Add editable combobox for groups in graphics dialogs as discussed in

http://www.mail-archive.com/lyx-users@lists.lyx.org/msg70194.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28160 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2009-01-14 15:10:15 +00:00
parent ec7d9f4593
commit 5701383b40
3 changed files with 51 additions and 44 deletions

View File

@ -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<string> grp;
graphics::getGraphicsGroups(buffer(), grp);
set<string>::const_iterator it = grp.begin();
set<string>::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());
}

View File

@ -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();

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>348</height>
<width>482</width>
<height>383</height>
</rect>
</property>
<property name="sizePolicy" >
@ -124,14 +124,6 @@
<number>0</number>
</property>
<widget class="QWidget" name="Graphics" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>272</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;Graphics</string>
</attribute>
@ -367,14 +359,6 @@
</layout>
</widget>
<widget class="QWidget" name="Clipping" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>272</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;Clipping</string>
</attribute>
@ -537,14 +521,6 @@
</layout>
</widget>
<widget class="QWidget" name="ExtraOptions" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>272</height>
</rect>
</property>
<attribute name="title" >
<string>LaTe&amp;X and LyX options</string>
</attribute>
@ -647,20 +623,7 @@
<string>Grou&amp;p Name:</string>
</property>
<property name="buddy" >
<cstring>groupId</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="groupId" >
<property name="minimumSize" >
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>Group Name to be set up from the current parameters. Use context menu to assign the existing one.</string>
<cstring>grouId</cstring>
</property>
</widget>
</item>
@ -693,10 +656,20 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="groupId" >
<property name="toolTip" >
<string>Group Name to be set up from the current parameters. Use context menu to assign the existing one.</string>
</property>
<property name="editable" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="1" >
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>