Angus Leeming wrote:
> Attached are the changes in my 1.3.x tree.
--
Angus
? boost_changes.diff
? branches.diff
? build-qt
? build-xforms
? colors.diff
? insetgraphics.diff
? lib_images.diff
? paragraph.diff
? qt_scroll.diff
? relyx-accents.diff
? relyx-minipage-test.tex
? relyx-minipage.diff
? striplog.sed
? tmp.diff
? xpm.diff.bz2
? xpm_cleanup.sh
? development/lyxserver/server_monitor
? development/lyxserver/tmpfile
? lib/configure.diff
Index: src/text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.29.2.2
diff -u -p -r1.29.2.2 text3.C
--- src/text3.C 13 Jun 2003 16:15:11 -0000 1.29.2.2
+++ src/text3.C 28 Dec 2003 15:15:41 -0000
@@ -1096,7 +1096,7 @@ Inset::RESULT LyXText::dispatch(FuncRequ
break;
case LFUN_GETLAYOUT:
- cmd.message(tostr(cursor.par()->layout()));
+ cmd.message(cursor.par()->layout()->name());
break;
case LFUN_LAYOUT: {
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.389.2.41
diff -u -p -r1.389.2.41 ChangeLog
--- src/frontends/qt2/ChangeLog 9 Dec 2003 14:15:22 -0000 1.389.2.41
+++ src/frontends/qt2/ChangeLog 28 Dec 2003 15:15:45 -0000
@@ -16,6 +16,17 @@
* QDocument.C: use geometry on custom, A3, B3 and B4
papersizes.
+2003-12-01 Angus Leeming <[EMAIL PROTECTED]>
+
+ * QContentPane.[Ch] (SyntheticMouseEvent): a new, helper struct.
+ (QContentPane): store an instance of SyntheticMouseEvent and
+ add a slot, generateSyntheticMouseEvent, that is invoked by the
+ SyntheticMouseEvent::timeout.
+ (mouseMoveEvent): initialize synthetic_mouse_event_ when the
+ mouse button is depressed and the cursor is outside of the work area.
+ (generateSyntheticMouseEvent): if the scrollbar value is different
+ from the cached value, then dispatch a 'synthetic' mouse event.
+
2003-11-14 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
* ui/QMathDialogBase.ui: remove mention of \frac in tooltip, since
Index: src/frontends/qt2/QContentPane.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v
retrieving revision 1.18
diff -u -p -r1.18 QContentPane.C
--- src/frontends/qt2/QContentPane.C 17 Dec 2002 20:37:10 -0000 1.18
+++ src/frontends/qt2/QContentPane.C 28 Dec 2003 15:15:45 -0000
@@ -16,9 +16,10 @@
#include "debug.h"
+#include <boost/bind.hpp>
+
#include "QWorkArea.h"
#include "QLyXKeySym.h"
-#include "funcrequest.h"
#include "qt_helpers.h"
#include <qevent.h>
@@ -82,10 +83,20 @@ mouse_button::state q_motion_state(Qt::B
} // namespace anon
+SyntheticMouseEvent::SyntheticMouseEvent()
+ : timeout(200), restart_timeout(true),
+ x_old(-1), y_old(-1), scrollbar_value_old(-1.0)
+{}
+
+
QContentPane::QContentPane(QWorkArea * parent)
: QWidget(parent, "content_pane", WRepaintNoErase),
wa_(parent)
{
+ synthetic_mouse_event_.timeout.timeout.connect(
+ boost::bind(&QContentPane::generateSyntheticMouseEvent,
+ this));
+
setFocusPolicy(QWidget::WheelFocus);
setFocus();
setCursor(ibeamCursor);
@@ -103,6 +114,25 @@ void QContentPane::scrollBarChanged(int
}
+void QContentPane::generateSyntheticMouseEvent()
+{
+ // Set things off to generate the _next_ 'pseudo' event.
+ if (synthetic_mouse_event_.restart_timeout)
+ synthetic_mouse_event_.timeout.start();
+
+ // Has anything changed on-screen since the last timeout signal
+ // was received?
+ double const scrollbar_value = wa_->scrollbar_->value();
+ if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) {
+ // Yes it has. Store the params used to check this.
+ synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
+
+ // ... and dispatch the event to the LyX core.
+ wa_->dispatch(synthetic_mouse_event_.cmd);
+ }
+ }
+
+
void QContentPane::mousePressEvent(QMouseEvent * e)
{
if (dc_event_.active && dc_event_ == *e) {
@@ -122,6 +152,9 @@ void QContentPane::mousePressEvent(QMous
void QContentPane::mouseReleaseEvent(QMouseEvent * e)
{
+ if (synthetic_mouse_event_.timeout.running())
+ synthetic_mouse_event_.timeout.stop();
+
FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
q_button_state(e->button()));
wa_->dispatch(cmd);
@@ -130,9 +163,55 @@ void QContentPane::mouseReleaseEvent(QMo
void QContentPane::mouseMoveEvent(QMouseEvent * e)
{
- FuncRequest cmd
- (LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state()));
- wa_->dispatch(cmd);
+ FuncRequest const cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
+ q_motion_state(e->state()));
+
+ // If we're above or below the work area...
+ if (e->y() <= 0 || e->y() >= height()) {
+ // Store the event, to be handled when the timeout expires.
+ synthetic_mouse_event_.cmd = cmd;
+
+ if (synthetic_mouse_event_.timeout.running()) {
+ // Discard the event. Note that it _may_ be handled
+ // when the timeout expires if
+ // synthetic_mouse_event_.cmd has not been overwritten.
+ // Ie, when the timeout expires, we handle the
+ // most recent event but discard all others that
+ // occurred after the one used to start the timeout
+ // in the first place.
+ return;
+ } else {
+ synthetic_mouse_event_.restart_timeout = true;
+ synthetic_mouse_event_.timeout.start();
+ // Fall through to handle this event...
+ }
+
+ } else if (synthetic_mouse_event_.timeout.running()) {
+ // Store the event, to be possibly handled when the timeout
+ // expires.
+ // Once the timeout has expired, normal control is returned
+ // to mouseMoveEvent (restart_timeout = false).
+ // This results in a much smoother 'feel' when moving the
+ // mouse back into the work area.
+ synthetic_mouse_event_.cmd = cmd;
+ synthetic_mouse_event_.restart_timeout = false;
+ return;
+ }
+
+ // Has anything changed on-screen since the last QMouseEvent
+ // was received?
+ double const scrollbar_value = wa_->scrollbar_->value();
+ if (e->x() != synthetic_mouse_event_.x_old ||
+ e->y() != synthetic_mouse_event_.y_old ||
+ scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) {
+ // Yes it has. Store the params used to check this.
+ synthetic_mouse_event_.x_old = e->x();
+ synthetic_mouse_event_.y_old = e->y();
+ synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
+
+ // ... and dispatch the event to the LyX core.
+ wa_->dispatch(cmd);
+ }
}
Index: src/frontends/qt2/QContentPane.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.h,v
retrieving revision 1.7
diff -u -p -r1.7 QContentPane.h
--- src/frontends/qt2/QContentPane.h 21 Oct 2002 04:46:26 -0000 1.7
+++ src/frontends/qt2/QContentPane.h 28 Dec 2003 15:15:45 -0000
@@ -16,6 +16,13 @@
#pragma interface
#endif
+#ifdef emit
+#undef emit
+#endif
+
+#include "funcrequest.h"
+#include "frontends/Timeout.h"
+
#include <qwidget.h>
#include <qevent.h>
#include <qpixmap.h>
@@ -45,6 +52,27 @@ struct double_click {
};
+/** Qt only emits mouse events when the mouse is being moved, but
+ * we want to generate 'pseudo' mouse events when the mouse button is
+ * pressed and the mouse cursor is below the bottom, or above the top
+ * of the work area. In this way, we'll be able to continue scrolling
+ * (and selecting) the text.
+ *
+ * This struct stores all the parameters needed to make this happen.
+ */
+struct SyntheticMouseEvent
+{
+ SyntheticMouseEvent();
+
+ FuncRequest cmd;
+ Timeout timeout;
+ bool restart_timeout;
+ int x_old;
+ int y_old;
+ double scrollbar_value_old;
+};
+
+
/**
* Widget for actually drawing the document on
*/
@@ -78,6 +106,10 @@ public slots:
void scrollBarChanged(int);
private:
+ /// The slot connected to SyntheticMouseEvent::timeout.
+ void generateSyntheticMouseEvent();
+ SyntheticMouseEvent synthetic_mouse_event_;
+
/// owning widget
QWorkArea * wa_;
Index: src/frontends/xforms/xforms_helpers.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.C,v
retrieving revision 1.54
diff -u -p -r1.54 xforms_helpers.C
--- src/frontends/xforms/xforms_helpers.C 4 Dec 2002 02:57:14 -0000 1.54
+++ src/frontends/xforms/xforms_helpers.C 28 Dec 2003 15:15:46 -0000
@@ -16,6 +16,7 @@
#include "xforms_helpers.h"
+#include "debug.h"
#include "lyxlex.h"
#include "gettext.h"
#include "lyxlength.h"
@@ -280,8 +281,11 @@ const int xformCount = sizeof(xformTags)
bool XformsColor::read(string const & filename)
{
LyXLex lexrc(xformTags, xformCount);
- if (!lexrc.setFile(filename))
+ if (!lexrc.setFile(filename)) {
+ lyxerr << "XformsColor::read(" << filename << ")\n"
+ << "Failed to open file." << std::endl;
return false;
+ }
while (lexrc.isOK()) {
int const le = lexrc.lex();
@@ -322,8 +326,11 @@ bool XformsColor::read(string const & fi
bool XformsColor::write(string const & filename)
{
ofstream os(filename.c_str());
- if (!os)
+ if (!os) {
+ lyxerr << "XformsColor::write(" << filename << ")\n"
+ << "Failed to open file." << std::endl;
return false;
+ }
os << "###"
<< "### file " << filename << "\n\n"
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.2
diff -u -p -r1.146.2.2 insetgraphics.C
--- src/insets/insetgraphics.C 15 Sep 2003 10:11:27 -0000 1.146.2.2
+++ src/insets/insetgraphics.C 28 Dec 2003 15:15:47 -0000
@@ -746,16 +746,21 @@ int InsetGraphics::latex(Buffer const *b
// "nice" means that the buffer is exported to LaTeX format but not
// run through the LaTeX compiler.
if (buf->niceFile) {
- os << before <<'{' << params().filename << '}' << after;
+ os << before <<'{' << MakeLatexName(params().filename)
+ << '}' << after;
return 1;
}
// Make the filename relative to the lyx file
// and remove the extension so the LaTeX will use whatever is
// appropriate (when there are several versions in different formats)
+ string const latex_name = message.empty() ?
+ MakeLatexName(os::external_path(prepareFile(buf))) :
+ MakeLatexName(params().filename);
+
string const latex_str = message.empty() ?
- (before + '{' + os::external_path(prepareFile(buf)) + '}' + after) :
- (before + '{' + params().filename + " not found!}" + after);
+ (before + '{' + latex_name + '}' + after) :
+ (before + '{' + latex_name + " not found!}" + after);
os << latex_str;
// Return how many newlines we issued.