示例#1
0
void CGridLabThresholds::DisableCell(int nRow, int nCol)
{
  SetReadOnly(nRow,nCol,true);
  SetCellBackgroundColour(nRow,nCol,
    GetGridLineColour());
  SetCellValue(wxEmptyString,nRow,nCol);
}
void CGridAttrGrid::SetupGridColoursAttr(CParmOsiris *pParm)
{
  wxFont fn = GetDefaultCellFont();
  wxFontWeight fw = wxFONTWEIGHT_NORMAL;
  int fs = wxFONTSTYLE_NORMAL;
  const size_t N = sizeof(aROWS_ATTR) / sizeof(aROWS_ATTR[0]);
  const ROW_INFO *pRow = aROWS_ATTR;
  size_t i;
  int nRow;
  int nFlag;
  wxColour cFG;
  wxColour cBG;
  wxColour c;
  for(i = 0; i < N; i++)
  {
    nRow = (int) pRow->nRow;
    nFlag = pRow->nFlag;
    cFG = pParm->GetForeground(nFlag);
    cBG = pParm->GetBackground(nFlag);
    if( pParm->IsGridReverse(nFlag) )
    {
        c = cFG;
        cFG = cBG;
        cBG = c;
    }
    fw = pParm->IsGridBold(nFlag) ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
    fs = pParm->IsGridItalic(nFlag) ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
    fn.SetWeight(fw);
    fn.SetStyle(fs);
    SetCellFont(nRow,0,fn);
    SetCellTextColour(nRow,0,cFG);
    SetCellBackgroundColour(nRow,0,cBG);
    pRow++;
  }
}
//---------------------------------------------------------
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 );
}
//---------------------------------------------------------
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 );
}
示例#5
0
void Threads::UpdateActiveThread()
{
	for (unsigned i = 0; i < numThreads; ++i)
	{
		wxColour c = (i == activeThread) ? wxColour(255, 255, 0) : GetDefaultCellBackgroundColour();
		for (int x = 0; x < 2; ++x)
			SetCellBackgroundColour(i, x, c);
	}
}
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_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			if( event.ControlDown() )
			{
				g_pData->Open   (pRecord->asString(iField));
			}
			else
			{
				Open_Application(pRecord->asString(iField));
			}
		}
	}

	//-----------------------------------------------------
	else if( event.ControlDown() )
	{
		m_pTable->Select(pRecord, true);

		Update_Selection();
	}

	else if( event.ShiftDown() )
	{
		SelectBlock(event.GetRow(), 0, GetGridCursorRow(), GetNumberCols(), false);
	}

	else
	{
		SelectRow(event.GetRow(), false);

		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
void CGridColorGrid::SetupGridColoursAttr(CParmOsiris *pParm)
{
  wxFont fn = GetDefaultCellFont();
  wxFontWeight fw = wxFONTWEIGHT_NORMAL;
  int fs = wxFONTSTYLE_NORMAL;
  const size_t N = sizeof(aROWS) / sizeof(aROWS[0]);
  const ROW_INFO *pRow = aROWS;
  size_t i;
  int nRow;
  int nFlag;
  wxColour cFG;
  wxColour cBG;
  for(i = 0; i < N; i++)
  {
    nRow = (int) pRow->nRow;
    nFlag = pRow->nFlag;
    cFG = pParm->GetForeground(nFlag);
    cBG = pParm->GetBackground(nFlag);
    fw = pParm->IsGridBold(nFlag) ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
    fs = pParm->IsGridItalic(nFlag) ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
    fn.SetWeight(fw);
    fn.SetStyle(fs);
    SetCellFont(nRow,0,fn);
    SetCellTextColour(nRow,0,cFG);
    SetCellBackgroundColour(nRow,0,cBG);
    pRow++;
  }

  SetCellTextColour(
    (int)ROW_ATTN,0,pParm->GetStatusForeground(true));
  SetCellBackgroundColour(
    (int)ROW_ATTN,0,pParm->GetStatusBackground(true));
  SetCellTextColour(
    (int)ROW_OK,0,pParm->GetStatusForeground(false));
  SetCellBackgroundColour(
    (int)ROW_OK,0,pParm->GetStatusBackground(false));
}
int GLIDebugVariableGrid::AddRowType(RowType addType, uint typeIndex)
{
  //Add the row and get the index
  AppendRows(1);

  //Add to the type array
  rowTypeDataArray.push_back(RowTypeData(addType, typeIndex));

  //Check that the array sizes match
  wxASSERT(rowTypeDataArray.size() == GetNumberRows());

  //Set the default properties for the different types
  int addIndex = GetNumberRows() - 1;
  switch(addType)
  {
    case(RT_Header):
      SetCellSize(addIndex, NAME_COLUMN_INDEX, 1, 3);
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetCellBackgroundColour(addIndex, NAME_COLUMN_INDEX, gridGrey);
      SetCellFont(addIndex, NAME_COLUMN_INDEX, GetLabelFont());
      break;

    case(RT_WatchValue):
      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET));  
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      break;

    case(RT_Uniform):
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      SetReadOnly(addIndex, TYPE_COLUMN_INDEX);

      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET));  
      break;

    case(RT_UniformArray):
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      SetReadOnly(addIndex, TYPE_COLUMN_INDEX);

      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET*2));  
      break;

  };


  //Return the index
  return addIndex;
}
  /*
void CGridAnalysis::SetCellStyle(
  int nRow, int nCol, bool bBold, bool bItal,bool bHasAlert)
{
  wxFont *pFont(NULL);
  if(bBold)
  {
    pFont = bItal ? &m_fontBoldItalic : &m_fontBold;
    SetCellFont(nRow,nCol,*pFont);
    SetCellBackgroundColour(nRow,nCol,m_bgBold);
    SetCellTextColour(nRow,nCol,m_fgBold);
  }
  else
  {
    wxColour *pcolor = bHasAlert ? &m_bgRowHasAlert : &m_bgNormal;
    pFont = bItal ? &m_fontItalic : &m_fontNormal;
    SetCellFont(nRow,nCol,*pFont);
    SetCellBackgroundColour(nRow,nCol,*pcolor);
    SetCellTextColour(nRow,nCol,m_fgNormal);
  }
}
*/
void CGridAnalysis::SetCellStyle(
  int nRow, int nCol, GRID_FLAG nFlag)
{
  const int BOLD = 1;
  const int ITALIC = 2;
  const int BOLD_ITALIC = 3;
  int n = 0;
  wxFont *pFont = NULL;
  CParmOsiris *pParm(CParmOsiris::GetGlobal());
  const wxColour &cFG(pParm->GetForeground(nFlag));
  const wxColour &cBG(pParm->GetBackground(nFlag));
  const wxColour *pcFG(&cFG);
  const wxColour *pcBG(&cBG);
  if(pParm->IsGridBold(nFlag))
  {
    n |= BOLD;
  }
  if(pParm->IsGridItalic(nFlag))
  {
    n |= ITALIC;
  }
  switch(n)
  {
  case BOLD:
    pFont = &m_fontBold;
    break;
  case ITALIC:
    pFont = &m_fontItalic;
    break;
  case BOLD_ITALIC:
    pFont = &m_fontBoldItalic;
    break;
  default:
    pFont = &m_fontNormal;
    break;
  }
  SetCellFont(nRow,nCol,*pFont);
  if(pParm->IsGridReverse(nFlag))
  {
    pcFG = &cBG;
    pcBG = &cFG;
  }
  SetCellBackgroundColour(nRow,nCol,*pcBG);
  SetCellTextColour(nRow,nCol,*pcFG);
}
示例#11
0
void CGridAllelePosCtrl::_SetRowNextControl(int nRow)
{
  if(nRow < 0)
  {
    nRow = _FindNextControlRow();
  }
  if(nRow >= 0)
  {
    _SetRowEnabled(nRow,false);
    m_nRowNextControl = nRow;
    if(!m_bReadOnly)
    {
      SetReadOnly(nRow,0,false);
      SetCellBackgroundColour(
        nRow,0,GetDefaultCellBackgroundColour());
    }
  }
}
//---------------------------------------------------------
void CActive_Attributes_Control::On_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pTable->Get_Record(event.GetRow());

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			Open_Application(pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	if( event.ControlDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			g_pData->Open   (pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	else
	{
		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
示例#13
0
bool CGridAlleleBase::SetupKit(
  const wxString &sKitName, bool bAllowAmel)
{
  bool bRtn = CGridLocusColumns::SetupKit(
    this,sKitName,m_vsLeftColumns,
    false,bAllowAmel,true);
  m_mapLocusColumn.clear();
  m_nAmelColumn = -1;
  EnableDragRowSize(false);
  if(bRtn)
  {
    wxString s;
    int nCols = GetNumberCols();
    int nCol;
    for(nCol = (int)m_vsLeftColumns.size(); nCol < nCols; nCol++)
    {
      s = GetColLabelValue(nCol);
      nwxString::Trim(&s);
      if(!s.IsEmpty())
      {
        m_mapLocusColumn.insert(
          map<wxString,int,nwxStringLessNoCase>::value_type(
            s,nCol));
        if(CLabLocus::IsAmel(s))
        {
          m_nAmelColumn = nCol;
        }
      }
    }
    nCols = (int)m_vsLeftColumns.size();
    wxColour sClr = GetDisabledColour();
    for(nCol = 0; nCol < nCols; nCol++)
    {
      SetCellBackgroundColour(0,nCol,
        sClr);
    }
  }
  return bRtn;
}
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();
}
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();
}
示例#16
0
bool wxPropertyList::UpdatePropertyItem(wxPropertyItem *pItem, int row)
{
    wxCHECK(row < GetNumberRows(), false);

    // reflect the property's state to match the grid row

    SetReadOnly(row, 0);
    // TODO: Make this a UpdatePropItem where ADVANCED, and new edit values are reflected
    SetCellValue(row,0, pItem->GetPropName());
    
    // boolean renderer
    if(pItem->GetItemType() == wxPropertyList::CHECKBOX)
    {
        // translate ON or TRUE (case insensitive to a checkbox)
        if(pItem->GetCurValue().IsSameAs(wxT("ON"), false) ||
           pItem->GetCurValue().IsSameAs(wxT("TRUE"), false))
            SetCellValue(row, 1, wxT("1"));
        else
            SetCellValue(row, 1, wxT("0"));
    }
    else
    {
        // for normal path values, give bold in cell when
        // the NOTFOUND is present, for emphasis
        wxString str = pItem->GetPropName() + wxT("-NOTFOUND");     
        if(pItem->GetCurValue().IsSameAs(str))
        {
            wxFont fnt = GetCellFont(row, 0);       
            fnt.SetWeight(wxFONTWEIGHT_BOLD);
            SetCellFont(row, 1, fnt);
        }
        else
            SetCellFont(row, 1, GetCellFont(row, 0));

        SetCellValue(row,1, pItem->GetCurValue());
    }

    if(pItem->GetCurValue().IsSameAs("IGNORE"))
    {
        // ignored cell is completely dimmed
        wxColour col(192,192,192);
        SetCellTextColour(row, 1, col);
    }
    else
    {
        // we colour paths blue, filenames green, all else black
        wxColour col;
        if(pItem->IsDirPath())
            col.Set(0,0,255);
        else if(pItem->IsFilePath())
            col.Set(0,128,0);
        else
            col = GetCellTextColour(row, 0);

        SetCellTextColour(row, 1, col);
    }

    if(pItem->GetNewValue())
    {
        // new cell is red
        wxColour col(255,100,100);
        SetCellBackgroundColour(row, 0, col);
    }
    else
    {
        // old cell is grey
        wxColour col(192, 192, 192);
        SetCellBackgroundColour(row, 0, col);
    }

    return true;
}
void CGridAnalysis::UpdateGrid(
  COARfile *pFile, COARsampleSort *pSort,
  int nLabelType, 
  int nLabelTypeName,
  const wxDateTime *pHistory, 
  wxDC *pDC)
{
  nwxGridBatch xBatch(this);
  wxDC *pDCuse = (pDC != NULL) ? pDC : GetDC();
  DCholder xx(this,pDCuse);

  wxString sChannel;
  wxString sCell;
  int iRow;
  int nCol;
  int nReviewCount;
  int nAcceptCount;
  int nReviewNeeded;
  int nAcceptNeeded;
  size_t nRowCount = pSort->GetCount();
  size_t nAlleleColCount = pFile->GetLocusCount();
  size_t i;
  COARlocus *pLocus;
  COARsample *pSample;
  const COARmessages *pMsgs = pFile->GetMessages();
  GRID_FLAG flagBase;
  GRID_FLAG flag;
  bool bAlert;
  bool bEdited;
  bool bSampleHasAlert;
  bool bSampleEdited;
  bool bNeedsAttention;
  bool bSampleDisabled;
  m_nLabelSize = 0;
  m_nLabelType = nLabelTypeName;

  

#if 0
  // moved to next loop
  // Set up row labels
  for(iRow = 0; iRow < (int)nRowCount; ++iRow)
  {
    pSample = pSort->GetSample((size_t)iRow);
    sName = pSample->GetName();
    if(pSample->IsSampleLevelEdited(pFile->GetMessages(),pHistory))
    {
      sName.Append(COARsample::g_sCellChannelEdited);
    }
    SetRowLabel(iRow,sName);
  }
#endif

  // set up cells
  pFile->GetReviewerCounts(&nReviewNeeded,&nAcceptNeeded,CLabReview::REVIEW_SAMPLE);

  for(iRow = 0; iRow < (int)nRowCount; ++iRow)
  {
    // setup sample info
    flagBase = GRID_NORMAL;
    bNeedsAttention = false;
    pSample = pSort->GetSample((size_t)iRow);
    bSampleHasAlert = pSample->HasAnyAlerts(pMsgs,pHistory);
    bSampleEdited = pSample->IsEdited(pMsgs,pHistory);
    bSampleDisabled = pSample->IsDisabled(pHistory);
    const COARsampleReviewAccept &accept(pSample->GetAcceptance());
    const COARsampleReviewAccept &review(pSample->GetReviews());

    if(bSampleDisabled)
    {
      flagBase |= GRID_DISABLED;
    }
    else 
    {
      if(bSampleHasAlert)
      {
        flagBase |= GRID_ALERT_SAMPLE;
      }
      if(bSampleEdited)
      {
        flagBase |= GRID_EDITED_SAMPLE;
      }
    }
    //  Setup Row Label for sample
    bEdited = pSample->IsSampleLevelEdited(pMsgs,pHistory);
    bAlert = pSample->HasSampleAlert(pMsgs,pHistory);
    nAcceptCount = accept.GetSampleCount(pHistory);
    nReviewCount = review.GetSampleCount(pHistory);
    _SetupCellFlag(
      flagBase,
      bSampleDisabled,bEdited,bAlert,
      nAcceptCount, nAcceptNeeded,
      nReviewCount, nReviewNeeded,
      &flag,&bNeedsAttention);
    SetupRowLabel(pSample,iRow,nLabelTypeName,bEdited,bNeedsAttention);


    // ILS alert column

    bAlert = bSampleHasAlert && pSample->HasILSAlert(pMsgs,pHistory);
    bEdited = pSample->IsCellILSEdited(pMsgs,pHistory);
    nAcceptCount = accept.GetILSCount(pHistory);
    nReviewCount = review.GetILSCount(pHistory);
    pFile->GetReviewerCounts(&nReviewNeeded,&nAcceptNeeded,CLabReview::REVIEW_ILS);
    _SetupCellFlag(
      flagBase,
      bSampleDisabled,bEdited,bAlert,
      nAcceptCount, nAcceptNeeded,
      nReviewCount, nReviewNeeded,
      &flag,&bNeedsAttention);
    SetCellValue(iRow,CFrameAnalysis::ILS_COLUMN,pSample->GetCellILS(pMsgs,pHistory));
    SetCellStyle(
      iRow,CFrameAnalysis::ILS_COLUMN,flag);

    // channel alert column

    sChannel = pSample->GetCellChannel(pMsgs,pHistory);
    bAlert = bSampleHasAlert && COARsample::HasChannelAlert(sChannel);
    bEdited = bSampleEdited && pSample->IsCellChannelEdited(pMsgs,pHistory);
    nAcceptCount = accept.GetChannelCount(pHistory);
    nReviewCount = review.GetChannelCount(pHistory);
    pFile->GetReviewerCounts(&nReviewNeeded,&nAcceptNeeded,CLabReview::REVIEW_CHANNEL);

    _SetupCellFlag(
      flagBase,
      bSampleDisabled,bEdited,bAlert,
      nAcceptCount, nAcceptNeeded,
      nReviewCount, nReviewNeeded,
      &flag,&bNeedsAttention);
    SetCellValue(iRow,CFrameAnalysis::CHANNEL_ALERT_COLUMN,sChannel);
    SetCellStyle(iRow,CFrameAnalysis::CHANNEL_ALERT_COLUMN,flag);

    SetReadOnly(iRow,CFrameAnalysis::ILS_COLUMN,true);
    SetReadOnly(iRow,CFrameAnalysis::CHANNEL_ALERT_COLUMN,true);
    SetReadOnly(iRow,CFrameAnalysis::STATUS_COLUMN,true);

    pFile->GetReviewerCounts(&nReviewNeeded,&nAcceptNeeded,CLabReview::REVIEW_LOCUS);
    for(i = 0, nCol = CFrameAnalysis::FIRST_LOCUS_COLUMN;
        i < nAlleleColCount;
        ++i, ++nCol)
    {
      SetReadOnly(iRow,nCol,true);
      pLocus = pSample->FindLocus(pFile->GetLocusName(i));
      if(pLocus != NULL)
      {
        sCell = pLocus->GetCell(nLabelType,pHistory);
        bAlert = bSampleHasAlert && pLocus->HasAlerts(pMsgs,pHistory);
        const COARchannel *pChannel =
          pFile->GetChannelFromLocus(pLocus->GetName());
        int nChannel = pChannel->GetChannelNr();
        nAcceptCount = pLocus->GetAcceptanceCount(pHistory);
        nReviewCount = pLocus->GetReviewCount(pHistory);
        bEdited = pLocus->HasBeenEdited(
          pMsgs,pSample,nChannel,pHistory);
        _SetupCellFlag(flagBase,
          bSampleDisabled,bEdited,bAlert,
          nAcceptCount,nAcceptNeeded,
          nReviewCount,nReviewNeeded,
          &flag,&bNeedsAttention);
        if(sCell.IsEmpty())
        {
          if(bAlert)
          {
            sCell = _T("?");
          }
          else if(bEdited)
          {
            sCell = COARsample::g_sCellChannelEdited;
          }
        }
        SetCellValue(iRow,nCol,sCell);
        SetCellStyle(iRow,nCol,flag);
      }
      else
      {
        SetCellValue(iRow,nCol,wxEmptyString);
        SetCellStyle(iRow,nCol,flagBase);
      }
    }
    // setup control cell

    SetReadOnly(iRow,nCol,true);
    SetCellValue(iRow,nCol,pSample->GetPositiveControl());
    SetCellStyle(iRow,nCol,flagBase);

    // setup status cell
    SetReadOnly(iRow,CFrameAnalysis::STATUS_COLUMN,true);
    if(bSampleDisabled)
    {
      SetCellValue(iRow,CFrameAnalysis::STATUS_COLUMN,_T(""));
      SetCellStyle(iRow,CFrameAnalysis::STATUS_COLUMN,flagBase);
    }
    else 
    {
      CParmOsirisGlobal parm;
      const wxColour &clFg(parm->GetStatusForeground(bNeedsAttention));
      const wxColour &clBg(parm->GetStatusBackground(bNeedsAttention));
      const wxString &s(
        bNeedsAttention ? g_sStatusNeedsAttention : g_sStatusOK);
      SetCellValue(iRow,CFrameAnalysis::STATUS_COLUMN,s);
      SetCellFont(iRow,CFrameAnalysis::STATUS_COLUMN,g_fontStatus);
      SetCellBackgroundColour(iRow,CFrameAnalysis::STATUS_COLUMN,clBg);
      SetCellTextColour(iRow,CFrameAnalysis::STATUS_COLUMN,clFg);
      SetCellAlignment(
        iRow,CFrameAnalysis::STATUS_COLUMN,
        wxALIGN_CENTRE,wxALIGN_CENTRE);
      SetCellAlignment(
        iRow,CFrameAnalysis::ILS_COLUMN,
        wxALIGN_CENTRE,wxALIGN_CENTRE);
    }
  }
  AutoSize();
  UpdateLabelSize();
}
示例#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();
}
示例#19
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();
}