#include "wx/dcclient.h"
#include "wx/settings.h"
#include "wx/log.h"
- #include "wx/sizer.h"
- #include "wx/layout.h"
#endif
+#include "wx/textfile.h"
#include "wx/generic/grid.h"
// ----------------------------------------------------------------------------
}
}
-// FIXME VZ: these should be wxFAIL_MSG(), not wxLogWarning, they're for the
-// programmer, not the user!
-
bool wxGridTableBase::InsertRows( size_t pos, size_t numRows )
{
- wxLogWarning( wxT("Called grid table class function InsertRows(pos=%d, N=%d)\n"
- "but your derived table class does not override this function"),
- pos, numRows );
+ wxFAIL_MSG( wxT("Called grid table class function InsertRows\n"
+ "but your derived table class does not override this function") );
return FALSE;
}
bool wxGridTableBase::AppendRows( size_t numRows )
{
- wxLogWarning( wxT("Called grid table class function AppendRows(N=%d)\n"
- "but your derived table class does not override this function"),
- numRows );
+ wxFAIL_MSG( wxT("Called grid table class function AppendRows\n"
+ "but your derived table class does not override this function"));
return FALSE;
}
bool wxGridTableBase::DeleteRows( size_t pos, size_t numRows )
{
- wxLogWarning( wxT("Called grid table class function DeleteRows(pos=%d, N=%d)\n"
- "but your derived table class does not override this function"),
- pos, numRows );
+ wxFAIL_MSG( wxT("Called grid table class function DeleteRows\n"
+ "but your derived table class does not override this function"));
return FALSE;
}
bool wxGridTableBase::InsertCols( size_t pos, size_t numCols )
{
- wxLogWarning( wxT("Called grid table class function InsertCols(pos=%d, N=%d)\n"
- "but your derived table class does not override this function"),
- pos, numCols );
+ wxFAIL_MSG( wxT("Called grid table class function InsertCols\n"
+ "but your derived table class does not override this function"));
return FALSE;
}
bool wxGridTableBase::AppendCols( size_t numCols )
{
- wxLogWarning( wxT("Called grid table class function AppendCols(N=%d)\n"
- "but your derived table class does not override this function"),
- numCols );
+ wxFAIL_MSG(wxT("Called grid table class function AppendCols\n"
+ "but your derived table class does not override this function"));
return FALSE;
}
bool wxGridTableBase::DeleteCols( size_t pos, size_t numCols )
{
- wxLogWarning( wxT("Called grid table class function DeleteCols(pos=%d, N=%d)\n"
- "but your derived table class does not override this function"),
- pos, numCols );
+ wxFAIL_MSG( wxT("Called grid table class function DeleteCols\n"
+ "but your derived table class does not override this function"));
return FALSE;
}
if ( pos >= curNumRows )
{
- wxLogError( wxT("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)...\n"
- "Pos value is invalid for present table with %d rows"),
- pos, numRows, curNumRows );
+ wxString errmsg;
+ errmsg.Printf("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)\n"
+ "Pos value is invalid for present table with %d rows",
+ pos, numRows, curNumRows );
+ wxFAIL_MSG( wxT(errmsg) );
return FALSE;
}
{
// TODO: something better than this ?
//
- wxLogError( wxT("Unable to append cols to a grid table with no rows.\n"
- "Call AppendRows() first") );
+ wxFAIL_MSG( wxT("Unable to append cols to a grid table with no rows.\n"
+ "Call AppendRows() first") );
return FALSE;
}
if ( pos >= curNumCols )
{
- wxLogError( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n"
- "Pos value is invalid for present table with %d cols"),
- pos, numCols, curNumCols );
+ wxString errmsg;
+ errmsg.Printf( "Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n"
+ "Pos value is invalid for present table with %d cols",
+ pos, numCols, curNumCols );
+ wxFAIL_MSG( wxT( errmsg ) );
return FALSE;
}
{
if ( m_created )
{
- wxLogError( wxT("wxGrid::CreateGrid(numRows, numCols) called more than once") );
+ wxFAIL_MSG( wxT("wxGrid::CreateGrid called more than once") );
return FALSE;
}
else
CalcUnscrolledPosition( r.GetLeft(), r.GetTop(), &left, &top );
CalcUnscrolledPosition( r.GetRight(), r.GetBottom(), &right, &bottom );
- left++; top++;
// find the cells within these bounds
//
int row, col;
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") );
return FALSE;
}
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") );
return FALSE;
}
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") );
return FALSE;
}
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") );
return FALSE;
}
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") );
return FALSE;
}
if ( !m_created )
{
- wxLogError( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") );
+ wxFAIL_MSG( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") );
return FALSE;
}
{
// shouldn't be here - we are going round in circles...
//
- wxLogFatalError( wxT("wxGrid::OnKeyDown called while alread active") );
+ wxFAIL_MSG( wxT("wxGrid::OnKeyDown called while alread active") );
}
m_inOnKeyDown = TRUE;
// right hand border
//
- dc.DrawLine( m_colRights[col]-1, m_rowBottoms[row] - m_rowHeights[row],
- m_colRights[col]-1, m_rowBottoms[row]-1 );
+ dc.DrawLine( m_colRights[col], m_rowBottoms[row] - m_rowHeights[row],
+ m_colRights[col], m_rowBottoms[row] );
// bottom border
//
- dc.DrawLine( m_colRights[col] - m_colWidths[col], m_rowBottoms[row]-1,
- m_colRights[col]-1, m_rowBottoms[row]-1 );
+ dc.DrawLine( m_colRights[col] - m_colWidths[col], m_rowBottoms[row],
+ m_colRights[col], m_rowBottoms[row] );
}
int i;
for ( i = 0; i < m_numRows; i++ )
{
- if ( m_rowBottoms[i]-1 > bottom )
+ if ( m_rowBottoms[i] > bottom )
{
break;
}
- else if ( m_rowBottoms[i]-1 >= top )
+ else if ( m_rowBottoms[i] >= top )
{
- dc.DrawLine( left, m_rowBottoms[i]-1, right, m_rowBottoms[i]-1 );
+ dc.DrawLine( left, m_rowBottoms[i], right, m_rowBottoms[i] );
}
}
//
for ( i = 0; i < m_numCols; i++ )
{
- if ( m_colRights[i]-1 > right )
+ if ( m_colRights[i] > right )
{
break;
}
- else if ( m_colRights[i]-1 >= left )
+ else if ( m_colRights[i] >= left )
{
- dc.DrawLine( m_colRights[i]-1, top, m_colRights[i]-1, bottom );
+ dc.DrawLine( m_colRights[i], top, m_colRights[i], bottom );
}
}
}
//
void wxGrid::StringToLines( const wxString& value, wxArrayString& lines )
{
- // TODO: this won't work for WXMAC ? (lines end with '\r')
- // => use wxTextFile functions then (VZ)
int startPos = 0;
int pos;
- while ( startPos < (int)value.Length() )
+ wxTextFile tf;
+ wxString eol = wxTextFile::GetEOL( wxTextFileType_Unix );
+ wxString tVal = wxTextFile::Translate( value, wxTextFileType_Unix );
+
+ while ( startPos < (int)tVal.Length() )
{
- pos = value.Mid(startPos).Find( '\n' );
+ pos = tVal.Mid(startPos).Find( eol );
if ( pos < 0 )
{
break;
}
else
{
- if ( value[startPos+pos-1] == '\r' )
- {
- lines.Add( value.Mid(startPos, pos-1) );
- }
- else
- {
- lines.Add( value.Mid(startPos, pos) );
- }
+ lines.Add( value.Mid(startPos, pos) );
}
startPos += pos+1;
}
wxColour wxGrid::GetDefaultCellBackgroundColour()
{
- return GetBackgroundColour();
+ return m_gridWin->GetBackgroundColour();
}
// TODO VZ: this must be optimized to allow only retrieveing attr once!
wxColour wxGrid::GetDefaultCellTextColour()
{
- return GetForegroundColour();
+ return m_gridWin->GetForegroundColour();
}
wxColour wxGrid::GetCellTextColour( int row, int col )
void wxGrid::SetDefaultCellBackgroundColour( const wxColour& col )
{
- SetBackgroundColour(col);
+ m_gridWin->SetBackgroundColour(col);
}
void wxGrid::SetDefaultCellTextColour( const wxColour& col )
{
- SetForegroundColour(col);
+ m_gridWin->SetForegroundColour(col);
}
void wxGrid::SetDefaultCellAlignment( int horiz, int vert )