From e3630e40764551f56b4dd25bc5bb3fae06864fb3 Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Thu, 6 Apr 2006 21:04:27 +0000 Subject: [PATCH] clean up of the graphics dialog: -layout -enabling/disabling widgets -tab order git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13574 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/QGraphics.C | 11 +- src/frontends/qt4/QGraphicsDialog.C | 69 ++- src/frontends/qt4/QGraphicsDialog.h | 2 + src/frontends/qt4/ui/QGraphicsUi.ui | 875 +++++++++++++++------------- 4 files changed, 515 insertions(+), 442 deletions(-) diff --git a/src/frontends/qt4/QGraphics.C b/src/frontends/qt4/QGraphics.C index adbe8a79db..89c34a3ebf 100644 --- a/src/frontends/qt4/QGraphics.C +++ b/src/frontends/qt4/QGraphics.C @@ -106,10 +106,10 @@ void QGraphics::build_dialog() bcview().addReadOnly(dialog_->getPB); // initialize the length validator - addCheckedLineEdit(bcview(), dialog_->Width, dialog_->sizewidthL_2); - addCheckedLineEdit(bcview(), dialog_->Height, dialog_->sizeheightL_2); + addCheckedLineEdit(bcview(), dialog_->Width, dialog_->widthL); + addCheckedLineEdit(bcview(), dialog_->Height, dialog_->heightL); addCheckedLineEdit(bcview(), dialog_->displayscale, dialog_->scaleLA); - addCheckedLineEdit(bcview(), dialog_->angle, dialog_->angleL_2); + addCheckedLineEdit(bcview(), dialog_->angle, dialog_->angleL); addCheckedLineEdit(bcview(), dialog_->lbX, dialog_->xL); addCheckedLineEdit(bcview(), dialog_->lbY, dialog_->yL); addCheckedLineEdit(bcview(), dialog_->rtX, dialog_->xL_2); @@ -240,6 +240,7 @@ void QGraphics::update_contents() dialog_->showCB->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly()); dialog_->displayCB->setChecked(igp.display != lyx::graphics::NoDisplay); dialog_->displayscale->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly()); + dialog_->displayscaleL->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly()); dialog_->displayscale->setText(toqstr(convert(igp.lyxscale))); //// the output section (width/height) @@ -272,6 +273,7 @@ void QGraphics::update_contents() // enable height input in case of non "Scale%" as width-unit bool use_height = (dialog_->widthUnit->currentItem() > 0); + dialog_->heightL->setEnabled(use_height); dialog_->Height->setEnabled(use_height); dialog_->heightUnit->setEnabled(use_height); @@ -296,6 +298,9 @@ void QGraphics::update_contents() else dialog_->origin->setCurrentItem(0); + // disable edit button when no filename is present + dialog_->editPB->setDisabled(dialog_->filename->text().isEmpty()); + //// latex section dialog_->latexoptions->setText(toqstr(igp.special)); } diff --git a/src/frontends/qt4/QGraphicsDialog.C b/src/frontends/qt4/QGraphicsDialog.C index ac5cdf0233..ab06db9465 100644 --- a/src/frontends/qt4/QGraphicsDialog.C +++ b/src/frontends/qt4/QGraphicsDialog.C @@ -51,37 +51,38 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form) connect(editPB, SIGNAL(clicked()), this, SLOT(edit_clicked())); - connect( subfigure, SIGNAL( toggled(bool) ), subcaption, SLOT( setEnabled(bool) ) ); - connect( browsePB, SIGNAL( clicked() ), this, SLOT( browse_clicked() ) ); - connect( filename, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( subcaption, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( subfigure, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( latexoptions, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( clip, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( lbX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); - connect( showCB, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) ); - connect( displayscale, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( Width, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( widthUnit, SIGNAL( activated(int) ), this, SLOT( change_WUnit() ) ); - connect( aspectratio, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( draftCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( unzipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( displayCB, SIGNAL( toggled(bool) ), showCB, SLOT( setEnabled(bool) ) ); - connect( displayCB, SIGNAL( toggled(bool) ), displayscale, SLOT( setEnabled(bool) ) ); - connect( Height, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( heightUnit, SIGNAL( selectionChanged(LyXLength::UNIT) ), this, SLOT( change_adaptor() ) ); - connect( angle, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( origin, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) ); - connect( getPB, SIGNAL( clicked() ), this, SLOT( getBB_clicked() ) ); - connect( getPB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) ); - connect( lbY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); - connect( rtX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); - connect( rtY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); - connect( lbXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); - connect( lbYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); - connect( rtXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); - connect( rtYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); + connect( subfigure, SIGNAL( toggled(bool) ), subcaption, SLOT( setEnabled(bool) ) ); + connect( browsePB, SIGNAL( clicked() ), this, SLOT( browse_clicked() ) ); + connect( filename, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( filename, SIGNAL( textChanged(const QString&) ), this, SLOT( filenameChanged(const QString&) ) ); + connect( subcaption, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( subfigure, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( latexoptions, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( clip, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( lbX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); + connect( showCB, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) ); + connect( displayscale, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( Width, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( widthUnit, SIGNAL( activated(int) ), this, SLOT( change_WUnit() ) ); + connect( aspectratio, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( draftCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( unzipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); + connect( displayCB, SIGNAL( toggled(bool) ), showCB, SLOT( setEnabled(bool) ) ); + connect( displayCB, SIGNAL( toggled(bool) ), displayscale, SLOT( setEnabled(bool) ) ); + connect( Height, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( heightUnit, SIGNAL( selectionChanged(LyXLength::UNIT) ), this, SLOT( change_adaptor() ) ); + connect( angle, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); + connect( origin, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) ); + connect( getPB, SIGNAL( clicked() ), this, SLOT( getBB_clicked() ) ); + connect( getPB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) ); + connect( lbY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); + connect( rtX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); + connect( rtY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) ); + connect( lbXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); + connect( lbYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); + connect( rtXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); + connect( rtYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) ); angle->setValidator(new QDoubleValidator(-360, 360, 2, angle)); @@ -125,6 +126,7 @@ void QGraphicsDialog::change_WUnit() bool useHeight = (widthUnit->currentItem() > 0); Height->setEnabled(useHeight); heightUnit->setEnabled(useHeight); + heightL->setEnabled(useHeight); form_->changed(); } @@ -156,5 +158,10 @@ void QGraphicsDialog::edit_clicked() form_->controller().editGraphics(); } +void QGraphicsDialog::filenameChanged(const QString & filename) +{ + editPB->setDisabled(filename.isEmpty()); +} + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/QGraphicsDialog.h b/src/frontends/qt4/QGraphicsDialog.h index d51020f918..82685b5d0e 100644 --- a/src/frontends/qt4/QGraphicsDialog.h +++ b/src/frontends/qt4/QGraphicsDialog.h @@ -17,6 +17,7 @@ #include #include +#include namespace lyx { namespace frontend { @@ -36,6 +37,7 @@ protected slots: virtual void browse_clicked(); virtual void getBB_clicked(); virtual void edit_clicked(); + virtual void filenameChanged(const QString &); protected: virtual void closeEvent(QCloseEvent * e); private: diff --git a/src/frontends/qt4/ui/QGraphicsUi.ui b/src/frontends/qt4/ui/QGraphicsUi.ui index dc89093c0e..0cadf3ef74 100644 --- a/src/frontends/qt4/ui/QGraphicsUi.ui +++ b/src/frontends/qt4/ui/QGraphicsUi.ui @@ -8,8 +8,8 @@ 0 0 - 451 - 549 + 412 + 411 @@ -28,102 +28,11 @@ - 11 + 9 6 - - - - 0 - - - 6 - - - - - &Restore - - - false - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 20 - 20 - - - - - - - - &OK - - - true - - - true - - - - - - - - 1 - 0 - 0 - 0 - - - - &Apply - - - false - - - false - - - - - - - - 1 - 0 - 0 - 0 - - - - Close - - - false - - - - - @@ -135,126 +44,91 @@ - 11 + 9 6 - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - + + - Rotation + LyX Display - + - 11 + 9 6 - - - - Angle to rotate image by + + + + true - - A&ngle: + + Qt::NoFocus - - angle + + % - - - - - 3 - 0 - 0 - 0 - - + + - Angle to rotate image by + Display image in LyX + + + &Show in LyX - - + + - The origin of the rotation + Screen display - Or&igin: + &Display: - origin + showCB - - - - The origin of the rotation + + + + true - - - - - - - - - LyX Display - - - - 11 - - - 6 - - - - - Display image in LyX + + + 5 + 0 + 0 + 0 + - - &Show in LyX + + Percentage to scale by in LyX - - + + - Screen display + Percentage to scale by in LyX - Display: + Sca&le: - showCB + displayscale - + Screen display @@ -281,60 +155,6 @@ - - - - Percentage to scale by in LyX - - - Scale: - - - displayscale - - - - - - - 0 - - - 6 - - - - - true - - - - 5 - 0 - 0 - 0 - - - - Percentage to scale by in LyX - - - - - - - true - - - Qt::NoFocus - - - % - - - - - @@ -343,15 +163,15 @@ Output - + - 11 + 9 6 - - + + true @@ -363,31 +183,55 @@ - - - - 0 + + + + true - - 6 + + Width of image in output - - - - true - - - Width of image in output - - - - - - - + - - + + + + + + + + 3 + 5 + 0 + 0 + + + + + 0 + 0 + + + + Qt::StrongFocus + + + Units of height value + + + + + + + true + + + Height of image in output + + + + + true @@ -399,51 +243,7 @@ - - - - 0 - - - 6 - - - - - true - - - Height of image in output - - - - - - - - 3 - 5 - 0 - 0 - - - - - 0 - 0 - - - - Qt::StrongFocus - - - Units of height value - - - - - - + true @@ -459,6 +259,69 @@ + + + + Rotation + + + + 11 + + + 6 + + + + + Angle to rotate image by + + + A&ngle: + + + angle + + + + + + + + 3 + 0 + 0 + 0 + + + + Angle to rotate image by + + + + + + + The origin of the rotation + + + Or&igin: + + + origin + + + + + + + The origin of the rotation + + + + + + @@ -536,58 +399,12 @@ - 11 + 9 6 - - - - 0 - - - 6 - - - - - Clip to bounding box values - - - Clip to &bounding box - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - Get bounding box from the (EPS) file - - - &Get from File - - - - - - + true @@ -595,7 +412,7 @@ 5 - 7 + 1 0 0 @@ -608,42 +425,12 @@ - 11 + 9 6 - - - - - - - y - - - - - - - - - - x - - - - - - - - - - - - - - + &Left bottom: @@ -653,23 +440,7 @@ - - - - - - - - - - - - - x - - - - + Right &top: @@ -679,26 +450,125 @@ - - - - y + + + + 0 - + + 6 + + + + + x + + + + + + + + + + + + + + + + + y + + + + + + + + + + - - + + + + 0 + + + 6 + + + + + x + + + + + + + + + + + + + y + + + + + + + + + + - + + + + Clip to bounding box values + + + Clip to &bounding box + + + + + + + Get bounding box from the (EPS) file + + + &Get from File + + + + - Qt::Vertical + Qt::Horizontal + + + + 261 + 20 + + + + + + + + Qt::Horizontal - QSizePolicy::MinimumExpanding + QSizePolicy::Expanding @@ -708,6 +578,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -821,6 +704,9 @@ + + false + The caption for the sub-figure @@ -862,6 +748,97 @@ + + + + 0 + + + 6 + + + + + &Restore + + + false + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 20 + 20 + + + + + + + + &OK + + + true + + + true + + + + + + + + 1 + 0 + 0 + 0 + + + + &Apply + + + false + + + false + + + + + + + + 1 + 0 + 0 + 0 + + + + Close + + + false + + + + + @@ -878,9 +855,10 @@ TabWidget filename browsePB - displayCB + editPB showCB displayscale + displayCB Width widthUnit Height @@ -909,5 +887,86 @@ closePB - + + + displayCB + toggled(bool) + TextLabel1 + setEnabled(bool) + + + 112 + 269 + + + 74 + 158 + + + + + displayCB + toggled(bool) + scaleLA + setEnabled(bool) + + + 125 + 269 + + + 91 + 212 + + + + + subfigure + toggled(bool) + CaptionLA + setEnabled(bool) + + + 56 + 56 + + + 44 + 62 + + + + + subfigure + toggled(bool) + subcaption + setEnabled(bool) + + + 69 + 54 + + + 110 + 62 + + + + + displayCB + toggled(bool) + displayscaleL + setEnabled(bool) + + + 53 + 260 + + + 157 + 235 + + + + -- 2.39.5