Patches from Dekel (2) and a bit more

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/lyx-1_1_5@1124 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-16 13:32:02 +00:00
parent da3b03ed1e
commit ca3b6674be
7 changed files with 100 additions and 36 deletions

View File

@ -1,3 +1,25 @@
2000-10-14 Dekel Tsur <dekelts@tau.ac.il>
* src/text.C (Backspace): Make sure that the row of the cursor is
rebreaked.
* src/lyxfunc.C (Dispatch): Set CurrentState() in minibuffer after
insertion of a char.
* src/lyx_gui.C (init): Prevent a crash when only one font from
menu/popup fonts is not found.
* lib/lyxrc.example: Add an example for binding a key for language
switching.
2000-10-13 Dekel Tsur <dekelts@tau.ac.il>
* src/text.C (GetColumnNearX): Better behavior when a RTL
paragraph is ended by LTR text.
* src/text2.C (SetCurrentFont,CursorLeftIntern,CursorRightIntern):
ditto.
2000-10-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* README: add a description of our numbering scheme

10
README
View File

@ -1,4 +1,4 @@
Preamble: LyX versionning scheme
Preamble: LyX version scheme
In September of 1999 the LyX Team decided that we could no
longer successfully use the two strand development process
@ -17,9 +17,7 @@ Preamble: LyX versionning scheme
* Establishing the foundations of GUI/system independence,
* Rearrangement of the directory structure,
* Use of libtool, automake and autoconf.
* Rearrangement of the directory structure.
Once the transition is over the 1.1 series should be very
stable and we will then release 1.2.0. This new series will be
@ -28,9 +26,9 @@ Preamble: LyX versionning scheme
occurring in branches of CVS and once the feature/modification
has proved stable it will be merged into the main releases.
Versionning uses a continuous numbering scheme where odd or
LyX now uses a continuous numbering scheme where odd or
even numbering is no longer significant. Prereleases are
labelled with a "pre" suffix and any fixes required between
labeled with a "pre" suffix and any fixes required between
stable releases have a "fix" suffix. Thus there are three
possible file names:

View File

@ -640,6 +640,12 @@
# Default is "true"
#\mark_foreign_language false
# It is possible to bind keys for changing the language inside a document.
# For example, the following command will cause F12 to switch between French
# and English in a French document, and in a document of other language it will
# switch between that language and French.
#\bind "F12" "language french"
#
# HEBREW SUPPORT SECTION ####################################################
#

View File

@ -197,35 +197,41 @@ void LyXGUI::init()
if (lyxrc.font_norm_menu.empty())
lyxrc.font_norm_menu = lyxrc.font_norm;
// Set the font name for popups and menus
string menufontname = lyxrc.menu_font_name
string boldfontname = lyxrc.menu_font_name
+ "-*-*-*-?-*-*-*-*-"
+ lyxrc.font_norm_menu;
// "?" means "scale that font"
string popupfontname = lyxrc.popup_font_name
string fontname = lyxrc.popup_font_name
+ "-*-*-*-?-*-*-*-*-"
+ lyxrc.font_norm_menu;
int bold = fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str());
int normal = fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str());
int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
if (bold < 0)
lyxerr << "Could not set menu font to "
<< menufontname << endl;
<< boldfontname << endl;
if (normal < 0)
lyxerr << "Could not set popup font to "
<< popupfontname << endl;
<< fontname << endl;
if (bold < 0 && normal < 0) {
lyxerr << "Using 'helvetica' font for menus" << endl;
bold = fl_set_font_name(FL_BOLD_STYLE,
"-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1");
normal = fl_set_font_name(FL_NORMAL_STYLE,
"-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1");
boldfontname = "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1";
fontname = "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1";
bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
if (bold < 0 && normal < 0) {
lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
normal = fl_set_font_name(FL_NORMAL_STYLE, "fixed");
fl_set_font_name(FL_NORMAL_STYLE, "fixed");
normal = bold = 0;
}
}
if (bold < 0)
fl_set_font_name(FL_BOLD_STYLE, fontname.c_str());
else if (normal < 0)
fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str());
// put here (after fl_initialize) to avoid segfault. Cannot be done
// in setDefaults() (Matthias 140496)

View File

@ -2575,6 +2575,10 @@ string LyXFunc::Dispatch(int ac,
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
moveCursorUpdate(false);
// current_font.number can change so we need to update
// the minibuffer
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
}
break;
@ -2692,6 +2696,9 @@ string LyXFunc::Dispatch(int ac,
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
moveCursorUpdate(false);
// current_font.number can change so we need to update
// the minibuffer
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
return string();
} else {
// why is an "Unknown action" with empty

View File

@ -3701,9 +3701,20 @@ void LyXText::Backspace()
BreakAgainOneRow(row);
SetCursor(cursor.par, cursor.pos, false, cursor.boundary);
// cursor MUST be in row now
// will the cursor be in another row now?
if (row->next && row->next->par == row->par &&
RowLast(row) <= cursor.pos) {
row = row->next;
BreakAgainOneRow(row);
}
SetCursor(cursor.par, cursor.pos,
false, cursor.boundary);
if (row->next && row->next->par == row->par)
need_break_row = row->next;
else
need_break_row = 0;
} else {
// set the dimensions of the row
row->fill = Fill(row, paperwidth);
@ -3724,9 +3735,9 @@ void LyXText::Backspace()
lastpos = cursor.par->Last();
if (cursor.pos == lastpos) {
SetCurrentFont();
if (IsBoundary(cursor.par, cursor.pos) != cursor.boundary)
SetCursor(cursor.par, cursor.pos, false, !cursor.boundary);
SetCurrentFont();
}
// check, wether the last characters font has changed.
@ -4666,7 +4677,7 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
++vc;
}
if (vc > row->pos && (tmpx+last_tmpx)/2 > x) {
if ((tmpx+last_tmpx)/2 > x) {
tmpx = last_tmpx;
left_side = true;
}
@ -4677,9 +4688,20 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
vc = last+1;
boundary = false;
bool lastrow = lyxrc.rtl_support // This is not needed, but gives
// some speedup if rtl_support=false
&& (!row->next || row->next->par != row->par);
bool rtl = (lastrow)
? row->par->isRightToLeftPar()
: false; // If lastrow is false, we don't need to compute
// the value of rtl.
if (row->pos > last) // Row is empty?
c = row->pos;
else if (lastrow &&
( ( rtl && left_side && vc == row->pos && x < tmpx - 5) ||
(!rtl && !left_side && vc == last + 1 && x > tmpx + 5) ))
c = last + 1;
else if (vc == row->pos ||
(row->par->table && vc <= last && row->par->IsNewline(vc-1)) ) {
c = vis2log(vc);

View File

@ -3416,6 +3416,13 @@ void LyXText::SetCurrentFont() const
current_font = cursor.par->GetFontSettings(pos);
real_current_font = GetFont(cursor.par, pos);
if (cursor.pos == cursor.par->Last() &&
IsBoundary(cursor.par, cursor.pos) && !cursor.boundary) {
Language const * lang = cursor.par->getParLanguage();
current_font.setLanguage(lang);
real_current_font.setLanguage(lang);
}
}
@ -3475,10 +3482,7 @@ void LyXText::CursorLeftIntern(bool internal) const
SetCursor(cursor.par, cursor.pos + 1, true, true);
} else if (cursor.par->Previous()) { // steps into the above paragraph.
LyXParagraph * par = cursor.par->Previous();
LyXParagraph::size_type pos = par->Last();
SetCursor(par, pos);
if (IsBoundary(par, pos))
SetCursor(par, pos, false, true);
SetCursor(par, par->Last());
}
}
@ -3498,15 +3502,14 @@ void LyXText::CursorRight(bool internal) const
void LyXText::CursorRightIntern(bool internal) const
{
if (cursor.pos < cursor.par->Last()) {
if (!internal && cursor.boundary &&
(!cursor.par->table || !cursor.par->IsNewline(cursor.pos)))
SetCursor(cursor.par, cursor.pos, true, false);
else {
else if (cursor.pos < cursor.par->Last()) {
SetCursor(cursor.par, cursor.pos + 1, true, false);
if (!internal && IsBoundary(cursor.par, cursor.pos))
if (!internal &&
IsBoundary(cursor.par, cursor.pos))
SetCursor(cursor.par, cursor.pos, true, true);
}
} else if (cursor.par->Next())
SetCursor(cursor.par->Next(), 0);
}