small changes and two patches from Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1077 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-10-03 18:38:10 +00:00
parent 7bab35423b
commit 1fefef3908
18 changed files with 124 additions and 38 deletions

View File

@ -1,3 +1,33 @@
2000-10-03 Lars Gullik Bjønnes <larsbj@lyx.org>
* 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 <dekelts@tau.ac.il>
* src/exporter.C (IsExportable): Fixed
* lib/configure.m4: Small fix
2000-10-03 Dekel Tsur <dekelts@tau.ac.il>
* 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 <jug@sad.it>
* src/BufferView2.C (theLockingInset): removed const because of

View File

@ -1,3 +1,5 @@
DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
ETAGS_ARGS = --lang=c++
EXTRADIST = boost libs

7
lib/configure vendored
View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -103,6 +103,7 @@ public:
int workWidth() const;
///
UpdatableInset * theLockingInset() const;
///
void theLockingInset(UpdatableInset * inset);
///
void updateInset(Inset * inset, bool mark_dirty);

View File

@ -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

View File

@ -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) +

View File

@ -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<pair<string, string> > const v = GetExportableFormats(buffer);
for (vector<pair<string, string> >::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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -53,7 +53,7 @@ string const InsetCitation::getScreenLabel() const
if (!getOptions().empty())
label += ", " + getOptions();
return '[' + label + ']';
return "[" + label + "]";
}

View File

@ -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);

View File

@ -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<bool, string> const
askForText(string const & msg, string const & dflt)
{
if (!lyxrc.use_gui) {
lyxerr << "----------------------------------------" << endl
<< msg << endl
<< "Assuming answer is " << dflt
<< "----------------------------------------" << endl;
return make_pair<bool, string>(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")));

View File

@ -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<bool, string> const

View File

@ -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

View File

@ -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;