mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 19:14:51 +00:00
Backport fix for #7997.
The View->Source pane resets the format every time you click into a new paragraph, which is very annoying. This commit fixes this bug. If anyone has a better idea, please let me know. I posted to devel about it but got no response. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40864 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
922726faae
commit
8d3e242755
@ -58,7 +58,7 @@ ViewSourceWidget::ViewSourceWidget()
|
||||
connect(updatePB, SIGNAL(clicked()),
|
||||
this, SLOT(updateView()));
|
||||
connect(outputFormatCO, SIGNAL(activated(int)),
|
||||
this, SLOT(updateView()));
|
||||
this, SLOT(setViewFormat()));
|
||||
|
||||
// setting a document at this point trigger an assertion in Qt
|
||||
// so we disable the signals here:
|
||||
@ -136,6 +136,13 @@ void ViewSourceWidget::contentsChanged()
|
||||
}
|
||||
|
||||
|
||||
void ViewSourceWidget::setViewFormat()
|
||||
{
|
||||
view_format_ = outputFormatCO->itemData(
|
||||
outputFormatCO->currentIndex()).toString();
|
||||
updateView();
|
||||
}
|
||||
|
||||
void ViewSourceWidget::updateView()
|
||||
{
|
||||
if (!bv_) {
|
||||
@ -146,8 +153,7 @@ void ViewSourceWidget::updateView()
|
||||
|
||||
setEnabled(true);
|
||||
|
||||
string const format = fromqstr(outputFormatCO->itemData(
|
||||
outputFormatCO->currentIndex()).toString());
|
||||
string const format = fromqstr(view_format_);
|
||||
|
||||
QString content;
|
||||
Buffer::OutputWhat output = Buffer::CurrentParagraph;
|
||||
@ -190,13 +196,20 @@ void ViewSourceWidget::updateDefaultFormat()
|
||||
outputFormatCO->clear();
|
||||
outputFormatCO->addItem(qt_("Default"),
|
||||
QVariant(QString("default")));
|
||||
|
||||
int index = 0;
|
||||
typedef vector<Format const *> Formats;
|
||||
Formats formats = bv_->buffer().params().exportableFormats(true);
|
||||
Formats::const_iterator cit = formats.begin();
|
||||
Formats::const_iterator end = formats.end();
|
||||
for (; cit != end; ++cit)
|
||||
for (; cit != end; ++cit) {
|
||||
QString const fname = toqstr((*cit)->name());
|
||||
outputFormatCO->addItem(qt_((*cit)->prettyname()),
|
||||
QVariant(toqstr((*cit)->name())));
|
||||
QVariant(fname));
|
||||
if (fname == view_format_)
|
||||
index = outputFormatCO->count() -1;
|
||||
}
|
||||
outputFormatCO->setCurrentIndex(index);
|
||||
outputFormatCO->blockSignals(false);
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,11 @@ public:
|
||||
void setBufferView(BufferView const * bv);
|
||||
|
||||
public Q_SLOTS:
|
||||
// update content
|
||||
/// update content
|
||||
void updateView();
|
||||
///
|
||||
void setViewFormat();
|
||||
///
|
||||
void updateDefaultFormat();
|
||||
///
|
||||
void contentsChanged();
|
||||
@ -58,6 +60,8 @@ private:
|
||||
LaTeXHighlighter * highlighter_;
|
||||
///
|
||||
bool force_getcontent_;
|
||||
///
|
||||
QString view_format_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,6 +45,9 @@
|
||||
<property name="toolTip">
|
||||
<string>Select the output format</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
|
122
src/frontends/qt4/ui/ViewSourceUi.ui.old
Normal file
122
src/frontends/qt4/ui/ViewSourceUi.ui.old
Normal file
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ViewSourceUi</class>
|
||||
<widget class="QWidget" name="ViewSourceUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>528</width>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" rowspan="5">
|
||||
<widget class="QTextEdit" name="viewSourceTV">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="outputFormatLA">
|
||||
<property name="text">
|
||||
<string>F&ormat:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>outputFormatCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="outputFormatCO">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select the output format</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="contentsCO">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Current Paragraph</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Complete Source</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Preamble Only</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Body Only</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="autoUpdateCB">
|
||||
<property name="text">
|
||||
<string>Automatic update</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="updatePB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>85</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>viewSourceTV</tabstop>
|
||||
<tabstop>autoUpdateCB</tabstop>
|
||||
<tabstop>updatePB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local">qt_i18n.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -80,6 +80,9 @@ What's new
|
||||
|
||||
- Fixed stray warning when inserting inserting plaintext file (bug 7916).
|
||||
|
||||
- Don't reset the selected format each time we click into a new paragraph
|
||||
in View>Source (bug 7997).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user