popup fixes from Juergen ; insetgraphics fix from Herbert ; menus fix from Andre ; allow ligature breaks in spellchecker and fix smart quote after protected space (from me)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-13 14:47:35 +00:00
parent d481340f88
commit 0b25c68c4b
16 changed files with 101 additions and 42 deletions

View File

@ -1,3 +1,9 @@
2001-11-13 André Pönitz <poenitz@gmx.net>
* ui/default.ui: create a new Submenu Insert->Math, since placing
everything in the main insert menu seems not possible in the long
run...
2001-11-08 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* ui/default.ui: move math panel from Edit to Insert.

View File

@ -182,14 +182,7 @@ Menuset
# INSERT MENU
#
Menu "insert"
Item "Math Formula|h" "math-mode"
Item "Display Formula|D" "math-display"
Item "Math Panel|l" "math-panel"
#Item "Display Formula|D" "math-mode display"
#Item "Change to Inline Math Formula|q" "math-mutate simple"
#Item "Change to Displayed Math Formula|q" "math-mutate equation"
#Item "Change to Eqnarray Environment|q" "math-mutate eqnarray"
#Item "Change to Align Environment|g" "math-mutate align"
Submenu "Math|h" "insert_math"
Separator
Submenu "Special Character|S" "insert_special"
Item "Citation Reference...|C" "citation-insert"
@ -229,6 +222,21 @@ Menuset
Item "Menu Separator|M" "menu-separator-insert"
End
Menu "insert_math"
Item "Inline Formula|h" "math-mode"
Item "Display Formula|D" "math-display"
Item "Eqnarray environment|E" "command-sequence math-mode; math-mutate eqnarray;"
Item "AMS align environment|A" "command-sequence math-mode; math-mutate align;"
Item "AMS alignat environment|t" "command-sequence math-mode; math-mutate alignat;"
Item "AMS xalignat environment|x" "command-sequence math-mode; math-mutate xalignat;"
Item "AMS xxalignat environment" "command-sequence math-mode; math-mutate xxalignat;"
Separator
Item "Array environment|y" "math-insert matrix 2 2"
Item "Cases environment|C" "math-insert cases 2"
Separator
Item "Math Panel|l" "math-panel"
End
Menu "insert_floats"
FloatInsert
End

View File

@ -3241,19 +3241,23 @@ void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind)
void BufferView::Pimpl::smartQuote()
{
LyXText const * lt = bv_->getLyXText();
Paragraph const * par = lt->cursor.par();
Paragraph::size_type pos = lt->cursor.pos();
char c;
LyXText * lt = bv_->getLyXText();
if (lt->cursor.pos())
c = lt->cursor.par()->getChar(lt->cursor.pos() - 1);
else
if (!pos
|| (par->isInset(pos - 1)
&& par->getInset(pos - 1)->isSpace()))
c = ' ';
else
c = par->getChar(pos - 1);
hideCursor();
LyXLayout const & style = textclasslist.Style(
bv_->buffer()->params.textclass,
lt->cursor.par()->getLayout());
bv_->buffer()->params.textclass, par->getLayout());
if (style.pass_thru ||
(!insertInset(new InsetQuotes(c, bv_->buffer()->params))))

View File

@ -1,3 +1,16 @@
2001-11-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* text.C (selectNextWordToSpellcheck): do not test explicitely for
insets which are part of a word. Paragraph::isLetter takes care of
that now. Use Paragraph::isInset to identify insets.
(selectSelectedWord): do not test for hyphenation break.
* BufferView_pimpl.C (smartQuote): use Inset::isSpace, so
that protected spaces are considered as spaces.
* paragraph.C (isLetter): cleanup the code for ispell extras; use
Inset::isLetter.
2001-11-12 John Levon <moz@compsoc.man.ac.uk>
* lyxserver.h:

View File

@ -1,3 +1,8 @@
2001-11-13 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* forms/form_graphics.fd: fixed shortcut clash
* forms/form-external.fd: added shortcut for "Apply"
2001-11-12 John Levon <moz@compsoc.man.ac.uk>
* FormFiledialog.C: don't reset path if new dir

View File

@ -93,7 +93,11 @@ FD_form_external * FormExternal::build_external()
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 270, 90, 30, _("Apply"));
{
char const * const dummy = N_("Apply|#A");
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 270, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);

View File

@ -89,7 +89,7 @@ FD_form_graphics * FormGraphics::build_graphics()
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 230, 450, 90, _("Subcaption"));
{
char const * const dummy = N_("Subcaption|#S");
char const * const dummy = N_("Subcaption|#u");
fdui->check_subcaption = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 110, 240, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}

View File

@ -202,7 +202,7 @@ alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Apply
label: Apply|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast

View File

@ -310,7 +310,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Subcaption|#S
label: Subcaption|#u
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity

View File

@ -1,3 +1,15 @@
2001-11-13 Herbert Voss <voss@perce.de>
* insetgraphic.C: fix scale bug
2001-11-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* inset.h (isSpace):
(isLetter): new virtual methods.
* insetspecialchar.C (isSpace):
(isLetter): implement here.
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* inset.h: new inline helpers

View File

@ -295,6 +295,12 @@ public:
// needed for spellchecking text
///
virtual bool allowSpellcheck() { return false; }
// is this equivalent to a letter?
virtual bool isLetter() const { return false; }
// is this equivalent to a space?
virtual bool isSpace() const { return false; }
protected:
///
mutable int top_x;

View File

@ -514,7 +514,7 @@ void formatResize(ostream & os, string const & key,
break;
case InsetGraphicsParams::SCALE:
os << "scale" << '=' << size << ',';
os << "scale" << '=' << size/100 << ',';
}
}

View File

@ -321,3 +321,15 @@ void InsetSpecialChar::validate(LaTeXFeatures & features) const
features.lyxarrow = true;
}
}
bool InsetSpecialChar::isLetter() const
{
return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK;
}
bool InsetSpecialChar::isSpace() const
{
return kind_ == PROTECTED_SEPARATOR;
}

View File

@ -82,6 +82,10 @@ public:
};
///
void validate(LaTeXFeatures &) const;
/// is this equivalent to a letter?
bool isLetter() const;
/// is this equivalent to a space?
bool isSpace() const;
private:
/// And which kind is this?
Kind kind_;

View File

@ -1878,13 +1878,11 @@ bool Paragraph::isLetter(Paragraph::size_type pos) const
value_type const c = getChar(pos);
if (IsLetterChar(c))
return true;
// '\0' is not a letter, allthough every string contains "" (below)
if (c == '\0')
return false;
if (isInset(pos))
return getInset(pos)->isLetter();
// We want to pass the ' and escape chars to ispell
string const extra = lyxrc.isp_esc_chars + '\'';
char ch[2] = { c, 0 };
return contains(extra, ch);
return contains(extra, c);
}

View File

@ -21,7 +21,6 @@
#include "support/lstrings.h"
#include "insets/insetbib.h"
#include "insets/insettext.h"
#include "insets/insetspecialchar.h"
#include "lyx_gui_misc.h"
#include "gettext.h"
#include "bufferparams.h"
@ -2365,16 +2364,10 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview,
Inset * inset;
// and find the end of the word
// (optional hyphens are part of a word)
// and find the end of the word (insets like optional hyphens
// and ligature break are part of a word)
while (cursor.pos() < cursor.par()->size()
&& (cursor.par()->isLetter(cursor.pos()))
// assignment is intentional here
|| ((inset = getInset())
&& inset->lyxCode() == Inset::SPECIALCHAR_CODE
&& static_cast<InsetSpecialChar *>(inset)->kind()
== InsetSpecialChar::HYPHENATION
))
&& (cursor.par()->isLetter(cursor.pos())))
cursor.pos(cursor.pos() + 1);
// Finally, we copy the word to a string and return it
@ -2382,7 +2375,7 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview,
if (selection.cursor.pos() < cursor.pos()) {
Paragraph::size_type i;
for (i = selection.cursor.pos(); i < cursor.pos(); ++i) {
if (cursor.par()->getChar(i) != Paragraph::META_INSET)
if (!cursor.par()->isInset(i))
str += cursor.par()->getChar(i);
}
}
@ -2406,13 +2399,7 @@ void LyXText::selectSelectedWord(BufferView * bview)
// now find the end of the word
while (cursor.pos() < cursor.par()->size()
&& (cursor.par()->isLetter(cursor.pos())
// assignment is intentional here
|| ((inset = getInset())
&& inset->lyxCode() == Inset::SPECIALCHAR_CODE
&& static_cast<InsetSpecialChar *>(inset)->kind()
== InsetSpecialChar::HYPHENATION
)))
&& (cursor.par()->isLetter(cursor.pos())))
cursor.pos(cursor.pos() + 1);
setCursor(bview, cursor.par(), cursor.pos());