]> git.lyx.org Git - features.git/commitdiff
some small patches
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 19 May 2000 19:46:23 +0000 (19:46 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 19 May 2000 19:46:23 +0000 (19:46 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@745 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
ChangeLog
src/BufferView_pimpl.C
src/filedlg.C
src/language.C
src/language.h
src/layout.C
src/lyx_gui_misc.C
src/lyx_main.C
src/lyxfont.C
src/mathed/formula.C
src/mathed/math_iter.C
src/mathed/math_iter.h
src/mathed/math_symbols.C
src/tabular.C
src/text2.C
src/vspace.C
src/vspace.h

index 782bccc51d9a721f7c4ff243823042e96e2e2bb6..1114af0ae9229957bfa3d0b0a7063294ad910343 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2000-05-19  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/vspace.C (operator=): removed
+       (operator=): removed
+
+       * src/lyx_gui_misc.C (askForText): manually set the type in make_pair
+
+       * src/layout.C (NumberOfClass): manually set the type in make_pair
+       (NumberOfLayout): ditto
+
+       * src/language.C: use the Language constructor for ignore_lang
+
+       * src/language.h: add constructors to struct Language
+
+       * src/BufferView_pimpl.C (scrollDown): change to pair<float, float>
+
+       * src/text2.C (SetCursorIntern): comment out #warning
+
+       * src/mathed/math_symbols.C (pixmapFromBitmapData): add const_cast
+
+       * src/mathed/math_iter.h: initialize sx and sw to 0
+
 2000-05-10  Dekel Tsur  <dekel@math.tau.ac.il>
 
        * forms/lyx.fd: Redesign of form_ref
index b86aa3cf4b5b47e50663f9521ddd56d24494830b..92e5d40fc1da1130971e4232f6352c6a1224d7dd 100644 (file)
@@ -469,7 +469,7 @@ int BufferView::Pimpl::scrollDown(long time)
        if (!screen) return 0;
    
        double value= workarea->getScrollbarValue();
-       pair<double, double> p = workarea->getScrollbarBounds();
+       pair<float, float> p = workarea->getScrollbarBounds();
        double max = p.second;
        
        if (value == max) return 0;
index d1294f705b0f00ddec73de9ee1b8ebde8811a8f9..1413a9fffaabee899f14994f64aef726604f96c8 100644 (file)
@@ -513,6 +513,7 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
        }
 }
 
+
 extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data) 
 {
        LyXFileDlg::FileDlgCB(ob, data);
index 4c9f64cbfac0888c1c0a38482a352825e535a0ae..f36cbf47e3932ce1807b936050ba76a552f5a794 100644 (file)
@@ -5,8 +5,8 @@
 #include "gettext.h"
 
 Languages languages;
-Language const *default_language;
-Language ignore_lang = {"ignore", "Ignore", false};
+Language const * default_language;
+Language ignore_lang("ignore", "Ignore", false);
 Language const * ignore_language = &ignore_lang;
 
 ///
index cb8d996649635c510b6972a15a22a2ba925b943a..7b76396952929ec18ac51fee9c35e776bdd2c73e 100644 (file)
@@ -6,6 +6,9 @@
 #include "LString.h"
 
 struct Language {
+       Language() : RightToLeft(false) {}
+       Language(string const & l, string const & d, bool rtl)
+               : lang(l), display(d), RightToLeft(rtl) {}
        string lang;
        string display;
        bool RightToLeft;
index 37898f03844cc55ec54a8d4671ed18792e68e559..777358827ff8a176839df2fe2d80be4e279d3ed6 100644 (file)
@@ -1327,7 +1327,8 @@ LyXTextClassList::NumberOfClass(string const & textclass) const
        for (ClassList::const_iterator cit = classlist.begin();
             cit != classlist.end(); ++cit) {
                if ((*cit).name() == textclass)
-                       return make_pair(true, cit - classlist.begin());
+                       return make_pair(true,
+                                        size_type(cit - classlist.begin()));
        }
        return make_pair(false, size_type(0));
 }
@@ -1356,8 +1357,8 @@ LyXTextClassList::NumberOfLayout(LyXTextClassList::size_type textclass,
                        return make_pair(true, i);
        }
        if (name == "dummy")
-               return make_pair(true, LYX_DUMMY_LAYOUT);
-       return make_pair(false, LyXTextClass::LayoutList::size_type(0)); // not found
+               return make_pair(true, LyXTextClassList::size_type(LYX_DUMMY_LAYOUT));
+       return make_pair(false, LyXTextClass::size_type(0)); // not found
 }
 
 
index 4cca2189b7fe967f549967e7cc0d213623ae53ef..e759718f2a9c4fefe570edd5bb5d9c03dcaad551 100644 (file)
@@ -390,13 +390,12 @@ int AskConfirmation(string const & s1, string const & s2, string const & s3)
 // Asks for a text
 pair<bool, string> askForText(string const & msg, string const & dflt)
 {
-       char const * tmp;
        fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
        fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
        fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
-       tmp = fl_show_input(msg.c_str(), dflt.c_str());
+       char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
        if (tmp != 0)
-         return make_pair<bool, string>(true, tmp);
+         return make_pair<bool, string>(true, string(tmp));
        else
          return make_pair<bool, string>(false, string());
 }
index 2eca5c1a3954fc6e4e5810a2fa301e291fac094b..54755e728a551e1eed50f74218dc27e61c4819b9 100644 (file)
@@ -161,11 +161,11 @@ extern "C" void error_handler(int err_sig);
 void LyX::init(int */*argc*/, char **argv, bool gui)
 {
        // Install the signal handlers
-       signal(SIGHUP, error_handler);
-       signal(SIGFPE, error_handler);
-       signal(SIGSEGV, error_handler);
-       signal(SIGINT, error_handler);
-       signal(SIGTERM, error_handler);
+       ::signal(SIGHUP, error_handler);
+       ::signal(SIGFPE, error_handler);
+       ::signal(SIGSEGV, error_handler);
+       ::signal(SIGINT, error_handler);
+       ::signal(SIGTERM, error_handler);
 
        //
        // Determine path of binary
index 82d4062bb8b675709e6992b7caed160c0366148c..07dca6dcac5021a66f7aa27ffde78b8034c966b4 100644 (file)
@@ -655,7 +655,12 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
                }
        }
        if (orgfont.color() != color()) {
-               os << "\\color " << lcolor.getLyXName(color()) << "\n";
+               // To make us file compatible with older
+               // lyx versions we emit "default" instead
+               // of "ignore"
+               string col_str(lcolor.getLyXName(color()));
+               if (col_str == "inherit") col_str = "default";
+               os << "\\color " << col_str << "\n";
        }
        if (orgfont.language() != language()) {
                if (language())
index bfdd7a37ec057d54fdd169dac0c680710e2b5341..cc61c95dc89ffc86f72d7841ac93c2c665235233 100644 (file)
@@ -430,8 +430,8 @@ void InsetFormula::draw(Painter & pain, LyXFont const & f,
        x += float(width(pain, font));
        
        if (par->GetType() == LM_OT_PARN || par->GetType() == LM_OT_MPARN) {
-               LyXFont font = WhichFont(LM_TC_BF, par->size);
-               font.setLatex(LyXFont::OFF);
+               LyXFont wfont = WhichFont(LM_TC_BF, par->size);
+               wfont.setLatex(LyXFont::OFF);
                
                if (par->GetType() == LM_OT_PARN) {
                        string str;
@@ -439,7 +439,7 @@ void InsetFormula::draw(Painter & pain, LyXFont const & f,
                                str = string("(") + label + ")";
                        else
                                str = string("(#)");
-                       pain.text(int(x + 20), baseline, str, font);
+                       pain.text(int(x + 20), baseline, str, wfont);
                } else if (par->GetType() == LM_OT_MPARN) {
                        MathMatrixInset * mt =
                                static_cast<MathMatrixInset*>(par);
@@ -453,7 +453,7 @@ void InsetFormula::draw(Painter & pain, LyXFont const & f,
                                                str = string("(") + crow->getLabel() + ")";
                                        else
                                                str = "(#)";
-                                       pain.text(int(x + 20), y, str, font);
+                                       pain.text(int(x + 20), y, str, wfont);
                                }
                                crow = crow->getNext();
                        }
@@ -1025,9 +1025,9 @@ InsetFormula::LocalDispatch(BufferView * bv,
        string lb = arg;
        if (lb.empty()) {
          pair<bool, string>
-               result = askForText(_("Enter new label to insert:"));
-         if (result.first) {
-            lb = result.second;
+               res = askForText(_("Enter new label to insert:"));
+         if (res.first) {
+            lb = res.second;
          }
        }
        if (!lb.empty() && lb[0] > ' ') {
index 8968d10871d4540f2a79168fdbb57bdd4d447f53..9e077461c463f1860027ea8c39ed19ddcdd96162 100644 (file)
@@ -629,7 +629,8 @@ bool MathedXIter::Next()
 //       lyxerr <<"LNX " << pos << endl;
 //       if (sw>0 && GetChar()!= LM_TC_UP && GetChar()!= LM_TC_DOWN) {
 //        w = (sx>sw) ? 0: sw-sx;
-      if ((sw > 0 || sx > 0) && GetChar() != LM_TC_UP && GetChar() != LM_TC_DOWN) {
+      if ((sw > 0 || sx > 0)
+         && GetChar() != LM_TC_UP && GetChar() != LM_TC_DOWN) {
          if (sw > 0)
            w = (sx > sw) ? 0 : sw - sx;
          sx = sw = 0;
index e7e6423bf0f3d86f8bccef7f657f4e0d5c9cc6d2..a34738eb32860c17a7176b92f1c072d80f590bef 100644 (file)
@@ -166,7 +166,7 @@ class MathedIter {
 class MathedXIter: public MathedIter {
  public:
     ///
-    MathedXIter(): MathedIter() { x = y = size = 0;  p = 0; crow = 0; }
+    MathedXIter() : MathedIter(), sx(0), sw(0) { x = y = size = 0;  p = 0; crow = 0; }
     ///
     MathedXIter(MathParInset*);
     ///
index 0fe7451ce7abab29e6970bf0894bb125c1c031ab..0d7c82642ae112a83a03e2d2bf585f108bbc5691 100644 (file)
@@ -543,7 +543,7 @@ char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
        XpmCreateDataFromImage(fl_display, const_cast<char***>(&data), sbima, sbima, 0);
        
        // Dirty hack to get blue symbols quickly
-       char * sx = strstr(data[2], "FFFFFFFF");
+       char * sx = const_cast<char*>(strstr(data[2], "FFFFFFFF"));
        if (sx) {
            for (int k = 0; k < 8; ++k) sx[k] = '0';
        }
index dd0a6b4ddb68891c998456299fb91312349c1fff..c63b540191a289f20ae41b2e0c54b0101d25e6e1 100644 (file)
@@ -268,10 +268,10 @@ void LyXTabular::AppendRow(int /* cell */)
 
 void LyXTabular::DeleteRow(int row)
 {
-    row_info.erase(&row_info[row]);
-    cell_info.erase(&cell_info[row]);
-    --rows_;
-    Reinit();
+       row_info.erase(row_info.begin() + row); //&row_info[row]);
+       cell_info.erase(cell_info.begin() + row); //&cell_info[row]);
+       --rows_;
+       Reinit();
 }
 
 
@@ -1352,7 +1352,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
            row = row_of_cell(cell);
            if (cont_row_info[row]) {
                DeleteRow(row);
-               cont_row_info.erase(&cont_row_info[row]);
+               cont_row_info.erase(cont_row_info.begin() + row); //&cont_row_info[row]);
                while(!IsFirstCellInRow(--cell));
            } else {
                inset = GetCellInset(cell);
index 71479ecbe646f67321f59863a0768d8375759ed3..d0d758faaf11a94dc28099f77638d09b04abe1e5 100644 (file)
@@ -3207,7 +3207,7 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
                              LyXParagraph::size_type pos, bool setfont) const
 {
        SetCursor(cursor, par, pos);
-#warning Remove this when verified working (Jug 20000413)
+// #warning Remove this when verified working (Jug 20000413)
 #if 0
        // correct the cursor position if impossible
        if (pos > par->Last()){
index 50f4a94fe5e018647b4903a96fe756ff39c3766b..92de80386154ecf5ac1bda878fc4f63b82e85131 100644 (file)
@@ -289,13 +289,6 @@ LyXLength::LyXLength(string const & data)
 }
 
 
-bool LyXLength::operator== (LyXLength const & other) const
-{
-       return (val == other.val &&
-               uni == other.uni);
-}
-
-
 string LyXLength::asString() const
 {
 #ifdef HAVE_SSTREAM
@@ -331,17 +324,6 @@ LyXGlueLength::LyXGlueLength (string const & data)
 }
 
 
-bool LyXGlueLength::operator== (LyXGlueLength const & other) const
-{
-       return (val == other.val && 
-               uni == other.uni &&
-               plus_val  == other.plus_val &&
-               plus_uni  == other.plus_uni &&
-               minus_val == other.minus_val &&
-               minus_uni == other.minus_uni);
-}
-
-
 string LyXGlueLength::asString() const
 {
 #ifdef HAVE_SSTREAM
index 7b0de93d5b560fecd2a30644108aa3b4926d3010..2d36964671ca74827d8110ec8408240692e10489 100644 (file)
@@ -73,9 +73,6 @@ public:
        LyXLength::UNIT unit() const { return uni; };
        //@}
 
-       ///
-        bool operator== (LyXLength const &) const;
-
        /// conversion
        virtual string asString() const;
        ///
@@ -94,6 +91,15 @@ protected:
        LyXLength::UNIT uni;
 };
 
+
+inline
+bool operator==(LyXLength const & l1, LyXLength const & l2)
+{
+       return l1.value() == l2.value()
+               && l1.unit() == l2.unit();
+}
+       
+
 extern LyXLength::UNIT unitFromString (string const & data);
 extern bool isValidLength(string const & data, LyXLength * result);
 
@@ -135,9 +141,6 @@ public:
        LyXLength::UNIT minusUnit() const { return minus_uni; };
        //@}
 
-       ///
-        bool operator == (LyXGlueLength const &) const;
-
        /// conversion
        virtual string asString() const;
        ///
@@ -156,6 +159,20 @@ protected:
        LyXLength::UNIT plus_uni, minus_uni;
 };
 
+///
+inline
+bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2)
+{
+       return l1.value() == l2.value()
+               && l1.unit() == l2.unit()
+               && l1.plusValue() == l2.plusValue()
+               && l1.plusUnit() == l2.plusUnit()
+               && l1.minusValue() == l2.minusValue()
+               && l1.minusUnit() == l2.minusUnit();
+}
+
+
+
 extern bool isValidGlueLength(string const & data, LyXGlueLength * result);
 
 ///  VSpace class