various fixes from John, Martin and Kayvan, plus one of mine. Read ChangeLogs

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3299 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-01-07 10:17:44 +00:00
parent 53cea4fb83
commit 61ccd8b8b5
18 changed files with 619 additions and 425 deletions

View File

@ -1,3 +1,8 @@
2002-01-05 Kayvan A. Sylvan <kayvan@sylvan.com>
* examples/noweb2lyx.lyx: Updated for lyx-1.2.0. Also got rid of
a harmless noweb error.
2002-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2002-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ui/default.ui: added dots "..." to insert->include file. * ui/default.ui: added dots "..." to insert->include file.

File diff suppressed because it is too large Load Diff

View File

@ -910,6 +910,8 @@ Inset * BufferView::Pimpl::checkInset(LyXText const & text, LyXCursor const & cu
Box b(insetDimensions(text, cursor)); Box b(insetDimensions(text, cursor));
if (!b.contained(x, y)) { if (!b.contained(x, y)) {
lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y
<< " box " << b << endl;
return 0; return 0;
} }

View File

@ -1,3 +1,19 @@
2002-01-06 John Levon <moz@compsoc.man.ac.uk>
* box.h: make signed dimensions to allow insets wider than
the screen (bug #162)
* BufferView_pimpl.C: add some insetHit debug
2002-01-05 John Levon <moz@compsoc.man.ac.uk>
* vc-backend.C: add FIXME
2002-01-03 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* lyxfunc.C (getStatus): enable code for showing math font status
in toolbar/menu.
2002-01-07 Juergen Vigna <jug@sad.it> 2002-01-07 Juergen Vigna <jug@sad.it>
* text.C (nextBreakPoint): removed debug output not needed anymore. * text.C (nextBreakPoint): removed debug output not needed anymore.
@ -20,24 +36,21 @@
* lyxfunc.C (dispatch): add a finishUndo() in LFUN_ESCAPE. * lyxfunc.C (dispatch): add a finishUndo() in LFUN_ESCAPE.
2002-01-03 Martin Vermeer <martin.vermeer@hut.fi> 2002-01-03 Martin Vermeer <martin.vermeer@hut.fi>
* FormMathsPanel.C: * FormMathsPanel.C:
* FormMathsPanel.h * FormMathsPanel.h
* MathsSymbols.C: * MathsSymbols.C:
* form_maths_panel.C: * form_maths_panel.C:
* form_maths_panel.h: * form_maths_panel.h:
* form_maths_panel.fd: * form_maths_panel.fd: implemented sub- and super- buttons in math
implemented sub- and super- buttons in math panel. panel.
* lyx_main.C: * lyx_main.C: Revised hardwired bindings to allow original _ and ^
Revised hardwired bindings to allow original _ and ^ (or ^ space) (or ^ space) to be used as in TeX (req'd by André).
to be used as in TeX (req'd byAndré).
* lyxfunc.C:
Allow ^and _ again to be used both as super/subscript (mathed)
and as themselves (in text).
* lyxfunc.C: Allow ^ and _ again to be used both as
super/subscript (mathed) and as themselves (in text).
2002-01-03 Allan Rae <rae@lyx.org> 2002-01-03 Allan Rae <rae@lyx.org>
@ -47,7 +60,7 @@
* XFormsView.C (setWindowTitle): also set icon title. * XFormsView.C (setWindowTitle): also set icon title.
* LyXView.h: (setWindowTitle): signature changed. * LyXView.h (setWindowTitle): signature changed.
* XFormsView.h (setWindowTitle): ditto. * XFormsView.h (setWindowTitle): ditto.
2002-01-02 Juergen Vigna <jug@sad.it> 2002-01-02 Juergen Vigna <jug@sad.it>

View File

@ -14,15 +14,17 @@
* It is expected that the box be constructed in * It is expected that the box be constructed in
* normalised form, that is to say : x1,y1 is top-left, * normalised form, that is to say : x1,y1 is top-left,
* x2,y2 is bottom-right. * x2,y2 is bottom-right.
*
* Negative values are allowed.
*/ */
struct Box { struct Box {
unsigned int x1; int x1;
unsigned int x2; int x2;
unsigned int y1; int y1;
unsigned int y2; int y2;
Box(unsigned int x1_, unsigned int x2_, Box(int x1_, int x2_,
unsigned int y1_, unsigned int y2_) : int y1_, int y2_) :
x1(x1_), x2(x2_), y1(y1_), y2(y2_) {} x1(x1_), x2(x2_), y1(y1_), y2(y2_) {}
/** /**
@ -30,10 +32,18 @@ struct Box {
* the box. Check is exclusive (point on a border * the box. Check is exclusive (point on a border
* returns false). * returns false).
*/ */
bool contained(unsigned int x, unsigned int y) { bool contained(int x, int y) {
return (x1 < x && x2 > x && return (x1 < x && x2 > x &&
y1 < y && y2 > y); y1 < y && y2 > y);
} }
}; };
inline std::ostream & operator<<(std::ostream & o, Box & b)
{
return o << "x1,y1: " << b.x1 << "," << b.y1
<< " x2,y2: " << b.x2 << "," << b.y2 << std::endl;
}
#endif // BOX_H #endif // BOX_H

View File

@ -1,3 +1,9 @@
2002-01-05 John Levon <moz@compsoc.man.ac.uk>
* FormFiledialog.C: add FIXME
* xforms_helpers.C: fix use of FileInfo
2002-01-07 John Levon <moz@compsoc.man.ac.uk> 2002-01-07 John Levon <moz@compsoc.man.ac.uk>
* FormTabular.h: * FormTabular.h:

View File

@ -24,8 +24,6 @@
#include "helper_funcs.h" #include "helper_funcs.h"
using std::vector; using std::vector;
using std::back_inserter;
using std::transform;
using namespace character; using namespace character;
typedef FormCB<ControlCharacter, FormDB<FD_form_character> > base_class; typedef FormCB<ControlCharacter, FormDB<FD_form_character> > base_class;

View File

@ -241,7 +241,6 @@ void FileDialog::Private::Reread()
iDepth = 0; iDepth = 0;
string line, Temp; string line, Temp;
char szMode[15]; char szMode[15];
FileInfo fileInfo;
string File = pszDirectory; string File = pszDirectory;
if (File != "/") { if (File != "/") {
File = split(File, Temp, '/'); File = split(File, Temp, '/');
@ -276,7 +275,8 @@ void FileDialog::Private::Reread()
// gets file status // gets file status
File = AddName(pszDirectory, fname); File = AddName(pszDirectory, fname);
fileInfo.newFile(File, true); // FIXME: we don't get this file exists/stattable
FileInfo fileInfo(File, true);
fileInfo.modeString(szMode); fileInfo.modeString(szMode);
unsigned int nlink = fileInfo.getNumberOfLinks(); unsigned int nlink = fileInfo.getNumberOfLinks();
string user = lyxUserCache.find(fileInfo.getUid()); string user = lyxUserCache.find(fileInfo.getUid());

View File

@ -400,7 +400,7 @@ bool RWInfo::WriteableDir(string const & name)
} }
FileInfo const tp(name); FileInfo const tp(name);
if (!tp.isDir()) { if (!tp.isOK() || !tp.isDir()) {
error_message = N_("Directory does not exist."); error_message = N_("Directory does not exist.");
return false; return false;
} }
@ -424,7 +424,7 @@ bool RWInfo::ReadableDir(string const & name)
} }
FileInfo const tp(name); FileInfo const tp(name);
if (!tp.isDir()) { if (!tp.isOK() || !tp.isDir()) {
error_message = N_("Directory does not exist."); error_message = N_("Directory does not exist.");
return false; return false;
} }
@ -459,7 +459,10 @@ bool RWInfo::WriteableFile(string const & name)
} }
FileInfo d(name); FileInfo d(name);
if (!d.isDir()) {
// FIXME: what is this supposed to do ?
// .newFile doesn't do what you think it does ...
if (!d.isOK() || !d.isDir()) {
d.newFile(dir); d.newFile(dir);
} }
@ -474,12 +477,12 @@ bool RWInfo::WriteableFile(string const & name)
} }
FileInfo f(name); FileInfo f(name);
if (dir == name || f.isDir()) { if (dir == name || (f.isOK() && f.isDir())) {
error_message = N_("A file is required, not a directory."); error_message = N_("A file is required, not a directory.");
return false; return false;
} }
if (f.exist() && !f.writable()) { if (f.isOK() && f.exist() && !f.writable()) {
error_message = N_("Cannot write to this file."); error_message = N_("Cannot write to this file.");
return false; return false;
} }
@ -504,7 +507,8 @@ bool RWInfo::ReadableFile(string const & name)
} }
FileInfo d(name); FileInfo d(name);
if (!d.isDir()) { // FIXME: what is this supposed to do ?
if (!d.isOK() && !d.isDir()) {
d.newFile(dir); d.newFile(dir);
} }
@ -519,7 +523,7 @@ bool RWInfo::ReadableFile(string const & name)
} }
FileInfo f(name); FileInfo f(name);
if (dir == name || f.isDir()) { if (dir == name || (f.isOK() && f.isDir())) {
error_message = N_("A file is required, not a directory."); error_message = N_("A file is required, not a directory.");
return false; return false;
} }

View File

@ -1,3 +1,11 @@
2002-01-07 Martin Vermeer <martin.vermeer@hut.fi>
* insettext.C: fix bug illustrated by attachment #37 of bug #59
2002-01-05 John Levon <moz@compsoc.man.ac.uk>
* insetinclude.C: fix use of FileInfo
2002-01-07 Juergen Vigna <jug@sad.it> 2002-01-07 Juergen Vigna <jug@sad.it>
* insettabular.C (draw): fixed clearing of cell around inset. * insettabular.C (draw): fixed clearing of cell around inset.

View File

@ -218,7 +218,7 @@ bool InsetInclude::loadIfNeeded() const
// the readonly flag can/will be wrong, not anymore I think. // the readonly flag can/will be wrong, not anymore I think.
FileInfo finfo(getFileName()); FileInfo finfo(getFileName());
bool const ro = !finfo.writable(); bool const ro = !(!finfo.isOK() || finfo.writable());
return bufferlist.readFile(getFileName(), ro) != 0; return bufferlist.readFile(getFileName(), ro) != 0;
} }

View File

@ -394,7 +394,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
if (!cleared && (top_x == int(x)) if (!cleared && (top_x == int(x))
&& ((need_update&(INIT|FULL)) || (top_baseline != baseline) && ((need_update&(INIT|FULL)) || (top_baseline != baseline)
||(last_drawn_width != insetWidth))) { ||(last_drawn_width != insetWidth))) {
clearInset(bv, baseline, cleared); // Condition necessary to eliminate bug 59 attachment 37
if (baseline > 0) clearInset(bv, baseline, cleared);
} }
top_x = int(x); top_x = int(x);

View File

@ -723,7 +723,6 @@ func_status::value_type LyXFunc::getStatus(int ac,
break; break;
} }
} }
#if 0
else { else {
MathTextCodes tc = mathcursor->getLastCode(); MathTextCodes tc = mathcursor->getLastCode();
switch (action) { switch (action) {
@ -752,7 +751,6 @@ func_status::value_type LyXFunc::getStatus(int ac,
break; break;
} }
} }
#endif
return flag; return flag;
} }

View File

@ -1,3 +1,10 @@
2002-01-05 John Levon <moz@compsoc.man.ac.uk>
* filetools.C: fix use of FileInfo
* FileInfo.h:
* FileInfo.C: add Asserts and documentation
2001-12-20 Kayvan A. Sylvan <kayvan@sylvan.com> 2001-12-20 Kayvan A. Sylvan <kayvan@sylvan.com>
* os_win32.C: compilation fixes * os_win32.C: compilation fixes

View File

@ -19,6 +19,7 @@
#include <cerrno> #include <cerrno>
#include "FileInfo.h" #include "FileInfo.h"
#include "LAssert.h"
#if !S_IRUSR #if !S_IRUSR
# if S_IREAD # if S_IREAD
@ -174,6 +175,8 @@ FileInfo & FileInfo::newFile(int fildes)
// should not be in FileInfo // should not be in FileInfo
char const * FileInfo::typeIndicator() const char const * FileInfo::typeIndicator() const
{ {
lyx::Assert(isOK());
if (S_ISDIR(buf.st_mode)) return ("/"); if (S_ISDIR(buf.st_mode)) return ("/");
#ifdef S_ISLNK #ifdef S_ISLNK
if (S_ISLNK(buf.st_mode)) return ("@"); if (S_ISLNK(buf.st_mode)) return ("@");
@ -192,6 +195,8 @@ char const * FileInfo::typeIndicator() const
mode_t FileInfo::getMode() const mode_t FileInfo::getMode() const
{ {
lyx::Assert(isOK());
return buf.st_mode; return buf.st_mode;
} }
@ -211,6 +216,8 @@ void FileInfo::modeString(char * szString) const
// should not be in FileInfo // should not be in FileInfo
char FileInfo::typeLetter() const char FileInfo::typeLetter() const
{ {
lyx::Assert(isOK());
#ifdef S_ISBLK #ifdef S_ISBLK
if (S_ISBLK(buf.st_mode)) return 'b'; if (S_ISBLK(buf.st_mode)) return 'b';
#endif #endif
@ -248,6 +255,8 @@ void FileInfo::flagRWX(mode_t i, char * szString) const
// should not be in FileInfo // should not be in FileInfo
void FileInfo::setSticky(char * szString) const void FileInfo::setSticky(char * szString) const
{ {
lyx::Assert(isOK());
#ifdef S_ISUID #ifdef S_ISUID
if (buf.st_mode & S_ISUID) { if (buf.st_mode & S_ISUID) {
if (szString[3] != 'x') szString[3] = 'S'; if (szString[3] != 'x') szString[3] = 'S';
@ -271,42 +280,49 @@ void FileInfo::setSticky(char * szString) const
time_t FileInfo::getModificationTime() const time_t FileInfo::getModificationTime() const
{ {
lyx::Assert(isOK());
return buf.st_mtime; return buf.st_mtime;
} }
time_t FileInfo::getAccessTime() const time_t FileInfo::getAccessTime() const
{ {
lyx::Assert(isOK());
return buf.st_atime; return buf.st_atime;
} }
time_t FileInfo::getStatusChangeTime() const time_t FileInfo::getStatusChangeTime() const
{ {
lyx::Assert(isOK());
return buf.st_ctime; return buf.st_ctime;
} }
nlink_t FileInfo::getNumberOfLinks() const nlink_t FileInfo::getNumberOfLinks() const
{ {
lyx::Assert(isOK());
return buf.st_nlink; return buf.st_nlink;
} }
uid_t FileInfo::getUid() const uid_t FileInfo::getUid() const
{ {
lyx::Assert(isOK());
return buf.st_uid; return buf.st_uid;
} }
gid_t FileInfo::getGid() const gid_t FileInfo::getGid() const
{ {
lyx::Assert(isOK());
return buf.st_gid; return buf.st_gid;
} }
off_t FileInfo::getSize() const off_t FileInfo::getSize() const
{ {
lyx::Assert(isOK());
return buf.st_size; return buf.st_size;
} }
@ -328,42 +344,49 @@ bool FileInfo::isOK() const
bool FileInfo::isLink() const bool FileInfo::isLink() const
{ {
lyx::Assert(isOK());
return S_ISLNK(buf.st_mode); return S_ISLNK(buf.st_mode);
} }
bool FileInfo::isRegular() const bool FileInfo::isRegular() const
{ {
lyx::Assert(isOK());
return S_ISREG(buf.st_mode); return S_ISREG(buf.st_mode);
} }
bool FileInfo::isDir() const bool FileInfo::isDir() const
{ {
lyx::Assert(isOK());
return S_ISDIR(buf.st_mode); return S_ISDIR(buf.st_mode);
} }
bool FileInfo::isChar() const bool FileInfo::isChar() const
{ {
lyx::Assert(isOK());
return S_ISCHR(buf.st_mode); return S_ISCHR(buf.st_mode);
} }
bool FileInfo::isBlock() const bool FileInfo::isBlock() const
{ {
lyx::Assert(isOK());
return S_ISBLK(buf.st_mode); return S_ISBLK(buf.st_mode);
} }
bool FileInfo::isFifo() const bool FileInfo::isFifo() const
{ {
lyx::Assert(isOK());
return S_ISFIFO(buf.st_mode); return S_ISFIFO(buf.st_mode);
} }
bool FileInfo::isSocket() const bool FileInfo::isSocket() const
{ {
lyx::Assert(isOK());
#ifdef S_ISSOCK #ifdef S_ISSOCK
return S_ISSOCK(buf.st_mode); return S_ISSOCK(buf.st_mode);
#else #else
@ -386,6 +409,3 @@ bool FileInfo::access(int p) const
return false; return false;
} }
} }

View File

@ -30,6 +30,9 @@
#endif #endif
/** Use objects of this class to get information about files. /** Use objects of this class to get information about files.
*
* Users must make sure to check fi.isOK() before any operations
* requiring the file to exist such as fi.isDir()
*/ */
class FileInfo : boost::noncopyable { class FileInfo : boost::noncopyable {
public: public:

View File

@ -435,7 +435,8 @@ int DeleteAllFilesInDir (string const & path)
<< endl; << endl;
bool deleted = true; bool deleted = true;
if (FileInfo(unlinkpath).isDir()) FileInfo fi(unlinkpath);
if (fi.isOK() && fi.isDir())
deleted = (DeleteAllFilesInDir(unlinkpath) == 0); deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
deleted &= (lyx::unlink(unlinkpath) == 0); deleted &= (lyx::unlink(unlinkpath) == 0);
if (!deleted) { if (!deleted) {

View File

@ -254,6 +254,7 @@ void CVS::scanMaster()
//sm[4]; // options //sm[4]; // options
//sm[5]; // tag or tagdate //sm[5]; // tag or tagdate
FileInfo fi(file_); FileInfo fi(file_);
// FIXME: must double check file is stattable/existing
time_t mod = fi.getModificationTime(); time_t mod = fi.getModificationTime();
string mod_date = strip(asctime(gmtime(&mod)), '\n'); string mod_date = strip(asctime(gmtime(&mod)), '\n');
lyxerr[Debug::LYXVC] lyxerr[Debug::LYXVC]