John's latest patch frenzy

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2397 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-08-01 10:08:53 +00:00
parent e0aa02ee9f
commit bcd818abe3
21 changed files with 192 additions and 128 deletions

54
COPYING
View File

@ -1,41 +1,27 @@
While LyX has been released nominally under the GPL in the past, it
has in fact never been truly GPL. Particularly, it has always been
linked to a closed source library. While some have taken a view that
such actions violate the GPL, this is a legal impossibility. The law
is quite clear that the release of the software by the original authors
and copyright holders changed the licenses.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Rather than leaving the issue to be debated, the following
clarifications are given. This is *not* a change of license, but a
clarification of the license that LyX has always used. All patches
submitted to LyX fall under this same license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1) LyX is quasi-GPL software. The terms of the GPL apply save where
they conflict with this statement.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2) There is no limitation on the license or nature of any software,
source, binary, library, or other, that may be linked to LyX, or to
which LyX may be linked. Particularly, the second full paragraph of
section 2, from 'These requirements apply to the modified work'
through 'who wrote it.' is rejected in its entirety.
In addition, as a special exception, the LyX Team gives permission to
link the code of this program with the XForms library (or with modified
versions of XForms that use the same license as XForms), and distribute
linked combinations including the two. You must obey the GNU General
Public License in all respects for all of the code used other than XForms.
If you modify this file, you may extend this exception to your version of
the file, but you are not obligated to do so. If you do not wish to do so,
delete this exception statement from your version.
3) There is no limitation on combining LyX source code with code
subject to any other license, provided that the LyX source remains
under this same license. Particularly, Section 3 of the GPL is
rejected in its entirety. To redistribute a modified version of LyX,
the entire source code of the modified LyX must be made available under
the terms of this license or such other licenses as apply to portions
of the original or modified code.
4) Any other clause or interpretation of the GPL limiting the
combination of other software of any type and LyX is rejected in its
entirety, provided that the LyX code and modifications to the LyX
source code remains under this same license, or such other licenses as
apply to portions of the original or modified code.
5) Nothing in this statement purports to alter or interpret the
license of any other software. Any combination of other software with
LyX must also meet the requirements of that software.
The GNU General Public License version 2 is included below for your reference.
------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE

View File

@ -1,3 +1,11 @@
2001-07-31 John Levon <moz@compsoc.man.ac.uk>
* configure.in: don't use -lbz2 if we don't need it
2001-07-30 John Levon <moz@compsoc.man.ac.uk>
* COPYING: use standard spiel for xforms
2001-07-30 John Levon <moz@compsoc.man.ac.uk>
* configure.in: add --without-aiksaurus, always

View File

@ -115,11 +115,10 @@ AC_ARG_WITH(aiksaurus,
[ --without-aiksaurus do not use the AikSaurus library],
[lyx_use_aiksaurus=$withval])
if test x$lyx_use_aiksaurus != xno; then
AC_CHECK_LIB(bz2, main)
AC_CHECK_LIB(AikSaurus, main,
[AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library])
AIKSAURUS_LIBS="-lAikSaurus"
])
AIKSAURUS_LIBS="-lAikSaurus -lbz2"
],,"-lbz2")
fi
AC_SUBST(AIKSAURUS_LIBS)

View File

@ -1389,7 +1389,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
if (available()) {
string const trypath = owner_->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
if (IsDirWriteable(trypath))
initpath = trypath;
}

View File

@ -1,3 +1,14 @@
2001-08-01 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.c: fail gracefully if file doesn't exist
* LyXSendto.C:
* buffer.C:
* lyxfunc.C:
* BufferView_pimpl.C: IsDirWriteable() proto changed
* LyXView.C: fix updateWindowTitle() to store the last title
2001-07-31 Juergen Vigna <jug@sad.it>
* text.C (setHeightOfRow): fixed setting of ascent/descent based on

View File

@ -81,7 +81,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
command += " &"; // execute in background
// push directorypath, if necessary
string path = OnlyPath(buffer->fileName());
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)){
if (lyxrc.use_tempdir || !IsDirWriteable(path)){
path = buffer->tmppath;
}
Path p(path);

View File

@ -234,6 +234,7 @@ void LyXView::updateWindowTitle()
}
if (title != last_title) {
setWindowTitle(title);
last_title = title;
}
}

View File

@ -200,7 +200,7 @@ pair<Buffer::LogType, string> const Buffer::getLogName(void) const
string path = OnlyPath(filename);
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1))
if (lyxrc.use_tempdir || !IsDirWriteable(path))
path = tmppath;
string const fname = AddName(path,
@ -3425,7 +3425,7 @@ int Buffer::runChktex()
string path = OnlyPath(filename);
string const org_path = path;
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = tmppath;
}

View File

@ -1,3 +1,7 @@
2001-08-01 John Levon <moz@compsoc.man.ac.uk>
* Liason.C: IsDirWriteable changed
2001-07-30 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* Liason.C: #include LAssert.h

View File

@ -107,7 +107,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
// Push directory path.
string path = OnlyPath(buffer->fileName());
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = buffer->tmppath;
}
Path p(path);

View File

@ -1,3 +1,13 @@
2001-08-01 John Levon <moz@compsoc.man.ac.uk>
* FormMathsPanel.C:
* FormMathsPanel.h:
* form_maths_panel.C:
* form_maths_panel.h:
* forms/form_maths_panel.fd: re-add dots bitmaps
* FormRef.C: "Goto" -> "Go to"
2001-07-29 John Levon <moz@compsoc.man.ac.uk>
* FormMathsBitmap.C: initialise form_

View File

@ -94,6 +94,13 @@ FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
}
misc_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_dots);
for (StringVec::size_type i = 0; i<latex.size(); ++i) {
latex[i] = latex_dots[i];
}
dots_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_varsz);
for (StringVec::size_type i = 0; i<latex.size(); ++i) {
latex[i] = latex_varsz[i];
@ -155,6 +162,8 @@ void FormMathsPanel::build()
misc_->addBitmap(29, 5, 6, misc_width, misc_height, misc_bits);
dots_->addBitmap(4, 4, 1, dots_width, dots_height, dots_bits);
varsize_->addBitmap(14, 3, 5, varsz_width, varsz_height, varsz_bits);
bc().setCancel(dialog_->button_close);
@ -195,6 +204,12 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
misc_->show();
break;
case MM_DOTS:
if (active_ && active_ != dots_.get())
active_->hide();
dots_->show();
break;
case MM_VARSIZE:
if (active_ && active_ != varsize_.get())
active_->hide();

View File

@ -90,6 +90,7 @@ private:
boost::scoped_ptr<FormMathsBitmap> brelats_;
boost::scoped_ptr<FormMathsBitmap> greek_;
boost::scoped_ptr<FormMathsBitmap> misc_;
boost::scoped_ptr<FormMathsBitmap> dots_;
boost::scoped_ptr<FormMathsBitmap> varsize_;
/// A pointer to the currently active subdialog

View File

@ -22,62 +22,66 @@ FD_form_maths_panel * FormMathsPanel::build_maths_panel()
FL_OBJECT *obj;
FD_form_maths_panel *fdui = new FD_form_maths_panel;
fdui->form = fl_bgn_form(FL_NO_BOX, 290, 172);
fdui->form = fl_bgn_form(FL_NO_BOX, 274, 226);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 290, 172, "");
fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 80, 14, 80, 30, _("Close "));
obj = fl_add_box(FL_UP_BOX, 0, 0, 274, 226, "");
fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 100, 180, 80, 30, _("Close "));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0);
fdui->browser_funcs = obj = fl_add_browser(FL_SELECT_BROWSER, 180, 40, 94, 110, _("Functions"));
fdui->browser_funcs = obj = fl_add_browser(FL_SELECT_BROWSER, 170, 30, 90, 140, _("Functions"));
fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_FUNC);
fl_set_browser_hscrollbar(obj, FL_OFF);
fdui->button_greek = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 90, 50, 30, _("Greek"));
fdui->button_greek = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 80, 50, 30, _("Greek"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_GREEK);
fdui->button_arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 120, 50, 30, _("­ Û"));
fdui->button_arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 110, 50, 30, _("­ Û"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_ARROW);
fdui->button_boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 90, 50, 30, _("± ´"));
fdui->button_boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 110, 50, 30, _("± ´"));
fl_set_object_lsize(obj, 0);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_BOP);
fdui->button_brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 50, 30, _("£ @"));
fdui->button_brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 110, 50, 30, _("£ @"));
fl_set_object_lsize(obj, 0);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_BRELATS);
fdui->button_varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 120, 50, 30, _("S ò"));
fl_set_object_lsize(obj, 0);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_VARSIZE);
fdui->button_misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 120, 50, 30, _("Misc"));
fdui->button_misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 140, 50, 30, _("Misc"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_MISC);
fdui->button_equation = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 50, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_EQU);
fdui->button_sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 15, 30, 30, "");
fdui->button_sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 20, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SQRT);
fdui->button_frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 15, 30, 30, "");
fdui->button_frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 20, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_lcolor(obj, FL_COL1);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_FRAC);
fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, "");
fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 20, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DELIM);
fdui->button_matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 50, 30, 30, "");
fdui->button_matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_MATRIX);
fdui->button_deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 50, 30, 30, "");
fdui->button_deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 20, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DECO);
fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 50, 30, 30, "");
fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 20, 30, 30, "");
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SPACE);
fdui->button_dots = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 140, 50, 30, _("Dots"));
fl_set_object_lsize(obj, 0);
fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DOTS);
fdui->button_varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 140, 50, 30, _("S ò"));
fl_set_object_lsize(obj, 0);
fl_set_object_lstyle(obj, 15);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_VARSIZE);
fl_end_form();
fdui->form->fdui = fdui;

View File

@ -20,7 +20,6 @@ struct FD_form_maths_panel {
FL_OBJECT *button_arrow;
FL_OBJECT *button_boperator;
FL_OBJECT *button_brelats;
FL_OBJECT *button_varsize;
FL_OBJECT *button_misc;
FL_OBJECT *button_equation;
FL_OBJECT *button_sqrt;
@ -29,6 +28,8 @@ struct FD_form_maths_panel {
FL_OBJECT *button_matrix;
FL_OBJECT *button_deco;
FL_OBJECT *button_space;
FL_OBJECT *button_dots;
FL_OBJECT *button_varsize;
};
#endif /* FD_form_maths_panel_h_ */

View File

@ -5,18 +5,17 @@ Internal Form Definition File
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
SnapGrid: 2
=============== FORM ===============
Name: form_maths_panel
Width: 290
Height: 172
Number of Objects: 16
Width: 274
Height: 226
Number of Objects: 17
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 290 172
box: 0 0 274 226
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -34,7 +33,7 @@ argument:
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 80 14 80 30
box: 100 180 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -47,12 +46,12 @@ resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_close
callback: C_FormBaseDeprecatedCancelCB
argument:
argument: 0
--------------------
class: FL_BROWSER
type: SELECT_BROWSER
box: 180 40 94 110
box: 170 30 90 140
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP
@ -71,7 +70,7 @@ argument: MM_FUNC
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 90 50 30
box: 60 80 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -89,7 +88,7 @@ argument: MM_GREEK
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 120 50 30
box: 110 110 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -107,7 +106,7 @@ argument: MM_ARROW
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 60 90 50 30
box: 10 110 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -125,7 +124,7 @@ argument: MM_BOP
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 110 90 50 30
box: 60 110 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -143,25 +142,7 @@ argument: MM_BRELATS
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 60 120 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: 15
size: 0
lcol: FL_BLACK
label: S ò
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_varsize
callback: C_FormBaseDeprecatedInputCB
argument: MM_VARSIZE
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 110 120 50 30
box: 110 140 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -197,7 +178,7 @@ argument: MM_EQU
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 10 15 30 30
box: 10 20 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -215,7 +196,7 @@ argument: MM_SQRT
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 40 15 30 30
box: 40 20 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -233,7 +214,7 @@ argument: MM_FRAC
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 10 50 30 30
box: 70 20 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -251,7 +232,7 @@ argument: MM_DELIM
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 100 50 30 30
box: 10 50 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -269,7 +250,7 @@ argument: MM_MATRIX
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 40 50 30 30
box: 100 20 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -287,7 +268,7 @@ argument: MM_DECO
--------------------
class: FL_PIXMAPBUTTON
type: NORMAL_BUTTON
box: 70 50 30 30
box: 130 20 30 30
boxtype: FL_UP_BOX
colors: FL_MCOL FL_BLUE
alignment: FL_ALIGN_BOTTOM
@ -302,5 +283,41 @@ name: button_space
callback: C_FormBaseDeprecatedInputCB
argument: MM_SPACE
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 60 140 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_TIMESITALIC_STYLE
size: 0
lcol: FL_BLACK
label: Dots
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_dots
callback: C_FormBaseDeprecatedInputCB
argument: MM_DOTS
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 140 50 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: 15
size: 0
lcol: FL_BLACK
label: S ò
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_varsize
callback: C_FormBaseDeprecatedInputCB
argument: MM_VARSIZE
==============================
create_the_forms

View File

@ -805,7 +805,7 @@ string const LyXFunc::dispatch(int ac,
if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled) {
lyxerr << "LyXFunc::Dispatch: "
<< lyxaction.getActionName(ac)
<< " [" << ac << "] is disabled ad this location"
<< " [" << ac << "] is disabled at this location"
<< endl;
goto exit_with_message;
}
@ -1710,7 +1710,7 @@ void LyXFunc::menuNew(bool fromTemplate)
if (owner->view()->available()) {
string const trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
if (IsDirWriteable(trypath))
initpath = trypath;
}
@ -1836,7 +1836,7 @@ void LyXFunc::open(string const & fname)
if (owner->view()->available()) {
string const trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
if (IsDirWriteable(trypath))
initpath = trypath;
}
@ -1869,7 +1869,13 @@ void LyXFunc::open(string const & fname)
// get absolute path of file and add ".lyx" to the filename if
// necessary
filename = FileSearch(string(), filename, "lyx");
string const fullpath = FileSearch(string(), filename, "lyx");
if (fullpath.empty()) {
WriteAlert(_("Error"), _("Could not find file"), filename);
return;
}
filename = fullpath;
// loads document
string const disp_fn(MakeDisplayPath(filename));
@ -1907,7 +1913,7 @@ void LyXFunc::doImport(string const & argument)
if (owner->view()->available()) {
string const trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
if (IsDirWriteable(trypath))
initpath = trypath;
}

View File

@ -1,3 +1,8 @@
2001-08-01 John Levon <moz@compsoc.man.ac.uk>
* filetools.h:
* filetools.C (IsDirWriteable): fix this
2001-07-26 Baruch Even <baruch@lyx.org>
* lyxlib.h (float_equal): Added function to compare floats almost equal

View File

@ -134,6 +134,8 @@ bool IsFileReadable (string const & path)
int IsFileWriteable (string const & path)
{
FileInfo fi(path);
//lyxerr << "fi : " << fi << endl;
//lyxerr << "fi.exists" << fi.exist() << endl;
if (fi.access(FileInfo::wperm|FileInfo::rperm)) // read-write
return 1;
if (fi.readable()) // read-only
@ -142,24 +144,19 @@ int IsFileWriteable (string const & path)
}
//returns 1: dir writeable
// 0: not writeable
// -1: error- couldn't find out
int IsDirWriteable (string const & path)
//returns true: dir writeable
// false: not writeable
bool IsDirWriteable (string const & path)
{
string const tmpfl(lyx::tempName(path, "lyxwritetest"));
// We must unlink the tmpfl.
lyx::unlink(tmpfl);
lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
if (tmpfl.empty()) {
WriteFSAlert(_("LyX Internal Error!"),
_("Could not test if directory is writeable"));
return -1;
} else {
FileInfo fi(path);
if (fi.writable()) return 1;
return 0;
}
string const tmpfl(lyx::tempName(path, "lyxwritetest"));
if (tmpfl.empty())
return false;
lyx::unlink(tmpfl);
return true;
}

View File

@ -54,11 +54,10 @@ std::vector<string> const DirList(string const & dir,
/** Is directory read only?
returns
1: dir writeable
0: not writeable
-1: error- couldn't find out, or unsure
true: dir writeable
false: not writeable
*/
int IsDirWriteable (string const & path);
bool IsDirWriteable (string const & path);
/** Is a file readable ?
Returns true if the file `path' is readable.