From 1fefef39080cbf6565d17acf3995312ce9bf067f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 3 Oct 2000 18:38:10 +0000 Subject: [PATCH] small changes and two patches from Dekel git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1077 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 30 +++++++++++++++++ boost/Makefile.am | 2 ++ lib/configure | 7 ++-- lib/configure.m4 | 5 +-- po/POTFILES.in | 13 -------- src/BufferView.h | 1 + src/BufferView2.C | 3 +- src/BufferView_pimpl.C | 8 +++-- src/exporter.C | 9 ++++-- src/frontends/xforms/Menubar_pimpl.C | 2 +- src/insets/insetbib.C | 6 ++-- src/insets/insetbutton.C | 2 ++ src/insets/insetcite.C | 2 +- src/insets/insettabular.C | 12 ++++++- src/lyx_gui_misc.C | 48 ++++++++++++++++++++++++++-- src/lyx_gui_misc.h | 4 +-- src/paragraph.C | 4 +-- src/support/filetools.C | 4 +-- 18 files changed, 124 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84d759b1dd..62460717ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2000-10-03 Lars Gullik Bjønnes + + + * src/insets/insettabular.C (setPos): change for loop to not use + sequencing operator. Please check this Jürgen. + + * src/frontends/xforms/Menubar_pimpl.C (makeMenubar): use "c" + instead of 'c' + * src/insets/insetcite.C (getScreenLabel): ditto + * src/support/filetools.C (QuoteName): ditto + (ChangeExtension): ditto + + * src/BufferView_pimpl.C (scrollCB): make heigt int + + * src/BufferView2.C (insertInset): comment out unused arg + + * boost/Makefile.am (EXTRADIST): new variable + +2000-10-03 Dekel Tsur + + * src/exporter.C (IsExportable): Fixed + + * lib/configure.m4: Small fix + +2000-10-03 Dekel Tsur + + * src/insets/insetbutton.C (width): Changed to work with no GUI. + * src/insets/insetbib.C (bibitemWidest): ditto. + * src/lyx_gui_misc.C (AskQuestion,AskConfirmation,askForText): ditto. + 2000-10-03 Juergen Vigna * src/BufferView2.C (theLockingInset): removed const because of diff --git a/boost/Makefile.am b/boost/Makefile.am index 2663749eae..fc3cdb8c5c 100644 --- a/boost/Makefile.am +++ b/boost/Makefile.am @@ -1,3 +1,5 @@ DISTCLEANFILES= *.orig *.rej *~ *.bak core MAINTAINERCLEANFILES= $(srcdir)/Makefile.in ETAGS_ARGS = --lang=c++ + +EXTRADIST = boost libs diff --git a/lib/configure b/lib/configure index c31b804dc9..76c79ec548 100755 --- a/lib/configure +++ b/lib/configure @@ -225,9 +225,9 @@ PATH=${save_PATH} # Search something to process a literate document echo $ac_n "checking for a Literate programming processor""... $ac_c" -echo "$ac_t""("noweave -delay -index \$\$FName > \$\$OutName")" +echo "$ac_t""(noweave)" LITERATE= -for ac_prog in "noweave -delay -index \$\$FName > \$\$OutName" +for ac_prog in noweave do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog ; ac_word=$2 @@ -258,7 +258,8 @@ if test -z "$LITERATE" ; then LITERATE=none fi -if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT="nw"; fi +test $LITERATE = "noweave" && LITERATE="noweave -delay -index \$\$FName > \$\$OutName" +LITERATE_EXT="nw" # Search for a Postscript interpreter echo $ac_n "checking for a Postscript interpreter""... $ac_c" diff --git a/lib/configure.m4 b/lib/configure.m4 index ce3855ddc4..d0eb420527 100644 --- a/lib/configure.m4 +++ b/lib/configure.m4 @@ -186,8 +186,9 @@ SEARCH_PROG([for reLyX LaTeX-to-LyX translator],RELYX,reLyX) PATH=${save_PATH} # Search something to process a literate document -SEARCH_PROG([for a Literate programming processor],LITERATE,"noweave -delay -index \$\$FName > \$\$OutName") -if test "$LITERATE" = "none"; then LITERATE_EXT="none"; else LITERATE_EXT="nw"; fi +SEARCH_PROG([for a Literate programming processor],LITERATE,noweave) +test $LITERATE = "noweave" && LITERATE="noweave -delay -index \$\$FName > \$\$OutName" +LITERATE_EXT="nw" # Search for a Postscript interpreter SEARCH_PROG([for a Postscript interpreter],GS, gs) diff --git a/po/POTFILES.in b/po/POTFILES.in index 7471c53912..78103e617b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -64,19 +64,6 @@ src/frontends/xforms/FormPrint.C src/frontends/xforms/form_print.C src/frontends/xforms/FormRef.C src/frontends/xforms/form_ref.C -src/frontends/xforms/forms/form_citation.C -src/frontends/xforms/forms/form_copyright.C -src/frontends/xforms/forms/form_document.C -src/frontends/xforms/forms/form_error.C -src/frontends/xforms/forms/form_graphics.C -src/frontends/xforms/forms/form_index.C -src/frontends/xforms/forms/form_paragraph.C -src/frontends/xforms/forms/form_preferences.C -src/frontends/xforms/forms/form_print.C -src/frontends/xforms/forms/form_ref.C -src/frontends/xforms/forms/form_tabular.C -src/frontends/xforms/forms/form_toc.C -src/frontends/xforms/forms/form_url.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C src/frontends/xforms/FormToc.C diff --git a/src/BufferView.h b/src/BufferView.h index 7f786fcd50..822033ede2 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -103,6 +103,7 @@ public: int workWidth() const; /// UpdatableInset * theLockingInset() const; + /// void theLockingInset(UpdatableInset * inset); /// void updateInset(Inset * inset, bool mark_dirty); diff --git a/src/BufferView2.C b/src/BufferView2.C index 809365a172..7f75d306c7 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -197,8 +197,9 @@ void BufferView::setCursorFromRow(int row) text->SetCursor(this, texrowpar, tmppos); } + bool BufferView::insertInset(Inset * inset, string const & lout, - bool no_table) + bool /*no_table*/) { // if we are in a locking inset we should try to insert the // inset there otherwise this is a illegal function now diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index c50fbf5f1d..22780d0629 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -428,7 +428,7 @@ void BufferView::Pimpl::scrollCB(double value) if (cursor_follows_scrollbar) { LyXText * vbt = bv_->text; - unsigned int height = vbt->DefaultHeight(); + int height = vbt->DefaultHeight(); if (vbt->cursor.y() < (int)(bv_->text->first + height)) { vbt->SetCursorFromCoordinates(bv_, 0, @@ -884,7 +884,8 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, LyXFont font = text->GetFont(bv_->buffer(), cursor.par(), cursor.pos()); bool is_rtl = font.isVisibleRightToLeft(); - int start_x, end_x; + int start_x; + int end_x; if (is_rtl) { start_x = cursor.x() - tmpinset->width(bv_, font) + tmpinset->scroll(); @@ -913,7 +914,8 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, LyXFont font = text->GetFont(bv_->buffer(), cursor.par(), cursor.pos()-1); bool is_rtl = font.isVisibleRightToLeft(); - int start_x, end_x; + int start_x; + int end_x; if (!is_rtl) { start_x = cursor.x() - tmpinset->width(bv_, font) + diff --git a/src/exporter.C b/src/exporter.C index 94405ac999..a906389e2e 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -84,12 +84,15 @@ bool Exporter::Preview(Buffer * buffer, string const & format0) bool Exporter::IsExportable(Buffer const * buffer, string const & format) { - // This is not efficient +#warning This is not efficient (Dekel) vector > const v = GetExportableFormats(buffer); for (vector >::const_iterator it = v.begin(); - it != v.end(); ++it) - if ((*it).first == format) + it != v.end(); ++it) { + string format2; + split((*it).first, format2, ':'); + if (format == format2) return true; + } return false; } diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index 4826f525c1..5136e7c20e 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -114,7 +114,7 @@ void Menubar::Pimpl::makeMenubar(Menu const &menu) break; } string label = i->label(); - string shortcut = '#' + i->shortcut(); + string shortcut = "#" + i->shortcut(); int width = string_width(label); obj = fl_add_button(FL_TOUCH_BUTTON, air + moffset, yloc, diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 14cd00d6a0..7a586aabf2 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -18,6 +18,7 @@ #include "lyxtext.h" #include "support/filetools.h" #include "support/path.h" +#include "lyxrc.h" using std::ostream; using std::ifstream; @@ -378,11 +379,12 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font) // ale070405 -string const bibitemWidest(BufferView * bv) +string const bibitemWidest(Buffer const * buffer) { int w = 0; // Does look like a hack? It is! (but will change at 0.13) - LyXParagraph * par = bv->buffer()->paragraph; + LyXParagraph * par = buffer->paragraph; + BufferView * bv = buffer->getUser(); InsetBibKey * bkey = 0; LyXFont font; diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index f5c467eaa1..a8a75095e9 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -70,6 +70,8 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const int width, ascent, descent; string s = getScreenLabel(); + if (!bv) + return s.length(); if (Editable()) { bv->painter().buttonText(0, 0, s, font, diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index fa2777fa97..a74989a400 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -53,7 +53,7 @@ string const InsetCitation::getScreenLabel() const if (!getOptions().empty()) label += ", " + getOptions(); - return '[' + label + ']'; + return "[" + label + "]"; } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 7b44fc76a8..0d0bc9d93a 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1060,9 +1060,19 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const // now search the right column int lx = tabular->GetWidthOfColumn(actcell) - tabular->GetAdditionalWidth(actcell); +#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb) +#if 0 for(; !tabular->IsLastCellInRow(actcell) && (lx < x); ++actcell,lx += tabular->GetWidthOfColumn(actcell) + tabular->GetAdditionalWidth(actcell - 1)); +#else + // Jürgen, you should check that this is correct. (Lgb) + for (; !tabular->IsLastCellInRow(actcell) && lx < x; ++actcell) { + lx += tabular->GetWidthOfColumn(actcell + 1) + + tabular->GetAdditionalWidth(actcell); + } + +#endif cursor.pos(0); resetPos(bv); if ((lx - (tabular->GetWidthOfColumn(actcell) / 2)) < x) { @@ -1082,7 +1092,7 @@ int InsetTabular::getCellXPos(int cell) const for(; !tabular->IsFirstCellInRow(c); --c) ; int lx = tabular->GetWidthOfColumn(cell); - for(; (c < cell); ++c) { + for(; c < cell; ++c) { lx += tabular->GetWidthOfColumn(c); } return (lx - tabular->GetWidthOfColumn(cell) + top_x); diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 678b03df87..8d05868f4c 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -35,6 +35,7 @@ #include "LyXView.h" #include "bufferview_funcs.h" #include "support/filetools.h" +#include "lyxrc.h" using std::pair; using std::make_pair; @@ -305,8 +306,23 @@ void WriteFSAlert(string const & s1, string const & s2) } -bool AskQuestion(string const & s1, string const & s2, string const & s3) +bool AskQuestion(string const & s1, string const & s2, string const & s3, + bool default_value) { + if (!lyxrc.use_gui) { + lyxerr << "----------------------------------------" << endl + << s1 << endl; + if (!s2.empty()) + lyxerr << s2 << endl; + if (!s3.empty()) + lyxerr << s3 << endl; + lyxerr << "Assuming answer is " + << (default_value ? "yes" : "no") + << endl + << "----------------------------------------" << endl; + return default_value; + } + fl_set_resource("flQuestion.yes.label", idex(_("Yes|Yy#y"))); fl_set_resource("flQuestion.no.label", idex(_("No|Nn#n"))); return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0); @@ -314,8 +330,28 @@ bool AskQuestion(string const & s1, string const & s2, string const & s3) // Returns 1 for yes, 2 for no, 3 for cancel. -int AskConfirmation(string const & s1, string const & s2, string const & s3) +int AskConfirmation(string const & s1, string const & s2, string const & s3, + int default_value) { + if (!lyxrc.use_gui) { + lyxerr << "----------------------------------------" << endl + << s1 << endl; + if (!s2.empty()) + lyxerr << s2 << endl; + if (!s3.empty()) + lyxerr << s3 << endl; + lyxerr << "Assuming answer is "; + if (default_value == 1) + lyxerr << "yes"; + else if (default_value == 2) + lyxerr << "no"; + else + lyxerr << "cancel"; + lyxerr << endl + << "----------------------------------------" << endl; + return default_value; + } + fl_set_choices_shortcut(scex(_("Yes|Yy#y")), scex(_("No|Nn#n")), scex(_("Cancel|^["))); @@ -330,6 +366,14 @@ int AskConfirmation(string const & s1, string const & s2, string const & s3) pair const askForText(string const & msg, string const & dflt) { + if (!lyxrc.use_gui) { + lyxerr << "----------------------------------------" << endl + << msg << endl + << "Assuming answer is " << dflt + << "----------------------------------------" << endl; + return make_pair(true, dflt); + } + 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"))); diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index 70dc71854c..89e4191b9f 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -59,11 +59,11 @@ void WriteFSAlert(string const & s1, string const & s2 = string()); /// Asks "Yes" or "No". Returns true for yes, false for no bool AskQuestion(string const & s1, string const & s2 = string(), - string const & s3 = string()); + string const & s3 = string(), bool default_value = true); /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel int AskConfirmation(string const & s1, string const & s2 = string(), - string const & s3 = string()); + string const & s3 = string(), int default_value = 1); /// returns a bool: false=cancelled, true=okay. string contains returned text std::pair const diff --git a/src/paragraph.C b/src/paragraph.C index 419c7e9145..ed9ed07038 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -51,7 +51,7 @@ int tex_code_break_column = 72; // needs non-zero initialization. set later. // this is a bad idea, but how can LyXParagraph find its buffer to get // parameters? (JMarc) extern BufferView * current_view; -extern string bibitemWidest(BufferView *); +extern string bibitemWidest(Buffer const *); // this is a minibuffer static char minibuffer_char; @@ -3227,7 +3227,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf, } else if (style.labeltype == LABEL_BIBLIO) { // ale970405 os << "\\begin{" << style.latexname() << "}{" - << bibitemWidest(current_view) + << bibitemWidest(buf) << "}\n"; } else if (style.latextype == LATEX_ITEM_ENVIRONMENT) { #ifdef FANCY_FOOTNOTE_CODE diff --git a/src/support/filetools.C b/src/support/filetools.C index 704de2db55..8f19df47a5 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -98,7 +98,7 @@ string const QuoteName(string const & name) { // CHECK Add proper emx support here! #ifndef __EMX__ - return '\'' + name + '\''; + return "\'" + name + "\'"; #else return name; #endif @@ -940,7 +940,7 @@ ChangeExtension(string const & oldname, string const & extension) string ext; // Make sure the extension starts with a dot if (!extension.empty() && extension[0] != '.') - ext= '.' + extension; + ext= "." + extension; else ext = extension; -- 2.39.2