Esempio n. 1
0
void
StageListView::setBatchProcessingInProgress(bool const in_progress)
{
	if (m_batchProcessingInProgress == in_progress) {
		return;
	}
	m_batchProcessingInProgress = in_progress;
	
	if (in_progress) {
		removeLaunchButton(selectedRow());
		updateRowSpans(); // Join columns.
		
		// Some styles (Oxygen) visually separate items in a selected row.
		// We really don't want that, so we pretend the items are not selected.
		// Same goes for hovered items.
		m_pFirstColDelegate->flagsForceDisabled(QStyle::State_Selected|QStyle::State_MouseOver);
		m_pSecondColDelegate->flagsForceDisabled(QStyle::State_Selected|QStyle::State_MouseOver);
		
		initiateBatchAnimationFrameRendering();
		m_timerId = startTimer(180);
	} else {
		updateRowSpans(); // Separate columns.
		placeLaunchButton(selectedRow());
		
		m_pFirstColDelegate->removeChanges(QStyle::State_Selected|QStyle::State_MouseOver);
		m_pSecondColDelegate->removeChanges(QStyle::State_Selected|QStyle::State_MouseOver);
		
		if (m_pModel) {
			m_pModel->disableBatchProcessingAnimation();
		}
		killTimer(m_timerId);
		m_timerId = 0;
	}
}
bool TypeParameterController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
    if (m_sequence) {
      Sequence::Type sequenceType = (Sequence::Type)selectedRow();
      if (m_sequence->type() != sequenceType) {
        m_listController->selectPreviousNewSequenceCell();
        m_sequence->setType(sequenceType);
        // Invalidate sequence context cache when changing sequence type
        static_cast<App *>(app())->localContext()->resetCache();
        // Reset the first index if the new type is "Explicit"
        if (sequenceType == Sequence::Type::Explicit) {
          m_sequence->setInitialRank(0);
        }
      }
      StackViewController * stack = stackController();
      assert(stack->depth()>2);
      stack->pop();
      stack->pop();
      return true;
    }
    Sequence * newSequence = static_cast<Sequence *>(m_sequenceStore->addEmptyModel());
    newSequence->setType((Sequence::Type)selectedRow());
    app()->dismissModalViewController();
    m_listController->editExpression(newSequence, 0, Ion::Events::OK);
    return true;
  }
  if (event == Ion::Events::Left && m_sequence) {
    stackController()->pop();
    return true;
  }
  return false;
}
Esempio n. 3
0
void CalculationController::didBecomeFirstResponder() {
  if (selectedRow() == -1) {
    selectCellAtLocation(1, 0);
  } else {
    selectCellAtLocation(selectedColumn(), selectedRow());
  }
  TabTableController::didBecomeFirstResponder();
}
Esempio n. 4
0
// public
kpToolWidgetFillStyle::FillStyle kpToolWidgetFillStyle::fillStyle () const
{
#if DEBUG_KP_TOOL_WIDGET_FILL_STYLE
    qCDebug(kpLogWidgets) << "kpToolWidgetFillStyle::fillStyle() selected="
                          << selectedRow ()
                          << endl;
#endif
    return (FillStyle) selectedRow ();
}
Esempio n. 5
0
void ListController::didBecomeFirstResponder() {
  if (selectedRow() == -1) {
    selectCellAtLocation(0, 0);
  } else {
    selectCellAtLocation(selectedColumn(), selectedRow());
  }
  if (selectedRow() >= numberOfRows()) {
    selectCellAtLocation(selectedColumn(), numberOfRows()-1);
  }
  footer()->setSelectedButton(-1);
  app()->setFirstResponder(selectableTableView());
}
Esempio n. 6
0
void
StageListView::setBatchProcessingPossible(bool const possible)
{
	if (m_batchProcessingPossible == possible) {
		return;
	}
	m_batchProcessingPossible = possible;
	
	if (possible) {
		placeLaunchButton(selectedRow());
	} else {
		removeLaunchButton(selectedRow());
	}
}
void LibrariesForm::on_installButton_clicked()
{
    int row = selectedRow();
    if (row == -1)
        return;
    install(librariesModel->get()[row]);
}
void LibrariesForm::on_downloadButton_clicked()
{
    int row = selectedRow();
    if (row == -1)
        return;
    download(librariesModel->get()[row]);
}
Esempio n. 9
0
TableView::ItemPos TableViewImpl::selectedItem() const
{
    TableView::ItemPos result;
    result.r = selectedRow();
    result.c = ListView_GetSelectedColumn(hWnd); // not sure
    return result;
}
Esempio n. 10
0
bool ListController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::Up && selectedRow() == -1) {
    footer()->setSelectedButton(-1);
    selectableTableView()->selectCellAtLocation(0, numberOfRows()-1);
    app()->setFirstResponder(selectableTableView());
    return true;
  }
  if (event == Ion::Events::Down) {
    if (selectedRow() == -1) {
      return false;
    }
    selectableTableView()->deselectTable();
    footer()->setSelectedButton(0);
    return true;
  }
  return handleEventOnExpression(event);
}
Esempio n. 11
0
void ValuesController::didBecomeFirstResponder() {
  EditableCellTableViewController::didBecomeFirstResponder();
  if (selectedRow() == -1) {
    selectableTableView()->deselectTable();
    header()->setSelectedButton(0);
  } else {
    header()->setSelectedButton(-1);
  }
}
bool PredictionParameterController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
    m_goToParameterController.setXPrediction(selectedRow() == 0);
    StackViewController * stack = (StackViewController *)parentResponder();
    stack->push(&m_goToParameterController);
    return true;
  }
  return false;
}
Esempio n. 13
0
bool ValuesController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::Down) {
    if (selectedRow() == -1) {
      header()->setSelectedButton(-1);
      selectableTableView()->selectCellAtLocation(0,0);
      app()->setFirstResponder(selectableTableView());
      return true;
    }
    return false;
  }

  if (event == Ion::Events::Up) {
    if (selectedRow() == -1) {
      header()->setSelectedButton(-1);
      app()->setFirstResponder(tabController());
      return true;
    }
    selectableTableView()->deselectTable();
    header()->setSelectedButton(0);
    return true;
  }
  if (event == Ion::Events::Backspace && selectedRow() > 0 &&
      (selectedRow() < numberOfRows()-1 || m_interval->numberOfElements() == Interval::k_maxNumberOfElements)) {
    m_interval->deleteElementAtIndex(selectedRow()-1);
    selectableTableView()->reloadData();
    return true;
  }
  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
    if (selectedRow() == -1) {
      return header()->handleEvent(event);
    }
    if (selectedRow() == 0) {
      if (selectedColumn() == 0) {
        configureAbscissa();
        return true;
      }
      configureFunction();
      return true;
    }
    return false;
  }
  if (selectedRow() == -1) {
    return header()->handleEvent(event);
  }
  return false;
}
bool CalculationTypeController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
    m_calculationController->setCalculationAccordingToIndex(selectedRow());
    m_calculationController->reload();
    app()->dismissModalViewController();
    return true;
  }
  if (event == Ion::Events::Back || event == Ion::Events::Right) {
    if (event == Ion::Events::Right) {
      m_calculationController->selectCellAtLocation(1,0);
    }
    app()->dismissModalViewController();
    return true;
  }
  return false;
}
void LibrariesForm::on_removeButton_clicked()
{
    int row = selectedRow();
    if (row == -1)
        return;
    auto library = librariesModel->get()[row];

    auto answer = QMessageBox::question(this, "Удаление библиотеки",
                                        "Вы уверены, что хотите удалить выбранную версию библиотеки?");
    if (answer != QMessageBox::Yes)
        return;

    if (row == 0)
        librariesModel->replaceCurrentLibrary(
                    Library::makeAbsent(Settings::instance().workingDir()));
    else
        librariesModel->removeRow(row);
    remove(library);
}
Esempio n. 16
0
void
StageListView::initiateBatchAnimationFrameRendering()
{
	if (!m_pModel || !m_batchProcessingInProgress) {
		return;
	}
	
	int const selected_row = selectedRow();
	if (selected_row == -1) {
		return;
	}
	
	m_pModel->updateBatchProcessingAnimation(
		selected_row, m_batchAnimationPixmaps[m_curBatchAnimationFrame]
	);
	if (++m_curBatchAnimationFrame == (int)m_batchAnimationPixmaps.size()) {
		m_curBatchAnimationFrame = 0;
	}
}
bool FunctionParameterController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
    switch (selectedRow()) {
      case 0:
      {
        m_cartesianFunction->setDisplayDerivative(!m_cartesianFunction->displayDerivative());
        m_selectableTableView.reloadData();
        return true;
      }
#if COPY_COLUMN
    case 1:
    /* TODO: implement function copy column */
      return true;
#endif
      default:
        assert(false);
        return false;
    }
  }
  return false;
}
Esempio n. 18
0
void PacmanView::keyPressEvent(QKeyEvent * event) {
    QTreeView::keyPressEvent(event);

    QModelIndex index = selectedRow();
    if (!index.isValid()) return;
    index = model->index(index.row(),model->columnCount()-1);
    QStyleOptionViewItem option;
    option.rect = visualRect(index);

    switch (event->key()) {
        case Qt::Key_Return:
        case Qt::Key_Enter:
        {
            QMouseEvent m_event(QEvent::MouseButtonRelease,option.rect.topLeft(),Qt::LeftButton,Qt::LeftButton,Qt::NoModifier);
            delegate->editorEvent(&m_event,model,option,index);
            break;
        }
        case Qt::Key_Right:
            delegate->editorEvent(event,model,option,index);
            break;
        default:
            break;
    }
}
Esempio n. 19
0
QColor WidgetColor::color () const
{
    return QColor(ColorTable1[selectedCol () + selectedRow () * 3]);
}
void PredictionParameterController::didBecomeFirstResponder() {
  if (selectedRow() < 0) {
    selectCellAtLocation(0, 0);
  }
  app()->setFirstResponder(&m_selectableTableView);
}
int kpToolWidgetLineWidth::lineWidth () const
{
    return lineWidths [selectedRow ()];
}
Esempio n. 22
0
void ListController::willDisplayCellForIndex(HighlightCell * cell, int index) {
  if (index != m_equationStore->numberOfModels()) {
    willDisplayExpressionCellAtIndex(cell, index);
  }
  cell->setHighlighted(index == selectedRow());
}
Esempio n. 23
0
WidgetColor::DrawPackage WidgetColor::drawFunctionData ( const QColor &color) const
{
    return drawFunctionDataForRowCol ( color, selectedRow (), selectedCol () );
}
Esempio n. 24
0
void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
  if (i == 0 && j == 0) {
    return;
  }
  EvenOddCell * myCell = (EvenOddCell *)cell;
  myCell->setEven(j%2 == 0);
  myCell->setHighlighted(i == selectedColumn() && j == selectedRow());

  // Calculation title
  if (i == 0) {
    if (j == numberOfRows()-1) {
      EvenOddExpressionCell * myCell = static_cast<EvenOddExpressionCell *>(cell);
      myCell->setExpressionLayout(m_r2Layout);
      return;
    }
    MarginEvenOddMessageTextCell * myCell = (MarginEvenOddMessageTextCell *)cell;
    myCell->setAlignment(1.0f, 0.5f);
    I18n::Message titles[k_totalNumberOfRows-1] = {I18n::Message::Mean, I18n::Message::Sum, I18n::Message::SquareSum, I18n::Message::StandardDeviation, I18n::Message::Deviation, I18n::Message::NumberOfDots, I18n::Message::Covariance, I18n::Message::Sxy, I18n::Message::Regression, I18n::Message::A, I18n::Message::B, I18n::Message::R, I18n::Message::Default};
    myCell->setMessage(titles[j-1]);
    return;
  }

  int seriesNumber = m_store->indexOfKthNonEmptySeries(i - 1);
  assert(i >= 0 && seriesNumber < DoublePairStore::k_numberOfSeries);

  // Coordinate and series title
  if (j == 0 && i > 0) {
    ColumnTitleCell * myCell = (ColumnTitleCell *)cell;
    char buffer[] = {'X', static_cast<char>('1' + seriesNumber), 0};
    myCell->setFirstText(buffer);
    buffer[0] = 'Y';
    myCell->setSecondText(buffer);
    myCell->setColor(Palette::DataColor[seriesNumber]);
    return;
  }

  // Calculation cell
  if (i > 0 && j > 0 && j <= k_totalNumberOfDoubleBufferRows) {
    ArgCalculPointer calculationMethods[k_totalNumberOfDoubleBufferRows] = {&Store::meanOfColumn, &Store::sumOfColumn, &Store::squaredValueSumOfColumn, &Store::standardDeviationOfColumn, &Store::varianceOfColumn};
    double calculation1 = (m_store->*calculationMethods[j-1])(seriesNumber, 0);
    double calculation2 = (m_store->*calculationMethods[j-1])(seriesNumber, 1);
    EvenOddDoubleBufferTextCellWithSeparator * myCell = (EvenOddDoubleBufferTextCellWithSeparator *)cell;
    char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
    PrintFloat::convertFloatToText<double>(calculation1, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
    myCell->setFirstText(buffer);
    PrintFloat::convertFloatToText<double>(calculation2, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
    myCell->setSecondText(buffer);
    return;
  }
  if (i > 0 && j == 9) {
    SeparatorEvenOddBufferTextCell * myCell = (SeparatorEvenOddBufferTextCell *)cell;
    myCell->setText("ax+b");
    return;
  }
  if (i > 0 && j > k_totalNumberOfDoubleBufferRows) {
    assert(j != 9);
    CalculPointer calculationMethods[k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows] = {&Store::doubleCastedNumberOfPairsOfSeries, &Store::covariance, &Store::columnProductSum, nullptr, &Store::slope, &Store::yIntercept, &Store::correlationCoefficient, &Store::squaredCorrelationCoefficient};
    double calculation = (m_store->*calculationMethods[j-k_totalNumberOfDoubleBufferRows-1])(seriesNumber);
    SeparatorEvenOddBufferTextCell * myCell = (SeparatorEvenOddBufferTextCell *)cell;
    char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
    PrintFloat::convertFloatToText<double>(calculation, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
    myCell->setText(buffer);
    return;
  }
}
Esempio n. 25
0
void ProposalTreeWidget::onSelectionChange()
{
	emit rowSelected( selectedRow() );
}