From 75788329198d6cc1532f4d3b694a08a6ae913fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 28 Apr 2008 06:19:25 +0000 Subject: [PATCH] Improvements to the External dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24532 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiExternal.cpp | 47 +- src/frontends/qt4/ui/ExternalUi.ui | 1236 ++++++++++++++-------------- 2 files changed, 636 insertions(+), 647 deletions(-) diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 9bcf779077..82bed17a3f 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -38,6 +38,7 @@ #include "Validator.h" #include +#include #include #include #include @@ -97,9 +98,9 @@ GuiExternal::GuiExternal(GuiView & lv) connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); - connect(displayCB, SIGNAL(toggled(bool)), + connect(displayGB, SIGNAL(toggled(bool)), showCO, SLOT(setEnabled(bool))); - connect(displayCB, SIGNAL(toggled(bool)), + connect(displayGB, SIGNAL(toggled(bool)), displayscaleED, SLOT(setEnabled(bool))); connect(showCO, SIGNAL(activated(QString)), this, SLOT(change_adaptor())); @@ -119,7 +120,7 @@ GuiExternal::GuiExternal(GuiView & lv) this, SLOT(widthUnitChanged())); connect(heightUnitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(change_adaptor())); - connect(displayCB, SIGNAL(stateChanged(int)), + connect(displayGB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(displayscaleED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); @@ -168,7 +169,7 @@ GuiExternal::GuiExternal(GuiView & lv) bc().addReadOnly(draftCB); bc().addReadOnly(displayscaleED); bc().addReadOnly(showCO); - bc().addReadOnly(displayCB); + bc().addReadOnly(displayGB); bc().addReadOnly(angleED); bc().addReadOnly(originCO); bc().addReadOnly(heightUnitCO); @@ -365,7 +366,7 @@ static Length::UNIT defaultUnit() static void setDisplay( - QCheckBox & displayCB, QComboBox & showCO, QLineEdit & scaleED, + QGroupBox & displayGB, QComboBox & showCO, QLineEdit & scaleED, external::DisplayType display, unsigned int scale, bool read_only) { int item = 0; @@ -393,16 +394,16 @@ static void setDisplay( showCO.setCurrentIndex(item); bool const no_display = display == external::NoDisplay; showCO.setEnabled(!no_display && !read_only); - displayCB.setChecked(!no_display); + displayGB.setChecked(!no_display); scaleED.setEnabled(!no_display && !read_only); scaleED.setText(QString::number(scale)); } -static external::DisplayType display(QCheckBox const & displayCB, +static external::DisplayType display(QGroupBox const & displayGB, QComboBox const & showCO) { - if (!displayCB.isChecked()) + if (!displayGB.isChecked()) return external::NoDisplay; switch (showCO.currentIndex()) { default: @@ -568,7 +569,7 @@ void GuiExternal::updateContents() draftCB->setChecked(params_.draft); - setDisplay(*displayCB, *showCO, *displayscaleED, + setDisplay(*displayGB, *showCO, *displayscaleED, params_.display, params_.lyxscale, isBufferReadonly()); setRotation(*angleED, *originCO, params_.rotationdata); @@ -589,22 +590,28 @@ void GuiExternal::updateTemplate() externalTB->setPlainText(qt_(templ.helpText)); // Ascertain which (if any) transformations the template supports - // and disable tabs hosting unsupported transforms. + // and disable tabs and Group Boxes hosting unsupported transforms. typedef vector TransformIDs; TransformIDs const transformIds = templ.transformIds; TransformIDs::const_iterator tr_begin = transformIds.begin(); TransformIDs::const_iterator const tr_end = transformIds.end(); bool found = std::find(tr_begin, tr_end, external::Rotate) != tr_end; - tab->setTabEnabled(tab->indexOf(rotatetab), found); + rotationGB->setEnabled(found); + found = std::find(tr_begin, tr_end, external::Resize) != tr_end; - tab->setTabEnabled(tab->indexOf(scaletab), found); + scaleGB->setEnabled(found); found = std::find(tr_begin, tr_end, external::Clip) != tr_end; - tab->setTabEnabled(tab->indexOf(croptab), found); + cropGB->setEnabled(found); + + tab->setTabEnabled(tab->indexOf(sizetab), + rotationGB->isEnabled() + || scaleGB->isEnabled() + || cropGB->isEnabled()); found = std::find(tr_begin, tr_end, external::Extra) != tr_end; - tab->setTabEnabled(tab->indexOf(optionstab), found); + optionsGB->setEnabled(found); if (!found) return; @@ -629,7 +636,7 @@ void GuiExternal::updateTemplate() bool const enabled = extraFormatCO->count() > 0; - tab->setTabEnabled(tab->indexOf(optionstab), enabled); + optionsGB->setEnabled(enabled); extraED->setEnabled(enabled && !isBufferReadonly()); extraFormatCO->setEnabled(enabled); @@ -647,20 +654,20 @@ void GuiExternal::applyView() params_.draft = draftCB->isChecked(); params_.lyxscale = displayscaleED->text().toInt(); - params_.display = display(*displayCB, *showCO); + params_.display = display(*displayGB, *showCO); - if (tab->isTabEnabled(tab->indexOf(rotatetab))) + if (rotationGB->isEnabled()) getRotation(params_.rotationdata, *angleED, *originCO); - if (tab->isTabEnabled(tab->indexOf(scaletab))) + if (scaleGB->isEnabled()) getSize(params_.resizedata, *widthED, *widthUnitCO, *heightED, *heightUnitCO, *aspectratioCB); - if (tab->isTabEnabled(tab->indexOf(croptab))) + if (cropGB->isEnabled()) getCrop(params_.clipdata, *clipCB, *xlED, *ybED, *xrED, *ytED, bbChanged_); - if (tab->isTabEnabled(tab->indexOf(optionstab))) { + if (optionsGB->isEnabled()) { MapType::const_iterator it = extra_.begin(); MapType::const_iterator const end = extra_.end(); for (; it != end; ++it) diff --git a/src/frontends/qt4/ui/ExternalUi.ui b/src/frontends/qt4/ui/ExternalUi.ui index 65788a7c29..1bedc8dcde 100644 --- a/src/frontends/qt4/ui/ExternalUi.ui +++ b/src/frontends/qt4/ui/ExternalUi.ui @@ -5,8 +5,8 @@ 0 0 - 390 - 346 + 386 + 453 @@ -22,6 +22,613 @@ 6 + + + + 0 + + + + F&ile + + + + 9 + + + 6 + + + + + Filename + + + + + + + Filename + + + &File: + + + fileED + + + + + + + Select a file + + + &Browse... + + + + + + + &Draft + + + + + + + &Template + + + + 9 + + + 6 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + + 3 + 0 + 0 + 0 + + + + Available templates + + + + + + + + + + + LaTe&X and LyX options + + + + 9 + + + 6 + + + + + LaTeX Options + + + true + + + + 9 + + + 6 + + + + + + + + O&ption: + + + extraED + + + + + + + + + + Forma&t: + + + Qt::AutoText + + + extraFormatCO + + + + + + + + + + Display image in LyX + + + &Show in LyX + + + true + + + true + + + + 9 + + + 6 + + + + + Qt::Horizontal + + + + 87 + 20 + + + + + + + + Screen display + + + + Default + + + + + Monochrome + + + + + Grayscale + + + + + Color + + + + + Preview + + + + + + + + 0 + + + 6 + + + + + true + + + + 5 + 0 + 0 + 0 + + + + Percentage to scale by in LyX + + + + + + + true + + + Qt::NoFocus + + + % + + + + + + + + + Screen display + + + &Display: + + + showCO + + + + + + + Percentage to scale by in LyX + + + Sca&le: + + + displayscaleED + + + + + + + + + + Qt::Vertical + + + + 81 + 196 + + + + + + + + + Si&ze and Rotation + + + + 9 + + + 6 + + + + + Rotate + + + true + + + + 9 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + 0 + + + 6 + + + + + + 3 + 0 + 0 + 0 + + + + Angle to rotate image by + + + + + + + + + + The origin of the rotation + + + Ori&gin: + + + originCO + + + + + + + The origin of the rotation + + + + + + + Angle to rotate image by + + + A&ngle: + + + angleED + + + + + + + + + + + + Scale + + + true + + + + 9 + + + 6 + + + + + + + + + + + true + + + Height of image in output + + + + + + + true + + + Width of image in output + + + + + + + true + + + &Width: + + + widthED + + + + + + + true + + + Maintain aspect ratio with largest dimension + + + &Maintain aspect ratio + + + + + + + true + + + &Height: + + + heightED + + + + + + + + + + Crop + + + true + + + + 9 + + + 6 + + + + + Clip to bounding box values + + + Clip to &bounding box + + + + + + + &Left bottom: + + + xlED + + + + + + + + + + x + + + + + + + Right &top: + + + xrED + + + + + + + Get bounding box from the (EPS) file + + + &Get from File + + + + + + + + + + + + + + Qt::Horizontal + + + + 43 + 18 + + + + + + + + + + + y + + + + + + + + + + + + + @@ -81,618 +688,6 @@ - - - - 2 - - - - File - - - - 9 - - - 6 - - - - - Template - - - - 9 - - - 6 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - - 3 - 0 - 0 - 0 - - - - Available templates - - - - - - - - - - Filename - - - - - - - Filename - - - &File: - - - fileED - - - - - - - Select a file - - - &Browse... - - - - - - - &Draft - - - - - - - - LyX View - - - - 9 - - - 6 - - - - - Screen display - - - - Default - - - - - Monochrome - - - - - Grayscale - - - - - Color - - - - - Preview - - - - - - - - 0 - - - 6 - - - - - true - - - - 5 - 0 - 0 - 0 - - - - Percentage to scale by in LyX - - - - - - - true - - - Qt::NoFocus - - - % - - - - - - - - - Screen display - - - &Display: - - - showCO - - - - - - - Percentage to scale by in LyX - - - Sca&le: - - - displayscaleED - - - - - - - Qt::Horizontal - - - - 87 - 20 - - - - - - - - Display image in LyX - - - &Show in LyX - - - - - - - Qt::Vertical - - - - 81 - 196 - - - - - - - - - Rotate - - - - 9 - - - 6 - - - - - Qt::Vertical - - - - 20 - 222 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - 0 - - - 6 - - - - - - 3 - 0 - 0 - 0 - - - - Angle to rotate image by - - - - - - - - - - The origin of the rotation - - - &Origin: - - - originCO - - - - - - - The origin of the rotation - - - - - - - Angle to rotate image by - - - A&ngle: - - - angleED - - - - - - - - - - Scale - - - - 9 - - - 6 - - - - - - - - - - - true - - - Height of image in output - - - - - - - true - - - Maintain aspect ratio with largest dimension - - - &Maintain aspect ratio - - - - - - - Qt::Vertical - - - - 20 - 165 - - - - - - - - true - - - &Width: - - - widthED - - - - - - - true - - - Width of image in output - - - - - - - true - - - &Height: - - - heightED - - - - - - - - Crop - - - - 9 - - - 6 - - - - - Get bounding box from the (EPS) file - - - &Get from File - - - - - - - Qt::Horizontal - - - - 43 - 18 - - - - - - - - Clip to bounding box values - - - Clip to &bounding box - - - - - - - - - - - - - - - - - &Left bottom: - - - xlED - - - - - - - - - - Right &top: - - - xrED - - - - - - - - - - Qt::Vertical - - - - 20 - 158 - - - - - - - - x - - - - - - - y - - - - - - - - Options - - - - 9 - - - 6 - - - - - Qt::Vertical - - - - 20 - 229 - - - - - - - - - - - O&ption: - - - extraED - - - - - - - - - - Forma&t: - - - Qt::AutoText - - - extraFormatCO - - - - - - - @@ -709,23 +704,10 @@ externalCO externalTB draftCB - displayCB showCO displayscaleED angleED originCO - widthED - widthUnitCO - heightED - aspectratioCB - clipCB - getbbPB - xrED - ytED - xlED - ybED - extraFormatCO - extraED okPB applyPB closePB