wxgui: Upgraded to wxWidgets 2.8.10.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1494 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-12 04:56:57 +00:00
parent 32233c1509
commit ec10451047
132 changed files with 2956 additions and 1457 deletions

View File

@ -3,7 +3,7 @@
// Purpose: declaration of wxAboutDialog class
// Author: Vadim Zeitlin
// Created: 2006-10-07
// RCS-ID: $Id: aboutdlg.h 41813 2006-10-09 16:56:18Z RD $
// RCS-ID: $Id: aboutdlg.h 58748 2009-02-08 09:46:03Z VZ $
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -128,6 +128,12 @@ public:
// artists and translators) as a one long multiline string
wxString GetDescriptionAndCredits() const;
#if wxABI_VERSION >= 20810
// returns the copyright with the (C) string substituted by the Unicode
// character U+00A9
wxString GetCopyrightToDisplay() const;
#endif // wx 2.8.10+
private:
wxString m_name,
m_version,

View File

@ -4,7 +4,7 @@
// Author: Mattia Barbon and Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// RCS-ID: $Id: arrstr.h 33888 2005-04-26 19:24:12Z MBN $
// RCS-ID: $Id: arrstr.h 56758 2008-11-13 22:32:21Z VS $
// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -364,6 +364,11 @@ public:
m_strings[i] = m_array[i];
return m_strings;
}
#if wxABI_VERSION >= 20810
wxString* Release();
#endif // wxABI_VERSION >= 20810
private:
const wxArrayString& m_array;
wxString* m_strings;

View File

@ -4,7 +4,7 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 18/03/2002
// RCS-ID: $Id: artprov.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: artprov.h 57701 2008-12-31 23:40:06Z VS $
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -122,6 +122,10 @@ public:
// Add new provider to the bottom of providers stack (i.e. the provider
// will be queried as the last one).
#if wxABI_VERSION >= 20810
static void PushBack(wxArtProvider *provider);
#endif
// same as PushBack()
static void Insert(wxArtProvider *provider);
// Remove latest added provider and delete it.

View File

@ -4,7 +4,7 @@
// Author: Benjamin I. Williams
// Modified by:
// Created: 2005-05-17
// RCS-ID: $Id: aui.h 40232 2006-07-22 13:14:07Z BIW $
// RCS-ID: $Id: aui.h 55195 2008-08-23 06:31:01Z BIW $
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
@ -15,6 +15,7 @@
#include "wx/aui/framemanager.h"
#include "wx/aui/dockart.h"
#include "wx/aui/floatpane.h"
#include "wx/aui/auibar.h"
#include "wx/aui/auibook.h"
#include "wx/aui/tabmdi.h"

View File

@ -469,15 +469,17 @@ protected:
void OnRightDown(wxMouseEvent& evt);
void OnRightUp(wxMouseEvent& evt);
void OnLeftDClick(wxMouseEvent& evt);
void OnSetFocus(wxFocusEvent& event);
void OnKillFocus(wxFocusEvent& event);
void OnChar(wxKeyEvent& event);
void OnSetFocus(wxFocusEvent& evt);
void OnKillFocus(wxFocusEvent& evt);
void OnChar(wxKeyEvent& evt);
#endif
#if wxABI_VERSION >= 20809
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
#endif
void OnMotion(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnButton(wxAuiNotebookEvent& evt);
protected:
wxPoint m_click_pt;

View File

@ -4,7 +4,7 @@
// Author: Benjamin I. Williams
// Modified by:
// Created: 2005-05-17
// RCS-ID: $Id: framemanager.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: framemanager.h 57885 2009-01-07 14:51:49Z JS $
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
@ -47,6 +47,7 @@ enum wxAuiManagerOption
wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
wxAUI_MGR_HINT_FADE = 1 << 6,
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
wxAUI_MGR_LIVE_RESIZE = 1 << 8,
wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
@ -166,7 +167,7 @@ public:
}
~wxAuiPaneInfo() {}
#ifndef SWIG
wxAuiPaneInfo(const wxAuiPaneInfo& c)
{
@ -350,12 +351,12 @@ public:
#ifdef SWIG
%typemap(out) wxAuiPaneInfo& ;
#endif
public:
// NOTE: You can add and subtract flags from this list,
// but do not change the values of the flags, because
// they are stored in a binary integer format in the
// they are stored in a binary integer format in the
// perspective string. If you really need to change the
// values around, you'll have to ensure backwards-compatibility
// in the perspective loading code.
@ -384,11 +385,11 @@ public:
buttonMaximize = 1 << 22,
buttonMinimize = 1 << 23,
buttonPin = 1 << 24,
buttonCustom1 = 1 << 26,
buttonCustom2 = 1 << 27,
buttonCustom3 = 1 << 28,
savedHiddenState = 1 << 30, // used internally
actionPane = 1 << 31 // used internally
};
@ -451,7 +452,7 @@ public:
bool AddPane(wxWindow* window,
const wxAuiPaneInfo& pane_info);
bool AddPane(wxWindow* window,
const wxAuiPaneInfo& pane_info,
const wxPoint& drop_pos);
@ -465,7 +466,7 @@ public:
int insert_level = wxAUI_INSERT_PANE);
bool DetachPane(wxWindow* window);
void Update();
wxString SavePaneInfo(wxAuiPaneInfo& pane);
@ -475,7 +476,7 @@ public:
void SetDockSizeConstraint(double width_pct, double height_pct);
void GetDockSizeConstraint(double* width_pct, double* height_pct) const;
void ClosePane(wxAuiPaneInfo& pane_info);
void MaximizePane(wxAuiPaneInfo& pane_info);
void RestorePane(wxAuiPaneInfo& pane_info);
@ -493,12 +494,12 @@ public:
wxWindow* pane_window,
const wxPoint& pt,
const wxPoint& offset);
void DrawHintRect(
wxWindow* pane_window,
const wxPoint& pt,
const wxPoint& offset);
virtual void ShowHint(const wxRect& rect);
virtual void HideHint();
@ -506,14 +507,14 @@ public:
// deprecated -- please use SetManagedWindow() and
// and GetManagedWindow() instead
wxDEPRECATED( void SetFrame(wxFrame* frame) );
wxDEPRECATED( wxFrame* GetFrame() const );
protected:
void UpdateHintWindowConfig();
void DoFrameLayout();
void LayoutAddPane(wxSizer* container,
@ -559,6 +560,10 @@ protected:
wxArrayInt& positions,
wxArrayInt& sizes);
#if wxABI_VERSION >= 20810
/// Ends a resize action, or for live update, resizes the sash
bool DoEndResizeAction(wxMouseEvent& event);
#endif
public:
@ -623,7 +628,7 @@ protected:
wxTimer m_hint_fadetimer; // transparent fade timer
wxByte m_hint_fadeamt; // transparent fade amount
wxByte m_hint_fademax; // maximum value of hint fade
void* m_reserved;
#ifndef SWIG
@ -665,17 +670,17 @@ public:
void SetPane(wxAuiPaneInfo* p) { pane = p; }
void SetButton(int b) { button = b; }
void SetDC(wxDC* pdc) { dc = pdc; }
wxAuiManager* GetManager() const { return manager; }
wxAuiPaneInfo* GetPane() const { return pane; }
int GetButton() const { return button; }
wxDC* GetDC() const { return dc; }
void Veto(bool veto = true) { veto_flag = veto; }
bool GetVeto() const { return veto_flag; }
void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
bool CanVeto() const { return canveto_flag && veto_flag; }
public:
wxAuiManager* manager;
wxAuiPaneInfo* pane;

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
// Created: 15.09.04
// RCS-ID: $Id: choicebk.h 49804 2007-11-10 01:09:42Z VZ $
// RCS-ID: $Id: choicebk.h 56623 2008-10-31 23:07:49Z VZ $
// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -93,7 +93,7 @@ protected:
void UpdateSelectedPage(size_t newsel)
{
m_selection = newsel;
m_selection = wx_static_cast(int, newsel);
GetChoiceCtrl()->Select(newsel);
}

View File

@ -5,7 +5,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 10.02.99
// RCS-ID: $Id: datetime.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: datetime.h 57502 2008-12-22 19:52:20Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -577,7 +577,7 @@ public:
// ------------------------------------------------------------------------
// default ctor does not initialize the object, use Set()!
wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); }
wxDateTime() { m_time = wxLongLong((wxInt32)UINT_MAX, UINT_MAX); }
// from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
@ -1100,13 +1100,8 @@ public:
// another one to get the current time broken down
static struct tm *GetTmNow()
{
#ifdef __WXWINCE__
static struct tm l_CurrentTime;
return GetTmNow(&l_CurrentTime);
#else
time_t t = GetTimeNow();
return localtime(&t);
#endif
}
// get current time using thread-safe function

View File

@ -17,7 +17,7 @@
// databases operate the same in that respect
//
// Created: 9.96
// RCS-ID: $Id: db.h 45498 2007-04-16 13:03:05Z VZ $
// RCS-ID: $Id: db.h 56697 2008-11-07 22:45:47Z VZ $
// Copyright: (c) 1996 Remstar International, Inc.
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -78,10 +78,15 @@
// defined in many other places on other systems (Motif, at least on
// OpenVMS; Cocoa and X11) so prevent the problem by defining it before
// including these headers
#define BOOL int
#include <sql.h>
#include <sqlext.h>
#undef BOOL
#ifndef BOOL
#define BOOL int
#include <sql.h>
#include <sqlext.h>
#undef BOOL
#else
#include <sql.h>
#include <sqlext.h>
#endif
#endif // wxUSE_BUILTIN_IODBC/!wxUSE_BUILTIN_IODBC
}
#endif

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
// RCS-ID: $Id: dc.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: dc.h 55927 2008-09-28 09:12:16Z VS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -466,7 +466,6 @@ public:
bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{ return DoGetPartialTextExtents(text, widths); }
// size and resolution
// -------------------
@ -793,6 +792,13 @@ protected:
virtual void DoDrawSpline(wxList *points);
#endif
#if wxABI_VERSION >= 20810
// returns adjustment factor for converting wxFont "point size"; in wx
// it is point size on screen and needs to be multiplied by this value
// for rendering on higher-resolution DCs such as printer ones
static float GetFontPointSizeAdjustment(float dpi);
#endif
protected:
// unset clipping variables (after clipping region was destroyed)
void ResetClipping()

View File

@ -4,7 +4,7 @@
* Author: Vadim Zeitlin
* Modified by: Ryan Norton (Converted to C)
* Created: 29/01/98
* RCS-ID: $Id: debug.h 53711 2008-05-22 22:58:28Z SN $
* RCS-ID: $Id: debug.h 54492 2008-07-05 17:54:03Z SN $
* Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
* Licence: wxWindows licence
*/
@ -190,6 +190,17 @@
/* as wxCHECK2 but with a message explaining why we fail */
#ifdef __GNUC__
#define wxFORCE_SEMICOLON typedef int wxDummyCheckInt
/* Note: old gcc versions (e.g. 2.8) give an internal compiler error */
/* on a simple forward declaration, when used in a template */
/* function, so rather use a dummy typedef which does work... */
#else
#define wxFORCE_SEMICOLON struct wxDummyCheckStruct
/* Note2: however, some other compilers (notably Digital Mars */
/* don't like multiple typedefs (even though the standard */
/* does allow them), so use a forward declaration for non-gcc. */
#endif
/* see comment near the definition of wxASSERT_MSG for the # if/else reason */
#if defined(__MWERKS__)
#define wxCHECK2_MSG(cond, op, msg) \
@ -210,10 +221,7 @@
wxFAIL_COND_MSG(#cond, msg); \
op; \
} \
typedef int wxDummyCheckInt /* just to force a semicolon */
/* NB: old gcc versions (e.g. 2.8) give an internal compiler error */
/* on a simple forward declaration, when used in a template */
/* function, so rather use a dummy typedef which does work... */
wxFORCE_SEMICOLON /* just to force a semicolon */
#endif
/* special form of wxCHECK2: as wxCHECK, but for use in void functions */

View File

@ -4,7 +4,7 @@
// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik
// Modified by:
// Created: 20/07/98
// RCS-ID: $Id: dynlib.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: dynlib.h 58750 2009-02-08 10:01:03Z VZ $
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -76,6 +76,18 @@ enum wxDLFlags
wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded
// (only for wxPluginManager)
wxDL_QUIET = 0x00000020, // don't log an error if failed to load
#if wxABI_VERSION >= 20810
// this flag is dangerous, for internal use of wxMSW only, don't use at all
// and especially don't use directly, use wxLoadedDLL instead if you really
// do need it
wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already
// loaded DLL or NULL otherwise; Unload()
// should not be called so don't forget to
// Detach() if you use this function
#endif // wx 2.8.10+
wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32
};
@ -309,6 +321,28 @@ protected:
DECLARE_NO_COPY_CLASS(wxDynamicLibrary)
};
#if defined(__WXMSW__) && wxABI_VERSION >= 20810
// ----------------------------------------------------------------------------
// wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind
// to a DLL already loaded into the project address space
// ----------------------------------------------------------------------------
class wxLoadedDLL : public wxDynamicLibrary
{
public:
wxLoadedDLL(const wxString& dllname)
: wxDynamicLibrary(dllname, wxDL_GET_LOADED | wxDL_VERBATIM | wxDL_QUIET)
{
}
~wxLoadedDLL()
{
Detach();
}
};
#endif // __WXMSW__
// ----------------------------------------------------------------------------
// Interesting defines

View File

@ -4,7 +4,7 @@
// Author: Julian Smart and Guillermo Rodriguez Garcia
// Modified by: Francesco Montorsi
// Created: 13/8/99
// RCS-ID: $Id: animate.h 43898 2006-12-10 14:18:37Z VZ $
// RCS-ID: $Id: animate.h 58350 2009-01-24 10:00:38Z FM $
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -23,6 +23,11 @@ WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDL
class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase
{
public:
#if wxABI_VERSION >= 20810
wxAnimation() {}
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
{ LoadFile(name, type); }
#endif
virtual bool IsOk() const
{ return m_refData != NULL; }

View File

@ -5,7 +5,7 @@
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// RCS-ID: $Id: clrpickerg.h 40322 2006-07-25 11:41:53Z ABX $
// RCS-ID: $Id: clrpickerg.h 58967 2009-02-17 13:31:28Z SC $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
@ -25,8 +25,18 @@
// the default style
#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
#ifndef wxCLRBTN_USES_BMP_BUTTON
#define wxCLRBTN_USES_BMP_BUTTON 0
#endif
class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton,
#if wxCLRBTN_USES_BMP_BUTTON
#include "wx/bmpbutton.h"
#define wxCLRBTN_BASE_CLASS wxBitmapButton
#else
#define wxCLRBTN_BASE_CLASS wxButton
#endif
class WXDLLIMPEXP_CORE wxGenericColourButton : public wxCLRBTN_BASE_CLASS,
public wxColourPickerWidgetBase
{
public:

View File

@ -4,7 +4,7 @@
// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
// Modified by: Santiago Palacios
// Created: 1/08/1999
// RCS-ID: $Id: grid.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: grid.h 55568 2008-09-12 12:49:11Z VZ $
// Copyright: (c) Michael Bedward
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -2256,7 +2256,7 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat
#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn)
#define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn)
#define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn)
#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_MOVE, id, fn)
#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDEVT(COL_MOVE, id, fn)
#define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn)
#define EVT_GRID_CMD_CELL_CHANGE(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGE, id, fn)
#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn)

View File

@ -5,7 +5,7 @@
// Modified by:
// Created:
// Copyright: (c) Stefan Csomor
// RCS-ID: $Id: graphics.h 50671 2007-12-12 20:19:36Z MR $
// RCS-ID: $Id: graphics.h 57953 2009-01-09 18:46:48Z SC $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -29,6 +29,7 @@ class WXDLLIMPEXP_CORE wxGraphicsRenderer;
class WXDLLIMPEXP_CORE wxGraphicsPen;
class WXDLLIMPEXP_CORE wxGraphicsBrush;
class WXDLLIMPEXP_CORE wxGraphicsFont;
class WXDLLIMPEXP_CORE wxGraphicsBitmap;
/*
* notes about the graphics context apis
@ -63,6 +64,10 @@ class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject
{
public :
wxGraphicsObject() ;
#if wxABI_VERSION >= 20810
wxGraphicsObject( const wxGraphicsObject& other) : wxObject( other ) {}
wxGraphicsObject& operator= (const wxGraphicsObject & other) { Ref(other); return *this;}
#endif
wxGraphicsObject( wxGraphicsRenderer* renderer ) ;
virtual ~wxGraphicsObject() ;
@ -82,6 +87,10 @@ class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject
{
public :
wxGraphicsPen() {}
#if wxABI_VERSION >= 20810
wxGraphicsPen( const wxGraphicsPen& other) : wxGraphicsObject( other ) {}
wxGraphicsPen& operator= (const wxGraphicsPen & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsPen() {}
private :
DECLARE_DYNAMIC_CLASS(wxGraphicsPen)
@ -93,6 +102,10 @@ class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject
{
public :
wxGraphicsBrush() {}
#if wxABI_VERSION >= 20810
wxGraphicsBrush( const wxGraphicsBrush& other) : wxGraphicsObject( other ) {}
wxGraphicsBrush& operator= (const wxGraphicsBrush & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsBrush() {}
private :
DECLARE_DYNAMIC_CLASS(wxGraphicsBrush)
@ -104,6 +117,10 @@ class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject
{
public :
wxGraphicsFont() {}
#if wxABI_VERSION >= 20810
wxGraphicsFont( const wxGraphicsFont& other) : wxGraphicsObject( other ) {}
wxGraphicsFont& operator= (const wxGraphicsFont & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsFont() {}
private :
DECLARE_DYNAMIC_CLASS(wxGraphicsFont)
@ -111,6 +128,20 @@ private :
extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont;
class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject
{
public :
wxGraphicsBitmap() {}
#if wxABI_VERSION >= 20810
wxGraphicsBitmap( const wxGraphicsBitmap& other) : wxGraphicsObject( other ) {}
wxGraphicsBitmap& operator= (const wxGraphicsBitmap & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsBitmap() {}
private :
DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap)
} ;
extern WXDLLEXPORT_DATA(wxGraphicsBitmap) wxNullGraphicsBitmap;
class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData
{
@ -171,6 +202,10 @@ class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject
{
public :
wxGraphicsMatrix() {}
#if wxABI_VERSION >= 20810
wxGraphicsMatrix( const wxGraphicsMatrix& other) : wxGraphicsObject( other ) {}
wxGraphicsMatrix& operator= (const wxGraphicsMatrix & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsMatrix() {}
@ -306,6 +341,10 @@ class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject
{
public :
wxGraphicsPath() {}
#if wxABI_VERSION >= 20810
wxGraphicsPath( const wxGraphicsPath& other) : wxGraphicsObject( other ) {}
wxGraphicsPath& operator= (const wxGraphicsPath & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsPath() {}
//
@ -428,6 +467,12 @@ public:
// sets the font
virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const;
#if wxABI_VERSION >= 20809
wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const;
#endif
//virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const;
// create a 'native' matrix corresponding to these values
virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
@ -527,7 +572,10 @@ public:
//
// image support
//
#if wxABI_VERSION >= 20809
void DrawGraphicsBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
#endif
virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
@ -584,6 +632,10 @@ class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject
{
public :
wxGraphicsFigure(wxGraphicsRenderer* renderer) ;
#if wxABI_VERSION >= 20810
wxGraphicsFigure( const wxGraphicsFigure& other) : wxGraphicsObject( other ) {}
wxGraphicsFigure& operator= (const wxGraphicsFigure & other) { Ref(other); return *this;}
#endif
virtual ~wxGraphicsFigure() ;
@ -666,6 +718,10 @@ public :
// sets the font
virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0;
#if wxABI_VERSION >= 20809
wxGraphicsBitmap CreateBitmap( const wxBitmap &bmp );
#endif
private :
DECLARE_NO_COPY_CLASS(wxGraphicsRenderer)
DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer)

View File

@ -4,7 +4,7 @@
// Author: Mattia Barbon
// Modified by:
// Created: 29/01/2002
// RCS-ID: $Id: hashmap.h 45498 2007-04-16 13:03:05Z VZ $
// RCS-ID: $Id: hashmap.h 57388 2008-12-17 09:34:48Z VZ $
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -14,12 +14,34 @@
#include "wx/string.h"
// In wxUSE_STL build we prefer to use the standard hash map class but it can
// be either in non-standard hash_map header (old g++ and some other STL
// implementations) or in C++0x standard unordered_map which can in turn be
// available either in std::tr1 or std namespace itself
//
// To summarize: if std::unordered_map is available use it, otherwise use tr1
// and finally fall back to non-standard hash_map
#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \
&& (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP))
#define HAVE_STL_HASH_MAP
#endif
#if wxUSE_STL && defined(HAVE_STL_HASH_MAP)
#if wxUSE_STL && \
(defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP))
#if defined(HAVE_STD_UNORDERED_MAP)
#include <unordered_map>
#define WX_HASH_MAP_NAMESPACE std
#elif defined(HAVE_TR1_UNORDERED_MAP)
#include <tr1/unordered_map>
#define WX_HASH_MAP_NAMESPACE std::tr1
#endif
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP)
#if defined(HAVE_EXT_HASH_MAP)
#include <ext/hash_map>
@ -36,8 +58,9 @@
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#else // !wxUSE_STL || no std::{hash,unordered}_map class available
#define wxNEEDS_WX_HASH_MAP
#ifdef __WXWINCE__
typedef int ptrdiff_t;
@ -442,7 +465,7 @@ inline bool grow_lf70( size_t buckets, size_t items )
return float(items)/float(buckets) >= 0.85;
}
#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#endif // various hash map implementations
// ----------------------------------------------------------------------------
// hashing and comparison functors
@ -452,7 +475,7 @@ inline bool grow_lf70( size_t buckets, size_t items )
// operators to suppress warnings about "statement with no effect" from gcc
// in the hash table class assignment operator (where they're assigned)
#if wxUSE_STL && defined(HAVE_STL_HASH_MAP)
#ifndef wxNEEDS_WX_HASH_MAP
// integer types
class WXDLLIMPEXP_BASE wxIntegerHash
@ -496,7 +519,7 @@ public:
wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
};
#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#else // wxNEEDS_WX_HASH_MAP
// integer types
class WXDLLIMPEXP_BASE wxIntegerHash
@ -517,7 +540,7 @@ public:
wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
};
#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP
class WXDLLIMPEXP_BASE wxIntegerEqual
{
@ -543,8 +566,8 @@ class WXDLLIMPEXP_BASE wxPointerHash
public:
wxPointerHash() { }
#if wxUSE_STL && defined(HAVE_STL_HASH_MAP)
size_t operator()( const void* k ) const { return (size_t)k; }
#ifdef wxNEEDS_WX_HASH_MAP
wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); }
#else
wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); }
#endif
@ -596,7 +619,7 @@ public:
wxStringEqual& operator=(const wxStringEqual&) { return *this; }
};
#if !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#ifdef wxNEEDS_WX_HASH_MAP
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \
@ -637,8 +660,6 @@ public: \
Node *node = GetOrCreateNode( \
CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \
created); \
if ( !created ) \
node->m_value.second = v.second; \
return Insert_Result(iterator(node, this), created); \
} \
\
@ -655,7 +676,7 @@ public: \
} \
}
#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP)
#endif // wxNEEDS_WX_HASH_MAP
// these macros are to be used in the user code
#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \

View File

@ -4,7 +4,7 @@
// Author: Mattia Barbon
// Modified by:
// Created: 11/08/2003
// RCS-ID: $Id: hashset.h 49056 2007-10-05 22:42:35Z VS $
// RCS-ID: $Id: hashset.h 55215 2008-08-23 18:54:04Z VZ $
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -14,7 +14,25 @@
#include "wx/hashmap.h"
#if wxUSE_STL && defined(HAVE_STL_HASH_MAP)
// see comment in wx/hashmap.h which also applies to different standard hash
// set classes
#if wxUSE_STL && \
(defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET))
#if defined(HAVE_STD_UNORDERED_SET)
#include <unordered_set>
#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\
typedef std::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME
#elif defined(HAVE_TR1_UNORDERED_SET)
#include <tr1/unordered_set>
#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\
typedef std::tr1::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME
#else
#error Update this code: unordered_set is available, but I do not know where.
#endif
#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP)
#if defined(HAVE_EXT_HASH_MAP)
#include <ext/hash_set>

View File

@ -2,7 +2,7 @@
// Name: winpars.h
// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow)
// Author: Vaclav Slavik
// RCS-ID: $Id: winpars.h 53457 2008-05-05 10:53:58Z VS $
// RCS-ID: $Id: winpars.h 59260 2009-03-02 10:43:00Z VS $
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -24,6 +24,7 @@ class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface;
class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser;
class WXDLLIMPEXP_FWD_HTML wxHtmlWinTagHandler;
class WXDLLIMPEXP_FWD_HTML wxHtmlTagsModule;
struct wxHtmlWinParser_TextParsingState;
//--------------------------------------------------------------------------------
@ -221,22 +222,10 @@ private:
wxEncodingConverter *m_EncConv;
#endif
struct TextParsingState
{
// current whitespace handling mode
WhitespaceMode m_whitespaceMode;
wxHtmlWordCell *m_lastWordCell;
// current position on line, in num. of characters; used to properly
// expand TABs; only updated while inside <pre>
int m_posColumn;
};
// NB: this pointer replaces m_lastWordCell pointer in wx<=2.8.7; this
// way, wxHtmlWinParser remains ABI compatible with older versions
// despite addition of two fields in TextParsingState
TextParsingState *m_textParsingState;
// despite addition of two fields in wxHtmlWinParser_TextParsingState
wxHtmlWinParser_TextParsingState *m_textParsingState;
DECLARE_NO_COPY_CLASS(wxHtmlWinParser)
};

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
// Created: 29/01/98
// RCS-ID: $Id: list.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: list.h 58742 2009-02-07 23:46:53Z VZ $
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -296,7 +296,7 @@ private:
push_front( e ); \
return compatibility_iterator( this, begin() ); \
} \
compatibility_iterator Insert( compatibility_iterator & i, elT e ) \
compatibility_iterator Insert(const compatibility_iterator &i, elT e) \
{ \
return compatibility_iterator( this, insert( i.m_iter, e ) ); \
} \
@ -1035,18 +1035,22 @@ private:
} \
iterator insert(const iterator& it, const_reference v = value_type())\
{ \
Insert(it.m_node, (const_base_reference)v); \
return iterator(it.m_node->GetPrevious(), GetLast()); \
if ( it == end() ) \
Append((const_base_reference)v); \
else \
Insert(it.m_node, (const_base_reference)v); \
iterator itprev(it); \
return itprev--; \
} \
void insert(const iterator& it, size_type n, const_reference v = value_type())\
{ \
for(size_type i = 0; i < n; ++i) \
Insert(it.m_node, (const_base_reference)v); \
insert(it, v); \
} \
void insert(const iterator& it, const_iterator first, const const_iterator& last)\
{ \
for(; first != last; ++first) \
Insert(it.m_node, (const_base_reference)*first); \
insert(it, *first); \
} \
iterator erase(const iterator& it) \
{ \
@ -1055,7 +1059,9 @@ private:
} \
iterator erase(const iterator& first, const iterator& last) \
{ \
iterator next = last; ++next; \
iterator next = last; \
if ( next != end() ) \
++next; \
DeleteNodes(first.m_node, last.m_node); \
return next; \
} \
@ -1066,10 +1072,11 @@ private:
{ splice(it, l, l.begin(), l.end() ); } \
void splice(const iterator& it, name& l, const iterator& first) \
{ \
iterator tmp = first; ++tmp; \
if(it == first || it == tmp) return; \
insert(it, *first); \
l.erase(first); \
if ( it != first ) \
{ \
insert(it, *first); \
l.erase(first); \
} \
} \
void remove(const_reference v) \
{ DeleteObject((const_base_reference)v); } \

View File

@ -5,7 +5,7 @@
// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin
// Modified by:
// Created: 10.02.99
// RCS-ID: $Id: longlong.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: longlong.h 54663 2008-07-16 15:22:22Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -113,9 +113,9 @@ public:
// from long long
wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { }
// from 2 longs
wxLongLongNative(long hi, unsigned long lo) : m_ll(0)
wxLongLongNative(wxInt32 hi, wxUint32 lo)
{
// assign first to avoid precision loss!
// cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxLongLong_t) hi) << 32;
m_ll |= (wxLongLong_t) lo;
}
@ -160,11 +160,11 @@ public:
// accessors
// get high part
long GetHi() const
{ return wx_truncate_cast(long, m_ll >> 32); }
wxInt32 GetHi() const
{ return wx_truncate_cast(wxInt32, m_ll >> 32); }
// get low part
unsigned long GetLo() const
{ return wx_truncate_cast(unsigned long, m_ll); }
wxUint32 GetLo() const
{ return wx_truncate_cast(wxUint32, m_ll); }
// get absolute value
wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
@ -350,9 +350,9 @@ public:
// from long long
wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { }
// from 2 longs
wxULongLongNative(unsigned long hi, unsigned long lo) : m_ll(0)
wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0)
{
// assign first to avoid precision loss!
// cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxULongLong_t) hi) << 32;
m_ll |= (wxULongLong_t) lo;
}
@ -392,11 +392,11 @@ public:
// accessors
// get high part
unsigned long GetHi() const
{ return wx_truncate_cast(unsigned long, m_ll >> 32); }
wxUint32 GetHi() const
{ return wx_truncate_cast(wxUint32, m_ll >> 32); }
// get low part
unsigned long GetLo() const
{ return wx_truncate_cast(unsigned long, m_ll); }
wxUint32 GetLo() const
{ return wx_truncate_cast(wxUint32, m_ll); }
// convert to native ulong long
wxULongLong_t GetValue() const { return m_ll; }

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by: Agron Selimaj
// Created: 01/02/97
// RCS-ID: $Id: listctrl.h 51773 2008-02-13 22:46:30Z VZ $
// RCS-ID: $Id: listctrl.h 54419 2008-06-29 01:35:24Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -12,7 +12,6 @@
#ifndef _WX_LISTCTRL_H_
#define _WX_LISTCTRL_H_
#include "wx/dcbuffer.h"
#include "wx/textctrl.h"
class WXDLLIMPEXP_FWD_CORE wxImageList;
@ -342,7 +341,6 @@ public:
bool SortItems(wxListCtrlCompare fn, long data);
// IMPLEMENTATION
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
virtual bool MSWShouldPreProcessMessage(WXMSG* msg);
@ -437,6 +435,11 @@ private:
// UpdateStyle()), only should be called if InReportView()
void MSWSetExListStyles();
// initialize the (already created) m_textCtrl with the associated HWND
void InitEditControl(WXHWND hWnd);
// destroy m_textCtrl if it's currently valid and reset it to NULL
void DeleteEditControl();
DECLARE_DYNAMIC_CLASS(wxListCtrl)
DECLARE_EVENT_TABLE()

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 11.07.97
// RCS-ID: $Id: uuid.h 35650 2005-09-23 12:56:45Z MR $
// RCS-ID: $Id: uuid.h 55113 2008-08-18 11:30:10Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
//
@ -74,6 +74,12 @@ public:
bool Set(const wxChar *pc); // from a string, returns true if ok
void Set(const UUID& uuid); // from another UUID (never fails)
#if wxABI_VERSION >= 20809
// comparison operators
bool operator==(const Uuid& uuid) const;
bool operator!=(const Uuid& uuid) const;
#endif // wxABI_VERSION >= 2.8.9
// accessors
operator const UUID*() const { return &m_uuid; }
operator const wxChar*() const { return (wxChar *)(m_pszUuid); }

View File

@ -1158,19 +1158,19 @@
#define wxUSE_LIBJPEG 1
// Set to 1 for TIFF format support (requires libtiff)
#define wxUSE_LIBTIFF 1
#define wxUSE_LIBTIFF 0
// Set to 1 for TGA format support (loading only)
#define wxUSE_TGA 1
// Set to 1 for GIF format support
#define wxUSE_GIF 1
#define wxUSE_GIF 0
// Set to 1 for PNM format support
#define wxUSE_PNM 1
// Set to 1 for PCX format support
#define wxUSE_PCX 1
#define wxUSE_PCX 0
// Set to 1 for IFF format support (Amiga format)
#define wxUSE_IFF 0

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: tbar95.h 44317 2007-01-25 23:35:07Z RD $
// RCS-ID: $Id: tbar95.h 58446 2009-01-26 23:32:16Z VS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -142,6 +142,9 @@ protected:
wxToolBarToolBase *m_pInTool;
private:
// makes sure tool bitmap size is sufficient for all tools
void AdjustToolBitmapSize();
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxToolBar)
DECLARE_NO_COPY_CLASS(wxToolBar)

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-03-07
// RCS-ID: $Id: chkconf.h 40023 2006-07-06 07:07:52Z ABX $
// RCS-ID: $Id: chkconf.h 55651 2008-09-16 08:03:55Z VZ $
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -29,6 +29,16 @@
#undef wxUSE_IPC
#define wxUSE_IPC 0
// no AUI under CE: it's unnecessary and currently doesn't compile
#undef wxUSE_AUI
#define wxUSE_AUI 0
// no MDI under CE
#undef wxUSE_MDI
#define wxUSE_MDI 0
#undef wxUSE_MDI_ARCHITECTURE
#define wxUSE_MDI_ARCHITECTURE 0
// metafiles are not supported neither
#undef wxUSE_ENH_METAFILE
#define wxUSE_ENH_METAFILE 0

View File

@ -1,4 +1,5 @@
// Copyright 1998, Ben Goetter. All rights reserved.
// Also released under wxWindows license - see src/msw/wince/net.cpp
/*
patch holes in winsock

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: prntbase.h 49563 2007-10-31 20:46:21Z VZ $
// RCS-ID: $Id: prntbase.h 54404 2008-06-28 15:32:52Z VS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -575,6 +575,10 @@ protected:
private:
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
// helpers for RenderPage():
bool RenderPageIntoDC(wxDC& dc, int pageNum);
bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
DECLARE_NO_COPY_CLASS(wxPrintPreviewBase)
DECLARE_CLASS(wxPrintPreviewBase)
};

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 10.09.00
// RCS-ID: $Id: radiobox.h 50255 2007-11-26 13:48:36Z VZ $
// RCS-ID: $Id: radiobox.h 54930 2008-08-02 19:45:23Z VZ $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -49,7 +49,8 @@ public:
unsigned int GetColumnCount() const { return m_numCols; }
unsigned int GetRowCount() const { return m_numRows; }
// return the item above/below/to the left/right of the given one
// return the next active (i.e. shown and not disabled) item above/below/to
// the left/right of the given one
int GetNextItem(int item, wxDirection dir, long style) const;
#if wxUSE_TOOLTIPS

View File

@ -4,7 +4,7 @@
// Author: Karsten Ballueder
// Modified by: VZ at 13.07.01 (integrated to wxWin)
// Created: 05.02.2000
// RCS-ID: $Id: regex.h 53135 2008-04-12 02:31:04Z VZ $
// RCS-ID: $Id: regex.h 57779 2009-01-02 17:35:16Z PC $
// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -16,7 +16,7 @@
#if wxUSE_REGEX
class WXDLLIMPEXP_FWD_BASE wxString;
#include "wx/string.h"
// ----------------------------------------------------------------------------
// constants

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
// RCS-ID: $Id: richtextbuffer.h 53671 2008-05-20 13:23:07Z JS $
// RCS-ID: $Id: richtextbuffer.h 58841 2009-02-12 10:16:07Z JS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -73,7 +73,11 @@
// Setting wxRICHTEXT_USE_OWN_CARET to 1 implements a non-flashing
// cursor reliably without using wxClientDC in case there
// are platform-specific problems with the generic caret.
#if defined(wxMAC_USE_CORE_GRAPHICS) && wxMAC_USE_CORE_GRAPHICS
#define wxRICHTEXT_USE_OWN_CARET 1
#else
#define wxRICHTEXT_USE_OWN_CARET 0
#endif
// Switch off for binary compatibility, on for faster drawing
#define wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING 0
@ -310,7 +314,7 @@ public:
void operator =(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; }
bool operator ==(const wxRichTextRange& range) const { return (m_start == range.m_start && m_end == range.m_end); }
bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start && m_end != range.m_end); }
bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start || m_end != range.m_end); }
wxRichTextRange operator -(const wxRichTextRange& range) const { return wxRichTextRange(m_start - range.m_start, m_end - range.m_end); }
wxRichTextRange operator +(const wxRichTextRange& range) const { return wxRichTextRange(m_start + range.m_start, m_end + range.m_end); }
@ -1067,7 +1071,7 @@ public:
virtual int GetParagraphLength(long paragraphNumber) const;
/// Get the number of paragraphs
virtual int GetParagraphCount() const { return GetChildCount(); }
virtual int GetParagraphCount() const { return wx_static_cast(int, GetChildCount()); }
/// Get the number of visible lines
virtual int GetLineCount() const;

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
// RCS-ID: $Id: richtextctrl.h 52136 2008-02-27 08:54:40Z JS $
// RCS-ID: $Id: richtextctrl.h 58256 2009-01-21 12:05:11Z JS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -38,6 +38,8 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
#define wxRE_READONLY 0x0010
#define wxRE_MULTILINE 0x0020
#define wxRE_CENTRE_CARET 0x8000
#define wxRE_CENTER_CARET wxRE_CENTRE_CARET
/* Flags
*/

View File

@ -3,7 +3,7 @@
// Purpose: Rich text printing classes
// Author: Julian Smart
// Created: 2006-10-23
// RCS-ID: $Id: richtextprint.h 43603 2006-11-22 17:11:53Z JS $
// RCS-ID: $Id: richtextprint.h 55146 2008-08-21 16:07:54Z JS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -119,7 +119,7 @@ public:
const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; }
/// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins.
void SetMargins(int top = 252, int bottom = 252, int left = 252, int right = 252);
void SetMargins(int top = 254, int bottom = 254, int left = 254, int right = 254);
/// Calculate scaling and rectangles, setting the device context scaling
void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect);

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 10/5/2006 3:11:58 PM
// RCS-ID: $Id: richtextsymboldlg.h 50950 2007-12-30 16:11:12Z JS $
// RCS-ID: $Id: richtextsymboldlg.h 58466 2009-01-27 19:19:40Z BP $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -43,7 +43,7 @@ class wxSymbolListCtrl;
*/
#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE _("Symbols")
#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE wxGetTranslation(wxT("Symbols"))
#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG
#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: settings.h 49563 2007-10-31 20:46:21Z VZ $
// RCS-ID: $Id: settings.h 57542 2008-12-25 13:03:24Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -79,6 +79,7 @@ enum wxSystemColour
wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
wxSYS_COLOUR_MENUHILIGHT,
wxSYS_COLOUR_MENUBAR,
wxSYS_COLOUR_LISTBOXTEXT,
wxSYS_COLOUR_MAX
};

View File

@ -999,7 +999,7 @@
//
// Recommended setting: 1, set to 0 if you want compile a
// smaller library.
#define wxUSE_RICHTEXT 0
#define wxUSE_RICHTEXT 1
// ----------------------------------------------------------------------------
// Data transfer
@ -1284,14 +1284,14 @@
//
// Recommended setting: 1, only set it to 0 if your compiler doesn't have
// or can't compile <richedit.h>
#define wxUSE_RICHEDIT 0
#define wxUSE_RICHEDIT 1
// Set this to 1 to use extra features of richedit v2 and later controls
//
// Default is 1 for compilers which support it
//
// Recommended setting: 1
#define wxUSE_RICHEDIT2 0
#define wxUSE_RICHEDIT2 1
// Set this to 1 to enable support for the owner-drawn menu and listboxes. This
// is required by wxUSE_CHECKLISTBOX.

View File

@ -1221,16 +1221,16 @@
#define wxUSE_LIBJPEG 1
// Set to 1 for TIFF format support (requires libtiff)
#define wxUSE_LIBTIFF 1
#define wxUSE_LIBTIFF 0
// Set to 1 for GIF format support
#define wxUSE_GIF 1
#define wxUSE_GIF 0
// Set to 1 for PNM format support
#define wxUSE_PNM 1
// Set to 1 for PCX format support
#define wxUSE_PCX 1
#define wxUSE_PCX 0
// Set to 1 for IFF format support (Amiga format)
#define wxUSE_IFF 0
@ -1289,8 +1289,8 @@
#define wxUSE_RICHEDIT2 0 // currently not supported
#else
#define wxUSE_RICHEDIT 0
#define wxUSE_RICHEDIT2 0
#define wxUSE_RICHEDIT 1
#define wxUSE_RICHEDIT2 1
#endif
// Set this to 1 to enable support for the owner-drawn menu and listboxes.

View File

@ -4,7 +4,7 @@
* Author: Julian Smart
* Modified by: Ryan Norton (Converted to C)
* Created: 29/01/98
* RCS-ID: $Id: version.h 53651 2008-05-19 19:09:22Z CE $
* RCS-ID: $Id: version.h 58872 2009-02-13 09:18:23Z CE $
* Copyright: (c) 1998 Julian Smart
* Licence: wxWindows licence
*/
@ -28,9 +28,9 @@
/* NB: this file is parsed by automatic tools so don't change its format! */
#define wxMAJOR_VERSION 2
#define wxMINOR_VERSION 8
#define wxRELEASE_NUMBER 8
#define wxRELEASE_NUMBER 10
#define wxSUBRELEASE_NUMBER 0
#define wxVERSION_STRING _T("wxWidgets 2.8.8")
#define wxVERSION_STRING _T("wxWidgets 2.8.10")
/* nothing to update below this line when updating the version */
/* ---------------------------------------------------------------------------- */

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by: Ron Lee
// Created: 01/02/97
// RCS-ID: $Id: window.h 52330 2008-03-05 14:19:38Z VS $
// RCS-ID: $Id: window.h 56758 2008-11-13 22:32:21Z VS $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -1004,14 +1004,21 @@ public:
void SetToolTip( const wxString &tip );
// attach a tooltip to the window
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
#if wxABI_VERSION >= 20809
// more readable synonym for SetToolTip(NULL)
void UnsetToolTip() { SetToolTip(NULL); }
#endif // wxABI_VERSION >= 2.8.9
// get the associated tooltip or NULL if none
wxToolTip* GetToolTip() const { return m_tooltip; }
wxString GetToolTipText() const ;
#else
#else // !wxUSE_TOOLTIPS
// make it much easier to compile apps in an environment
// that doesn't support tooltips, such as PocketPC
inline void SetToolTip( const wxString & WXUNUSED(tip) ) {}
#endif // wxUSE_TOOLTIPS
void SetToolTip( const wxString & WXUNUSED(tip) ) {}
#if wxABI_VERSION >= 20809
void UnsetToolTip() { }
#endif // wxABI_VERSION >= 2.8.9
#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS
// drag and drop
// -------------
@ -1020,6 +1027,14 @@ public:
// NULL; it's owned by the window and will be deleted by it)
virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
#ifndef __WXMSW__ // MSW version is in msw/window.h
#if wxABI_VERSION >= 20810
// Accept files for dragging
void DragAcceptFiles(bool accept);
#endif // wxABI_VERSION >= 20810
#endif // !__WXMSW__
#endif // wxUSE_DRAG_AND_DROP
// constraints and sizers

View File

@ -3,7 +3,7 @@
// Purpose: XML resources
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id: xmlres.h 49563 2007-10-31 20:46:21Z VZ $
// RCS-ID: $Id: xmlres.h 55504 2008-09-07 09:15:46Z VS $
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -128,8 +128,6 @@ public:
// Destructor.
virtual ~wxXmlResource();
wxXmlNode *GetFirstRoot();
// Loads resources from XML files that match given filemask.
// This method understands VFS (see filesys.h).
bool Load(const wxString& filemask);

View File

@ -4,7 +4,7 @@
// Author: Guilhem Lavaux
// Modified by: Mike Wetherell
// Created: 11/07/98
// RCS-ID: $Id: zstream.h 42713 2006-10-30 11:56:12Z ABX $
// RCS-ID: $Id: zstream.h 54688 2008-07-18 08:06:44Z MW $
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -125,11 +125,11 @@ public:
wxFilterInputStream *NewStream(wxInputStream& stream) const
{ return new wxZlibInputStream(stream); }
wxFilterOutputStream *NewStream(wxOutputStream& stream) const
{ return new wxZlibOutputStream(stream, -1); }
{ return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); }
wxFilterInputStream *NewStream(wxInputStream *stream) const
{ return new wxZlibInputStream(stream); }
wxFilterOutputStream *NewStream(wxOutputStream *stream) const
{ return new wxZlibOutputStream(stream, -1); }
{ return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); }
const wxChar * const *GetProtocols(wxStreamProtocolType type
= wxSTREAM_PROTOCOL) const;

View File

@ -1158,19 +1158,19 @@
#define wxUSE_LIBJPEG 1
// Set to 1 for TIFF format support (requires libtiff)
#define wxUSE_LIBTIFF 1
#define wxUSE_LIBTIFF 0
// Set to 1 for TGA format support (loading only)
#define wxUSE_TGA 1
// Set to 1 for GIF format support
#define wxUSE_GIF 1
#define wxUSE_GIF 0
// Set to 1 for PNM format support
#define wxUSE_PNM 1
// Set to 1 for PCX format support
#define wxUSE_PCX 1
#define wxUSE_PCX 0
// Set to 1 for IFF format support (Amiga format)
#define wxUSE_IFF 0

View File

@ -4,7 +4,7 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 18/03/2002
// RCS-ID: $Id: artprov.cpp 41398 2006-09-23 20:16:18Z VZ $
// RCS-ID: $Id: artprov.cpp 57701 2008-12-31 23:40:06Z VS $
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -30,6 +30,10 @@
#include "wx/module.h"
#endif
#ifdef __WXMSW__
#include "wx/msw/wrapwin.h"
#endif
// ===========================================================================
// implementation
// ===========================================================================
@ -135,6 +139,11 @@ wxArtProvider::~wxArtProvider()
sm_providers->Append(provider);
}
/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider)
{
Insert(provider);
}
/*static*/ bool wxArtProvider::Pop()
{
wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") );
@ -272,7 +281,14 @@ wxArtProvider::~wxArtProvider()
else if (client == wxART_MENU)
return wxSize(16, 15);
else if (client == wxART_FRAME_ICON)
return wxSize(16, 15);
{
#ifdef __WXMSW__
return wxSize(::GetSystemMetrics(SM_CXSMICON),
::GetSystemMetrics(SM_CYSMICON));
#else
return wxSize(16, 16);
#endif // __WXMSW__/!__WXMSW__
}
else if (client == wxART_CMN_DIALOG || client == wxART_MESSAGE_BOX)
return wxSize(32, 32);
else if (client == wxART_HELP_BROWSER)

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 05.01.00
// RCS-ID: $Id: cmdline.cpp 42197 2006-10-21 14:04:27Z VZ $
// RCS-ID: $Id: cmdline.cpp 54704 2008-07-19 01:53:04Z VZ $
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -1235,7 +1235,7 @@ wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p)
break;
}
lastBS = *p == _T('\\');
lastBS = !lastBS && *p == _T('\\');
arg += *p;
}

View File

@ -4,7 +4,7 @@
// Author: Jaakko Salli
// Modified by:
// Created: Apr-30-2006
// RCS-ID: $Id: combocmn.cpp 45512 2007-04-16 20:51:27Z RD $
// RCS-ID: $Id: combocmn.cpp 55201 2008-08-23 08:20:00Z RR $
// Copyright: (c) 2005 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -1138,6 +1138,8 @@ bool wxComboCtrlBase::Enable(bool enable)
m_btn->Enable(enable);
if ( m_text )
m_text->Enable(enable);
Refresh();
return true;
}
@ -1194,16 +1196,15 @@ void wxComboCtrlBase::SetValidator(const wxValidator& validator)
if ( textCtrl )
textCtrl->SetValidator( validator );
else
wxControl::SetValidator( validator );
}
wxValidator* wxComboCtrlBase::GetValidator()
{
wxTextCtrl* textCtrl = GetTextCtrl();
if ( textCtrl )
return textCtrl->GetValidator();
return wxControl::GetValidator();
return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator();
}
#endif // wxUSE_VALIDATORS

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 11.05.99
// RCS-ID: $Id: datetime.cpp 53900 2008-06-01 14:37:26Z VZ $
// RCS-ID: $Id: datetime.cpp 58486 2009-01-28 21:52:37Z VZ $
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// parts of code taken from sndcal library by Scott E. Lee:
//
@ -147,59 +147,26 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringCon
#if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM)
#if defined(__WXPALMOS__)
#define WX_GMTOFF_IN_TM
#elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
#elif defined(__WXMSW__)
static long wxGetTimeZone()
{
static long s_timezone = MAXLONG; // invalid timezone
if (s_timezone == MAXLONG)
{
TIME_ZONE_INFORMATION info;
GetTimeZoneInformation(&info);
s_timezone = info.Bias * 60; // convert minutes to seconds
}
return s_timezone;
}
#define WX_TIMEZONE wxGetTimeZone()
#elif defined(__VISAGECPP__)
#define WX_TIMEZONE _timezone
#elif defined(__MWERKS__)
long wxmw_timezone = 28800;
#define WX_TIMEZONE wxmw_timezone
#elif defined(__DJGPP__) || defined(__WINE__)
#include <sys/timeb.h>
#include <values.h>
static long wxGetTimeZone()
{
static long timezone = MAXLONG; // invalid timezone
if (timezone == MAXLONG)
{
struct timeb tb;
ftime(&tb);
timezone = tb.timezone;
}
return timezone;
}
#define WX_TIMEZONE wxGetTimeZone()
#elif defined(__DARWIN__)
#define WX_GMTOFF_IN_TM
#elif defined(__WXWINCE__) && defined(__VISUALC8__)
// _timezone is not present in dynamic run-time library
#if 0
// Solution (1): use the function equivalent of _timezone
static long wxGetTimeZone()
{
static long s_Timezone = MAXLONG; // invalid timezone
if (s_Timezone == MAXLONG)
{
int t;
_get_timezone(& t);
s_Timezone = (long) t;
}
return s_Timezone;
}
#define WX_TIMEZONE wxGetTimeZone()
#elif 1
// Solution (2): using GetTimeZoneInformation
static long wxGetTimeZone()
{
static long timezone = MAXLONG; // invalid timezone
if (timezone == MAXLONG)
{
TIME_ZONE_INFORMATION tzi;
::GetTimeZoneInformation(&tzi);
timezone = tzi.Bias;
}
return timezone;
}
#define WX_TIMEZONE wxGetTimeZone()
#endif
#else // unknown platform - try timezone
#define WX_TIMEZONE timezone
#endif
@ -1272,6 +1239,17 @@ wxDateTime wxDateTime::GetBeginDST(int year, Country country)
wxFAIL_MSG( _T("no first Sunday in April?") );
}
}
else if ( year > 2006 )
// Energy Policy Act of 2005, Pub. L. no. 109-58, 119 Stat 594 (2005).
// Starting in 2007, daylight time begins in the United States on the
// second Sunday in March and ends on the first Sunday in November
{
if ( !dt.SetToWeekDay(Sun, 2, Mar, year) )
{
// weird...
wxFAIL_MSG( _T("no second Sunday in March?") );
}
}
else
{
if ( !dt.SetToWeekDay(Sun, 1, Apr, year) )
@ -1351,21 +1329,36 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country)
dt.Set(30, Sep, year);
break;
default:
// DST ends at 2 a.m. on the last Sunday of October
if ( !dt.SetToLastWeekDay(Sun, Oct, year) )
default: // default for switch (year)
if ( year > 2006 )
// Energy Policy Act of 2005, Pub. L. no. 109-58, 119 Stat 594 (2005).
// Starting in 2007, daylight time begins in the United States on the
// second Sunday in March and ends on the first Sunday in November
{
// weirder and weirder...
wxFAIL_MSG( _T("no last Sunday in October?") );
if ( !dt.SetToWeekDay(Sun, 1, Nov, year) )
{
// weird...
wxFAIL_MSG( _T("no first Sunday in November?") );
}
}
else
// pre-2007
// DST ends at 2 a.m. on the last Sunday of October
{
if ( !dt.SetToLastWeekDay(Sun, Oct, year) )
{
// weirder and weirder...
wxFAIL_MSG( _T("no last Sunday in October?") );
}
}
dt += wxTimeSpan::Hours(2);
// TODO what about timezone??
// TODO: what about timezone??
}
break;
default:
default: // default for switch (country)
// assume October 26th as the end of the DST - totally bogus too
dt.Set(26, Oct, year);
}
@ -4304,7 +4297,16 @@ enum TimeSpanPart
// %l milliseconds (000 - 999)
wxString wxTimeSpan::Format(const wxChar *format) const
{
wxCHECK_MSG( format, wxEmptyString, _T("NULL format in wxTimeSpan::Format") );
// we deal with only positive time spans here and just add the sign in
// front for the negative ones
if ( IsNegative() )
{
wxString str(Negate().Format(format));
return _T("-") + str;
}
wxCHECK_MSG( format, wxEmptyString,
_T("NULL format in wxTimeSpan::Format") );
wxString str;
str.Alloc(wxStrlen(format));
@ -4374,13 +4376,6 @@ wxString wxTimeSpan::Format(const wxChar *format) const
n = GetHours();
if ( partBiggest < Part_Hour )
{
if ( n < 0 )
{
// the sign has already been taken into account
// when outputting the biggest part
n = -n;
}
n %= HOURS_PER_DAY;
}
else
@ -4395,9 +4390,6 @@ wxString wxTimeSpan::Format(const wxChar *format) const
n = GetMilliseconds().ToLong();
if ( partBiggest < Part_MSec )
{
if ( n < 0 )
n = -n;
n %= 1000;
}
//else: no need to reset partBiggest to Part_MSec, it is
@ -4410,9 +4402,6 @@ wxString wxTimeSpan::Format(const wxChar *format) const
n = GetMinutes();
if ( partBiggest < Part_Min )
{
if ( n < 0 )
n = -n;
n %= MIN_PER_HOUR;
}
else
@ -4427,9 +4416,6 @@ wxString wxTimeSpan::Format(const wxChar *format) const
n = GetSeconds().ToLong();
if ( partBiggest < Part_Sec )
{
if ( n < 0 )
n = -n;
n %= SEC_PER_MIN;
}
else
@ -4443,10 +4429,6 @@ wxString wxTimeSpan::Format(const wxChar *format) const
if ( digits )
{
// negative numbers need one extra position for '-' display
if ( n < 0 )
digits++;
fmtPrefix << _T("0") << digits;
}

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
// RCS-ID: $Id: dcbase.cpp 48616 2007-09-09 19:36:50Z VZ $
// RCS-ID: $Id: dcbase.cpp 56135 2008-10-06 21:04:02Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -1157,3 +1157,18 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
} // CalculateEllipticPoints
#endif
float wxDCBase::GetFontPointSizeAdjustment(float dpi)
{
// wxMSW has long-standing bug where wxFont point size is interpreted as
// "pixel size corresponding to given point size *on screen*". In other
// words, on a typical 600dpi printer and a typical 96dpi screen, fonts
// are ~6 times smaller when printing. Unfortunately, this bug is so severe
// that *all* printing code has to account for it and consequently, other
// ports need to emulate this bug too:
const wxSize screenPixels = wxGetDisplaySize();
const wxSize screenMM = wxGetDisplaySizeMM();
const float screenPPI_y = (screenPixels.y * 25.4) / screenMM.y;
return screenPPI_y / dpi;
}

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: event.cpp 51404 2008-01-27 12:57:04Z VZ $
// RCS-ID: $Id: event.cpp 56712 2008-11-08 22:41:10Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -34,6 +34,7 @@
#include "wx/module.h"
#if wxUSE_GUI
#include "wx/window.h"
#include "wx/control.h"
#include "wx/dc.h"
#include "wx/textctrl.h"
@ -1039,7 +1040,7 @@ wxEvtHandler::wxEvtHandler()
m_eventsLocker = new wxCriticalSection;
# endif
#endif
// no client data (yet)
m_clientData = NULL;
m_clientDataType = wxClientData_None;
@ -1141,8 +1142,6 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
m_pendingEvents->Append(eventCopy);
wxLEAVE_CRIT_SECT( Lock() );
// 2) Add this event handler to list of event handlers that
// have pending events.
@ -1154,6 +1153,8 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
wxLEAVE_CRIT_SECT( Lock() );
// 3) Inform the system that new pending events are somewhere,
// and that these should be processed in idle time.
wxWakeUpIdle();
@ -1165,7 +1166,7 @@ void wxEvtHandler::ProcessPendingEvents()
// pending events
wxCHECK_RET( m_pendingEvents,
wxT("Please call wxApp::ProcessPendingEvents() instead") );
wxENTER_CRIT_SECT( Lock() );
// we leave the loop once we have processed all events that were present at

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 29/01/98
// RCS-ID: $Id: filefn.cpp 51858 2008-02-17 09:16:11Z SC $
// RCS-ID: $Id: filefn.cpp 58220 2009-01-19 11:40:24Z VZ $
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -1493,7 +1493,7 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz)
{
sz -= 3;
rc = ::DosQueryCurrentDir( 0 // current drive
,cbuf + 3
,(PBYTE)cbuf + 3
,(PULONG)&sz
);
cbuf[0] = char('A' + (ulDriveNum - 1));

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling, Vadim Zeitlin
// Modified by:
// Created: 28.12.2000
// RCS-ID: $Id: filename.cpp 52996 2008-04-03 12:47:16Z VZ $
// RCS-ID: $Id: filename.cpp 58751 2009-02-08 10:05:28Z VZ $
// Copyright: (c) 2000 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -704,7 +704,6 @@ static wxString wxCreateTempImpl(
WXFILEARGS(wxFile *fileTemp, wxFFile *ffileTemp),
bool *deleteOnClose = NULL)
{
static int pid = -1;
#if wxUSE_FILE && wxUSE_FFILE
wxASSERT(fileTemp == NULL || ffileTemp == NULL);
#endif
@ -823,11 +822,7 @@ static wxString wxCreateTempImpl(
#else // !HAVE_MKTEMP (includes __DOS__)
// generate the unique file name ourselves
#if !defined(__DOS__) && !defined(__PALMOS__) && (!defined(__MWERKS__) || defined(__DARWIN__) )
if(pid < 0)
pid = getpid();
path << (unsigned int)pid;
path << (unsigned int)getpid();
#endif
wxString pathTry;
@ -1266,11 +1261,6 @@ bool wxFileName::Normalize(int flags,
}
}
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
{
dir.MakeLower();
}
m_dirs.Add(dir);
}
@ -1280,26 +1270,12 @@ bool wxFileName::Normalize(int flags,
wxString filename;
if (GetShortcutTarget(GetFullPath(format), filename))
{
// Repeat this since we may now have a new path
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
{
filename.MakeLower();
}
m_relative = false;
Assign(filename);
}
}
#endif
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
{
// VZ: expand env vars here too?
m_volume.MakeLower();
m_name.MakeLower();
m_ext.MakeLower();
}
#if defined(__WIN32__)
if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) )
{
@ -1307,6 +1283,22 @@ bool wxFileName::Normalize(int flags,
}
#endif // Win32
// Change case (this should be kept at the end of the function, to ensure
// that the path doesn't change any more after we normalize its case)
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
{
m_volume.MakeLower();
m_name.MakeLower();
m_ext.MakeLower();
// directory entries must be made lower case as well
count = m_dirs.GetCount();
for ( size_t i = 0; i < count; i++ )
{
m_dirs[i].MakeLower();
}
}
return true;
}
@ -2255,7 +2247,7 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess,
// not 9x
bool ok;
FILETIME ftAccess, ftCreate, ftWrite;
if ( IsDir() )
if ( IsDir() )
{
// implemented in msw/dir.cpp
extern bool wxGetDirectoryTimes(const wxString& dirname,

View File

@ -3,7 +3,7 @@
// Purpose: wxFileSystem class - interface for opening files
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// CVS-ID: $Id: filesys.cpp 51940 2008-02-20 16:33:55Z VZ $
// CVS-ID: $Id: filesys.cpp 55271 2008-08-26 00:03:04Z VZ $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -23,6 +23,7 @@
#include "wx/module.h"
#endif
#include "wx/sysopt.h"
#include "wx/wfstream.h"
#include "wx/mimetype.h"
#include "wx/filename.h"
@ -62,64 +63,77 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
#if wxUSE_MIMETYPE
static bool s_MinimalMimeEnsured = false;
if (!s_MinimalMimeEnsured)
{
static const wxFileTypeInfo fallbacks[] =
{
wxFileTypeInfo(_T("image/jpeg"),
wxEmptyString,
wxEmptyString,
_T("JPEG image (from fallback)"),
_T("jpg"), _T("jpeg"), _T("JPG"), _T("JPEG"), NULL),
wxFileTypeInfo(_T("image/gif"),
wxEmptyString,
wxEmptyString,
_T("GIF image (from fallback)"),
_T("gif"), _T("GIF"), NULL),
wxFileTypeInfo(_T("image/png"),
wxEmptyString,
wxEmptyString,
_T("PNG image (from fallback)"),
_T("png"), _T("PNG"), NULL),
wxFileTypeInfo(_T("image/bmp"),
wxEmptyString,
wxEmptyString,
_T("windows bitmap image (from fallback)"),
_T("bmp"), _T("BMP"), NULL),
wxFileTypeInfo(_T("text/html"),
wxEmptyString,
wxEmptyString,
_T("HTML document (from fallback)"),
_T("htm"), _T("html"), _T("HTM"), _T("HTML"), NULL),
// must terminate the table with this!
wxFileTypeInfo()
};
wxTheMimeTypesManager->AddFallbacks(fallbacks);
s_MinimalMimeEnsured = true;
}
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
if ( !ft || !ft -> GetMimeType(&mime) )
{
mime = wxEmptyString;
}
delete ft;
return mime;
#else
if ( ext.IsSameAs(wxT("htm"), false) || ext.IsSameAs(_T("html"), false) )
return wxT("text/html");
if ( ext.IsSameAs(wxT("jpg"), false) || ext.IsSameAs(_T("jpeg"), false) )
return wxT("image/jpeg");
if ( ext.IsSameAs(wxT("gif"), false) )
return wxT("image/gif");
if ( ext.IsSameAs(wxT("png"), false) )
return wxT("image/png");
if ( ext.IsSameAs(wxT("bmp"), false) )
return wxT("image/bmp");
return wxEmptyString;
// Don't use mime types manager if the application doesn't need it and it would be
// cause an unacceptable delay, especially on startup.
bool useMimeTypesManager = true;
#if wxUSE_SYSTEM_OPTIONS
useMimeTypesManager = (wxSystemOptions::GetOptionInt(wxT("filesys.no-mimetypesmanager")) == 0);
#endif
if (useMimeTypesManager)
{
if (!s_MinimalMimeEnsured)
{
static const wxFileTypeInfo fallbacks[] =
{
wxFileTypeInfo(_T("image/jpeg"),
wxEmptyString,
wxEmptyString,
_T("JPEG image (from fallback)"),
_T("jpg"), _T("jpeg"), _T("JPG"), _T("JPEG"), NULL),
wxFileTypeInfo(_T("image/gif"),
wxEmptyString,
wxEmptyString,
_T("GIF image (from fallback)"),
_T("gif"), _T("GIF"), NULL),
wxFileTypeInfo(_T("image/png"),
wxEmptyString,
wxEmptyString,
_T("PNG image (from fallback)"),
_T("png"), _T("PNG"), NULL),
wxFileTypeInfo(_T("image/bmp"),
wxEmptyString,
wxEmptyString,
_T("windows bitmap image (from fallback)"),
_T("bmp"), _T("BMP"), NULL),
wxFileTypeInfo(_T("text/html"),
wxEmptyString,
wxEmptyString,
_T("HTML document (from fallback)"),
_T("htm"), _T("html"), _T("HTM"), _T("HTML"), NULL),
// must terminate the table with this!
wxFileTypeInfo()
};
wxTheMimeTypesManager->AddFallbacks(fallbacks);
s_MinimalMimeEnsured = true;
}
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
if ( !ft || !ft -> GetMimeType(&mime) )
{
mime = wxEmptyString;
}
delete ft;
return mime;
}
else
#endif
{
if ( ext.IsSameAs(wxT("htm"), false) || ext.IsSameAs(_T("html"), false) )
return wxT("text/html");
if ( ext.IsSameAs(wxT("jpg"), false) || ext.IsSameAs(_T("jpeg"), false) )
return wxT("image/jpeg");
if ( ext.IsSameAs(wxT("gif"), false) )
return wxT("image/gif");
if ( ext.IsSameAs(wxT("png"), false) )
return wxT("image/png");
if ( ext.IsSameAs(wxT("bmp"), false) )
return wxT("image/bmp");
return wxEmptyString;
}
}
@ -174,8 +188,10 @@ wxString wxFileSystemHandler::GetAnchor(const wxString& location) const
for (int i = l-1; i >= 0; i--) {
c = location[i];
if (c == wxT('#')) return location.Right(l-i-1);
else if ((c == wxT('.')) || (c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) return wxEmptyString;
if (c == wxT('#'))
return location.Right(l-i-1);
else if ((c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':')))
return wxEmptyString;
}
return wxEmptyString;
}

View File

@ -3,7 +3,7 @@
// Purpose: font management for ports that don't have their own
// Author: Vaclav Slavik
// Created: 2006-11-18
// RCS-ID: $Id: fontmgrcmn.cpp 43550 2006-11-20 20:45:57Z VS $
// RCS-ID: $Id: fontmgrcmn.cpp 54757 2008-07-21 17:34:48Z VZ $
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
// (c) 2006 REA Elektronik GmbH
// Licence: wxWindows licence
@ -24,9 +24,15 @@
WX_DECLARE_LIST(wxFontInstance, wxFontInstanceList);
WX_DEFINE_LIST(wxFontInstanceList)
WX_DEFINE_LIST(wxFontBundleList)
WX_DECLARE_HASH_MAP(wxString, wxFontBundle*,
wxStringHash, wxStringEqual,
wxFontBundleHash);
wxFontBundleHashBase);
// in STL build, hash class is typedef to a template, so it can't be forward
// declared, as we do; solve it by having a dummy class:
class wxFontBundleHash : public wxFontBundleHashBase
{
};
// ============================================================================
// implementation
@ -65,17 +71,14 @@ wxFontInstance *wxFontFaceBase::GetFontInstance(float ptSize, bool aa)
{
wxASSERT_MSG( m_refCnt > 0, _T("font library not loaded!") );
wxFontInstance *i;
wxFontInstanceList::Node *node;
for ( node = m_instances->GetFirst(); node; node = node->GetNext() )
for ( wxFontInstanceList::const_iterator i = m_instances->begin();
i != m_instances->end(); ++i )
{
i = node->GetData();
if ( i->GetPointSize() == ptSize && i->IsAntiAliased() == aa )
return i;
if ( (*i)->GetPointSize() == ptSize && (*i)->IsAntiAliased() == aa )
return *i;
}
i = CreateFontInstance(ptSize, aa);
wxFontInstance *i = CreateFontInstance(ptSize, aa);
m_instances->Append(i);
return i;
}

View File

@ -6,7 +6,7 @@
//
// Author: Robin Dunn
// Created: 03-Nov-2003
// RCS-ID: $Id: gbsizer.cpp 53000 2008-04-03 23:28:16Z RD $
// RCS-ID: $Id: gbsizer.cpp 54568 2008-07-10 01:32:23Z RD $
// Copyright: (c) Robin Dunn
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -580,7 +580,7 @@ void wxGridBagSizer::AdjustForOverflow()
{
wxGBPosition pos(row,col);
wxGBSizerItem* item = FindItemAtPosition(pos);
if ( !item )
if ( !item || !item->ShouldAccountFor() )
continue;
int endrow, endcol;
@ -623,7 +623,7 @@ void wxGridBagSizer::AdjustForOverflow()
{
wxGBPosition pos(row,col);
wxGBSizerItem* item = FindItemAtPosition(pos);
if ( !item )
if ( !item || !item->ShouldAccountFor() )
continue;
int endrow, endcol;

View File

@ -3,7 +3,7 @@
// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation
// Author: Guillermo Rodriguez Garcia <guille@iies.es>
// Version: 3.04
// RCS-ID: $Id: gifdecod.cpp 43898 2006-12-10 14:18:37Z VZ $
// RCS-ID: $Id: gifdecod.cpp 54944 2008-08-03 00:36:52Z VZ $
// Copyright: (c) Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -186,7 +186,7 @@ bool wxGIFDecoder::ConvertToImage(unsigned int frame, wxImage *image) const
// Get data for current frame
wxSize wxGIFDecoder::GetFrameSize(unsigned int frame) const
wxSize wxGIFDecoder::GetFrameSize(unsigned int frame) const
{
return wxSize(GetFrame(frame)->w, GetFrame(frame)->h);
}
@ -593,7 +593,7 @@ bool wxGIFDecoder::CanRead(wxInputStream &stream) const
wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
{
unsigned int global_ncolors = 0;
int bits, interl, transparent, i;
int bits, interl, i;
wxAnimationDisposal disposal;
long size;
long delay;
@ -655,7 +655,7 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
}
// transparent colour, disposal method and delay default to unused
transparent = -1;
int transparent = -1;
disposal = wxANIM_UNSPECIFIED;
delay = -1;
@ -705,8 +705,7 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
delay = 10 * (buf[2] + 256 * buf[3]);
// read transparent colour index, if used
if (buf[1] & 0x01)
transparent = buf[4];
transparent = buf[1] & 0x01 ? buf[4] : -1;
// read disposal method
disposal = (wxAnimationDisposal)(((buf[1] & 0x1C) >> 2) - 1);
@ -756,8 +755,8 @@ wxGIFErrorCode wxGIFDecoder::LoadGIF(wxInputStream& stream)
pimg->w = buf[4] + 256 * buf[5];
pimg->h = buf[6] + 256 * buf[7];
if (anim && ((pimg->w == 0) || (pimg->w > (unsigned int)m_szAnimation.GetWidth()) ||
(pimg->h == 0) || (pimg->h > (unsigned int)m_szAnimation.GetHeight())))
if (anim && ((pimg->w == 0) || (pimg->w > (unsigned int)m_szAnimation.GetWidth()) ||
(pimg->h == 0) || (pimg->h > (unsigned int)m_szAnimation.GetHeight())))
{
Destroy();
return wxGIF_INVFORMAT;

View File

@ -4,7 +4,7 @@
// Author: Stefan Csomor
// Modified by:
// Created:
// RCS-ID: $Id: graphcmn.cpp 49287 2007-10-21 11:52:54Z SC $
// RCS-ID: $Id: graphcmn.cpp 56801 2008-11-16 23:25:09Z KO $
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -120,10 +120,12 @@ wxObjectRefData* wxGraphicsObject::CloneRefData(const wxObjectRefData* data) con
IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPen, wxGraphicsObject)
IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBrush, wxGraphicsObject)
IMPLEMENT_DYNAMIC_CLASS(wxGraphicsFont, wxGraphicsObject)
IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBitmap, wxGraphicsObject)
WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen;
WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush;
WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont;
WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap;
//-----------------------------------------------------------------------------
// matrix
@ -729,6 +731,11 @@ wxGraphicsFont wxGraphicsContext::CreateFont( const wxFont &font , const wxColou
return GetRenderer()->CreateFont(font,col);
}
wxGraphicsBitmap wxGraphicsContext::CreateBitmap( const wxBitmap& bmp ) const
{
return GetRenderer()->CreateBitmap(bmp);
}
wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC& dc)
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);

View File

@ -2,7 +2,7 @@
// Name: src/common/imagbmp.cpp
// Purpose: wxImage BMP,ICO and CUR handlers
// Author: Robert Roebling, Chris Elliott
// RCS-ID: $Id: imagbmp.cpp 41819 2006-10-09 17:51:07Z VZ $
// RCS-ID: $Id: imagbmp.cpp 54942 2008-08-03 00:23:38Z VZ $
// Copyright: (c) Robert Roebling, Chris Elliott
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -454,9 +454,9 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
wxFileOffset bmpOffset, wxInputStream& stream,
bool verbose, bool IsBmp, bool hasPalette)
{
wxInt32 aDword, rmask = 0, gmask = 0, bmask = 0;
int rshift = 0, gshift = 0, bshift = 0;
int rbits = 0, gbits = 0, bbits = 0;
wxInt32 aDword, rmask = 0, gmask = 0, bmask = 0, amask = 0;
int rshift = 0, gshift = 0, bshift = 0, ashift = 0;
int rbits = 0, gbits = 0, bbits = 0, abits = 0;
wxInt32 dbuf[4];
wxInt8 bbuf[4];
wxUint8 aByte;
@ -488,11 +488,29 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
{
if ( verbose )
wxLogError( _("BMP: Couldn't allocate memory.") );
if ( cmap )
delete[] cmap;
delete[] cmap;
return false;
}
unsigned char *alpha;
if ( bpp == 32 )
{
// tell the image to allocate an alpha buffer
image->SetAlpha();
alpha = image->GetAlpha();
if ( !alpha )
{
if ( verbose )
wxLogError(_("BMP: Couldn't allocate memory."));
delete[] cmap;
return false;
}
}
else // no alpha
{
alpha = NULL;
}
// Reading the palette, if it exists:
if ( bpp < 16 && ncolors != 0 )
{
@ -577,9 +595,13 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
rmask = 0x00FF0000;
gmask = 0x0000FF00;
bmask = 0x000000FF;
amask = 0xFF000000;
ashift = 24;
rshift = 16;
gshift = 8;
bshift = 0;
abits = 8;
rbits = 8;
gbits = 8;
bbits = 8;
@ -815,6 +837,11 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
ptr[poffset + 1] = temp;
temp = (unsigned char)((aDword & bmask) >> bshift);
ptr[poffset + 2] = temp;
if ( alpha )
{
temp = (unsigned char)((aDword & amask) >> ashift);
alpha[line * width + column] = temp;
}
column++;
}
}

View File

@ -2,7 +2,7 @@
// Name: src/common/image.cpp
// Purpose: wxImage
// Author: Robert Roebling
// RCS-ID: $Id: image.cpp 53245 2008-04-17 15:10:20Z RR $
// RCS-ID: $Id: image.cpp 59197 2009-02-28 15:44:53Z VZ $
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -234,6 +234,7 @@ bool wxImage::Create( int width, int height, unsigned char* data, unsigned char*
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = true;
M_IMGDATA->m_static = static_data;
M_IMGDATA->m_staticAlpha = static_data;
return true;
}
@ -1274,7 +1275,6 @@ void wxImage::Paste( const wxImage &image, int x, int y )
(GetMaskGreen()==image.GetMaskGreen()) &&
(GetMaskBlue()==image.GetMaskBlue()))))
{
width *= 3;
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
int source_step = image.GetWidth()*3;
@ -1282,11 +1282,10 @@ void wxImage::Paste( const wxImage &image, int x, int y )
int target_step = M_IMGDATA->m_width*3;
for (int j = 0; j < height; j++)
{
memcpy( target_data, source_data, width );
memcpy( target_data, source_data, width*3 );
source_data += source_step;
target_data += target_step;
}
return;
}
// Copy over the alpha channel from the original image
@ -1315,7 +1314,6 @@ void wxImage::Paste( const wxImage &image, int x, int y )
unsigned char g = image.GetMaskGreen();
unsigned char b = image.GetMaskBlue();
width *= 3;
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
int source_step = image.GetWidth()*3;
@ -1324,7 +1322,7 @@ void wxImage::Paste( const wxImage &image, int x, int y )
for (int j = 0; j < height; j++)
{
for (int i = 0; i < width; i+=3)
for (int i = 0; i < width*3; i+=3)
{
if ((source_data[i] != r) ||
(source_data[i+1] != g) ||

View File

@ -3,7 +3,7 @@
// Purpose: wxImage PCX handler
// Author: Guillermo Rodriguez Garcia <guille@iies.es>
// Version: 1.1
// CVS-ID: $Id: imagpcx.cpp 40943 2006-08-31 19:31:43Z ABX $
// CVS-ID: $Id: imagpcx.cpp 54766 2008-07-22 20:16:03Z VZ $
// Copyright: (c) 1999 Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -87,17 +87,15 @@ void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s)
void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s)
{
unsigned int i, data, cont;
// Read 'size' bytes. The PCX official specs say there will be
// a decoding break at the end of each scanline (but not at the
// end of each plane inside a scanline). Only use this function
// to read one or more _complete_ scanlines. Else, more than
// 'size' bytes might be read and the buffer might overflow.
while (size > 0)
while (size != 0)
{
data = (unsigned char)s.GetC();
unsigned int data = (unsigned char)s.GetC();
// If ((data & 0xC0) != 0xC0), then the value read is a data
// byte. Else, it is a counter (cont = val & 0x3F) and the
@ -110,9 +108,11 @@ void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s)
}
else
{
cont = data & 0x3F;
unsigned int cont = data & 0x3F;
if (cont > size) // can happen only if the file is malformed
break;
data = (unsigned char)s.GetC();
for (i = 1; i <= cont; i++)
for (unsigned int i = 1; i <= cont; i++)
*(p++) = (unsigned char)data;
size -= cont;
}

View File

@ -5,7 +5,7 @@
// Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su>
// (2003/09/30 - PluralForms support)
// Created: 29/01/98
// RCS-ID: $Id: intl.cpp 53628 2008-05-17 22:49:30Z VZ $
// RCS-ID: $Id: intl.cpp 57501 2008-12-22 19:50:17Z VZ $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -2504,7 +2504,13 @@ wxFontEncoding wxLocale::GetSystemEncoding()
// (a.k.a. US-ASCII) which is arguably a bug but keep it like this for
// backwards compatibility and just take care to not return
// wxFONTENCODING_DEFAULT from here as this surely doesn't make sense
if ( enc != wxFONTENCODING_MAX && enc != wxFONTENCODING_DEFAULT )
if ( enc == wxFONTENCODING_DEFAULT )
{
// we don't have wxFONTENCODING_ASCII, so use the closest one
return wxFONTENCODING_ISO8859_1;
}
if ( enc != wxFONTENCODING_MAX )
{
return enc;
}
@ -3699,9 +3705,9 @@ void wxLocale::InitLanguagesDB()
LNG(wxLANGUAGE_SANSKRIT, "sa" , LANG_SANSKRIT , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Sanskrit")
LNG(wxLANGUAGE_SCOTS_GAELIC, "gd" , 0 , 0 , wxLayout_LeftToRight, "Scots Gaelic")
LNG(wxLANGUAGE_SAMI, "se_NO", LANG_SAMI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Northern Sami")
LNG(wxLANGUAGE_SERBIAN, "sr_SR", LANG_SERBIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Serbian")
LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_SR", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , wxLayout_LeftToRight, "Serbian (Cyrillic)")
LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_SR@latin", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , wxLayout_LeftToRight, "Serbian (Latin)")
LNG(wxLANGUAGE_SERBIAN, "sr_RS", LANG_SERBIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Serbian")
LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_RS", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , wxLayout_LeftToRight, "Serbian (Cyrillic)")
LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_RS@latin", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , wxLayout_LeftToRight, "Serbian (Latin)")
LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_YU", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , wxLayout_LeftToRight, "Serbian (Cyrillic)")
LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_YU@latin", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , wxLayout_LeftToRight, "Serbian (Latin)")
LNG(wxLANGUAGE_SERBO_CROATIAN, "sh" , 0 , 0 , wxLayout_LeftToRight, "Serbo-Croatian")

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id: ipcbase.cpp 38787 2006-04-18 07:24:35Z ABX $
// RCS-ID: $Id: ipcbase.cpp 54615 2008-07-14 02:34:29Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -61,8 +61,8 @@ wxConnectionBase::wxConnectionBase(const wxConnectionBase& copy)
wxConnectionBase::~wxConnectionBase(void)
{
if ( m_deletebufferwhendone && m_buffer )
delete m_buffer;
if ( m_deletebufferwhendone )
delete [] m_buffer;
}
wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
@ -73,8 +73,7 @@ wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
{ // need to resize buffer
if ( m_deletebufferwhendone )
{ // we're in charge of buffer, increase it
if ( m_buffer )
delete m_buffer;
delete [] m_buffer;
// the argument specifies **byte size**, but m_buffer is of type
// wxChar. Under unicode: sizeof(wxChar) > 1, so the buffer size is
// bytes / sizeof(wxChar) rounded upwards.

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 26.10.99
// RCS-ID: $Id: menucmn.cpp 51361 2008-01-24 18:12:55Z PC $
// RCS-ID: $Id: menucmn.cpp 57852 2009-01-06 09:40:34Z SC $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -194,7 +194,11 @@ wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut)
{
if ( (label[n] == '+') || (label[n] == '-') )
{
// differentiate between a ctrl that will be translated to cmd on mac
// and an explicit xctrl that will not be translated and remains a ctrl
if ( CompareAccelString(current, wxTRANSLATE("ctrl")) )
accelFlags |= wxACCEL_CMD;
else if ( CompareAccelString(current, wxTRANSLATE("xctrl")) )
accelFlags |= wxACCEL_CTRL;
else if ( CompareAccelString(current, wxTRANSLATE("alt")) )
accelFlags |= wxACCEL_ALT;
@ -312,8 +316,12 @@ wxString wxAcceleratorEntry::ToString() const
int flags = GetFlags();
if ( flags & wxACCEL_ALT )
text += _("Alt-");
if ( flags & wxACCEL_CTRL )
if ( flags & wxACCEL_CMD )
text += _("Ctrl-");
#ifdef __WXMAC__
if ( flags & wxACCEL_CTRL )
text += _("XCtrl-");
#endif
if ( flags & wxACCEL_SHIFT )
text += _("Shift-");

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by: Ron Lee
// Created: 04/01/98
// RCS-ID: $Id: object.cpp 40111 2006-07-15 22:21:44Z MW $
// RCS-ID: $Id: object.cpp 56500 2008-10-23 14:48:31Z MW $
// Copyright: (c) 1998 Julian Smart
// (c) 2001 Ron Lee <ron@debian.org>
// Licence: wxWindows licence
@ -205,37 +205,45 @@ wxClassInfo *wxClassInfo::FindClass(const wxChar *className)
}
}
// This function wasn't written to be reentrant but there is a possiblity of
// reentrance if something it does causes a shared lib to load and register
// classes. On Solaris this happens when the wxHashTable is newed, so the first
// part of the function has been modified to handle it, and a wxASSERT checks
// against reentrance in the remainder of the function.
// Reentrance can occur on some platforms (Solaris for one), as the use of hash
// and string objects can cause other modules to load and register classes
// before the original call returns. This is handled by keeping the hash table
// local when it is first created and only assigning it to the global variable
// when the function is ready to return.
//
// That does make the assumption that after the function has completed the
// first time the problem will no longer happen; all the modules it depends on
// will have been loaded. The assumption is checked using the 'entry' variable
// as a reentrance guard, it checks that once the hash table is global it is
// not accessed multiple times simulateously.
void wxClassInfo::Register()
{
if ( !sm_classTable )
{
wxHashTable *classTable = new wxHashTable(wxKEY_STRING);
// check for reentrance
if ( sm_classTable )
delete classTable;
else
sm_classTable = classTable;
}
#ifdef __WXDEBUG__
// reentrance guard - see note above
static int entry = 0;
wxASSERT_MSG(++entry == 1, _T("wxClassInfo::Register() reentrance"));
#endif
wxHashTable *classTable;
if ( !sm_classTable )
{
// keep the hash local initially, reentrance is possible
classTable = new wxHashTable(wxKEY_STRING);
}
else
{
// guard againt reentrance once the global has been created
wxASSERT_MSG(++entry == 1, _T("wxClassInfo::Register() reentrance"));
classTable = sm_classTable;
}
// Using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you
// link any object module twice mistakenly, or link twice against wx shared
// library) will break this function because it will enter an infinite loop
// and eventually die with "out of memory" - as this is quite hard to
// detect if you're unaware of this, try to do some checks here.
wxASSERT_MSG( sm_classTable->Get(m_className) == NULL,
wxASSERT_MSG( classTable->Get(m_className) == NULL,
wxString::Format
(
_T("Class \"%s\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"),
@ -243,10 +251,27 @@ void wxClassInfo::Register()
)
);
sm_classTable->Put(m_className, (wxObject *)this);
classTable->Put(m_className, (wxObject *)this);
// if we're using a local hash we need to try to make it global
if ( sm_classTable != classTable )
{
if ( !sm_classTable )
{
// make the hash global
sm_classTable = classTable;
}
else
{
// the gobal hash has already been created by a reentrant call,
// so delete the local hash and try again
delete classTable;
Register();
}
}
#ifdef __WXDEBUG__
--entry;
entry = 0;
#endif
}

View File

@ -4,7 +4,7 @@
// Author: Francesco Montorsi
// Modified by:
// Created: 15/04/2006
// RCS-ID: $Id: pickerbase.cpp 52566 2008-03-16 13:50:17Z JS $
// RCS-ID: $Id: pickerbase.cpp 58463 2009-01-27 17:39:50Z BP $
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -144,12 +144,12 @@ void wxPickerBase::DoSetToolTip(wxToolTip *tip)
// wxPickerBase - event handlers
// ----------------------------------------------------------------------------
void wxPickerBase::OnTextCtrlKillFocus(wxFocusEvent &)
void wxPickerBase::OnTextCtrlKillFocus(wxFocusEvent& event)
{
wxASSERT(m_text);
event.Skip();
// don't leave the textctrl empty
if (m_text->GetValue().empty())
if (m_text && m_text->GetValue().empty())
UpdateTextCtrlFromPicker();
}

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 06.01.01
// RCS-ID: $Id: popupcmn.cpp 49643 2007-11-05 16:55:13Z SC $
// RCS-ID: $Id: popupcmn.cpp 56979 2008-11-26 15:31:18Z JMS $
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// License: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -43,9 +43,10 @@
#ifdef __WXGTK__
#include <gtk/gtk.h>
#endif
#ifdef __WXX11__
#include "wx/x11/private.h"
#elif defined(__WXMSW__)
#include "wx/msw/private.h"
#elif defined(__WXX11__)
#include "wx/x11/private.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow)
@ -260,8 +261,16 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
m_child->PushEventHandler(m_handlerPopup);
m_focus = winFocus ? winFocus : this;
m_focus->SetFocus();
#if defined(__WXMSW__)
// Focusing on child of popup window does not work on MSW unless WS_POPUP
// style is set. We do not even want to try to set the focus, as it may
// provoke errors on some Windows versions (Vista and later).
if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & WS_POPUP )
#endif
{
m_focus = winFocus ? winFocus : this;
m_focus->SetFocus();
}
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
// MSW doesn't allow to set focus to the popup window, but we need to

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id: prntbase.cpp 42763 2006-10-30 20:34:25Z VZ $
// RCS-ID: $Id: prntbase.cpp 58209 2009-01-18 21:31:36Z RD $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -18,6 +18,17 @@
#if wxUSE_PRINTING_ARCHITECTURE
// change this to 1 to use experimental high-quality printing on Windows
// (NB: this can't be in msw/printwin.cpp because of binary compatibility)
#define wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW 0
#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
#if !defined(__WXMSW__) || !wxUSE_IMAGE || !wxUSE_WXDIB
#undef wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
#define wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW 0
#endif
#endif
#include "wx/dcprint.h"
#ifndef WX_PRECOMP
@ -65,6 +76,19 @@
#endif
#endif // __WXMSW__
#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
#include "wx/msw/dib.h"
#include "wx/image.h"
typedef bool (wxPrintPreviewBase::*RenderPageIntoDCFunc)(wxDC&, int);
static bool RenderPageIntoBitmapHQ(wxPrintPreviewBase *preview,
RenderPageIntoDCFunc RenderPageIntoDC,
wxPrinterDC& printerDC,
wxBitmap& bmp, int pageNum,
int pageWidth, int pageHeight);
#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
//----------------------------------------------------------------------------
// wxPrintFactory
//----------------------------------------------------------------------------
@ -508,6 +532,7 @@ void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
wxPrinterBase::sm_abortIt = true;
wxPrinterBase::sm_abortWindow->Show(false);
wxPrinterBase::sm_abortWindow->Close(true);
wxPrinterBase::sm_abortWindow->Destroy();
wxPrinterBase::sm_abortWindow = (wxWindow *) NULL;
}
@ -1469,6 +1494,70 @@ void wxPrintPreviewBase::AdjustScrollbars(wxPreviewCanvas *canvas)
canvas->SetScrollbars(10, 10, scrollUnitsX, scrollUnitsY, 0, 0, true);
}
bool wxPrintPreviewBase::RenderPageIntoDC(wxDC& dc, int pageNum)
{
m_previewPrintout->SetDC(&dc);
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
// Need to delay OnPreparePrinting() until here, so we have enough
// information.
if (!m_printingPrepared)
{
m_previewPrintout->OnPreparePrinting();
int selFrom, selTo;
m_previewPrintout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
m_printingPrepared = true;
}
m_previewPrintout->OnBeginPrinting();
if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
{
wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
return false;
}
m_previewPrintout->OnPrintPage(pageNum);
m_previewPrintout->OnEndDocument();
m_previewPrintout->OnEndPrinting();
m_previewPrintout->SetDC(NULL);
return true;
}
bool wxPrintPreviewBase::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum)
{
#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
// try high quality rendering first:
static bool s_hqPreviewFailed = false;
if ( !s_hqPreviewFailed )
{
wxPrinterDC printerDC(m_printDialogData.GetPrintData());
if ( RenderPageIntoBitmapHQ(this,
&wxPrintPreviewBase::RenderPageIntoDC,
printerDC,
bmp, pageNum,
m_pageWidth, m_pageHeight) )
{
return true;
}
else
{
wxLogTrace(_T("printing"),
_T("high-quality preview failed, falling back to normal"));
s_hqPreviewFailed = true; // don't bother re-trying
}
}
#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
wxMemoryDC memoryDC;
memoryDC.SelectObject(bmp);
memoryDC.Clear();
return RenderPageIntoDC(memoryDC, pageNum);
}
bool wxPrintPreviewBase::RenderPage(int pageNum)
{
wxBusyCursor busy;
@ -1497,44 +1586,15 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
}
}
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_previewBitmap);
memoryDC.Clear();
m_previewPrintout->SetDC(&memoryDC);
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
// Need to delay OnPreparePrinting until here, so we have enough information.
if (!m_printingPrepared)
{
m_previewPrintout->OnPreparePrinting();
int selFrom, selTo;
m_previewPrintout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
m_printingPrepared = true;
}
m_previewPrintout->OnBeginPrinting();
if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
if ( !RenderPageIntoBitmap(*m_previewBitmap, pageNum) )
{
wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
memoryDC.SelectObject(wxNullBitmap);
delete m_previewBitmap;
m_previewBitmap = NULL;
return false;
}
m_previewPrintout->OnPrintPage(pageNum);
m_previewPrintout->OnEndDocument();
m_previewPrintout->OnEndPrinting();
m_previewPrintout->SetDC(NULL);
memoryDC.SelectObject(wxNullBitmap);
#if wxUSE_STATUSBAR
wxString status;
if (m_maxPage != 0)
@ -1758,4 +1818,273 @@ void wxPrintPreview::DetermineScaling()
m_pimpl->DetermineScaling();
}
//----------------------------------------------------------------------------
// experimental backport of high-quality preview on Windows
//----------------------------------------------------------------------------
#if wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
// The preview, as implemented in wxPrintPreviewBase (and as used prior to wx3)
// is inexact: it uses screen DC, which has much lower resolution and has
// other properties different from printer DC, so the preview is not quite
// right.
//
// To make matters worse, if the application depends heavily on GetTextExtent()
// or does text layout itself, the output in preview and on paper can be very
// different. In particular, wxHtmlEasyPrinting is affected and the preview
// can be easily off by several pages.
//
// To fix this, we attempt to render the preview into high-resolution bitmap
// using DC with same resolution etc. as the printer DC. This takes lot of
// memory, so the code is more complicated than it could be, but the results
// are much better.
//
// Finally, this code is specific to wxMSW, because it doesn't make sense to
// bother with it on other platforms. Both OSX and modern GNOME/GTK+
// environments have builtin accurate preview (that applications should use
// instead) and the differences between screen and printer DC in wxGTK are so
// large than this trick doesn't help at all.
namespace
{
// If there's not enough memory, we need to render the preview in parts.
// Unfortunately we cannot simply use wxMemoryDC, because it reports its size
// as bitmap's size, and we need to use smaller bitmap while still reporting
// original ("correct") DC size, because printing code frequently uses
// GetSize() to determine scaling factor. This DC class handles this.
class PageFragmentDC : public wxMemoryDC
{
public:
PageFragmentDC(wxDC *printer, wxBitmap& bmp,
const wxPoint& offset,
const wxSize& fullSize)
: wxMemoryDC(printer),
m_offset(offset),
m_fullSize(fullSize)
{
SetDeviceOrigin(0, 0);
SelectObject(bmp);
}
virtual void SetDeviceOrigin(wxCoord x, wxCoord y)
{
wxMemoryDC::SetDeviceOrigin(x - m_offset.x, y - m_offset.y);
}
virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
{
wxMemoryDC::DoGetDeviceOrigin(x, y);
if ( x ) *x += m_offset.x;
if ( x ) *y += m_offset.y;
}
virtual void DoGetSize(int *width, int *height) const
{
if ( width )
*width = m_fullSize.x;
if ( height )
*height = m_fullSize.y;
}
private:
wxPoint m_offset;
wxSize m_fullSize;
};
// estimate how big chunks we can render, given available RAM
long ComputeFragmentSize(long printerDepth,
long width,
long height)
{
// Compute the amount of memory needed to generate the preview.
// Memory requirements of RenderPageFragment() are as follows:
//
// (memory DC - always)
// width * height * printerDepth/8
// (wxImage + wxDIB instance)
// width * height * (3 + 4)
// (this could be reduced to *3 if using wxGraphicsContext)
//
// So, given amount of memory M, we can render at most
//
// height = M / (width * (printerDepth/8 + F))
//
// where F is 3 or 7 depending on whether wxGraphicsContext is used or not
wxMemorySize memAvail = wxGetFreeMemory();
if ( memAvail == -1 )
{
// we don't know; 10meg shouldn't be a problem hopefully
memAvail = 10000000;
}
else
{
// limit ourselves to half of available RAM to have a margin for other
// apps, for our rendering code, and for miscalculations
memAvail /= 2;
}
const float perPixel = float(printerDepth)/8 + (3 + 4);
const long perLine = long(width * perPixel);
const long maxstep = (memAvail / perLine).GetValue();
const long step = wxMin(height, maxstep);
wxLogTrace(_T("printing"),
_T("using %liMB of RAM (%li lines) for preview, %li %lipx fragments"),
long((memAvail >> 20).GetValue()),
maxstep,
(height+step-1) / step,
step);
return step;
}
} // anonymous namespace
static bool RenderPageFragment(wxPrintPreviewBase *preview,
RenderPageIntoDCFunc RenderPageIntoDC,
float scaleX, float scaleY,
int *nextFinalLine,
wxPrinterDC& printer,
wxMemoryDC& finalDC,
const wxRect& rect,
int pageWidth, int pageHeight,
int pageNum)
{
// compute 'rect' equivalent in the small final bitmap:
const wxRect smallRect(wxPoint(0, *nextFinalLine),
wxPoint(int(rect.GetRight() * scaleX),
int(rect.GetBottom() * scaleY)));
wxLogTrace(_T("printing"),
_T("rendering fragment of page %i: [%i,%i,%i,%i] scaled down to [%i,%i,%i,%i]"),
pageNum,
rect.x, rect.y, rect.GetRight(), rect.GetBottom(),
smallRect.x, smallRect.y, smallRect.GetRight(), smallRect.GetBottom()
);
// create DC and bitmap compatible with printer DC:
wxBitmap large(rect.width, rect.height, printer);
if ( !large.IsOk() )
return false;
// render part of the page into it:
{
PageFragmentDC memoryDC(&printer, large,
rect.GetPosition(),
wxSize(pageWidth, pageHeight));
if ( !memoryDC.IsOk() )
return false;
memoryDC.Clear();
if ( !(preview->*RenderPageIntoDC)(memoryDC, pageNum) )
return false;
} // release bitmap from memoryDC
// now scale the rendered part down and blit it into final output:
wxImage img;
{
wxDIB dib(large);
if ( !dib.IsOk() )
return false;
large = wxNullBitmap; // free memory a.s.a.p.
img = dib.ConvertToImage();
} // free the DIB now that it's no longer needed, too
if ( !img.IsOk() )
return false;
img.Rescale(smallRect.width, smallRect.height, wxIMAGE_QUALITY_HIGH);
if ( !img.IsOk() )
return false;
wxBitmap bmp(img);
if ( !bmp.IsOk() )
return false;
img = wxNullImage;
finalDC.DrawBitmap(bmp, smallRect.x, smallRect.y);
if ( bmp.IsOk() )
{
*nextFinalLine += smallRect.height;
return true;
}
return false;
}
static bool RenderPageIntoBitmapHQ(wxPrintPreviewBase *preview,
RenderPageIntoDCFunc RenderPageIntoDC,
wxPrinterDC& printerDC,
wxBitmap& bmp, int pageNum,
int pageWidth, int pageHeight)
{
wxLogTrace(_T("printing"), _T("rendering HQ preview of page %i"), pageNum);
if ( !printerDC.IsOk() )
return false;
// compute scale factor
const float scaleX = float(bmp.GetWidth()) / float(pageWidth);
const float scaleY = float(bmp.GetHeight()) / float(pageHeight);
wxMemoryDC bmpDC;
bmpDC.SelectObject(bmp);
bmpDC.Clear();
const int initialStep = ComputeFragmentSize(printerDC.GetDepth(),
pageWidth, pageHeight);
wxRect todo(0, 0, pageWidth, initialStep); // rect to render
int nextFinalLine = 0; // first not-yet-rendered output line
while ( todo.y < pageHeight )
{
todo.SetBottom(wxMin(todo.GetBottom(), pageHeight - 1));
if ( !RenderPageFragment(preview, RenderPageIntoDC,
scaleX, scaleY,
&nextFinalLine,
printerDC,
bmpDC,
todo,
pageWidth, pageHeight,
pageNum) )
{
if ( todo.height < 20 )
{
// something is very wrong if we can't render even at this
// slow space, let's bail out and fall back to low quality
// preview
wxLogTrace(_T("printing"),
_T("it seems that HQ preview doesn't work at all"));
return false;
}
// it's possible our memory calculation was off, or conditions
// changed, or there's not enough _bitmap_ resources; try if using
// smaller bitmap would help:
todo.height /= 2;
wxLogTrace(_T("printing"),
_T("preview of fragment failed, reducing height to %ipx"),
todo.height);
continue; // retry at the same position again
}
// move to the next segment
todo.Offset(0, todo.height);
}
return true;
}
#endif // wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW
#endif // wxUSE_PRINTING_ARCHITECTURE

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 03.06.01
// RCS-ID: $Id: radiocmn.cpp 39676 2006-06-11 21:13:13Z VZ $
// RCS-ID: $Id: radiocmn.cpp 54930 2008-08-02 19:45:23Z VZ $
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// License: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -64,96 +64,106 @@ void wxRadioBoxBase::SetMajorDim(unsigned int majorDim, long style)
int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const
{
const int itemStart = item;
int count = GetCount(),
numCols = GetColumnCount(),
numRows = GetRowCount();
bool horz = (style & wxRA_SPECIFY_COLS) != 0;
switch ( dir )
do
{
case wxUP:
if ( horz )
{
item -= numCols;
}
else // vertical layout
{
if ( !item-- )
item = count - 1;
}
break;
switch ( dir )
{
case wxUP:
if ( horz )
{
item -= numCols;
}
else // vertical layout
{
if ( !item-- )
item = count - 1;
}
break;
case wxLEFT:
if ( horz )
{
if ( !item-- )
item = count - 1;
}
else // vertical layout
{
item -= numRows;
}
break;
case wxLEFT:
if ( horz )
{
if ( !item-- )
item = count - 1;
}
else // vertical layout
{
item -= numRows;
}
break;
case wxDOWN:
if ( horz )
{
item += numCols;
}
else // vertical layout
{
if ( ++item == count )
item = 0;
}
break;
case wxDOWN:
if ( horz )
{
item += numCols;
}
else // vertical layout
{
if ( ++item == count )
item = 0;
}
break;
case wxRIGHT:
if ( horz )
{
if ( ++item == count )
item = 0;
}
else // vertical layout
{
item += numRows;
}
break;
case wxRIGHT:
if ( horz )
{
if ( ++item == count )
item = 0;
}
else // vertical layout
{
item += numRows;
}
break;
default:
wxFAIL_MSG( _T("unexpected wxDirection value") );
return wxNOT_FOUND;
default:
wxFAIL_MSG( _T("unexpected wxDirection value") );
return wxNOT_FOUND;
}
// ensure that the item is in range [0..count)
if ( item < 0 )
{
// first map the item to the one in the same column but in the last
// row
item += count;
// now there are 2 cases: either it is the first item of the last
// row in which case we need to wrap again and get to the last item
// or we can just go to the previous item
if ( item % (horz ? numCols : numRows) )
item--;
else
item = count - 1;
}
else if ( item >= count )
{
// same logic as above
item -= count;
// ... except that we need to check if this is not the last item,
// not the first one
if ( (item + 1) % (horz ? numCols : numRows) )
item++;
else
item = 0;
}
wxASSERT_MSG( item < count && item >= 0,
_T("logic error in wxRadioBox::GetNextItem()") );
}
// ensure that the item is in range [0..count)
if ( item < 0 )
{
// first map the item to the one in the same column but in the last row
item += count;
// now there are 2 cases: either it is the first item of the last row
// in which case we need to wrap again and get to the last item or we
// can just go to the previous item
if ( item % (horz ? numCols : numRows) )
item--;
else
item = count - 1;
}
else if ( item >= count )
{
// same logic as above
item -= count;
// ... except that we need to check if this is not the last item, not
// the first one
if ( (item + 1) % (horz ? numCols : numRows) )
item++;
else
item = 0;
}
wxASSERT_MSG( item < count && item >= 0,
_T("logic error in wxRadioBox::GetNextItem()") );
// we shouldn't select the non-active items, continue looking for a
// visible and shown one unless we came back to the item we started from in
// which case bail out to avoid infinite loop
while ( !(IsItemShown(item) && IsItemEnabled(item)) && item != itemStart );
return item;
}

View File

@ -4,7 +4,7 @@
// Author: Karsten Ballueder and Vadim Zeitlin
// Modified by:
// Created: 13.07.01
// RCS-ID: $Id: regex.cpp 50711 2007-12-15 02:57:58Z VZ $
// RCS-ID: $Id: regex.cpp 57779 2009-01-02 17:35:16Z PC $
// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net>
// 2001 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
@ -27,9 +27,10 @@
#if wxUSE_REGEX
#include "wx/regex.h"
#ifndef WX_PRECOMP
#include "wx/object.h"
#include "wx/string.h"
#include "wx/log.h"
#include "wx/intl.h"
#endif //WX_PRECOMP
@ -43,7 +44,6 @@
#endif
#include <regex.h>
#include "wx/regex.h"
// WXREGEX_USING_BUILTIN defined when using the built-in regex lib
// WXREGEX_USING_RE_SEARCH defined when using re_search in the GNU regex lib
@ -277,12 +277,15 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags)
// translate our flags to regcomp() ones
int flagsRE = 0;
if ( !(flags & wxRE_BASIC) )
{
#ifndef WX_NO_REGEX_ADVANCED
if (flags & wxRE_ADVANCED)
flagsRE |= REG_ADVANCED;
else
#endif
flagsRE |= REG_EXTENDED;
}
if ( flags & wxRE_ICASE )
flagsRE |= REG_ICASE;
if ( flags & wxRE_NOSUB )

View File

@ -4,7 +4,7 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 2004-08-15
// RCS-ID: $Id: stockitem.cpp 42936 2006-11-02 10:42:42Z JS $
// RCS-ID: $Id: stockitem.cpp 58617 2009-02-02 05:12:43Z SC $
// Copyright: (c) Vaclav Slavik, 2004
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -235,15 +235,15 @@ wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id)
switch (id)
{
STOCKITEM(wxID_COPY, wxACCEL_CTRL,'C')
STOCKITEM(wxID_CUT, wxACCEL_CTRL,'X')
STOCKITEM(wxID_FIND, wxACCEL_CTRL,'F')
STOCKITEM(wxID_REPLACE, wxACCEL_CTRL,'R')
STOCKITEM(wxID_HELP, wxACCEL_CTRL,'H')
STOCKITEM(wxID_NEW, wxACCEL_CTRL,'N')
STOCKITEM(wxID_OPEN, wxACCEL_CTRL,'O')
STOCKITEM(wxID_PASTE, wxACCEL_CTRL,'V')
STOCKITEM(wxID_SAVE, wxACCEL_CTRL,'S')
STOCKITEM(wxID_COPY, wxACCEL_CMD,'C')
STOCKITEM(wxID_CUT, wxACCEL_CMD,'X')
STOCKITEM(wxID_FIND, wxACCEL_CMD,'F')
STOCKITEM(wxID_REPLACE, wxACCEL_CMD,'R')
STOCKITEM(wxID_HELP, wxACCEL_CMD,'H')
STOCKITEM(wxID_NEW, wxACCEL_CMD,'N')
STOCKITEM(wxID_OPEN, wxACCEL_CMD,'O')
STOCKITEM(wxID_PASTE, wxACCEL_CMD,'V')
STOCKITEM(wxID_SAVE, wxACCEL_CMD,'S')
default:
// set the wxAcceleratorEntry to return into an invalid state:

View File

@ -5,7 +5,7 @@
// Ryan Norton, Fredrik Roubert (UTF7)
// Modified by:
// Created: 29/01/98
// RCS-ID: $Id: strconv.cpp 45921 2007-05-09 18:10:26Z VZ $
// RCS-ID: $Id: strconv.cpp 56394 2008-10-17 11:31:22Z VZ $
// Copyright: (c) 1999 Ove Kaaven, Robert Roebling, Vaclav Slavik
// (c) 2000-2003 Vadim Zeitlin
// (c) 2004 Ryan Norton, Fredrik Roubert
@ -66,6 +66,8 @@
// includes Mac headers
#include "wx/mac/private.h"
#include "wx/thread.h"
#endif
@ -1957,7 +1959,7 @@ size_t wxMBConv_iconv::GetMBNulLen() const
wxMutexLocker lock(self->m_iconvMutex);
#endif
wchar_t *wnul = L"";
const wchar_t *wnul = L"";
char buf[8]; // should be enough for NUL in any encoding
size_t inLen = sizeof(wchar_t),
outLen = WXSIZEOF(buf);
@ -2733,7 +2735,8 @@ public:
#if wxUSE_FONTMAP
wxMBConv_mac(const wxChar* name)
{
Init( wxMacGetSystemEncFromFontEnc( wxFontMapperBase::Get()->CharsetToEncoding(name, false) ) );
wxFontEncoding enc = wxFontMapperBase::Get()->CharsetToEncoding(name, false);
Init( (enc != wxFONTENCODING_SYSTEM) ? wxMacGetSystemEncFromFontEnc( enc ) : kTextEncodingUnknown);
}
#endif
@ -2756,13 +2759,22 @@ public:
{
m_MB2WC_converter = NULL ;
m_WC2MB_converter = NULL ;
m_char_encoding = CreateTextEncoding(encoding, encodingVariant, encodingFormat) ;
m_unicode_encoding = CreateTextEncoding(kTextEncodingUnicodeDefault, 0, kUnicode16BitFormat) ;
if ( encoding != kTextEncodingUnknown )
{
m_char_encoding = CreateTextEncoding(encoding, encodingVariant, encodingFormat) ;
m_unicode_encoding = CreateTextEncoding(kTextEncodingUnicodeDefault, 0, kUnicode16BitFormat) ;
}
else
{
m_char_encoding = kTextEncodingUnknown;
m_unicode_encoding = kTextEncodingUnknown;
}
}
virtual void CreateIfNeeded() const
{
if ( m_MB2WC_converter == NULL && m_WC2MB_converter == NULL )
if ( m_MB2WC_converter == NULL && m_WC2MB_converter == NULL &&
m_char_encoding != kTextEncodingUnknown && m_unicode_encoding != kTextEncodingUnknown )
{
OSStatus status = noErr ;
status = TECCreateConverter(&m_MB2WC_converter,
@ -2800,10 +2812,14 @@ public:
#else
ubuf = (UniChar*) (buf ? buf : tbuf) ;
#endif
status = TECConvertText(
{
#if wxUSE_THREADS
wxMutexLocker lock( m_MB2WC_guard );
#endif
status = TECConvertText(
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
(TextPtr) ubuf, byteBufferLen, &byteOutLen);
}
#if SIZEOF_WCHAR_T == 4
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar
@ -2854,10 +2870,15 @@ public:
ubuf = (UniChar*) psz ;
#endif
status = TECConvertText(
{
#if wxUSE_THREADS
wxMutexLocker lock( m_WC2MB_guard );
#endif
status = TECConvertText(
m_WC2MB_converter, (ConstTextPtr) ubuf, byteInLen, &byteInLen,
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
}
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
@ -2898,6 +2919,10 @@ public:
protected :
mutable TECObjectRef m_MB2WC_converter;
mutable TECObjectRef m_WC2MB_converter;
#if wxUSE_THREADS
mutable wxMutex m_MB2WC_guard;
mutable wxMutex m_WC2MB_guard;
#endif
TextEncodingBase m_char_encoding;
TextEncodingBase m_unicode_encoding;
@ -2958,15 +2983,20 @@ public :
ByteCount dcubufread , dcubufwritten ;
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
ConvertFromUnicodeToText( m_uni , byteInLen , ubuf ,
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , dcubuf ) ;
{
#if wxUSE_THREADS
wxMutexLocker lock( m_WC2MB_guard );
#endif
ConvertFromUnicodeToText( m_uni , byteInLen , ubuf ,
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , dcubuf ) ;
// we now convert that decomposed buffer into UTF8
// we now convert that decomposed buffer into UTF8
status = TECConvertText(
status = TECConvertText(
m_WC2MB_converter, (ConstTextPtr) dcubuf, dcubufwritten, &dcubufread,
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
}
free( dcubuf );
#if SIZEOF_WCHAR_T == 4
@ -3015,16 +3045,21 @@ public :
ByteCount dcubufread , dcubufwritten ;
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
status = TECConvertText(
{
#if wxUSE_THREADS
wxMutexLocker lock( m_MB2WC_guard );
#endif
status = TECConvertText(
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
(TextPtr) dcubuf, dcubuflen, &byteOutLen);
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar
// is not properly terminated we get random characters at the end
dcubuf[byteOutLen / sizeof( UniChar ) ] = 0 ;
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar
// is not properly terminated we get random characters at the end
dcubuf[byteOutLen / sizeof( UniChar ) ] = 0 ;
// now from the decomposed UniChar to properly composed uniChar
ConvertFromUnicodeToText( m_uniBack , byteOutLen , dcubuf ,
// now from the decomposed UniChar to properly composed uniChar
ConvertFromUnicodeToText( m_uniBack , byteOutLen , dcubuf ,
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , ubuf ) ;
}
free( dcubuf );
byteOutLen = dcubufwritten ;
@ -3205,6 +3240,16 @@ wxCSConv::wxCSConv(const wxChar *charset)
#if wxUSE_FONTMAP
m_encoding = wxFontMapperBase::GetEncodingFromName(charset);
if ( m_encoding == wxFONTENCODING_MAX )
{
// set to unknown/invalid value
m_encoding = wxFONTENCODING_SYSTEM;
}
else if ( m_encoding == wxFONTENCODING_DEFAULT )
{
// wxFONTENCODING_DEFAULT is same as US-ASCII in this context
m_encoding = wxFONTENCODING_ISO8859_1;
}
#else
m_encoding = wxFONTENCODING_SYSTEM;
#endif
@ -3506,7 +3551,7 @@ void wxCSConv::CreateConvIfNeeded() const
if ( !m_name && m_encoding == wxFONTENCODING_SYSTEM )
{
#if wxUSE_INTL
self->m_name = wxStrdup(wxLocale::GetSystemEncodingName());
self->m_encoding = wxLocale::GetSystemEncoding();
#else
// fallback to some reasonable default:
self->m_encoding = wxFONTENCODING_ISO8859_1;
@ -3540,7 +3585,19 @@ size_t wxCSConv::ToWChar(wchar_t *dst, size_t dstLen,
return m_convReal->ToWChar(dst, dstLen, src, srcLen);
// latin-1 (direct)
return wxMBConv::ToWChar(dst, dstLen, src, srcLen);
if ( srcLen == wxNO_LEN )
srcLen = strlen(src) + 1; // take trailing NUL too
if ( dst )
{
if ( dstLen < srcLen )
return wxCONV_FAILED;
for ( size_t n = 0; n < srcLen; n++ )
dst[n] = (unsigned char)(src[n]);
}
return srcLen;
}
size_t wxCSConv::FromWChar(char *dst, size_t dstLen,
@ -3552,57 +3609,45 @@ size_t wxCSConv::FromWChar(char *dst, size_t dstLen,
return m_convReal->FromWChar(dst, dstLen, src, srcLen);
// latin-1 (direct)
return wxMBConv::FromWChar(dst, dstLen, src, srcLen);
if ( srcLen == wxNO_LEN )
srcLen = wxWcslen(src) + 1;
if ( dst )
{
if ( dstLen < srcLen )
return wxCONV_FAILED;
for ( size_t n = 0; n < srcLen; n++ )
{
if ( src[n] > 0xFF )
return wxCONV_FAILED;
dst[n] = (char)src[n];
}
}
else // still need to check the input validity
{
for ( size_t n = 0; n < srcLen; n++ )
{
if ( src[n] > 0xFF )
return wxCONV_FAILED;
}
}
return srcLen;
}
size_t wxCSConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const
{
CreateConvIfNeeded();
if (m_convReal)
return m_convReal->MB2WC(buf, psz, n);
// latin-1 (direct)
size_t len = strlen(psz);
if (buf)
{
for (size_t c = 0; c <= len; c++)
buf[c] = (unsigned char)(psz[c]);
}
return len;
// this function exists only for ABI-compatibility in 2.8 branch
return wxMBConv::MB2WC(buf, psz, n);
}
size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
{
CreateConvIfNeeded();
if (m_convReal)
return m_convReal->WC2MB(buf, psz, n);
// latin-1 (direct)
const size_t len = wxWcslen(psz);
if (buf)
{
for (size_t c = 0; c <= len; c++)
{
if (psz[c] > 0xFF)
return wxCONV_FAILED;
buf[c] = (char)psz[c];
}
}
else
{
for (size_t c = 0; c <= len; c++)
{
if (psz[c] > 0xFF)
return wxCONV_FAILED;
}
}
return len;
// this function exists only for ABI-compatibility in 2.8 branch
return wxMBConv::WC2MB(buf, psz, n);
}
size_t wxCSConv::GetMBNulLen() const

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin, Ryan Norton
// Modified by:
// Created: 29/01/98
// RCS-ID: $Id: string.cpp 53702 2008-05-22 17:22:00Z SN $
// RCS-ID: $Id: string.cpp 56758 2008-11-13 22:32:21Z VS $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// (c) 2004 Ryan Norton <wxprojects@comcast.net>
// Licence: wxWindows licence
@ -1492,8 +1492,8 @@ wxString wxString::AfterFirst(wxChar ch) const
}
// replace first (or all) occurences of some substring with another one
size_t wxString::Replace(const wxChar *szOld,
const wxChar *szNew, bool bReplaceAll)
size_t
wxString::Replace(const wxChar *szOld, const wxChar *szNew, bool bReplaceAll)
{
// if we tried to replace an empty string we'd enter an infinite loop below
wxCHECK_MSG( szOld && *szOld && szNew, 0,
@ -1501,33 +1501,48 @@ size_t wxString::Replace(const wxChar *szOld,
size_t uiCount = 0; // count of replacements made
size_t uiOldLen = wxStrlen(szOld);
size_t uiNewLen = wxStrlen(szNew);
size_t dwPos = 0;
while ( this->c_str()[dwPos] != wxT('\0') )
// optimize the special common case of replacing one character with another
// one
if ( szOld[1] == '\0' && (szNew[0] != '\0' && szNew[1] == '\0') )
{
//DO NOT USE STRSTR HERE
//this string can contain embedded null characters,
//so strstr will function incorrectly
dwPos = find(szOld, dwPos);
if ( dwPos == npos )
break; // exit the loop
else
// this loop is the simplified version of the one below
for ( size_t pos = 0; ; )
{
//replace this occurance of the old string with the new one
replace(dwPos, uiOldLen, szNew, uiNewLen);
pos = find(*szOld, pos);
if ( pos == npos )
break;
//move up pos past the string that was replaced
dwPos += uiNewLen;
(*this)[pos++] = *szNew;
//increase replace count
++uiCount;
uiCount++;
if ( !bReplaceAll )
break;
}
}
else // general case
{
const size_t uiOldLen = wxStrlen(szOld);
const size_t uiNewLen = wxStrlen(szNew);
for ( size_t pos = 0; ; )
{
pos = find(szOld, pos);
if ( pos == npos )
break;
// replace this occurrence of the old string with the new one
replace(pos, uiOldLen, szNew, uiNewLen);
// move past the string that was replaced
pos += uiNewLen;
// increase replace count
uiCount++;
// stop now?
if ( !bReplaceAll )
break; // exit the loop
break;
}
}
@ -2630,3 +2645,10 @@ int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2)
{
return -s1->Cmp(*s2);
}
wxString* wxCArrayString::Release()
{
wxString *r = GetStrings();
m_strings = NULL;
return r;
}

View File

@ -3,7 +3,7 @@
// Purpose: Implementation of a uri parser
// Author: Ryan Norton
// Created: 10/26/04
// RCS-ID: $Id: uri.cpp 37403 2006-02-09 03:09:36Z VZ $
// RCS-ID: $Id: uri.cpp 58728 2009-02-07 22:03:30Z VZ $
// Copyright: (c) 2004 Ryan Norton
// Licence: wxWindows
/////////////////////////////////////////////////////////////////////////////
@ -159,22 +159,19 @@ bool wxURI::IsEscape(const wxChar*& uri)
// ---------------------------------------------------------------------------
wxString wxURI::GetUser() const
{
size_t dwPasswordPos = m_userinfo.find(':');
if (dwPasswordPos == wxString::npos)
dwPasswordPos = 0;
return m_userinfo(0, dwPasswordPos);
// if there is no colon at all, find() returns npos and this method returns
// the entire string which is correct as it means that password was omitted
return m_userinfo(0, m_userinfo.find(':'));
}
wxString wxURI::GetPassword() const
{
size_t dwPasswordPos = m_userinfo.find(':');
size_t posColon = m_userinfo.find(':');
if (dwPasswordPos == wxString::npos)
if ( posColon == wxString::npos )
return wxT("");
else
return m_userinfo(dwPasswordPos+1, m_userinfo.length() + 1);
return m_userinfo(posColon + 1, wxString::npos);
}
// ---------------------------------------------------------------------------
@ -867,7 +864,7 @@ void wxURI::Resolve(const wxURI& base, int flags)
// T.path = remove_dot_segments(T.path);
// endif;
// T.query = R.query;
if (m_path[0u] != wxT('/'))
if (m_path.empty() || m_path[0u] != wxT('/'))
{
//Merge paths
const wxChar* op = m_path.c_str();

View File

@ -4,7 +4,7 @@
// Author: Guilhem Lavaux
// Modified by:
// Created: 20/07/1997
// RCS-ID: $Id: url.cpp 49798 2007-11-09 23:17:49Z VZ $
// RCS-ID: $Id: url.cpp 57545 2008-12-25 17:03:20Z VZ $
// Copyright: (c) 1997, 1998 Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -242,11 +242,11 @@ wxInputStream *wxURL::GetInputStream()
size_t dwPasswordPos = m_userinfo.find(':');
if (dwPasswordPos == wxString::npos)
m_protocol->SetUser(m_userinfo);
m_protocol->SetUser(Unescape(m_userinfo));
else
{
m_protocol->SetUser(m_userinfo(0, dwPasswordPos));
m_protocol->SetPassword(m_userinfo(dwPasswordPos+1, m_userinfo.length() + 1));
m_protocol->SetUser(Unescape(m_userinfo(0, dwPasswordPos)));
m_protocol->SetPassword(Unescape(m_userinfo(dwPasswordPos+1, m_userinfo.length() + 1)));
}
}

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 10/09/98
// RCS-ID: $Id: variant.cpp 45498 2007-04-16 13:03:05Z VZ $
// RCS-ID: $Id: variant.cpp 58054 2009-01-12 17:27:53Z JMS $
// Copyright: (c)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -1223,7 +1223,11 @@ bool wxVariantDataDateTime::Write(wxSTD ostream& str) const
bool wxVariantDataDateTime::Write(wxString& str) const
{
str = m_value.Format();
if ( m_value.IsValid() )
str = m_value.Format();
else
str = wxT("Invalid");
return true;
}
@ -1239,6 +1243,12 @@ bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
bool wxVariantDataDateTime::Read(wxString& str)
{
if ( str == wxT("Invalid") )
{
m_value = wxInvalidDateTime;
return true;
}
if(! m_value.ParseDateTime(str))
return false;
return true;

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 11/07/98
// RCS-ID: $Id: wfstream.cpp 44013 2006-12-19 13:49:26Z SC $
// RCS-ID: $Id: wfstream.cpp 54418 2008-06-29 01:28:43Z VZ $
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -107,9 +107,9 @@ wxFileOffset wxFileInputStream::OnSysTell() const
return m_file->Tell();
}
bool wxFileInputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
bool wxFileInputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
}
// ----------------------------------------------------------------------------
@ -183,9 +183,9 @@ wxFileOffset wxFileOutputStream::GetLength() const
return m_file->Length();
}
bool wxFileOutputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
bool wxFileOutputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
}
// ----------------------------------------------------------------------------
@ -220,9 +220,16 @@ size_t wxTempFileOutputStream::OnSysWrite(const void *buffer, size_t size)
// ----------------------------------------------------------------------------
wxFileStream::wxFileStream(const wxString& fileName)
: wxFileInputStream(fileName)
: wxFileInputStream(),
wxFileOutputStream()
{
wxFileOutputStream::m_file = wxFileInputStream::m_file;
wxFileOutputStream::m_file =
wxFileInputStream::m_file = new wxFile(fileName, wxFile::read_write);
// this is a bit ugly as streams are symmetric but we still have to delete
// the file we created above exactly once so we decide to (arbitrarily) do
// it in wxFileInputStream
wxFileInputStream::m_file_destroy = true;
}
#endif //wxUSE_FILE
@ -300,9 +307,9 @@ wxFileOffset wxFFileInputStream::OnSysTell() const
return m_file->Tell();
}
bool wxFFileInputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
bool wxFFileInputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
}
// ----------------------------------------------------------------------------
@ -386,9 +393,9 @@ wxFileOffset wxFFileOutputStream::GetLength() const
return m_file->Length();
}
bool wxFFileOutputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
bool wxFFileOutputStream::IsOk() const
{
return (wxStreamBase::IsOk() && m_file->IsOpened());
}
// ----------------------------------------------------------------------------
@ -396,9 +403,14 @@ bool wxFFileOutputStream::IsOk() const
// ----------------------------------------------------------------------------
wxFFileStream::wxFFileStream(const wxString& fileName)
: wxFFileInputStream(fileName)
: wxFFileInputStream(),
wxFFileOutputStream()
{
wxFFileOutputStream::m_file = wxFFileInputStream::m_file;
wxFFileOutputStream::m_file =
wxFFileInputStream::m_file = new wxFFile(fileName, _T("w+b"));
// see comment in wxFileStream ctor
wxFFileInputStream::m_file_destroy = true;
}
#endif //wxUSE_FFILE

View File

@ -4,7 +4,7 @@
// Author: Julian Smart, Vadim Zeitlin
// Modified by:
// Created: 13/07/98
// RCS-ID: $Id: wincmn.cpp 52330 2008-03-05 14:19:38Z VS $
// RCS-ID: $Id: wincmn.cpp 57704 2009-01-01 15:18:40Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -2363,7 +2363,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
msg.Printf(_T("wxWidgets Library (%s port)\n")
_T("Version %d.%d.%d%s%s, compiled at %s %s\n")
_T("Runtime version of toolkit used is %d.%d.%s\n")
_T("Copyright (c) 1995-2007 wxWidgets team"),
_T("Copyright (c) 1995-2009 wxWidgets team"),
wxPlatformInfo::Get().GetPortIdName().c_str(),
wxMAJOR_VERSION,
wxMINOR_VERSION,
@ -2749,6 +2749,56 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
return win ? win->GetMainWindowOfCompositeControl() : NULL;
}
// ----------------------------------------------------------------------------
// drag and drop
// ----------------------------------------------------------------------------
#if wxUSE_DRAG_AND_DROP && !defined(__WXMSW__)
class wxDragAcceptFilesImplTarget : public wxFileDropTarget
{
public:
wxDragAcceptFilesImplTarget(wxWindowBase *win) : m_win(win) {}
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames)
{
wxDropFilesEvent event(wxEVT_DROP_FILES,
filenames.size(),
wxCArrayString(filenames).Release());
event.SetEventObject(m_win);
event.m_pos.x = x;
event.m_pos.y = y;
return m_win->GetEventHandler()->ProcessEvent(event);
}
private:
wxWindowBase * const m_win;
DECLARE_NO_COPY_CLASS(wxDragAcceptFilesImplTarget)
};
// Generic version of DragAcceptFiles(). It works by installing a simple
// wxFileDropTarget-to-EVT_DROP_FILES adaptor and therefore cannot be used
// together with explicit SetDropTarget() calls.
void wxWindowBase::DragAcceptFiles(bool accept)
{
if ( accept )
{
wxASSERT_MSG( !GetDropTarget(),
_T("cannot use DragAcceptFiles() and SetDropTarget() together") );
SetDropTarget(new wxDragAcceptFilesImplTarget(this));
}
else
{
SetDropTarget(NULL);
}
}
#endif // wxUSE_DRAG_AND_DROP && !defined(__WXMSW__)
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
// Author: Ove Kaven
// Modified by: Ron Lee, Francesco Montorsi
// Created: 09/04/99
// RCS-ID: $Id: wxchar.cpp 54071 2008-06-10 18:22:32Z VZ $
// RCS-ID: $Id: wxchar.cpp 58994 2009-02-18 15:49:09Z FM $
// Copyright: (c) wxWidgets copyright
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -565,6 +565,8 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
break;
case wxT('c'):
m_szFlags[flagofs++] = char(ch);
m_szFlags[flagofs] = '\0';
if (ilen == -1)
{
// in Unicode mode %hc == ANSI character
@ -591,6 +593,8 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
break;
case wxT('s'):
m_szFlags[flagofs++] = char(ch);
m_szFlags[flagofs] = '\0';
if (ilen == -1)
{
// Unicode mode wx extension: we'll let %hs mean non-Unicode
@ -615,6 +619,8 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
break;
case wxT('n'):
m_szFlags[flagofs++] = char(ch);
m_szFlags[flagofs] = '\0';
if (ilen == 0)
m_type = wxPAT_NINT;
else if (ilen == -1)
@ -671,7 +677,7 @@ void wxPrintfConvSpec::ReplaceAsteriskWith(int width)
bool wxPrintfConvSpec::LoadArg(wxPrintfArg *p, va_list &argptr)
{
// did the '*' width/precision specifier was used ?
// was the '*' width/precision specifier used ?
if (m_nMaxWidth == -1)
{
// take the maxwidth specifier from the stack
@ -1191,7 +1197,7 @@ int WXDLLEXPORT wxVsnprintf_(wxChar *buf, size_t lenMax,
// NOTE2: the +1 is because we want to copy also the '\0'
size_t tocopy = wxStrlen(format) + 1 - ( toparse - format ) ;
lenCur += wxCopyStrWithPercents(lenMax - lenCur, buf + lenCur,
lenCur += wxCopyStrWithPercents(lenMax - lenCur, buf + lenCur,
tocopy, toparse) - 1;
if (buf[lenCur])
{
@ -1256,7 +1262,7 @@ int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...)
int wxSprintf (wchar_t * s, const wchar_t * format, ... )
{
va_list arglist;
va_start( arglist, format );
int iLen = swprintf ( s, -1, format, arglist );
va_end( arglist );

View File

@ -2,7 +2,7 @@
// Name: src/common/xpmdecod.cpp
// Purpose: wxXPMDecoder
// Author: John Cristy, Vaclav Slavik
// RCS-ID: $Id: xpmdecod.cpp 41689 2006-10-08 08:04:49Z PC $
// RCS-ID: $Id: xpmdecod.cpp 54948 2008-08-03 10:54:33Z VZ $
// Copyright: (c) John Cristy, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -108,6 +108,7 @@ license is as follows:
#include "wx/hashmap.h"
#include "wx/stream.h"
#include "wx/image.h"
#include "wx/palette.h"
#endif
#include <string.h>
@ -808,6 +809,24 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
}
}
#if wxUSE_PALETTE
unsigned char* r = new unsigned char[colors_cnt];
unsigned char* g = new unsigned char[colors_cnt];
unsigned char* b = new unsigned char[colors_cnt];
for (it = clr_tbl.begin(), i = 0; it != clr_tbl.end(); it++, i++)
{
r[i] = it->second.R;
g[i] = it->second.G;
b[i] = it->second.B;
}
wxASSERT(i == colors_cnt);
img.SetPalette(wxPalette(colors_cnt, r, g, b));
delete[] r;
delete[] g;
delete[] b;
#endif // wxUSE_PALETTE
return img;
}

View File

@ -3,7 +3,7 @@
// Purpose: implements wxGenericAboutBox() function
// Author: Vadim Zeitlin
// Created: 2006-10-08
// RCS-ID: $Id: aboutdlgg.cpp 49560 2007-10-31 16:08:18Z VZ $
// RCS-ID: $Id: aboutdlgg.cpp 58761 2009-02-08 14:55:44Z VZ $
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -96,6 +96,19 @@ wxIcon wxAboutDialogInfo::GetIcon() const
return icon;
}
wxString wxAboutDialogInfo::GetCopyrightToDisplay() const
{
wxString ret = m_copyright;
#if wxUSE_UNICODE
const wxString copyrightSign = wxString::FromUTF8("\xc2\xa9");
ret.Replace(_T("(c)"), copyrightSign);
ret.Replace(_T("(C)"), copyrightSign);
#endif // wxUSE_UNICODE
return ret;
}
// ----------------------------------------------------------------------------
// wxGenericAboutDialog
// ----------------------------------------------------------------------------
@ -120,7 +133,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info)
m_sizerText->Add(label, wxSizerFlags().Centre().Border());
m_sizerText->AddSpacer(5);
AddText(info.GetCopyright());
AddText(info.GetCopyrightToDisplay());
AddText(info.GetDescription());
if ( info.HasWebSite() )

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin (original code by Robert Roebling)
// Modified by:
// Created: 25.05.99
// RCS-ID: $Id: caret.cpp 42397 2006-10-25 12:12:56Z VS $
// RCS-ID: $Id: caret.cpp 55170 2008-08-22 10:34:32Z JS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -268,10 +268,37 @@ void wxCaret::Refresh()
void wxCaret::DoDraw(wxDC *dc)
{
dc->SetPen( *wxBLACK_PEN );
dc->SetBrush(*(m_hasFocus ? wxBLACK_BRUSH : wxTRANSPARENT_BRUSH));
dc->SetPen(*wxBLACK_PEN);
#if defined(__WXGTK__) || defined(__WXMAC__)
wxClientDC* clientDC = wxDynamicCast(dc, wxClientDC);
if (clientDC)
{
wxPen pen(*wxBLACK_PEN);
wxBrush brush(*wxBLACK_BRUSH);
#ifdef __WXGTK__
wxWindow* win = clientDC->m_owner;
#else
wxWindow* win = clientDC->GetWindow();
#endif
if (win)
{
wxColour backgroundColour(win->GetBackgroundColour());
if (backgroundColour.Red() < 100 &&
backgroundColour.Green() < 100 &&
backgroundColour.Blue() < 100)
{
pen = *wxWHITE_PEN;
brush = *wxWHITE_BRUSH;
}
}
dc->SetPen( pen );
dc->SetBrush(m_hasFocus ? brush : *wxTRANSPARENT_BRUSH);
}
else
#endif
{
dc->SetBrush(*(m_hasFocus ? wxBLACK_BRUSH : wxTRANSPARENT_BRUSH));
dc->SetPen(*wxBLACK_PEN);
}
// VZ: unfortunately, the rectangle comes out a pixel smaller when this is
// done under wxGTK - no idea why

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp
// Created: 15.09.04
// RCS-ID: $Id: choicbkg.cpp 53045 2008-04-06 15:14:25Z VZ $
// RCS-ID: $Id: choicbkg.cpp 58355 2009-01-24 14:12:59Z VZ $
// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -146,11 +146,15 @@ wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
wxSize size = sizePage;
if ( IsVertical() )
{
if ( sizeChoice.x > sizePage.x )
size.x = sizeChoice.x;
size.y += sizeChoice.y + GetInternalBorder();
}
else // left/right aligned
{
size.x += sizeChoice.x + GetInternalBorder();
if ( sizeChoice.y > sizePage.y )
size.y = sizeChoice.y;
}
return size;

View File

@ -4,7 +4,7 @@
// Author: Francesco Montorsi (readapted code written by Vadim Zeitlin)
// Modified by:
// Created: 15/04/2006
// RCS-ID: $Id: clrpickerg.cpp 52835 2008-03-26 15:49:08Z JS $
// RCS-ID: $Id: clrpickerg.cpp 58967 2009-02-17 13:31:28Z SC $
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -36,7 +36,7 @@
// ============================================================================
wxColourData wxGenericColourButton::ms_data;
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxButton)
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxCLRBTN_BASE_CLASS)
// ----------------------------------------------------------------------------
// wxGenericColourButton
@ -48,8 +48,14 @@ bool wxGenericColourButton::Create( wxWindow *parent, wxWindowID id,
const wxValidator& validator, const wxString &name)
{
// create this button
#if wxCLRBTN_USES_BMP_BUTTON
wxBitmap empty(1,1);
if (!wxBitmapButton::Create( parent, id, empty, pos,
size, style, validator, name ))
#else
if (!wxButton::Create( parent, id, wxEmptyString, pos,
size, style, validator, name ))
#endif
{
wxFAIL_MSG( wxT("wxGenericColourButton creation failed") );
return false;
@ -101,8 +107,13 @@ void wxGenericColourButton::UpdateColour()
{
if ( !m_colour.Ok() )
{
#if wxCLRBTN_USES_BMP_BUTTON
wxBitmap empty(1,1);
SetBitmapLabel(empty);
#else
if ( HasFlag(wxCLRP_SHOW_LABEL) )
SetLabel(wxEmptyString);
#endif
return;
}
@ -110,18 +121,63 @@ void wxGenericColourButton::UpdateColour()
// the colour to make sure fg colour is different enough from m_colour
wxColour colFg(~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue());
#if wxCLRBTN_USES_BMP_BUTTON
wxSize sz = GetSize();
sz.x -= 2*GetMarginX();
sz.y -= 2*GetMarginY();
wxPoint topleft;
if ( sz.x < 1 )
sz.x = 1;
else
if ( sz.y < 1 )
sz.y = 1;
wxBitmap bmp(sz.x, sz.y);
{
wxMemoryDC memdc(bmp);
memdc.SetPen(colFg);
memdc.SetBrush(m_colour);
memdc.DrawRectangle(topleft,sz);
if ( HasFlag(wxCLRP_SHOW_LABEL) )
{
int x, y, leading, desc;
wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX);
memdc.GetTextExtent(label,&x,&y,&desc,&leading);
if ( x <= sz.x && y <= sz.y )
{
topleft.x += (sz.x-x)/2;
topleft.y += (sz.y-y)/2;
memdc.SetTextForeground(colFg);
memdc.DrawText(label,topleft);
}
}
}
SetBitmapLabel(bmp);
#else
SetForegroundColour(colFg);
SetBackgroundColour(m_colour);
if ( HasFlag(wxCLRP_SHOW_LABEL) )
SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX));
#endif
}
wxSize wxGenericColourButton::DoGetBestSize() const
{
wxSize sz(wxButton::DoGetBestSize());
if ( HasFlag(wxCLRP_SHOW_LABEL) )
{
#if wxCLRBTN_USES_BMP_BUTTON
int x, y, leading, desc;
wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX);
wxClientDC dc(const_cast<wxGenericColourButton*>(this));
dc.GetTextExtent(label,&x,&y,&desc,&leading);
sz.x = sz.y+x;
#endif
return sz;
}
// if we have no label, then make this button a square
// (like e.g. native GTK version of this control)

View File

@ -4,7 +4,7 @@
// Author: Andreas Pflug
// Modified by:
// Created: 2005-01-19
// RCS-ID: $Id: datectlg.cpp 53510 2008-05-09 22:15:55Z RD $
// RCS-ID: $Id: datectlg.cpp 54407 2008-06-28 18:58:07Z VZ $
// Copyright: (c) 2005 Andreas Pflug <pgadmin@pse-consulting.de>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -169,6 +169,11 @@ public:
}
}
bool IsTextEmpty() const
{
return m_combo->GetTextCtrl()->IsEmpty();
}
bool ParseDateTime(const wxString& s, wxDateTime* pDt)
{
wxASSERT(pDt);
@ -470,6 +475,8 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate,
wxDateTime wxDatePickerCtrlGeneric::GetValue() const
{
if ( HasFlag(wxDP_ALLOWNONE) && m_popup->IsTextEmpty() )
return wxInvalidDateTime;
return m_popup->GetDate();
}

View File

@ -4,7 +4,7 @@
// Author: Julian Smart, Robert Roebling, Markus Holzhem
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id: dcpsg.cpp 50711 2007-12-15 02:57:58Z VZ $
// RCS-ID: $Id: dcpsg.cpp 55927 2008-09-28 09:12:16Z VS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -987,8 +987,11 @@ void wxPostScriptDC::SetFont( const wxFont& font )
PsPrint( name );
PsPrint( " findfont\n" );
float size = float(m_font.GetPointSize());
size = size * GetFontPointSizeAdjustment(GetResolution());
char buffer[100];
sprintf( buffer, "%f scalefont setfont\n", LogicalToDeviceYRel(m_font.GetPointSize() * 1000) / 1000.0F);
sprintf( buffer, "%f scalefont setfont\n", size * m_scaleX);
// this is a hack - we must scale font size (in pts) according to m_scaleY but
// LogicalToDeviceYRel works with wxCoord type (int or longint). Se we first convert font size
// to 1/1000th of pt and then back.
@ -1590,7 +1593,6 @@ bool wxPostScriptDC::StartDoc( const wxString& message )
m_title = message;
PsPrint( "%!PS-Adobe-2.0\n" );
PsPrintf( wxT("%%%%Title: %s\n"), m_title.c_str() );
PsPrint( "%%Creator: wxWidgets PostScript renderer\n" );
PsPrintf( wxT("%%%%CreationDate: %s\n"), wxNow().c_str() );
if (m_printData.GetOrientation() == wxLANDSCAPE)
@ -1841,7 +1843,8 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if (!fontToUse) fontToUse = (wxFont*) &m_font;
wxCHECK_RET( fontToUse, wxT("GetTextExtent: no font defined") );
const float fontSize =
fontToUse->GetPointSize() * GetFontPointSizeAdjustment(72.0);
if (string.empty())
{
@ -1861,15 +1864,10 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
* Produces accurate results for mono-spaced font
* such as Courier (aka wxMODERN) */
int height = 12;
if (fontToUse)
{
height = fontToUse->GetPointSize();
}
if ( x )
*x = strlen (strbuf) * height * 72 / 120;
*x = strlen (strbuf) * fontSize * 72.0 / 120.0;
if ( y )
*y = (wxCoord) (height * 1.32); /* allow for descender */
*y = (wxCoord) (fontSize * 1.32); /* allow for descender */
if (descent) *descent = 0;
if (externalLeading) *externalLeading = 0;
#else
@ -2136,9 +2134,9 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
// VS: dirty, but is there any better solution?
double *pt;
pt = (double*) &m_underlinePosition;
*pt = LogicalToDeviceYRel((wxCoord)(UnderlinePosition * fontToUse->GetPointSize())) / 1000.0f;
*pt = LogicalToDeviceYRel((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f;
pt = (double*) &m_underlineThickness;
*pt = LogicalToDeviceYRel((wxCoord)(UnderlineThickness * fontToUse->GetPointSize())) / 1000.0f;
*pt = LogicalToDeviceYRel((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f;
}
@ -2148,7 +2146,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
/ string. they are given in 1/1000 of the size! */
long sum=0;
wxCoord height=Size; /* by default */
float height=fontSize; /* by default */
unsigned char *p;
for(p=(unsigned char *)wxMBSTRINGCAST strbuf; *p; p++)
{
@ -2164,7 +2162,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
}
double widthSum = sum;
widthSum *= Size;
widthSum *= fontSize;
widthSum /= 1000.0F;
/* add descender to height (it is usually a negative value) */
@ -2179,14 +2177,14 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if ( x )
*x = (wxCoord)widthSum;
if ( y )
*y = height;
*y = (wxCoord)height;
/* return other parameters */
if (descent)
{
if(lastDescender!=INT_MIN)
{
*descent = (wxCoord)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */
*descent = (wxCoord)(((-lastDescender)/1000.0F) * fontSize); /* MATTHEW: forgot scale */
}
else
{

View File

@ -4,7 +4,7 @@
// Author: Stefan Csomor
// Modified by:
// Created: 2006-10-03
// RCS-ID: $Id: graphicc.cpp 51312 2008-01-21 16:30:13Z VS $
// RCS-ID: $Id: graphicc.cpp 56887 2008-11-22 04:40:08Z KO $
// Copyright: (c) 2006 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -301,6 +301,23 @@ private :
double m_alpha;
};
class wxCairoBitmapData : public wxGraphicsObjectRefData
{
public:
wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp );
~wxCairoBitmapData();
virtual cairo_surface_t* GetCairoSurface() { return m_surface; }
virtual cairo_pattern_t* GetCairoPattern() { return m_pattern; }
virtual wxSize GetSize() { return wxSize(m_width, m_height); }
private :
cairo_surface_t* m_surface;
cairo_pattern_t* m_pattern;
int m_width;
int m_height;
unsigned char* m_buffer;
};
class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext
{
DECLARE_NO_COPY_CLASS(wxCairoContext)
@ -341,6 +358,7 @@ public:
// gets the matrix of this context
virtual wxGraphicsMatrix GetTransform() const;
void DrawGraphicsBitmapInternal( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void PushState();
@ -961,6 +979,90 @@ void * wxCairoMatrixData::GetNativeMatrix() const
return (void*) &m_matrix;
}
//-----------------------------------------------------------------------------
// wxCairoBitmap implementation
//-----------------------------------------------------------------------------
wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsObjectRefData( renderer )
{
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
int bw = m_width = bmp.GetWidth();
int bh = m_height = bmp.GetHeight();
wxBitmap bmpSource = bmp; // we need a non-const instance
m_buffer = new unsigned char[bw*bh*4];
wxUint32* data = (wxUint32*)m_buffer;
// Create a surface object and copy the bitmap pixel data to it. if the
// image has alpha (or a mask represented as alpha) then we'll use a
// different format and iterator than if it doesn't...
if (bmpSource.HasAlpha() || bmpSource.GetMask())
{
m_surface = cairo_image_surface_create_for_data(
m_buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4);
wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
wxAlphaPixelData::Iterator p(pixData);
for (int y=0; y<bh; y++)
{
wxAlphaPixelData::Iterator rowStart = p;
for (int x=0; x<bw; x++)
{
// Each pixel in CAIRO_FORMAT_ARGB32 is a 32-bit quantity,
// with alpha in the upper 8 bits, then red, then green, then
// blue. The 32-bit quantities are stored native-endian.
// Pre-multiplied alpha is used.
unsigned char alpha = p.Alpha();
if (alpha == 0)
*data = 0;
else
*data = ( alpha << 24
| (p.Red() * alpha/255) << 16
| (p.Green() * alpha/255) << 8
| (p.Blue() * alpha/255) );
++data;
++p;
}
p = rowStart;
p.OffsetY(pixData, 1);
}
}
else // no alpha
{
m_surface = cairo_image_surface_create_for_data(
m_buffer, CAIRO_FORMAT_RGB24, bw, bh, bw*4);
wxNativePixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
wxNativePixelData::Iterator p(pixData);
for (int y=0; y<bh; y++)
{
wxNativePixelData::Iterator rowStart = p;
for (int x=0; x<bw; x++)
{
// Each pixel in CAIRO_FORMAT_RGB24 is a 32-bit quantity, with
// the upper 8 bits unused. Red, Green, and Blue are stored in
// the remaining 24 bits in that order. The 32-bit quantities
// are stored native-endian.
*data = ( p.Red() << 16 | p.Green() << 8 | p.Blue() );
++data;
++p;
}
p = rowStart;
p.OffsetY(pixData, 1);
}
}
m_pattern = cairo_pattern_create_for_surface(m_surface);
}
wxCairoBitmapData::~wxCairoBitmapData()
{
cairo_pattern_destroy(m_pattern);
cairo_surface_destroy(m_surface);
delete [] m_buffer;
}
//-----------------------------------------------------------------------------
// wxCairoContext implementation
//-----------------------------------------------------------------------------
@ -1144,101 +1246,40 @@ void wxCairoContext::PopState()
cairo_restore(m_context);
}
void wxGraphicsContext::DrawGraphicsBitmap(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h)
{
static_cast<wxCairoContext*>(this)->DrawGraphicsBitmapInternal(bmp, x, y, w, h);
}
void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
{
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp);
DrawGraphicsBitmapInternal(bitmap, x, y, w, h);
}
cairo_surface_t* surface;
int bw = bmp.GetWidth();
int bh = bmp.GetHeight();
wxBitmap bmpSource = bmp; // we need a non-const instance
unsigned char* buffer = new unsigned char[bw*bh*4];
wxUint32* data = (wxUint32*)buffer;
// Create a surface object and copy the bitmap pixel data to it. if the
// image has alpha (or a mask represented as alpha) then we'll use a
// different format and iterator than if it doesn't...
if (bmpSource.HasAlpha() || bmpSource.GetMask())
{
surface = cairo_image_surface_create_for_data(
buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4);
wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
wxAlphaPixelData::Iterator p(pixData);
for (int y=0; y<bh; y++)
{
wxAlphaPixelData::Iterator rowStart = p;
for (int x=0; x<bw; x++)
{
// Each pixel in CAIRO_FORMAT_ARGB32 is a 32-bit quantity,
// with alpha in the upper 8 bits, then red, then green, then
// blue. The 32-bit quantities are stored native-endian.
// Pre-multiplied alpha is used.
unsigned char alpha = p.Alpha();
if (alpha == 0)
*data = 0;
else
*data = ( alpha << 24
| (p.Red() * alpha/255) << 16
| (p.Green() * alpha/255) << 8
| (p.Blue() * alpha/255) );
++data;
++p;
}
p = rowStart;
p.OffsetY(pixData, 1);
}
}
else // no alpha
{
surface = cairo_image_surface_create_for_data(
buffer, CAIRO_FORMAT_RGB24, bw, bh, bw*4);
wxNativePixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
wxNativePixelData::Iterator p(pixData);
for (int y=0; y<bh; y++)
{
wxNativePixelData::Iterator rowStart = p;
for (int x=0; x<bw; x++)
{
// Each pixel in CAIRO_FORMAT_RGB24 is a 32-bit quantity, with
// the upper 8 bits unused. Red, Green, and Blue are stored in
// the remaining 24 bits in that order. The 32-bit quantities
// are stored native-endian.
*data = ( p.Red() << 16 | p.Green() << 8 | p.Blue() );
++data;
++p;
}
p = rowStart;
p.OffsetY(pixData, 1);
}
}
void wxCairoContext::DrawGraphicsBitmapInternal(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
{
wxCairoBitmapData* data = static_cast<wxCairoBitmapData*>(bmp.GetRefData());
cairo_pattern_t* pattern = data->GetCairoPattern();
wxSize size = data->GetSize();
PushState();
// In case we're scaling the image by using a width and height different
// than the bitmap's size create a pattern transformation on the surface and
// draw the transformed pattern.
cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface);
wxDouble scaleX = w / bw;
wxDouble scaleY = h / bh;
wxDouble scaleX = w / size.GetWidth();
wxDouble scaleY = h / size.GetHeight();
cairo_scale(m_context, scaleX, scaleY);
// prepare to draw the image
cairo_translate(m_context, x, y);
cairo_set_source(m_context, pattern);
// use the original size here since the context is scaled already...
cairo_rectangle(m_context, 0, 0, bw, bh);
cairo_rectangle(m_context, 0, 0, size.GetWidth(), size.GetHeight());
// fill the rectangle using the pattern
cairo_fill(m_context);
// clean up
cairo_pattern_destroy(pattern);
cairo_surface_destroy(surface);
delete [] buffer;
PopState();
}
@ -1253,7 +1294,9 @@ void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDou
void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{
if ( m_font.IsNull() || str.empty())
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::DrawText - no valid font set") );
if ( str.empty())
return;
((wxCairoFontData*)m_font.GetRefData())->Apply(this);
@ -1271,7 +1314,9 @@ void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
wxDouble *descent, wxDouble *externalLeading ) const
{
if ( m_font.IsNull() || str.empty())
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") );
if ( str.empty())
return;
((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this);
@ -1303,6 +1348,8 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
widths.Empty();
widths.Add(0, text.length());
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") );
if (text.empty())
return;
@ -1366,6 +1413,8 @@ public :
// sets the font
virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ;
wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ;
private :
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer)
@ -1507,4 +1556,16 @@ wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour
return wxNullGraphicsFont;
}
wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap( const wxBitmap& bmp )
{
if ( bmp.Ok() )
{
wxGraphicsBitmap p;
p.SetRefData(new wxCairoBitmapData( this , bmp ));
return p;
}
else
return wxNullGraphicsBitmap;
}
#endif // wxUSE_GRAPHICS_CONTEXT

View File

@ -4,7 +4,7 @@
// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
// Modified by: Robin Dunn, Vadim Zeitlin, Santiago Palacios
// Created: 1/08/1999
// RCS-ID: $Id: grid.cpp 54276 2008-06-18 11:21:57Z SN $
// RCS-ID: $Id: grid.cpp 58753 2009-02-08 10:23:19Z VZ $
// Copyright: (c) Michael Bedward (mbedward@ozemail.com.au)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -96,7 +96,7 @@ struct wxGridCellWithAttr
{
if (attr != new_attr)
{
// "Delete" (i.e. DecRef) the old attribute.
// "Delete" (i.e. DecRef) the old attribute.
attr->DecRef();
attr = new_attr;
// Take ownership of the new attribute, i.e. no IncRef.
@ -943,7 +943,6 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
bool wxGridCellNumberEditor::EndEdit(int row, int col,
wxGrid* grid)
{
bool changed;
long value = 0;
wxString text;
@ -951,26 +950,40 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
if ( HasRange() )
{
value = Spin()->GetValue();
changed = value != m_valueOld;
if (changed)
text = wxString::Format(wxT("%ld"), value);
if ( value == m_valueOld )
return false;
text.Printf(wxT("%ld"), value);
}
else
#endif
else // using unconstrained input
#endif // wxUSE_SPINCTRL
{
const wxString textOld(grid->GetCellValue(row, col));
text = Text()->GetValue();
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
if ( text.empty() )
{
if ( textOld.empty() )
return false;
}
else // non-empty text now (maybe 0)
{
if ( !text.ToLong(&value) )
return false;
// if value == m_valueOld == 0 but old text was "" and new one is
// "0" something still did change
if ( value == m_valueOld && (value || !textOld.empty()) )
return false;
}
}
if ( changed )
{
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_NUMBER))
grid->GetTable()->SetValueAsLong(row, col, value);
else
grid->GetTable()->SetValue(row, col, text);
}
wxGridTableBase * const table = grid->GetTable();
if ( table->CanSetValueAs(row, col, wxGRID_VALUE_NUMBER) )
table->SetValueAsLong(row, col, value);
else
table->SetValue(row, col, text);
return changed;
return true;
}
void wxGridCellNumberEditor::Reset()
@ -1103,7 +1116,7 @@ void wxGridCellFloatEditor::Create(wxWindow* parent,
void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
{
// first get the value
wxGridTableBase *table = grid->GetTable();
wxGridTableBase * const table = grid->GetTable();
if ( table->CanGetValueAs(row, col, wxGRID_VALUE_FLOAT) )
{
m_valueOld = table->GetValueAsDouble(row, col);
@ -1111,35 +1124,53 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
else
{
m_valueOld = 0.0;
wxString sValue = table->GetValue(row, col);
if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty())
const wxString value = table->GetValue(row, col);
if ( !value.empty() )
{
wxFAIL_MSG( _T("this cell doesn't have float value") );
return;
if ( !value.ToDouble(&m_valueOld) )
{
wxFAIL_MSG( _T("this cell doesn't have float value") );
return;
}
}
}
DoBeginEdit(GetString());
}
bool wxGridCellFloatEditor::EndEdit(int row, int col,
wxGrid* grid)
bool wxGridCellFloatEditor::EndEdit(int row, int col, wxGrid* grid)
{
double value = 0.0;
wxString text(Text()->GetValue());
const wxString text(Text()->GetValue()),
textOld(grid->GetCellValue(row, col));
if ( (text.empty() || text.ToDouble(&value)) &&
!wxIsSameDouble(value, m_valueOld) )
double value;
if ( !text.empty() )
{
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
grid->GetTable()->SetValueAsDouble(row, col, value);
else
grid->GetTable()->SetValue(row, col, text);
if ( !text.ToDouble(&value) )
return false;
}
else // new value is empty string
{
if ( textOld.empty() )
return false; // nothing changed
return true;
value = 0.;
}
return false;
// the test for empty strings ensures that we don't skip the value setting
// when "" is replaced by "0" or vice versa as "" numeric value is also 0.
if ( wxIsSameDouble(value, m_valueOld) && !text.empty() && !textOld.empty() )
return false; // nothing changed
wxGridTableBase * const table = grid->GetTable();
if ( table->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT) )
table->SetValueAsDouble(row, col, value);
else
table->SetValue(row, col, text);
return true;
}
void wxGridCellFloatEditor::Reset()
@ -2790,7 +2821,7 @@ void wxGridRowOrColAttrData::SetAttr(wxGridCellAttr *attr, int rowOrCol)
size_t n = (size_t)i;
if ( m_attrs[n] == attr )
// nothing to do
return;
return;
if ( attr )
{
// change the attribute, handling reference count manually,
@ -4284,6 +4315,14 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
wxGrid::~wxGrid()
{
if ( m_winCapture && m_winCapture->HasCapture() )
m_winCapture->ReleaseMouse();
// Ensure that the editor control is destroyed before the grid is,
// otherwise we crash later when the editor tries to do something with the
// half destroyed grid
HideCellEditControl();
// Must do this or ~wxScrollHelper will pop the wrong event handler
SetTargetWindow(this);
ClearAttrCache();
@ -5641,6 +5680,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
if ( markerX != m_dragLastPos )
{
wxClientDC dc( m_colLabelWin );
DoPrepareDC(dc);
int cw, ch;
m_colLabelWin->GetClientSize( &cw, &ch );
@ -6075,7 +6115,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
}
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
else if ( event.LeftIsDown() &&
m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
{
int cw, ch, left, dummy;
m_gridWin->GetClientSize( &cw, &ch );
@ -6093,7 +6134,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
dc.DrawLine( left, y, left+cw, y );
m_dragLastPos = y;
}
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL )
else if ( event.LeftIsDown() &&
m_cursorMode == WXGRID_CURSOR_RESIZE_COL )
{
int cw, ch, dummy, top;
m_gridWin->GetClientSize( &cw, &ch );
@ -7817,7 +7859,27 @@ void wxGrid::DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells)
size_t count = cells.GetCount();
for ( size_t n = 0; n < count; n++ )
{
if ( cells[n] == m_currentCellCoords )
wxGridCellCoords cell = cells[n];
// If we are using attributes, then we may have just exposed another
// cell in a partially-visible merged cluster of cells. If the "anchor"
// (upper left) cell of this merged cluster is the cell indicated by
// m_currentCellCoords, then we need to refresh the cell highlight even
// though the "anchor" itself is not part of our update segment.
if ( CanHaveAttributes() )
{
int rows = 0,
cols = 0;
GetCellSize(cell.GetRow(), cell.GetCol(), &rows, &cols);
if ( rows < 0 )
cell.SetRow(cell.GetRow() + rows);
if ( cols < 0 )
cell.SetCol(cell.GetCol() + cols);
}
if ( cell == m_currentCellCoords )
{
wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords);
DrawCellHighlight(dc, attr);
@ -8556,11 +8618,19 @@ void wxGrid::HideCellEditControl()
wxGridCellAttr *attr = GetCellAttr(row, col);
wxGridCellEditor *editor = attr->GetEditor(this, row, col);
const bool
editorHadFocus = wxWindow::FindFocus() == editor->GetControl();
editor->Show( false );
editor->DecRef();
attr->DecRef();
m_gridWin->SetFocus();
// return the focus to the grid itself if the editor had it
//
// note that we must not do this unconditionally to avoid stealing
// focus from the window which just received it if we are hiding the
// editor precisely because we lost focus
if ( editorHadFocus )
m_gridWin->SetFocus();
// refresh whole row to the right
wxRect rect( CellToRect(row, col) );
@ -9996,9 +10066,14 @@ void wxGrid::ClearAttrCache()
{
if ( m_attrCache.row != -1 )
{
wxSafeDecRef(m_attrCache.attr);
wxGridCellAttr *oldAttr = m_attrCache.attr;
m_attrCache.attr = NULL;
m_attrCache.row = -1;
// wxSafeDecRec(...) might cause event processing that accesses
// the cached attribute, if one exists (e.g. by deleting the
// editor stored within the attribute). Therefore it is important
// to invalidate the cache before calling wxSafeDecRef!
wxSafeDecRef(oldAttr);
}
}
@ -10239,7 +10314,7 @@ void wxGrid::SetCellSize( int row, int col, int num_rows, int num_cols )
wxT("wxGrid::SetCellSize setting cell size to < 1"));
// if this was already a multicell then "turn off" the other cells first
if ((cell_rows > 1) || (cell_rows > 1))
if ((cell_rows > 1) || (cell_cols > 1))
{
int i, j;
for (j=row; j < row + cell_rows; j++)
@ -10408,6 +10483,19 @@ void wxGrid::SetRowSize( int row, int height )
{
wxCHECK_RET( row >= 0 && row < m_numRows, _T("invalid row index") );
// if < 0 then calculate new height from label
if ( height < 0 )
{
long w, h;
wxArrayString lines;
wxClientDC dc(m_rowLabelWin);
dc.SetFont(GetLabelFont());
StringToLines(GetRowLabelValue( row ), lines);
GetTextBoxSize( dc, lines, &w, &h );
//check that it is not less than the minimal height
height = wxMax(h, GetRowMinimalAcceptableHeight());
}
// See comment in SetColSize
if ( height < GetRowMinimalAcceptableHeight())
return;
@ -10452,6 +10540,23 @@ void wxGrid::SetColSize( int col, int width )
{
wxCHECK_RET( col >= 0 && col < m_numCols, _T("invalid column index") );
// if < 0 then calculate new width from label
if ( width < 0 )
{
long w, h;
wxArrayString lines;
wxClientDC dc(m_colLabelWin);
dc.SetFont(GetLabelFont());
StringToLines(GetColLabelValue(col), lines);
if ( GetColLabelTextOrientation() == wxHORIZONTAL )
GetTextBoxSize( dc, lines, &w, &h );
else
GetTextBoxSize( dc, lines, &h, &w );
width = w + 6;
//check that it is not less than the minimal width
width = wxMax(width, GetColMinimalAcceptableWidth());
}
// should we check that it's bigger than GetColMinimalWidth(col) here?
// (VZ)
// No, because it is reasonable to assume the library user know's
@ -10469,18 +10574,6 @@ void wxGrid::SetColSize( int col, int width )
InitColWidths();
}
// if < 0 then calculate new width from label
if ( width < 0 )
{
long w, h;
wxArrayString lines;
wxClientDC dc(m_colLabelWin);
dc.SetFont(GetLabelFont());
StringToLines(GetColLabelValue(col), lines);
GetTextBoxSize(dc, lines, &w, &h);
width = w + 6;
}
int w = wxMax( 0, width );
int diff = w - m_colWidths[col];
m_colWidths[col] = w;
@ -10851,9 +10944,6 @@ void wxGrid::AutoSize()
void wxGrid::AutoSizeRowLabelSize( int row )
{
wxArrayString lines;
long w, h;
// Hide the edit control, so it
// won't interfere with drag-shrinking.
if ( IsCellEditControlShown() )
@ -10863,20 +10953,12 @@ void wxGrid::AutoSizeRowLabelSize( int row )
}
// autosize row height depending on label text
StringToLines( GetRowLabelValue( row ), lines );
wxClientDC dc( m_rowLabelWin );
GetTextBoxSize( dc, lines, &w, &h );
if ( h < m_defaultRowHeight )
h = m_defaultRowHeight;
SetRowSize(row, h);
SetRowSize(row, -1);
ForceRefresh();
}
void wxGrid::AutoSizeColLabelSize( int col )
{
wxArrayString lines;
long w, h;
// Hide the edit control, so it
// won't interfere with drag-shrinking.
if ( IsCellEditControlShown() )
@ -10886,15 +10968,7 @@ void wxGrid::AutoSizeColLabelSize( int col )
}
// autosize column width depending on label text
StringToLines( GetColLabelValue( col ), lines );
wxClientDC dc( m_colLabelWin );
if ( GetColLabelTextOrientation() == wxHORIZONTAL )
GetTextBoxSize( dc, lines, &w, &h );
else
GetTextBoxSize( dc, lines, &h, &w );
if ( w < m_defaultColWidth )
w = m_defaultColWidth;
SetColSize(col, w);
SetColSize(col, -1);
ForceRefresh();
}
@ -11141,37 +11215,36 @@ void wxGrid::ClearSelection()
// This function returns the rectangle that encloses the given block
// in device coords clipped to the client size of the grid window.
//
wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
const wxGridCellCoords &bottomRight )
wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords& topLeft,
const wxGridCellCoords& bottomRight )
{
wxRect rect( wxGridNoCellRect );
wxRect cellRect;
cellRect = CellToRect( topLeft );
if ( cellRect != wxGridNoCellRect )
wxRect resultRect;
wxRect tempCellRect = CellToRect(topLeft);
if ( tempCellRect != wxGridNoCellRect )
{
rect = cellRect;
resultRect = tempCellRect;
}
else
{
rect = wxRect(0, 0, 0, 0);
resultRect = wxRect(0, 0, 0, 0);
}
cellRect = CellToRect( bottomRight );
if ( cellRect != wxGridNoCellRect )
tempCellRect = CellToRect(bottomRight);
if ( tempCellRect != wxGridNoCellRect )
{
rect += cellRect;
resultRect += tempCellRect;
}
else
{
// If both inputs were "wxGridNoCellRect," then there's nothing to do.
return wxGridNoCellRect;
}
int i, j;
int left = rect.GetLeft();
int top = rect.GetTop();
int right = rect.GetRight();
int bottom = rect.GetBottom();
// Ensure that left/right and top/bottom pairs are in order.
int left = resultRect.GetLeft();
int top = resultRect.GetTop();
int right = resultRect.GetRight();
int bottom = resultRect.GetBottom();
int leftCol = topLeft.GetCol();
int topRow = topLeft.GetRow();
@ -11180,65 +11253,89 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
if (left > right)
{
i = left;
int tmp = left;
left = right;
right = i;
i = leftCol;
right = tmp;
tmp = leftCol;
leftCol = rightCol;
rightCol = i;
rightCol = tmp;
}
if (top > bottom)
{
i = top;
int tmp = top;
top = bottom;
bottom = i;
i = topRow;
bottom = tmp;
tmp = topRow;
topRow = bottomRow;
bottomRow = i;
bottomRow = tmp;
}
for ( j = topRow; j <= bottomRow; j++ )
{
for ( i = leftCol; i <= rightCol; i++ )
{
if ((j == topRow) || (j == bottomRow) || (i == leftCol) || (i == rightCol))
{
cellRect = CellToRect( j, i );
// The following loop is ONLY necessary to detect and handle merged cells.
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );
if (cellRect.x < left)
left = cellRect.x;
if (cellRect.y < top)
top = cellRect.y;
if (cellRect.x + cellRect.width > right)
right = cellRect.x + cellRect.width;
if (cellRect.y + cellRect.height > bottom)
bottom = cellRect.y + cellRect.height;
// Get the origin coordinates: notice that they will be negative if the
// grid is scrolled downwards/to the right.
int gridOriginX = 0;
int gridOriginY = 0;
CalcScrolledPosition(gridOriginX, gridOriginY, &gridOriginX, &gridOriginY);
int onScreenLeftmostCol = internalXToCol(-gridOriginX);
int onScreenUppermostRow = internalYToRow(-gridOriginY);
int onScreenRightmostCol = internalXToCol(-gridOriginX + cw);
int onScreenBottommostRow = internalYToRow(-gridOriginY + ch);
// Bound our loop so that we only examine the portion of the selected block
// that is shown on screen. Therefore, we compare the Top-Left block values
// to the Top-Left screen values, and the Bottom-Right block values to the
// Bottom-Right screen values, choosing appropriately.
const int visibleTopRow = wxMax(topRow, onScreenUppermostRow);
const int visibleBottomRow = wxMin(bottomRow, onScreenBottommostRow);
const int visibleLeftCol = wxMax(leftCol, onScreenLeftmostCol);
const int visibleRightCol = wxMin(rightCol, onScreenRightmostCol);
for ( int j = visibleTopRow; j <= visibleBottomRow; j++ )
{
for ( int i = visibleLeftCol; i <= visibleRightCol; i++ )
{
if ( (j == visibleTopRow) || (j == visibleBottomRow) ||
(i == visibleLeftCol) || (i == visibleRightCol) )
{
tempCellRect = CellToRect( j, i );
if (tempCellRect.x < left)
left = tempCellRect.x;
if (tempCellRect.y < top)
top = tempCellRect.y;
if (tempCellRect.x + tempCellRect.width > right)
right = tempCellRect.x + tempCellRect.width;
if (tempCellRect.y + tempCellRect.height > bottom)
bottom = tempCellRect.y + tempCellRect.height;
}
else
{
i = rightCol; // jump over inner cells.
i = visibleRightCol; // jump over inner cells.
}
}
}
// convert to scrolled coords
//
// Convert to scrolled coords
CalcScrolledPosition( left, top, &left, &top );
CalcScrolledPosition( right, bottom, &right, &bottom );
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );
if (right < 0 || bottom < 0 || left > cw || top > ch)
return wxRect(0,0,0,0);
rect.SetLeft( wxMax(0, left) );
rect.SetTop( wxMax(0, top) );
rect.SetRight( wxMin(cw, right) );
rect.SetBottom( wxMin(ch, bottom) );
resultRect.SetLeft( wxMax(0, left) );
resultRect.SetTop( wxMax(0, top) );
resultRect.SetRight( wxMin(cw, right) );
resultRect.SetBottom( wxMin(ch, bottom) );
return rect;
return resultRect;
}
// ----------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
// Author: Paul Gammans, Roger Gammans
// Modified by:
// Created: 11/04/2001
// RCS-ID: $Id: gridctrl.cpp 41587 2006-10-03 14:28:36Z PC $
// RCS-ID: $Id: gridctrl.cpp 59121 2009-02-25 00:09:23Z VZ $
// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -357,9 +357,19 @@ wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid,
dc.GetTextExtent(tok, &x, &y);
if ( curr_x + x > max_x)
{
lines.Add( wxString(thisline) );
thisline = tok;
curr_x=x;
if ( curr_x == 0 )
{
// this means that a single token is wider than the maximal
// width -- still use it as is as we need to show at least the
// part of it which fits
lines.Add(tok);
}
else
{
lines.Add(thisline);
thisline = tok;
curr_x = x;
}
}
else
{
@ -380,7 +390,10 @@ wxGridCellAutoWrapStringRenderer::GetBestSize(wxGrid& grid,
wxDC& dc,
int row, int col)
{
wxCoord x,y, height , width = grid.GetColSize(col) -10;
wxCoord x,y, height , width = grid.GetColSize(col) -20;
// for width, subtract 20 because ColSize includes a magin of 10 pixels
// that we do not want here and because we always start with an increment
// by 10 in the loop below.
int count = 250; //Limit iterations..
wxRect rect(0,0,width,10);

View File

@ -2,7 +2,7 @@
// Name: src/generic/imaglist.cpp
// Purpose:
// Author: Robert Roebling
// Id: $id$
// Id: $Id: imaglist.cpp 58031 2009-01-12 05:39:04Z PC $
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -68,6 +68,8 @@ int wxGenericImageList::Add( const wxBitmap &bitmap )
_T("invalid bitmap size in wxImageList: this might work ")
_T("on this platform but definitely won't under Windows.") );
const int index = int(m_images.GetCount());
if (bitmap.IsKindOf(CLASSINFO(wxIcon)))
{
m_images.Append( new wxIcon( (const wxIcon&) bitmap ) );
@ -98,7 +100,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap )
m_height = bitmap.GetHeight();
}
return m_images.GetCount()-1;
return index;
}
int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )

View File

@ -3,7 +3,7 @@
// Purpose: generic implementation of wxListCtrl
// Author: Robert Roebling
// Vadim Zeitlin (virtual list control support)
// Id: $Id: listctrl.cpp 54201 2008-06-13 22:38:33Z VZ $
// Id: $Id: listctrl.cpp 57542 2008-12-25 13:03:24Z VZ $
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -621,6 +621,8 @@ public:
void OnPaint( wxPaintEvent &event );
void OnChildFocus(wxChildFocusEvent& event);
void DrawImage( int index, wxDC *dc, int x, int y );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
@ -1904,6 +1906,19 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
x += wCol;
}
// Fill in what's missing to the right of the columns, otherwise we will
// leave an unpainted area when columns are removed (and it looks better)
if ( x < w )
{
wxRendererNative::Get().DrawHeaderButton
(
this,
dc,
wxRect(x, HEADER_OFFSET_Y, w - x, h),
0
);
}
}
void wxListHeaderWindow::DrawCurrent()
@ -2255,6 +2270,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
EVT_SCROLLWIN (wxListMainWindow::OnScroll)
EVT_CHILD_FOCUS (wxListMainWindow::OnChildFocus)
END_EVENT_TABLE()
void wxListMainWindow::Init()
@ -2877,6 +2893,13 @@ void wxListMainWindow::HighlightAll( bool on )
}
}
void wxListMainWindow::OnChildFocus(wxChildFocusEvent& WXUNUSED(event))
{
// Do nothing here. This prevents the default handler in wxScrolledWindow
// from needlessly scrolling the window when the edit control is
// dismissed. See ticket #9563.
}
void wxListMainWindow::SendNotify( size_t line,
wxEventType command,
const wxPoint& point )
@ -3415,16 +3438,9 @@ void wxListMainWindow::OnKeyDown( wxKeyEvent &event )
wxWindow *parent = GetParent();
// propagate the key event upwards
wxKeyEvent ke( wxEVT_KEY_DOWN );
ke.m_shiftDown = event.m_shiftDown;
ke.m_controlDown = event.m_controlDown;
ke.m_altDown = event.m_altDown;
ke.m_metaDown = event.m_metaDown;
ke.m_keyCode = event.m_keyCode;
ke.m_x = event.m_x;
ke.m_y = event.m_y;
ke.SetEventObject( parent );
if (parent->GetEventHandler()->ProcessEvent( ke )) return;
wxKeyEvent ke(event);
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
event.Skip();
}
@ -3434,16 +3450,10 @@ void wxListMainWindow::OnKeyUp( wxKeyEvent &event )
wxWindow *parent = GetParent();
// propagate the key event upwards
wxKeyEvent ke( wxEVT_KEY_UP );
ke.m_shiftDown = event.m_shiftDown;
ke.m_controlDown = event.m_controlDown;
ke.m_altDown = event.m_altDown;
ke.m_metaDown = event.m_metaDown;
ke.m_keyCode = event.m_keyCode;
ke.m_x = event.m_x;
ke.m_y = event.m_y;
wxKeyEvent ke(event);
ke.SetEventObject( parent );
if (parent->GetEventHandler()->ProcessEvent( ke )) return;
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
event.Skip();
}
@ -3464,16 +3474,9 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
}
// propagate the char event upwards
wxKeyEvent ke( wxEVT_CHAR );
ke.m_shiftDown = event.m_shiftDown;
ke.m_controlDown = event.m_controlDown;
ke.m_altDown = event.m_altDown;
ke.m_metaDown = event.m_metaDown;
ke.m_keyCode = event.m_keyCode;
ke.m_x = event.m_x;
ke.m_y = event.m_y;
ke.SetEventObject( parent );
if (parent->GetEventHandler()->ProcessEvent( ke )) return;
wxKeyEvent ke(event);
if (parent->GetEventHandler()->ProcessEvent( ke ))
return;
if (event.GetKeyCode() == WXK_TAB)
{
@ -4154,8 +4157,9 @@ wxRect wxListMainWindow::GetViewRect() const
{
for ( int i = 0; i < count; i++ )
{
wxRect r;
GetItemRect(i, r);
// we need logical, not physical, coordinates here, so use
// GetLineRect() instead of GetItemRect()
wxRect r = GetLineRect(i);
wxCoord x = r.GetRight(),
y = r.GetBottom();
@ -4223,9 +4227,9 @@ void wxListMainWindow::RecalculatePositions(bool noRefresh)
const size_t count = GetItemCount();
int iconSpacing;
if ( HasFlag(wxLC_ICON) )
if ( HasFlag(wxLC_ICON) && m_normal_image_list )
iconSpacing = m_normal_spacing;
else if ( HasFlag(wxLC_SMALL_ICON) )
else if ( HasFlag(wxLC_SMALL_ICON) && m_small_image_list )
iconSpacing = m_small_spacing;
else
iconSpacing = 0;
@ -5761,7 +5765,7 @@ wxGenericListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
#else
wxUnusedVar(variant);
wxVisualAttributes attr;
attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
return attr;

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.07.99
// RCS-ID: $Id: numdlgg.cpp 41838 2006-10-09 21:08:45Z VZ $
// RCS-ID: $Id: numdlgg.cpp 54861 2008-07-30 21:53:26Z VZ $
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -104,10 +104,7 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
// spin ctrl
wxString valStr;
valStr.Printf(wxT("%ld"), m_value);
m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ) );
#if wxUSE_SPINCTRL
m_spinctrl->SetRange((int)m_min, (int)m_max);
#endif
m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ), wxSP_ARROW_KEYS, (int)m_min, (int)m_max, (int)m_value);
inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 );
// add both
topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 );

View File

@ -4,7 +4,7 @@
// Author: Jaakko Salli
// Modified by:
// Created: Apr-30-2006
// RCS-ID: $Id: odcombo.cpp 52747 2008-03-23 20:20:46Z VZ $
// RCS-ID: $Id: odcombo.cpp 58203 2009-01-18 20:05:07Z JMS $
// Copyright: (c) 2005 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -257,14 +257,23 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar unicode
int comboStyle = m_combo->GetWindowStyle();
// this is the character equivalent of the code
wxChar keychar=0;
if ((keycode >= WXK_SPACE) && (keycode <=255) && (keycode != WXK_DELETE) && wxIsprint(keycode))
wxChar keychar = 0;
if ( keycode < WXK_START )
{
keychar = (wxChar)keycode;
}
else if (unicode>0)
{
keychar = unicode;
#if wxUSE_UNICODE
if ( unicode > 0 )
{
if ( wxIsprint(unicode) )
keychar = unicode;
}
else
#else
wxUnusedVar(unicode);
#endif
if ( wxIsprint(keycode) )
{
keychar = (wxChar) keycode;
}
}
if ( keycode == WXK_DOWN || keycode == WXK_RIGHT )
@ -287,7 +296,7 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar unicode
value-=10;
StopPartialCompletion();
}
else if ( comboStyle & wxCB_READONLY )
else if ( keychar && (comboStyle & wxCB_READONLY) )
{
// Try partial completion

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id: prntdlgg.cpp 50289 2007-11-28 00:24:25Z VZ $
// RCS-ID: $Id: prntdlgg.cpp 55256 2008-08-25 14:39:11Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -201,9 +201,9 @@ void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent))
if (factory->HasStatusLine())
{
flex->Add( new wxStaticText( this, wxID_ANY, _("Status:") ),
0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 );
0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 );
flex->Add( new wxStaticText( this, wxID_ANY, factory->CreateStatusLine() ),
0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 );
0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 );
}
mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT|wxGROW, 10 );
@ -354,10 +354,12 @@ bool wxGenericPrintDialog::TransferDataToWindow()
if (m_printDialogData.GetToPage() > 0)
m_toText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetToPage()));
if(m_rangeRadioBox)
{
if (m_printDialogData.GetAllPages() || m_printDialogData.GetFromPage() == 0)
m_rangeRadioBox->SetSelection(0);
else
m_rangeRadioBox->SetSelection(1);
}
}
else
{

View File

@ -5,7 +5,7 @@
// Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement.
// Ron Lee on 10.4.02: virtual size / auto scrollbars et al.
// Created: 01/02/97
// RCS-ID: $Id: scrlwing.cpp 50982 2008-01-01 20:38:33Z VZ $
// RCS-ID: $Id: scrlwing.cpp 55010 2008-08-07 15:58:51Z JS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -1352,21 +1352,69 @@ void wxScrollHelper::HandleOnChildFocus(wxChildFocusEvent& event)
if ( win == m_targetWindow )
return; // nothing to do
while ( win->GetParent() != m_targetWindow )
#ifdef __WXMAC__
if (wxDynamicCast(win, wxScrollBar))
return;
#endif
// Fixing ticket: http://trac.wxwidgets.org/ticket/9563
// When a child inside a wxControlContainer receives a focus, the
// wxControlContainer generates an artificial wxChildFocusEvent for
// itself, telling its parent that 'it' received the focus. The effect is
// that this->HandleOnChildFocus is called twice, first with the
// artificial wxChildFocusEvent and then with the original event. We need
// to ignore the artificial event here or otherwise HandleOnChildFocus
// would first scroll the target window to make the entire
// wxControlContainer visible and immediately afterwards scroll the target
// window again to make the child widget visible. This leads to ugly
// flickering when using nested wxPanels/wxScrolledWindows.
//
// Ignore this event if 'win' is derived from wxControlContainer AND its
// parent is the m_targetWindow AND 'win' is not actually reciving the
// focus (win != FindFocus). TODO: This affects all wxControlContainer
// objects, but wxControlContainer is not part of the wxWidgets RTTI and
// so wxDynamicCast(win, wxControlContainer) does not compile. Find a way
// to determine if 'win' derives from wxControlContainer. Until then,
// testing if 'win' derives from wxPanel will probably get >90% of all
// cases.
wxWindow *actual_focus=wxWindow::FindFocus();
if (win != actual_focus &&
wxDynamicCast(win, wxPanel) != 0 &&
win->GetParent() == m_targetWindow)
// if win is a wxPanel and receives the focus, it should not be
// scrolled into view
return;
wxSize view(m_targetWindow->GetClientSize());
// For composite controls such as wxComboCtrl we should try to fit the
// entire control inside the visible area of the target window, not just
// the focused child of the control. Otherwise we'd make only the textctrl
// part of a wxComboCtrl visible and the button would still be outside the
// scrolled area. But do so only if the parent fits *entirely* inside the
// scrolled window. In other situations, such as nested wxPanel or
// wxScrolledWindows, the parent might be way to big to fit inside the
// scrolled window. If that is the case, then make only the focused window
// visible
if ( win->GetParent() != m_targetWindow)
{
win = win->GetParent();
if ( !win )
return; // event is not from a child of the target window
wxWindow *parent=win->GetParent();
wxSize parent_size=parent->GetSize();
if (parent_size.GetWidth() <= view.GetWidth() &&
parent_size.GetHeight() <= view.GetHeight())
// make the immediate parent visible instead of the focused control
win=parent;
}
// if the child is not fully visible, try to scroll it into view:
int stepx, stepy;
GetScrollPixelsPerUnit(&stepx, &stepy);
// NB: we don't call CalcScrolledPosition() on win->GetPosition() here,
// because children' positions are already scrolled
wxRect winrect(win->GetPosition(), win->GetSize());
wxSize view(m_targetWindow->GetClientSize());
// 'win' position coordinates are relative to it's parent
// convert them so that they are relative to the m_targetWindow viewing area
wxRect winrect(m_targetWindow->ScreenToClient(win->GetScreenPosition()),
win->GetSize());
int startx, starty;
GetViewStart(&startx, &starty);

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 28/6/2000
// RCS-ID: $Id: splash.cpp 42755 2006-10-30 19:41:46Z VZ $
// RCS-ID: $Id: splash.cpp 58746 2009-02-08 09:16:50Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -150,7 +150,8 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
#endif // USE_PALETTE_IN_SPLASH
dcMem.SelectObjectAsSource(bitmap);
dc.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & dcMem, 0, 0);
dc.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), &dcMem, 0, 0, wxCOPY,
true /* use mask */);
dcMem.SelectObject(wxNullBitmap);
#ifdef USE_PALETTE_IN_SPLASH

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: splitter.cpp 42816 2006-10-31 08:50:17Z RD $
// RCS-ID: $Id: splitter.cpp 59341 2009-03-05 15:44:24Z JS $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -84,6 +84,11 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
style &= ~wxBORDER_MASK;
style |= wxBORDER_NONE;
#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
// CoreGraphics can't paint sash feedback
style |= wxSP_LIVE_UPDATE;
#endif
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
return false;
@ -91,7 +96,7 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
m_lastSize.x = size.x;
if (size.y >= 0)
m_lastSize.y = size.y;
m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0;
// FIXME: with this line the background is not erased at all under GTK1,
@ -206,8 +211,11 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
int x = (int)event.GetX(),
y = (int)event.GetY();
if (GetWindowStyle() & wxSP_NOSASH)
if ( GetWindowStyle() & wxSP_NOSASH )
{
event.Skip();
return;
}
// with wxSP_LIVE_UPDATE style the splitter windows are always resized
// following the mouse movement while it drags the sash, without it we only
@ -389,6 +397,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
{
OnDoubleClickSash(x, y);
}
else
{
event.Skip();
}
}
void wxSplitterWindow::OnSize(wxSizeEvent& event)
@ -600,7 +612,7 @@ int wxSplitterWindow::AdjustSashPosition(int sashPos) const
minSize = m_minimumPaneSize;
int maxSize = GetWindowSize() - minSize - GetBorderSize() - GetSashSize();
if ( maxSize > 0 && sashPos > maxSize )
if ( maxSize > 0 && sashPos > maxSize && maxSize >= m_minimumPaneSize)
sashPos = maxSize;
}

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: statusbr.cpp 51615 2008-02-09 15:10:13Z VZ $
// RCS-ID: $Id: statusbr.cpp 57542 2008-12-25 13:03:24Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -194,6 +194,7 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
#ifdef __WXGTK20__
// Draw grip first
if (HasFlag( wxST_SIZEGRIP ))

View File

@ -4,7 +4,7 @@
// Author: Evgeniy Tarassov, Vadim Zeitlin
// Modified by:
// Created: 2005-09-15
// RCS-ID: $Id: treebkg.cpp 44271 2007-01-21 00:52:05Z VZ $
// RCS-ID: $Id: treebkg.cpp 54645 2008-07-15 21:29:10Z JS $
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -104,15 +104,18 @@ wxTreebook::Create(wxWindow *parent,
style, wxDefaultValidator, name) )
return false;
#ifdef __WXMSW__
long treeStyle = GetThemedBorderStyle();
#else
long treeStyle = wxBORDER_SUNKEN;
#endif
m_bookctrl = new wxTreeCtrl
(
this,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
#ifndef __WXMSW__
wxBORDER_SIMPLE | // On wxMSW this produces a black border which is wrong
#endif
treeStyle|
wxTR_DEFAULT_STYLE |
wxTR_HIDE_ROOT |
wxTR_SINGLE

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Created: 01/02/97
// Modified: 22/10/98 - almost total rewrite, simpler interface (VZ)
// Id: $Id: treectlg.cpp 53135 2008-04-12 02:31:04Z VZ $
// Id: $Id: treectlg.cpp 57542 2008-12-25 13:03:24Z VZ $
// Copyright: (c) 1998 Robert Roebling and Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -92,29 +92,8 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
public:
wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item);
void EndEdit(bool discardChanges = false)
{
if ( discardChanges )
{
StopEditing();
}
else
{
m_aboutToFinish = true;
void EndEdit(bool discardChanges);
// Notify the owner about the changes
AcceptChanges();
// Even if vetoed, close the control (consistent with MSW)
Finish();
}
}
void StopEditing()
{
Finish();
m_owner->OnRenameCancelled(m_itemEdited);
}
const wxGenericTreeItem* item() const { return m_itemEdited; }
protected:
@ -123,13 +102,12 @@ protected:
void OnKillFocus( wxFocusEvent &event );
bool AcceptChanges();
void Finish();
void Finish( bool setfocus = true );
private:
wxGenericTreeCtrl *m_owner;
wxGenericTreeItem *m_itemEdited;
wxString m_startValue;
bool m_finished;
bool m_aboutToFinish;
DECLARE_EVENT_TABLE()
@ -363,7 +341,6 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
: m_itemEdited(item), m_startValue(item->GetText())
{
m_owner = owner;
m_finished = false;
m_aboutToFinish = false;
int w = m_itemEdited->GetWidth(),
@ -407,6 +384,26 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
wxPoint(x - 4, y - 4), wxSize(w + 11, h + 8));
}
void wxTreeTextCtrl::EndEdit(bool discardChanges)
{
m_aboutToFinish = true;
if ( discardChanges )
{
m_owner->OnRenameCancelled(m_itemEdited);
Finish();
}
else
{
// Notify the owner about the changes
AcceptChanges();
// Even if vetoed, close the control (consistent with MSW)
Finish();
}
}
bool wxTreeTextCtrl::AcceptChanges()
{
const wxString value = GetValue();
@ -435,18 +432,14 @@ bool wxTreeTextCtrl::AcceptChanges()
return true;
}
void wxTreeTextCtrl::Finish()
void wxTreeTextCtrl::Finish( bool setfocus )
{
if ( !m_finished )
{
m_owner->ResetTextControl();
m_owner->ResetTextControl();
wxPendingDelete.Append(this);
m_finished = true;
wxPendingDelete.Append(this);
if (setfocus)
m_owner->SetFocus();
}
}
void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
@ -454,11 +447,11 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
switch ( event.m_keyCode )
{
case WXK_RETURN:
EndEdit();
EndEdit( false );
break;
case WXK_ESCAPE:
StopEditing();
EndEdit( true );
break;
default:
@ -468,7 +461,7 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
void wxTreeTextCtrl::OnKeyUp( wxKeyEvent &event )
{
if ( !m_finished )
if ( !m_aboutToFinish )
{
// auto-grow the textctrl:
wxSize parentSize = m_owner->GetSize();
@ -488,18 +481,15 @@ void wxTreeTextCtrl::OnKeyUp( wxKeyEvent &event )
void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event )
{
if ( !m_finished && !m_aboutToFinish )
if ( !m_aboutToFinish )
{
// We must finish regardless of success, otherwise we'll get
// focus problems:
Finish();
if ( !AcceptChanges() )
m_owner->OnRenameCancelled( m_itemEdited );
Finish( false );
}
// We must let the native text control handle focus, too, otherwise
// it could have problems with the cursor (e.g., in wxGTK).
// We should let the native text control handle focus, too.
event.Skip();
}
@ -820,10 +810,10 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
style |= wxTR_NO_LINES;
if (major < 10)
style |= wxTR_ROW_LINES;
if (style == 0 || style & wxTR_DEFAULT_STYLE)
style |= wxTR_FULL_ROW_HIGHLIGHT;
#endif // __WXMAC__
#ifdef __WXGTK20__
style |= wxTR_NO_LINES;
@ -1519,7 +1509,7 @@ void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item)
void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item)
{
if (m_textCtrl != NULL && item != m_textCtrl->item() && IsDescendantOf(item, m_textCtrl->item())) {
m_textCtrl->StopEditing();
m_textCtrl->EndEdit( true );
}
if (item != m_key_current && IsDescendantOf(item, m_key_current)) {
m_key_current = NULL;
@ -1553,7 +1543,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId)
if (m_textCtrl != NULL && IsDescendantOf(item, m_textCtrl->item()))
{
// can't delete the item being edited, cancel editing it first
m_textCtrl->StopEditing();
m_textCtrl->EndEdit( true );
}
wxGenericTreeItem *parent = item->GetParent();
@ -1607,7 +1597,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId)
delete item;
InvalidateBestSize();
InvalidateBestSize();
}
void wxGenericTreeCtrl::DeleteAllItems()
@ -1905,7 +1895,7 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select)
{
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item);
if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
return;
@ -2262,7 +2252,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
#else
rect.x -= 1;
rect.width += 2;
int flags = wxCONTROL_SELECTED;
if (m_hasFocus)
flags |= wxCONTROL_FOCUSED;
@ -2289,7 +2279,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
{
rect.x -= 1;
rect.width += 2;
int flags = wxCONTROL_SELECTED;
if (m_hasFocus)
flags |= wxCONTROL_FOCUSED;
@ -3629,7 +3619,7 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return wxListBox::GetClassDefaultAttributes(variant);
#else
wxVisualAttributes attr;
attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
return attr;

View File

@ -4,7 +4,7 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 30.05.03
// RCS-ID: $Id: vscroll.cpp 51579 2008-02-07 14:15:45Z JS $
// RCS-ID: $Id: vscroll.cpp 57359 2008-12-15 19:09:31Z BP $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -373,8 +373,8 @@ bool wxVScrolledWindow::ScrollToLine(size_t line)
// finally refresh the display -- but only redraw as few lines as possible
// to avoid flicker
if ( GetVisibleBegin() >= lineLastOld ||
GetVisibleEnd() <= lineFirstOld )
if ( GetChildren().empty() &&
(GetVisibleBegin() >= lineLastOld || GetVisibleEnd() <= lineFirstOld ) )
{
// the simplest case: we don't have any old lines left, just redraw
// everything

View File

@ -3,7 +3,7 @@
// Purpose: implementation of wxAboutBox() for wxMSW
// Author: Vadim Zeitlin
// Created: 2006-10-07
// RCS-ID: $Id: aboutdlg.cpp 45979 2007-05-11 22:39:15Z VZ $
// RCS-ID: $Id: aboutdlg.cpp 58748 2009-02-08 09:46:03Z VZ $
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -53,7 +53,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
msg << _T('\n');
if ( info.HasCopyright() )
msg << info.GetCopyright() << _T('\n');
msg << info.GetCopyrightToDisplay() << _T('\n');
// add everything remaining
msg << info.GetDescriptionAndCredits();

View File

@ -4,7 +4,7 @@
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id: accel.cpp 49804 2007-11-10 01:09:42Z VZ $
// RCS-ID: $Id: accel.cpp 56049 2008-10-03 12:13:21Z VZ $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -152,13 +152,6 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
{
#if 0
// calling TranslateAccelerator() with child window doesn't do anything so
// it's probably a bug
wxASSERT_MSG( window->IsTopLevel(),
_T("TranslateAccelerator() needs a top level window") );
#endif
MSG *msg = (MSG *)wxmsg;
return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
}

Some files were not shown because too many files have changed in this diff Show More