Warning fixes to unused variables, int/wxChar keycode and other typecasting, not mixing 'type*' and 'type' variables in single line, IsEmpty to empty replacement etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-11-05 21:18:04 +00:00
parent f7ad3cd30b
commit 32b1391332
15 changed files with 225 additions and 222 deletions

View File

@@ -411,7 +411,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
static wxString s_text;
s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"),
s_text, this);
if ( !s_text.IsEmpty() )
if ( !s_text.empty() )
{
m_treeCtrl->SetItemText(item, s_text);
}
@@ -906,121 +906,120 @@ TREE_EVENT_HANDLER(OnSelChanging)
void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
{
wxString key;
long keycode = event.GetKeyCode();
{
switch ( keycode )
{
case WXK_BACK: key = wxT("BACK"); break;
case WXK_TAB: key = wxT("TAB"); break;
case WXK_RETURN: key = wxT("RETURN"); break;
case WXK_ESCAPE: key = wxT("ESCAPE"); break;
case WXK_SPACE: key = wxT("SPACE"); break;
case WXK_DELETE: key = wxT("DELETE"); break;
case WXK_START: key = wxT("START"); break;
case WXK_LBUTTON: key = wxT("LBUTTON"); break;
case WXK_RBUTTON: key = wxT("RBUTTON"); break;
case WXK_CANCEL: key = wxT("CANCEL"); break;
case WXK_MBUTTON: key = wxT("MBUTTON"); break;
case WXK_CLEAR: key = wxT("CLEAR"); break;
case WXK_SHIFT: key = wxT("SHIFT"); break;
case WXK_ALT: key = wxT("ALT"); break;
case WXK_CONTROL: key = wxT("CONTROL"); break;
case WXK_MENU: key = wxT("MENU"); break;
case WXK_PAUSE: key = wxT("PAUSE"); break;
case WXK_CAPITAL: key = wxT("CAPITAL"); break;
case WXK_PRIOR: key = wxT("PRIOR"); break;
case WXK_NEXT: key = wxT("NEXT"); break;
case WXK_END: key = wxT("END"); break;
case WXK_HOME: key = wxT("HOME"); break;
case WXK_LEFT: key = wxT("LEFT"); break;
case WXK_UP: key = wxT("UP"); break;
case WXK_RIGHT: key = wxT("RIGHT"); break;
case WXK_DOWN: key = wxT("DOWN"); break;
case WXK_SELECT: key = wxT("SELECT"); break;
case WXK_PRINT: key = wxT("PRINT"); break;
case WXK_EXECUTE: key = wxT("EXECUTE"); break;
case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break;
case WXK_INSERT: key = wxT("INSERT"); break;
case WXK_HELP: key = wxT("HELP"); break;
case WXK_NUMPAD0: key = wxT("NUMPAD0"); break;
case WXK_NUMPAD1: key = wxT("NUMPAD1"); break;
case WXK_NUMPAD2: key = wxT("NUMPAD2"); break;
case WXK_NUMPAD3: key = wxT("NUMPAD3"); break;
case WXK_NUMPAD4: key = wxT("NUMPAD4"); break;
case WXK_NUMPAD5: key = wxT("NUMPAD5"); break;
case WXK_NUMPAD6: key = wxT("NUMPAD6"); break;
case WXK_NUMPAD7: key = wxT("NUMPAD7"); break;
case WXK_NUMPAD8: key = wxT("NUMPAD8"); break;
case WXK_NUMPAD9: key = wxT("NUMPAD9"); break;
case WXK_MULTIPLY: key = wxT("MULTIPLY"); break;
case WXK_ADD: key = wxT("ADD"); break;
case WXK_SEPARATOR: key = wxT("SEPARATOR"); break;
case WXK_SUBTRACT: key = wxT("SUBTRACT"); break;
case WXK_DECIMAL: key = wxT("DECIMAL"); break;
case WXK_DIVIDE: key = wxT("DIVIDE"); break;
case WXK_F1: key = wxT("F1"); break;
case WXK_F2: key = wxT("F2"); break;
case WXK_F3: key = wxT("F3"); break;
case WXK_F4: key = wxT("F4"); break;
case WXK_F5: key = wxT("F5"); break;
case WXK_F6: key = wxT("F6"); break;
case WXK_F7: key = wxT("F7"); break;
case WXK_F8: key = wxT("F8"); break;
case WXK_F9: key = wxT("F9"); break;
case WXK_F10: key = wxT("F10"); break;
case WXK_F11: key = wxT("F11"); break;
case WXK_F12: key = wxT("F12"); break;
case WXK_F13: key = wxT("F13"); break;
case WXK_F14: key = wxT("F14"); break;
case WXK_F15: key = wxT("F15"); break;
case WXK_F16: key = wxT("F16"); break;
case WXK_F17: key = wxT("F17"); break;
case WXK_F18: key = wxT("F18"); break;
case WXK_F19: key = wxT("F19"); break;
case WXK_F20: key = wxT("F20"); break;
case WXK_F21: key = wxT("F21"); break;
case WXK_F22: key = wxT("F22"); break;
case WXK_F23: key = wxT("F23"); break;
case WXK_F24: key = wxT("F24"); break;
case WXK_NUMLOCK: key = wxT("NUMLOCK"); break;
case WXK_SCROLL: key = wxT("SCROLL"); break;
case WXK_PAGEUP: key = wxT("PAGEUP"); break;
case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break;
case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break;
case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break;
case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break;
case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break;
case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break;
case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break;
case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break;
case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break;
case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break;
case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break;
case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break;
case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break;
case WXK_NUMPAD_PRIOR: key = wxT("NUMPAD_PRIOR"); break;
case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break;
case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break;
case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break;
case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break;
case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break;
case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break;
case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break;
case WXK_NUMPAD_MULTIPLY: key = wxT("NUMPAD_MULTIPLY"); break;
case WXK_NUMPAD_ADD: key = wxT("NUMPAD_ADD"); break;
case WXK_NUMPAD_SEPARATOR: key = wxT("NUMPAD_SEPARATOR"); break;
case WXK_NUMPAD_SUBTRACT: key = wxT("NUMPAD_SUBTRACT"); break;
case WXK_NUMPAD_DECIMAL: key = wxT("NUMPAD_DECIMAL"); break;
int keycode = event.GetKeyCode();
default:
{
if ( wxIsprint((int)keycode) )
key.Printf(wxT("'%c'"), (char)keycode);
else if ( keycode > 0 && keycode < 27 )
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
else
key.Printf(wxT("unknown (%ld)"), keycode);
}
switch ( keycode )
{
case WXK_BACK: key = wxT("BACK"); break;
case WXK_TAB: key = wxT("TAB"); break;
case WXK_RETURN: key = wxT("RETURN"); break;
case WXK_ESCAPE: key = wxT("ESCAPE"); break;
case WXK_SPACE: key = wxT("SPACE"); break;
case WXK_DELETE: key = wxT("DELETE"); break;
case WXK_START: key = wxT("START"); break;
case WXK_LBUTTON: key = wxT("LBUTTON"); break;
case WXK_RBUTTON: key = wxT("RBUTTON"); break;
case WXK_CANCEL: key = wxT("CANCEL"); break;
case WXK_MBUTTON: key = wxT("MBUTTON"); break;
case WXK_CLEAR: key = wxT("CLEAR"); break;
case WXK_SHIFT: key = wxT("SHIFT"); break;
case WXK_ALT: key = wxT("ALT"); break;
case WXK_CONTROL: key = wxT("CONTROL"); break;
case WXK_MENU: key = wxT("MENU"); break;
case WXK_PAUSE: key = wxT("PAUSE"); break;
case WXK_CAPITAL: key = wxT("CAPITAL"); break;
case WXK_PRIOR: key = wxT("PRIOR"); break;
case WXK_NEXT: key = wxT("NEXT"); break;
case WXK_END: key = wxT("END"); break;
case WXK_HOME: key = wxT("HOME"); break;
case WXK_LEFT: key = wxT("LEFT"); break;
case WXK_UP: key = wxT("UP"); break;
case WXK_RIGHT: key = wxT("RIGHT"); break;
case WXK_DOWN: key = wxT("DOWN"); break;
case WXK_SELECT: key = wxT("SELECT"); break;
case WXK_PRINT: key = wxT("PRINT"); break;
case WXK_EXECUTE: key = wxT("EXECUTE"); break;
case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break;
case WXK_INSERT: key = wxT("INSERT"); break;
case WXK_HELP: key = wxT("HELP"); break;
case WXK_NUMPAD0: key = wxT("NUMPAD0"); break;
case WXK_NUMPAD1: key = wxT("NUMPAD1"); break;
case WXK_NUMPAD2: key = wxT("NUMPAD2"); break;
case WXK_NUMPAD3: key = wxT("NUMPAD3"); break;
case WXK_NUMPAD4: key = wxT("NUMPAD4"); break;
case WXK_NUMPAD5: key = wxT("NUMPAD5"); break;
case WXK_NUMPAD6: key = wxT("NUMPAD6"); break;
case WXK_NUMPAD7: key = wxT("NUMPAD7"); break;
case WXK_NUMPAD8: key = wxT("NUMPAD8"); break;
case WXK_NUMPAD9: key = wxT("NUMPAD9"); break;
case WXK_MULTIPLY: key = wxT("MULTIPLY"); break;
case WXK_ADD: key = wxT("ADD"); break;
case WXK_SEPARATOR: key = wxT("SEPARATOR"); break;
case WXK_SUBTRACT: key = wxT("SUBTRACT"); break;
case WXK_DECIMAL: key = wxT("DECIMAL"); break;
case WXK_DIVIDE: key = wxT("DIVIDE"); break;
case WXK_F1: key = wxT("F1"); break;
case WXK_F2: key = wxT("F2"); break;
case WXK_F3: key = wxT("F3"); break;
case WXK_F4: key = wxT("F4"); break;
case WXK_F5: key = wxT("F5"); break;
case WXK_F6: key = wxT("F6"); break;
case WXK_F7: key = wxT("F7"); break;
case WXK_F8: key = wxT("F8"); break;
case WXK_F9: key = wxT("F9"); break;
case WXK_F10: key = wxT("F10"); break;
case WXK_F11: key = wxT("F11"); break;
case WXK_F12: key = wxT("F12"); break;
case WXK_F13: key = wxT("F13"); break;
case WXK_F14: key = wxT("F14"); break;
case WXK_F15: key = wxT("F15"); break;
case WXK_F16: key = wxT("F16"); break;
case WXK_F17: key = wxT("F17"); break;
case WXK_F18: key = wxT("F18"); break;
case WXK_F19: key = wxT("F19"); break;
case WXK_F20: key = wxT("F20"); break;
case WXK_F21: key = wxT("F21"); break;
case WXK_F22: key = wxT("F22"); break;
case WXK_F23: key = wxT("F23"); break;
case WXK_F24: key = wxT("F24"); break;
case WXK_NUMLOCK: key = wxT("NUMLOCK"); break;
case WXK_SCROLL: key = wxT("SCROLL"); break;
case WXK_PAGEUP: key = wxT("PAGEUP"); break;
case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break;
case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break;
case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break;
case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break;
case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break;
case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break;
case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break;
case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break;
case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break;
case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break;
case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break;
case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break;
case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break;
case WXK_NUMPAD_PRIOR: key = wxT("NUMPAD_PRIOR"); break;
case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break;
case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break;
case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break;
case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break;
case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break;
case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break;
case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break;
case WXK_NUMPAD_MULTIPLY: key = wxT("NUMPAD_MULTIPLY"); break;
case WXK_NUMPAD_ADD: key = wxT("NUMPAD_ADD"); break;
case WXK_NUMPAD_SEPARATOR: key = wxT("NUMPAD_SEPARATOR"); break;
case WXK_NUMPAD_SUBTRACT: key = wxT("NUMPAD_SUBTRACT"); break;
case WXK_NUMPAD_DECIMAL: key = wxT("NUMPAD_DECIMAL"); break;
default:
{
if ( wxIsprint((wxChar)keycode) )
key.Printf(wxT("'%c'"), (char)keycode);
else if ( keycode > 0 && keycode < 27 )
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
else
key.Printf(wxT("unknown (%d)"), keycode);
}
}

View File

@@ -141,7 +141,7 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
}
}
if ( current.IsEmpty() ) {
if ( current.empty() ) {
wxLogDebug(wxT("No accel key found, accel string ignored."));
}
else {
@@ -262,7 +262,7 @@ void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
// we should process them here
default:
if ( wxIsalnum(code) )
if ( wxIsalnum((wxChar)code) )
{
text << (wxChar)code;

View File

@@ -243,9 +243,9 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludeList(wxString((wxChar) keyCode, 1))) ||
((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(wxString((wxChar) keyCode, 1))) ||
((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) ||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode)
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha((wxChar)keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum((wxChar)keyCode)) ||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit((wxChar)keyCode)
&& keyCode != '.' && keyCode != ',' && keyCode != '-')
)
)

View File

@@ -97,9 +97,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
{
const wxAcceleratorEntry& entry = entries[i];
int keycode = entry.GetKeyCode();
if ( wxIslower(keycode) )
keycode = wxToupper(keycode);
int keycode = wxToupper(entry.GetKeyCode());
M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry.GetFlags(),
keycode,

View File

@@ -1556,7 +1556,7 @@ wxSize wxPostScriptDC::GetPPI(void) const
bool wxPostScriptDC::StartDoc( const wxString& message )
{
wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") );
if (m_printData.GetPrintMode() != wxPRINT_MODE_STREAM )
{
if (m_printData.GetFilename() == wxEmptyString)
@@ -1718,7 +1718,7 @@ void wxPostScriptDC::EndDoc ()
#endif
#ifndef __WXMSW__
wxPostScriptPrintNativeData *data =
wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
if (m_ok && (m_printData.GetPrintMode() == wxPRINT_MODE_PRINTER))
@@ -1755,7 +1755,7 @@ void wxPostScriptDC::StartPage()
wxCoord translate_x, translate_y;
double scale_x, scale_y;
wxPostScriptPrintNativeData *data =
wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
translate_x = (wxCoord)data->GetPrinterTranslateX();
@@ -1833,7 +1833,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
wxCHECK_RET( fontToUse, wxT("GetTextExtent: no font defined") );
if (string.IsEmpty())
if (string.empty())
{
if (x) (*x) = 0;
if (y) (*y) = 0;
@@ -1967,12 +1967,12 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
FILE *afmFile = NULL;
wxPostScriptPrintNativeData *data =
wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
// Get the directory of the AFM files
wxString afmName;
if (!data->GetFontMetricPath().IsEmpty())
if (!data->GetFontMetricPath().empty())
{
afmName = data->GetFontMetricPath();
afmName << wxFILE_SEP_PATH << name;
@@ -2019,8 +2019,10 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
/* init the widths array */
for(int i=0; i<256; i++) lastWidths[i] = INT_MIN;
/* some variables for holding parts of a line */
char cString[10],semiString[10],WXString[10],descString[20];
char upString[30], utString[30], encString[50];
char cString[10], semiString[10], WXString[10];
char descString[20];
char upString[30], utString[30];
char encString[50];
char line[256];
int ascii,cWidth;
/* read in the file and parse it */
@@ -2187,9 +2189,9 @@ void wxPostScriptDC::PsPrintf( const wxChar* fmt, ... )
void wxPostScriptDC::PsPrint( const char* psdata )
{
wxPostScriptPrintNativeData *data =
wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
switch (m_printData.GetPrintMode())
{
#if wxUSE_STREAMS
@@ -2212,9 +2214,9 @@ void wxPostScriptDC::PsPrint( const char* psdata )
void wxPostScriptDC::PsPrint( int ch )
{
wxPostScriptPrintNativeData *data =
wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
switch (m_printData.GetPrintMode())
{
#if wxUSE_STREAMS
@@ -2223,7 +2225,7 @@ void wxPostScriptDC::PsPrint( int ch )
{
wxOutputStream* outputstream = data->GetOutputStream();
wxCHECK_RET( outputstream, wxT("invalid outputstream") );
outputstream->PutC( ch );
outputstream->PutC( (char)ch );
}
break;
#endif // wxUSE_STREAMS

View File

@@ -502,7 +502,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
m_colBgOld = m_control->GetBackgroundColour();
m_control->SetBackgroundColour(attr->GetBackgroundColour());
// Workaround for GTK+1 font setting problem on some platforms
// Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__)
m_fontOld = m_control->GetFont();
m_control->SetFont(attr->GetFont());
@@ -525,7 +525,8 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
m_control->SetBackgroundColour(m_colBgOld);
m_colBgOld = wxNullColour;
}
// Workaround for GTK+1 font setting problem on some platforms
// Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__)
if ( m_fontOld.Ok() )
{
@@ -728,7 +729,7 @@ bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event)
default:
// accept 8 bit chars too if isprint() agrees
if ( (keycode < 255) && (wxIsprint(keycode)) )
if ( (keycode < 255) && (wxIsprint((wxChar)keycode)) )
return true;
}
}
@@ -835,7 +836,7 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
{
m_valueOld = 0;
wxString sValue = table->GetValue(row, col);
if (! sValue.ToLong(&m_valueOld) && ! sValue.IsEmpty())
if (! sValue.ToLong(&m_valueOld) && ! sValue.empty())
{
wxFAIL_MSG( _T("this cell doesn't have numeric value") );
return;
@@ -870,7 +871,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
else
{
text = Text()->GetValue();
changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
}
if ( changed )
@@ -922,7 +923,7 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event)
return true;
default:
if ( (keycode < 128) && wxIsdigit(keycode) )
if ( (keycode < 128) && wxIsdigit((wxChar)keycode) )
return true;
}
}
@@ -935,7 +936,7 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
if ( !HasRange() )
{
int keycode = event.GetKeyCode();
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
|| keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1
|| keycode == WXK_NUMPAD2
@@ -1039,7 +1040,7 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
{
m_valueOld = 0.0;
wxString sValue = table->GetValue(row, col);
if (! sValue.ToDouble(&m_valueOld) && ! sValue.IsEmpty())
if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty())
{
wxFAIL_MSG( _T("this cell doesn't have float value") );
return;
@@ -1055,7 +1056,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col,
double value = 0.0;
wxString text(Text()->GetValue());
if ( (text.IsEmpty() || text.ToDouble(&value)) && (value != m_valueOld) )
if ( (text.empty() || text.ToDouble(&value)) && (value != m_valueOld) )
{
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
grid->GetTable()->SetValueAsDouble(row, col, value);
@@ -1081,7 +1082,7 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point = ( strbuf ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
|| is_decimal_point
|| keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1
@@ -1188,11 +1189,11 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point =
bool is_decimal_point =
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) &&
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
(wxIsdigit((wxChar)keycode) || tolower(keycode) == 'e' ||
is_decimal_point || keycode == '+' || keycode == '-') )
return true;
}

View File

@@ -251,7 +251,7 @@ void wxLogGui::Flush()
m_bHasMessages = false;
wxString appName = wxTheApp->GetAppName();
if ( !!appName )
if ( !appName.empty() )
appName[0u] = (wxChar)wxToupper(appName[0u]);
long style;
@@ -317,7 +317,7 @@ void wxLogGui::Flush()
// this catches both cases of 1 message with wxUSE_LOG_DIALOG and any
// situation without it
if ( !!str )
if ( !str.empty() )
{
wxMessageBox(str, title, wxOK | style);
@@ -701,7 +701,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
if ( ms_details.IsEmpty() )
if ( ms_details.empty() )
{
// ensure that we won't loop here if wxGetTranslation()
// happens to pop up a Log message while translating this :-)

View File

@@ -4551,7 +4551,7 @@ wxKeyEvent wxWindowMSW::CreateKeyEvent(wxEventType evType,
event.m_eventObject = (wxWindow *)this; // const_cast
event.m_keyCode = id;
#if wxUSE_UNICODE
event.m_uniChar = wParam;
event.m_uniChar = (wxChar) wParam;
#endif
event.m_rawCode = (wxUint32) wParam;
event.m_rawFlags = (wxUint32) lParam;

View File

@@ -177,7 +177,8 @@ wxRect wxRenderer::StandardGetScrollbarRect(const wxScrollBar *scrollbar,
}
wxSize sizeTotal = scrollbar->GetClientSize();
wxCoord *start, *width, length, arrow;
wxCoord *start, *width;
wxCoord length, arrow;
wxRect rect;
if ( scrollbar->IsVertical() )
{
@@ -813,7 +814,8 @@ void wxControlRenderer::DrawProgressBar(const wxGauge *gauge)
int steps = ((lenTotal + step - 1) * pos) / (max * step);
// calc the coords of one small rect
wxCoord *px, dx, dy;
wxCoord *px;
wxCoord dx, dy;
if ( gauge->IsVertical() )
{
// draw from bottom to top: so first set y to the bottom

View File

@@ -135,7 +135,7 @@ bool wxListBox::Create(wxWindow *parent,
style |= wxBORDER_SUNKEN;
#endif
if ( !wxControl::Create(parent, id, pos, size, style,
if ( !wxControl::Create(parent, id, pos, size, style,
validator, name) )
return false;
@@ -1380,7 +1380,7 @@ bool wxStdListboxInputHandler::HandleKey(wxInputConsumer *consumer,
break;
default:
if ( (keycode < 255) && wxIsalnum(keycode) )
if ( (keycode < 255) && wxIsalnum((wxChar)keycode) )
{
action = wxACTION_LISTBOX_FIND;
strArg = (wxChar)keycode;

View File

@@ -958,7 +958,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
default:
// look for the menu item starting with this letter
if ( wxIsalnum(key) )
if ( wxIsalnum((wxChar)key) )
{
// we want to start from the item after this one because
// if we're already on the item with the given accel we want to
@@ -2284,7 +2284,7 @@ void wxMenuBar::OnKeyDown(wxKeyEvent& event)
int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
{
if ( !wxIsalnum(key) )
if ( !wxIsalnum((wxChar)key) )
{
// we only support letters/digits as accels
return -1;

View File

@@ -48,7 +48,7 @@
// due to unsigned type nPage is always >= 0
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((size_t(nPage)) < GetPageCount()))
#else
#define IS_VALID_PAGE(nPage) ((size_t(nPage)) < GetPageCount())
#define IS_VALID_PAGE(nPage) (((size_t)nPage) < GetPageCount())
#endif
// ----------------------------------------------------------------------------
@@ -1285,9 +1285,9 @@ void wxNotebook::DoSetSize(int x, int y,
wxSize old_client_size = GetClientSize();
wxControl::DoSetSize(x, y, width, height, sizeFlags);
wxSize new_client_size = GetClientSize();
if (old_client_size != new_client_size)
Relayout();
}

View File

@@ -313,7 +313,7 @@ int wxSlider::GetThumbLength() const
{
wxSize sz = GetDefaultThumbSize();
int len = (IsVert() ? sz.x : sz.y);
if (m_thumbSize > len)
if (m_thumbSize > len)
{
return m_thumbSize;
}
@@ -389,7 +389,7 @@ wxSize wxSlider::DoGetBestClientSize() const
if ( HasTicks() )
{
wxCoord lenTick = GetRenderer()->GetSliderTickLen();
if (style & wxSL_BOTH)
if (style & wxSL_BOTH)
{
lenTick = 2 * lenTick;
}
@@ -482,25 +482,25 @@ void wxSlider::CalcGeometry()
m_rectLabel = wxRect(rectTotal.GetPosition(), sizeLabels);
if (style & wxSL_TOP)
if (style & wxSL_TOP)
{
// shrink and offset the slider to the bottom
m_rectSlider.y += sizeLabels.y + SLIDER_LABEL_MARGIN;
m_rectSlider.height -= sizeLabels.y + SLIDER_LABEL_MARGIN;
}
else if (style & wxSL_BOTTOM)
else if (style & wxSL_BOTTOM)
{
// shrink the slider and move the label to the bottom
m_rectSlider.height -= sizeLabels.y + SLIDER_LABEL_MARGIN;
m_rectLabel.y += m_rectSlider.height + SLIDER_LABEL_MARGIN;
}
else if (style & wxSL_LEFT)
else if (style & wxSL_LEFT)
{
// shrink and offset the slider to the right
m_rectSlider.x += sizeLabels.x + SLIDER_LABEL_MARGIN;
m_rectSlider.width -= sizeLabels.x + SLIDER_LABEL_MARGIN;
}
else if (style & wxSL_RIGHT)
else if (style & wxSL_RIGHT)
{
// shrink the slider and move the label to the right
m_rectSlider.width -= sizeLabels.x + SLIDER_LABEL_MARGIN;
@@ -518,7 +518,7 @@ void wxSlider::CalcGeometry()
if ( IsVert() )
{
if (style & (wxSL_LEFT|wxSL_BOTH))
if (style & (wxSL_LEFT|wxSL_BOTH))
{
m_rectTicks.x = m_rectSlider.x;
}
@@ -530,7 +530,7 @@ void wxSlider::CalcGeometry()
}
else // horizontal
{
if (style & (wxSL_TOP|wxSL_BOTH))
if (style & (wxSL_TOP|wxSL_BOTH))
{
m_rectTicks.y = m_rectSlider.y;
}
@@ -599,8 +599,9 @@ void wxSlider::CalcThumbRect(const wxRect *rectShaftIn,
}
wxCoord lenShaft,
lenThumb,
*p;
lenThumb;
wxCoord *p;
wxRect rectThumb(rectShaft.GetPosition(), GetThumbSize());
if ( isVertical )
{
@@ -708,19 +709,19 @@ void wxSlider::DoDraw(wxControlRenderer *renderer)
{
// align it to be close to the shaft
int align = 0;
if (style & wxSL_TOP)
if (style & wxSL_TOP)
{
align = wxALIGN_CENTRE_HORIZONTAL|wxALIGN_TOP;
}
else if (style & wxSL_BOTTOM)
else if (style & wxSL_BOTTOM)
{
align = wxALIGN_CENTRE_HORIZONTAL|wxALIGN_BOTTOM;
}
else if (style & wxSL_LEFT)
else if (style & wxSL_LEFT)
{
align = wxALIGN_CENTRE_VERTICAL|wxALIGN_LEFT;
}
else if (style & wxSL_RIGHT)
else if (style & wxSL_RIGHT)
{
align = wxALIGN_CENTRE_VERTICAL|wxALIGN_RIGHT;
}
@@ -799,14 +800,14 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const
CalcThumbRect(&rectShaft, &rectThumb, NULL);
// check for possible shaft or thumb hit
if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt))
if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt))
{
return wxScrollThumb::Shaft_None;
}
// the position to test and the start and end of the thumb
wxCoord x, x1, x2, x3, x4;
if (IsVert())
if (IsVert())
{
x = pt.y;
x1 = rectThumb.GetBottom();
@@ -822,7 +823,7 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const
x3 = rectThumb.GetRight();
x4 = rectShaft.GetRight();
}
if ((x1 <= x) & (x < x2))
if ((x1 <= x) & (x < x2))
{
// or to the left
return wxScrollThumb::Shaft_Above;
@@ -896,7 +897,7 @@ void wxSlider::SetShaftPartState(wxScrollThumb::Shaft shaftPart,
void wxSlider::OnThumbDragStart(int pos)
{
if (IsVert())
if (IsVert())
{
PerformAction(wxACTION_SLIDER_THUMB_DRAG, m_max - pos);
}
@@ -908,7 +909,7 @@ void wxSlider::OnThumbDragStart(int pos)
void wxSlider::OnThumbDrag(int pos)
{
if (IsVert())
if (IsVert())
{
PerformAction(wxACTION_SLIDER_THUMB_MOVE, m_max - pos);
}
@@ -920,7 +921,7 @@ void wxSlider::OnThumbDrag(int pos)
void wxSlider::OnThumbDragEnd(int pos)
{
if (IsVert())
if (IsVert())
{
PerformAction(wxACTION_SLIDER_THUMB_RELEASE, m_max - pos);
}

View File

@@ -163,7 +163,7 @@ private:
private:
wxTheme *m_win32Theme;
wxMetalRenderer *m_renderer;
WX_DECLARE_THEME(Metal)
};
@@ -587,7 +587,7 @@ void wxMetalRenderer::DrawMetal(wxDC &dc, const wxRect &rect )
dc.SetPen(*wxTRANSPARENT_PEN);
for (int y = rect.y; y < rect.height+rect.y; y++)
{
int intens = 230 + 80 * (rect.y-y) / rect.height;
unsigned char intens = (unsigned char)(230 + 80 * (rect.y-y) / rect.height);
dc.SetBrush( wxBrush( wxColour(intens,intens,intens), wxSOLID ) );
dc.DrawRectangle( rect.x, y, rect.width, 1 );
}

View File

@@ -77,7 +77,7 @@ public:
// not pressed yet
m_isInverted = false;
// mouse not here yet
m_underMouse = false;
}
@@ -93,7 +93,7 @@ public:
// not pressed yet
m_isInverted = false;
// mouse not here yet
m_underMouse = false;
}
@@ -108,7 +108,7 @@ public:
// press the tool temporarily by inverting its toggle state
void Invert() { m_isInverted = !m_isInverted; }
// Set underMouse
void SetUnderMouse( bool under = true ) { m_underMouse = under; }
bool IsUnderMouse() { return m_underMouse; }
@@ -123,7 +123,7 @@ public:
private:
// true if the tool is pressed
bool m_isInverted;
// true if the tool is under the mouse
bool m_underMouse;
};
@@ -292,9 +292,9 @@ void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
unsigned char blue = image.GetBlue(x,y);
if (!has_mask || red != mask_red || green != mask_green || blue != mask_blue)
{
red = (((wxInt32) red - bg_red) >> 1) + bg_red;
green = (((wxInt32) green - bg_green) >> 1) + bg_green;
blue = (((wxInt32) blue - bg_blue) >> 1) + bg_blue;
red = (unsigned char)((((wxInt32) red - bg_red) >> 1) + bg_red);
green = (unsigned char)((((wxInt32) green - bg_green) >> 1) + bg_green);
blue = (unsigned char)((((wxInt32) blue - bg_blue) >> 1) + bg_blue);
image.SetRGB( x, y, red, green, blue );
}
}
@@ -309,9 +309,9 @@ void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
unsigned char blue = image.GetBlue(x,y);
if (!has_mask || red != mask_red || green != mask_green || blue != mask_blue)
{
red = (((wxInt32) red - bg_red) >> 1) + bg_red;
green = (((wxInt32) green - bg_green) >> 1) + bg_green;
blue = (((wxInt32) blue - bg_blue) >> 1) + bg_blue;
red = (unsigned char)((((wxInt32) red - bg_red) >> 1) + bg_red);
green = (unsigned char)((((wxInt32) green - bg_green) >> 1) + bg_green);
blue = (unsigned char)((((wxInt32) blue - bg_blue) >> 1) + bg_blue);
image.SetRGB( x, y, red, green, blue );
}
}
@@ -440,8 +440,8 @@ void wxToolBar::DoLayout()
y = m_yMargin;
const wxCoord widthTool = IsVertical() ? m_defaultHeight : m_defaultWidth;
wxCoord margin = IsVertical() ? m_xMargin : m_yMargin,
*pCur = IsVertical() ? &y : &x;
wxCoord margin = IsVertical() ? m_xMargin : m_yMargin;
wxCoord *pCur = IsVertical() ? &y : &x;
// calculate the positions of all elements
for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
@@ -494,7 +494,7 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
GetSize(&old_width, &old_height);
wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
// Correct width and height if needed.
if ( width == wxDefaultCoord || height == wxDefaultCoord )
{
@@ -506,12 +506,12 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if ( height == wxDefaultCoord )
height = tmp_height;
}
// We must refresh the frame size when the toolbar changes size
// otherwise the toolbar can be shown incorrectly
if ( old_width != width || old_height != height )
{
// But before we send the size event check it
// But before we send the size event check it
// we have a frame that is not being deleted.
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && !frame->IsBeingDeleted() )
@@ -588,13 +588,13 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer)
// we're beyond the area to redraw, nothing left to do
break;
}
if (tool->IsSeparator() && !HasFlag(wxTB_FLAT))
{
// Draw seperators only in flat mode
continue;
}
// deal with the flags
int flags = 0;
@@ -647,7 +647,7 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
wxToolBarTool *tool = (wxToolBarTool*) FindById(numArg);
if (!tool)
return false;
if ( action == wxACTION_TOOLBAR_TOGGLE )
{
PerformAction( wxACTION_BUTTON_RELEASE, numArg );
@@ -657,7 +657,7 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
else if ( action == wxACTION_TOOLBAR_PRESS )
{
wxLogTrace(_T("toolbar"), _T("Button '%s' pressed."), tool->GetShortHelp().c_str());
tool->Invert();
RefreshTool( tool );
@@ -667,7 +667,7 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
wxLogTrace(_T("toolbar"), _T("Button '%s' released."), tool->GetShortHelp().c_str());
wxASSERT_MSG( tool->IsInverted(), _T("release unpressed button?") );
tool->Invert();
RefreshTool( tool );
@@ -692,11 +692,11 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
else if ( action == wxACTION_TOOLBAR_ENTER )
{
wxCHECK_MSG( tool, false, _T("no tool to enter?") );
if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
{
tool->SetUnderMouse( true );
if ( !tool->IsToggled() )
RefreshTool( tool );
}
@@ -704,11 +704,11 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
else if ( action == wxACTION_TOOLBAR_LEAVE )
{
wxCHECK_MSG( tool, false, _T("no tool to leave?") );
if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
{
tool->SetUnderMouse( false );
if ( !tool->IsToggled() )
RefreshTool( tool );
}
@@ -753,10 +753,10 @@ bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer,
{
if ( !tool || !tool->IsEnabled() )
return true;
m_winCapture = tbar;
m_winCapture->CaptureMouse();
m_toolCapture = tool;
consumer->PerformAction( wxACTION_BUTTON_PRESS, tool->GetId() );
@@ -778,9 +778,9 @@ bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer,
else
consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
}
m_toolCapture = NULL;
return true;
}
//else: don't do anything special about the double click
@@ -795,7 +795,7 @@ bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
if ( !wxStdInputHandler::HandleMouseMove(consumer, event) )
{
wxToolBar *tbar = wxStaticCast(consumer->GetInputWindow(), wxToolBar);
wxToolBarTool *tool;
if ( event.Leaving() )
{
@@ -807,43 +807,43 @@ bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
{
tool = (wxToolBarTool*) tbar->FindToolForPosition( event.GetX(), event.GetY() );
}
if (m_toolCapture)
{
// During capture we only care of the captured tool
if (tool && (tool != m_toolCapture))
tool = NULL;
if (tool == m_toolLast)
return true;
if (tool)
consumer->PerformAction( wxACTION_BUTTON_PRESS, m_toolCapture->GetId() );
else
consumer->PerformAction( wxACTION_BUTTON_RELEASE, m_toolCapture->GetId() );
m_toolLast = tool;
}
else
{
if (tool == m_toolLast)
return true;
if (m_toolLast)
{
// Leave old tool if any
consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolLast->GetId() );
}
if (tool)
{
// Enter new tool if any
consumer->PerformAction( wxACTION_TOOLBAR_ENTER, tool->GetId() );
}
m_toolLast = tool;
}
return true;
}
@@ -853,7 +853,7 @@ bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
bool wxStdToolbarInputHandler::HandleFocus(wxInputConsumer *consumer,
const wxFocusEvent& WXUNUSED(event))
{
if ( m_toolCapture )
if ( m_toolCapture )
{
// We shouldn't be left with a highlighted button
consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );