コード例 #1
0
ファイル: ctlSQLGrid.cpp プロジェクト: SokilV/pgadmin3
void ctlSQLGrid::OnMouseWheel(wxMouseEvent &event)
{
	if (event.ControlDown() || event.CmdDown())
	{
		wxFont fontlabel = GetLabelFont();
		wxFont fontcells = GetDefaultCellFont();
		if (event.GetWheelRotation() > 0)
		{
			fontlabel.SetPointSize(fontlabel.GetPointSize() - 1);
			fontcells.SetPointSize(fontcells.GetPointSize() - 1);
		}
		else
		{
			fontlabel.SetPointSize(fontlabel.GetPointSize() + 1);
			fontcells.SetPointSize(fontcells.GetPointSize() + 1);
		}
		SetLabelFont(fontlabel);
		SetDefaultCellFont(fontcells);
		SetColLabelSize(fontlabel.GetPointSize() * 4);
		SetDefaultRowSize(fontcells.GetPointSize() * 2);
		for (int index = 0; index < GetNumberCols(); index++)
			SetColSize(index, -1);
		ForceRefresh();
	}
	else
		event.Skip();
}
コード例 #2
0
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++;
  }
}
コード例 #3
0
ファイル: ctlVarWindow.cpp プロジェクト: Joe-xXx/pgadmin3
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" ));

}
コード例 #4
0
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

}
コード例 #5
0
ファイル: DataGrid.cpp プロジェクト: lasyard/HomeAccount
void DataGrid::setRow(int row)
{
	SetCellAlignment(wxALIGN_RIGHT, row, IncomeIndex);
	SetCellAlignment(wxALIGN_RIGHT, row, OutlayIndex);
	SetCellAlignment(wxALIGN_RIGHT, row, BalanceIndex);
	SetReadOnly(row, IncomeIndex, false);
	SetReadOnly(row, OutlayIndex, false);
	SetReadOnly(row, DescIndex, false);
	SetReadOnly(row, CommentIndex, false);
	SetReadOnly(row, BalanceIndex);
	SetCellEditor(row, IncomeIndex, new wxGridCellFloatEditor(MONEY_LEN, 2));
	SetCellEditor(row, OutlayIndex, new wxGridCellFloatEditor(MONEY_LEN, 2));
	clearRow(row);
	for (int i = 0; i < ColumnNum; i++) {
		SetCellFont(row, i, GetDefaultCellFont());
		SetCellTextColour(row, i, GetDefaultCellTextColour());
	}
}
コード例 #6
0
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);

}
コード例 #7
0
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));
}
コード例 #8
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();
}
コード例 #9
0
ファイル: CGridRFURunBase.cpp プロジェクト: ncbi/osiris
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();
}
コード例 #10
0
ファイル: CGridCMF.cpp プロジェクト: HelloWilliam/osiris
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);
  }
}
コード例 #11
0
ファイル: CGridCMF.cpp プロジェクト: HelloWilliam/osiris
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;
}