ctlVarWindow::ctlVarWindow( wxWindow *parent, wxWindowID id ) : wxGrid( parent, id ), m_cells( NULL ), m_nameFont( GetDefaultCellFont()) { wxWindowBase::SetFont(settings->GetSystemFont()); // Create the grid control CreateGrid( 0, 0 ); SetRowLabelSize( 0 ); // Turn off the row labels // Set up three columns: name, value, and data type AppendCols( 3 ); SetColLabelValue( COL_NAME, _( "Name" )); SetColLabelValue( COL_TYPE, _( "Type" )); SetColLabelValue( COL_VALUE, _( "Value" )); EnableDragGridSize( true ); // EDB wants to hide certain PL variables. To do that, we // keep a hash of hidden names and a hash of hidden types... m_hiddenNames.insert( wxT( "found" )); m_hiddenNames.insert( wxT( "rowcount" )); m_hiddenNames.insert( wxT( "sqlcode" )); m_hiddenNames.insert( wxT( "sqlerrm" )); m_hiddenNames.insert( wxT( "_found" )); m_hiddenNames.insert( wxT( "_rowcount" )); m_hiddenNames.insert( wxT( "sqlstate" )); m_hiddenTypes.insert( wxT( "refcursor" )); }
LogMessagesViewer::LogMessagesViewer( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxGrid( parent, id, pos, size, style, name ), _timer( this ) { // grid CreateGrid( 0, 4 ); EnableEditing( false ); EnableGridLines( false ); EnableDragGridSize( false ); SetMargins( 0, 0 ); // columns //EnableDragColMove( false ); EnableDragColSize( true ); SetColLabelSize( 20 ); SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // rows EnableDragRowSize( true ); SetRowLabelSize( 40 ); SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // label appearance SetColLabelValue( 0, _T( "description" ) ); SetColLabelValue( 1, _T( "source" ) ); SetColLabelValue( 2, _T( "line" ) ); SetColLabelValue( 3, _T( "clock" ) ); // cell defaults SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); coca::getLogger().addHandler( *this ); _timer.Start( 200 ); }
/* handles left mouse click on column header */ void CBOINCGridCtrl::OnLabelLClick(wxGridEvent& ev) { if(ev.GetCol() != -1) { //same column as last time, then change only sort direction if(sortColumn == ev.GetCol()) { sortAscending = ! sortAscending; } else { int tmpOldColumn = sortColumn; sortColumn = ev.GetCol(); sortAscending = true; // Force a repaint of the label if ( -1 != tmpOldColumn ) { SetColLabelValue(tmpOldColumn, GetColLabelValue(tmpOldColumn)); } } // Force a repaint of the label SetColLabelValue(ev.GetCol(), GetColLabelValue(ev.GetCol())); // sortNeededByLabelClick=true; // Update and sort data wxTimerEvent tEvent; wxDynamicCast(GetParent(),CBOINCBaseView)->FireOnListRender(tEvent); } // The base class calls ClearSelection(), so do NOT call ev.Skip(); }
CGridSampleLimits::CGridSampleLimits(wxWindow *parent, wxWindowID id) : _CGridEdit(parent,id), m_pValidatePct(NULL), m_pData(NULL), m_pMessageBook(NULL) //,m_bReadOnly(false) { wxString PEAKS(_T("peaks")); CreateGrid(ROW_MESSAGE_BOOK_OFFSET,2); EnableDragColSize(false); EnableDragRowSize(false); EnableScrolling(false,true); SetRowLabelValue(ROW_PULLUP,_T("Max. No. of pullups peaks per sample")); SetCellValue(ROW_PULLUP,1,PEAKS); SetRowLabelValue(ROW_STUTTER,_T("Max. No. of stutter peaks per sample")); SetCellValue(ROW_STUTTER,1,PEAKS); SetRowLabelValue(ROW_ADENYLATION,_T("Max. No. of adenylation peaks per sample")); SetCellValue(ROW_ADENYLATION,1,PEAKS); SetRowLabelValue(ROW_OFF_LADDER,_T("Max. off-ladder alleles per sample:")); SetCellValue(ROW_OFF_LADDER,1,PEAKS); SetRowLabelValue(ROW_RESIDUAL,_T("Max. residual for allele (<0.5 bp):")); SetCellValue(ROW_RESIDUAL,1,_T("Sample/Ladder BP alignment")); SetCellEditor(ROW_RESIDUAL,0,new wxGridCellFloatEditor(-1,4)); SetDefaultCellValidator(new nwxGridCellUIntRangeValidator(0,1000000,true)); SetCellValidator( new nwxGridCellDoubleRangeValidator(0.0,0.5,true), ROW_RESIDUAL,0); SetRowLabelValue(ROW_EXCESSIVE_RESIDUAL,_T("Max. No. of peaks with excessive residual:")); SetCellValue(ROW_EXCESSIVE_RESIDUAL,1,PEAKS); SetRowLabelValue(ROW_RFU_INCOMPLETE_SAMPLE,_T("Incomplete profile threshold for Reamp More/Reamp Less:")); SetCellValue(ROW_RFU_INCOMPLETE_SAMPLE,1,_T("RFU")); SetRowLabelValue(ROW_MIN_BPS_ARTIFACTS,_T("Ignore artifacts smaller than:")); SetCellValue(ROW_MIN_BPS_ARTIFACTS,1,_T("bps")); m_clrBackground = GetLabelBackgroundColour(); wxFont fnLabel = GetLabelFont(); for(int nRow = 0; nRow < ROW_MESSAGE_BOOK_OFFSET; nRow++) { SetCellBackgroundColour(nRow,1,m_clrBackground); SetReadOnly(nRow,1,true); SetCellFont(nRow,1,fnLabel); SetCellAlignment(nRow,0,wxALIGN_RIGHT, wxALIGN_CENTRE); } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetColLabelValue(0,_T("Value")); SetColLabelValue(1,_T("Units")); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); }
//--------------------------------------------------------- void CVIEW_Table_Control::On_Field_Rename(wxCommandEvent &event) { int i; CSG_Parameters P; P.Set_Name(_TL("Rename Fields")); for(i=0; i<m_pTable->Get_Field_Count(); i++) { P.Add_String(NULL, "", m_pTable->Get_Field_Name(i), _TL(""), m_pTable->Get_Field_Name(i)); } //----------------------------------------------------- if( DLG_Parameters(&P) ) { for(i=0; i<m_pTable->Get_Field_Count(); i++) { CSG_String s(P(i)->asString()); if( s.Length() > 0 && s.Cmp(m_pTable->Get_Field_Name(i)) ) { m_pTable->Set_Field_Name(i, s); SetColLabelValue(i, s.c_str()); } } g_pData->Update(m_pTable, NULL); } }
//--------------------------------------------------------- bool CVIEW_Table_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; } } //----------------------------------------------------- EndBatch(); return( _Set_Records() ); }
//--------------------------------------------------------- void CActive_Attributes_Control::On_Field_Rename(wxCommandEvent &event) { if( !g_pActive->Get_Active_Data_Item() || g_pActive->Get_Active_Data_Item()->Get_Type() != WKSP_ITEM_Grids ) { return; } CSG_Grids *pGrids = ((CWKSP_Grids *)g_pActive->Get_Active_Data_Item())->Get_Grids(); //----------------------------------------------------- int i; CSG_Parameters P; P.Set_Name(_TL("Rename Fields")); for(i=0; i<m_pTable->Get_Field_Count(); i++) { P.Add_String(NULL, SG_Get_String(i), m_pTable->Get_Field_Name(i), _TL(""), m_pTable->Get_Field_Name(i)); } //----------------------------------------------------- if( DLG_Parameters(&P) ) { for(i=0; i<m_pTable->Get_Field_Count(); i++) { CSG_String s(P(i)->asString()); if( s.Length() > 0 && s.Cmp(m_pTable->Get_Field_Name(i)) ) { pGrids->Get_Attributes_Ptr()->Set_Field_Name(i, s); SetColLabelValue(i, s.c_str()); } } g_pData->Update(pGrids, NULL); } }
CGridAnalysis::CGridAnalysis(wxWindow *pParent) : wxGrid(pParent,IDgrid), m_bgBold(255,255,160), m_bgNormal(255,255,255), m_bgRowHasAlert(255,255,218), m_fgBold(192,0,0), m_fgNormal(0,0,0), m_pDC(NULL), m_nLabelSize(0), m_nLabelType(-1), m_nXScroll(0), m_nYScroll(0), m_nIDmenuSort(IDmenuSortFileName) { CreateGrid(1,1); SetRowLabelValue(0,wxEmptyString); SetColLabelValue(0,wxEmptyString); SetReadOnly(0,0,true); SetRowLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTRE); m_fontNormal = GetDefaultCellFont(); m_fontItalic = m_fontNormal; m_fontBold = m_fontNormal; m_fontBold.SetWeight(wxFONTWEIGHT_BOLD); m_fontBoldItalic = m_fontBold; m_fontBoldItalic.SetStyle(wxFONTSTYLE_ITALIC); m_fontItalic.SetStyle(wxFONTSTYLE_ITALIC); #if USE_WINGDINGS g_fontStatus.SetPointSize(m_fontNormal.GetPointSize()); #else // X11 if ever implemented g_fontStatus = m_fontBold; #endif }
void CatheterGrid::formatDefaultGrid(int nrows) { SetColLabelValue(CHANNEL_COL, wxT("Channel")); SetColLabelValue(CURRENT_COL, wxT("Current (mA)")); SetColLabelValue(DIRECTION_COL, wxT("Direction")); SetColLabelValue(DELAY_COL, wxT("Delay (ms)")); //HideRowLabels(); SetColFormatNumber(CHANNEL_COL); //channel address SetColFormatFloat(CURRENT_COL); // MA current //default is String for Direction SetColFormatNumber(DELAY_COL); //delay for (int i = 0; i < nrows; i++) formatDefaultRow(i); setRowReadOnly(0, false); }
/// Use m_columnsToDisplay to set the label strings void ctPropertyEditorGrid::DisplayLabels() { size_t i; for (i = 0; i < m_columnsToDisplay.GetCount(); i++) { SetColLabelValue(i, m_columnsToDisplay[i]); } }
DataGrid::DataGrid(wxWindow* parent, wxWindowID id) : wxGrid(parent, id) , m_data(NULL) { SetColMinimalAcceptableWidth(70); DisableDragRowSize(); CreateGrid(0, ColumnNum); SetColLabelValue(IncomeIndex, HaStrings::strIncome); SetColLabelValue(OutlayIndex, HaStrings::strOutlay); SetColLabelValue(BalanceIndex, HaStrings::strBalance); SetColLabelValue(DescIndex, HaStrings::strDesc); SetColLabelValue(CommentIndex, HaStrings::strComment); SetColFormatFloat(IncomeIndex, MONEY_LEN, 2); SetColFormatFloat(OutlayIndex, MONEY_LEN, 2); SetColFormatFloat(BalanceIndex, MONEY_LEN, 2); AppendRows(2); for (int i = 0; i < ColumnNum; i++) SetReadOnly(0, i); }
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(); }
GLIDebugVariableGrid::GLIDebugVariableGrid(wxWindow *parent, wxWindowID id, uint displayFlags, const wxPoint& pos, const wxSize& size, long style, const wxString& name): wxGrid(parent, id, pos, size, style, name), gridFlags(displayFlags), internalCellEditCounter(0) { //Create a drag target SetDropTarget(new GridDnDText(this)); //Create the grid of 3 columns CreateGrid(0, 3, wxGrid::wxGridSelectRows); //Set the label values SetColLabelValue(NAME_COLUMN_INDEX, wxT("Name")); SetColLabelValue(VALUE_COLUMN_INDEX, wxT("Value")); SetColLabelValue(TYPE_COLUMN_INDEX, wxT("Type")); SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_TOP); SetColLabelSize(17); //Set the column sizes SetColSize(NAME_COLUMN_INDEX, 125); SetColSize(VALUE_COLUMN_INDEX, 200); SetColSize(TYPE_COLUMN_INDEX, 115); //Turn off row labels SetRowLabelSize(0); //Turn off cell overflowing SetDefaultCellOverflow(false); //Setup default colours SetDefaultCellBackgroundColour(*wxWHITE); SetDefaultCellTextColour (*wxBLACK); SetGridLineColour (gridGrey); SetLabelBackgroundColour(gridGrey); SetLabelTextColour (*wxBLACK); }
CatheterCmdGrid::CatheterCmdGrid(const CatheterCmdGrid& C) : wxGrid(C.GetParent(), wxID_ANY), cmd_count(C.cmd_count), dir_choices{ wxT("neg"), wxT("pos") } { dir_choices[DIR_POS] = wxT("pos"); dir_choices[DIR_NEG] = wxT("neg"); CreateGrid(NCHANNELS, NFIELDS); SetColLabelValue(CHANNEL_COL, wxT("Channel")); SetColLabelValue(CURRENT_COL, wxT("Current (MA)")); SetColLabelValue(DIR_COL, wxT("Direction")); SetColLabelValue(DELAY_COL, wxT("Delay (ms)")); //HideRowLabels(); // set column attributes GetTable()->SetAttrProvider(new wxGridCellAttrProvider()); for (int i = 0; i < NFIELDS; i++) GetTable()->GetAttrProvider()->SetColAttr(new wxGridCellAttr(), i); SetColFormatNumber(CHANNEL_COL); //channel address SetColFormatFloat(CURRENT_COL); // MA current SetColFormatNumber(DELAY_COL); //delay wxGridCellAttr* dirAttr = GetTable()->GetAttrProvider()->GetAttr(0, DIR_COL, wxGridCellAttr::Col); wxGridCellAttr* channelAttr = GetTable()->GetAttrProvider()->GetAttr(0, CHANNEL_COL, wxGridCellAttr::Col); if (channelAttr == NULL || dirAttr == NULL) { printf("attribute is NULL\n"); exit(EXIT_FAILURE); } dirAttr->SetEditor(new wxGridCellChoiceEditor(2, dir_choices)); channelAttr->SetEditor(new wxGridCellNumberEditor(1, NCHANNELS)); SetColAttr(DIR_COL, dirAttr); SetColAttr(CHANNEL_COL, channelAttr); for (int i = 1; i < GetNumberRows(); i++) { setRowReadOnly(i, true); } appendCommandRow(); }
Threads::Threads(wxWindow *parent) : wxGrid(parent, wxID_ANY) , numThreads(0) , activeThread(0) { CreateGrid(0, 2); HideRowLabels(); // Add the headers. SetColLabelValue(0, "PID"); SetColLabelValue(1, "Name"); SetColSize(0, 40); SetColSize(1, 160); // tmp AddThread("123", "main_thread"); AddThread("6001", "worker_pool_0"); AddThread("6013", "worker_pool_1"); UpdateActiveThread(); }
void CListView::initWithReportItems() { // DisableDragColSize(); DisableDragColMove(); DisableDragRowSize(); DisableDragGridSize(); CreateGrid(0, 2, wxGridSelectRows); SetColLabelValue(0, wxT("├ч│к")); SetColLabelValue(1, wxT("ох")); wxGridSizesInfo info; info.m_sizeDefault = 20; SetRowSizes(info); wxGridCellAttr *attrRO = new wxGridCellAttr; attrRO->SetReadOnly(); SetColAttr(0, attrRO); registerItemWindow(); }
void CModifierSeqListView::initWithReportItems() { DisableDragColSize(); DisableDragColMove(); DisableDragRowSize(); DisableDragGridSize(); CreateGrid(8, 4, wxGridSelectRows); SetColLabelValue(0, wxT("修改器ID")); SetColLabelValue(1, wxT("参数1")); SetColLabelValue(2, wxT("参数2")); SetColLabelValue(3, wxT("参数3")); wxGridCellAttr *pAttr = new wxGridCellAttr; pAttr->SetEditor(new CTextButtonEditor(wxT("编辑"))); //pAttr->SetRenderer(new CGridCellTextButtonRenderer); SetColAttr(0, pAttr); wxGridSizesInfo info; info.m_sizeDefault = 30; SetRowSizes(info); }
CGridRFULimits::CGridRFULimits(wxWindow *parent, wxWindowID id) : nwxGrid(parent,id), m_pData(NULL) { int i; int j; CreateGrid(ROW_COUNT,COL_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 < ROW_COUNT; i++) { for(j = 0; j < COL_COUNT; j++) { SetCellValue(i,j,_T("00000000")); // used for size if(_DisabledCell(i,j)) { SetCellBackgroundColour(i,j,GetGridLineColour()); } } } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetColLabelValue(COL_SAMPLE,_T("Sample")); SetColLabelValue(COL_LADDER,_T("Ladder")); SetColLabelValue(COL_ILS,_T(" ILS ")); SetRowLabelValue(ROW_RFU_MIN,_T("Analysis Threshold (RFU)")); SetRowLabelValue(ROW_RFU_INTERLOCUS,_T("Min. Interlocus RFU")); SetRowLabelValue(ROW_RFU_MAX,_T("Max. RFU")); SetRowLabelValue(ROW_DETECTION,_T("Detection Threshold (RFU)")); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetMargins(0,0); nwxGrid::UpdateLabelSizes(this); AutoSize(); _DisableUnused(); }
CGridLocus::CGridLocus( COARlocus *pLocusEdit, wxWindow *parent, wxWindowID id, bool bReadOnly) : _CGridEdit(parent,id,bReadOnly), m_pLocusEdited(pLocusEdit) { wxSize sz; size_t nCount = m_pLocusEdited->AlleleCount(); size_t j; int nCol = nCount ? (int) nCount : 1; int nRow = nCount ? nLABELS : 1; int i; int k; CreateGrid(nRow,nCol); if(!nCount) { SetRowLabelValue(0,wxEmptyString); SetColLabelValue(0,wxEmptyString); SetReadOnly(0,0,true); SetReadOnly(0,1,true); SetReadOnly(1,0,true); SetReadOnly(1,1,true); } else { bool bAmel = m_pLocusEdited->IsAmel(); for(i = 0; i < nRow; i++) { s = _T(labels[i]); SetRowLabelValue(i,s); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); } for(j = 0; j < nCount; j++) { k = (int)j; _ImplementColumn(k,bAmel); } TransferDataToWindow(); nwxGrid::UpdateLabelSizes(this); } DisableDragRowSize(); DisableDragColSize(); SetColLabelSize(GetRowSize(0)); s.Empty(); }
void CGridLocus::_ImplementColumn(int nCol,bool bAmel) { int nStart = nCol; int nStop = nCol; int i; int k; int n = GetNumberCols(); if(nCol >= n) { AppendCols(nCol - n + 1); nStart = n; } for(k = nStart; k <= nStop; ++k) { s.Printf("Peak %d",k+1); SetColLabelValue(k,s); for(i = ROW_RO_FIRST; i <= ROW_RO_LAST; i++) { DisableEdit(i,k); } SetBoolCell(ROW_HOMOZYGOUS,k); SetBoolCell(ROW_OFF_LADDER,k); SetBoolCell(ROW_DISABLE,k); SetCellEditor(ROW_BPS,k,new wxGridCellFloatEditor(12,7)); SetCellRenderer(ROW_BPS,k,new wxGridCellFloatRenderer(12,7)); if(!bAmel) { wxGridCellFloatEditor *pfe1(new wxGridCellFloatEditor(5,1)); wxGridCellFloatRenderer *pfr1(new wxGridCellFloatRenderer(5,1)); SetCellEditor(ROW_ALLELE,k,pfe1); SetCellRenderer(ROW_ALLELE,k,pfr1); } else { wxGridCellTextEditor *pe(new wxGridCellTextEditor); pe->SetParameters(_T("1")); SetCellEditor(ROW_ALLELE,k,pe); } SetCellAlignment(wxALIGN_RIGHT, ROW_ALLELE,k); SetCellAlignment(wxALIGN_RIGHT, ROW_BPS,k); SetCellAlignment(wxALIGN_RIGHT, ROW_RFU,k); SetCellAlignment(wxALIGN_RIGHT, ROW_TIME,k); SetCellAlignment(wxALIGN_RIGHT, ROW_PEAK_AREA,k); } }
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; }
CGridColorGrid::CGridColorGrid( wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE | wxWANTS_CHARS) { wxFont fnStatus = CGridAnalysis::GetFontStatus(); int nRow; size_t i; const size_t N = sizeof(aROWS) / sizeof(aROWS[0]); CreateGrid((int)ROW_COUNT,1); SetRowLabelSize(1); SetColLabelSize(1); DisableDragColSize(); DisableDragRowSize(); nwxGrid::SetAllReadOnly(this,true); fnStatus.SetPointSize(GetDefaultCellFont().GetPointSize()); SetColLabelValue(0,wxEmptyString); const ROW_INFO *pRow = aROWS; for(i = 0; i < N; i++) { nRow = (int) pRow->nRow; SetRowLabelValue(nRow,wxEmptyString); SetCellValue(nRow,0,pRow->psLabel); pRow++; } SetRowLabelValue((int)ROW_ATTN,wxEmptyString); SetCellFont((int) ROW_ATTN,0,fnStatus); SetCellValue((int) ROW_ATTN,0,CGridAnalysis::g_sStatusNeedsAttention); SetCellAlignment(wxALIGN_CENTRE,(int)ROW_ATTN,0); SetRowLabelValue((int)ROW_OK,wxEmptyString); SetCellFont((int) ROW_OK,0,fnStatus); SetCellValue((int) ROW_OK,0,CGridAnalysis::g_sStatusOK); SetCellAlignment(wxALIGN_CENTRE,(int)ROW_OK,0); }
CGridAttrGrid::CGridAttrGrid(wxWindow *parent, wxWindowID id) : wxGrid(parent,id,wxDefaultPosition,wxDefaultSize, wxBORDER_SIMPLE | wxWANTS_CHARS) { CreateGrid((int) ROW_ATTR_COUNT,1); SetRowLabelSize(1); SetColLabelSize(1); DisableDragColSize(); DisableDragRowSize(); nwxGrid::SetAllReadOnly(this,true); SetColLabelValue(0,wxEmptyString); const ROW_INFO *pRow = aROWS_ATTR; const size_t N = sizeof(aROWS_ATTR) / sizeof(aROWS_ATTR[0]); size_t i; int nRow; for(i = 0; i < N; i++) { nRow = (int) pRow->nRow; SetRowLabelValue(nRow,wxEmptyString); SetCellValue(nRow,0,pRow->psLabel); pRow++; } }
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(); }
//---------------------------------------------------------------------------------------- int DBGrid::OnTableView(wxString Table) { wxStopWatch sw; //--------------------------------------------------------------------------------------- int x,y,z; wxString Temp0; wxBeginBusyCursor(); SetDefaultCellFont(* pDoc->ft_Doc); //--------------------------------------------------------------------------------------- ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer //--------------------------------------------------------------------------------------- if (ct_BrowserDB) // Valid pointer (!= NULL) ? { // Pointer is Valid, use the wxDatabase Information for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables { if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table)) // is this our Table ? { // Yes, the Data of this Table shall be put into the Grid int ValidTable = x; // Save the Tablenumber (db_Br+i_Which)->OnSelect(Table,false); // Select * from "table" // Set the local Pointer to the Column Information we are going to use (db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf; if ((ct_BrowserDB->pTableInf+x)->pColInf) // Valid pointer (!= NULL) ? { // Pointer is Valid, Column Informationen sind Vorhanden int i = (db_Br+i_Which)->i_Records; // How many Records are there (db_Br+i_Which)->i_Which = ValidTable; // Still used ???? mj10777 if (i == 0) // If the Table is empty, then show one empty row i++; // wxLogMessage(_("\n-I-> DBGrid::OnTableView() : Vor CreateGrid")); CreateGrid(i,(ct_BrowserDB->pTableInf+x)->numCols); // Records , Columns for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) // Loop through the Fields { // The Field / Column name is used here as Row Titel SetColLabelValue(y,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName); SetColSize(y,95); } // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) SetColSize(((ct_BrowserDB->pTableInf+x)->numCols-1),120); // Make the last Column Wider // The Grid has been created, now fill it for (z=0;z<(db_Br+i_Which)->i_Records;z++) // Loop through the Records { Temp0.Printf(_T("%06d"),z+1); SetRowLabelValue(z,Temp0); // Set Row Lable Value (db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,false); for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields { // BrowserDB::OnGetNext Formats the field Value into tablename SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName); } #if wxUSE_STATUSBAR if (z % 50 == 0) { Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records); pDoc->p_MainFrame->SetStatusText(Temp0, 0); } #endif // wxUSE_STATUSBAR } // for (z=0;z<(db_Br+i_Which)->i_Records;z++) Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time()); wxLogMessage(Temp0); #if wxUSE_STATUSBAR pDoc->p_MainFrame->SetStatusText(Temp0, 0); #endif // wxUSE_STATUSBAR // The Grid has been filled, now leave goto Weiter; } // if ((ct_BrowserDB->pTableInf+x)->pColInf) else wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid Column Pointer : Failed")); } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE") } // for (x=0;x<ct_BrowserDB->numTables;x++) } // if (ct_BrowserDB) else wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed")); //--------------------------------------------------------------------------------------- Weiter: EnableEditing(b_EditModus); // Deactivate in-place Editing wxEndBusyCursor(); //--------------------------------------------------------------------------------------- wxLogMessage(_("-I-> DBGrid::OnTableView() - End")); return 0; }
//--------------------------------------------------------- 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 ); }
bool CGridAnalysis::TransferDataToGrid( COARfile *pFile, COARsampleSort *pSort, int nLabelType, int nLabelTypeName, wxDC *pdc) { int nAMEL = -1; bool bError = false; // set up row/col count size_t nRowCount = pSort->GetCount(); size_t nAlleleColCount = pFile->GetLocusCount(); size_t nColCount = nAlleleColCount + CFrameAnalysis::FIRST_LOCUS_COLUMN + 1; DCholder xxx(this,pdc); m_nLabelSize = 0; m_setColChannelChange.clear(); nwxGridBatch xBatch(this); bError = (!nRowCount) || (!nAlleleColCount) || (!_SetGridSize((int) nRowCount,(int)nColCount)); if(!bError) { // set up column headers wxString sLabel; wxString sLocus; wxString sChannel; SetColLabelValue(CFrameAnalysis::STATUS_COLUMN,_T("")); SetColLabelValue(CFrameAnalysis::ILS_COLUMN,_T("ILS")); SetColLabelValue(CFrameAnalysis::CHANNEL_ALERT_COLUMN,_T("Channels")); int nPrevChannel = 0; int nChannel; int nCol; size_t i; const COARdirectoryAlerts *pDirAlerts = pFile->GetDirectoryAlerts(); // set up column labels for(i = 0, nCol = CFrameAnalysis::FIRST_LOCUS_COLUMN; i < nAlleleColCount; ++i,++nCol) { sLocus = pFile->GetLocusName(i); nChannel = pFile->GetChannelNr(i); sLabel = wxString::Format("%s-%d",sLocus.c_str(),nChannel); if(pDirAlerts->GetBaseLocusAlertsByLocus(sLocus) != NULL) { sLabel.Append(_T(" *")); } if(nChannel != nPrevChannel) { m_setColChannelChange.insert(nCol - 1); nPrevChannel = nChannel; } SetColLabelValue(nCol,sLabel); if(!strncmp(sLabel.MakeUpper().c_str(),"AMEL",4)) { nAMEL = nCol; } } nCol = (int)nColCount - 1; SetColLabelValue(nCol,"+Ctrl"); m_setColChannelChange.insert(nCol - 1); m_setColChannelChange.insert(nCol); UpdateGrid(pFile,pSort,nLabelType,nLabelTypeName); UpdateLabelSize(); SetGridCursor(0,CFrameAnalysis::ILS_COLUMN); SetColLabelSize(GetRowSize(0) + 2); } return !bError; }
CGridAlerts::CGridAlerts( COARmessages *pMsgEdit, wxWindow *parent, wxWindowID id, int nType, bool bReadOnly) : _CGridEdit(parent,id,bReadOnly), m_pMsgEdit(pMsgEdit), m_nChannelColumn(-1), m_nLocusColumn(-1), m_nInCellChangeEvent(0) { int bChannel = !!(nType & TYPE_CHANNEL); int bLocus = !!(nType & TYPE_LOCUS); size_t nCount = m_pMsgEdit->GetMessageCount(); if(nCount) { const wxString sDisable(_T("Enabled")); int nColCount = 2 + bChannel + bLocus; int nCol = nColCount; CreateGrid((int)nCount,nColCount); SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetColLabelValue(--nCol,_T("Alert")); SetColLabelValue(--nCol,sDisable); if(bChannel) { SetColLabelValue(--nCol,LABEL_CHANNEL); m_nChannelColumn = nCol; } if(bLocus) { SetColLabelValue(--nCol,LABEL_LOCUS); m_nLocusColumn = nCol; } SetRowLabelSize(2); for(size_t j = 0; j < nCount; j++) { nCol = nColCount; SetCellAlignment((int)j,--nCol,wxALIGN_LEFT,wxALIGN_CENTRE); SetBoolCell((int)j,--nCol); SetCellAlignment((int)j,nCol,wxALIGN_CENTRE,wxALIGN_CENTRE); if(bChannel) { SetCellAlignment((int)j,m_nChannelColumn,wxALIGN_CENTRE,wxALIGN_CENTRE); SetReadOnly((int)j,m_nChannelColumn,true); } if(bLocus) { SetCellAlignment((int)j,m_nLocusColumn,wxALIGN_LEFT,wxALIGN_CENTRE); SetReadOnly((int)j,m_nLocusColumn,true); } SetRowLabelValue((int)j,wxEmptyString); } TransferDataToWindow(); SetColLabelSize(GetRowSize(0)); } else { CreateGrid(1,1); nwxGrid::SetMessageGrid(this,_T("There are no " COAR_NOTICE_DISPLAY)); } AutoSizeColumns(); DisableDragRowSize(); if(bReadOnly) { DisableDragColSize(); } }
CGridCMF::CGridCMF( CDialogCMF *parent, wxWindowID id, COARfile *pFile, COARsampleSort *pSort) : _CGridEdit(parent,id,false), m_pParent(parent), m_pFile(pFile), m_pSort(pSort) { wxString s; vector<int> vnSample; COARsample *pSample; size_t n = m_pFile->GetSampleCount(); size_t i; int j = 0; m_vpSample.reserve(n); vnSample.reserve(n); // a little overkill because of ladders and controls for(i = 0; i < n; i++) { j++; pSample = m_pSort->GetSample(i); if(pSample->IsSampleType() && !pSample->IsDisabled()) { m_vpSample.push_back(pSample); vnSample.push_back(j); } } n = m_vpSample.size(); if(!n) { CreateGrid(1,1); SetCellValue(0,0,"There are no samples"); SetReadOnly(0,0,true); AutoSize(); } else { int ii; CreateGrid((int)n, (int)COLUMN_COUNT); SetRowLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTRE); for(i = 0; i < n; i++) { ii = (int)i; pSample = m_vpSample.at(i); s = CGridAnalysis::FormatRowLabel( vnSample.at(i), (int)n, pSample->GetName()); SetRowLabelValue((int)i,s); SetBoolCell(ii,EXCLUDE); SetBoolCell(ii,PARTIAL); SetCellEditor(ii,SPECIMEN_TYPE,_CreateTypeEditor()); SetReadOnly(ii,EMPTY_LOCI,true); } for(i = 0; i < (size_t) COLUMN_COUNT; i++) { s = COL_LABELS[i]; SetColLabelValue((int)i,s); } SetColLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTRE); } }
void CGridRFULimits::_Build() { wxFont fontChannel = GetDefaultCellFont(); wxFont fontDefault = fontChannel; fontChannel.SetWeight(wxFONTWEIGHT_BOLD); const CChannelColors *pChannelColors = NULL; int nCurrentColCount = GetNumberCols(); int i; int j; if(nCurrentColCount < m_nCOL_COUNT) { InsertCols(m_nCOL_CHANNEL_START, m_nCOL_COUNT - nCurrentColCount); _UpdateReadOnly(); } else if(nCurrentColCount > m_nCOL_COUNT) { DeleteCols(m_nCOL_CHANNEL_START,nCurrentColCount - m_nCOL_COUNT); } InitValidators(); SetDefaultCellValidator( new nwxGridCellUIntRangeValidator( mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true)); nwxGridCellUIntRangeValidator *pVreqd = new nwxGridCellUIntRangeValidator( mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,false); // does not allow empty SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_SAMPLE); SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_ILS); SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_LADDER); EnableDragColSize(false); EnableDragRowSize(false); SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); for(i = 0; i < ROW_COUNT; i++) { for(j = 0; j < m_nCOL_COUNT; j++) { SetCellValue(i,j,"00000000"); // used for size if(_DisabledCell(i,j)) { SetCellBackgroundColour(i,j,GetGridLineColour()); } } } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetColLabelValue(m_nCOL_SAMPLE,"Sample"); SetColLabelValue(m_nCOL_LADDER,"Ladder"); SetColLabelValue(m_nCOL_ILS," ILS "); SetRowLabelValue(ROW_RFU_MIN,"Analysis Threshold (RFU)"); SetRowLabelValue(ROW_RFU_INTERLOCUS,"Min. Interlocus RFU"); SetRowLabelValue(ROW_RFU_MAX,"Max. RFU"); SetRowLabelValue(ROW_DETECTION,"Detection Threshold (RFU)"); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetMargins(0,0); ChannelNumberIterator itrChannelCol; int nCol; const wxChar *psDye = NULL; wxString sLabel; for(itrChannelCol = m_vnChannelNumbers.begin(), nCol = m_nCOL_CHANNEL_START; itrChannelCol != m_vnChannelNumbers.end(); ++itrChannelCol, ++nCol) { if(m_pKitColors != NULL) { pChannelColors = m_pKitColors->GetColorChannel(*itrChannelCol); psDye = (pChannelColors == NULL) ? NULL : (const wxChar *) pChannelColors->GetDyeName(); } CGridLocusColumns::FORMAT_CHANNEL_DYE(&sLabel,*itrChannelCol,psDye); SetColLabelValue(nCol,sLabel); if(pChannelColors != NULL) { _SetupChannelColumn(nCol,pChannelColors->GetColorAnalyzed(),fontChannel); } else { _SetupDefaultChannelColumn(nCol); } } nwxGrid::UpdateLabelSizes(this); AutoSize(); _DisableUnused(); }