]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiViewSource.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiViewSource.cpp
index 95cefd8ede6f5c1fb23c77aef417aec7fa1b7cc1..b2df874437206bde096e139e8559bd5bab06ac1b 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <boost/crc.hpp>
 
+#include <QBoxLayout>
 #include <QSettings>
 #include <QTextCursor>
 #include <QTextDocument>
@@ -114,6 +115,9 @@ static bool getContent(BufferView const * view, Buffer::OutputWhat output,
        view->buffer().getSourceCode(ostr, format, par_begin, par_end + 1,
                                     output, master);
        docstring s = ostr.str();
+       // FIXME THREAD
+       // Could this be private to this particular dialog? We could have
+       // more than one of these, in different windows.
        static size_t crc = 0;
        size_t newcrc = crcCheck(s);
        if (newcrc == crc && !force_getcontent)
@@ -227,6 +231,19 @@ void ViewSourceWidget::updateDefaultFormat()
 }
 
 
+void ViewSourceWidget::resizeEvent (QResizeEvent * event)
+{
+       QSize const & formSize = formLayout->sizeHint();
+       // minimize the size of the part that contains the buttons
+       if (width() * formSize.height() < height() * formSize.width()) {
+               layout_->setDirection(QBoxLayout::TopToBottom);
+       } else {
+               layout_->setDirection(QBoxLayout::LeftToRight);
+       }
+       QWidget::resizeEvent(event);
+}
+
+
 GuiViewSource::GuiViewSource(GuiView & parent,
                Qt::DockWidgetArea area, Qt::WindowFlags flags)
        : DockView(parent, "view-source", qt_("LaTeX Source"), area, flags)
@@ -279,7 +296,7 @@ QString GuiViewSource::title() const
                case LITERATE:
                        return qt_("Literate Source");
        }
-       LASSERT(false, /**/);
+       LATTEST(false);
        return QString();
 }