From bcd818abe33ae0396e8be01714c1fbf6aa346486 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 1 Aug 2001 10:08:53 +0000 Subject: [PATCH] John's latest patch frenzy git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2397 a592a061-630c-0410-9148-cb99ea01b6c8 --- COPYING | 58 +++++------- ChangeLog | 8 ++ configure.in | 5 +- src/BufferView_pimpl.C | 2 +- src/ChangeLog | 11 +++ src/LyXSendto.C | 2 +- src/LyXView.C | 1 + src/buffer.C | 4 +- src/frontends/ChangeLog | 4 + src/frontends/Liason.C | 2 +- src/frontends/xforms/ChangeLog | 10 ++ src/frontends/xforms/FormMathsPanel.C | 15 +++ src/frontends/xforms/FormMathsPanel.h | 1 + src/frontends/xforms/FormRef.C | 6 +- src/frontends/xforms/form_maths_panel.C | 42 +++++---- src/frontends/xforms/form_maths_panel.h | 3 +- .../xforms/forms/form_maths_panel.fd | 91 +++++++++++-------- src/lyxfunc.C | 16 +++- src/support/ChangeLog | 5 + src/support/filetools.C | 27 +++--- src/support/filetools.h | 7 +- 21 files changed, 192 insertions(+), 128 deletions(-) diff --git a/COPYING b/COPYING index 2b853081d7..0fc5c89d1f 100644 --- a/COPYING +++ b/COPYING @@ -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. - -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 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. -1) LyX is quasi-GPL software. The terms of the GPL apply save where -they conflict with this statement. - -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. + 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. -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. + 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 + + 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. + + The GNU General Public License version 2 is included below for your reference. ------------------------------------------------------------------------ GNU GENERAL PUBLIC LICENSE diff --git a/ChangeLog b/ChangeLog index 6858d9efce..f7ea6112d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-07-31 John Levon + + * configure.in: don't use -lbz2 if we don't need it + +2001-07-30 John Levon + + * COPYING: use standard spiel for xforms + 2001-07-30 John Levon * configure.in: add --without-aiksaurus, always diff --git a/configure.in b/configure.in index 0823931ca4..1b93203b68 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 8eff02dd2c..634363041c 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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; } diff --git a/src/ChangeLog b/src/ChangeLog index 8def1ba3ee..5098fd7c69 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2001-08-01 John Levon + + * 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 * text.C (setHeightOfRow): fixed setting of ascent/descent based on diff --git a/src/LyXSendto.C b/src/LyXSendto.C index f0d71077eb..5f672ac07b 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -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); diff --git a/src/LyXView.C b/src/LyXView.C index 03550c4a1f..a0313ab7c6 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -234,6 +234,7 @@ void LyXView::updateWindowTitle() } if (title != last_title) { setWindowTitle(title); + last_title = title; } } diff --git a/src/buffer.C b/src/buffer.C index d3fe751c18..dbe54248bc 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -200,7 +200,7 @@ pair 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; } diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 9945f3c887..67954aac98 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2001-08-01 John Levon + + * Liason.C: IsDirWriteable changed + 2001-07-30 Jean-Marc Lasgouttes * Liason.C: #include LAssert.h diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C index f4d0082dfb..e54e8a9813 100644 --- a/src/frontends/Liason.C +++ b/src/frontends/Liason.C @@ -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); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index cebb0314df..b8d42ba24c 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,13 @@ +2001-08-01 John Levon + + * 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 * FormMathsBitmap.C: initialise form_ diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index ef7a55cb9c..2917964e26 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -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; iaddBitmap(28, 7, 4, greek_width, greek_height, greek_bits); 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); @@ -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(); diff --git a/src/frontends/xforms/FormMathsPanel.h b/src/frontends/xforms/FormMathsPanel.h index 8d9ac6f51c..4e5388aedf 100644 --- a/src/frontends/xforms/FormMathsPanel.h +++ b/src/frontends/xforms/FormMathsPanel.h @@ -90,6 +90,7 @@ private: boost::scoped_ptr brelats_; boost::scoped_ptr greek_; boost::scoped_ptr misc_; + boost::scoped_ptr dots_; boost::scoped_ptr varsize_; /// A pointer to the currently active subdialog diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 6c4fa3d442..dd18ac9234 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -67,7 +67,7 @@ void FormRef::update() InsetRef::getType(controller().params().getCmdName()) + 1); at_ref_ = false; - fl_set_object_label(dialog_->button_go, _("Goto reference")); + fl_set_object_label(dialog_->button_go, _("Go to reference")); // Name is irrelevant to LaTeX/Literate documents if (controller().docType() == ControlRef::LATEX || @@ -157,7 +157,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long) } else { controller().gotoBookmark(); fl_set_object_label(dialog_->button_go, - _("Goto reference")); + _("Go to reference")); } } else if (ob == dialog_->browser) { @@ -174,7 +174,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long) if (at_ref_) controller().gotoBookmark(); at_ref_ = false; - fl_set_object_label(dialog_->button_go, _("Goto reference")); + fl_set_object_label(dialog_->button_go, _("Go to reference")); setEnabled(dialog_->type, true); setEnabled(dialog_->button_go, true); diff --git a/src/frontends/xforms/form_maths_panel.C b/src/frontends/xforms/form_maths_panel.C index 154c08e970..29cfe4e123 100644 --- a/src/frontends/xforms/form_maths_panel.C +++ b/src/frontends/xforms/form_maths_panel.C @@ -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; diff --git a/src/frontends/xforms/form_maths_panel.h b/src/frontends/xforms/form_maths_panel.h index 1224ababa9..7d65ceefe5 100644 --- a/src/frontends/xforms/form_maths_panel.h +++ b/src/frontends/xforms/form_maths_panel.h @@ -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_ */ diff --git a/src/frontends/xforms/forms/form_maths_panel.fd b/src/frontends/xforms/forms/form_maths_panel.fd index e865337391..cec8e19b80 100644 --- a/src/frontends/xforms/forms/form_maths_panel.fd +++ b/src/frontends/xforms/forms/form_maths_panel.fd @@ -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 diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 8316df4b4f..4269908281 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -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,8 +1869,14 @@ 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; } diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 7c7ec802d0..db1f0053d7 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2001-08-01 John Levon + + * filetools.h: + * filetools.C (IsDirWriteable): fix this + 2001-07-26 Baruch Even * lyxlib.h (float_equal): Added function to compare floats almost equal diff --git a/src/support/filetools.C b/src/support/filetools.C index 69dab110f7..6ac637f7d2 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -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) { + lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl; + string const tmpfl(lyx::tempName(path, "lyxwritetest")); - // We must unlink the tmpfl. + + if (tmpfl.empty()) + return false; + lyx::unlink(tmpfl); - - 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; - } + return true; } diff --git a/src/support/filetools.h b/src/support/filetools.h index 7242c108f8..04d8b2deba 100644 --- a/src/support/filetools.h +++ b/src/support/filetools.h @@ -54,11 +54,10 @@ std::vector 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.