minor cleanup - reformatting

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-05-03 02:44:33 +00:00
parent 7e05216cce
commit c2f5b920ca

View File

@@ -188,9 +188,9 @@ class WXDLLIMPEXP_ADV wxGridWindow : public wxWindow
public: public:
wxGridWindow() wxGridWindow()
{ {
m_owner = (wxGrid *)NULL; m_owner = NULL;
m_rowLabelWin = (wxGridRowLabelWindow *)NULL; m_rowLabelWin = NULL;
m_colLabelWin = (wxGridColLabelWindow *)NULL; m_colLabelWin = NULL;
} }
wxGridWindow( wxGrid *parent, wxGridWindow( wxGrid *parent,
@@ -800,13 +800,13 @@ void wxGridCellTextEditor::SetParameters(const wxString& params)
else else
{ {
long tmp; long tmp;
if ( !params.ToLong(&tmp) ) if ( params.ToLong(&tmp) )
{ {
wxLogDebug( _T("Invalid wxGridCellTextEditor parameter string '%s' ignored"), params.c_str() ); m_maxChars = (size_t)tmp;
} }
else else
{ {
m_maxChars = (size_t)tmp; wxLogDebug( _T("Invalid wxGridCellTextEditor parameter string '%s' ignored"), params.c_str() );
} }
} }
} }
@@ -850,7 +850,7 @@ void wxGridCellNumberEditor::Create(wxWindow* parent,
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
#endif // wxUSE_VALIDATORS #endif
} }
} }
@@ -1043,7 +1043,7 @@ void wxGridCellFloatEditor::Create(wxWindow* parent,
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
#endif // wxUSE_VALIDATORS #endif
} }
void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid) void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
@@ -1309,7 +1309,7 @@ void wxGridCellBoolEditor::Show(bool show, wxGridCellAttr *attr)
void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid) void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
{ {
wxASSERT_MSG(m_control, wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!")); wxT("The wxGridCellEditor must be created first!"));
if (grid->GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL)) if (grid->GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL))
{ {
@@ -1329,7 +1329,7 @@ bool wxGridCellBoolEditor::EndEdit(int row, int col,
wxGrid* grid) wxGrid* grid)
{ {
wxASSERT_MSG(m_control, wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!")); wxT("The wxGridCellEditor must be created first!"));
bool changed = false; bool changed = false;
bool value = CBox()->GetValue(); bool value = CBox()->GetValue();
@@ -1350,7 +1350,7 @@ bool wxGridCellBoolEditor::EndEdit(int row, int col,
void wxGridCellBoolEditor::Reset() void wxGridCellBoolEditor::Reset()
{ {
wxASSERT_MSG(m_control, wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!")); wxT("The wxGridCellEditor must be created first!"));
CBox()->SetValue(m_startValue); CBox()->SetValue(m_startValue);
} }
@@ -1460,15 +1460,15 @@ void wxGridCellChoiceEditor::PaintBackground(const wxRect& rectCell,
// flicker // flicker
// TODO: It doesn't actually fill the client area since the height of a // TODO: It doesn't actually fill the client area since the height of a
// combo always defaults to the standard... Until someone has time to // combo always defaults to the standard. Until someone has time to
// figure out the right rectangle to paint, just do it the normal way... // figure out the right rectangle to paint, just do it the normal way.
wxGridCellEditor::PaintBackground(rectCell, attr); wxGridCellEditor::PaintBackground(rectCell, attr);
} }
void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid) void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
{ {
wxASSERT_MSG(m_control, wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!")); wxT("The wxGridCellEditor must be created first!"));
wxGridCellEditorEvtHandler* evtHandler = NULL; wxGridCellEditorEvtHandler* evtHandler = NULL;
if (m_control) if (m_control)
@@ -1640,6 +1640,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event)
event.Skip(); event.Skip();
break; break;
} }
case WXK_END: case WXK_END:
{ {
if ( wholeCellVisible ) if ( wholeCellVisible )
@@ -1693,6 +1694,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event)
default: default:
event.Skip(); event.Skip();
break;
} }
} }
@@ -1854,7 +1856,9 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
} }
if (is_empty) if (is_empty)
{
rect.width += grid.GetColSize(i); rect.width += grid.GetColSize(i);
}
else else
{ {
i--; i--;
@@ -2187,7 +2191,9 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
bool value; bool value;
if ( grid.GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL) ) if ( grid.GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL) )
{
value = grid.GetTable()->GetValueAsBool(row, col); value = grid.GetTable()->GetValueAsBool(row, col);
}
else else
{ {
wxString cellval( grid.GetTable()->GetValue(row, col) ); wxString cellval( grid.GetTable()->GetValue(row, col) );
@@ -2393,7 +2399,9 @@ void wxGridCellAttr::GetAlignment(int *hAlign, int *vAlign) const
*vAlign = m_vAlign; *vAlign = m_vAlign;
} }
else if (m_defGridAttr && m_defGridAttr != this) else if (m_defGridAttr && m_defGridAttr != this)
{
m_defGridAttr->GetAlignment(hAlign, vAlign); m_defGridAttr->GetAlignment(hAlign, vAlign);
}
else else
{ {
wxFAIL_MSG(wxT("Missing default cell attribute")); wxFAIL_MSG(wxT("Missing default cell attribute"));
@@ -2413,11 +2421,11 @@ void wxGridCellAttr::GetSize( int *num_rows, int *num_cols ) const
// used, otherwise the default editor or renderer is fetched from the grid and // used, otherwise the default editor or renderer is fetched from the grid and
// used. It should be the default for the data type of the cell. If it is // used. It should be the default for the data type of the cell. If it is
// NULL (because the table has a type that the grid does not have in its // NULL (because the table has a type that the grid does not have in its
// registry,) then the grid's default editor or renderer is used. // registry), then the grid's default editor or renderer is used.
wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col) const wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col) const
{ {
wxGridCellRenderer *renderer; wxGridCellRenderer *renderer = NULL;
if ( m_renderer && this != m_defGridAttr ) if ( m_renderer && this != m_defGridAttr )
{ {
@@ -2433,14 +2441,10 @@ wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col)
// GetDefaultRendererForCell() will do IncRef() for us // GetDefaultRendererForCell() will do IncRef() for us
renderer = grid->GetDefaultRendererForCell(row, col); renderer = grid->GetDefaultRendererForCell(row, col);
} }
else
{
renderer = NULL;
}
if ( !renderer ) if ( renderer == NULL )
{ {
if (m_defGridAttr && this != m_defGridAttr ) if ( (m_defGridAttr != NULL) && (m_defGridAttr != this) )
{ {
// if we still don't have one then use the grid default // if we still don't have one then use the grid default
// (no need for IncRef() here neither) // (no need for IncRef() here neither)
@@ -2465,7 +2469,7 @@ wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col)
// same as above, except for s/renderer/editor/g // same as above, except for s/renderer/editor/g
wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) const wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) const
{ {
wxGridCellEditor *editor; wxGridCellEditor *editor = NULL;
if ( m_editor && this != m_defGridAttr ) if ( m_editor && this != m_defGridAttr )
{ {
@@ -2481,14 +2485,10 @@ wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) cons
// GetDefaultEditorForCell() will do IncRef() for us // GetDefaultEditorForCell() will do IncRef() for us
editor = grid->GetDefaultEditorForCell(row, col); editor = grid->GetDefaultEditorForCell(row, col);
} }
else
{
editor = NULL;
}
if ( !editor ) if ( editor == NULL )
{ {
if ( m_defGridAttr && this != m_defGridAttr ) if ( (m_defGridAttr != NULL) && (m_defGridAttr != this) )
{ {
// if we still don't have one then use the grid default // if we still don't have one then use the grid default
// (no need for IncRef() here neither) // (no need for IncRef() here neither)
@@ -4783,7 +4783,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
CalcDimensions(); CalcDimensions();
m_colLabelWin->Refresh(); m_colLabelWin->Refresh();
} }
} }
result = true; result = true;
break; break;
@@ -8484,7 +8483,7 @@ bool wxGrid::MovePageUp()
if ( newRow == row ) if ( newRow == row )
{ {
//row > 0 , so newrow can never be less than 0 here. // row > 0, so newRow can never be less than 0 here.
newRow = row - 1; newRow = row - 1;
} }
@@ -8512,7 +8511,7 @@ bool wxGrid::MovePageDown()
int newRow = internalYToRow( y + ch ); int newRow = internalYToRow( y + ch );
if ( newRow == row ) if ( newRow == row )
{ {
// row < m_numRows , so newrow can't overflow here. // row < m_numRows, so newRow can't overflow here.
newRow = row + 1; newRow = row + 1;
} }
@@ -10170,7 +10169,7 @@ void wxGrid::AutoSizeColLabelSize( int col )
long w, h; long w, h;
// Hide the edit control, so it // Hide the edit control, so it
// won't interfer with drag-shrinking. // won't interfere with drag-shrinking.
if ( IsCellEditControlShown() ) if ( IsCellEditControlShown() )
{ {
HideCellEditControl(); HideCellEditControl();