void CLogSpreadSheet::DeleteRecord(int nRow) { m_daoLogContent.DeleteLogContentByID(GetIDFromRow(nRow)); m_mapLogContent.erase(GetIDFromRow(nRow)); DeleteRows(nRow,1); m_nRowLength--; }
void GLIDebugVariableGrid::RefreshGrid() { //Flag that we are updating the cells internally (so update callbacks do not get called) SetInternalEditMode(true); //Begin batch to not redraw during changes BeginBatch(); //Clear any existing data ClearGrid(); rowTypeDataArray.clear(); //Delete all rows if(GetNumberRows() > 0) { DeleteRows(0, GetNumberRows()); } //Refresh the watch values RefreshWatchValues(); //Refresh the uniform data RefreshUniformValues(); //End Batch to update the changes to the grid EndBatch(); //Reset the cell update counter SetInternalEditMode(false); }
void CatheterCmdGrid::setNumberRows(int nrows) { // default number of rows = NCHANNELS int delta = GetNumberRows() - nrows; if (delta > 0) { DeleteRows(NCHANNELS, delta); } else if (delta < 0) { AppendRows(delta); } }
void ctlResultGrid::fillGrid( PGresult * result ) { int rowCount = PQntuples( result ); int colCount = PQnfields( result ); // If this PGresult represents a non-query command // (like an INSERT), there won't be any columns in // the result set - just return if( colCount == 0 ) return; // Disable repaints to we don't flicker too much BeginBatch(); // Clear out the old results (if any) and resize // grid to match the result set if( GetNumberRows()) DeleteRows( 0, GetNumberRows()); if( GetNumberCols()) DeleteCols( 0, GetNumberCols()); AppendRows( rowCount ); AppendCols( colCount ); EnableEditing( false ); // Copy the column names from the result set into the column headers for( int col = 0; col < colCount; ++col ) SetColLabelValue( col, wxString( PQfname( result, col ), wxConvUTF8 )); // Now copy each value from the result set into the grid for( int row = 0; row < rowCount; ++row ) { for( int col = 0; col < colCount; ++col ) { if( PQgetisnull( result, row, col )) SetCellValue( row, col, wxT( "" )); else SetCellValue( row, col, wxString( PQgetvalue( result, row, col ), wxConvUTF8 )); } } // Resize each column to fit its content AutoSizeColumns( false ); // Enable repaints EndBatch(); }
void CatheterGrid::resetDefaultGrid(int nrows) { cmdCount = 0; DeleteRows(0, GetNumberRows()); for (int i = 0; i < nrows; i++) addGridRow(true); formatDefaultGrid(nrows); setRowReadOnly(0, false); }
void CGridAllelePosCtrl::_DeleteRow(int nRow) { if(!m_bReadOnly) { DeleteRows(nRow,1); AppendRows(1); SetGridReadOnly(false); // set up enabled/disabled rows SetGridCursor(nRow,0); } wxASSERT_MSG( !m_bReadOnly, "CGridAllelePosCtrl::_DeleteRow called on readonly table"); }
void wxPropertyList::RemoveAll() { WX_CLEAR_ARRAY(m_PropertyItems); m_generatedProjects = false; if(GetNumberRows() > 0) DeleteRows(0, GetNumberRows()); m_strQuery.Empty(); #ifdef __LINUX__ // fix to make sure scrollbars are drawn properly wxGrid::AdjustScrollbars(); #endif }
void ctlVarWindow::delVar( wxString name ) { if( name.IsEmpty()) { delete m_cells; m_cells = NULL; if( GetNumberRows()) DeleteRows( 0, GetNumberRows()); } else { } }
bool CGridAnalysis::_SetGridSize(int nRowCount, int nColCount) { // return true if OK, false if error int nRowCurrent = GetNumberRows(); int nColCurrent = GetNumberCols(); bool bError = false; ClearSelection(); ClearGrid(); if((!nRowCount) || (nColCount < 1)) { bError = true; nRowCount = 1; nColCount = 1; } if(nColCurrent > nColCount) { DeleteCols(nColCount,nColCurrent - nColCount); } else if(nColCurrent < nColCount) { AppendCols(nColCount - nColCurrent); } if(nRowCurrent > nRowCount) { DeleteRows(nRowCount,nRowCurrent - nRowCount); } else if(nRowCurrent < nRowCount) { AppendRows(nRowCount - nRowCurrent); } if(bError) { SetColLabelValue(0,wxEmptyString); SetRowLabelValue(0,wxEmptyString); SetCellStyle(0,0,GRID_NORMAL); SetCellValue(0,0,wxEmptyString); } return !bError; }
void DataGrid::showMainData() { char buf[MONEY_LEN]; BeginBatch(); int diff = GetNumberRows()-(m_data->getItemsNum()+1+1); // +initial and total if (diff < 0) { if (!AppendRows(-diff)) return; setRows(m_data->getItemsNum()+1+diff, -diff); } else if (diff > 0) { if (!DeleteRows(m_data->getItemsNum()+1, diff)) return; } SetRowLabelValue(0, HaStrings::strInitial); money_to_str_trail(buf, m_data->getInitial()); SetCellValue(0, BalanceIndex, buf); int row = 1; for (DataFileRW::ItemIterator i = m_data->ItemBegin(); i != m_data->ItemEnd(); ++i, row++) { if (ulist_is_first(&i->owner->items, &i->ulist)) { SetRowLabelValue(row, i->owner->title.str); } else { SetRowLabelValue(row, wxT("")); } clearRow(row); if (is_dummy_item(&*i)) continue; if (i->money < 0) { money_to_str_trail(buf, -i->money); SetCellValue(row, IncomeIndex, buf); } else { money_to_str_trail(buf, i->money); SetCellValue(row, OutlayIndex, buf); } SetCellValue(row, DescIndex, i->desc.str); SetCellValue(row, CommentIndex, i->comment.str); } SetRowLabelValue(row, HaStrings::strTotal); for (int i = 0; i < ColumnNum; i++) SetReadOnly(row, i); wxFont font = GetCellFont(row, 0); font.MakeBold(); SetCellFont(row, IncomeIndex, font); SetCellFont(row, OutlayIndex, font); EndBatch(); }
void wxPropertyList::UpdateGridView() { // make sure all items are shown, remove items that should not be shown bool keepItem; int row; for(size_t i = 0; i < m_PropertyItems.Count(); i++) { // to begin with, does this item fit the query? keepItem = m_strQuery.IsEmpty() || (m_PropertyItems[i]->GetPropName().Find(m_strQuery) != -1); if(keepItem) { // when advanced items are allowed to be shown, keep when ok if(!m_ShowAdvanced) keepItem = !m_PropertyItems[i]->GetAdvanced(); } // find the item, if not present but keep is true, add, if // present but keep is false, remove row = -1; for(size_t j = 0; j < (size_t)GetNumberRows(); j++) { if(m_PropertyItems[i]->GetPropName().IsSameAs(GetCellValue(j, 0))) { row = j; break; } } if(row == -1 && keepItem) AddPropertyToGrid(m_PropertyItems[i], (m_ShowAdvanced ? 2 : 0)); else if(row != -1 && !keepItem) DeleteRows(row, 1); } #ifdef __LINUX__ // fix to make sure scrollbars are drawn properly wxGrid::AdjustScrollbars(); #endif }
void wxPropertyList::RemoveProperty(wxPropertyItem *pItem) { HideControls(); // look for property in grid, delete it when present for(size_t j = 0; j < (size_t)GetNumberRows(); j++) { if(pItem->GetPropName().IsSameAs(GetCellValue(j, 0), false)) { DeleteRows(j, 1); #ifdef __LINUX__ // fix to make sure scrollbars are drawn properly wxGrid::AdjustScrollbars(); #endif break; } } // delete the item from the list m_PropertyItems.Remove(pItem); delete pItem; }
//--------------------------------------------------------- bool CVIEW_Table_Control::_Set_Records(bool bSelection_To_Top) { BeginBatch(); //----------------------------------------------------- if( m_bSelOnly && m_pTable->Get_Selection_Count() <= 0 ) { m_bSelOnly = false; } int Difference, nRecords = m_bSelOnly ? m_pTable->Get_Selection_Count() : m_pTable->Get_Count(); if( (Difference = nRecords - GetNumberRows()) > 0 ) { AppendRows(Difference); } else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 ) { DeleteRows(0, Difference); } m_pRecords = (CSG_Table_Record **)SG_Realloc(m_pRecords, nRecords * sizeof(CSG_Table_Record *)); ClearSelection(); //----------------------------------------------------- if( m_bSelOnly ) { // #pragma omp parallel for for(int iRecord=0; iRecord<nRecords; iRecord++) { _Set_Record(iRecord, m_pTable->Get_Selection(iRecord)); } } else if( !bSelection_To_Top ) { // #pragma omp parallel for for(int iRecord=0; iRecord<nRecords; iRecord++) { _Set_Record(iRecord, m_pTable->Get_Record_byIndex(iRecord)); } } else // if( bSelection_To_Top && m_pTable->Get_Selection_Count() > 0 ) { for(int iRecord=0, iSel=0, iNoSel=m_pTable->Get_Selection_Count(); iRecord<nRecords && PROGRESSBAR_Set_Position(iRecord, nRecords); iRecord++) { CSG_Table_Record *pRecord = m_pTable->Get_Record_byIndex(iRecord); if( pRecord->is_Selected() ) { _Set_Record(iSel ++, pRecord); } else { _Set_Record(iNoSel++, pRecord); } } PROCESS_Set_Okay(); } //----------------------------------------------------- EndBatch(); _Update_Views(); return( true ); }
void CGridRFURunBase::_Build() // called from _SetupKit(); { nwxLabelGridBatch x(this); ClearAll(); // nwxGrid.h nwxLabelGrid::ClearAll(); wxFont fontChannel = GetDefaultCellFont(); wxFont fontLabel = fontChannel; fontChannel.SetWeight(wxFONTWEIGHT_BOLD); fontLabel.SetStyle(wxFONTSTYLE_ITALIC); SetDefaultLabelFont(fontLabel); SetDefaultLabelTextColour(wxColour(192, 192, 192)); const CChannelColors *pChannelColors = NULL; int nCurrentRowCount = GetNumberRows(); int i; int j; if(nCurrentRowCount < m_nROW_COUNT) { InsertRows(m_nROW_CHANNEL_START, m_nROW_COUNT - nCurrentRowCount); _UpdateReadOnly(); } else if(nCurrentRowCount > m_nROW_COUNT) { DeleteRows(m_nROW_CHANNEL_START,nCurrentRowCount - m_nROW_COUNT); } SetDefaultCellValidator( new nwxGridCellUIntRangeValidator( mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true)); EnableDragColSize(false); EnableDragRowSize(false); SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); for(i = 0; i < m_nROW_COUNT; i++) { for(j = 0; j < COL_COUNT; j++) { SetCellValue(i,j,"00000000"); // used for size if(_DisabledCell(i,j)) { SetCellBackgroundColour(i,j,GetGridLineColour()); } } } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetRowLabelValue(m_nROW_SAMPLE,"Sample"); SetRowLabelValue(m_nROW_LADDER,"Ladder"); SetRowLabelValue(m_nROW_ILS," ILS "); SetColLabelValue(COL_ANALYSIS,"Analysis"); SetColLabelValue(COL_DETECTION,"Detection"); SetColLabelValue(COL_INTERLOCUS,"Interlocus"); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetMargins(0,0); ChannelNumberIterator itrChannelCol; int nRow; const wxChar *psDye = NULL; wxString sLabel; for(itrChannelCol = m_vnChannelNumbers.begin(), nRow = m_nROW_CHANNEL_START; itrChannelCol != m_vnChannelNumbers.end(); ++itrChannelCol, ++nRow) { if(m_pKitColors != NULL) { pChannelColors = m_pKitColors->GetColorChannel(*itrChannelCol); psDye = (pChannelColors == NULL) ? NULL : (const wxChar *) pChannelColors->GetDyeName(); } CGridLocusColumns::FORMAT_CHANNEL_DYE(&sLabel,*itrChannelCol,psDye); SetRowLabelValue(nRow,sLabel); if(pChannelColors != NULL) { _SetupChannelRow(nRow,pChannelColors->GetColorAnalyzed(),fontChannel); } else { _SetupDefaultChannelRow(nRow); } } nwxGrid::UpdateLabelSizes(this); AutoSize(); _DisableUnused(); }
//--------------------------------------------------------- bool CActive_Attributes_Control::Update_Table(void) { if( GetBatchCount() > 0 ) { return( false ); } BeginBatch(); //----------------------------------------------------- int Difference = (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols(); if( Difference > 0 ) { AppendCols(Difference); } else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 ) { // here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class DeleteCols(0, Difference); } //----------------------------------------------------- for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++) { SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField)); switch( m_pTable->Get_Field_Type(iField) ) { default: case SG_DATATYPE_Byte: case SG_DATATYPE_Char: case SG_DATATYPE_String: case SG_DATATYPE_Date: case SG_DATATYPE_Binary: SetColFormatCustom(iCol, wxGRID_VALUE_STRING); break; case SG_DATATYPE_Bit: case SG_DATATYPE_Word: case SG_DATATYPE_Short: case SG_DATATYPE_DWord: case SG_DATATYPE_Int: case SG_DATATYPE_ULong: case SG_DATATYPE_Long: case SG_DATATYPE_Color: SetColFormatNumber(iCol); break; case SG_DATATYPE_Float: case SG_DATATYPE_Double: SetColFormatFloat(iCol); break; } } //----------------------------------------------------- if( (Difference = m_pTable->Get_Count() - GetNumberRows()) > 0 ) { AppendRows(Difference); } else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 ) { DeleteRows(0, Difference); } //------------------------------------------------- for(int iRecord=0; iRecord<m_pTable->Get_Count(); iRecord++) { _Set_Record(iRecord); } //----------------------------------------------------- if( GetNumberCols() > 0 && GetNumberRows() > 0 ) { SetRowLabelSize(wxGRID_AUTOSIZE); if( m_Field_Offset ) // feature attributes { if( GetClientSize().x > GetRowLabelSize() ) { SetColSize(0, GetClientSize().x - GetRowLabelSize()); } } else // grid cell values { AutoSizeColumns(); } } Enable(GetNumberRows() > 0); m_pTable->Set_Modified(false); //----------------------------------------------------- EndBatch(); return( true ); }
/// Clear attributes bool ctPropertyEditorGrid::ClearAttributes() { if (GetNumberRows() > 0) DeleteRows(0, GetNumberRows()); return true; }
void CLogSpreadSheet::ResetSheet() { DeleteRows(1,m_nRowLength); m_nRowLength=0; }