Beispiel #1
0
void MyStringTable::resizeEvent(QResizeEvent * event)
{
    int w = event->size().width();

    if(ColCount()>0)
    {
        int ws = w / ColCount();
        int ns;
        int ww = 0;
        int nn = 0;

        for(ns=0;ns<ColCount();ns++)
        {
            ws = ColWidth(ns);
            if(ws>0) ww += ws;
            else     nn++;
        }

        if(nn>0)
        {
            ww = (w - ww) / nn; if(ww<10) ww=10;
        }

        for(ns=0;ns<ColCount();ns++)
        {
            ws = ColWidth(ns);
            if(ws<1) ws = ww;
            horizontalHeader()->resizeSection(ns,ws);
        }
    }
    QTableView::resizeEvent(event);
}
Beispiel #2
0
void MyStringTable::setTag(int r, int c, int v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    _rows[r].cells[c].tag = v;
}
Beispiel #3
0
QString MyStringTable::Data(int r, int c)
{
    if(r<0 || r>=RowCount()) return QString();
    if(c<0 || c>=ColCount()) return QString();

    return _rows[r].cells[c].data;
}
Beispiel #4
0
int MyStringTable::Check(int r, int c)
{
    if(r<0 || r>=RowCount()) return 4;
    if(c<0 || c>=ColCount()) return 4;

    return _rows[r].cells[c].check;
}
Beispiel #5
0
void MyStringTable::setCellColor(int r, int c, QColor v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    _rows[r].cells[c].color = v; //_model->updateRow(r);
}
Beispiel #6
0
bool MyStringTable::CellEdit(int r, int c)
{
    if(r<0 || r>=RowCount()) return false;
    if(c<0 || c>=ColCount()) return false;

    return _rows[r].cells[c].edit;
}
Beispiel #7
0
QColor MyStringTable::CellColor(int r, int c)
{
    if(r<0 || r>=RowCount()) return QColor();
    if(c<0 || c>=ColCount()) return QColor();

    return _rows[r].cells[c].color;
}
Beispiel #8
0
void MyStringTable::setImgName(int r, int c, QString v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    _rows[r].cells[c].imgnm = v; //_model->updateRow(r);
}
Beispiel #9
0
QString MyStringTable::ImgName(int r, int c)
{
    if(r<0 || r>=RowCount()) return "";
    if(c<0 || c>=ColCount()) return "";

    return _rows[r].cells[c].imgnm;
}
Beispiel #10
0
void MyStringTable::setData(int r, int c, QString v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    _rows[r].cells[c].data = v;
}
Beispiel #11
0
int MyStringTable::Tag(int r, int c)
{
    if(r<0 || r>=RowCount()) return -1;
    if(c<0 || c>=ColCount()) return -1;

    return _rows[r].cells[c].tag;
}
Beispiel #12
0
void MyStringTable::setCheck(int r, int c, int v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    //_rows[r].cells[c].check = v; //_model->updateRow(r);
    _model->setData(_model->index(r,c),v,Qt::CheckStateRole);
}
Beispiel #13
0
void MyStringTable::setCell(int r, int c, QString v)
{
    if(r<0 || r>=RowCount()) return;
    if(c<0 || c>=ColCount()) return;

    //_rows[r].cells[c].text = v;  //_model->updateRow(r);
    _model->setData(_model->index(r,c),v,Qt::EditRole);
}
Beispiel #14
0
void MyStringTable::setRowCount(int v, bool reset)
{
    int n;

    _model->beginResetModel();

    _rows.resize(v);

    for(n=0;n<_rows.count();n++) _rows[n].cells.resize(ColCount());

    if(reset) _model->endResetModel();

}
Beispiel #15
0
QString MyStringTable::Cell(int r, int c)
{
    if(r<0 || r>=RowCount()) return "";
    if(c<0 || c>=ColCount()) return "";


    int rc = receivers(SIGNAL(cellDataRequest(int, int, QString&)));
    if(rc<1) return _rows[r].cells[c].text;

    QString v;

    emit cellDataRequest(r,c,v);

    return  v;
}
Beispiel #16
0
bool ON_Matrix::Transpose()
{
  bool rc = false;
  int i, j;
  double t;
  const int row_count = RowCount();
  const int col_count = ColCount();
  if ( row_count > 0 && col_count > 0 ) 
  {
    double** this_m = ThisM();
    if ( row_count == col_count )
    {
      rc = true;
      for ( i = 0; i < row_count; i++ ) for ( j = i+1; j < row_count; j++ )
      {
        t = this_m[i][j]; this_m[i][j] = this_m[j][i]; this_m[j][i] = t;
      }
    }
    else if ( this_m == m_rowmem.Array() )
    {
      ON_Matrix A(*this);
      rc = Create(col_count,row_count) 
           && m_row_count == A.ColCount()
           && m_col_count == A.RowCount();
      if (rc)
      {
        double const*const* Am = A.ThisM();
  		  this_m = ThisM(); // Create allocates new memory
        for ( i = 0; i < row_count; i++ ) for ( j = 0; j < col_count; j++ ) 
        {
          this_m[j][i] = Am[i][j];
        }
        m_row_offset = A.m_col_offset;
        m_col_offset = A.m_row_offset;
      }
      else
      {
        // attempt to put values back
        *this = A;
      }
    }
  }
  return rc;
}
Beispiel #17
0
bool CLimnStream::ExchangeDataFields()
  {
  switch (DX.Handle)
    {
    case idx_OreSolidsFlow      : DX.Double = GetResult(0)/(3.6);                 return true;
    case idx_PassingSize0       : DX.Double = GetResult(1)*0.001;                 return true;
    case idx_PassingSize1       : DX.Double = GetResult(2)*0.001;                 return true;
    case idx_PassingSize2       : DX.Double = GetResult(3)*0.001;                 return true;
    case idx_MeanSG             : DX.Double = GetResult(4)*1000;                  return true;
    case idx_MeanSize           : DX.Double = GetResult(5)*0.001;                 return true;
    case idx_WaterFlow          : DX.Double = GetResult(6)/(3.6);                 return true;
    case idx_SolidsFrac         : DX.Double = GetResult(7)*0.01;                  return true;
    case idx_PulpSG             : DX.Double = GetResult(8)*1000;                  return true;
    case idx_FeSiFlow           : DX.Double = GetResult(9)/(3.6);                 return true;
    case idx_DiamondFlow        : DX.Double = GetResult(10)/(5000.0*1000*3.6);    return true;
    case idx_DiamondAssay       : DX.Double = GetResult(11)*5000*1000*100;        return true;
    case idx_LiberatedFlow      : DX.Double = GetResult(12)/(5000.0*1000*3.6);    return true;
    case idx_RelativeDiamonds   : DX.Double = GetResult(13)/100;                  return true;
    case idx_LiberatedFraction  : DX.Double = GetResult(14)*0.01;                 return true;
    case idx_RelativeRevenue    : DX.Double = GetResult(15)/100;                  return true;
    case idx_Revenue            : DX.Double = GetResult(16)/3600.0;               return true;

    case idx_BaseTag:
      DX.String=sm_sBaseTag;
      return true;
    case idx_BaseMark:
      if (DX.HasReqdValue)
        {
        if (DX.Bool)
          sm_sBaseTag=Tag;
        else if (DX.ForView)
          sm_sBaseTag="";
        }
      DX.Bool=sm_sBaseTag.CompareNoCase(Tag)==0;
      return true;

    case idx_BaseDiamondFlow     : DX.Double = sm_BaseCarats/(5000.0*1000*3.6);    return true;
    case idx_BaseRevenue         : DX.Double = sm_BaseRevenue/3600.0;              return true;

    case idx_CopySummary        : 
      {
      if (DX.HasReqdValue && DX.Bool)
        {
        CString Buff, V;
        for (int i=0; i<17; i++)
          {
          V.Format("%.12f\r\n", GetResult(i));
          Buff+=V;
          }
        CopyTextToClipboard(Buff);
        }
      DX.Bool =  false;
      return true;
      }

    case idx_CopyFractional     : 
    case idx_CopyMass           : 
      {
      if (DX.HasReqdValue && DX.Bool)
        {
        if (DX.Handle==idx_CopyMass)
          ConvertToMassForm(Vector);
        CString Buff, V;
        for (int r=0; r<RowCount(); r++)
          {
          for (int c=0; c<ColCount(); c++)
            {
            V.Format(c>0?"\t%.12f":"%.12f", m_Data[c+ColCount()*r]);
            Buff+=V;
            }
          Buff+="\r\n";
          }
        CopyTextToClipboard(Buff);
        if (DX.Handle==idx_CopyMass)
          ConvertToFracForm(Vector);
        }
      DX.Bool =  false;
      return true;
      }
    case idx_Calculate      :
      if (DX.HasReqdValue)
        {
        m_bCalculate = DX.Bool;
        if (m_bCalculate && m_pFeed==NULL)
          {
          m_pFeed=new CFeed;
          ReadData();
          }
        }
      DX.Bool = m_bCalculate;
      return true;
    case idx_Source         : 
      if (DX.HasReqdValue)
        m_pFeed->m_iSource = DX.Long;
      DX.Long   = m_pFeed->m_iSource;  
      return true;
    case idx_SrcName        : 
      if (DX.HasReqdValue)
        {
        m_pFeed->m_sSrcName = DX.String;
        ReadData();
        }
      DX.String = m_pFeed->m_sSrcName; 
      return true;
    case idx_SrcLoad        : 
      if (DX.HasReqdValue && DX.Bool)
        ReadData();
      return true;
    }
  return false;
  };
Beispiel #18
0
bool MyStringTable::ColEdit(int c)
{
    if(c<0 || c>=ColCount()) return false;
    return _cols[c].edit;
}
Beispiel #19
0
void MyStringTable::setColEdit(int c, bool v)
{
    if(c<0 || c>=ColCount()) return;
    _cols[c].edit = v;
}
Beispiel #20
0
static irqreturn_t cirrus_interrupt(int irq, void *id)
{
	struct net_device *dev = (struct net_device *) id;
	cirrus_t *priv;
	u16 status;

	if (dev->priv == NULL) {
		return IRQ_NONE;
	}

	priv = (cirrus_t *) dev->priv;

	while ((status = cirrus_read (dev,PP_ISQ))) {
		switch (RegNum (status)) {
		case RxEvent:
			cirrus_receive (dev);
			break;

		case TxEvent:
			priv->stats.collisions += ColCount (cirrus_read (dev,PP_TxCOL));
			if (!(RegContent (status) & TxOK)) {
				priv->stats.tx_errors++;
				if ((RegContent (status) & Out_of_window)) priv->stats.tx_window_errors++;
				if ((RegContent (status) & Jabber)) priv->stats.tx_aborted_errors++;
				break;
			} else if (priv->txlen) {
				priv->stats.tx_packets++;
				priv->stats.tx_bytes += priv->txlen;
			}
			priv->txlen = 0;
			netif_wake_queue (dev);
			break;

		case BufEvent:
			if ((RegContent (status) & RxMiss)) {
				u16 missed = MissCount (cirrus_read (dev,PP_RxMISS));
				priv->stats.rx_errors += missed;
				priv->stats.rx_missed_errors += missed;
			}
			if ((RegContent (status) & TxUnderrun)) {
				priv->stats.tx_errors++;
				priv->stats.tx_fifo_errors++;
			}
			/* FIXME: if Rdy4Tx, transmit last sent packet (if any) */
			priv->txlen = 0;
			netif_wake_queue (dev);
			break;

		case TxCOL:
			priv->stats.collisions += ColCount (cirrus_read (dev,PP_TxCOL));
			break;

		case RxMISS:
			status = MissCount (cirrus_read (dev,PP_RxMISS));
			priv->stats.rx_errors += status;
			priv->stats.rx_missed_errors += status;
			break;
		default:
			return IRQ_HANDLED;
		}
	}

	return IRQ_HANDLED;
}
Beispiel #21
0
QString MyStringTable::ColLabel(int c)
{
    if(c<0 || c>=ColCount()) return "";

    return _cols[c].label;
}
Beispiel #22
0
void MyStringTable::setColLabel(int c, QString v)
{
    if(c<0 || c>=ColCount()) return;

    _cols[c].label=v;  update();
}
Beispiel #23
0
int MyStringTable::ColWidth(int c)
{
    if(c<0 || c>=ColCount()) return false;

    return _cols[c].width;
}
Beispiel #24
0
void MyStringTable::setColWidth(int c, int v)
{
    if(c<0 || c>=ColCount()) return;

    _cols[c].width=v;  update();
}
Beispiel #25
0
bool MyStringTable::ColChkbx(int c)
{
    if(c<0 || c>=ColCount()) return false;

    return _cols[c].chkbx;
}
Beispiel #26
0
void MyStringTable::setColChkbx(int c, bool v)
{
    if(c<0 || c>=ColCount()) return;

    _cols[c].chkbx=v;  update();
}