+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
\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
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;
}
.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)
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 */
//@{
/**
// 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;
+ "-*-*-*-?-*-*-*-*-"
+ 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
#include "lyxlex.h"
#include "FontLoader.h"
#include "support/lstrings.h"
+#include "bufferparams.h" // stateText
using std::ostream;
using std::endl;
/// Build GUI description of font state
-string LyXFont::stateText() const
+string LyXFont::stateText(BufferParams * params) const
{
#ifdef HAVE_SSTREAM
std::ostringstream ost;
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
#endif
class LyXLex;
+class BufferParams;
///
class LyXFont {
LyXFont const & next) const;
/// Build GUI description of font state
- string stateText() const;
+ string stateText(BufferParams * params) const;
///
LColor::color realColor() const;
// 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;;
// 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;;
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));
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,
"|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")));
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;
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);
}
<< endl;
features.noun = true;
lyxerr[Debug::LATEX] << "Noun enabled. Font: "
- << (*cit).font.stateText()
+ << (*cit).font.stateText(0)
<< endl;
}
switch ((*cit).font.color()) {
default:
features.color = true;
lyxerr[Debug::LATEX] << "Color enabled. Font: "
- << (*cit).font.stateText()
+ << (*cit).font.stateText(0)
<< endl;
}
#if 0
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;
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;
}
}
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);
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))
}
}
- 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())