Various warning fixes and minor source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-02-25 20:38:17 +00:00
parent a2dc319b12
commit 18c45cd6dc
7 changed files with 133 additions and 137 deletions

View File

@@ -64,7 +64,6 @@ public:
wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
wxMultiCellItemHandle( int row, int column, int align);
int GetColumn(); int GetColumn();
int GetRow(); int GetRow();
int GetWidth(); int GetWidth();

View File

@@ -1435,14 +1435,14 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
return; return;
wxChar *s = property->GetValue().StringValue(); wxChar *s = property->GetValue().StringValue();
int r = 0; unsigned char r = 0;
int g = 0; unsigned char g = 0;
int b = 0; unsigned char b = 0;
if (s) if (s)
{ {
r = wxHexToDec(s); r = (unsigned char)wxHexToDec(s);
g = wxHexToDec(s+2); g = (unsigned char)wxHexToDec(s+2);
b = wxHexToDec(s+4); b = (unsigned char)wxHexToDec(s+4);
} }
wxColour col(r,g,b); wxColour col(r,g,b);
@@ -1453,7 +1453,9 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
wxColour colour(i*16, i*16, i*16); wxColour colour((unsigned char)(i*16),
(unsigned char)(i*16),
(unsigned char)(i*16));
data.SetCustomColour(i, colour); data.SetCustomColour(i, colour);
} }

View File

@@ -151,13 +151,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
wxItemResource::wxItemResource() wxItemResource::wxItemResource()
{ {
m_itemType = wxT(""); m_itemType = wxEmptyString;
m_title = wxT(""); m_title = wxEmptyString;
m_name = wxT(""); m_name = wxEmptyString;
m_windowStyle = 0; m_windowStyle = 0;
m_x = m_y = m_width = m_height = 0; m_x = m_y = m_width = m_height = 0;
m_value1 = m_value2 = m_value3 = m_value5 = 0; m_value1 = m_value2 = m_value3 = m_value5 = 0;
m_value4 = wxT(""); m_value4 = wxEmptyString;
m_windowId = 0; m_windowId = 0;
m_exStyle = 0; m_exStyle = 0;
} }
@@ -196,9 +196,9 @@ wxItemResource *wxResourceTable::FindResource(const wxString& name) const
void wxResourceTable::AddResource(wxItemResource *item) void wxResourceTable::AddResource(wxItemResource *item)
{ {
wxString name = item->GetName(); wxString name = item->GetName();
if (name == wxT("")) if (name.empty())
name = item->GetTitle(); name = item->GetTitle();
if (name == wxT("")) if (name.empty())
name = wxT("no name"); name = wxT("no name");
// Delete existing resource, if any. // Delete existing resource, if any.
@@ -324,7 +324,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
{ {
int id = childResource->GetId(); int id = childResource->GetId();
if ( id == 0 ) if ( id == 0 )
id = -1; id = wxID_ANY;
bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0); bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0);
@@ -346,7 +346,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton"))) if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton")))
{ {
if (childResource->GetValue4() != wxT("")) if (!childResource->GetValue4().empty())
{ {
// Bitmap button // Bitmap button
wxBitmap bitmap = childResource->GetBitmap(); wxBitmap bitmap = childResource->GetBitmap();
@@ -375,7 +375,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) || else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) ||
itemType == wxString(wxT("wxStaticBitmap"))) itemType == wxString(wxT("wxStaticBitmap")))
{ {
if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) ) if (!childResource->GetValue4().empty() || itemType == wxString(wxT("wxStaticBitmap")) )
{ {
// Bitmap message // Bitmap message
wxBitmap bitmap = childResource->GetBitmap(); wxBitmap bitmap = childResource->GetBitmap();
@@ -611,7 +611,7 @@ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db)
if (item) if (item)
{ {
// Remove any existing resource of same name // Remove any existing resource of same name
if (item->GetName() != wxT("")) if (!item->GetName().empty())
table.DeleteResource(item->GetName()); table.DeleteResource(item->GetName());
table.AddResource(item); table.AddResource(item);
} }
@@ -661,12 +661,12 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
dialogItem->SetType(wxT("wxPanel")); dialogItem->SetType(wxT("wxPanel"));
else else
dialogItem->SetType(wxT("wxDialog")); dialogItem->SetType(wxT("wxDialog"));
wxString style = wxT(""); wxString style = wxEmptyString;
wxString title = wxT(""); wxString title = wxEmptyString;
wxString name = wxT(""); wxString name = wxEmptyString;
wxString backColourHex = wxT(""); wxString backColourHex = wxEmptyString;
wxString labelColourHex = wxT(""); wxString labelColourHex = wxEmptyString;
wxString buttonColourHex = wxT(""); wxString buttonColourHex = wxEmptyString;
long windowStyle = wxDEFAULT_DIALOG_STYLE; long windowStyle = wxDEFAULT_DIALOG_STYLE;
if (isPanel) if (isPanel)
@@ -706,7 +706,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
expr->GetAttributeValue(wxT("id"), id); expr->GetAttributeValue(wxT("id"), id);
dialogItem->SetId(id); dialogItem->SetId(id);
if (style != wxT("")) if (!style.empty())
{ {
windowStyle = wxParseWindowStyle(style); windowStyle = wxParseWindowStyle(style);
} }
@@ -731,7 +731,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
else if (style.Find(wxT("HORIZONTAL_LABEL")) != wxNOT_FOUND) else if (style.Find(wxT("HORIZONTAL_LABEL")) != wxNOT_FOUND)
dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL); dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL);
if (backColourHex != wxT("")) if (!backColourHex.empty())
{ {
int r = 0; int r = 0;
int g = 0; int g = 0;
@@ -741,7 +741,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
b = wxHexToDec(backColourHex.Mid(4, 2)); b = wxHexToDec(backColourHex.Mid(4, 2));
dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
} }
if (labelColourHex != wxT("")) if (!labelColourHex.empty())
{ {
int r = 0; int r = 0;
int g = 0; int g = 0;
@@ -751,7 +751,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
b = wxHexToDec(labelColourHex.Mid(4, 2)); b = wxHexToDec(labelColourHex.Mid(4, 2));
dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
} }
if (buttonColourHex != wxT("")) if (!buttonColourHex.empty())
{ {
int r = 0; int r = 0;
int g = 0; int g = 0;
@@ -776,7 +776,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
if (controlExpr->Number() == 3) if (controlExpr->Number() == 3)
{ {
wxString controlKeyword(controlExpr->Nth(1)->StringValue()); wxString controlKeyword(controlExpr->Nth(1)->StringValue());
if (controlKeyword != wxT("") && controlKeyword == wxT("control")) if (!controlKeyword.empty() && controlKeyword == wxT("control"))
{ {
// The value part: always a list. // The value part: always a list.
wxExpr *listExpr = controlExpr->Nth(2); wxExpr *listExpr = controlExpr->Nth(2);
@@ -906,7 +906,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
wxString str(expr->Nth(count)->StringValue()); wxString str(expr->Nth(count)->StringValue());
count ++; count ++;
if (str != wxT("")) if (!str.empty())
{ {
controlItem->SetValue4(str); controlItem->SetValue4(str);
controlItem->SetType(wxT("wxBitmapButton")); controlItem->SetType(wxT("wxBitmapButton"));
@@ -1416,18 +1416,18 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx
wxExpr *coloursExpr = listExpr->Nth(3); wxExpr *coloursExpr = listExpr->Nth(3);
wxExpr *xresExpr = listExpr->Nth(4); wxExpr *xresExpr = listExpr->Nth(4);
wxExpr *yresExpr = listExpr->Nth(5); wxExpr *yresExpr = listExpr->Nth(5);
if (nameExpr && nameExpr->StringValue() != wxT("")) if (nameExpr && !nameExpr->StringValue().empty())
{ {
bitmapSpec->SetName(nameExpr->StringValue()); bitmapSpec->SetName(nameExpr->StringValue());
} }
if (typeExpr && typeExpr->StringValue() != wxT("")) if (typeExpr && !typeExpr->StringValue().empty())
{ {
bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue()));
} }
else else
bitmapSpec->SetValue1(0); bitmapSpec->SetValue1(0);
if (platformExpr && platformExpr->StringValue() != wxT("")) if (platformExpr && !platformExpr->StringValue().empty())
{ {
wxString plat(platformExpr->StringValue()); wxString plat(platformExpr->StringValue());
if (plat == wxT("windows") || plat == wxT("WINDOWS")) if (plat == wxT("windows") || plat == wxT("WINDOWS"))
@@ -1486,7 +1486,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr)
int style = wxNORMAL; int style = wxNORMAL;
int weight = wxNORMAL; int weight = wxNORMAL;
int underline = 0; int underline = 0;
wxString faceName(wxT("")); wxString faceName;
wxExpr *pointExpr = expr->Nth(0); wxExpr *pointExpr = expr->Nth(0);
wxExpr *familyExpr = expr->Nth(1); wxExpr *familyExpr = expr->Nth(1);
@@ -1604,7 +1604,7 @@ static bool wxEatWhiteSpace(FILE *fd)
} }
static bool wxEatWhiteSpace(wxInputStream *is) static bool wxEatWhiteSpace(wxInputStream *is)
{ {
int ch = is->GetC() ; char ch = is->GetC() ;
if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9))
{ {
is->Ungetch(ch); is->Ungetch(ch);
@@ -2385,7 +2385,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap"))) if ((item->GetType().empty()) || (item->GetType() != wxT("wxBitmap")))
{ {
wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource); wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource);
return wxNullBitmap; return wxNullBitmap;
@@ -2539,7 +2539,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0) if ((item->GetType().empty()) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0)
{ {
wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource); wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource);
return wxNullIcon; return wxNullIcon;
@@ -2695,7 +2695,7 @@ wxMenu *wxResourceCreateMenu(wxItemResource *item)
while (node) while (node)
{ {
wxItemResource *child = (wxItemResource *)node->GetData(); wxItemResource *child = (wxItemResource *)node->GetData();
if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator"))) if ((!child->GetType().empty()) && (child->GetType() == wxT("wxMenuSeparator")))
menu->AppendSeparator(); menu->AppendSeparator();
else if (child->GetChildren().GetCount() > 0) else if (child->GetChildren().GetCount() > 0)
{ {
@@ -2718,7 +2718,7 @@ wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *ta
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource); wxItemResource *menuResource = table->FindResource(resource);
if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) if (menuResource && (!menuResource->GetType().empty()) && (menuResource->GetType() == wxT("wxMenu")))
{ {
if (!menuBar) if (!menuBar)
menuBar = new wxMenuBar; menuBar = new wxMenuBar;
@@ -2742,7 +2742,7 @@ wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource); wxItemResource *menuResource = table->FindResource(resource);
if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) if (menuResource && (!menuResource->GetType().empty()) && (menuResource->GetType() == wxT("wxMenu")))
// if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) // if (menuResource && (menuResource->GetType() == wxTYPE_MENU))
return wxResourceCreateMenu(menuResource); return wxResourceCreateMenu(menuResource);
return (wxMenu *) NULL; return (wxMenu *) NULL;
@@ -3184,7 +3184,7 @@ bool wxLoadFromResource(wxWindow* thisWindow, wxWindow *parent, const wxString&
wxItemResource *resource = table->FindResource((const wxChar *)resourceName); wxItemResource *resource = table->FindResource((const wxChar *)resourceName);
// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX))
if (!resource || (resource->GetType() == wxT("")) || if (!resource || (resource->GetType().empty()) ||
! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel")))) ! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel"))))
return false; return false;

View File

@@ -804,12 +804,10 @@ void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event )
// simulate the first mouse movement // simulate the first mouse movement
int x = event.mPos.x, y = event.mPos.y; int x = event.mPos.x, y = event.mPos.y;
mpSrcPane->FrameToPane( &x, &y ); mpSrcPane->FrameToPane( &x, &y );
cbMotionEvent motionEvt( wxPoint(x,y), event.mpPane ); wxPoint pt(x,y);
cbMotionEvent motionEvt( pt, event.mpPane );
this->OnMouseMove( motionEvt ); this->OnMouseMove( motionEvt );
return; // event is "eaten" by this plugin return; // event is "eaten" by this plugin

View File

@@ -379,11 +379,16 @@ wxBitmap* wxNewBitmapButton::GetStateLabel()
return mpDisabledImg; return mpDisabledImg;
} }
#ifndef __WXMSW__
static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA, static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA, 0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA, 0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA 0x55,0xAA,0x55,0xAA
}; };
#endif
void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp, void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
bool isEnabled, bool isPressed ) bool isEnabled, bool isPressed )
{ {
@@ -454,11 +459,9 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
destDc.SelectObject( *destBmp ); destDc.SelectObject( *destBmp );
wxBrush grayBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE), wxSOLID ); wxBrush grayBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE), wxSOLID );
wxPen nullPen( wxColour(0,0,0), 1, wxTRANSPARENT );
destDc.SetBrush( grayBrush ); destDc.SetBrush( grayBrush );
destDc.SetPen( nullPen ); destDc.SetPen( *wxTRANSPARENT_PEN );
destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 ); destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
if ( isPressed ) if ( isPressed )
@@ -751,7 +754,7 @@ void wxNewBitmapButton::Reshape( )
// in the case of loading button from stream, check if we // in the case of loading button from stream, check if we
// have non-empty image-file name, load if possible // have non-empty image-file name, load if possible
if ( mImageFileName != wxT("") ) if (!mImageFileName.empty())
{ {
mDepressedBmp.LoadFile( mImageFileName, mImageFileType ); mDepressedBmp.LoadFile( mImageFileName, mImageFileType );

View File

@@ -260,7 +260,7 @@ void cbRowLayoutPlugin::FitBarsToRange( int from, int till,
{ {
pBar->mBounds.width = pBar->mBounds.width =
wxMax( mpPane->mProps.mMinCBarDim.x, wxMax( mpPane->mProps.mMinCBarDim.x,
(int)( double(freeSpc) * (pBar->mLenRatio/pcntSum) ) (int)( ((double)freeSpc) * (pBar->mLenRatio/pcntSum) )
); );
} }
pBar = pBar->mpNext; pBar = pBar->mpNext;
@@ -1051,7 +1051,7 @@ void cbRowLayoutPlugin::OnLayoutRows( cbLayoutRowsEvent& event )
cbRowInfo& row = *mpPane->GetRowList()[ i ]; cbRowInfo& row = *mpPane->GetRowList()[ i ];
//mpPane->CalcLengthRatios(& row); //mpPane->CalcLengthRatios(& row);
// setup "has-handle" flags for rows, which depend on the existance // setup "has-handle" flags for rows, which depend on the existence
// of not-fixed bars in the row // of not-fixed bars in the row
if ( !row.mHasOnlyFixedBars ) if ( !row.mHasOnlyFixedBars )

View File

@@ -86,12 +86,6 @@ wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, wxResizable
{ {
Initialize(row, column, 1, 1, wxSize(1, 1), style, weight, align); Initialize(row, column, 1, 1, wxSize(1, 1), style, weight, align);
} }
//---------------------------------------------------------------------------
wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, int align)
{
Initialize(row, column, 1, 1, wxSize(1,1), wxNOT_RESIZABLE, wxSize(1, 1), align);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int wxMultiCellItemHandle::GetColumn() int wxMultiCellItemHandle::GetColumn()
{ {
@@ -653,7 +647,7 @@ void wxMultiCellCanvas :: CalculateConstraints()
if (!m_cells[CELL_LOC(row, col)]) if (!m_cells[CELL_LOC(row, col)])
{ {
// Create an empty static text field as a placeholder // Create an empty static text field as a placeholder
m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, wxID_ANY, wxT(""))); m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, wxID_ANY, wxEmptyString));
} }
wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window); wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window);
} }