Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 1194 → Rev 1195

/branches/Version13x/Scribus/scribus/tabguides.cpp
15,11 → 15,109
#include "mspinbox.h"
#include "scribusstructs.h"
 
TabGuides::TabGuides( QWidget* parent, struct guidesPrefs *prefsData, double unitBase, QString unit) : QWidget( parent, "tabguide", 0 )
TabGuides::TabGuides( QWidget* parent, struct guidesPrefs *prefsData, struct typoPrefs *prefsData2, double unitBase, QString unit) : QWidget( parent, "tabguide", 0 )
{
tabGuidesLayout = new QVBoxLayout( this, 10, 5, "tabViewLayout");
 
commonBox = new QGroupBox( this, "commonBox" );
commonBox->setTitle( tr( "Common Settings" ) );
commonBox->setColumnLayout(0, Qt::Vertical );
commonBox->layout()->setSpacing( 5 );
commonBox->layout()->setMargin( 10 );
commonBoxLayout = new QHBoxLayout( commonBox->layout() );
 
buttonGroup1 = new QButtonGroup( commonBox, "buttonGroup1" );
buttonGroup1->setExclusive( true );
buttonGroup1->setColumnLayout(0, Qt::Horizontal );
buttonGroup1->layout()->setSpacing( 5 );
buttonGroup1->layout()->setMargin( 10 );
buttonGroup1->setTitle( tr( "Placing in Documents" ) );
buttonGroup1Layout = new QVBoxLayout( buttonGroup1->layout() );
buttonGroup1Layout->setAlignment( Qt::AlignTop );
inBackground = new QRadioButton( buttonGroup1, "inBackground" );
inBackground->setText( tr( "In the Background" ) );
buttonGroup1Layout->addWidget( inBackground );
inForeground = new QRadioButton( buttonGroup1, "inForeground" );
inForeground->setText( tr( "In the Foreground" ) );
buttonGroup1Layout->addWidget( inForeground );
inBackground->setChecked( prefsData->before );
inForeground->setChecked( !prefsData->before );
commonBoxLayout->addWidget( buttonGroup1 );
 
snapBox = new QGroupBox( commonBox, "snapBox" );
snapBox->setTitle( tr( "Snapping" ) );
snapBox->setColumnLayout(0, Qt::Vertical );
snapBox->layout()->setSpacing( 5 );
snapBox->layout()->setMargin( 10 );
snapBoxLayout = new QGridLayout( snapBox->layout() );
textLabel8 = new QLabel( snapBox, "textLabel8" );
textLabel8->setText( tr( "Snap Distance:" ) );
snapBoxLayout->addWidget( textLabel8, 0, 0 );
snapDistance = new MSpinBox( unitBase, 1000 * unitBase, snapBox, 2 );
snapDistance->setValue( prefsData->guideRad * unitBase );
snapDistance->setSuffix( unit );
snapBoxLayout->addWidget( snapDistance, 0, 1 );
textLabel82 = new QLabel( snapBox, "textLabel8" );
textLabel82->setText( tr( "Grab Radius:" ) );
snapBoxLayout->addWidget( textLabel82, 1, 0 );
grabDistance = new QSpinBox( snapBox, "grabDistance" );
grabDistance->setMaxValue( 1000 );
grabDistance->setMinValue( 1 );
grabDistance->setLineStep( 1 );
grabDistance->setValue( prefsData->grabRad );
grabDistance->setSuffix( tr( " px" ) );
snapBoxLayout->addWidget( grabDistance, 1, 1 );
commonBoxLayout->addWidget( snapBox );
tabGuidesLayout->addWidget( commonBox );
layout9 = new QHBoxLayout( 0, 0, 5, "layout9");
guideBox = new QGroupBox( this, "guideBox" );
guideBox->setTitle( tr( "Guides" ) );
guideBox->setColumnLayout(0, Qt::Vertical );
guideBox->layout()->setSpacing( 5 );
guideBox->layout()->setMargin( 10 );
guideBoxLayout = new QHBoxLayout( guideBox->layout() );
checkGuides = new QCheckBox( guideBox, "checkGuides" );
checkGuides->setText( tr( "Show Guides" ) );
checkGuides->setChecked(prefsData->guidesShown);
guideBoxLayout->addWidget( checkGuides );
guideColor = new QPushButton( guideBox, "guideColor" );
guideColor->setMinimumSize( QSize( 60, 20 ) );
guideColor->setMaximumSize( QSize( 60, 20 ) );
guideColor->setFlat( false );
guideColor->setAutoDefault( false );
QPixmap pm3 = QPixmap(54, 14);
pm3.fill(prefsData->guideColor);
colorGuides = prefsData->guideColor;
guideColor->setPixmap(pm3);
guideColor->setText( QString::null );
guideBoxLayout->addWidget( guideColor );
layout9->addWidget( guideBox );
marginBox = new QGroupBox( this, "guideBox" );
marginBox->setTitle( tr( "Margins" ) );
marginBox->setColumnLayout(0, Qt::Vertical );
marginBox->layout()->setSpacing( 5 );
marginBox->layout()->setMargin( 10 );
marginBoxLayout = new QHBoxLayout( marginBox->layout() );
checkMargin = new QCheckBox( marginBox, "checkMargin" );
checkMargin->setText( tr( "Show Margins" ) );
checkMargin->setChecked(prefsData->marginsShown);
marginBoxLayout->addWidget( checkMargin );
marginColor = new QPushButton( marginBox, "marginColor" );
marginColor->setMinimumSize( QSize( 60, 20 ) );
marginColor->setMaximumSize( QSize( 60, 20 ) );
marginColor->setAutoDefault( false );
QPixmap pm6 = QPixmap(54, 14);
pm6.fill(prefsData->margColor);
colorMargin = prefsData->margColor;
marginColor->setPixmap(pm6);
marginColor->setFlat( false );
marginColor->setText( QString::null );
marginBoxLayout->addWidget( marginColor );
layout9->addWidget( marginBox );
tabGuidesLayout->addLayout( layout9 );
 
checkGrid = new QGroupBox( this, "checkGrid" );
checkGrid->setTitle( tr( "Show Grid" ) );
checkGrid->setTitle( tr( "Show Page Grid" ) );
checkGrid->setCheckable( true );
checkGrid->setChecked(prefsData->gridShown);
checkGrid->setColumnLayout(0, Qt::Vertical );
86,59 → 184,19
groupBox2Layout->addWidget( minorSpace, 0, 1 );
checkGridLayout->addWidget( groupBox2, 0, 1 );
tabGuidesLayout->addWidget( checkGrid );
buttonGroup1 = new QButtonGroup( this, "buttonGroup1" );
buttonGroup1->setExclusive( true );
buttonGroup1->setColumnLayout(0, Qt::Vertical );
buttonGroup1->layout()->setSpacing( 5 );
buttonGroup1->layout()->setMargin( 10 );
buttonGroup1->setTitle( tr( "Placing of Guides" ) );
buttonGroup1Layout = new QHBoxLayout( buttonGroup1->layout() );
buttonGroup1Layout->setAlignment( Qt::AlignTop );
inBackground = new QRadioButton( buttonGroup1, "inBackground" );
inBackground->setText( tr( "In the Background" ) );
buttonGroup1Layout->addWidget( inBackground );
inForeground = new QRadioButton( buttonGroup1, "inForeground" );
inForeground->setText( tr( "In the Foreground" ) );
buttonGroup1Layout->addWidget( inForeground );
inBackground->setChecked( prefsData->before );
inForeground->setChecked( !prefsData->before );
tabGuidesLayout->addWidget( buttonGroup1 );
layout11 = new QGridLayout( 0, 1, 1, 0, 5, "layout11");
textLabel8 = new QLabel( this, "textLabel8" );
textLabel8->setText( tr( "Guide Snap Distance:" ) );
layout11->addWidget( textLabel8, 0, 0 );
snapDistance = new MSpinBox( unitBase, 1000 * unitBase, this, 2 );
snapDistance->setValue( prefsData->guideRad * unitBase );
snapDistance->setSuffix( unit );
layout11->addWidget( snapDistance, 0, 1, Qt::AlignLeft );
textLabel82 = new QLabel( this, "textLabel8" );
textLabel82->setText( tr( "Grab Radius:" ) );
layout11->addWidget( textLabel82, 1, 0 );
grabDistance = new QSpinBox( this, "grabDistance" );
grabDistance->setMaxValue( 1000 );
grabDistance->setMinValue( 1 );
grabDistance->setLineStep( 1 );
grabDistance->setValue( prefsData->grabRad );
grabDistance->setSuffix( tr( " px" ) );
layout11->addWidget( grabDistance, 1, 1, Qt::AlignLeft );
 
checkMargin = new QCheckBox( this, "checkMargin" );
checkMargin->setText( tr( "Show Margins" ) );
checkMargin->setChecked(prefsData->marginsShown);
layout11->addWidget( checkMargin, 2, 0 );
checkGuides = new QCheckBox( this, "checkGuides" );
checkGuides->setText( tr( "Show Guides" ) );
checkGuides->setChecked(prefsData->guidesShown);
layout11->addWidget( checkGuides, 3, 0 );
checkBaseline = new QCheckBox( this, "checkBaseline" );
baselineBox = new QGroupBox( this, "baselineBox" );
baselineBox->setTitle( tr( "Baseline Grid" ) );
baselineBox->setColumnLayout(0, Qt::Vertical );
baselineBox->layout()->setSpacing( 5 );
baselineBox->layout()->setMargin( 10 );
baselineBoxLayout = new QGridLayout( baselineBox->layout() );
baselineBoxLayout->setAlignment( Qt::AlignTop );
checkBaseline = new QCheckBox( baselineBox, "checkBaseline" );
checkBaseline->setText( tr( "Show Baseline Grid" ) );
checkBaseline->setChecked(prefsData->baseShown);
layout11->addWidget( checkBaseline, 4, 0 );
layout2 = new QHBoxLayout( 0, 0, 5, "layout2");
textLabel2 = new QLabel( this, "textLabel2" );
textLabel2->setText( tr( "Color:" ) );
layout2->addWidget( textLabel2 );
baselineColor = new QPushButton( this, "baselineColor" );
baselineBoxLayout->addWidget( checkBaseline, 0, 0 );
baselineColor = new QPushButton( baselineBox, "baselineColor" );
baselineColor->setMinimumSize( QSize( 60, 20 ) );
baselineColor->setMaximumSize( QSize( 60, 20 ) );
baselineColor->setFlat( false );
148,55 → 206,29
colorBaselineGrid = prefsData->baseColor;
baselineColor->setPixmap(pm4);
baselineColor->setText( QString::null );
layout2->addWidget( baselineColor );
layout11->addLayout( layout2, 4, 1 );
layout3 = new QHBoxLayout( 0, 0, 5, "layout3");
textLabel3 = new QLabel( this, "textLabel3" );
textLabel3->setText( tr( "Color:" ) );
layout3->addWidget( textLabel3 );
guideColor = new QPushButton( this, "guideColor" );
guideColor->setMinimumSize( QSize( 60, 20 ) );
guideColor->setMaximumSize( QSize( 60, 20 ) );
guideColor->setFlat( false );
guideColor->setAutoDefault( false );
QPixmap pm3 = QPixmap(54, 14);
pm3.fill(prefsData->guideColor);
colorGuides = prefsData->guideColor;
guideColor->setPixmap(pm3);
guideColor->setText( QString::null );
layout3->addWidget( guideColor );
layout11->addLayout( layout3, 3, 1 );
layout9 = new QHBoxLayout( 0, 0, 5, "layout9");
textLabel1 = new QLabel( this, "textLabel1" );
textLabel1->setText( tr( "Color:" ) );
layout9->addWidget( textLabel1 );
marginColor = new QPushButton( this, "marginColor" );
marginColor->setMinimumSize( QSize( 60, 20 ) );
marginColor->setMaximumSize( QSize( 60, 20 ) );
marginColor->setAutoDefault( false );
QPixmap pm6 = QPixmap(54, 14);
pm6.fill(prefsData->margColor);
colorMargin = prefsData->margColor;
marginColor->setPixmap(pm6);
marginColor->setFlat( false );
marginColor->setText( QString::null );
layout9->addWidget( marginColor );
layout11->addLayout( layout9, 2, 1 );
tabGuidesLayout->addLayout( layout11 );
layout12 = new QGridLayout( 0, 1, 1, 0, 5, "layout12");
checkLink = new QCheckBox( this, "checkLink" );
checkLink->setText( tr( "Show Text Chains" ) );
checkLink->setChecked(prefsData->linkShown);
layout12->addWidget( checkLink, 1, 0 );
checkFrame = new QCheckBox( this, "checkFrame" );
checkFrame->setText( tr( "Show Frames" ) );
checkFrame->setChecked(prefsData->framesShown);
layout12->addWidget( checkFrame, 0, 0 );
checkPictures = new QCheckBox( this, "checkPictures" );
checkPictures->setText( tr( "Show Pictures" ) );
layout12->addWidget( checkPictures, 0, 1 );
checkPictures->setChecked(prefsData->showPic);
tabGuidesLayout->addLayout( layout12 );
baselineBoxLayout->addWidget( baselineColor, 0, 1 );
autoLine = new QSpinBox( baselineBox, "autoLine" );
autoLine->setMaxValue( 100 );
autoLine->setMinValue( 1 );
autoLine->setValue( prefsData2->autoLineSpacing );
autoLine->setSuffix( tr( " %" ) );
baselineBoxLayout->addWidget( autoLine, 1, 1 );
textLabel8a = new QLabel( autoLine, tr( "Automatic &Line Spacing:" ), baselineBox, "textLabel8a" );
baselineBoxLayout->addWidget( textLabel8a, 1, 0 );
baseGrid = new MSpinBox( 1, 1000, baselineBox, 1 );
baseGrid->setSuffix( unit );
baseGrid->setValue(prefsData2->valueBaseGrid * unitBase);
baselineBoxLayout->addWidget( baseGrid, 0, 3 );
textLabel6a = new QLabel(baseGrid, tr( "Baseline &Grid:" ), baselineBox, "textLabel6a" );
baselineBoxLayout->addWidget( textLabel6a, 0, 2 );
baseOffset = new MSpinBox( 0, 1000, baselineBox, 1 );
baseOffset->setSuffix( unit );
baseOffset->setValue(prefsData2->offsetBaseGrid * unitBase);
baselineBoxLayout->addWidget( baseOffset, 1, 3 );
textLabel7a = new QLabel(baseOffset, tr( "Baseline &Offset:" ), baselineBox, "textLabel7a" );
baselineBoxLayout->addWidget( textLabel7a, 1, 2 );
tabGuidesLayout->addWidget( baselineBox );
 
connect(majorGridColor, SIGNAL(clicked()), this, SLOT(changeMajorColor()));
connect(minorGridColor, SIGNAL(clicked()), this, SLOT(changeMinorColor()));
connect(baselineColor, SIGNAL(clicked()), this, SLOT(changeBaselineColor()));
215,9 → 247,7
QToolTip::add( checkGrid, tr("Turns the gridlines on or off"));
QToolTip::add( checkGuides, tr("Turns the guides on or off"));
QToolTip::add( checkMargin, tr("Turns the margins on or off"));
QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
QToolTip::add( autoLine, tr( "Percentage increase over the font size for the line spacing" ) );
}
 
void TabGuides::changeMajorColor()