|
|
|
|
@ -31,152 +31,17 @@ |
|
|
|
|
#include <kapp.h> |
|
|
|
|
#include <kconfig.h> |
|
|
|
|
#include <klocale.h> |
|
|
|
|
#include <kglobal.h> |
|
|
|
|
|
|
|
|
|
#include "optiondialog.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char *paperNames[] =
|
|
|
|
|
{
|
|
|
|
|
"US", |
|
|
|
|
"US landscape", |
|
|
|
|
"Legal", |
|
|
|
|
"foolscap", |
|
|
|
|
|
|
|
|
|
// ISO `A' formats, Portrait
|
|
|
|
|
"A1", |
|
|
|
|
"A2", |
|
|
|
|
"A3", |
|
|
|
|
"A4", |
|
|
|
|
"A5", |
|
|
|
|
"A6", |
|
|
|
|
"A7", |
|
|
|
|
|
|
|
|
|
// ISO `A' formats, Landscape
|
|
|
|
|
"A1 landscape", |
|
|
|
|
"A2 landscape", |
|
|
|
|
"A3 landscape", |
|
|
|
|
"A4 landscape", |
|
|
|
|
"A5 landscape", |
|
|
|
|
"A6 landscape", |
|
|
|
|
"A7 landscape", |
|
|
|
|
|
|
|
|
|
// ISO `B' formats, Portrait
|
|
|
|
|
"B1", |
|
|
|
|
"B2", |
|
|
|
|
"B3", |
|
|
|
|
"B4", |
|
|
|
|
"B5", |
|
|
|
|
"B6", |
|
|
|
|
"B7", |
|
|
|
|
|
|
|
|
|
// ISO `B' formats, Landscape
|
|
|
|
|
"B1 landscape", |
|
|
|
|
"B2 landscape", |
|
|
|
|
"B3 landscape", |
|
|
|
|
"B4 landscape", |
|
|
|
|
"B5 landscape", |
|
|
|
|
"B6 landscape", |
|
|
|
|
"B7 landscape", |
|
|
|
|
|
|
|
|
|
// ISO `C' formats, Portrait
|
|
|
|
|
"C1", |
|
|
|
|
"C2", |
|
|
|
|
"C3", |
|
|
|
|
"C4", |
|
|
|
|
"C5", |
|
|
|
|
"C6", |
|
|
|
|
"C7", |
|
|
|
|
|
|
|
|
|
// ISO `C' formats, Landscape
|
|
|
|
|
"C1 landscape", |
|
|
|
|
"C2 landscape", |
|
|
|
|
"C3 landscape", |
|
|
|
|
"C4 landscape", |
|
|
|
|
"C5 landscape", |
|
|
|
|
"C6 landscape", |
|
|
|
|
"C7 landscape", |
|
|
|
|
|
|
|
|
|
0 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char *papers[] =
|
|
|
|
|
{
|
|
|
|
|
"us", "8.5x11", |
|
|
|
|
"usr", "11x8.5", |
|
|
|
|
"legal", "8.5x14", |
|
|
|
|
"foolscap", "13.5x17.0", /* ??? */ |
|
|
|
|
|
|
|
|
|
// ISO `A' formats, Portrait
|
|
|
|
|
"a1", "59.4x84.0cm", |
|
|
|
|
"a2", "42.0x59.4cm", |
|
|
|
|
"a3", "29.7x42.0cm", |
|
|
|
|
"a4", "21.0x29.7cm", |
|
|
|
|
"a5", "14.85x21.0cm", |
|
|
|
|
"a6", "10.5x14.85cm", |
|
|
|
|
"a7", "7.42x10.5cm", |
|
|
|
|
|
|
|
|
|
// ISO `A' formats, Landscape
|
|
|
|
|
"a1r", "84.0x59.4cm", |
|
|
|
|
"a2r", "59.4x42.0cm", |
|
|
|
|
"a3r", "42.0x29.7cm", |
|
|
|
|
"a4r", "29.7x21.0cm", |
|
|
|
|
"a5r", "21.0x14.85cm", |
|
|
|
|
"a6r", "14.85x10.5cm", |
|
|
|
|
"a7r", "10.5x7.42cm", |
|
|
|
|
|
|
|
|
|
// ISO `B' formats, Portrait
|
|
|
|
|
"b1", "70.6x100.0cm", |
|
|
|
|
"b2", "50.0x70.6cm", |
|
|
|
|
"b3", "35.3x50.0cm", |
|
|
|
|
"b4", "25.0x35.3cm", |
|
|
|
|
"b5", "17.6x25.0cm", |
|
|
|
|
"b6", "13.5x17.6cm", |
|
|
|
|
"b7", "8.8x13.5cm", |
|
|
|
|
|
|
|
|
|
// ISO `B' formats, Landscape
|
|
|
|
|
"b1r", "100.0x70.6cm", |
|
|
|
|
"b2r", "70.6x50.0cm", |
|
|
|
|
"b3r", "50.0x35.3cm", |
|
|
|
|
"b4r", "35.3x25.0cm", |
|
|
|
|
"b5r", "25.0x17.6cm", |
|
|
|
|
"b6r", "17.6x13.5cm", |
|
|
|
|
"b7r", "13.5x8.8cm", |
|
|
|
|
|
|
|
|
|
// ISO `C' formats, Portrait
|
|
|
|
|
"c1", "64.8x91.6cm", |
|
|
|
|
"c2", "45.8x64.8cm", |
|
|
|
|
"c3", "32.4x45.8cm", |
|
|
|
|
"c4", "22.9x32.4cm", |
|
|
|
|
"c5", "16.2x22.9cm", |
|
|
|
|
"c6", "11.46x16.2cm", |
|
|
|
|
"c7", "8.1x11.46cm", |
|
|
|
|
|
|
|
|
|
// ISO `C' formats, Landscape
|
|
|
|
|
"c1r", "91.6x64.8cm", |
|
|
|
|
"c2r", "64.8x45.8cm", |
|
|
|
|
"c3r", "45.8x32.4cm", |
|
|
|
|
"c4r", "32.4x22.9cm", |
|
|
|
|
"c5r", "22.9x16.2cm", |
|
|
|
|
"c6r", "16.2x11.46cm", |
|
|
|
|
"c7r", "11.46x8.1cm", |
|
|
|
|
|
|
|
|
|
0 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OptionDialog::OptionDialog( QWidget *parent, const char *name, bool modal ) |
|
|
|
|
:KDialogBase( Tabbed, i18n("Preferences"), Help|Ok|Apply|Cancel, Ok, |
|
|
|
|
parent, name, modal ) |
|
|
|
|
{ |
|
|
|
|
makeFontPage(); |
|
|
|
|
makeRenderingPage(); |
|
|
|
|
makePaperPage(); |
|
|
|
|
makeMiscPage(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -199,25 +64,19 @@ void OptionDialog::slotOk() |
|
|
|
|
|
|
|
|
|
void OptionDialog::slotApply() |
|
|
|
|
{ |
|
|
|
|
KConfig &config = *kapp->config(); |
|
|
|
|
config.setGroup("kdvi"); |
|
|
|
|
|
|
|
|
|
config.writeEntry( "BaseResolution", mFont.resolutionEdit->text() ); |
|
|
|
|
config.writeEntry( "MetafontMode", mFont.metafontEdit->text() ); |
|
|
|
|
config.writeEntry( "MakePK", mFont.fontPathCheck->isChecked() ); |
|
|
|
|
config.writeEntry( "FontPath", mFont.fontPathEdit->text() ); |
|
|
|
|
config.writeEntry( "SmallZoom", mFont.zoomSmallEdit->text() ); |
|
|
|
|
config.writeEntry( "LargeZoom", mFont.zoomLargeEdit->text() ); |
|
|
|
|
KConfig *config = KGlobal::config(); |
|
|
|
|
config->setGroup("kdvi"); |
|
|
|
|
|
|
|
|
|
config.writeEntry( "ShowPS", mRender.showSpecialCheck->isChecked() ); |
|
|
|
|
config.writeEntry( "PS Anti Alias", mRender.antialiasCheck->isChecked() ); |
|
|
|
|
config.writeEntry( "Gamma", mRender.gammaEdit->text() ); |
|
|
|
|
config->writeEntry( "BaseResolution", mFont.resolutionEdit->text() ); |
|
|
|
|
config->writeEntry( "MetafontMode", mFont.metafontEdit->text() ); |
|
|
|
|
config->writeEntry( "MakePK", mFont.fontPathCheck->isChecked() ); |
|
|
|
|
config->writeEntry( "FontPath", mFont.fontPathEdit->text() ); |
|
|
|
|
|
|
|
|
|
QString paperText = mPaper.paperCombo->currentText(); |
|
|
|
|
config.writeEntry( "Paper", paperText.simplifyWhiteSpace() ); |
|
|
|
|
config->writeEntry( "ShowPS", mRender.showSpecialCheck->isChecked() ); |
|
|
|
|
config->writeEntry( "PS Anti Alias", mRender.antialiasCheck->isChecked() ); |
|
|
|
|
config->writeEntry( "Gamma", mRender.gammaEdit->text() ); |
|
|
|
|
|
|
|
|
|
config.setGroup("RecentFiles"); |
|
|
|
|
config.writeEntry( "MaxCount", mMisc.recentSpin->value() ); |
|
|
|
|
config->sync(); |
|
|
|
|
|
|
|
|
|
emit preferencesChanged(); |
|
|
|
|
} |
|
|
|
|
@ -225,47 +84,20 @@ void OptionDialog::slotApply() |
|
|
|
|
|
|
|
|
|
void OptionDialog::setup() |
|
|
|
|
{ |
|
|
|
|
KConfig &config = *kapp->config(); |
|
|
|
|
config.setGroup("kdvi"); |
|
|
|
|
KConfig *config = KGlobal::config(); |
|
|
|
|
config->setGroup("kdvi"); |
|
|
|
|
|
|
|
|
|
// Font page
|
|
|
|
|
mFont.resolutionEdit->setText( config.readEntry( "BaseResolution" ) ); |
|
|
|
|
mFont.metafontEdit->setText( config.readEntry( "MetafontMode" ) ); |
|
|
|
|
mFont.fontPathCheck->setChecked( config.readNumEntry( "MakePK" ) ); |
|
|
|
|
mFont.fontPathEdit->setText( config.readEntry( "FontPath" ) ); |
|
|
|
|
mFont.zoomSmallEdit->setText( config.readEntry( "SmallZoom" ) ); |
|
|
|
|
mFont.zoomLargeEdit->setText( config.readEntry( "LargeZoom" ) ); |
|
|
|
|
mFont.resolutionEdit->setText( config->readEntry( "BaseResolution" ) ); |
|
|
|
|
mFont.metafontEdit->setText( config->readEntry( "MetafontMode" ) ); |
|
|
|
|
mFont.fontPathCheck->setChecked( config->readNumEntry( "MakePK" ) ); |
|
|
|
|
mFont.fontPathEdit->setText( config->readEntry( "FontPath" ) ); |
|
|
|
|
fontPathCheckChanged( mFont.fontPathCheck->isChecked() ); |
|
|
|
|
|
|
|
|
|
// Rendering page
|
|
|
|
|
mRender.showSpecialCheck->setChecked( config.readNumEntry( "ShowPS" ) ); |
|
|
|
|
mRender.antialiasCheck->setChecked(config.readNumEntry("PS Anti Alias", 1));
|
|
|
|
|
mRender.gammaEdit->setText( config.readEntry( "Gamma" ) ); |
|
|
|
|
|
|
|
|
|
// Paper page
|
|
|
|
|
QString paperText = config.readEntry( "Paper" ); |
|
|
|
|
if( mPaper.paperCombo->currentText() != paperText ) |
|
|
|
|
{ |
|
|
|
|
bool match = false; |
|
|
|
|
for( int i=0; i<mPaper.paperCombo->count() && papers[i*2] != 0; i++ ) |
|
|
|
|
{ |
|
|
|
|
if( paperText == mPaper.paperCombo->text(i) || paperText == papers[i*2] ) |
|
|
|
|
{ |
|
|
|
|
match = true; |
|
|
|
|
mPaper.paperCombo->setCurrentItem(i); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if( match == false ) |
|
|
|
|
{ |
|
|
|
|
mPaper.paperCombo->insertItem( paperText, 0 ); |
|
|
|
|
mPaper.paperCombo->setCurrentItem(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Misc page
|
|
|
|
|
config.setGroup("RecentFiles"); |
|
|
|
|
mMisc.recentSpin->setValue( config.readEntry( "MaxCount", "5" ).toInt() ); |
|
|
|
|
mRender.showSpecialCheck->setChecked( config->readNumEntry( "ShowPS" ) ); |
|
|
|
|
mRender.antialiasCheck->setChecked(config->readNumEntry("PS Anti Alias", 1));
|
|
|
|
|
mRender.gammaEdit->setText( config->readEntry( "Gamma" ) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -299,18 +131,6 @@ void OptionDialog::makeFontPage() |
|
|
|
|
glay->addWidget( mFont.fontPathLabel, 4, 0 ); |
|
|
|
|
glay->addWidget( mFont.fontPathEdit, 4, 1 ); |
|
|
|
|
|
|
|
|
|
glay->addRowSpacing( 5, spacingHint()*2 ); |
|
|
|
|
|
|
|
|
|
label = new QLabel( i18n("Zoom factor for small text:"), page ); |
|
|
|
|
mFont.zoomSmallEdit = new QLineEdit( page ); |
|
|
|
|
glay->addWidget( label, 6, 0 ); |
|
|
|
|
glay->addWidget( mFont.zoomSmallEdit, 6, 1 ); |
|
|
|
|
|
|
|
|
|
label = new QLabel( i18n("Zoom factor for large text:"), page ); |
|
|
|
|
mFont.zoomLargeEdit = new QLineEdit( page ); |
|
|
|
|
glay->addWidget( label, 7, 0 ); |
|
|
|
|
glay->addWidget( mFont.zoomLargeEdit, 7, 1 ); |
|
|
|
|
|
|
|
|
|
topLayout->addStretch(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -338,40 +158,6 @@ void OptionDialog::makeRenderingPage() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OptionDialog::makePaperPage() |
|
|
|
|
{ |
|
|
|
|
QFrame *page = addPage( i18n("Paper") ); |
|
|
|
|
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); |
|
|
|
|
mPaper.pageIndex = pageIndex(page); |
|
|
|
|
|
|
|
|
|
QLabel *label = new QLabel( i18n("Select paper size:"), page ); |
|
|
|
|
topLayout->addWidget( label ); |
|
|
|
|
|
|
|
|
|
mPaper.paperCombo = new QComboBox( false, page ); |
|
|
|
|
topLayout->addWidget( mPaper.paperCombo ); |
|
|
|
|
mPaper.paperCombo->insertStrList ( paperNames ); |
|
|
|
|
|
|
|
|
|
topLayout->addStretch(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OptionDialog::makeMiscPage() |
|
|
|
|
{ |
|
|
|
|
QFrame *page = addPage( i18n("Miscellaneous") ); |
|
|
|
|
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); |
|
|
|
|
mMisc.pageIndex = pageIndex(page); |
|
|
|
|
|
|
|
|
|
QHBoxLayout *hlay = new QHBoxLayout( topLayout ); |
|
|
|
|
QLabel *label = new QLabel( i18n("Number of recent files:"), page ); |
|
|
|
|
hlay->addWidget( label ); |
|
|
|
|
|
|
|
|
|
mMisc.recentSpin = new QSpinBox( 0, 100, 1, page ); |
|
|
|
|
hlay->addWidget( mMisc.recentSpin ); |
|
|
|
|
|
|
|
|
|
topLayout->addStretch(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OptionDialog::fontPathCheckChanged( bool state ) |
|
|
|
|
{ |
|
|
|
|
mFont.fontPathLabel->setEnabled( state ); |
|
|
|
|
@ -379,28 +165,3 @@ void OptionDialog::fontPathCheckChanged( bool state ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool OptionDialog::paperSizes( const char *p, float &w, float &h ) |
|
|
|
|
{ |
|
|
|
|
QString s(p); |
|
|
|
|
s = s.simplifyWhiteSpace(); |
|
|
|
|
|
|
|
|
|
for( uint i=0; paperNames[i] != 0; i++ ) |
|
|
|
|
{ |
|
|
|
|
if( s == paperNames[i] ) |
|
|
|
|
{ |
|
|
|
|
s = papers[ 2*i + 1 ]; |
|
|
|
|
int cm = s.findRev( "cm" ); |
|
|
|
|
w = s.toFloat(); |
|
|
|
|
int ind = s.find( 'x' ); |
|
|
|
|
if ( ind<0 ) |
|
|
|
|
return false; |
|
|
|
|
s = s.mid( ind + 1, 9999 ); |
|
|
|
|
h = s.toFloat(); |
|
|
|
|
if ( cm >= 0 ) |
|
|
|
|
w /= 2.54, h /= 2.54; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|