From: Lars Gullik Bjønnes Date: Fri, 19 May 2000 19:46:23 +0000 (+0000) Subject: some small patches X-Git-Tag: 1.6.10~22237 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=94fd1a06287642d3691d857d0e51b83fb116ae6c;p=features.git some small patches git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@745 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 782bccc51d..1114af0ae9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2000-05-19 Lars Gullik Bjønnes + + * 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 + + * 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 * forms/lyx.fd: Redesign of form_ref diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index b86aa3cf4b..92e5d40fc1 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -469,7 +469,7 @@ int BufferView::Pimpl::scrollDown(long time) if (!screen) return 0; double value= workarea->getScrollbarValue(); - pair p = workarea->getScrollbarBounds(); + pair p = workarea->getScrollbarBounds(); double max = p.second; if (value == max) return 0; diff --git a/src/filedlg.C b/src/filedlg.C index d1294f705b..1413a9fffa 100644 --- a/src/filedlg.C +++ b/src/filedlg.C @@ -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); diff --git a/src/language.C b/src/language.C index 4c9f64cbfa..f36cbf47e3 100644 --- a/src/language.C +++ b/src/language.C @@ -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; /// diff --git a/src/language.h b/src/language.h index cb8d996649..7b76396952 100644 --- a/src/language.h +++ b/src/language.h @@ -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; diff --git a/src/layout.C b/src/layout.C index 37898f0384..777358827f 100644 --- a/src/layout.C +++ b/src/layout.C @@ -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 } diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 4cca2189b7..e759718f2a 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -390,13 +390,12 @@ int AskConfirmation(string const & s1, string const & s2, string const & s3) // Asks for a text pair 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(true, tmp); + return make_pair(true, string(tmp)); else return make_pair(false, string()); } diff --git a/src/lyx_main.C b/src/lyx_main.C index 2eca5c1a39..54755e728a 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -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 diff --git a/src/lyxfont.C b/src/lyxfont.C index 82d4062bb8..07dca6dcac 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -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()) diff --git a/src/mathed/formula.C b/src/mathed/formula.C index bfdd7a37ec..cc61c95dc8 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -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(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 - 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] > ' ') { diff --git a/src/mathed/math_iter.C b/src/mathed/math_iter.C index 8968d10871..9e077461c4 100644 --- a/src/mathed/math_iter.C +++ b/src/mathed/math_iter.C @@ -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; diff --git a/src/mathed/math_iter.h b/src/mathed/math_iter.h index e7e6423bf0..a34738eb32 100644 --- a/src/mathed/math_iter.h +++ b/src/mathed/math_iter.h @@ -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*); /// diff --git a/src/mathed/math_symbols.C b/src/mathed/math_symbols.C index 0fe7451ce7..0d7c82642a 100644 --- a/src/mathed/math_symbols.C +++ b/src/mathed/math_symbols.C @@ -543,7 +543,7 @@ char const ** pixmapFromBitmapData(char const * s, int wx, int hx) XpmCreateDataFromImage(fl_display, const_cast(&data), sbima, sbima, 0); // Dirty hack to get blue symbols quickly - char * sx = strstr(data[2], "FFFFFFFF"); + char * sx = const_cast(strstr(data[2], "FFFFFFFF")); if (sx) { for (int k = 0; k < 8; ++k) sx[k] = '0'; } diff --git a/src/tabular.C b/src/tabular.C index dd0a6b4ddb..c63b540191 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -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); diff --git a/src/text2.C b/src/text2.C index 71479ecbe6..d0d758faaf 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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()){ diff --git a/src/vspace.C b/src/vspace.C index 50f4a94fe5..92de803861 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -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 diff --git a/src/vspace.h b/src/vspace.h index 7b0de93d5b..2d36964671 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -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