Exemplo n.º 1
0
  void MOPACInputDialog::setTheory(int n)
  {
    switch (n)
      {
      case 0:
        m_theoryType = AM1;
        break;
      case 1:
        m_theoryType = MNDO;
        break;
      case 2:
        m_theoryType = MNDOD;
        break;
      case 3:
        m_theoryType = PM3;
        break;
      case 5:
        m_theoryType = RM1;
        break;
      case 4:
      default:
        m_theoryType = PM6;
      }

    updatePreviewText();
  }
void AStylePreferences::indentChanged()
{
    if(!m_enableWidgetSignals)
        return;
    
    switch(cbIndentType->currentIndex()) {
        case INDENT_TABS:
            m_formatter->setTabIndentation(inpNuberSpaces->value(), false);
            chkConvertTabs->setEnabled(false);
            break;
        case INDENT_TABSFORCE:
            m_formatter->setTabIndentation(inpNuberSpaces->value(), true);
            chkConvertTabs->setEnabled(false);
            break;
        case INDENT_SPACES:
            m_formatter->setSpaceIndentation(inpNuberSpaces->value());
            chkConvertTabs->setEnabled(true);
            break;
    }
    
    m_formatter->setTabSpaceConversionMode( chkConvertTabs->isEnabled() & chkConvertTabs->isChecked() );
    m_formatter->setFillEmptyLines( chkFillEmptyLines->isChecked() );

    updatePreviewText();
}
void AStylePreferences::minMaxValuesChanged()
{
    if(!m_enableWidgetSignals)
        return;
    m_formatter->setMaxInStatementIndentLength(inpMaxStatement->value());
    m_formatter->setMinConditionalIndentLength(inpMinConditional->value());

    updatePreviewText();
}
void AStylePreferences::onelinersChanged()
{
    if(!m_enableWidgetSignals)
        return;
    m_formatter->setSingleStatementsMode(!chkKeepStatements->isChecked());
    m_formatter->setBreakOneLineBlocksMode(!chkKeepBlocks->isChecked());

    updatePreviewText();
}
void AStylePreferences::load(const KDevelop::SourceFormatterStyle &style)
{
    if(!style.content().isEmpty())
        m_formatter->loadStyle(style.content());
    else
        m_formatter->predefinedStyle(style.name());

    updateWidgets();
    updatePreviewText();
}
Exemplo n.º 6
0
void DrawTextTool::setPreviewLetter()
{
	if (!preview_text)
	{
		preview_text = new TextObject(drawing_symbol);
	}
	
	preview_text->setText(static_cast<const TextSymbol*>(drawing_symbol)->getIconText());
	preview_text->setAnchorPosition(cur_pos_map);
	updatePreviewText();
}
void AStylePreferences::blocksChanged()
{
    if(!m_enableWidgetSignals)
        return;
    m_formatter->setBreakBlocksMode(chkBlockBreak->isChecked());
    m_formatter->setBreakClosingHeaderBlocksMode(chkBlockBreakAll->isChecked());
    m_formatter->setBreakElseIfsMode(chkBlockIfElse->isChecked());

    chkBlockBreakAll->setEnabled(chkBlockBreak->isChecked());

    updatePreviewText();
}
Exemplo n.º 8
0
 void MOPACInputDialog::setCoords(int n)
 {
   switch (n)
     {
     case 0:
       m_coordType = CARTESIAN;
       break;
     case 1:
       m_coordType = ZMATRIX;
       break;
     default:
       m_coordType = CARTESIAN;
     }
   updatePreviewText();
 }
void AStylePreferences::bracketsChanged()
{
    if(!m_enableWidgetSignals)
        return;
    switch(cbBrackets->currentIndex()) {
        case BRACKET_NOCHANGE: m_formatter->setBracketFormatMode(astyle::NONE_MODE); break;
        case BRACKET_ATTACH: m_formatter->setBracketFormatMode(astyle::ATTACH_MODE); break;
        case BRACKET_BREAK: m_formatter->setBracketFormatMode(astyle::BREAK_MODE); break;
        case BRACKET_LINUX: m_formatter->setBracketFormatMode(astyle::BDAC_MODE); break;
    }

    m_formatter->setBreakClosingHeaderBracketsMode(chkBracketsCloseHeaders->isChecked());

    updatePreviewText();
}
Exemplo n.º 10
0
 void MOPACInputDialog::setCalculation(int n)
 {
   switch (n)
     {
     case 0:
       m_calculationType = SP;
       break;
     case 2:
       m_calculationType = FREQ;
       break;
     case 1:
     default:
       m_calculationType = OPT;
     }
   updatePreviewText();
 }
Exemplo n.º 11
0
bool DrawTextTool::mouseReleaseEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget)
{
	if (text_editor)
	{
		if (text_editor->mouseReleaseEvent(event, map_coord, widget))
			return true;
		else
		{
			cur_pos = event->pos();
			cur_pos_map = map_coord;
			finishEditing();
			return true;
		}
	}
	
	if (event->button() != Qt::LeftButton)
		return false;
	
	if (dragging)
	{
		// Create box text
		double width = qAbs(cur_pos_map.x() - click_pos_map.x());
		double height = qAbs(cur_pos_map.y() - click_pos_map.y());
		auto midpoint = MapCoord { 0.5 * (cur_pos_map + click_pos_map) };
		preview_text->setBox(midpoint.nativeX(), midpoint.nativeY(), width, height);
		
		dragging = false;
		updateDirtyRect();
	}
	else
		setPreviewLetter();
	
	preview_text->setText("");

	// Create the TextObjectEditor
	text_editor = new TextObjectEditorHelper(preview_text, editor);
	connect(text_editor, SIGNAL(selectionChanged(bool)), this, SLOT(selectionChanged(bool)));
	
	updatePreviewText();
	updateStatusText();
	
	return true;
}
void AStylePreferences::indentObjectsChanged(QListWidgetItem *item)
{
    if(!m_enableWidgetSignals)
        return;
    if(!item)
        return;

    bool checked = (item->checkState() == Qt::Checked);
    switch(listIdentObjects->row(item)) {
        case INDENT_BLOCK: m_formatter->setBlockIndent(checked); break;
        case INDENT_BRACKET: m_formatter->setBracketIndent(checked); break;
        case INDENT_CASE: m_formatter->setCaseIndent(checked); break;
        case INDENT_CLASS: m_formatter->setClassIndent(checked); break;
        case INDENT_LABEL: m_formatter->setLabelIndent(checked); break;
        case INDENT_NAMESPACE: m_formatter->setNamespaceIndent(checked); break;
        case INDENT_PREPROCESSOR: m_formatter->setPreprocessorIndent(checked); break;
        case INDENT_SWITCH: m_formatter->setSwitchIndent(checked); break;
    }

    updatePreviewText();
}
void AStylePreferences::paddingChanged()
{
    if(!m_enableWidgetSignals)
        return;
    switch(cbParenthesisPadding->currentIndex()) {
        case PADDING_NOCHANGE:
            m_formatter->setParensUnPaddingMode(false);
            m_formatter->setParensInsidePaddingMode(false);
            m_formatter->setParensOutsidePaddingMode(false);
            break;
        case PADDING_NO:
            m_formatter->setParensUnPaddingMode(true);
            m_formatter->setParensInsidePaddingMode(false);
            m_formatter->setParensOutsidePaddingMode(false);
            break;
        case PADDING_IN:
            m_formatter->setParensUnPaddingMode(true);
            m_formatter->setParensInsidePaddingMode(true);
            m_formatter->setParensOutsidePaddingMode(false);
            break;
        case PADDING_OUT:
            m_formatter->setParensUnPaddingMode(true);
            m_formatter->setParensInsidePaddingMode(false);
            m_formatter->setParensOutsidePaddingMode(true);
            break;
        case PADDING_INOUT:
            m_formatter->setParensUnPaddingMode(true);
            m_formatter->setParensInsidePaddingMode(true);
            m_formatter->setParensOutsidePaddingMode(true);
            break;
    }

    m_formatter->setOperatorPaddingMode(chkPadOperators->isChecked());

    updatePreviewText();
}
Exemplo n.º 14
0
 void MOPACInputDialog::enableFormClicked()
 {
   updatePreviewText();
 }
Exemplo n.º 15
0
void DrawTextTool::selectionChanged(bool text_change)
{
	Q_UNUSED(text_change);
	preview_text->setOutputDirty(); // TODO: Check if neccessary here.
	updatePreviewText();
}
Exemplo n.º 16
0
 void MOPACInputDialog::setMultiplicity(int n)
 {
   m_multiplicity = n + 1;
   updatePreviewText();
 }
Exemplo n.º 17
0
 void MOPACInputDialog::setTitle()
 {
   m_title = ui.titleLine->text();
   updatePreviewText();
 }
void AStylePreferences::currentTabChanged()
{
    updatePreviewText(false);
}
Exemplo n.º 19
0
 void MOPACInputDialog::setCharge(int n)
 {
   m_charge = n;
   updatePreviewText();
 }