mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Various fixes from Dekel Tsur.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@637 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b8dd79b64d
commit
0542d7af5d
58
ChangeLog
58
ChangeLog
@ -1,3 +1,61 @@
|
||||
2000-04-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/text.C (Backspace): some additional cleanups (we already
|
||||
know whether cursor.pos is 0 or not).
|
||||
|
||||
* lib/reLyX/Makefile.am (DESTDIR): add an empty value (since
|
||||
automake does not provide one).
|
||||
|
||||
* src/bmtable.h: replace C++ comments with C comments.
|
||||
|
||||
2000-04-02 Dekel Tsur <dekel@math.tau.ac.il>
|
||||
|
||||
* src/screen.C (ShowCursor): Change the shape of the cursor if
|
||||
the current language is not equal to the language of the document.
|
||||
(If the cursor change its shape unexpectedly, then you've found a bug)
|
||||
|
||||
* src/insets/insettext.C (LocalDispatch, UpdateLocal) Fixed some
|
||||
bugs [I hope...]
|
||||
|
||||
* src/insets/insetnumber.[Ch]: New files.
|
||||
|
||||
* src/LyXAction.C (init)
|
||||
* src/lyxfunc.C (dispatch): Add command number-inset-insert
|
||||
|
||||
* lyxrc.example
|
||||
* src/lyxrc.C: Renamed command \auto_mathmode to \number_inset
|
||||
|
||||
* src/lyxparagraph.h
|
||||
* src/paragraph.C: Changed insetlist to Vector<InsetTable>.
|
||||
(the vector is kept sorted).
|
||||
|
||||
* src/text.C (GetVisibleRow): Draw selection correctly when there
|
||||
is both LTR and RTL text.
|
||||
|
||||
* src/paragraph.C (Clone): Use the assignment operator for cloning,
|
||||
which is much faster.
|
||||
|
||||
* src/text.C (GetVisibleRow and other): Do not draw the last space
|
||||
in a row if the direction of the last letter is not equal to the
|
||||
direction of the paragraph.
|
||||
|
||||
* src/lyxfont.C (latexWriteStartChanges):
|
||||
Check that font language is not equal to basefont language.
|
||||
(latexWriteEndChanges): ditto
|
||||
|
||||
* src/lyx_cb.C (StyleReset): Don't change the language while using
|
||||
the font-default command.
|
||||
|
||||
* src/paragraph.C (GetFirstFontSettings): Handle correctly an
|
||||
empty paragraph before a footnote.
|
||||
|
||||
* src/insets/insetcommand.C (draw): Increase x correctly.
|
||||
|
||||
* src/screen.C (ShowCursor): Change cursor shape if
|
||||
current language != document language.
|
||||
|
||||
* src/lyxfunc.C (dispatch): Added calls to owner->view()->setState()
|
||||
|
||||
2000-03-31 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/paragraph.C (GetInset): commented out text[pos] = ' '
|
||||
|
@ -631,12 +631,12 @@
|
||||
# Arabic). Default is false.
|
||||
#\rtl true
|
||||
|
||||
# If auto_mathmode is set to "true", each time a digit key is pressed,
|
||||
# LyX will automatically enter into math-mode.
|
||||
# If auto_mathmode is set to "rtl", the above behavior will take place
|
||||
# only when editing right-to-left text.
|
||||
# Default is false.
|
||||
#\auto_mathmode true
|
||||
# If number_inset is set to "true", each time a digit key is pressed,
|
||||
# LyX will automatically open a new number inset.
|
||||
# If number_inset is set to "rtl", the above behavior will take place
|
||||
# only when the cursor is on right-to-left text.
|
||||
# Default is rtl.
|
||||
#\number_inset true
|
||||
|
||||
# The latex command for loading the language package.
|
||||
# Default is \usepackage{babel}.
|
||||
@ -670,7 +670,7 @@
|
||||
#\kbmap_secondary hebrew
|
||||
#\latex_command elatex
|
||||
#\font_encoding default
|
||||
#\auto_mathmode rtl
|
||||
#\number_inset rtl
|
||||
|
||||
# You also need to bind a key for switching between Hebrew and English.
|
||||
# For example,
|
||||
@ -694,7 +694,7 @@
|
||||
#\kbmap true
|
||||
#\kbmap_primary null
|
||||
#\kbmap_secondary arabic
|
||||
#\auto_mathmode false
|
||||
#\number_inset false
|
||||
|
||||
# You also need to bind a key for switching between Arabic and English.
|
||||
# For example,
|
||||
|
@ -10,6 +10,7 @@ EXTRA_DIST = BUGS BasicLyX.pm CHANGES CleanTeX.pm LastLyX.pm MANIFEST \
|
||||
reLyXmain.pl syntax.default test.ltx test.lyx reLyX.man \
|
||||
RelyxFigure.pm Verbatim.pm \
|
||||
$(LYXDISTDIRS)
|
||||
DESTDIR =
|
||||
|
||||
LIBINSTFILES = *.pm *.pl README BUGS CHANGES reLyX.pod syntax.default Text/*.pm
|
||||
|
||||
|
@ -291,6 +291,8 @@ void LyXAction::init()
|
||||
{ LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
|
||||
{ LFUN_INSERT_NOTE, "note-insert", "", Noop },
|
||||
{ LFUN_GOTONOTE, "note-next", "", ReadOnly },
|
||||
{ LFUN_INSET_NUMBER , "number-inset-insert",
|
||||
N_("Insert a new Number Inset"), Noop },
|
||||
{ LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
|
||||
{ LFUN_DOWN_PARAGRAPH, "paragraph-down",
|
||||
N_("Go one paragraph down"), ReadOnly },
|
||||
|
@ -23,11 +23,11 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
///
|
||||
/**/
|
||||
#define FL_BMTABLE 1500
|
||||
/// A flat bitmap table
|
||||
/* A flat bitmap table */
|
||||
#define FL_BMTABLE_FLAT 0
|
||||
/// A grided bitmap table
|
||||
/* A grided bitmap table */
|
||||
#define FL_BMTABLE_GRID 1
|
||||
|
||||
|
||||
@ -40,25 +40,25 @@ extern "C"
|
||||
#define FL_BMTABLE_BOXTYPE FL_UP_BOX
|
||||
|
||||
|
||||
///
|
||||
/**/
|
||||
FL_OBJECT *fl_create_bmtable(int, FL_Coord, FL_Coord,
|
||||
FL_Coord, FL_Coord, char const *);
|
||||
///
|
||||
/**/
|
||||
FL_OBJECT *fl_add_bmtable(int, FL_Coord, FL_Coord,
|
||||
FL_Coord, FL_Coord, char const *);
|
||||
|
||||
/** Same as fl_get_button_numb() */
|
||||
int fl_get_bmtable_numb(FL_OBJECT *ob);
|
||||
///
|
||||
/**/
|
||||
void fl_set_bmtable(FL_OBJECT *, int pushed, int pos);
|
||||
|
||||
/** Number of columns and rows, and the background bitmap */
|
||||
void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char const *);
|
||||
///
|
||||
/**/
|
||||
void fl_set_bmtable_pixmap_data(FL_OBJECT *, int, int, char **);
|
||||
///
|
||||
/**/
|
||||
void fl_set_bmtable_file(FL_OBJECT *, int, int, char const *);
|
||||
///
|
||||
/**/
|
||||
void fl_set_bmtable_pixmap_file(FL_OBJECT *, int, int, char const *);
|
||||
|
||||
/** Adjust bitmap origin (ox, oy) and cell dimensions (dx, dy) incrementally */
|
||||
@ -66,7 +66,7 @@ void fl_set_bmtable_adjust(FL_OBJECT *, int ox, int oy, int dx, int dy);
|
||||
|
||||
/** The number of items is by default nc x nr, but you can change it */
|
||||
void fl_set_bmtable_maxitems(FL_OBJECT *, int);
|
||||
///
|
||||
/**/
|
||||
int fl_get_bmtable_maxitems(FL_OBJECT *);
|
||||
|
||||
/** Returns the index of the selected item or -1 if none was selected */
|
||||
|
@ -74,6 +74,7 @@ using std::setw;
|
||||
#include "insets/insetspecialchar.h"
|
||||
#include "insets/figinset.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "insets/insetnumber.h"
|
||||
#include "insets/insetert.h"
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetfoot.h"
|
||||
@ -812,6 +813,13 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
} else if (tmptok == "Number") {
|
||||
inset = new InsetNumber(this);
|
||||
inset->Read(lex);
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
} else if (tmptok == "Foot") {
|
||||
inset = new InsetFoot(this);
|
||||
inset->Read(lex);
|
||||
|
@ -246,6 +246,7 @@ enum kb_action {
|
||||
LFUN_INSET_ERT, // Jug 20000218
|
||||
LFUN_INSERT_GRAPHICS, // Lgb 20000226
|
||||
LFUN_INSET_FOOTNOTE, // Jug 20000307
|
||||
LFUN_INSET_NUMBER, // Dekel 20000402
|
||||
LFUN_LASTACTION /* this marks the end of the table */
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,8 @@ libinsets_la_SOURCES = \
|
||||
insetlof.h \
|
||||
insetlot.C \
|
||||
insetlot.h \
|
||||
insetnumber.C \
|
||||
insetnumber.h \
|
||||
insetparent.C \
|
||||
insetparent.h \
|
||||
insetquotes.C \
|
||||
|
@ -493,7 +493,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
cutSelection();
|
||||
actpos = selection_start;
|
||||
par->InsertChar(actpos,arg[0]);
|
||||
par->SetFont(actpos,real_current_font);
|
||||
SetCharFont(actpos,current_font);
|
||||
++actpos;
|
||||
selection_start = selection_end = actpos;
|
||||
UpdateLocal(bv, true);
|
||||
@ -665,7 +665,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
bv->text->cursor.par->ParFromPos(bv->text->cursor.pos)->previous,
|
||||
bv->text->cursor.par->ParFromPos(bv->text->cursor.pos)->next);
|
||||
par->InsertChar(actpos,LyXParagraph::META_NEWLINE);
|
||||
par->SetFont(actpos,real_current_font);
|
||||
SetCharFont(actpos,current_font);
|
||||
UpdateLocal(bv, true);
|
||||
++actpos;
|
||||
selection_start = selection_end = actpos;
|
||||
@ -1308,9 +1308,10 @@ void InsetText::UpdateLocal(BufferView *bv, bool flag)
|
||||
if (flag) {
|
||||
computeTextRows(bv->painter(), xpos);
|
||||
computeBaselines(top_baseline);
|
||||
resetPos(bv);
|
||||
}
|
||||
bv->updateInset(this, flag);
|
||||
if (flag)
|
||||
resetPos(bv);
|
||||
ShowInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,9 @@ public:
|
||||
///
|
||||
MARGIN_CODE,
|
||||
///
|
||||
SPECIALCHAR_CODE
|
||||
SPECIALCHAR_CODE,
|
||||
///
|
||||
NUMBER_CODE
|
||||
};
|
||||
|
||||
enum EDITABLE {
|
||||
|
10
src/lyx_cb.C
10
src/lyx_cb.C
@ -2160,7 +2160,7 @@ void LangCB(string const & l)
|
||||
|
||||
void StyleReset()
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_INHERIT);
|
||||
LyXFont font(LyXFont::ALL_INHERIT, ignore_language);
|
||||
ToggleAndShow(current_view, font);
|
||||
}
|
||||
|
||||
@ -2697,11 +2697,9 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
||||
|
||||
if (!current_view->available())
|
||||
return;
|
||||
if (lyxrc.rtl_support) {
|
||||
current_view->text->SetCursor(current_view->text->cursor.par,
|
||||
current_view->text->cursor.pos);
|
||||
current_view->setState();
|
||||
}
|
||||
current_view->text->SetCursor(current_view->text->cursor.par,
|
||||
current_view->text->cursor.pos);
|
||||
current_view->setState();
|
||||
|
||||
LyXTextClassList::ClassList::size_type new_class =
|
||||
fl_get_choice(fd_form_document->choice_class) - 1;
|
||||
|
@ -663,7 +663,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
|
||||
int count = 0;
|
||||
bool env = false;
|
||||
|
||||
if (language() != prev.language()) {
|
||||
if (language() != base.language() && language() != prev.language()) {
|
||||
if (isRightToLeft() != prev.isRightToLeft()) {
|
||||
if (isRightToLeft()) {
|
||||
os << "\\R{";
|
||||
@ -755,7 +755,7 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
|
||||
int count = 0;
|
||||
bool env = false;
|
||||
|
||||
if (language() != next.language()) {
|
||||
if (language() != base.language() && language() != next.language()) {
|
||||
os << "}";
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "insets/insetinclude.h"
|
||||
#include "insets/insetbib.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "insets/insetnumber.h"
|
||||
#include "insets/insetert.h"
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetfoot.h"
|
||||
@ -567,24 +568,33 @@ string LyXFunc::Dispatch(int ac,
|
||||
setMessage(N_("Text mode"));
|
||||
LyXDirection direction = owner->view()->text->
|
||||
cursor.par->getParDirection();
|
||||
if ((action == -1) ||
|
||||
((action == LFUN_RIGHT) &&
|
||||
(direction == LYX_DIR_LEFT_TO_RIGHT))) {
|
||||
switch(action) {
|
||||
case LFUN_UNKNOWN_ACTION:
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKLINE:
|
||||
owner->view()->text->CursorRight();
|
||||
moveCursorUpdate(false);
|
||||
owner->getMiniBuffer()->
|
||||
Set(CurrentState());
|
||||
}
|
||||
if ((action == LFUN_LEFT) &&
|
||||
(direction == LYX_DIR_RIGHT_TO_LEFT)) {
|
||||
owner->view()->text->CursorRight();
|
||||
moveCursorUpdate(false);
|
||||
owner->getMiniBuffer()->
|
||||
Set(CurrentState());
|
||||
}
|
||||
if ((action == LFUN_LEFT) ||
|
||||
(action == LFUN_RIGHT))
|
||||
owner->view()->setState();
|
||||
owner->getMiniBuffer()->Set(CurrentState());
|
||||
break;
|
||||
case LFUN_RIGHT:
|
||||
if (direction == LYX_DIR_LEFT_TO_RIGHT) {
|
||||
owner->view()->text->CursorRight();
|
||||
moveCursorUpdate(false);
|
||||
owner->getMiniBuffer()->
|
||||
Set(CurrentState());
|
||||
}
|
||||
return string();
|
||||
case LFUN_LEFT:
|
||||
if (direction == LYX_DIR_RIGHT_TO_LEFT) {
|
||||
owner->view()->text->CursorRight();
|
||||
moveCursorUpdate(false);
|
||||
owner->getMiniBuffer()->
|
||||
Set(CurrentState());
|
||||
}
|
||||
return string();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -881,6 +891,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_PASTE:
|
||||
owner->view()->paste();
|
||||
owner->view()->setState();
|
||||
break;
|
||||
|
||||
case LFUN_PASTESELECTION:
|
||||
@ -905,6 +916,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_LAYOUT_PASTE:
|
||||
owner->view()->pasteEnvironment();
|
||||
owner->view()->setState();
|
||||
break;
|
||||
|
||||
case LFUN_GOTOERROR:
|
||||
@ -1138,6 +1150,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
text->cursor.par->
|
||||
GetLayout() + 1);
|
||||
owner->view()->update(1);
|
||||
owner->view()->setState();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1947,6 +1960,13 @@ string LyXFunc::Dispatch(int ac,
|
||||
new_inset->Edit(owner->view(), 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_NUMBER:
|
||||
{
|
||||
InsetNumber * new_inset = new InsetNumber(owner->buffer());
|
||||
owner->view()->insertInset(new_inset);
|
||||
new_inset->Edit(owner->view(), 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_ERT:
|
||||
{
|
||||
InsetERT * new_inset = new InsetERT(owner->buffer());
|
||||
@ -2545,28 +2565,13 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->beforeChange();
|
||||
|
||||
if (isdigit(argument[0]) &&
|
||||
(lyxrc.auto_mathmode == "true" ||
|
||||
(lyxrc.auto_mathmode == "rtl" &&
|
||||
(lyxrc.number_inset == "true" ||
|
||||
(lyxrc.number_inset == "rtl" &&
|
||||
owner->view()->text->real_current_font.isVisibleRightToLeft()
|
||||
))) {
|
||||
UpdatableInset * tmpinset = new InsetFormula;
|
||||
LyXCursor & cursor = owner->view()->text->cursor;
|
||||
if (cursor.pos > 0 &&
|
||||
cursor.par->GetChar(cursor.pos - 1) == '-' &&
|
||||
(cursor.pos == 1 ||
|
||||
cursor.par->IsSeparator(cursor.pos - 2) ||
|
||||
cursor.par->IsNewline(cursor.pos - 2) )
|
||||
) {
|
||||
owner->view()->text->Backspace();
|
||||
owner->view()->open_new_inset(tmpinset);
|
||||
tmpinset->LocalDispatch(owner->view(),
|
||||
LFUN_UNKNOWN_ACTION,
|
||||
"-");
|
||||
} else {
|
||||
owner->view()->open_new_inset(tmpinset);
|
||||
}
|
||||
tmpinset->LocalDispatch(owner->view(),
|
||||
LFUN_UNKNOWN_ACTION,
|
||||
UpdatableInset * tmpinset = new InsetNumber(owner->buffer());
|
||||
owner->view()->open_new_inset(tmpinset);
|
||||
tmpinset->LocalDispatch(owner->view(), action,
|
||||
argument);
|
||||
return string();
|
||||
}
|
||||
|
@ -537,13 +537,15 @@ private:
|
||||
size_type pos;
|
||||
///
|
||||
Inset * inset;
|
||||
///
|
||||
InsetTable(size_type p, Inset * i) { pos = p; inset = i;}
|
||||
};
|
||||
///
|
||||
typedef list<FontTable> FontList;
|
||||
///
|
||||
FontList fontlist;
|
||||
///
|
||||
typedef list<InsetTable> InsetList;
|
||||
typedef vector<InsetTable> InsetList;
|
||||
///
|
||||
InsetList insetlist;
|
||||
///
|
||||
@ -578,4 +580,11 @@ private:
|
||||
///
|
||||
static unsigned int paragraph_id;
|
||||
};
|
||||
|
||||
inline bool operator<(LyXParagraph::InsetTable const & a,
|
||||
LyXParagraph::InsetTable const & b)
|
||||
{
|
||||
return a.pos < b.pos;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
14
src/lyxrc.C
14
src/lyxrc.C
@ -134,7 +134,7 @@ enum LyXRCTags {
|
||||
RC_MAKE_BACKUP,
|
||||
RC_BACKUPDIR_PATH,
|
||||
RC_RTL_SUPPORT,
|
||||
RC_AUTO_MATHMODE,
|
||||
RC_NUMBER_INSET,
|
||||
RC_LANGUAGE_PACKAGE,
|
||||
RC_LANGUAGE_AUTO_BEGIN,
|
||||
RC_LANGUAGE_AUTO_END,
|
||||
@ -164,7 +164,6 @@ keyword_item lyxrcTags[] = {
|
||||
{ "\\alternate_language", RC_ALT_LANG },
|
||||
{ "\\ascii_linelen", RC_ASCII_LINELEN },
|
||||
{ "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
|
||||
{ "\\auto_mathmode", RC_AUTO_MATHMODE },
|
||||
{ "\\auto_region_delete", RC_AUTOREGIONDELETE },
|
||||
{ "\\autosave", RC_AUTOSAVE },
|
||||
{ "\\background_color", RC_BACKGROUND_COLOR },
|
||||
@ -212,6 +211,7 @@ keyword_item lyxrcTags[] = {
|
||||
{ "\\literate_extension", RC_LITERATE_EXTENSION },
|
||||
{ "\\make_backup", RC_MAKE_BACKUP },
|
||||
{ "\\num_lastfiles", RC_NUMLASTFILES },
|
||||
{ "\\number_inset", RC_NUMBER_INSET },
|
||||
{ "\\pdf_mode", RC_PDF_MODE },
|
||||
{ "\\pdf_to_ps_command", RC_PDF_TO_PS_COMMAND },
|
||||
{ "\\pdflatex_command", RC_PDFLATEX_COMMAND },
|
||||
@ -362,7 +362,7 @@ void LyXRC::setDefaults() {
|
||||
use_kbmap = false;
|
||||
hasBindFile = false;
|
||||
rtl_support = false;
|
||||
auto_mathmode = "rtl";
|
||||
number_inset = "rtl";
|
||||
language_package = "\\usepackage{babel}";
|
||||
language_auto_begin = true;
|
||||
language_auto_end = true;
|
||||
@ -1001,9 +1001,9 @@ int LyXRC::read(string const & filename)
|
||||
if (lexrc.next())
|
||||
rtl_support = lexrc.GetBool();
|
||||
break;
|
||||
case RC_AUTO_MATHMODE:
|
||||
case RC_NUMBER_INSET:
|
||||
if (lexrc.next())
|
||||
auto_mathmode = lowercase(lexrc.GetString());
|
||||
number_inset = lowercase(lexrc.GetString());
|
||||
break;
|
||||
case RC_SHOW_BANNER:
|
||||
if (lexrc.next())
|
||||
@ -1326,8 +1326,8 @@ void LyXRC::output(ostream & os) const
|
||||
os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
|
||||
case RC_RTL_SUPPORT:
|
||||
os << "\\rtl " << tostr(rtl_support) << "\n";
|
||||
case RC_AUTO_MATHMODE:
|
||||
os << "\\auto_mathmode" << auto_mathmode << "\n";
|
||||
case RC_NUMBER_INSET:
|
||||
os << "\\number_inset " << number_inset << "\n";
|
||||
case RC_LANGUAGE_AUTO_BEGIN:
|
||||
os << "\\language_auto_begin "
|
||||
<< tostr(language_auto_begin) << "\n";
|
||||
|
@ -222,7 +222,7 @@ public:
|
||||
///
|
||||
bool rtl_support;
|
||||
///
|
||||
string auto_mathmode;
|
||||
string number_inset;
|
||||
///
|
||||
bool show_banner;
|
||||
/// Do we have to use a GUI?
|
||||
|
@ -299,9 +299,8 @@ public:
|
||||
decide, wether it is selected text or not. This is a strange
|
||||
solution but faster.
|
||||
*/
|
||||
void GetVisibleRow(int offset,
|
||||
Row * row_ptr, long y);
|
||||
|
||||
void GetVisibleRow(int offset, Row * row_ptr, long y);
|
||||
|
||||
/* footnotes: */
|
||||
///
|
||||
void ToggleFootnote();
|
||||
@ -615,6 +614,9 @@ private:
|
||||
///
|
||||
mutable LyXParagraph::size_type bidi_start;
|
||||
|
||||
///
|
||||
mutable bool bidi_same_direction;
|
||||
|
||||
///
|
||||
void ComputeBidiTables(Row *row) const;
|
||||
|
||||
|
164
src/paragraph.C
164
src/paragraph.C
@ -37,7 +37,6 @@
|
||||
using std::endl;
|
||||
using std::fstream;
|
||||
using std::ios;
|
||||
using std::greater;
|
||||
|
||||
int tex_code_break_column = 72; // needs non-zero initialization. set later.
|
||||
// this is a bad idea, but how can LyXParagraph find its buffer to get
|
||||
@ -425,14 +424,11 @@ void LyXParagraph::CutIntoMinibuffer(LyXParagraph::size_type pos)
|
||||
// the inset, not just a clone. Otherwise
|
||||
// the inset would be deleted when calling Erase(pos)
|
||||
// find the entry
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos == pos) {
|
||||
(*it).inset = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (it != insetlist.end() && (*it).pos == pos)
|
||||
(*it).inset = 0;
|
||||
} else {
|
||||
minibuffer_inset = 0;
|
||||
minibuffer_char = ' ';
|
||||
@ -526,13 +522,12 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
// if it is an inset, delete the inset entry
|
||||
if (text[pos] == LyXParagraph::META_INSET) {
|
||||
// find the entry
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos == pos) {
|
||||
delete (*it).inset;
|
||||
insetlist.erase(it);
|
||||
break;
|
||||
}
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (it != insetlist.end() && (*it).pos == pos) {
|
||||
delete (*it).inset;
|
||||
insetlist.erase(it);
|
||||
}
|
||||
}
|
||||
text.erase(text.begin() + pos);
|
||||
@ -560,11 +555,11 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
}
|
||||
|
||||
// Update the inset table.
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos > pos)
|
||||
(*it).pos--;
|
||||
}
|
||||
for (InsetList::iterator it = upper_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
it != insetlist.end(); ++it)
|
||||
--(*it).pos;
|
||||
} else {
|
||||
lyxerr << "ERROR (LyXParagraph::Erase): "
|
||||
"can't erase non-existant char." << endl;
|
||||
@ -597,11 +592,11 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos, char c)
|
||||
}
|
||||
|
||||
// Update the inset table.
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos >= pos)
|
||||
(*it).pos++;
|
||||
}
|
||||
for (InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
it != insetlist.end(); ++it)
|
||||
++(*it).pos;
|
||||
}
|
||||
|
||||
|
||||
@ -628,10 +623,14 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
|
||||
|
||||
if (inset) {
|
||||
// Add a new entry in the inset table.
|
||||
InsetList::iterator it =
|
||||
insetlist.insert(insetlist.begin(), InsetTable());
|
||||
(*it).inset = inset;
|
||||
(*it).pos = pos;
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (it != insetlist.end() && (*it).pos == pos)
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"there is an inset in position: " << pos << endl;
|
||||
else
|
||||
insetlist.insert(it,InsetTable(pos,inset));
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,12 +650,12 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos)
|
||||
return 0;
|
||||
}
|
||||
// Find the inset.
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos == pos) {
|
||||
return (*it).inset;
|
||||
}
|
||||
}
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (it != insetlist.end() && (*it).pos == pos)
|
||||
return (*it).inset;
|
||||
|
||||
lyxerr << "ERROR (LyXParagraph::GetInset): "
|
||||
"Inset does not exist: " << pos << endl;
|
||||
// text[pos] = ' '; // WHY!!! does this set the pos to ' '????
|
||||
@ -683,12 +682,12 @@ Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const
|
||||
return 0;
|
||||
}
|
||||
// Find the inset.
|
||||
for (InsetList::const_iterator cit = insetlist.begin();
|
||||
cit != insetlist.end(); ++cit) {
|
||||
if ((*cit).pos == pos) {
|
||||
return (*cit).inset;
|
||||
}
|
||||
}
|
||||
InsetList::const_iterator cit = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (cit != insetlist.end() && (*cit).pos == pos)
|
||||
return (*cit).inset;
|
||||
|
||||
lyxerr << "ERROR (LyXParagraph::GetInset): "
|
||||
"Inset does not exist: " << pos << endl;
|
||||
//text[pos] = ' '; // WHY!!! does this set the pos to ' '????
|
||||
@ -756,7 +755,8 @@ LyXFont LyXParagraph::GetFirstFontSettings() const
|
||||
if (0 >= (*cit).pos && 0 <= (*cit).pos_end)
|
||||
return (*cit).font;
|
||||
#endif
|
||||
}
|
||||
} else if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
||||
return NextAfterFootnote()->GetFirstFontSettings();
|
||||
return LyXFont(LyXFont::ALL_INHERIT);
|
||||
}
|
||||
|
||||
@ -1478,27 +1478,12 @@ LyXParagraph * LyXParagraph::Clone() const
|
||||
|
||||
// copy everything behind the break-position to the new paragraph
|
||||
|
||||
// IMO this is not correct. Here we should not use the Minibuffer to
|
||||
// copy stuff, as the Minibuffer is global and we could be in a
|
||||
// situation where we copy a paragraph inside a paragraph (this now
|
||||
// is possible think of Text-Insets!). So I'm changing this so that
|
||||
// then inside the Text-Inset I can use par->Clone() to copy the
|
||||
// paragraph data from one inset to the other!
|
||||
#if 0
|
||||
for (size_type i = 0; i < size(); ++i) {
|
||||
CopyIntoMinibuffer(i);
|
||||
result->InsertFromMinibuffer(i);
|
||||
}
|
||||
#else
|
||||
for(size_type i = 0; i < size(); ++i) {
|
||||
result->InsertChar(i, GetChar(i));
|
||||
result->SetFont(i, GetFontSettings(i));
|
||||
if ((GetChar(i) == LyXParagraph::META_INSET) && GetInset(i)) {
|
||||
result->InsertInset(i, GetInset(i)->Clone());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
result->text.resize(result->text.size());
|
||||
result->text = text;
|
||||
result->fontlist = fontlist;
|
||||
result->insetlist = insetlist;
|
||||
for (InsetList::iterator it = result->insetlist.begin();
|
||||
it != result->insetlist.end(); ++it)
|
||||
(*it).inset = (*it).inset->Clone();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1891,37 +1876,29 @@ LyXParagraph const * LyXParagraph::DepthHook(int deth) const
|
||||
|
||||
int LyXParagraph::AutoDeleteInsets()
|
||||
{
|
||||
vector<size_type> tmpvec;
|
||||
int i = 0;
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).inset && (*it).inset->AutoDelete()) {
|
||||
tmpvec.push_back((*it).pos);
|
||||
int count = 0;
|
||||
unsigned int i = 0;
|
||||
while (i < insetlist.size()) {
|
||||
if (insetlist[i].inset && insetlist[i].inset->AutoDelete()) {
|
||||
Erase(insetlist[i].pos);
|
||||
// Erase() calls to insetlist.erase(&insetlist[i])
|
||||
// so i shouldn't be increased.
|
||||
++count;
|
||||
} else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
sort(tmpvec.begin(), tmpvec.end(), greater<size_type>());
|
||||
for (vector<size_type>::const_iterator cit = tmpvec.begin();
|
||||
cit != tmpvec.end(); ++cit) {
|
||||
Erase((*cit));
|
||||
}
|
||||
return i;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Inset * LyXParagraph::ReturnNextInsetPointer(LyXParagraph::size_type & pos)
|
||||
{
|
||||
InsetList::iterator it2 = insetlist.end();
|
||||
for (InsetList::iterator it = insetlist.begin();
|
||||
it != insetlist.end(); ++it) {
|
||||
if ((*it).pos >= pos) {
|
||||
if (it2 == insetlist.end() || (*it).pos < (*it2).pos)
|
||||
it2 = it;
|
||||
}
|
||||
}
|
||||
if (it2 != insetlist.end()) {
|
||||
pos = (*it2).pos;
|
||||
return (*it2).inset;
|
||||
InsetList::iterator it = lower_bound(insetlist.begin(),
|
||||
insetlist.end(),
|
||||
InsetTable(pos,0));
|
||||
if (it != insetlist.end()) {
|
||||
pos = (*it).pos;
|
||||
return (*it).inset;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -3097,14 +3074,21 @@ void LyXParagraph::SimpleTeXSpecialChars(ostream & os, TexRow & texrow,
|
||||
&& running_font.isRightToLeft()) {
|
||||
os << "\\L{";
|
||||
close = true;
|
||||
} else if (inset->LyxCode() == Inset::NUMBER_CODE
|
||||
&& running_font.isRightToLeft()) {
|
||||
os << "{\\beginL ";
|
||||
close = true;
|
||||
}
|
||||
|
||||
int tmp = inset->Latex(os, style.isCommand(),
|
||||
style.free_spacing);
|
||||
|
||||
if (close)
|
||||
os << "}";
|
||||
|
||||
if (inset->LyxCode() == Inset::NUMBER_CODE)
|
||||
os << "\\endL}";
|
||||
else
|
||||
os << "}";
|
||||
|
||||
if (tmp) {
|
||||
column = 0;
|
||||
} else {
|
||||
|
@ -188,7 +188,9 @@ void LyXScreen::ShowCursor()
|
||||
{
|
||||
if (!cursor_visible) {
|
||||
Cursor_Shape shape = BAR_SHAPE;
|
||||
if (text->real_current_font.isVisibleRightToLeft()
|
||||
if (text->real_current_font.language() !=
|
||||
text->parameters->language_info
|
||||
|| text->real_current_font.isVisibleRightToLeft()
|
||||
!= text->parameters->language_info->RightToLeft)
|
||||
shape = (text->real_current_font.isVisibleRightToLeft())
|
||||
? REVERSED_L_SHAPE : L_SHAPE;
|
||||
|
246
src/text.C
246
src/text.C
@ -247,7 +247,7 @@ LyXParagraph::size_type LyXText::RowLast(Row const * row) const
|
||||
|
||||
void LyXText::ComputeBidiTables(Row * row) const
|
||||
{
|
||||
|
||||
bidi_same_direction = true;
|
||||
if (!lyxrc.rtl_support) {
|
||||
bidi_start = -1;
|
||||
return;
|
||||
@ -336,6 +336,7 @@ void LyXText::ComputeBidiTablesFromTo(Row * row,
|
||||
++lpos;
|
||||
}
|
||||
direction = static_cast<LyXDirection>(-direction);
|
||||
bidi_same_direction = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2855,7 +2856,10 @@ void LyXText::PrepareToPrint(Row * row, float & x,
|
||||
&& !row->par->table
|
||||
&& last != vis2log(last)
|
||||
&& row->par->IsLineSeparator(last)) {
|
||||
if (!(main_body > 0 && main_body-1 == last))
|
||||
if ((main_body = 0 || main_body-1 != last) &&
|
||||
(!row->next || row->next->par != row->par ||
|
||||
row->par->getLetterDirection(last) ==
|
||||
LYX_DIR_RIGHT_TO_LEFT))
|
||||
x -= fill_separator+SingleWidth(row->par,last);
|
||||
} else if (main_body > 0 &&
|
||||
(main_body-1 > last ||
|
||||
@ -3342,8 +3346,8 @@ void LyXText::Backspace()
|
||||
&& !(cursor.par->Next()
|
||||
&& cursor.par->footnoteflag == LyXParagraph::NO_FOOTNOTE
|
||||
&& cursor.par->Next()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)) {
|
||||
// This is an empty paragraph and we delete it just by moving the curosr one step
|
||||
// left and let the DeleteEmptyParagraphMechanism handle the actual deleteion
|
||||
// This is an empty paragraph and we delete it just by moving the cursor one step
|
||||
// left and let the DeleteEmptyParagraphMechanism handle the actual deletion
|
||||
// of the paragraph.
|
||||
|
||||
if (cursor.par->previous) {
|
||||
@ -3385,17 +3389,12 @@ void LyXText::Backspace()
|
||||
// not a good idea since it triggers the auto-delete
|
||||
// mechanism. So we do a CursorLeftIntern()-lite,
|
||||
// without the dreaded mechanism. (JMarc)
|
||||
if (cursor.pos > 0) {
|
||||
SetCursorIntern(cursor.par, cursor.pos - 1);
|
||||
}
|
||||
else if (cursor.par->Previous()) {
|
||||
if (cursor.par->Previous()) {
|
||||
// steps into the above paragraph.
|
||||
SetCursorIntern(cursor.par->Previous(),
|
||||
cursor.par->Previous()->Last());
|
||||
}
|
||||
|
||||
|
||||
#warning See comment on top of text.C
|
||||
/* Pasting is not allowed, if the paragraphs have different
|
||||
layout. I think it is a real bug of all other
|
||||
word processors to allow it. It confuses the user.
|
||||
@ -3458,22 +3457,14 @@ void LyXText::Backspace()
|
||||
// not a good idea since it triggers the auto-delete
|
||||
// mechanism. So we do a CursorLeftIntern()-lite,
|
||||
// without the dreaded mechanism. (JMarc)
|
||||
if (cursor.pos > 0) {
|
||||
SetCursorIntern(cursor.par, cursor.pos - 1);
|
||||
}
|
||||
else if (cursor.par->Previous()) {
|
||||
// steps into the above paragraph.
|
||||
SetCursorIntern(cursor.par->Previous(),
|
||||
cursor.par->Previous()->Last());
|
||||
}
|
||||
// CursorLeftIntern();
|
||||
SetCursorIntern(cursor.par, cursor.pos - 1);
|
||||
|
||||
// some insets are undeletable here
|
||||
if (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET) {
|
||||
if (!cursor.par->GetInset(cursor.pos)->Deletable())
|
||||
return;
|
||||
// force complete redo when erasing display insets
|
||||
// this is a cruel mathod but save..... Matthias
|
||||
// this is a cruel method but safe..... Matthias
|
||||
if (cursor.par->GetInset(cursor.pos)->display()){
|
||||
cursor.par->Erase(cursor.pos);
|
||||
RedoParagraph();
|
||||
@ -3666,14 +3657,15 @@ void LyXText::Backspace()
|
||||
}
|
||||
|
||||
|
||||
void LyXText::GetVisibleRow(int offset,
|
||||
Row * row_ptr, long y)
|
||||
void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
|
||||
{
|
||||
/* returns a printed row */
|
||||
Painter & pain = owner_->painter();
|
||||
|
||||
LyXDirection direction = row_ptr->par->getParDirection();
|
||||
LyXParagraph::size_type vpos, pos, pos_end;
|
||||
LyXParagraph::size_type last = RowLast(row_ptr);
|
||||
|
||||
LyXParagraph::size_type vpos, pos;
|
||||
float x, tmpx;
|
||||
int y_top, y_bottom;
|
||||
float fill_separator, fill_hfill, fill_label_hfill;
|
||||
@ -3692,49 +3684,143 @@ void LyXText::GetVisibleRow(int offset,
|
||||
pain.fillRectangle(0, offset, paperwidth, row_ptr->height);
|
||||
|
||||
if (selection) {
|
||||
/* selection code */
|
||||
if (sel_start_cursor.row == row_ptr &&
|
||||
sel_end_cursor.row == row_ptr) {
|
||||
if (sel_start_cursor.x < sel_end_cursor.x)
|
||||
pain.fillRectangle(sel_start_cursor.x, offset,
|
||||
sel_end_cursor.x - sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
pain.fillRectangle(sel_end_cursor.x, offset,
|
||||
sel_start_cursor.x - sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (sel_start_cursor.row == row_ptr) {
|
||||
if (direction == LYX_DIR_LEFT_TO_RIGHT)
|
||||
pain.fillRectangle(sel_start_cursor.x, offset,
|
||||
paperwidth - sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
/* selection code */
|
||||
if (bidi_same_direction) {
|
||||
if (sel_start_cursor.row == row_ptr &&
|
||||
sel_end_cursor.row == row_ptr) {
|
||||
if (sel_start_cursor.x < sel_end_cursor.x)
|
||||
pain.fillRectangle(sel_start_cursor.x, offset,
|
||||
sel_end_cursor.x - sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
pain.fillRectangle(sel_end_cursor.x, offset,
|
||||
sel_start_cursor.x - sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (sel_start_cursor.row == row_ptr) {
|
||||
if (direction == LYX_DIR_LEFT_TO_RIGHT)
|
||||
pain.fillRectangle(sel_start_cursor.x, offset,
|
||||
paperwidth - sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
pain.fillRectangle(0, offset,
|
||||
sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (sel_end_cursor.row == row_ptr) {
|
||||
if (direction == LYX_DIR_LEFT_TO_RIGHT)
|
||||
pain.fillRectangle(0, offset,
|
||||
sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
pain.fillRectangle(sel_end_cursor.x, offset,
|
||||
paperwidth - sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (y > sel_start_cursor.y && y < sel_end_cursor.y) {
|
||||
pain.fillRectangle(0, offset,
|
||||
sel_start_cursor.x,
|
||||
row_ptr->height,
|
||||
paperwidth, row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (sel_end_cursor.row == row_ptr) {
|
||||
if (direction == LYX_DIR_LEFT_TO_RIGHT)
|
||||
pain.fillRectangle(0, offset,
|
||||
sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
else
|
||||
pain.fillRectangle(sel_end_cursor.x, offset,
|
||||
paperwidth - sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
|
||||
} else if (y > sel_start_cursor.y && y < sel_end_cursor.y) {
|
||||
}
|
||||
} else if ( sel_start_cursor.row != row_ptr &&
|
||||
sel_end_cursor.row != row_ptr &&
|
||||
y > sel_start_cursor.y && y < sel_end_cursor.y) {
|
||||
pain.fillRectangle(0, offset,
|
||||
paperwidth, row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (sel_start_cursor.row == row_ptr ||
|
||||
sel_end_cursor.row == row_ptr) {
|
||||
float tmpx = x;
|
||||
int cell = 0;
|
||||
if (row_ptr->par->table) {
|
||||
cell = NumberOfCell(row_ptr->par, row_ptr->pos);
|
||||
tmpx += row_ptr->par->table->GetBeginningOfTextInCell(cell);
|
||||
}
|
||||
if ( (sel_start_cursor.row != row_ptr &&
|
||||
direction == LYX_DIR_LEFT_TO_RIGHT) ||
|
||||
(sel_end_cursor.row != row_ptr &&
|
||||
direction == LYX_DIR_RIGHT_TO_LEFT))
|
||||
pain.fillRectangle(0, offset,
|
||||
tmpx, row_ptr->height,
|
||||
LColor::selection);
|
||||
if (row_ptr->par->table) {
|
||||
float x_old = x;
|
||||
for (vpos = row_ptr->pos; vpos <= last; ++vpos) {
|
||||
pos = vis2log(vpos);
|
||||
float old_tmpx = tmpx;
|
||||
if (row_ptr->par->IsNewline(pos)) {
|
||||
tmpx = x_old + row_ptr->par->table->WidthOfColumn(cell);
|
||||
x_old = tmpx;
|
||||
++cell;
|
||||
tmpx += row_ptr->par->table->GetBeginningOfTextInCell(cell);
|
||||
} else {
|
||||
tmpx += SingleWidth(row_ptr->par, pos);
|
||||
}
|
||||
if ( (sel_start_cursor.row != row_ptr ||
|
||||
sel_start_cursor.pos <= pos) &&
|
||||
(sel_end_cursor.row != row_ptr ||
|
||||
pos < sel_end_cursor.pos) )
|
||||
pain.fillRectangle(old_tmpx, offset,
|
||||
tmpx - old_tmpx + 1,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
}
|
||||
} else {
|
||||
LyXParagraph::size_type main_body =
|
||||
BeginningOfMainBody(row_ptr->par);
|
||||
|
||||
for (vpos = row_ptr->pos; vpos <= last; ++vpos) {
|
||||
pos = vis2log(vpos);
|
||||
float old_tmpx = tmpx;
|
||||
if (main_body > 0 && pos == main_body-1) {
|
||||
tmpx += fill_label_hfill +
|
||||
GetFont(row_ptr->par, -2).stringWidth(
|
||||
textclasslist.Style(parameters->textclass, row_ptr->par->GetLayout()).labelsep);
|
||||
if (row_ptr->par->IsLineSeparator(main_body-1))
|
||||
tmpx -= SingleWidth(row_ptr->par, main_body-1);
|
||||
}
|
||||
if (HfillExpansion(row_ptr, pos)) {
|
||||
tmpx += SingleWidth(row_ptr->par, pos);
|
||||
if (pos >= main_body)
|
||||
tmpx += fill_hfill;
|
||||
else
|
||||
tmpx += fill_label_hfill;
|
||||
}
|
||||
else if (row_ptr->par->IsSeparator(pos)) {
|
||||
if (pos != last || !row_ptr->next ||
|
||||
row_ptr->next->par != row_ptr->par ||
|
||||
direction == row_ptr->par->getLetterDirection(last)) {
|
||||
tmpx += SingleWidth(row_ptr->par, pos);
|
||||
if (pos >= main_body)
|
||||
tmpx += fill_separator;
|
||||
}
|
||||
} else
|
||||
tmpx += SingleWidth(row_ptr->par, pos);
|
||||
|
||||
if ( (sel_start_cursor.row != row_ptr ||
|
||||
sel_start_cursor.pos <= pos) &&
|
||||
(sel_end_cursor.row != row_ptr ||
|
||||
pos < sel_end_cursor.pos) )
|
||||
pain.fillRectangle(old_tmpx, offset,
|
||||
tmpx - old_tmpx + 1,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
}
|
||||
}
|
||||
if ( (sel_start_cursor.row != row_ptr &&
|
||||
direction == LYX_DIR_RIGHT_TO_LEFT) ||
|
||||
(sel_end_cursor.row != row_ptr &&
|
||||
direction == LYX_DIR_LEFT_TO_RIGHT) )
|
||||
pain.fillRectangle(tmpx, offset,
|
||||
paperwidth - tmpx,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (row_ptr->par->appendix){
|
||||
pain.line(1, offset,
|
||||
1, offset + row_ptr->height,
|
||||
@ -4033,7 +4119,7 @@ void LyXText::GetVisibleRow(int offset,
|
||||
|
||||
/* is it a last row? */
|
||||
par = row_ptr->par->LastPhysicalPar();
|
||||
if (row_ptr->par->ParFromPos(RowLast(row_ptr) + 1) == par
|
||||
if (row_ptr->par->ParFromPos(last + 1) == par
|
||||
&& (!row_ptr->next || row_ptr->next->par != row_ptr->par)) {
|
||||
|
||||
/* think about the margins */
|
||||
@ -4108,7 +4194,7 @@ void LyXText::GetVisibleRow(int offset,
|
||||
int endlabel = row_ptr->par->GetEndLabel();
|
||||
if (endlabel == END_LABEL_BOX ||
|
||||
endlabel == END_LABEL_FILLED_BOX) {
|
||||
LyXFont font = GetFont(row_ptr->par, RowLast(row_ptr));
|
||||
LyXFont font = GetFont(row_ptr->par, last);
|
||||
int size = int(0.75*font.maxAscent());
|
||||
int y = (offset + row_ptr->baseline) - size;
|
||||
int x = (direction == LYX_DIR_LEFT_TO_RIGHT)
|
||||
@ -4140,7 +4226,6 @@ void LyXText::GetVisibleRow(int offset,
|
||||
}
|
||||
|
||||
/* draw the text in the pixmap */
|
||||
pos_end = RowLast(row_ptr);
|
||||
|
||||
vpos = row_ptr->pos;
|
||||
/* table stuff -- begin*/
|
||||
@ -4150,7 +4235,7 @@ void LyXText::GetVisibleRow(int offset,
|
||||
float x_old = x;
|
||||
x += row_ptr->par->table->GetBeginningOfTextInCell(cell);
|
||||
|
||||
while (vpos <= pos_end) {
|
||||
while (vpos <= last) {
|
||||
pos = vis2log(vpos);
|
||||
if (row_ptr->par->IsNewline(pos)) {
|
||||
|
||||
@ -4305,11 +4390,11 @@ void LyXText::GetVisibleRow(int offset,
|
||||
LyXParagraph::size_type main_body =
|
||||
BeginningOfMainBody(row_ptr->par);
|
||||
if (main_body > 0 &&
|
||||
(main_body-1 > pos_end ||
|
||||
(main_body-1 > last ||
|
||||
!row_ptr->par->IsLineSeparator(main_body-1)))
|
||||
main_body = 0;
|
||||
|
||||
while (vpos <= pos_end) {
|
||||
while (vpos <= last) {
|
||||
pos = vis2log(vpos);
|
||||
if (main_body > 0 && pos == main_body-1) {
|
||||
x += fill_label_hfill
|
||||
@ -4353,10 +4438,16 @@ void LyXText::GetVisibleRow(int offset,
|
||||
x += 2;
|
||||
++vpos;
|
||||
} else if (row_ptr->par->IsSeparator(pos)) {
|
||||
tmpx = x;
|
||||
x+= SingleWidth(row_ptr->par, pos);
|
||||
if (pos >= main_body)
|
||||
x+= fill_separator;
|
||||
if (pos != last || !row_ptr->next ||
|
||||
row_ptr->next->par != row_ptr->par ||
|
||||
direction == row_ptr->par->getLetterDirection(last)) {
|
||||
#if 0
|
||||
tmpx = x;
|
||||
#endif
|
||||
x += SingleWidth(row_ptr->par, pos);
|
||||
if (pos >= main_body)
|
||||
x += fill_separator;
|
||||
}
|
||||
#warning Think about this
|
||||
#if 0
|
||||
/* -------> Only draw protected spaces when
|
||||
@ -4471,17 +4562,24 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
|
||||
tmpx -= SingleWidth(row->par, main_body-1);
|
||||
}
|
||||
|
||||
tmpx += SingleWidth(row->par, c);
|
||||
if (HfillExpansion(row, c)) {
|
||||
x += SingleWidth(row->par, c);
|
||||
if (c >= main_body)
|
||||
tmpx += fill_hfill;
|
||||
else
|
||||
tmpx += fill_label_hfill;
|
||||
}
|
||||
else if (c >= main_body
|
||||
&& row->par->IsSeparator(c)) {
|
||||
tmpx+= fill_separator;
|
||||
}
|
||||
else if (row->par->IsSeparator(c)) {
|
||||
if (c != last ||
|
||||
!row->next ||
|
||||
row->next->par != row->par ||
|
||||
direction == row->par->getLetterDirection(last)) {
|
||||
tmpx += SingleWidth(row->par, c);
|
||||
if (c >= main_body)
|
||||
tmpx+= fill_separator;
|
||||
}
|
||||
} else
|
||||
tmpx += SingleWidth(row->par, c);
|
||||
++vc;
|
||||
}
|
||||
|
||||
|
23
src/text2.C
23
src/text2.C
@ -540,13 +540,13 @@ void LyXText::SetLayout(LyXTextClass::size_type layout)
|
||||
|
||||
// we have to reset the selection, because the
|
||||
// geometry could have changed */
|
||||
SetCursor(sel_start_cursor.par, sel_start_cursor.pos);
|
||||
SetCursor(sel_start_cursor.par, sel_start_cursor.pos, false);
|
||||
sel_cursor = cursor;
|
||||
SetCursor(sel_end_cursor.par, sel_end_cursor.pos);
|
||||
SetCursor(sel_end_cursor.par, sel_end_cursor.pos, false);
|
||||
UpdateCounters(cursor.row);
|
||||
ClearSelection();
|
||||
SetSelection();
|
||||
SetCursor(tmpcursor.par, tmpcursor.pos);
|
||||
SetCursor(tmpcursor.par, tmpcursor.pos, true);
|
||||
}
|
||||
|
||||
|
||||
@ -3107,16 +3107,25 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
|
||||
x -= SingleWidth(row->par, main_body-1);
|
||||
}
|
||||
|
||||
x += SingleWidth(row->par, pos);
|
||||
if (HfillExpansion(row, pos)) {
|
||||
x += SingleWidth(row->par, pos);
|
||||
if (pos >= main_body)
|
||||
x += fill_hfill;
|
||||
else
|
||||
x += fill_label_hfill;
|
||||
}
|
||||
else if (pos >= main_body && row->par->IsSeparator(pos)) {
|
||||
x+= fill_separator;
|
||||
}
|
||||
else if (row->par->IsSeparator(pos)) {
|
||||
if (pos != last ||
|
||||
!row->next ||
|
||||
row->next->par != row->par ||
|
||||
row->par->getParDirection() ==
|
||||
row->par->getLetterDirection(last)) {
|
||||
x += SingleWidth(row->par, pos);
|
||||
if (pos >= main_body)
|
||||
x += fill_separator;
|
||||
}
|
||||
} else
|
||||
x += SingleWidth(row->par, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user