//---------------------------------------------------------
bool CActive_Attributes_Control::_Set_Record(int iRecord)
{
	CSG_Table_Record *pRecord	= m_pTable->Get_Record(iRecord);

	if( m_Field_Offset )	// feature attributes
	{
		SetRowLabelValue(iRecord, pRecord->asString(0));
	}
	else					// grid cell values
	{
		SetRowLabelValue(iRecord, wxString::Format("%d", 1 + iRecord));
	}

	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
	{
		switch( m_pTable->Get_Field_Type(iField) )
		{
		default:
			SetCellValue(iRecord, iCol, pRecord->is_NoData(iField) ? SG_T("") : pRecord->asString(iField));
			break;

		case SG_DATATYPE_Color:
			SetCellBackgroundColour(iRecord, iCol, Get_Color_asWX(pRecord->asInt(iField)));
			break;
		}
	}

	if( pRecord->is_Selected() )
	{
		SelectRow(iRecord, true);
	}

	return( true );
}
Example #2
0
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();
}
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

}
Example #4
0
bool CGridLabThresholds::_SetData(
  CLabThresholds *pData, 
  const wxString &sKitName,
  const wxChar * const *psLabels)
{
  m_pData = pData;
  bool bOK = CGridLocusColumns::SetupKit(
    this,sKitName,true,m_bILS,true,true);

      // set row labels
  if(bOK)
  {
    const wxChar * const *pRowLabel;
    int nColCount = GetNumberCols();
    int j = 1;
    for(pRowLabel = psLabels; (*pRowLabel) != NULL; pRowLabel++)
    {
      SetRowLabelValue(j++,*pRowLabel);
    }
    // put junk in row 1 to set cell width
    _CreateGrid(m_nRows,nColCount);
    for(j = 0; j < nColCount ; j++)
    {
      SetCellValue(1,j,"0000000000");  // set cell width
    }
    nwxGrid::UpdateLabelSizes(this);
    AutoSize();
  }
  return bOK;
}
Example #5
0
void CGridAlleleBase::_FitString(const wxString &s, int nStartColumn)
{
  int nCols = GetNumberCols();
  int nRows = GetNumberRows();
  int nCol;
  int nRow;
  if(nStartColumn < 0)
  {
    nStartColumn = (int)m_vsLeftColumns.size();
  }
  if(nRows > 1 && nCols > 0)
  {
    for(nCol = nStartColumn; nCol < nCols; nCol++)
    {
      SetCellValue(1,nCol,s);
    }
    for(nRow = 0; nRow < nRows; nRow++)
    {
      SetRowLabelValue(nRow,wxEmptyString);
    }
    UpdateLabelSizes();
    SetRowLabelSize(2);
    AutoSize();
  }
}
//---------------------------------------------------------
bool CVIEW_Table_Control::_Set_Record(int iRecord, CSG_Table_Record *pRecord)
{
	m_pRecords[iRecord]	= pRecord;

	if( m_Field_Offset )
	{
		SetRowLabelValue(iRecord, pRecord->asString(0));
	}

	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
	{
		switch( m_pTable->Get_Field_Type(iField) )
		{
		default:
			SetCellValue(iRecord, iCol, pRecord->is_NoData(iField) ? SG_T("") : pRecord->asString(iField));
			break;

		case SG_DATATYPE_Color:
			SetCellBackgroundColour(iRecord, iCol, Get_Color_asWX(pRecord->asInt(iField)));
			break;
		}
	}

	if( pRecord->is_Selected() )
	{
		SelectRow(iRecord, true);
	}

	return( true );
}
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);
}
Example #8
0
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();
}
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);

}
void CGridAnalysis::SetRowLabel(int nRow, const wxString &sLabel)
{
  wxString sNumberedLabel = FormatRowLabel(nRow + 1,GetNumberRows(),sLabel);
  SetRowLabelValue(nRow,sNumberedLabel);
  if(m_pDC != NULL)
  {
    wxSize sz = m_pDC->GetTextExtent(sNumberedLabel);
    int nSize = sz.GetWidth();
    if(nSize > m_nLabelSize)
    {
      m_nLabelSize = nSize;
    }
  }
}
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();
}
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 CVIEW_Table_Control::Set_Labeling(bool bOn)
{
	if( bOn && m_Field_Offset == 0 )
	{
		m_Field_Offset	= 1;

		SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE);
	}
	else if( !bOn && m_Field_Offset != 0 )
	{
		m_Field_Offset	= 0;

		SetRowLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);

		Freeze();

		for(int i=0; i<GetRows(); i++)
		{
			SetRowLabelValue(i, wxString::Format("%d", 1 + i));
		}

		Thaw();
	}
}
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++;
  }
}
Example #15
0
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);
  }
}
Example #16
0
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();
}
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();
  }
}
Example #18
0
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();
}
Example #19
0
//----------------------------------------------------------------------------------------
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;
}
Example #20
0
void ctlVarWindow::addVar( wxString name, wxString value, wxString type, bool readOnly )
{
	// If this is a 'hidden' variable, just ignore it

	if( m_hiddenNames.find( name ) != m_hiddenNames.end())
		return;

	if( m_hiddenTypes.find( type ) != m_hiddenTypes.end())
		return;

	if( m_cells == NULL )
	{
		// This is the first variable we're adding to this grid,
		// layout the grid and set the column headers.

		m_cells = new wsCellHash;
	}

	// Try to find an existing grid cell for this variable...
	wxString	key( name );

	wsCellHash::iterator cell = m_cells->find( key );

	if( cell == m_cells->end())
	{
		// Can't find this variable in the grid, go ahead and add it

		gridCell	newCell;

		newCell.m_row   = m_cells->size();
		newCell.m_type  = type;
		newCell.m_value = value;

		AppendRows( 1 );

		SetRowLabelValue( newCell.m_row, key );

		SetCellValue( newCell.m_row, COL_NAME,  key );
		SetCellValue( newCell.m_row, COL_TYPE,  type );
		SetCellValue( newCell.m_row, COL_VALUE, value );

		SetCellFont( newCell.m_row, COL_NAME, m_nameFont );

		SetReadOnly( newCell.m_row, COL_NAME,  true );
		SetReadOnly( newCell.m_row, COL_TYPE,  true );
		SetReadOnly( newCell.m_row, COL_VALUE, readOnly );

		(*m_cells)[key] = newCell;
	}
	else
	{
		// This variable is already in the grid, update the value
		// and hilite it so the user knows that it has changed.

		cell->second.m_value = value;

		if( GetCellValue( cell->second.m_row, COL_VALUE ).IsSameAs( value ))
			SetCellTextColour( cell->second.m_row, COL_VALUE, *wxBLACK );
		else
			SetCellTextColour( cell->second.m_row, COL_VALUE, *wxRED );

		SetCellValue( cell->second.m_row, COL_VALUE, value );

		// FIXME: why is this part conditional?
		// FIXME: why do we need this code? can the type ever change?

		if( GetCellValue( cell->second.m_row, COL_TYPE) == wxT( "" ))
		{
			SetCellValue( cell->second.m_row, COL_TYPE, type );
		}
	}

	// AutoSizeColumns( false );
}
void CGridSampleLimits::SetData(
  CLabThresholds *pData, const CXMLmessageBook *pMessageBook)
{
  m_pData = pData;
  m_pMessageBook = pMessageBook;
  typedef map<wxString,size_t> MSG_THRESHOLDS;
  set<wxString> setMsgThresholds; // message names for thresholds already used
  size_t nCount = 
    ((m_pMessageBook != NULL) && m_pMessageBook->IsOK())
    ? m_pMessageBook->GetMessageCount()
    : 0;
  if(nCount)
  {
    const wxString sEmpty;
    const wxString sUnitPCT(_T("%"));
    const CXMLmessageBookSM *pmsgSM;
    size_t nCountKeep = 0;
    bool bPct;

    // the following 5 will not use the message book
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfPullUpsInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfStuttersInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfAdenylationsInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfOffLadderAllelesInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfExcessiveResidualsInSample);

    m_vpMsgBookSM.clear();
    m_vpMsgBookSM.reserve(nCount);
    for(size_t i = 0; i < nCount; i++)
    {
      pmsgSM = m_pMessageBook->GetMessage(i);
      if(setMsgThresholds.find(pmsgSM->GetName()) == setMsgThresholds.end())
      {
        m_vpMsgBookSM.push_back(pmsgSM);
        setMsgThresholds.insert(pmsgSM->GetName());
        if(!pmsgSM->EmptyDescriptor())
        {
          nCountKeep++;
        }
      }
    }
    SetMessageBookRows((int)nCountKeep);
    if(nCountKeep)
    {
      wxFont fn = GetLabelFont();
      vector<const CXMLmessageBookSM *>::iterator itrSM;
      int nRow = ROW_MESSAGE_BOOK_OFFSET;
      for(itrSM = m_vpMsgBookSM.begin();
        itrSM != m_vpMsgBookSM.end();
        ++itrSM)
      {
        pmsgSM = *itrSM;
        if(!pmsgSM->EmptyDescriptor())
        {
          bPct = pmsgSM->IsPercent();
          if(bPct)
          {
            SetCellValidator(GetPctValidator(),nRow,0);
          }
          SetRowLabelValue(nRow,pmsgSM->GetDescriptor());
          SetCellBackgroundColour(nRow,1,m_clrBackground);
          SetCellFont(nRow,1,fn);
          SetCellValue(nRow,1,bPct ? sUnitPCT : sEmpty);
          SetReadOnly(nRow,1,true);
          if(pmsgSM->IsPreset())
          {
            SetCellAlignment(nRow,0,wxALIGN_RIGHT,wxALIGN_CENTRE);
          }
          nRow++;
        }
      }
    }
  }
  SetCellValue(0,0,"00000000");
  SetMargins(0,0);
  nwxGrid::UpdateLabelSizes(this);
  AutoSize();
}