some small changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@765 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-05-22 16:56:05 +00:00
parent 0ee6cee81b
commit e42217a778
11 changed files with 104 additions and 37 deletions

View File

@ -1,3 +1,27 @@
2000-05-22 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C (String): give more correct output.
2000-05-20 Dekel Tsur <dekel@math.tau.ac.il>
* src/lyxfont.C (stateText) Do not output the language if it is
eqaul to the language of the document.
* src/paragraph.C (TeXOnePar): Do not put language switch commands
between two paragraphs with the same language.
* src/paragraph.C (getParLanguage) Return a correct answer for an
empty dummy paragraph.
* src/menus.C (ShowTocMenu): Do not draw lines between LOF/LOT/LOA
menus.
* src/menus.C (ShowLayoutMenu) Add "Start of Appendix" item to the
layout menu.
* src/lyx_gui.C (init): Try to use helvetica (or fixed) fonts for
the menus/popup, if requested fonts are unavailable.
2000-05-22 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (LocalDispatch): added some more cursor

View File

@ -108,7 +108,7 @@
\bind "M-l s" "layout-save-default"
\bind "M-l space" "menu-open Layout"
\bind "M-l i" "buffer-itemize-bullets-select"
\bind "M-l x" "appendix"
#
# Insert menu

View File

@ -267,7 +267,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
f.setNoun(LyXFont::INHERIT);
f.setLatex(LyXFont::INHERIT);
f.setColor(LColor::inherit);
lyxerr << "Font '" << f.stateText()
lyxerr << "Font '" << f.stateText(0)
<< "' matched by\n" << font << endl;
}

View File

@ -244,7 +244,7 @@ string CurrentState(BufferView * bv)
.TextClass(buffer->params.textclass)
.defaultfont();
font.reduce(defaultfont);
state = _("Font: ") + font.stateText();
state = _("Font: ") + font.stateText(&buffer->params);
// The paragraph depth
int depth = bv->text->GetDepth();
if (depth > 0)

View File

@ -25,12 +25,14 @@
both reads and writes this information to a file. The number of files
kept are user defined, but defaults to four.
*/
class LastFiles
{
class LastFiles {
public:
///
typedef std::deque<string> Files;
///
typedef Files::const_iterator const_iterator;
/**@name Constructors and Deconstructors */
//@{
/**

View File

@ -3153,7 +3153,7 @@ void TocUpdateCB(FL_OBJECT *, long)
// return;
if (toclist.size() == tmp[type].size()) {
// Check if all elements are the same.
int i = 0;
unsigned int i = 0;
for (; i < toclist.size(); ++i) {
if (toclist[i] != tmp[type][i])
break;

View File

@ -247,14 +247,28 @@ void LyXGUI::init()
+ "-*-*-*-?-*-*-*-*-"
+ lyxrc.font_norm_menu;
if (fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str()) < 0)
int bold = fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str());
int normal = fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str());
if (bold < 0)
lyxerr << "Could not set menu font to "
<< menufontname << endl;
if (fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str()) < 0)
if (normal < 0)
lyxerr << "Could not set popup font to "
<< popupfontname << 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");
if (bold < 0 && normal < 0) {
lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
normal = fl_set_font_name(FL_NORMAL_STYLE, "fixed");
}
}
// put here (after fl_initialize) to avoid segfault. Cannot be done
// in setDefaults() (Matthias 140496)
// Moved from ::LyXGUI to ::init to allow popup font customization

View File

@ -24,6 +24,7 @@
#include "lyxlex.h"
#include "FontLoader.h"
#include "support/lstrings.h"
#include "bufferparams.h" // stateText
using std::ostream;
using std::endl;
@ -380,7 +381,7 @@ bool LyXFont::resolved() const
/// Build GUI description of font state
string LyXFont::stateText() const
string LyXFont::stateText(BufferParams * params) const
{
#ifdef HAVE_SSTREAM
std::ostringstream ost;
@ -410,7 +411,8 @@ string LyXFont::stateText() const
ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", ";
if (bits == inherit)
ost << _("Default") << ", ";
ost << _("Language: ") << _(language()->display.c_str());
if (!params || language() != params->language_info)
ost << _("Language: ") << _(language()->display.c_str());
#ifdef HAVE_SSTREAM
string buf(ost.str().c_str());
#else

View File

@ -36,6 +36,7 @@
#endif
class LyXLex;
class BufferParams;
///
class LyXFont {
@ -309,7 +310,7 @@ public:
LyXFont const & next) const;
/// Build GUI description of font state
string stateText() const;
string stateText(BufferParams * params) const;
///
LColor::color realColor() const;

View File

@ -662,7 +662,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
// make the lastfiles menu
int ii = 1;
for (LastFiles::Files::const_iterator cit = lastfiles->begin();
for (LastFiles::const_iterator cit = lastfiles->begin();
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
string tmp = tostr(ii);
string tmp2 = tmp + "#" + tmp;;
@ -813,7 +813,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
// make the lastfiles menu
int ii = 1;
for (LastFiles::Files::const_iterator cit = lastfiles->begin();
for (LastFiles::const_iterator cit = lastfiles->begin();
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
string tmp = tostr(ii);
string tmp2 = tmp + "#" + tmp;;
@ -1350,11 +1350,17 @@ void Menus::ShowTocMenu(FL_OBJECT * ob, long)
men->currentView()->buffer()->getTocList();
//xgettext:no-c-format
static char const * MenuNames[3] = { N_("List of Figures%m%l"),
static char const * MenuNames[3] = { N_("List of Figures%m"),
//xgettext:no-c-format
N_("List of Tables%m%l"),
N_("List of Tables%m"),
//xgettext:no-c-format
N_("List of Algorithms%m%l") };
N_("List of Algorithms%m") };
int max_nonempty = 0;
for (int j = 1; j <= 3; ++j)
if (!toclist[j].empty())
max_nonempty = j;
for (int j = 1; j <= 3; ++j)
if (!toclist[j].empty()) {
int menu2 = fl_newpup(FL_ObjWin(ob));
@ -1363,7 +1369,12 @@ void Menus::ShowTocMenu(FL_OBJECT * ob, long)
fl_addtopup(menu2,
(toclist[j][i].str + "%x"
+ tostr(i+1+j*BIG_NUM)).c_str());
fl_addtopup(TocMenu, _(MenuNames[j-1]), menu2);
if (j == max_nonempty) {
string tmp = _(MenuNames[j-1]);
tmp += "%l";
fl_addtopup(TocMenu, tmp.c_str(), menu2);
} else
fl_addtopup(TocMenu, _(MenuNames[j-1]), menu2);
}
Add_to_toc_menu(toclist[0], 0, toclist[0].size(), 0,
@ -1522,9 +1533,10 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
"|Emphasize Style%b"
"|Noun Style%b"
"|Bold Style%b"
"|TeX Style%b"
"|TeX Style%b%l"
"|Change Environment Depth"
"|LaTeX Preamble...%l"
"|LaTeX Preamble..."
"|Start of Appendix%l"
"|Save layout as default"));
fl_setpup_shortcut(LayoutMenu, 1, scex(_("LM|Cc#c#C")));
fl_setpup_shortcut(LayoutMenu, 2, scex(_("LM|Pp#p#P")));
@ -1538,7 +1550,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(LayoutMenu, 10, scex(_("LM|Tt#t#T")));
fl_setpup_shortcut(LayoutMenu, 11, scex(_("LM|vV#v#V")));
fl_setpup_shortcut(LayoutMenu, 12, scex(_("LM|Ll#l#L")));
fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S")));
fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|xX#x#X")));
fl_setpup_shortcut(LayoutMenu, 14, scex(_("LM|Ss#s#S")));
// Set values of checkboxes according to font
LyXFont font = men->currentView()->text->real_current_font;
@ -1584,7 +1597,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
case 10: tmpfunc->Dispatch(LFUN_TEX); break;
case 11: tmpfunc->Dispatch(LFUN_DEPTH_PLUS); break;
case 12: tmpfunc->Dispatch(LFUN_LAYOUT_PREAMBLE); break;
case 13: tmpfunc->Dispatch(LFUN_LAYOUT_SAVE_DEFAULT); break;
case 13: tmpfunc->Dispatch(LFUN_APPENDIX); break;
case 14: tmpfunc->Dispatch(LFUN_LAYOUT_SAVE_DEFAULT); break;
}
fl_freepup(LayoutMenu);
}

View File

@ -354,7 +354,7 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
<< endl;
features.noun = true;
lyxerr[Debug::LATEX] << "Noun enabled. Font: "
<< (*cit).font.stateText()
<< (*cit).font.stateText(0)
<< endl;
}
switch ((*cit).font.color()) {
@ -365,7 +365,7 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
default:
features.color = true;
lyxerr[Debug::LATEX] << "Color enabled. Font: "
<< (*cit).font.stateText()
<< (*cit).font.stateText(0)
<< endl;
}
#if 0
@ -2025,7 +2025,8 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow,
Language const * language = getParLanguage();
Language const * doc_language = current_view->buffer()->params.language_info;
if (language != doc_language) {
if (language != doc_language &&
(!previous || previous->getParLanguage() != language)) {
os << subst(lyxrc.language_command_begin, "$$lang",
language->lang)
<< endl;
@ -2059,23 +2060,28 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow,
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& next->footnoteflag != footnoteflag) {
LyXParagraph * p = 0;
bool is_rtl = GetFontSettings(size()-1).isRightToLeft();
bool is_rtl = (size() > 0)
? GetFontSettings(size()-1).isRightToLeft()
: language->RightToLeft;
if ( (p = NextAfterFootnote()) != 0 &&
p->size() > 0 &&
p->GetFontSettings(0).isRightToLeft() != is_rtl)
is_rtl = GetFontSettings(0).isRightToLeft();
while (par &&
par->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
par->footnoteflag != footnoteflag) {
is_rtl = getParLanguage()->RightToLeft;
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& par->footnoteflag != footnoteflag) {
par = par->TeXFootnote(os, texrow, foot,
foot_texrow, foot_count,
is_rtl);
par->SimpleTeXOnePar(os, texrow, moving_arg);
is_rtl = par->GetFontSettings(par->size()-1).isRightToLeft();
is_rtl = (par->size() > 0)
? par->GetFontSettings(par->size()-1).isRightToLeft()
: language->RightToLeft;
if (par->next &&
par->next->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
(p = par->NextAfterFootnote()) != 0 &&
p->size() > 0 &&
p->GetFontSettings(0).isRightToLeft() != is_rtl)
is_rtl = GetFontSettings(0).isRightToLeft();
is_rtl = language->RightToLeft;
par = par->next;
}
}
@ -2115,7 +2121,10 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow,
os << "{\\" << font.latexSize() << " \\par}";
}
if (language != doc_language) {
if (language != doc_language &&
(!par
|| (footnoteflag != NO_FOOTNOTE && par->footnoteflag != footnoteflag)
|| par->getParLanguage() != language)) {
os << endl
<< subst(lyxrc.language_command_end, "$$lang",
doc_language->lang);
@ -4213,10 +4222,11 @@ bool LyXParagraph::IsWord(size_type pos ) const
Language const * LyXParagraph::getParLanguage() const
{
if (size() > 0)
if (IsDummy())
return FirstPhysicalPar()->getParLanguage();
else if (size() > 0)
if (!table)
return FirstPhysicalPar()->GetFirstFontSettings()
.language();
return GetFirstFontSettings().language();
else {
for (size_type pos = 0; pos < size(); ++pos)
if (IsNewline(pos))
@ -4321,8 +4331,8 @@ string LyXParagraph::String(LyXParagraph::size_type beg,
}
}
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
s += NextAfterFootnote()->String(false);
//if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
// s += NextAfterFootnote()->String(false);
if (!IsDummy()) {
if (isRightToLeftPar())