bool CEnableDisableMultiple::AppendReview(const wxString &sName)
{
  const vector<COARsample *> *pvpSample = m_pDialog->GetSelection();
  vector<COARsample *>::const_iterator itr;
  COARsample *pSample;
  bool bEnable = m_pDialog->IsActionEnable();
  if(pvpSample != NULL)
  {
    for(itr = pvpSample->begin();
      itr != pvpSample->end();
      ++itr)
    {
      pSample = *itr;
      pSample->SetEnabled(sName,bEnable);
    }
  }
  return true;
}
void CSplitterCellHistory::_SetupSetDateTime(
    const COARsample &Sample,
    int nChannel,
    const COARlocus &Locus,
    const COARmessages &Msg,
    const set<wxDateTime> &setDateTime,
    set<wxDateTime> *psetKeep)
{
    wxString sNotes;
    wxString sNotesLast;
    wxString sLocusName(Locus.GetName());
    wxDateTime dt;
    wxDateTime dtLast((time_t)0);
    vector<const COARallele *> vpAllele;
    set<wxDateTime>::const_iterator itr;
    const vector<int> *pvnAlerts = Locus.GetAlerts();
    bool bKeep;

    psetKeep->clear();
    dtLast.Set((time_t) 0);
    psetKeep->insert(dtLast);

    if(setDateTime.size())
    {
        sNotesLast = Locus.GetNotes(&dtLast);
        for(itr = setDateTime.begin(); itr != setDateTime.end(); ++itr)
        {
            bKeep = false;
            dt = *itr;
            auto_ptr< vectorptr<COARpeakAny> > pPeaks(
                Sample.GetPeaksByLocusName(
                    sLocusName, nChannel, &dt));
            for(vectorptr<COARpeakAny>::iterator itra
                    = pPeaks->begin();
                    (itra != pPeaks->end()) && (!bKeep);
                    ++itra)
            {
                if((*itra)->GetUpdateTime() > dtLast)
                {
                    bKeep = true;
                }
            }

            // check for a newer message change
            if(!bKeep)
            {
                bKeep = _CheckMessageUpdate(Msg,pvnAlerts, dtLast, &dt);
            }

            sNotes = Locus.GetNotes(&dt);
            if(sNotes != sNotesLast)
            {
                sNotesLast = sNotes;
                bKeep = true;
            }
            if(bKeep)
            {
                // something changed between this time (dt) and the
                // previous (dtLast), so keep this time
                psetKeep->insert(dt);
                dtLast = dt;
            }
        }
    }
}
void CSplitterCellHistory::_SetupSetDateTime(
    const COARfile &File,
    const COARsample &Sample,
    set<wxDateTime> *psetKeep,
    int nSelect)
{
    set<wxDateTime>::const_iterator itr;
    wxString sNotesILS;
    wxString sNotesSample;
    wxString sNotesChannel;
    wxString sNotesDir;
    wxString sNotes;
    wxDateTime dt;
    wxDateTime dtLast;
    vector<int> vnAlerts;
    bool bKeep;
    bool bSample = false;
    bool bILS = false;
    bool bChannel = false;
    bool bDir = false;
    switch(nSelect)
    {
    case SA_NDX_DIR:
        bDir = true;
        break;
    case SA_NDX_SAMPLE:
        bSample = true;
        break;
    case SA_NDX_ILS:
        bILS = true;
        break;
    case SA_NDX_CHANNEL:
        bChannel = true;
        break;
    default:
        bChannel = true;
        bSample = true;
        bILS = true;
        bDir = true;
        break;
    }
    if(bSample)
    {
        Sample.AppendChannelAlerts(&vnAlerts);
    }
    if(bILS)
    {
        COARfile::AppendVectorInt(&vnAlerts,Sample.GetILSAlerts()->Get());
    }
    if(bSample)
    {
        COARfile::AppendVectorInt(&vnAlerts,Sample.GetSampleAlerts()->Get());
    }
    if(bDir)
    {
        // get all message numbers
        const COARdirectoryAlerts *pDirAlert =
            File.GetDirectoryAlerts();
        const vector<COARbaseLocus *> *pvBaseLoci =
            pDirAlert->GetBaseLociAlerts();
        vector<COARbaseLocus *>::const_iterator itrL;
        COARfile::AppendVectorInt(
            &vnAlerts,pDirAlert->GetMessagesNumbers());
        for(itrL = pvBaseLoci->begin();
                itrL != pvBaseLoci->end();
                ++itrL)
        {
            COARfile::AppendVectorInt(
                &vnAlerts,(*itrL)->GetMessageNumbers());
        }
    }

    //bool bFirstLoop = true;
    psetKeep->clear();
    dtLast.Set((time_t) 0);
    psetKeep->insert(dtLast);
    const set<wxDateTime> &setDateTime(*File.GetHistory());
    if(setDateTime.size())
    {
        if(bChannel)
        {
            sNotesChannel = COARnotes::GetText(Sample.GetNotesChannel(&dtLast));
        }
        if(bILS)
        {
            sNotesILS = COARnotes::GetText(Sample.GetNotesILS(&dtLast));
        }
        if(bSample)
        {
            sNotesSample = COARnotes::GetText(Sample.GetNotesSample(&dtLast));
        }
        if(bDir)
        {
            sNotesDir = COARnotes::GetText(File.GetNotesDir(&dtLast));
        }
        for(itr = setDateTime.begin(); itr != setDateTime.end(); ++itr)
        {
            dt = *itr;
            bKeep = _CheckMessageUpdate(
                        *File.GetMessages(),&vnAlerts,dtLast,&dt);

            if(bChannel)
            {
                sNotes = COARnotes::GetText(Sample.GetNotesChannel(&dt));
                if(sNotes != sNotesChannel)
                {
                    sNotesChannel = sNotes;
                    bKeep = true;
                }
            }
            if(bILS)
            {
                sNotes = COARnotes::GetText(Sample.GetNotesILS(&dt));
                if(sNotes != sNotesILS)
                {
                    sNotesILS = sNotes;
                    bKeep = true;
                }
            }
            if(bSample)
            {
                sNotes = COARnotes::GetText(Sample.GetNotesSample(&dt));
                if(sNotes != sNotesSample)
                {
                    sNotesSample = sNotes;
                    bKeep = true;
                }
            }
            if(bDir)
            {
                sNotes = COARnotes::GetText(File.GetNotesDir(&dt));
                if(sNotes != sNotesDir)
                {
                    sNotesDir = sNotes;
                    bKeep = true;
                }
            }
            if(bKeep)
            {
                // something changed between this time (dt) and the
                // previous (dtLast), so keep this time
                psetKeep->insert(dt);
                dtLast = dt;
            }
        }
    }
}
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();
}
CDialogEnableMultiple::CDialogEnableMultiple(
    const vector<COARsample *> *pvpSamples,
    bool bAllowUserNameOverride,
    wxWindow *parent) : 
  wxDialog(
    parent,wxID_ANY,g_psDisable,
    wxDefaultPosition, wxDefaultSize,
    mainApp::DIALOG_STYLE),
    m_pReview(NULL),
    m_pCombo(NULL),
    m_nListSize((int) pvpSamples->size())
{
  vector<COARsample *>::const_iterator itr;
  size_t nSampleCount = pvpSamples->size();
  int n = 0;
  COARsample *pSample;

  m_vnEnabled.reserve(nSampleCount);
  m_vnDisabled.reserve(nSampleCount);
  m_vpSampleEnabled.reserve(nSampleCount);
  m_vpSampleDisabled.reserve(nSampleCount);
  for(itr = pvpSamples->begin();
    itr != pvpSamples->end();
    ++itr)
  {
    n++;
    pSample = *itr;
    if(!pSample->IsSampleType()) {}
    else if(pSample->IsEnabled())
    {
      m_vnEnabled.push_back(n);
      m_vpSampleEnabled.push_back(pSample);
    }
    else
    {
      m_vnDisabled.push_back(n);
      m_vpSampleDisabled.push_back(pSample);
    }
  }
  if(HasSamples())
  {
    wxBoxSizer *pSizer = new wxBoxSizer(wxVERTICAL);
    wxWindow *pWindowTop(NULL);
    int nSizeTOP = wxALIGN_LEFT | wxALL;
    bool bEnable = false;
    if(m_vpSampleEnabled.empty())
    {
      pWindowTop = new wxStaticText(this,wxID_ANY,g_psEnable);
      bEnable = true;
      SetTitle(g_psEnable);
    }
    else if(m_vpSampleDisabled.empty())
    {
      pWindowTop = new wxStaticText(this,wxID_ANY,g_psDisable);
    }
    else
    {
      const wxChar *pChoices[2] = {g_psDisable,g_psEnable};
      wxArrayString choices(2,pChoices);
      m_pCombo = new wxComboBox(this,wxID_ANY,"",
        wxDefaultPosition, wxDefaultSize, choices,wxCB_READONLY);
      pWindowTop = m_pCombo;
      m_pCombo->SetSelection(0);
      nSizeTOP = wxALL | wxEXPAND;
    }
    m_pListBox = new wxListBox(
      this,wxID_ANY,wxDefaultPosition, wxSize(-1,200),
      0,NULL, wxLB_EXTENDED | wxLB_NEEDED_SB);
    m_pReview = new CEnableDisableMultiple(this);
    m_pPanelUser = new CPanelUserID(
      this,wxID_ANY,wxID_ANY,m_pReview,
      UID_BTN_OK | UID_BTN_CANCEL | 
      UID_SPACER_BTN_RIGHT | UID_SEND_BTN_EVENTS,
      !bAllowUserNameOverride);
    m_pPanelUser->Enable(false);
    pSizer->Add(pWindowTop,0,nSizeTOP,ID_BORDER);
    pSizer->Add(m_pListBox,1,(wxALL ^ wxTOP) | wxEXPAND,ID_BORDER);
    pSizer->Add(m_pPanelUser,0,(wxALL ^ wxTOP) | wxEXPAND, ID_BORDER);
    SetSizer(pSizer);
    pSizer->Layout();
    _SetupList(bEnable);
    CentreOnParent();
#ifdef __WXMAC__
    Fit();
#endif
  }
}
Beispiel #6
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);
  }
}
Beispiel #7
0
bool CGridCMF::TransferDataFromGrid(
  const wxString &sDefaultSpecimen,
  COARsample2CMFSpecimen *pMap,
  vector<wxString> *pMsgs)
{

  wxString s;
  wxString sMsg;
  size_t nRows = m_vpSample.size();
  size_t i;
  COARsample *pSample;
  nwxXmlCMFSpecimen *pCMFSpecimen;
  bool bRtn = true;
  bool bExclude;

  for(i = 0; i < nRows; i++)
  {
    bExclude = GetBoolValue((int)i,EXCLUDE);
    pSample = m_vpSample.at(i);
    pCMFSpecimen = pMap->Find(pSample);
    if(pCMFSpecimen == NULL)
    {
      if(!bExclude)
      {
        bRtn = false;
        s = GetCellValue((int)i,SAMPLE);
        if(s.IsEmpty())
        {
          s = pSample->GetName();
        }
        sMsg = "Internal error:\nCannot find specimen, ";
        sMsg.Append(s);
        sMsg.Append(", in CMF file");
        pMsgs->push_back(sMsg);
      }
    }
    else if(bExclude)
    {
      pCMFSpecimen->SetExclude(true);
    }
    else
    {
      pCMFSpecimen->SetExclude(false);
      s = GetCellValue((int)i,SAMPLE);
      if( (!s.IsEmpty()) && (s != pSample->GetName()) )
      {
        pCMFSpecimen->SetSpecimenID(s);
      }
      s = GetCellValue((int)i,SPECIMEN_TYPE);
      if(s.IsEmpty() || !s.Cmp(DEFAULT))
      {
        s = sDefaultSpecimen;
      }
      pCMFSpecimen->SetSpecimenCategory(s);
      s = GetCellValue((int)i,SOURCE_ID);
      if(!s.IsEmpty())
      {
        pCMFSpecimen->SetSourceID(s);
      }
      s = GetCellValue((int)i,CASE_ID);
      if(!s.IsEmpty())
      {
        pCMFSpecimen->SetCaseID(s);
      }
      s = GetCellValue((int)i,COMMENT);
      if(!s.IsEmpty())
      {
        pCMFSpecimen->SetSpecimenComment(s);
      }
      pCMFSpecimen->SetPartial(GetBoolValue((int)i,PARTIAL));
    }
  }
  return bRtn;
}
Beispiel #8
0
void CGridCMF::UpdateEmptyLoci()
{
  size_t nRows = m_vpSample.size();
  if(nRows)
  {
    wxFont fnBold = GetDefaultCellFont();
    wxString sEmptyLoci;
    wxString COMMA(", ");
    size_t i;
    size_t j;
    size_t nLocusCount;
    bool bPartial;
    bool bEmpty;
    COARlocus *pLocus;
    COARsample *pSample;
    fnBold.SetWeight(wxFONTWEIGHT_BOLD);

    if(m_vsLocus.empty())
    {
        // setup locus names

      size_t nChannelCount = m_pFile->GetChannelCount();
      size_t nLocusCount;
      const COARchannel *pChannel;

      m_vsLocus.reserve(24);
      for(i = 0; i < nChannelCount; i++)
      {
        pChannel = m_pFile->GetChannel(i);
        nLocusCount = pChannel->GetLocusCount();
        for(j = 0; j < nLocusCount; j++)
        {
          m_vsLocus.push_back(pChannel->GetLocusName(j));
        }
      }
    }

    nLocusCount = m_vsLocus.size();
    for(i = 0; i < nRows; i++)
    {
      // now look for empty loci
      bPartial = false;
      bEmpty = true;
      sEmptyLoci.Empty();
      pSample = m_vpSample.at(i);
      for(j = 0; j < nLocusCount; j++)
      {
        pLocus = pSample->FindLocus(m_vsLocus.at(j));
        if( (pLocus == NULL) ||
            (!pLocus->EnabledAlleleCount()) )
        {
          // this is an empty locus

          if(!sEmptyLoci.IsEmpty())
          {
            sEmptyLoci.Append(COMMA);
          }
          sEmptyLoci.Append(pLocus->GetName());
          bPartial = true;
        }
        else
        {
          bEmpty = false;
        }
      }
      if(bEmpty)
      {
        SetBoolValue((int)i,EXCLUDE,bEmpty);
        sEmptyLoci = "ALL LOCI";
        SetCellFont((int)i,EMPTY_LOCI,fnBold);
      }
      else
      {
        //
        // may need to be restored if user pressed
        // 'finish later' and then edited alleles
        //
        SetCellFont((int)i,EMPTY_LOCI,GetDefaultCellFont());
      }
      SetCellValue((int)i,EMPTY_LOCI,sEmptyLoci);
      if(bPartial)
      {
        SetBoolValue((int)i,PARTIAL,bPartial);
      }
      DisableEditRow((int) i,bEmpty);
      SetReadOnly((int)i,EMPTY_LOCI,true);
    }
    AutoSizeColumn(EMPTY_LOCI,false);
  }
}
Beispiel #9
0
bool CGridCMF::TransferDataToGrid()
{
  size_t n = m_vpSample.size();
  bool bRtn = (n > 0);
  if(bRtn)
  {

    // loop through samples

    const CLabSettings &lab(m_pFile->GetLabSettings());
    wxString sName;
    wxString sCat;
    COARsample *pSample;
    const CLabNameStrings *pNameStr;
    size_t i;

    for(i = 0; i < n; i++)
    {
      pSample = m_vpSample.at(i);

      // sample name and category

      sName = pSample->GetName();
      pNameStr = lab.GetLabStrings();
      if(pNameStr == NULL)
      {
        sCat = DEFAULT;
      }
      else
      {
        sCat = pNameStr->GetCategory(sName);
        if(sCat.IsEmpty())
        {
          sCat = DEFAULT;
        }
      }


      // now set cell values

      SetBoolValue((int)i,EXCLUDE,false);
      SetCellValue((int)i,SPECIMEN_TYPE,sCat);
      SetCellValue((int)i,SAMPLE,pSample->GetName());
      SetTextLength((int)i,SAMPLE,nwxXmlCMFSpecimen::LEN_SPECIMEN_ID);
      SetTextLength((int)i,SOURCE_ID,nwxXmlCMFSpecimen::LEN_SOURCE_ID);
      SetTextLength((int)i,CASE_ID,nwxXmlCMFSpecimen::LEN_CASE_ID);
      SetTextLength((int)i,COMMENT,nwxXmlCMFSpecimen::LEN_SPECIMEN_COMMENT);
    }
    UpdateEmptyLoci();
    nwxGrid::UpdateLabelSizes(this);
    AutoSizeColumn(EXCLUDE);
    AutoSizeColumn(SAMPLE);
    AutoSizeColumn(PARTIAL);

    // compute size of SPECIMENT_TYPE columns
    int nWidth = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
    const char *ps = CLabSpecimenCategory::LongestType();
    wxClientDC dc(this);
    dc.SetFont(GetDefaultCellFont());
    wxSize sz = dc.GetTextExtent(ps);
    if(!nWidth)
    {
      nWidth = 20;
    }
    nWidth += sz.GetWidth();
    nWidth += 6;
    SetColSize(SPECIMEN_TYPE,nWidth);
    sz = dc.GetTextExtent(
      "This is sample text to determine the width of the comment column.");
    nWidth = sz.GetWidth();
    nWidth += 2;
    SetColSize(COMMENT,nWidth);
  }
  return bRtn;
}