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>
* 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));
if (!b.contained(x, y)) {
lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y
<< " box " << b << endl;
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>
* text.C (nextBreakPoint): removed debug output not needed anymore.
@ -27,17 +43,14 @@
* MathsSymbols.C:
* form_maths_panel.C:
* form_maths_panel.h:
* form_maths_panel.fd:
implemented sub- and super- buttons in math panel.
* form_maths_panel.fd: implemented sub- and super- buttons in math
panel.
* lyx_main.C:
Revised hardwired bindings to allow original _ and ^ (or ^ space)
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).
* lyx_main.C: Revised hardwired bindings to allow original _ and ^
(or ^ space) to be used as in TeX (req'd by André).
* 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>
@ -47,7 +60,7 @@
* XFormsView.C (setWindowTitle): also set icon title.
* LyXView.h: (setWindowTitle): signature changed.
* LyXView.h (setWindowTitle): signature changed.
* XFormsView.h (setWindowTitle): ditto.
2002-01-02 Juergen Vigna <jug@sad.it>

View File

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

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>
* FormTabular.h:

View File

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

View File

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

View File

@ -400,7 +400,7 @@ bool RWInfo::WriteableDir(string const & name)
}
FileInfo const tp(name);
if (!tp.isDir()) {
if (!tp.isOK() || !tp.isDir()) {
error_message = N_("Directory does not exist.");
return false;
}
@ -424,7 +424,7 @@ bool RWInfo::ReadableDir(string const & name)
}
FileInfo const tp(name);
if (!tp.isDir()) {
if (!tp.isOK() || !tp.isDir()) {
error_message = N_("Directory does not exist.");
return false;
}
@ -459,7 +459,10 @@ bool RWInfo::WriteableFile(string const & 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);
}
@ -474,12 +477,12 @@ bool RWInfo::WriteableFile(string const & 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.");
return false;
}
if (f.exist() && !f.writable()) {
if (f.isOK() && f.exist() && !f.writable()) {
error_message = N_("Cannot write to this file.");
return false;
}
@ -504,7 +507,8 @@ bool RWInfo::ReadableFile(string const & name)
}
FileInfo d(name);
if (!d.isDir()) {
// FIXME: what is this supposed to do ?
if (!d.isOK() && !d.isDir()) {
d.newFile(dir);
}
@ -519,7 +523,7 @@ bool RWInfo::ReadableFile(string const & 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.");
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>
* 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.
FileInfo finfo(getFileName());
bool const ro = !finfo.writable();
bool const ro = !(!finfo.isOK() || finfo.writable());
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))
&& ((need_update&(INIT|FULL)) || (top_baseline != baseline)
||(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);

View File

@ -723,7 +723,6 @@ func_status::value_type LyXFunc::getStatus(int ac,
break;
}
}
#if 0
else {
MathTextCodes tc = mathcursor->getLastCode();
switch (action) {
@ -752,7 +751,6 @@ func_status::value_type LyXFunc::getStatus(int ac,
break;
}
}
#endif
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>
* os_win32.C: compilation fixes

View File

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

View File

@ -30,6 +30,9 @@
#endif
/** 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 {
public:

View File

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

View File

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