+2000-12-02 Dekel Tsur <dekelts@tau.ac.il>
+
+ * src/BufferView_pimpl.C (workAreaMotionNotify): Fixed mouse
+ movement in inset in RTL text.
+ (checkInsetHit): Fixed mouse movement in scrolled inset in RTL text.
+ (workAreaButtonRelease): Do not open a float when there is a selection.
+
+ * src/insets/insettext.C (cx): Fixed for insets in RTL text.
+
+ * src/spellchecker.C (RunSpellChecker): Open all floats before
+ spellchecking.
+
+ * src/text.C (InsertChar): Consider "," as a part of a number
+ (for LTR numbers in RTL text code).
+ (IsBoundary): Fixed (and simplified).
+ (InsertChar): Recalculate cursor boundary.
+ (Backspace): Ditto.
+
+2000-12-04 John Levon <moz@compsoc.man.ac.uk>
+
+ * src/spellchecker.C: fix figures with pspell enabled
+
+ * src/insets/figinset.C: workaround for gs hang xforms bug
+
2000-12-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/bind/??_menus.bind: comment out the entries corresponding to
// Check for inset locking
if (bv_->theLockingInset()) {
LyXCursor cursor = bv_->text->cursor;
+ LyXFont font = bv_->text->GetFont(bv_->buffer(),
+ cursor.par(), cursor.pos());
+ int width = bv_->theLockingInset()->width(bv_, font);
+ int inset_x = font.isVisibleRightToLeft()
+ ? cursor.x() - width : cursor.x();
+ int start_x = inset_x + bv_->theLockingInset()->scroll();
bv_->theLockingInset()->
InsetMotionNotify(bv_,
- x - cursor.x() -
- bv_->theLockingInset()->scroll(),
+ x - start_x,
y - cursor.y() + bv_->text->first,
state);
return;
GetChar(bv_->text->cursor.pos());
}
#ifndef NEW_INSETS
+ if(!bv_->text->selection)
if (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
Inset * tmpinset = cursor.par()->GetInset(cursor.pos());
LyXFont font = text->GetFont(bv_->buffer(),
cursor.par(), cursor.pos());
- bool is_rtl = font.isVisibleRightToLeft();
- int start_x;
- int end_x;
-
- if (is_rtl) {
- start_x = cursor.x() - tmpinset->width(bv_, font) + tmpinset->scroll();
- end_x = cursor.x() + tmpinset->scroll();
- } else {
- start_x = cursor.x() + tmpinset->scroll();
- end_x = cursor.x() + tmpinset->width(bv_, font) + tmpinset->scroll();
- }
+ int width = tmpinset->width(bv_, font);
+ int inset_x = font.isVisibleRightToLeft()
+ ? cursor.x() - width : cursor.x();
+ int start_x = inset_x + tmpinset->scroll();
+ int end_x = inset_x + width;
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
Inset * tmpinset = cursor.par()->GetInset(cursor.pos()-1);
LyXFont font = text->GetFont(bv_->buffer(), cursor.par(),
cursor.pos()-1);
- bool is_rtl = font.isVisibleRightToLeft();
- int start_x;
- int end_x;
-
- if (!is_rtl) {
- start_x = cursor.x() - tmpinset->width(bv_, font) +
- tmpinset->scroll();
- end_x = cursor.x() + tmpinset->scroll();
- } else {
- start_x = cursor.x() + tmpinset->scroll();
- end_x = cursor.x() + tmpinset->width(bv_, font) +
- tmpinset->scroll();
- }
+ int width = tmpinset->width(bv_, font);
+ int inset_x = font.isVisibleRightToLeft()
+ ? cursor.x() : cursor.x() - width;
+ int start_x = inset_x + tmpinset->scroll();
+ int end_x = inset_x + width;
+
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
}
-extern "C" // static
-int GhostscriptMsg(FL_OBJECT *, Window, int, int,
- XEvent * ev, void *)
+extern "C" {
+static
+int GhostscriptMsg(XEvent * ev, void *)
{
+ // bin all events not of interest
+ if (ev->type != ClientMessage)
+ return FL_PREEMPT;
+
XClientMessageEvent * e = reinterpret_cast<XClientMessageEvent*>(ev);
if (lyxerr.debugging()) {
}
break;
}
- return 0;
+ return FL_PREEMPT;
+}
}
}
+// xforms doesn't define this
+extern "C" FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
+
static
void InitFigures()
{
// first get visual
gs_color = false;
if (lyxrc.use_gui) {
- fl_add_canvas_handler(figinset_canvas, ClientMessage,
- GhostscriptMsg,
- current_view->owner()->getForm());
+ /* we want to capture every event, in order to work around an
+ * xforms bug.
+ */
+ fl_set_preemptive_callback(fl_get_canvas_id(figinset_canvas), GhostscriptMsg, 0);
local_gc_copy = createGC();
figures.clear();
lyxerr.debug() << "Unregistering figures..." << endl;
-
- fl_remove_canvas_handler(figinset_canvas, ClientMessage,
- GhostscriptMsg);
}
int InsetText::cx(BufferView * bv) const
{
- return TEXT(bv)->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
+ LyXText * text = TEXT(bv);
+ int x = text->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
+ if (the_locking_inset) {
+ LyXFont font = text->GetFont(bv->buffer(),
+ text->cursor.par(), text->cursor.pos());
+ if (font.isVisibleRightToLeft())
+ x -= the_locking_inset->width(bv, font);
+ }
+ return x;
}
#include "encoding.h"
#include "support/lstrings.h"
-//#define USE_PSPELL 1
-
#ifdef USE_PSPELL
-
-#include <pspell/pspell.h>
-
+# include <pspell/pspell.h>
#endif
using std::reverse;
FD_form_spell_options *fd_form_spell_options = 0;
FD_form_spell_check *fd_form_spell_check = 0;
-//void sigchldhandler(int sig);
void sigchldhandler(pid_t pid, int *status);
-//extern void sigchldchecker(int sig);
extern void sigchldchecker(pid_t pid, int *status);
#ifndef USE_PSPELL
-// Send word to ispell and get reply
+// Send word to pspell and get reply
static
isp_result * sc_check_word(string const & word)
{
int newvalue;
FL_OBJECT * obj;
+#ifndef NEW_INSETS
+ // Open all floats
+ bv->allFloats(1, 0);
+ bv->allFloats(1, 1);
+#endif
+
#ifdef USE_PSPELL
string tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : bv->buffer()->params.language->code();
}
}
-
-#ifndef USE_PSPELL
-
+#warning should go somewhere more sensible
void sigchldhandler(pid_t pid, int * status)
{
if (isp_pid > 0)
}
sigchldchecker(pid, status);
}
-
-#else
-
-void sigchldhandler(pid_t, int *)
-{
- // do nothing
-}
-
-#endif
if (!lyxrc.rtl_support)
return false; // This is just for speedup
- if (!bidi_InRange(pos - 1))
+ if (!bidi_InRange(pos - 1)) {
+ lyxerr << "LyXText::IsBoundary This shouldn't happen\n";
return false;
+ }
bool const rtl = bidi_level(pos - 1) % 2;
- bool rtl2 = rtl;
- if (pos == par->Last())
- rtl2 = par->isRightToLeftPar(buf->params);
- else if (bidi_InRange(pos))
- rtl2 = bidi_level(pos) % 2;
+ bool rtl2 = bidi_InRange(pos)
+ ? bidi_level(pos) % 2
+ : par->isRightToLeftPar(buf->params);
return rtl != rtl2;
}
return false; // This is just for speedup
bool const rtl = font.isVisibleRightToLeft();
- bool rtl2 = rtl;
- if (pos == par->Last())
- rtl2 = par->isRightToLeftPar(buf->params);
- else if (bidi_InRange(pos))
- rtl2 = bidi_level(pos) % 2;
+ bool rtl2 = bidi_InRange(pos)
+ ? bidi_level(pos) % 2
+ : par->isRightToLeftPar(buf->params);
return rtl != rtl2;
}
if (lyxrc.auto_number) {
if (current_font.number() == LyXFont::ON) {
if (!isdigit(c) && !strchr("+-/*", c) &&
- !(strchr(".",c) &&
+ !(strchr(".,",c) &&
cursor.pos() >= 1 &&
cursor.pos() < cursor.par()->size() &&
GetFont(bview->buffer(),
cursor.par(),
cursor.pos() - 1,
current_font);
- } else if (strchr(".", c) &&
+ } else if (strchr(".,", c) &&
cursor.pos() >= 2 &&
GetFont(bview->buffer(),
cursor.par(),
SetCursor(bview, cursor.par(), cursor.pos() + 1, false,
cursor.boundary());
+ if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos())
+ != cursor.boundary())
+ SetCursor(bview, cursor.par(), cursor.pos(), false,
+ !cursor.boundary());
if (row->next() && row->next()->par() == row->par())
need_break_row = row->next();
else
// current_font = rawtmpfont;
// real_current_font = realtmpfont;
+ if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos())
+ != cursor.boundary())
+ SetCursor(bview, cursor.par(), cursor.pos(), false,
+ !cursor.boundary());
+
lastpos = cursor.par()->Last();
- if (cursor.pos() == lastpos) {
- if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) != cursor.boundary())
- SetCursor(bview, cursor.par(), cursor.pos(), false, !cursor.boundary());
+ if (cursor.pos() == lastpos)
SetCurrentFont(bview);
- }
- // check, wether the last characters font has changed.
+ // check, whether the last characters font has changed.
if (rawparfont !=
cursor.par()->GetFontSettings(bview->buffer()->params, lastpos - 1)) {
RedoHeightOfParagraph(bview, cursor);