]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
- Link against qt-mt333.lib which is what the current qt3 cvs produces
[lyx.git] / src / BufferView_pimpl.C
index e76eaf3052af1385e0e7a23c6ba38dded5e9dde2..7491e27213e26af48a1458d9a254455cdedc8ea5 100644 (file)
@@ -34,6 +34,7 @@
 #include "gettext.h"
 #include "intl.h"
 #include "insetiterator.h"
+#include "LaTeXFeatures.h"
 #include "lyx_cb.h" // added for Dispatch functions
 #include "lyx_main.h"
 #include "lyxfind.h"
@@ -56,6 +57,7 @@
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
 #include "frontends/FileDialog.h"
+#include "frontends/font_metrics.h"
 #include "frontends/LyXView.h"
 #include "frontends/LyXScreenFactory.h"
 #include "frontends/screen.h"
 
 #include "graphics/Previews.h"
 
+#include "support/convert.h"
 #include "support/filefilterlist.h"
 #include "support/filetools.h"
 #include "support/forkedcontr.h"
-#include "support/path_defines.h"
-#include "support/tostr.h"
+#include "support/package.h"
 #include "support/types.h"
 
 #include <boost/bind.hpp>
@@ -85,8 +87,7 @@ using lyx::support::ForkedcallsController;
 using lyx::support::IsDirWriteable;
 using lyx::support::MakeDisplayPath;
 using lyx::support::MakeAbsPath;
-using lyx::support::strToUnsignedInt;
-using lyx::support::system_lyxdir;
+using lyx::support::package;
 
 using std::endl;
 using std::istringstream;
@@ -586,8 +587,9 @@ void BufferView::Pimpl::workAreaResize()
 bool BufferView::Pimpl::fitCursor()
 {
        if (bv_funcs::status(bv_, bv_->cursor()) == bv_funcs::CUR_INSIDE) {
-               int asc, des;
-               bv_->cursor().getDim(asc, des);
+               LyXFont const font = bv_->cursor().getFont();
+               int const asc = font_metrics::maxAscent(font);
+               int const des = font_metrics::maxDescent(font);
                Point p = bv_funcs::getPos(bv_->cursor());
                if (p.y_ - asc >= 0 && p.y_ + des < bv_->workHeight())
                        return false;
@@ -777,7 +779,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
                        make_pair(string(_("Documents|#o#O")),
                                  string(lyxrc.document_path)),
                        make_pair(string(_("Examples|#E#e")),
-                                 string(AddPath(system_lyxdir(), "examples"))));
+                                 string(AddPath(package().system_support(), "examples"))));
 
                FileDialog::Result result =
                        fileDlg.open(initpath,
@@ -963,13 +965,21 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
                break;
 
        case LFUN_BOOKMARK_GOTO:
-               flag.enabled(bv_->isSavedPosition(strToUnsignedInt(cmd.argument)));
+               flag.enabled(bv_->isSavedPosition(convert<unsigned int>(cmd.argument)));
                break;
        case LFUN_TRACK_CHANGES:
                flag.enabled(true);
                flag.setOnOff(buf->params().tracking_changes);
                break;
 
+       case LFUN_OUTPUT_CHANGES: {
+               LaTeXFeatures features(*buf, buf->params(), false);
+               flag.enabled(buf && buf->params().tracking_changes
+                       && features.isAvailable("dvipost"));
+               flag.setOnOff(buf->params().output_changes);
+               break;
+       }
+
        case LFUN_MERGE_CHANGES:
        case LFUN_ACCEPT_CHANGE: // what about these two
        case LFUN_REJECT_CHANGE: // what about these two
@@ -1041,11 +1051,11 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_BOOKMARK_SAVE:
-               savePosition(strToUnsignedInt(cmd.argument));
+               savePosition(convert<unsigned int>(cmd.argument));
                break;
 
        case LFUN_BOOKMARK_GOTO:
-               restorePosition(strToUnsignedInt(cmd.argument));
+               restorePosition(convert<unsigned int>(cmd.argument));
                break;
 
        case LFUN_REF_GOTO: {
@@ -1069,6 +1079,13 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
                trackChanges();
                break;
 
+       case LFUN_OUTPUT_CHANGES: {
+               Buffer * buf = bv_->buffer();
+               bool const state = buf->params().output_changes;
+               buf->params().output_changes = !state;
+               break;
+       }
+
        case LFUN_MERGE_CHANGES:
                owner_->getDialogs().show("changes");
                break;