]> git.lyx.org Git - features.git/commitdiff
remove reference list from menus, formlog updates, small mathed cleanup
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Feb 2001 15:54:30 +0000 (15:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Feb 2001 15:54:30 +0000 (15:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1471 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/ChangeLog
src/MenuBackend.C
src/MenuBackend.h
src/buffer.C
src/buffer.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormLog.C
src/frontends/xforms/Menubar_pimpl.C
src/mathed/ChangeLog
src/mathed/array.h
src/mathed/math_iter.h
src/mathed/math_write.C

index b6cb3d8c4006481d83f2712cfb474b72e86e7d04..8d1b80c717f6a5107be638e07a1d70b041434641 100644 (file)
@@ -1,3 +1,14 @@
+2001-02-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * buffer.h:
+       * buffer.C: rename to getLogName(), handle
+         build log / latex log nicely
+
+2001-02-09  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * MenuBackend.C: 
+       * MenuBackend.h: remove support for reference menuitem type.
+
 2001-02-07  John Levon  <moz@compsoc.man.ac.uk>
 
        * BufferView_pimpl.C: housekeeping
index a73b2aa17518be602cc53634b3c0b93437165c07..53cdc1200de8d420482f2a0f42ab057e77bc1795 100644 (file)
@@ -52,7 +52,6 @@ MenuItem::MenuItem(Kind kind, string const & label,
        case Documents:
        case Lastfiles:
        case Toc:
-       case References:
        case ViewFormats:
        case UpdateFormats:
        case ExportFormats:
@@ -93,7 +92,6 @@ Menu & Menu::read(LyXLex & lex)
                md_importformats,
                md_lastfiles,
                md_optitem,
-               md_references,
                md_separator,
                md_submenu,
                md_toc,
@@ -110,7 +108,6 @@ Menu & Menu::read(LyXLex & lex)
                { "item", md_item },
                { "lastfiles", md_lastfiles },
                { "optitem", md_optitem }, 
-               { "references", md_references },
                { "separator", md_separator },
                { "submenu", md_submenu },
                { "toc", md_toc },
@@ -157,10 +154,6 @@ Menu & Menu::read(LyXLex & lex)
                        add(MenuItem(MenuItem::Toc));
                        break;
 
-               case md_references:
-                       add(MenuItem(MenuItem::References));
-                       break;
-
                case md_viewformats:
                        add(MenuItem(MenuItem::ViewFormats));
                        break;
index 192c45d5c4e9f03f771f830539a3003a352cd67d..d21df334087a878af2a4765ccdf57a80ce3cd03d 100644 (file)
@@ -44,8 +44,6 @@ public:
                Documents,
                ///
                Toc,
-               ///
-               References,
                /** This is a list of viewable formats
                    typically for the File->View menu. */
                ViewFormats,
index ed641b4110167318c298565ce2160c920d3babd0..f4c92268c55ac14a94ba8324232beda8d5e3a976 100644 (file)
@@ -104,6 +104,7 @@ using std::ios;
 using std::setw;
 using std::endl;
 using std::pair;
+using std::make_pair;
 using std::vector;
 using std::max;
 using std::set;
@@ -178,32 +179,35 @@ string const Buffer::getLatexName(bool no_path) const
                                       ".tex"); 
 }
 
-string const Buffer::getLatexLogName(void) const
+pair<Buffer::LogType, string> const Buffer::getLogName(void) const
 {
        string filename, fname, bname, path;
 
        filename = getLatexName(false);
 
        if (filename.empty())
-               return string();
+               return make_pair(Buffer::latexlog, string());
 
-       fname = OnlyFilename(ChangeExtension(filename, ".log"));
-       bname = OnlyFilename(ChangeExtension(filename,
-               formats.Extension("literate") + ".out"));
        path = OnlyPath(filename);
 
        if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1))
-               path = tmppath + "/";
+               path = tmppath;
 
-       lyxerr[Debug::FILES] << "LaTeX Log calculated as : " << path + fname << endl;
+       fname = AddName(path, OnlyFilename(ChangeExtension(filename, ".log")));
+       bname = AddName(path, OnlyFilename(ChangeExtension(filename,
+               formats.Extension("literate") + ".out")));
 
        // If no Latex log or Build log is newer, show Build log
-       FileInfo f_fi(path + fname), b_fi(path + bname);
+
+       FileInfo f_fi(fname), b_fi(bname);
+
        if (b_fi.exist() &&
-               (!f_fi.exist() || f_fi.getModificationTime() < b_fi.getModificationTime()))
-               return path + bname;
-       else
-               return path + fname;
+               (!f_fi.exist() || f_fi.getModificationTime() < b_fi.getModificationTime())) {
+               lyxerr[Debug::FILES] << "Log name calculated as : " << bname << endl;
+               return make_pair(Buffer::buildlog, bname);
+       }
+       lyxerr[Debug::FILES] << "Log name calculated as : " << fname << endl;
+       return make_pair(Buffer::latexlog, fname);
 }
 
 void Buffer::setReadonly(bool flag)
index b717a78051e385feb9f6126ba84316cc4fc270be..15aecd6062c3a2875aae1c256cc820dcb18140a4 100644 (file)
@@ -57,6 +57,12 @@ struct DEPCLEAN {
   */
 class Buffer {
 public:
+       /// what type of log will getLogName() return ?
+       enum LogType {
+               latexlog, /**< LaTeX log */
+               buildlog  /**< Literate build log */
+       };
+
        ///
        explicit Buffer(string const & file, bool b = false);
        
@@ -240,10 +246,8 @@ public:
        */
        string const getLatexName(bool no_path = true) const;
 
-       /**
-        * get the name of the LaTeX log
-        */
-       string const getLatexLogName(void) const;
+       /// get the name and type of the log
+       std::pair<LogType, string> const getLogName(void) const;
  
        /// Change name of buffer. Updates "read-only" flag.
        void setFileName(string const & newfile);
index 8d49e1fe8a9a2b7732209176ebfb8dbad83c95f9..63f72154071c18c8774aac5d2844ccf0b4cfb7b4 100644 (file)
@@ -1,3 +1,11 @@
+2001-02-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * FormLog.C: handle Literate build log nicely
+
+2001-02-09  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * Menubar_pimpl.C: remove support for reference menuitem type.
+
 2001-02-07  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am:
index e85e324a69e01f17c19ab9477a479d322295e9af..d8accd95ff9f46ab1a358bb056d9c6571e492eec 100644 (file)
@@ -41,10 +41,21 @@ void FormLog::update()
        if (!dialog_ || !lv_->view()->available())
                return;
  
-       string const logfile = lv_->view()->buffer()->getLatexLogName();
+       std::pair<Buffer::LogType, string> const logfile
+               = lv_->view()->buffer()->getLogName();
 
        fl_clear_browser(dialog_->browser);
 
-       if (!fl_load_browser(dialog_->browser, logfile.c_str()))
-               fl_add_browser_line(dialog_->browser, _("No LaTeX log file found"));
+       if (logfile.first == Buffer::buildlog) {
+               fl_set_form_title(dialog_->form, _("Build log"));
+               if (!fl_load_browser(dialog_->browser, logfile.second.c_str()))
+                       fl_add_browser_line(dialog_->browser,
+                                           _("No build log file found"));
+               return;
+       }
+
+       fl_set_form_title(dialog_->form, _("LaTeX Log"));
+       if (!fl_load_browser(dialog_->browser, logfile.second.c_str()))
+               fl_add_browser_line(dialog_->browser,
+                                   _("No LaTeX log file found"));
 }
index 91daef413b97325efd06ff886841537f997f53af..6a26b0f450cc18f3ba69f4eee963b93702d8255a 100644 (file)
@@ -367,130 +367,6 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
 
 }
 
-void add_references2(int menu, vector<int> & smn, Window win,
-                    vector<string> const & label_list, string const & type)
-{
-       size_type const max_number_of_items = 25;
-       size_type const max_number_of_items2 = 20;
-       string::size_type const max_item_length = 40;
-       string::size_type const max_item_length2 = 20;
-
-       if (label_list.size() <= max_number_of_items)
-               for (size_type i = 0; i < label_list.size(); ++i) {
-                       int const action = (type == "goto")
-                               ? lyxaction.getPseudoAction(LFUN_REF_GOTO, 
-                                                           label_list[i])
-                               : lyxaction.getPseudoAction(LFUN_REF_INSERT,
-                                                           type + "|++||++|"
-                                                           + label_list[i]);
-                       string label = label_list[i];
-                       if (label.size() > max_item_length)
-                               label = label.substr(0, max_item_length-1) + "$";
-                       label += "%x" + tostr(action + action_offset);
-                       fl_addtopup(menu, label.c_str());
-               }
-       else {
-               size_type count = 0;
-               for (size_type i = 0; i < label_list.size();
-                    i += max_number_of_items2) {
-                       ++count;
-                       if (count > max_number_of_items) {
-                               fl_addtopup(menu, ". . .%d");
-                               break;
-                       }
-                       size_type j = min(label_list.size(),
-                                         i+max_number_of_items2);
-
-                       string label;
-                       label += (label_list[i].size() > max_item_length2)
-                               ? label_list[i].substr(0, max_item_length2-1) + "$"
-                               : label_list[i];
-                       label += "..";
-                       label += (label_list[j-1].size() > max_item_length2)
-                               ? label_list[j-1].substr(0, max_item_length2-1) + "$"
-                               : label += label_list[j-1];
-
-                       int menu2 = get_new_submenu(smn, win);
-                       for (size_type k = i;  k < j; ++k) {
-                               int const action = (type == "goto")
-                                       ? lyxaction.getPseudoAction(LFUN_REF_GOTO, 
-                                                                   label_list[k])
-                                       : lyxaction.getPseudoAction(LFUN_REF_INSERT,
-                                                                   type + "|++||++|"
-                                                                   + label_list[k]);
-                               string label2 = label_list[k];
-                               if (label2.size() > max_item_length)
-                                       label2 = label2.substr(0, max_item_length-1) + "$";
-                               label2 += "%x" + tostr(action + action_offset);
-                               fl_addtopup(menu2, label2.c_str());
-                       }
-                       label += "%m";
-                       fl_addtopup(menu, label.c_str(), menu2);
-               }
-       }
-}
-
-
-void Menubar::Pimpl::add_references(int menu, string const & extra_label,
-                                   vector<int> & smn, Window win)
-{
-       //xgettext:no-c-format
-       static char const * MenuNames[6] = { N_("Insert Reference%m"),
-       //xgettext:no-c-format
-                                            N_("Insert Page Number%m"),
-       //xgettext:no-c-format
-                                            N_("Insert vref%m"),
-       //xgettext:no-c-format
-                                            N_("Insert vpageref%m"),
-       //xgettext:no-c-format
-                                            N_("Insert Pretty Ref%m"),
-       //xgettext:no-c-format
-                                            N_("Goto Reference%m") };
-
-       int const EMPTY = 1;
-       int const SGML = 2;
-       int const READONLY = 4;
-
-       static int MenuFlags[6] = {
-               EMPTY | READONLY,
-               EMPTY | READONLY,
-               EMPTY | READONLY | SGML,
-               EMPTY | READONLY | SGML,
-               EMPTY | READONLY | SGML,
-               EMPTY };
-
-       static string const MenuTypes[6] = {
-               "ref", "pageref", "vref", "vpageref", "prettyref", "goto" };
-
-       vector<string> label_list = owner_->buffer()->getLabelList();
-
-       int flag = 0;
-       if (label_list.empty())
-               flag += EMPTY;
-       if (owner_->buffer()->isSGML())
-               flag += SGML;
-       if (owner_->buffer()->isReadonly())
-               flag += READONLY;
-
-       int max_nonempty = -1;
-       for (int i = 0; i < 6; ++i)
-               if ((MenuFlags[i] & flag) == 0)
-                       max_nonempty = i;
-
-       for (int i = 0; i < 6; ++i) {
-               if ((MenuFlags[i] & flag) == 0) {
-                       string label = _(MenuNames[i]);
-                       if (i == max_nonempty)
-                               label += extra_label;
-                       int menu2 = get_new_submenu(smn, win);
-                       add_references2(menu2, smn, win, label_list,
-                                       MenuTypes[i]);
-                       fl_addtopup(menu, label.c_str(), menu2);
-               }
-       }
-}
-
-
 int Menubar::Pimpl::create_submenu(Window win, LyXView * view, 
                                   string const & menu_name, 
                                   vector<int> & smn) 
@@ -633,10 +509,6 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
                        add_toc(menu, extra_label, smn, win);
                        break;
 
-               case MenuItem::References:
-                       add_references(menu, extra_label, smn, win);
-                       break;
-
                case MenuItem::Documents: 
                case MenuItem::Lastfiles: 
                case MenuItem::ViewFormats:
index aa81690a58a8b3d2a16503ed7e6c5c4cdc25f268..6f0382b2b97963fb7a19006ec4d794e8d5aae407 100644 (file)
@@ -1,3 +1,8 @@
+2001-02-09  Andre Poenitz  <poenitz@HTWM.De>
+
+       * math_iter.h: remove unused prototype
+       * array.h: ditto.
+
 2001-02-08  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * math_macro.C (draw): add .c_str() to .str() (useful when
index 1a33d6438c5c83fb7809d006dd13614069340bc8..4be93b9bfca5b82462863db3790c23d0a539c6a6 100644 (file)
@@ -78,9 +78,6 @@ public:
        /// Insert a character at position pos
        void Insert(int pos, byte);
 
-       /// Insert a string of lenght dx at position pos
-       void Insert(int pos, byte *, int dx);
-
        /// Constructs a new array with dx elements starting at pos 
        byte operator[](const int);
 
index c6e89231f68e4dde4c9532001288c38df6ad84ad..dc19a7f43c01d84f2eb45cca0a75412ecc288064 100644 (file)
@@ -198,8 +198,6 @@ class MathedXIter: public MathedIter {
     inline
     void GetIncPos(int &, int &) const;
     ///
-    byte * GetString(int &) const ;
-    ///
     string const GetString() const;
     ///
     int GetX() const;
index e0e436924d1a61368db086706b78855a2143ef08..e19aaf0ca8f6ba20c653eb07e4d3ed3de9cdab36 100644 (file)
@@ -206,9 +206,8 @@ void MathParInset::Write(ostream & os, bool fragile)
                                        if (l) {
                                                os << '\\' << l->name << ' ';
                                        } else {
-#warning This does not compile (Lgb)
-                                               //lyxerr << "Illegal symbol code[" << c
-                                               //     << " " << str.end() - s << " " << data.FCode() << "]";
+                                               lyxerr << "Illegal symbol code[" << c
+                                                    << " " << str.end() - s << " " << data.FCode() << "]";
                                        }
                                } else {
                                        // Is there a standard logical XOR?