/* PaletteEntryPanel::handleAction * Handles the action [id]. Returns true if the action was handled, * false otherwise *******************************************************************/ bool PaletteEntryPanel::handleAction(string id) { // Ignore if hidden if (!isActivePanel()) return false; // Only interested in "ppal_" events if (!id.StartsWith("ppal_")) return false; // Add to custom palettes if (id == "ppal_addcustom") { addCustomPalette(); return true; } // Test palette else if (id == "ppal_test") { testPalette(); return true; } // Export As else if (id == "ppal_exportas") { exportAs(); return true; } // Import From else if (id == "ppal_importfrom") { importFrom(); return true; } // Generate Palettes if (id == "ppal_generate") { generatePalettes(); return true; } // Generate Colormaps if (id == "ppal_colormap") { generateColormaps(); return true; } // Colourise else if (id == "ppal_colourise") { colourise(); return true; } // Tint else if (id == "ppal_tint") { tint(); return true; } // Tweak else if (id == "ppal_tweak") { tweak(); return true; } // Invert else if (id == "ppal_invert") { invert(); return true; } // Move Up else if (id == "ppal_moveup") { move(true); return true; } // Move Down else if (id == "ppal_movedown") { move(false); return true; } // Duplicate else if (id == "ppal_duplicate") { duplicate(); return true; } // Remove else if (id == "ppal_remove") { clearOne(); return true; } // Remove Others else if (id == "ppal_removeothers") { clearOthers(); return true; } // Some debug/reverse engineering stuff else if (id == "ppal_report") { analysePalettes(); return true; } return false; }
Tabruler::Tabruler( QWidget* parent, bool haveFirst, int dEin, QList<ParagraphStyle::TabRecord> Tabs, double wid ) : QWidget( parent ), firstLineLabel(0), leftIndentLabel(0), rightIndentLabel(0), firstLineData(0), leftIndentData(0), rightIndentData(0) { docUnitRatio=unitGetRatioFromIndex(dEin); double ww = (wid < 0) ? 4000 : wid; tabrulerLayout = new QVBoxLayout( this ); tabrulerLayout->setMargin(0); tabrulerLayout->setSpacing(5); layout2 = new QHBoxLayout; layout2->setMargin(0); layout2->setSpacing(5); rulerScrollL = new QToolButton(this); rulerScrollL->setArrowType(Qt::LeftArrow); rulerScrollL->setAutoRepeat( true ); layout2->addWidget( rulerScrollL ); ruler = new RulerT( this, dEin, Tabs, haveFirst, wid ); ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); layout2->addWidget( ruler ); rulerScrollR = new QToolButton(this); rulerScrollR->setArrowType(Qt::RightArrow); rulerScrollR->setAutoRepeat( true ); layout2->addWidget( rulerScrollR ); layout1 = new QHBoxLayout; layout1->setMargin(0); layout1->setSpacing(5); layout1->setAlignment( Qt::AlignTop ); typeCombo = new QComboBox(this); typeCombo->setEditable(false); typeCombo->clear(); typeCombo->addItem( tr( "Left" ) ); typeCombo->addItem( tr( "Right" ) ); typeCombo->addItem( tr( "Period" ) ); typeCombo->addItem( tr( "Comma" ) ); typeCombo->addItem( tr( "Center" ) ); layout1->addWidget( typeCombo ); tabData = new ScrSpinBox( 0, ww / docUnitRatio, this, dEin ); tabData->setValue(0); positionLabel = new QLabel( tr("&Position:"), this ); positionLabel->setBuddy(tabData); layout1->addWidget( positionLabel ); layout1->addWidget( tabData ); tabFillCombo = new QComboBox(this); tabFillCombo->setEditable(false); tabFillCombo->addItem( tr("None", "tab fill")); tabFillCombo->addItem( tr("Dot")); tabFillCombo->addItem( tr("Hyphen")); tabFillCombo->addItem( tr("Underscore")); tabFillCombo->addItem( tr("Custom")); tabFillComboT = new QLabel( tr( "Fill Char:" ), this ); tabFillComboT->setBuddy(tabFillCombo); layout1->addWidget( tabFillComboT ); layout1->addWidget( tabFillCombo ); layout4 = new QHBoxLayout; layout4->setMargin(0); layout4->setSpacing(5); indentLayout = new QHBoxLayout; indentLayout->setMargin(0); indentLayout->setSpacing(5); if (haveFirst) { firstLineData = new ScrSpinBox( -3000, ww / docUnitRatio, this, dEin); firstLineData->setValue(0); firstLineLabel = new QLabel(this); firstLineLabel->setText(""); firstLineLabel->setPixmap(IconManager::instance()->loadPixmap("firstline.png")); indentLayout->addWidget( firstLineLabel ); indentLayout->addWidget( firstLineData ); leftIndentData = new ScrSpinBox( 0, ww / docUnitRatio, this, dEin ); leftIndentData->setValue(0); leftIndentLabel = new QLabel(this); leftIndentLabel->setText(""); leftIndentLabel->setPixmap(IconManager::instance()->loadPixmap("leftindent.png")); layout4->addWidget( leftIndentLabel ); layout4->addWidget( leftIndentData ); layout4->addStretch(10); rightIndentLabel = new QLabel(this); rightIndentLabel->setText(""); rightIndentLabel->setPixmap(IconManager::instance()->loadPixmap("rightindent.png")); rightIndentData = new ScrSpinBox(0, ww / docUnitRatio, this, dEin); rightIndentData->setValue(0); indentLayout->addWidget(rightIndentLabel); indentLayout->addWidget(rightIndentData); } clearButton = new QPushButton( this ); clearButton->setText( tr( "Delete All" ) ); indentLayout->addSpacing(20); indentLayout->addWidget( clearButton); clearOneButton = new QPushButton( this ); clearOneButton->setText( tr( "Delete Selected" ) ); indentLayout->addWidget( clearOneButton); indentLayout->addStretch(10); if (!haveFirst) { QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout1->addItem( spacer ); } layout1->addStretch( 10 ); tabrulerLayout->addLayout( layout1 ); tabrulerLayout->addLayout( layout2 ); indentLayout->addStretch( 10 ); tabrulerLayout->addLayout( indentLayout ); tabrulerLayout->addLayout(layout4); tabData->setEnabled(false); tabFillCombo->setEnabled(false); typeCombo->setEnabled(false); if (Tabs.count() == 0) clearButton->setEnabled(false); clearOneButton->setEnabled(false); resize( minimumSizeHint() ); connect(rulerScrollL, SIGNAL(clicked()), ruler, SLOT(decreaseOffset())); connect(rulerScrollR, SIGNAL(clicked()), ruler, SLOT(increaseOffset())); connect(rulerScrollL, SIGNAL(released()), this, SLOT(resetOFfL())); connect(rulerScrollR, SIGNAL(released()), this, SLOT(resetOFfR())); connect(ruler, SIGNAL(typeChanged(int)) , this, SLOT(setTabType(int))); connect(ruler, SIGNAL(fillCharChanged(QChar)) , this, SLOT(setTabFillChar(QChar))); connect(typeCombo, SIGNAL(activated(int)), this, SLOT(setType())); connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar())); connect(tabFillCombo, SIGNAL(editTextChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &))); connect(ruler, SIGNAL(tabMoved(double)) , this, SLOT(setTabData(double))); connect(ruler, SIGNAL(tabSelected()), this, SLOT(tabAdded())); connect(ruler, SIGNAL(newTab()), this, SLOT(tabAdded())); connect(ruler, SIGNAL(noTabs()), this, SLOT(lastTabRemoved())); connect(tabData, SIGNAL(valueChanged(double)), this, SLOT(setTab())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clearAll())); connect(clearOneButton, SIGNAL(clicked()), this, SLOT(clearOne())); tabFillCombo->setToolTip( tr( "Fill Character of Tab" ) ); typeCombo->setToolTip( tr( "Type/Orientation of Tab" ) ); tabData->setToolTip( tr( "Position of Tab" ) ); if (haveFirst) { connect(ruler, SIGNAL(firstLineMoved(double)) , this, SLOT(setFirstLineData(double))); connect(ruler, SIGNAL(leftIndentMoved(double)) , this, SLOT(setLeftIndentData(double))); connect(ruler, SIGNAL(mouseReleased()), this, SIGNAL(tabrulerChanged())); connect(ruler, SIGNAL(mouseReleased()), this, SLOT(slotMouseReleased())); connect(firstLineData, SIGNAL(valueChanged(double)), this, SLOT(setFirstLine())); connect(leftIndentData, SIGNAL(valueChanged(double)), this, SLOT(setLeftIndent())); connect(rightIndentData, SIGNAL(valueChanged(double)), this, SLOT(setRightIndent())); firstLineData->setToolTip( tr( "Indentation for first line of the paragraph" ) ); leftIndentData->setToolTip( tr( "Indentation from the left for the whole paragraph" ) ); rightIndentData->setToolTip( tr( "Indentation from the right for the whole paragraph" ) ); firstLineLabel->setToolTip(firstLineData->toolTip()); leftIndentLabel->setToolTip(leftIndentData->toolTip()); rightIndentLabel->setToolTip(rightIndentData->toolTip()); } clearButton->setToolTip( tr( "Delete all Tabulators" ) ); clearOneButton->setToolTip( tr("Delete selected Tabulator")); QString ein = unitGetSuffixFromIndex(dEin); if (dEin == 2) { if (haveFirst) { firstLineData->setDecimals(4); leftIndentData->setDecimals(4); rightIndentData->setDecimals(4); } tabData->setDecimals(4); } if (haveFirst) { firstLineData->setSuffix(ein); leftIndentData->setSuffix(ein); rightIndentData->setSuffix(ein); } tabData->setSuffix(ein); haveF = haveFirst; }