diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index aea9b11359..aab4109be6 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -243,7 +243,9 @@ GuiGraphics::GuiGraphics(GuiView & lv) connect(displayGB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(displayscale, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); - connect(groupId, SIGNAL(textChanged(const QString&)), + connect(groupId, SIGNAL(currentIndexChanged (const QString&)), + this, SLOT(change_group(const QString&))); + connect(groupId, SIGNAL(editTextChanged(const QString&)), this, SLOT(change_adaptor())); displayscale->setValidator(new QIntValidator(displayscale)); @@ -289,6 +291,24 @@ void GuiGraphics::change_adaptor() } +void GuiGraphics::change_group(const QString &text) +{ + if (text.isEmpty()) + return; + + groupId->blockSignals(true); + + string grp = graphics::getGroupParams(buffer(), fromqstr(text)); + InsetGraphicsParams par; + InsetGraphics::string2params(grp, buffer(), par); + par.filename = params_.filename; + params_ = par; + paramsToDialog(par); + + groupId->blockSignals(false); +} + + void GuiGraphics::change_bb() { bbChanged = true; @@ -530,7 +550,20 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp) Scale->setEnabled(scaleChecked); displayGB->setEnabled(lyxrc.display_graphics); - groupId->setText(toqstr(igp.groupId)); + set grp; + graphics::getGraphicsGroups(buffer(), grp); + set::const_iterator it = grp.begin(); + set::const_iterator end = grp.end(); + groupId->blockSignals(true); + groupId->clear(); + groupId->addItem(""); + for (; it != end; it++) + groupId->addItem(toqstr(*it)); + if (igp.groupId.empty()) + groupId->setCurrentIndex(-1); + else + groupId->setCurrentIndex(groupId->findText(toqstr(igp.groupId), Qt::MatchExactly)); + groupId->blockSignals(false); lengthAutoToWidgets(Width, widthUnit, igp.width, unitDefault); @@ -666,7 +699,7 @@ void GuiGraphics::applyView() // more latex options igp.special = fromqstr(latexoptions->text()); - igp.groupId = fromqstr(groupId->text()); + igp.groupId = fromqstr(groupId->currentText()); } diff --git a/src/frontends/qt4/GuiGraphics.h b/src/frontends/qt4/GuiGraphics.h index a5dd3e6592..27e34ac916 100644 --- a/src/frontends/qt4/GuiGraphics.h +++ b/src/frontends/qt4/GuiGraphics.h @@ -40,6 +40,7 @@ public: private Q_SLOTS: void change_adaptor(); + void change_group(const QString &); void change_bb(); void on_browsePB_clicked(); void on_getPB_clicked(); diff --git a/src/frontends/qt4/ui/GraphicsUi.ui b/src/frontends/qt4/ui/GraphicsUi.ui index 697d143c8e..704201a9c1 100644 --- a/src/frontends/qt4/ui/GraphicsUi.ui +++ b/src/frontends/qt4/ui/GraphicsUi.ui @@ -5,8 +5,8 @@ 0 0 - 480 - 348 + 482 + 383 @@ -124,14 +124,6 @@ 0 - - - 0 - 0 - 458 - 272 - - &Graphics @@ -367,14 +359,6 @@ - - - 0 - 0 - 458 - 272 - - &Clipping @@ -537,14 +521,6 @@ - - - 0 - 0 - 458 - 272 - - LaTe&X and LyX options @@ -647,20 +623,7 @@ Grou&p Name: - groupId - - - - - - - - 87 - 0 - - - - Group Name to be set up from the current parameters. Use context menu to assign the existing one. + grouId @@ -693,10 +656,20 @@ + + + + Group Name to be set up from the current parameters. Use context menu to assign the existing one. + + + true + + + - + Qt::Vertical