]> git.lyx.org Git - features.git/commitdiff
some small changes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 22 May 2000 16:56:05 +0000 (16:56 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 22 May 2000 16:56:05 +0000 (16:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@765 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
lib/bind/menus.bind
src/FontLoader.C
src/bufferview_funcs.C
src/lastfiles.h
src/lyx_cb.C
src/lyx_gui.C
src/lyxfont.C
src/lyxfont.h
src/menus.C
src/paragraph.C

index 882d4812e69be8c20c19cb4fef0b5faeca2e0b3b..d7ec2e5860ca8ba8182679dd2eefae3fa0938d5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 2f5e7b57263dbc060bbbe8dfaf4903f29e9984f8..9d91d90f52bccb463192fd7d059e77f9db717c74 100644 (file)
 \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
index 77007f7461c0d29a0c8a47b9fa43e0b8a2fd4de6..6938348f6e9b9b1d5a34b7b22461cc7842c515a2 100644 (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;
        }
 
index e4d2f5205e14440a4cb84067aca69180b605a796..bc99b1eca528e4cc5f564b8d312054a67b633596 100644 (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) 
index 884817df30a6ace638060ab42abc56bcffbf27ac..cb7c49cc2986c36f53c0ae5dd1e10e113f56225e 100644 (file)
     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 */
        //@{
        /**
index 8715b6dfd63026b612b73d3d05aac813f6e05738..1b4db6807f3759805d6955fd13cd01ce5b56ccfb 100644 (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;
index 7d491397a94de77d066da50aca261ccb8f32495b..a8d3f021fde51e2188a9c6a5e3064c1a9034ade1 100644 (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 
index 19b6ee727c2a8e8ae1932b069ea64a534705c478..5239fbba8f8b79c5eaf6a37284ec615d0db2842b 100644 (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
index a626288bfe770ed5743bc5cf9db683bd4f6ddd0b..65267f996996131c4ffe3e48b43a57617c11c019 100644 (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;
index f443638f5884950e661b41a0476b8a5d0c0a7722..4ca5bc8effe01ef227cb6590f6a0a768dc48e0ab 100644 (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); 
 }
index c4747be48ed147807ec46292ca0577407108626d..f32ab65e163811786809f6b778f07309fd6b20cc 100644 (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())