Source cleaning inspired by and included in patch '[ 1215450 ] cleanup: unreachable code.'

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-06-06 16:47:04 +00:00
parent 3554a468bf
commit 902725eefe
25 changed files with 1084 additions and 1099 deletions

View File

@@ -690,7 +690,7 @@ bool wxMenuBase::SendEvent(int id, int checked)
bool processed = false; bool processed = false;
// Try the menu's event handler // Try the menu's event handler
if ( !processed ) // if ( !processed )
{ {
wxEvtHandler *handler = GetEventHandler(); wxEvtHandler *handler = GetEventHandler();
if ( handler ) if ( handler )

View File

@@ -1053,23 +1053,19 @@ bool wxSizer::IsShown( size_t index ) const
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap ) wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
: m_rows( rows ) : m_rows( ( cols == 0 && rows == 0 ) ? 1 : rows )
, m_cols( cols ) , m_cols( cols )
, m_vgap( vgap ) , m_vgap( vgap )
, m_hgap( hgap ) , m_hgap( hgap )
{ {
if (m_rows == 0 && m_cols == 0)
m_rows = 1;
} }
wxGridSizer::wxGridSizer( int cols, int vgap, int hgap ) wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
: m_rows( 0 ) : m_rows( cols == 0 ? 1 : 0 )
, m_cols( cols ) , m_cols( cols )
, m_vgap( vgap ) , m_vgap( vgap )
, m_hgap( hgap ) , m_hgap( hgap )
{ {
if (m_rows == 0 && m_cols == 0)
m_rows = 1;
} }
int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const

View File

@@ -1468,7 +1468,7 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
{ {
// find the right position, or default to the first if not found // find the right position, or default to the first if not found
int pos = Combo()->FindString(m_startValue); int pos = Combo()->FindString(m_startValue);
if (pos == -1) if (pos == wxNOT_FOUND)
pos = 0; pos = 0;
Combo()->SetSelection(pos); Combo()->SetSelection(pos);
} }
@@ -4905,6 +4905,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
break; break;
case WXGRID_CURSOR_SELECT_ROW: case WXGRID_CURSOR_SELECT_ROW:
{
if ( (row = YToRow( y )) >= 0 ) if ( (row = YToRow( y )) >= 0 )
{ {
if ( m_selection ) if ( m_selection )
@@ -4916,6 +4917,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
event.MetaDown() ); event.MetaDown() );
} }
} }
}
break;
// default label to suppress warnings about "enumeration value // default label to suppress warnings about "enumeration value
// 'xxx' not handled in switch // 'xxx' not handled in switch
@@ -5127,6 +5130,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
break; break;
case WXGRID_CURSOR_SELECT_COL: case WXGRID_CURSOR_SELECT_COL:
{
if ( (col = XToCol( x )) >= 0 ) if ( (col = XToCol( x )) >= 0 )
{ {
if ( m_selection ) if ( m_selection )
@@ -5138,6 +5142,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
event.MetaDown() ); event.MetaDown() );
} }
} }
}
break;
// default label to suppress warnings about "enumeration value // default label to suppress warnings about "enumeration value
// 'xxx' not handled in switch // 'xxx' not handled in switch

View File

@@ -445,12 +445,15 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
{ {
case 1: case 1:
return; return;
case -1: case -1:
m_blockSelectionTopLeft.RemoveAt(n); m_blockSelectionTopLeft.RemoveAt(n);
m_blockSelectionBottomRight.RemoveAt(n); m_blockSelectionBottomRight.RemoveAt(n);
n--; count--; n--; count--;
break;
default: default:
; break;
} }
} }
@@ -467,11 +470,14 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
{ {
case 1: case 1:
return; return;
case -1: case -1:
m_rowSelection.RemoveAt(n); m_rowSelection.RemoveAt(n);
n--; count--; n--; count--;
break;
default: default:
; break;
} }
} }
} }
@@ -486,11 +492,14 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
{ {
case 1: case 1:
return; return;
case -1: case -1:
m_colSelection.RemoveAt(n); m_colSelection.RemoveAt(n);
n--; count--; n--; count--;
break;
default: default:
; break;
} }
} }
} }

View File

@@ -344,6 +344,7 @@ void wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent &event)
{ {
#if 1 // What's best? Delayed deleting or immediate deleting? #if 1 // What's best? Delayed deleting or immediate deleting?
delete m_pActiveChild; delete m_pActiveChild;
m_pActiveChild = NULL;
#else #else
ActivateNext(); ActivateNext();

View File

@@ -2284,7 +2284,9 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
colBg = attr->GetBackgroundColour(); colBg = attr->GetBackgroundColour();
} }
else else
{
colBg = m_backgroundColour; colBg = m_backgroundColour;
}
dc.SetBrush(wxBrush(colBg, wxSOLID)); dc.SetBrush(wxBrush(colBg, wxSOLID));
} }
@@ -3246,7 +3248,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
{ {
// this facilitates multiple-item drag-and-drop // this facilitates multiple-item drag-and-drop
if (item && HasFlag(wxTR_MULTIPLE)) if ( /* item && */ HasFlag(wxTR_MULTIPLE))
{ {
wxArrayTreeItemIds selections; wxArrayTreeItemIds selections;
size_t count = GetSelections(selections); size_t count = GetSelections(selections);

View File

@@ -103,7 +103,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
} }
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return FALSE; if (!image.Ok()) return false;
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 ); m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 );
GdkGC *gc = gdk_gc_new( m_bitmap ); GdkGC *gc = gdk_gc_new( m_bitmap );
@@ -183,7 +183,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex ) bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
@@ -191,7 +191,7 @@ bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
unsigned char r,g,b; unsigned char r,g,b;
wxPalette *pal = bitmap.GetPalette(); wxPalette *pal = bitmap.GetPalette();
wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") ); wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
pal->GetRGB(paletteIndex, &r, &g, &b); pal->GetRGB(paletteIndex, &r, &g, &b);
@@ -206,13 +206,13 @@ bool wxMask::Create( const wxBitmap& bitmap )
m_bitmap = (GdkBitmap*) NULL; m_bitmap = (GdkBitmap*) NULL;
} }
if (!bitmap.Ok()) return FALSE; if (!bitmap.Ok()) return false;
wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") ); wxCHECK_MSG( bitmap.GetBitmap(), false, wxT("Cannot create mask from colour bitmap") );
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
if (!m_bitmap) return FALSE; if (!m_bitmap) return false;
GdkGC *gc = gdk_gc_new( m_bitmap ); GdkGC *gc = gdk_gc_new( m_bitmap );
@@ -220,7 +220,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
GdkBitmap *wxMask::GetBitmap() const GdkBitmap *wxMask::GetBitmap() const
@@ -307,7 +307,7 @@ bool wxBitmap::Create( int width, int height, int depth )
if (depth == -1) if (depth == -1)
depth = visual->depth; depth = visual->depth;
wxCHECK_MSG( (depth == visual->depth) || (depth == 1) || (depth == 32), FALSE, wxCHECK_MSG( (depth == visual->depth) || (depth == 1) || (depth == 32), false,
wxT("invalid bitmap depth") ) wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
@@ -340,7 +340,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
{ {
UnRef(); UnRef();
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
GdkVisual *visual = wxTheApp->GetGdkVisual(); GdkVisual *visual = wxTheApp->GetGdkVisual();
@@ -350,7 +350,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits );
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") ); wxCHECK_MSG( M_BMPDATA->m_pixmap, false, wxT("couldn't create pixmap") );
if (mask) if (mask)
{ {
@@ -362,7 +362,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ? M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ?
return TRUE; return true;
} }
wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy ) wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy )
@@ -571,8 +571,8 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
{ {
UnRef(); UnRef();
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) wxCHECK_MSG( image.Ok(), false, wxT("invalid image") )
wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") ) wxCHECK_MSG( depth == -1 || depth == 1, false, wxT("invalid bitmap depth") )
if (image.GetWidth() <= 0 || image.GetHeight() <= 0) if (image.GetWidth() <= 0 || image.GetHeight() <= 0)
return false; return false;
@@ -728,12 +728,12 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
if (!image.HasMask() && (bpp > 12)) if (!image.HasMask() && (bpp > 12))
#endif #endif
{ {
static bool s_hasInitialized = FALSE; static bool s_hasInitialized = false;
if (!s_hasInitialized) if (!s_hasInitialized)
{ {
gdk_rgb_init(); gdk_rgb_init();
s_hasInitialized = TRUE; s_hasInitialized = true;
} }
GdkGC *gc = gdk_gc_new( GetPixmap() ); GdkGC *gc = gdk_gc_new( GetPixmap() );
@@ -747,7 +747,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
width*3 ); width*3 );
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
// Create picture image // Create picture image
@@ -902,6 +902,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
case GBR: pixel = (g << 16) | (b << 8) | r; break; case GBR: pixel = (g << 16) | (b << 8) | r; break;
} }
gdk_image_put_pixel( data_image, x, y, pixel ); gdk_image_put_pixel( data_image, x, y, pixel );
break;
} }
default: break; default: break;
} }
@@ -1067,7 +1068,7 @@ wxImage wxBitmap::ConvertToImage() const
int red_shift_left = 0; int red_shift_left = 0;
int green_shift_left = 0; int green_shift_left = 0;
int blue_shift_left = 0; int blue_shift_left = 0;
bool use_shift = FALSE; bool use_shift = false;
if (GetPixmap()) if (GetPixmap())
{ {
@@ -1267,7 +1268,7 @@ void wxBitmap::SetMask( wxMask *mask )
bool wxBitmap::CopyFromIcon(const wxIcon& icon) bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{ {
*this = icon; *this = icon;
return TRUE; return true;
} }
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
@@ -1335,7 +1336,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const
{ {
wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") ); wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
// Try to save the bitmap via wxImage handlers: // Try to save the bitmap via wxImage handlers:
{ {
@@ -1343,7 +1344,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett
if (image.Ok()) return image.SaveFile( name, type ); if (image.Ok()) return image.SaveFile( name, type );
} }
return FALSE; return false;
} }
bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
@@ -1351,7 +1352,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
UnRef(); UnRef();
if (!wxFileExists(name)) if (!wxFileExists(name))
return FALSE; return false;
GdkVisual *visual = wxTheApp->GetGdkVisual(); GdkVisual *visual = wxTheApp->GetGdkVisual();
@@ -1383,12 +1384,12 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
{ {
wxImage image; wxImage image;
if ( !image.LoadFile( name, type ) || !image.Ok() ) if ( !image.LoadFile( name, type ) || !image.Ok() )
return FALSE; return false;
*this = wxBitmap(image); *this = wxBitmap(image);
} }
return TRUE; return true;
} }
wxPalette *wxBitmap::GetPalette() const wxPalette *wxBitmap::GetPalette() const
@@ -1626,18 +1627,18 @@ wxBitmapHandler::~wxBitmapHandler()
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{ {
return FALSE; return false;
} }
/* static */ void wxBitmap::InitStandardHandlers() /* static */ void wxBitmap::InitStandardHandlers()

View File

@@ -125,7 +125,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxButton)
void wxBitmapButton::Init() void wxBitmapButton::Init()
{ {
m_hasFocus = m_hasFocus =
m_isSelected = FALSE; m_isSelected = false;
} }
bool wxBitmapButton::Create( wxWindow *parent, bool wxBitmapButton::Create( wxWindow *parent,
@@ -137,14 +137,14 @@ bool wxBitmapButton::Create( wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString &name ) const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxBitmapButton creation failed") ); wxFAIL_MSG( wxT("wxBitmapButton creation failed") );
return FALSE; return false;
} }
m_bmpNormal = bitmap; m_bmpNormal = bitmap;
@@ -175,7 +175,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
PostCreation(size); PostCreation(size);
return TRUE; return true;
} }
void wxBitmapButton::SetDefault() void wxBitmapButton::SetDefault()
@@ -195,7 +195,7 @@ void wxBitmapButton::SetLabel( const wxString &label )
wxString wxBitmapButton::GetLabel() const wxString wxBitmapButton::GetLabel() const
{ {
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid button") ); wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid button") );
return wxControl::GetLabel(); return wxControl::GetLabel();
} }
@@ -221,20 +221,8 @@ void wxBitmapButton::OnSetBitmap()
the_one = m_bmpSelected; the_one = m_bmpSelected;
else if (m_hasFocus) else if (m_hasFocus)
the_one = m_bmpFocus; the_one = m_bmpFocus;
else
{
if (m_isSelected)
{
the_one = m_bmpSelected;
}
else
{
if (m_hasFocus)
the_one = m_bmpFocus;
else else
the_one = m_bmpNormal; the_one = m_bmpNormal;
}
}
if (!the_one.Ok()) the_one = m_bmpNormal; if (!the_one.Ok()) the_one = m_bmpNormal;
if (!the_one.Ok()) return; if (!the_one.Ok()) return;
@@ -281,34 +269,34 @@ wxSize wxBitmapButton::DoGetBestSize() const
bool wxBitmapButton::Enable( bool enable ) bool wxBitmapButton::Enable( bool enable )
{ {
if ( !wxWindow::Enable(enable) ) if ( !wxWindow::Enable(enable) )
return FALSE; return false;
OnSetBitmap(); OnSetBitmap();
return TRUE; return true;
} }
void wxBitmapButton::HasFocus() void wxBitmapButton::HasFocus()
{ {
m_hasFocus = TRUE; m_hasFocus = true;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::NotFocus() void wxBitmapButton::NotFocus()
{ {
m_hasFocus = FALSE; m_hasFocus = false;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::StartSelect() void wxBitmapButton::StartSelect()
{ {
m_isSelected = TRUE; m_isSelected = true;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::EndSelect() void wxBitmapButton::EndSelect()
{ {
m_isSelected = FALSE; m_isSelected = false;
OnSetBitmap(); OnSetBitmap();
} }

View File

@@ -883,7 +883,7 @@ void wxTextCtrl::CalculateScrollbar()
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, wxT(""), wxT("invalid text ctrl") ); wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1071,7 +1071,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
if (text) if (text)
{ {
wxString buf(wxT("")); wxString buf;
long i; long i;
int currentLine = 0; int currentLine = 0;
for (i = 0; currentLine != lineNo && text[i]; i++ ) for (i = 0; currentLine != lineNo && text[i]; i++ )
@@ -1725,7 +1725,7 @@ bool wxTextCtrl::IsModified() const
void wxTextCtrl::Clear() void wxTextCtrl::Clear()
{ {
SetValue( wxT("") ); SetValue( wxEmptyString );
} }
void wxTextCtrl::OnChar( wxKeyEvent &key_event ) void wxTextCtrl::OnChar( wxKeyEvent &key_event )
@@ -1896,6 +1896,7 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
// nothing to do // nothing to do
return true; return true;
} }
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer ); gint l = gtk_text_buffer_get_char_count( m_buffer );
@@ -1912,8 +1913,6 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this); wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this);
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi ); wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
return true;
#else #else
// VERY dirty way to do that - removes the required text and re-adds it // VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME) // with styling (FIXME)
@@ -1931,14 +1930,14 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end ); gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end );
gtk_editable_set_position( GTK_EDITABLE(m_text), start ); gtk_editable_set_position( GTK_EDITABLE(m_text), start );
#if wxUSE_UNICODE #if wxUSE_UNICODE
wxWX2MBbuf buf = tmp.mbc_str(); wxWX2MBbuf buf = tmp.mbc_str();
const char *txt = buf; const char *txt = buf;
size_t txtlen = strlen(buf); size_t txtlen = strlen(buf);
#else #else
const char *txt = tmp; const char *txt = tmp;
size_t txtlen = tmp.length(); size_t txtlen = tmp.length();
#endif #endif
// use the attributes from style which are set in it and fall back // use the attributes from style which are set in it and fall back
// first to the default style and then to the text control default // first to the default style and then to the text control default
@@ -1952,13 +1951,13 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */ gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos ); SetInsertionPoint( old_pos );
#endif #endif
return true; return true;
} }
else // singe line
{ // else single line
// cannot do this for GTK+'s Entry widget // cannot do this for GTK+'s Entry widget
return false; return false;
}
} }
void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style) void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)

View File

@@ -103,7 +103,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
} }
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return FALSE; if (!image.Ok()) return false;
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 ); m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 );
GdkGC *gc = gdk_gc_new( m_bitmap ); GdkGC *gc = gdk_gc_new( m_bitmap );
@@ -183,7 +183,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex ) bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
@@ -191,7 +191,7 @@ bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
unsigned char r,g,b; unsigned char r,g,b;
wxPalette *pal = bitmap.GetPalette(); wxPalette *pal = bitmap.GetPalette();
wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") ); wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
pal->GetRGB(paletteIndex, &r, &g, &b); pal->GetRGB(paletteIndex, &r, &g, &b);
@@ -206,13 +206,13 @@ bool wxMask::Create( const wxBitmap& bitmap )
m_bitmap = (GdkBitmap*) NULL; m_bitmap = (GdkBitmap*) NULL;
} }
if (!bitmap.Ok()) return FALSE; if (!bitmap.Ok()) return false;
wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") ); wxCHECK_MSG( bitmap.GetBitmap(), false, wxT("Cannot create mask from colour bitmap") );
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
if (!m_bitmap) return FALSE; if (!m_bitmap) return false;
GdkGC *gc = gdk_gc_new( m_bitmap ); GdkGC *gc = gdk_gc_new( m_bitmap );
@@ -220,7 +220,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
GdkBitmap *wxMask::GetBitmap() const GdkBitmap *wxMask::GetBitmap() const
@@ -307,7 +307,7 @@ bool wxBitmap::Create( int width, int height, int depth )
if (depth == -1) if (depth == -1)
depth = visual->depth; depth = visual->depth;
wxCHECK_MSG( (depth == visual->depth) || (depth == 1) || (depth == 32), FALSE, wxCHECK_MSG( (depth == visual->depth) || (depth == 1) || (depth == 32), false,
wxT("invalid bitmap depth") ) wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
@@ -340,7 +340,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
{ {
UnRef(); UnRef();
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
GdkVisual *visual = wxTheApp->GetGdkVisual(); GdkVisual *visual = wxTheApp->GetGdkVisual();
@@ -350,7 +350,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits );
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") ); wxCHECK_MSG( M_BMPDATA->m_pixmap, false, wxT("couldn't create pixmap") );
if (mask) if (mask)
{ {
@@ -362,7 +362,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ? M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ?
return TRUE; return true;
} }
wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy ) wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy )
@@ -571,8 +571,8 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
{ {
UnRef(); UnRef();
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) wxCHECK_MSG( image.Ok(), false, wxT("invalid image") )
wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") ) wxCHECK_MSG( depth == -1 || depth == 1, false, wxT("invalid bitmap depth") )
if (image.GetWidth() <= 0 || image.GetHeight() <= 0) if (image.GetWidth() <= 0 || image.GetHeight() <= 0)
return false; return false;
@@ -728,12 +728,12 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
if (!image.HasMask() && (bpp > 12)) if (!image.HasMask() && (bpp > 12))
#endif #endif
{ {
static bool s_hasInitialized = FALSE; static bool s_hasInitialized = false;
if (!s_hasInitialized) if (!s_hasInitialized)
{ {
gdk_rgb_init(); gdk_rgb_init();
s_hasInitialized = TRUE; s_hasInitialized = true;
} }
GdkGC *gc = gdk_gc_new( GetPixmap() ); GdkGC *gc = gdk_gc_new( GetPixmap() );
@@ -747,7 +747,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
width*3 ); width*3 );
gdk_gc_unref( gc ); gdk_gc_unref( gc );
return TRUE; return true;
} }
// Create picture image // Create picture image
@@ -902,6 +902,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
case GBR: pixel = (g << 16) | (b << 8) | r; break; case GBR: pixel = (g << 16) | (b << 8) | r; break;
} }
gdk_image_put_pixel( data_image, x, y, pixel ); gdk_image_put_pixel( data_image, x, y, pixel );
break;
} }
default: break; default: break;
} }
@@ -1067,7 +1068,7 @@ wxImage wxBitmap::ConvertToImage() const
int red_shift_left = 0; int red_shift_left = 0;
int green_shift_left = 0; int green_shift_left = 0;
int blue_shift_left = 0; int blue_shift_left = 0;
bool use_shift = FALSE; bool use_shift = false;
if (GetPixmap()) if (GetPixmap())
{ {
@@ -1267,7 +1268,7 @@ void wxBitmap::SetMask( wxMask *mask )
bool wxBitmap::CopyFromIcon(const wxIcon& icon) bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{ {
*this = icon; *this = icon;
return TRUE; return true;
} }
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
@@ -1335,7 +1336,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const
{ {
wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") ); wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
// Try to save the bitmap via wxImage handlers: // Try to save the bitmap via wxImage handlers:
{ {
@@ -1343,7 +1344,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett
if (image.Ok()) return image.SaveFile( name, type ); if (image.Ok()) return image.SaveFile( name, type );
} }
return FALSE; return false;
} }
bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
@@ -1351,7 +1352,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
UnRef(); UnRef();
if (!wxFileExists(name)) if (!wxFileExists(name))
return FALSE; return false;
GdkVisual *visual = wxTheApp->GetGdkVisual(); GdkVisual *visual = wxTheApp->GetGdkVisual();
@@ -1383,12 +1384,12 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
{ {
wxImage image; wxImage image;
if ( !image.LoadFile( name, type ) || !image.Ok() ) if ( !image.LoadFile( name, type ) || !image.Ok() )
return FALSE; return false;
*this = wxBitmap(image); *this = wxBitmap(image);
} }
return TRUE; return true;
} }
wxPalette *wxBitmap::GetPalette() const wxPalette *wxBitmap::GetPalette() const
@@ -1626,18 +1627,18 @@ wxBitmapHandler::~wxBitmapHandler()
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{ {
return FALSE; return false;
} }
/* static */ void wxBitmap::InitStandardHandlers() /* static */ void wxBitmap::InitStandardHandlers()

View File

@@ -125,7 +125,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxButton)
void wxBitmapButton::Init() void wxBitmapButton::Init()
{ {
m_hasFocus = m_hasFocus =
m_isSelected = FALSE; m_isSelected = false;
} }
bool wxBitmapButton::Create( wxWindow *parent, bool wxBitmapButton::Create( wxWindow *parent,
@@ -137,14 +137,14 @@ bool wxBitmapButton::Create( wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString &name ) const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxBitmapButton creation failed") ); wxFAIL_MSG( wxT("wxBitmapButton creation failed") );
return FALSE; return false;
} }
m_bmpNormal = bitmap; m_bmpNormal = bitmap;
@@ -175,7 +175,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
PostCreation(size); PostCreation(size);
return TRUE; return true;
} }
void wxBitmapButton::SetDefault() void wxBitmapButton::SetDefault()
@@ -195,7 +195,7 @@ void wxBitmapButton::SetLabel( const wxString &label )
wxString wxBitmapButton::GetLabel() const wxString wxBitmapButton::GetLabel() const
{ {
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid button") ); wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid button") );
return wxControl::GetLabel(); return wxControl::GetLabel();
} }
@@ -221,20 +221,8 @@ void wxBitmapButton::OnSetBitmap()
the_one = m_bmpSelected; the_one = m_bmpSelected;
else if (m_hasFocus) else if (m_hasFocus)
the_one = m_bmpFocus; the_one = m_bmpFocus;
else
{
if (m_isSelected)
{
the_one = m_bmpSelected;
}
else
{
if (m_hasFocus)
the_one = m_bmpFocus;
else else
the_one = m_bmpNormal; the_one = m_bmpNormal;
}
}
if (!the_one.Ok()) the_one = m_bmpNormal; if (!the_one.Ok()) the_one = m_bmpNormal;
if (!the_one.Ok()) return; if (!the_one.Ok()) return;
@@ -281,34 +269,34 @@ wxSize wxBitmapButton::DoGetBestSize() const
bool wxBitmapButton::Enable( bool enable ) bool wxBitmapButton::Enable( bool enable )
{ {
if ( !wxWindow::Enable(enable) ) if ( !wxWindow::Enable(enable) )
return FALSE; return false;
OnSetBitmap(); OnSetBitmap();
return TRUE; return true;
} }
void wxBitmapButton::HasFocus() void wxBitmapButton::HasFocus()
{ {
m_hasFocus = TRUE; m_hasFocus = true;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::NotFocus() void wxBitmapButton::NotFocus()
{ {
m_hasFocus = FALSE; m_hasFocus = false;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::StartSelect() void wxBitmapButton::StartSelect()
{ {
m_isSelected = TRUE; m_isSelected = true;
OnSetBitmap(); OnSetBitmap();
} }
void wxBitmapButton::EndSelect() void wxBitmapButton::EndSelect()
{ {
m_isSelected = FALSE; m_isSelected = false;
OnSetBitmap(); OnSetBitmap();
} }

View File

@@ -883,7 +883,7 @@ void wxTextCtrl::CalculateScrollbar()
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, wxT(""), wxT("invalid text ctrl") ); wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1071,7 +1071,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
if (text) if (text)
{ {
wxString buf(wxT("")); wxString buf;
long i; long i;
int currentLine = 0; int currentLine = 0;
for (i = 0; currentLine != lineNo && text[i]; i++ ) for (i = 0; currentLine != lineNo && text[i]; i++ )
@@ -1725,7 +1725,7 @@ bool wxTextCtrl::IsModified() const
void wxTextCtrl::Clear() void wxTextCtrl::Clear()
{ {
SetValue( wxT("") ); SetValue( wxEmptyString );
} }
void wxTextCtrl::OnChar( wxKeyEvent &key_event ) void wxTextCtrl::OnChar( wxKeyEvent &key_event )
@@ -1896,6 +1896,7 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
// nothing to do // nothing to do
return true; return true;
} }
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer ); gint l = gtk_text_buffer_get_char_count( m_buffer );
@@ -1912,8 +1913,6 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this); wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this);
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi ); wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
return true;
#else #else
// VERY dirty way to do that - removes the required text and re-adds it // VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME) // with styling (FIXME)
@@ -1931,14 +1930,14 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end ); gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end );
gtk_editable_set_position( GTK_EDITABLE(m_text), start ); gtk_editable_set_position( GTK_EDITABLE(m_text), start );
#if wxUSE_UNICODE #if wxUSE_UNICODE
wxWX2MBbuf buf = tmp.mbc_str(); wxWX2MBbuf buf = tmp.mbc_str();
const char *txt = buf; const char *txt = buf;
size_t txtlen = strlen(buf); size_t txtlen = strlen(buf);
#else #else
const char *txt = tmp; const char *txt = tmp;
size_t txtlen = tmp.length(); size_t txtlen = tmp.length();
#endif #endif
// use the attributes from style which are set in it and fall back // use the attributes from style which are set in it and fall back
// first to the default style and then to the text control default // first to the default style and then to the text control default
@@ -1952,13 +1951,13 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */ gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos ); SetInsertionPoint( old_pos );
#endif #endif
return true; return true;
} }
else // singe line
{ // else single line
// cannot do this for GTK+'s Entry widget // cannot do this for GTK+'s Entry widget
return false; return false;
}
} }
void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style) void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)

View File

@@ -308,15 +308,11 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
m_CurTextPiece++; m_CurTextPiece++;
} }
else if (m_CurTag) else if (m_CurTag)
{
// Add tag:
if (m_CurTag)
{ {
if (m_CurTag->HasEnding()) if (m_CurTag->HasEnding())
begin_pos = m_CurTag->GetEndPos2(); begin_pos = m_CurTag->GetEndPos2();
else else
begin_pos = m_CurTag->GetBeginPos(); begin_pos = m_CurTag->GetBeginPos();
}
wxHtmlTag *t = m_CurTag; wxHtmlTag *t = m_CurTag;
m_CurTag = m_CurTag->GetNextTag(); m_CurTag = m_CurTag->GetNextTag();
AddTag(*t); AddTag(*t);

View File

@@ -85,9 +85,9 @@ extern size_t g_numberOfThreads;
// statics for implementation // statics for implementation
static bool s_inYield = FALSE; static bool s_inYield = false;
static bool s_inReceiveEvent = FALSE ; static bool s_inReceiveEvent = false ;
static EventTime sleepTime = kEventDurationNoWait ; static EventTime sleepTime = kEventDurationNoWait ;
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
@@ -246,7 +246,7 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
{ {
wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId); wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId);
if (!win->ProcessEvent(exitEvent)) if (!win->ProcessEvent(exitEvent))
win->Close(TRUE ) ; win->Close(true) ;
} }
else else
{ {
@@ -297,7 +297,7 @@ void wxApp::MacPrintFile(const wxString & fileName )
if (printout) if (printout)
{ {
wxPrinter printer; wxPrinter printer;
printer.Print(view->GetFrame(), printout, TRUE); printer.Print(view->GetFrame(), printout, true);
delete printout; delete printout;
} }
} }
@@ -736,7 +736,7 @@ bool wxApp::OnInitGui()
sQuitHandler , 0 , FALSE ) ; sQuitHandler , 0 , FALSE ) ;
} }
return TRUE ; return true ;
} }
void wxApp::CleanUp() void wxApp::CleanUp()
@@ -917,7 +917,7 @@ wxApp::wxApp()
int wxApp::MainLoop() int wxApp::MainLoop()
{ {
m_keepGoing = TRUE; m_keepGoing = true;
#if wxMAC_USE_RAEL #if wxMAC_USE_RAEL
RunApplicationEventLoop() ; RunApplicationEventLoop() ;
#else #else
@@ -931,7 +931,7 @@ int wxApp::MainLoop()
void wxApp::ExitMainLoop() void wxApp::ExitMainLoop()
{ {
m_keepGoing = FALSE; m_keepGoing = false;
#if wxMAC_USE_RAEL #if wxMAC_USE_RAEL
QuitApplicationEventLoop() ; QuitApplicationEventLoop() ;
#endif #endif
@@ -987,7 +987,7 @@ void wxApp::Exit()
void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
{ {
if (GetTopWindow()) if (GetTopWindow())
GetTopWindow()->Close(TRUE); GetTopWindow()->Close(true);
} }
// Default behaviour: close the application with prompts. The // Default behaviour: close the application with prompts. The
@@ -997,7 +997,7 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event)
if (GetTopWindow()) if (GetTopWindow())
{ {
if (!GetTopWindow()->Close(!event.CanVeto())) if (!GetTopWindow()->Close(!event.CanVeto()))
event.Veto(TRUE); event.Veto(true);
} }
} }
@@ -1018,10 +1018,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
wxFAIL_MSG( wxT("wxYield called recursively" ) ); wxFAIL_MSG( wxT("wxYield called recursively" ) );
} }
return FALSE; return false;
} }
s_inYield = TRUE; s_inYield = true;
// by definition yield should handle all non-processed events // by definition yield should handle all non-processed events
@@ -1052,9 +1052,9 @@ bool wxApp::Yield(bool onlyIfNeeded)
} while( status == noErr ) ; } while( status == noErr ) ;
wxMacProcessNotifierAndPendingEvents() ; wxMacProcessNotifierAndPendingEvents() ;
s_inYield = FALSE; s_inYield = false;
return TRUE; return true;
} }
void wxApp::MacDoOneEvent() void wxApp::MacDoOneEvent()
@@ -1118,30 +1118,38 @@ long wxMacTranslateKey(unsigned char key, unsigned char code)
case kHomeCharCode : case kHomeCharCode :
retval = WXK_HOME; retval = WXK_HOME;
break; break;
case kEnterCharCode : case kEnterCharCode :
retval = WXK_RETURN; retval = WXK_RETURN;
break; break;
case kEndCharCode : case kEndCharCode :
retval = WXK_END; retval = WXK_END;
break; break;
case kHelpCharCode : case kHelpCharCode :
retval = WXK_HELP; retval = WXK_HELP;
break; break;
case kBackspaceCharCode : case kBackspaceCharCode :
retval = WXK_BACK; retval = WXK_BACK;
break; break;
case kTabCharCode : case kTabCharCode :
retval = WXK_TAB; retval = WXK_TAB;
break; break;
case kPageUpCharCode : case kPageUpCharCode :
retval = WXK_PAGEUP; retval = WXK_PAGEUP;
break; break;
case kPageDownCharCode : case kPageDownCharCode :
retval = WXK_PAGEDOWN; retval = WXK_PAGEDOWN;
break; break;
case kReturnCharCode : case kReturnCharCode :
retval = WXK_RETURN; retval = WXK_RETURN;
break; break;
case kFunctionKeyCharCode : case kFunctionKeyCharCode :
{ {
switch( code ) switch( code )
@@ -1194,23 +1202,31 @@ long wxMacTranslateKey(unsigned char key, unsigned char code)
} }
} }
break ; break ;
case kEscapeCharCode : case kEscapeCharCode :
retval = WXK_ESCAPE ; retval = WXK_ESCAPE ;
break ; break ;
case kLeftArrowCharCode : case kLeftArrowCharCode :
retval = WXK_LEFT ; retval = WXK_LEFT ;
break ; break ;
case kRightArrowCharCode : case kRightArrowCharCode :
retval = WXK_RIGHT ; retval = WXK_RIGHT ;
break ; break ;
case kUpArrowCharCode : case kUpArrowCharCode :
retval = WXK_UP ; retval = WXK_UP ;
break ; break ;
case kDownArrowCharCode : case kDownArrowCharCode :
retval = WXK_DOWN ; retval = WXK_DOWN ;
break ; break ;
case kDeleteCharCode : case kDeleteCharCode :
retval = WXK_DELETE ; retval = WXK_DELETE ;
break ;
default: default:
break ; break ;
} // end switch } // end switch
@@ -1340,10 +1356,9 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
handled = focus->GetEventHandler()->ProcessEvent( event ) ; handled = focus->GetEventHandler()->ProcessEvent( event ) ;
if ( handled && event.GetSkipped() ) if ( handled && event.GetSkipped() )
handled = false ; handled = false ;
if ( !handled )
{
#if wxUSE_ACCEL #if wxUSE_ACCEL
if (!handled) if ( !handled )
{ {
wxWindow *ancestor = focus; wxWindow *ancestor = focus;
while (ancestor) while (ancestor)
@@ -1361,14 +1376,14 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
} }
} }
#endif // wxUSE_ACCEL #endif // wxUSE_ACCEL
}
if (!handled) if (!handled)
{ {
wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ; wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ;
if (tlw) if (tlw)
{ {
event.Skip( FALSE ) ; event.Skip( false ) ;
event.SetEventType( wxEVT_CHAR_HOOK ); event.SetEventType( wxEVT_CHAR_HOOK );
// raw value again // raw value again
event.m_keyCode = realkeyval ; event.m_keyCode = realkeyval ;
@@ -1381,7 +1396,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
if ( !handled ) if ( !handled )
{ {
event.Skip( FALSE ) ; event.Skip( false ) ;
event.SetEventType( wxEVT_CHAR ) ; event.SetEventType( wxEVT_CHAR ) ;
// raw value again // raw value again
event.m_keyCode = realkeyval ; event.m_keyCode = realkeyval ;

View File

@@ -819,14 +819,14 @@ void wxBitmap::EndRawAccess()
bool wxBitmap::CreateFromXpm(const char **bits) bool wxBitmap::CreateFromXpm(const char **bits)
{ {
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
wxXPMDecoder decoder; wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits); wxImage img = decoder.ReadData(bits);
wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") )
*this = wxBitmap(img); *this = wxBitmap(img);
return TRUE; return true;
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -943,7 +943,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int
if ( handler == NULL ) { if ( handler == NULL ) {
wxLogWarning(wxT("no bitmap handler for type %d defined."), type); wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
return FALSE; return false;
} }
return handler->Create(this, data, type, width, height, depth); return handler->Create(this, data, type, width, height, depth);
@@ -1104,22 +1104,24 @@ wxImage wxBitmap::ConvertToImage() const
bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
const wxPalette *palette) const const wxPalette *palette) const
{ {
bool success = false;
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
if ( handler ) if ( handler )
{ {
return handler->SaveFile(this, filename, type, palette); success = handler->SaveFile(this, filename, type, palette);
} }
else else
{ {
#if wxUSE_IMAGE #if wxUSE_IMAGE
wxImage image = ConvertToImage(); wxImage image = ConvertToImage();
return image.SaveFile(filename, type); success = image.SaveFile(filename, type);
#else
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
#endif #endif
} }
wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return success;
return false;
} }
bool wxBitmap::Ok() const bool wxBitmap::Ok() const
@@ -1349,7 +1351,7 @@ bool wxMask::Create(const wxBitmap& bitmap)
} }
m_memBuf.UngetWriteBuf( size ) ; m_memBuf.UngetWriteBuf( size ) ;
RealizeNative() ; RealizeNative() ;
return TRUE; return true;
} }
// Create a mask from a bitmap and a colour indicating // Create a mask from a bitmap and a colour indicating
@@ -1381,7 +1383,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
} }
m_memBuf.UngetWriteBuf( size ) ; m_memBuf.UngetWriteBuf( size ) ;
RealizeNative() ; RealizeNative() ;
return TRUE; return true;
} }
WXHBITMAP wxMask::GetHBITMAP() const WXHBITMAP wxMask::GetHBITMAP() const
@@ -1399,18 +1401,18 @@ wxBitmapHandler::~wxBitmapHandler()
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
return FALSE; return false;
} }
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{ {
return FALSE; return false;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1451,10 +1453,10 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
dc.SelectObject( *bitmap ) ; dc.SelectObject( *bitmap ) ;
mf.Play( &dc ) ; mf.Play( &dc ) ;
dc.SelectObject( wxNullBitmap ) ; dc.SelectObject( wxNullBitmap ) ;
return TRUE ; return true ;
} }
#endif //wxUSE_METAFILE #endif //wxUSE_METAFILE
return FALSE ; return false ;
} }

View File

@@ -49,7 +49,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
if (data) if (data)
m_colourData = *data; m_colourData = *data;
return TRUE; return true;
} }
int wxColourDialog::ShowModal() int wxColourDialog::ShowModal()
@@ -64,10 +64,6 @@ int wxColourDialog::ShowModal()
m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ; m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ;
return wxID_OK; return wxID_OK;
} }
else
{
return wxID_CANCEL;
}
return wxID_CANCEL; return wxID_CANCEL;
} }

View File

@@ -52,16 +52,10 @@ int wxDirDialog::ShowModal()
{ {
NavDialogOptions mNavOptions; NavDialogOptions mNavOptions;
NavObjectFilterUPP mNavFilterUPP = NULL; NavObjectFilterUPP mNavFilterUPP = NULL;
NavPreviewUPP mNavPreviewUPP = NULL ;
NavReplyRecord mNavReply; NavReplyRecord mNavReply;
AEDesc* mDefaultLocation = NULL ;
bool mSelectDefault = false ;
::NavGetDefaultDialogOptions(&mNavOptions); ::NavGetDefaultDialogOptions(&mNavOptions);
mNavFilterUPP = nil;
mNavPreviewUPP = nil;
mSelectDefault = false;
mNavReply.validRecord = false; mNavReply.validRecord = false;
mNavReply.replacing = false; mNavReply.replacing = false;
mNavReply.isStationery = false; mNavReply.isStationery = false;
@@ -75,17 +69,8 @@ int wxDirDialog::ShowModal()
// that's displayed when the dialog // that's displayed when the dialog
// first appears // first appears
if ( mDefaultLocation ) {
if (mSelectDefault) {
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
} else {
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
}
}
OSErr err = ::NavChooseFolder( OSErr err = ::NavChooseFolder(
mDefaultLocation, NULL,
&mNavReply, &mNavReply,
&mNavOptions, &mNavOptions,
NULL, NULL,
@@ -93,7 +78,7 @@ int wxDirDialog::ShowModal()
0L); // User Data 0L); // User Data
if ( (err != noErr) && (err != userCanceledErr) ) { if ( (err != noErr) && (err != userCanceledErr) ) {
m_path = wxT("") ; m_path = wxEmptyString ;
return wxID_CANCEL ; return wxID_CANCEL ;
} }
@@ -104,7 +89,7 @@ int wxDirDialog::ShowModal()
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSRef, &specDesc); OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSRef, &specDesc);
if ( err != noErr ) { if ( err != noErr ) {
m_path = wxT("") ; m_path = wxEmptyString ;
return wxID_CANCEL ; return wxID_CANCEL ;
} }
folderInfo = **(FSRef**) specDesc.dataHandle; folderInfo = **(FSRef**) specDesc.dataHandle;

View File

@@ -55,7 +55,7 @@ void wxFrame::Init()
m_frameStatusBar = NULL; m_frameStatusBar = NULL;
m_winLastFocused = NULL ; m_winLastFocused = NULL ;
m_iconized = FALSE; m_iconized = false;
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
m_hwndToolTip = 0; m_hwndToolTip = 0;
@@ -72,16 +72,16 @@ bool wxFrame::Create(wxWindow *parent,
{ {
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE; return false;
wxModelessWindows.Append(this); wxModelessWindows.Append(this);
return TRUE; return true;
} }
wxFrame::~wxFrame() wxFrame::~wxFrame()
{ {
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
DeleteAllBars(); DeleteAllBars();
} }
@@ -89,7 +89,7 @@ wxFrame::~wxFrame()
bool wxFrame::Enable(bool enable) bool wxFrame::Enable(bool enable)
{ {
if ( !wxWindow::Enable(enable) ) if ( !wxWindow::Enable(enable) )
return FALSE; return false;
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() ) if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
{ {
@@ -100,7 +100,7 @@ bool wxFrame::Enable(bool enable)
} }
} }
return TRUE; return true;
} }
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
@@ -226,7 +226,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( GetStatusBar() && GetStatusBar()->IsShown() && y ) if ( GetStatusBar() && GetStatusBar()->IsShown() && y )
{ {
if ( y) *y -= WX_MAC_STATUSBAR_HEIGHT; *y -= WX_MAC_STATUSBAR_HEIGHT;
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -24,7 +24,6 @@
#ifdef __DARWIN__ #ifdef __DARWIN__
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#else #else
#include <MacHeaders.c> #include <MacHeaders.c>
#define OTUNIXERRORS 1 #define OTUNIXERRORS 1
@@ -61,22 +60,22 @@
#endif #endif
#ifndef __GSOCKET_STANDALONE__ #ifndef __GSOCKET_STANDALONE__
#include "wx/mac/macnotfy.h" #include "wx/mac/macnotfy.h"
#include "wx/mac/gsockmac.h" #include "wx/mac/gsockmac.h"
#include "wx/gsocket.h" #include "wx/gsocket.h"
#else #else
#include "gsockmac.h" #include "gsockmac.h"
#include "gsocket.h" #include "gsocket.h"
#endif /* __GSOCKET_STANDALONE__ */ #endif /* __GSOCKET_STANDALONE__ */
#ifndef ntohl #ifndef ntohl
#define ntohl(x) (x) #define ntohl(x) (x)
#define ntohs(x) (x) #define ntohs(x) (x)
#define htonl(x) (x) #define htonl(x) (x)
#define htons(x) (x) #define htons(x) (x)
#endif #endif
void wxCYield() ; void wxCYield() ;
@@ -317,8 +316,8 @@ void GSocket::Shutdown()
err = OTSndOrderlyDisconnect( m_endpoint ) ; err = OTSndOrderlyDisconnect( m_endpoint ) ;
if ( err != kOTNoError ) if ( err != kOTNoError )
{ {
} }
err = OTRcvOrderlyDisconnect( m_endpoint ) ; err = OTRcvOrderlyDisconnect( m_endpoint ) ;
err = OTUnbind( m_endpoint ) ; err = OTUnbind( m_endpoint ) ;
err = OTCloseProvider( m_endpoint ) ; err = OTCloseProvider( m_endpoint ) ;
@@ -1544,8 +1543,11 @@ GSocketError GSocket::Output_Timeout()
void _GSocket_Internal_Proc(unsigned long e , void* d ) void _GSocket_Internal_Proc(unsigned long e , void* d )
{ {
GSocket *socket = (GSocket*) d ;
if ( !socket )
return ;
GSocket * socket = (GSocket*) d ;
OTEventCode ev = (OTEventCode) e ; OTEventCode ev = (OTEventCode) e ;
GSocketEvent event; GSocketEvent event;
GSocketEvent event2; GSocketEvent event2;
@@ -1554,8 +1556,6 @@ void _GSocket_Internal_Proc(unsigned long e , void* d )
GSocketCallback cback2; GSocketCallback cback2;
char *data2; char *data2;
if ( !socket )
return ;
event = GSOCK_MAX_EVENT ; event = GSOCK_MAX_EVENT ;
event2 = GSOCK_MAX_EVENT ; event2 = GSOCK_MAX_EVENT ;
cback = NULL; cback = NULL;
@@ -1567,7 +1567,7 @@ void _GSocket_Internal_Proc(unsigned long e , void* d )
* destroyed) and for safety, check that the m_endpoint field * destroyed) and for safety, check that the m_endpoint field
* is what we expect it to be. * is what we expect it to be.
*/ */
if ((socket != NULL) && (socket->m_takesEvents)) if ( /* (socket != NULL) && */ (socket->m_takesEvents))
{ {
switch (ev) switch (ev)
{ {

View File

@@ -143,7 +143,7 @@ _wxMenuAt(const wxMenuList &menuList, size_t pos)
void wxMenu::Init() void wxMenu::Init()
{ {
m_doBreak = FALSE; m_doBreak = false;
m_startRadioGroup = -1; m_startRadioGroup = -1;
// create the menu // create the menu
@@ -158,7 +158,7 @@ void wxMenu::Init()
wxAssociateMenuWithMacMenu( (MenuRef)m_hMenu , this ) ; wxAssociateMenuWithMacMenu( (MenuRef)m_hMenu , this ) ;
// if we have a title, insert it in the beginning of the menu // if we have a title, insert it in the beginning of the menu
if ( !!m_title ) if ( !m_title.empty() )
{ {
Append(idMenuTitle, m_title) ; Append(idMenuTitle, m_title) ;
AppendSeparator() ; AppendSeparator() ;
@@ -250,7 +250,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
{ {
GetMenuBar()->Refresh(); GetMenuBar()->Refresh();
} }
return TRUE ; return true ;
} }
void wxMenu::EndRadioGroup() void wxMenu::EndRadioGroup()
@@ -263,7 +263,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{ {
wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") ); wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
bool check = FALSE; bool check = false;
if ( item->GetKind() == wxITEM_RADIO ) if ( item->GetKind() == wxITEM_RADIO )
{ {
@@ -279,7 +279,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
item->SetRadioGroupEnd(m_startRadioGroup); item->SetRadioGroupEnd(m_startRadioGroup);
// ensure that we have a checked item in the radio group // ensure that we have a checked item in the radio group
check = TRUE; check = true;
} }
else // extend the current radio group else // extend the current radio group
{ {
@@ -310,7 +310,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
if ( check ) if ( check )
{ {
// check the item initially // check the item initially
item->Check(TRUE); item->Check(true);
} }
return item; return item;
@@ -357,12 +357,13 @@ void wxMenu::SetTitle(const wxString& label)
m_title = label ; m_title = label ;
UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ; UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ;
} }
bool wxMenu::ProcessCommand(wxCommandEvent & event) bool wxMenu::ProcessCommand(wxCommandEvent & event)
{ {
bool processed = FALSE; bool processed = false;
// Try the menu's event handler // Try the menu's event handler
if ( !processed && GetEventHandler()) if ( /* !processed && */ GetEventHandler())
{ {
processed = GetEventHandler()->ProcessEvent(event); processed = GetEventHandler()->ProcessEvent(event);
} }
@@ -860,7 +861,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
{ {
wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title); wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
if ( !menuOld ) if ( !menuOld )
return FALSE; return false;
m_titles[pos] = title; m_titles[pos] = title;
if ( IsAttached() ) if ( IsAttached() )
@@ -894,7 +895,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{ {
if ( !wxMenuBarBase::Insert(pos, menu, title) ) if ( !wxMenuBarBase::Insert(pos, menu, title) )
return FALSE; return false;
m_titles.Insert(title, pos); m_titles.Insert(title, pos);
@@ -919,7 +920,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
if (m_invokingWindow) if (m_invokingWindow)
wxMenubarSetInvokingWindow( menu, m_invokingWindow ); wxMenubarSetInvokingWindow( menu, m_invokingWindow );
return TRUE; return true;
} }
wxMenu *wxMenuBar::Remove(size_t pos) wxMenu *wxMenuBar::Remove(size_t pos)
@@ -946,10 +947,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
bool wxMenuBar::Append(wxMenu *menu, const wxString& title) bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{ {
WXHMENU submenu = menu ? menu->GetHMenu() : 0; WXHMENU submenu = menu ? menu->GetHMenu() : 0;
wxCHECK_MSG( submenu, FALSE, wxT("can't append invalid menu to menubar") ); wxCHECK_MSG( submenu, false, wxT("can't append invalid menu to menubar") );
if ( !wxMenuBarBase::Append(menu, title) ) if ( !wxMenuBarBase::Append(menu, title) )
return FALSE; return false;
m_titles.Add(title); m_titles.Add(title);
@@ -971,7 +972,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
if (m_invokingWindow) if (m_invokingWindow)
wxMenubarSetInvokingWindow( menu, m_invokingWindow ); wxMenubarSetInvokingWindow( menu, m_invokingWindow );
return TRUE; return true;
} }
static void wxMenubarUnsetInvokingWindow( wxMenu *menu ) static void wxMenubarUnsetInvokingWindow( wxMenu *menu )

View File

@@ -87,7 +87,7 @@ wxMetaFile::wxMetaFile(const wxString& file)
m_refData = new wxMetafileRefData; m_refData = new wxMetafileRefData;
M_METAFILEDATA->m_metafile = 0; M_METAFILEDATA->m_metafile = 0;
wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet") ) ; wxASSERT_MSG( file.empty() , wxT("no file based metafile support yet") ) ;
/* /*
if (!file.IsNull() && (file.Cmp("") == 0)) if (!file.IsNull() && (file.Cmp("") == 0))
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file); M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
@@ -110,10 +110,12 @@ WXHMETAFILE wxMetaFile::GetHMETAFILE() const
bool wxMetaFile::SetClipboard(int width, int height) bool wxMetaFile::SetClipboard(int width, int height)
{ {
bool success = true;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
//TODO finishi this port , we need the data obj first //TODO finishi this port , we need the data obj first
if (!m_refData) if (!m_refData)
return FALSE; return false;
bool alreadyOpen=wxTheClipboard->IsOpened() ; bool alreadyOpen=wxTheClipboard->IsOpened() ;
if (!alreadyOpen) if (!alreadyOpen)
@@ -123,12 +125,12 @@ bool wxMetaFile::SetClipboard(int width, int height)
} }
wxDataObject *data = wxDataObject *data =
new wxMetafileDataObject( *this) ; new wxMetafileDataObject( *this) ;
bool success = wxTheClipboard->SetData(data); success = wxTheClipboard->SetData(data);
if (!alreadyOpen) if (!alreadyOpen)
wxTheClipboard->Close(); wxTheClipboard->Close();
return (bool) success;
#endif #endif
return TRUE ;
return success;
} }
void wxMetafile::SetHMETAFILE(WXHMETAFILE mf) void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
@@ -158,10 +160,10 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
bool wxMetaFile::Play(wxDC *dc) bool wxMetaFile::Play(wxDC *dc)
{ {
if (!m_refData) if (!m_refData)
return FALSE; return false;
if (!dc->Ok() ) if (!dc->Ok() )
return FALSE; return false;
{ {
#if wxMAC_USE_CORE_GRAPHICS #if wxMAC_USE_CORE_GRAPHICS
@@ -180,7 +182,7 @@ bool wxMetaFile::Play(wxDC *dc)
DrawPicture( pict , &(**pict).picFrame ) ; DrawPicture( pict , &(**pict).picFrame ) ;
#endif #endif
} }
return TRUE; return true;
} }
wxSize wxMetaFile::GetSize() const wxSize wxMetaFile::GetSize() const
@@ -210,7 +212,7 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
const wxString& WXUNUSED(description) ) const wxString& WXUNUSED(description) )
{ {
wxASSERT_MSG( width == 0 || height == 0 , _T("no arbitration of metafilesize supported") ) ; wxASSERT_MSG( width == 0 || height == 0 , _T("no arbitration of metafilesize supported") ) ;
wxASSERT_MSG( filename.IsEmpty() , _T("no file based metafile support yet")) ; wxASSERT_MSG( filename.empty() , _T("no file based metafile support yet")) ;
m_metaFile = new wxMetaFile(filename) ; m_metaFile = new wxMetaFile(filename) ;
#if wxMAC_USE_CORE_GRAPHICS #if wxMAC_USE_CORE_GRAPHICS
@@ -222,7 +224,7 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) ) ; m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) ) ;
::GetPort( (GrafPtr*) &m_macPort ) ; ::GetPort( (GrafPtr*) &m_macPort ) ;
m_ok = TRUE ; m_ok = true ;
#endif #endif
SetMapMode(wxMM_TEXT); SetMapMode(wxMM_TEXT);
} }

View File

@@ -136,15 +136,9 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
return *wxSMALL_FONT ; return *wxSMALL_FONT ;
} ; } ;
break ; break ;
case wxSYS_OEM_FIXED_FONT :
case wxSYS_ANSI_FIXED_FONT :
case wxSYS_SYSTEM_FIXED_FONT :
default :
{
return *wxNORMAL_FONT ;
} ;
break ;
default :
break ;
} }
return *wxNORMAL_FONT; return *wxNORMAL_FONT;
} }
@@ -225,9 +219,9 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
return 0; return 0;
default: default:
return -1; // unsupported metric break; // unsupported metric
} }
return 0; return -1;
} }
bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
@@ -236,9 +230,9 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
{ {
case wxSYS_CAN_ICONIZE_FRAME: case wxSYS_CAN_ICONIZE_FRAME:
case wxSYS_CAN_DRAW_FRAME_DECORATIONS: case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
return TRUE; return true;
default: default:
return FALSE; return false;
} }
} }

View File

@@ -211,7 +211,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ;
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ; wxTheApp->MacSetCurrentEvent( event , handler ) ;
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( if ( /* focus && */ wxTheApp->MacSendKeyDownEvent(
focus , message , modifiers , when , point.h , point.v , uniChar ) ) focus , message , modifiers , when , point.h , point.v , uniChar ) )
{ {
result = noErr ; result = noErr ;
@@ -220,7 +220,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
} }
break ; break ;
case kEventRawKeyUp : case kEventRawKeyUp :
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
focus , message , modifiers , when , point.h , point.v , uniChar ) ) focus , message , modifiers , when , point.h , point.v , uniChar ) )
{ {
result = noErr ; result = noErr ;
@@ -242,25 +242,25 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
event.SetTimestamp(when); event.SetTimestamp(when);
event.SetEventObject(focus); event.SetEventObject(focus);
if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & controlKey ) if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & controlKey )
{ {
event.m_keyCode = WXK_CONTROL ; event.m_keyCode = WXK_CONTROL ;
event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ; focus->GetEventHandler()->ProcessEvent( event ) ;
} }
if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & shiftKey ) if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & shiftKey )
{ {
event.m_keyCode = WXK_SHIFT ; event.m_keyCode = WXK_SHIFT ;
event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ; focus->GetEventHandler()->ProcessEvent( event ) ;
} }
if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & optionKey ) if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & optionKey )
{ {
event.m_keyCode = WXK_ALT ; event.m_keyCode = WXK_ALT ;
event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ; focus->GetEventHandler()->ProcessEvent( event ) ;
} }
if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & cmdKey ) if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & cmdKey )
{ {
event.m_keyCode = WXK_COMMAND ; event.m_keyCode = WXK_COMMAND ;
event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
@@ -684,9 +684,11 @@ static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef hand
break ; break ;
} }
case kEventWindowShown : case kEventWindowShown :
{
toplevelWindow->Refresh() ; toplevelWindow->Refresh() ;
result = noErr ; result = noErr ;
break ; break ;
}
case kEventWindowClose : case kEventWindowClose :
toplevelWindow->Close() ; toplevelWindow->Close() ;
result = noErr ; result = noErr ;
@@ -879,17 +881,17 @@ typedef struct
void wxTopLevelWindowMac::Init() void wxTopLevelWindowMac::Init()
{ {
m_iconized = m_iconized =
m_maximizeOnShow = FALSE; m_maximizeOnShow = false;
m_macWindow = NULL ; m_macWindow = NULL ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( UMAGetSystemVersion() >= 0x1030 ) if ( UMAGetSystemVersion() >= 0x1030 )
{ {
m_macUsesCompositing = TRUE; m_macUsesCompositing = true;
} }
else else
#endif #endif
{ {
m_macUsesCompositing = FALSE; m_macUsesCompositing = false;
} }
m_macEventHandler = NULL ; m_macEventHandler = NULL ;
m_macFullScreenData = NULL ; m_macFullScreenData = NULL ;
@@ -940,7 +942,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
if ( parent ) if ( parent )
parent->AddChild(this); parent->AddChild(this);
return TRUE; return true;
} }
wxTopLevelWindowMac::~wxTopLevelWindowMac() wxTopLevelWindowMac::~wxTopLevelWindowMac()
@@ -1059,7 +1061,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
OSStatus err = noErr ; OSStatus err = noErr ;
SetName(name); SetName(name);
m_windowStyle = style; m_windowStyle = style;
m_isShown = FALSE; m_isShown = false;
// create frame. // create frame.
@@ -1116,7 +1118,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
{ {
wclass = kDrawerWindowClass; wclass = kDrawerWindowClass;
// we must force compositing on a drawer // we must force compositing on a drawer
m_macUsesCompositing = TRUE ; m_macUsesCompositing = true ;
} }
#endif //10.2 and up #endif //10.2 and up
else else
@@ -1278,7 +1280,7 @@ void wxTopLevelWindowMac::SetTitle(const wxString& title)
bool wxTopLevelWindowMac::Show(bool show) bool wxTopLevelWindowMac::Show(bool show)
{ {
if ( !wxTopLevelWindowBase::Show(show) ) if ( !wxTopLevelWindowBase::Show(show) )
return FALSE; return false;
if (show) if (show)
{ {
@@ -1314,7 +1316,7 @@ bool wxTopLevelWindowMac::Show(bool show)
MacPropagateVisibilityChanged() ; MacPropagateVisibilityChanged() ;
return TRUE ; return true ;
} }
bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
@@ -1375,7 +1377,7 @@ bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
delete data ; delete data ;
m_macFullScreenData = NULL ; m_macFullScreenData = NULL ;
} }
return FALSE; return false;
} }
bool wxTopLevelWindowMac::IsFullScreen() const bool wxTopLevelWindowMac::IsFullScreen() const
@@ -1545,7 +1547,7 @@ void wxTopLevelWindowMac::RequestUserAttention(int flags )
bool wxTopLevelWindowMac::SetShape(const wxRegion& region) bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{ {
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
_T("Shaped windows must be created with the wxFRAME_SHAPED style.")); _T("Shaped windows must be created with the wxFRAME_SHAPED style."));
// The empty region signifies that the shape should be removed from the // The empty region signifies that the shape should be removed from the
@@ -1571,7 +1573,7 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
// Tell the window manager that the window has changed shape // Tell the window manager that the window has changed shape
ReshapeCustomWindow((WindowRef)MacGetWindowRef()); ReshapeCustomWindow((WindowRef)MacGetWindowRef());
return TRUE; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1635,8 +1637,8 @@ static void wxShapedMacWindowStructureRegion(WindowRef window, RgnHandle rgn)
if (cachedRegion) if (cachedRegion)
{ {
Rect windowRect; Rect windowRect;
wxShapedMacWindowGetPos(window, &windowRect); //how big is the window wxShapedMacWindowGetPos(window, &windowRect); // how big is the window
CopyRgn(cachedRegion, rgn); //make a copy of our cached region CopyRgn(cachedRegion, rgn); // make a copy of our cached region
OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window
//MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size
} }

View File

@@ -471,6 +471,7 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef
break ; break ;
case kEventClassService : case kEventClassService :
result = wxMacWindowServiceEventHandler( handler, event , data ) ; result = wxMacWindowServiceEventHandler( handler, event , data ) ;
break ;
default : default :
break ; break ;
} }
@@ -725,17 +726,17 @@ void wxWindowMac::Init()
m_peer = NULL ; m_peer = NULL ;
m_frozenness = 0 ; m_frozenness = 0 ;
#if WXWIN_COMPATIBILITY_2_4 #if WXWIN_COMPATIBILITY_2_4
m_backgroundTransparent = FALSE; m_backgroundTransparent = false;
#endif #endif
// as all windows are created with WS_VISIBLE style... // as all windows are created with WS_VISIBLE style...
m_isShown = TRUE; m_isShown = true;
m_hScrollBar = NULL ; m_hScrollBar = NULL ;
m_vScrollBar = NULL ; m_vScrollBar = NULL ;
m_macBackgroundBrush = wxNullBrush ; m_macBackgroundBrush = wxNullBrush ;
m_macIsUserPane = TRUE; m_macIsUserPane = true;
#if wxMAC_USE_CORE_GRAPHICS #if wxMAC_USE_CORE_GRAPHICS
m_cgContextRef = NULL ; m_cgContextRef = NULL ;
#endif #endif
@@ -750,7 +751,7 @@ wxWindowMac::~wxWindowMac()
{ {
SendDestroyEvent(); SendDestroyEvent();
m_isBeingDeleted = TRUE; m_isBeingDeleted = true;
MacInvalidateBorders() ; MacInvalidateBorders() ;
@@ -849,10 +850,10 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
long style, long style,
const wxString& name) const wxString& name)
{ {
wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindowMac without parent") ); wxCHECK_MSG( parent, false, wxT("can't create wxWindowMac without parent") );
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE; return false;
m_windowVariant = parent->GetWindowVariant() ; m_windowVariant = parent->GetWindowVariant() ;
@@ -890,7 +891,7 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
wxWindowCreateEvent event(this); wxWindowCreateEvent event(this);
GetEventHandler()->AddPendingEvent(event); GetEventHandler()->AddPendingEvent(event);
return TRUE; return true;
} }
void wxWindowMac::MacChildAdded() void wxWindowMac::MacChildAdded()
@@ -1443,17 +1444,17 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
bool wxWindowMac::SetCursor(const wxCursor& cursor) bool wxWindowMac::SetCursor(const wxCursor& cursor)
{ {
if (m_cursor == cursor) if (m_cursor == cursor)
return FALSE; return false;
if (wxNullCursor == cursor) if (wxNullCursor == cursor)
{ {
if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) ) if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
return FALSE ; return false ;
} }
else else
{ {
if ( ! wxWindowBase::SetCursor( cursor ) ) if ( ! wxWindowBase::SetCursor( cursor ) )
return FALSE ; return false ;
} }
wxASSERT_MSG( m_cursor.Ok(), wxASSERT_MSG( m_cursor.Ok(),
@@ -1487,7 +1488,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
m_cursor.MacInstall() ; m_cursor.MacInstall() ;
} }
return TRUE ; return true ;
} }
#if wxUSE_MENUS #if wxUSE_MENUS
@@ -1525,7 +1526,7 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
menu->SetInvokingWindow(NULL); menu->SetInvokingWindow(NULL);
return TRUE; return true;
} }
#endif #endif
@@ -1926,7 +1927,7 @@ bool wxWindowMac::Show(bool show)
{ {
bool former = MacIsReallyShown() ; bool former = MacIsReallyShown() ;
if ( !wxWindowBase::Show(show) ) if ( !wxWindowBase::Show(show) )
return FALSE; return false;
// TODO use visibilityChanged Carbon Event for OSX // TODO use visibilityChanged Carbon Event for OSX
if ( m_peer ) if ( m_peer )
@@ -1935,7 +1936,7 @@ bool wxWindowMac::Show(bool show)
} }
if ( former != MacIsReallyShown() ) if ( former != MacIsReallyShown() )
MacPropagateVisibilityChanged() ; MacPropagateVisibilityChanged() ;
return TRUE; return true;
} }
bool wxWindowMac::Enable(bool enable) bool wxWindowMac::Enable(bool enable)
@@ -1943,13 +1944,13 @@ bool wxWindowMac::Enable(bool enable)
wxASSERT( m_peer->Ok() ) ; wxASSERT( m_peer->Ok() ) ;
bool former = MacIsReallyEnabled() ; bool former = MacIsReallyEnabled() ;
if ( !wxWindowBase::Enable(enable) ) if ( !wxWindowBase::Enable(enable) )
return FALSE; return false;
m_peer->Enable( enable ) ; m_peer->Enable( enable ) ;
if ( former != MacIsReallyEnabled() ) if ( former != MacIsReallyEnabled() )
MacPropagateEnabledStateChanged() ; MacPropagateEnabledStateChanged() ;
return TRUE; return true;
} }
// //

View File

@@ -152,9 +152,10 @@ bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data )
HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames;
if (!hDevMode) if (!hDevMode)
{
return false; return false;
}
if ( hDevMode ) else
{ {
LPDEVMODE devMode = (LPDEVMODE)GlobalLock(hDevMode); LPDEVMODE devMode = (LPDEVMODE)GlobalLock(hDevMode);