mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
forminclude patch from herbert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3428 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
804493f2c4
commit
d6dd467219
@ -9,7 +9,6 @@ src/converter.C
|
||||
src/CutAndPaste.C
|
||||
src/debug.C
|
||||
src/exporter.C
|
||||
src/ext_l10n.h
|
||||
src/figure_form.C
|
||||
src/figureForm.C
|
||||
src/FontLoader.C
|
||||
@ -64,6 +63,7 @@ src/frontends/qt2/QRef.C
|
||||
src/frontends/qt2/QSearch.C
|
||||
src/frontends/qt2/QSpellchecker.C
|
||||
src/frontends/qt2/QTabularCreate.C
|
||||
src/frontends/qt2/QTexinfo.C
|
||||
src/frontends/qt2/QThesaurus.C
|
||||
src/frontends/qt2/QToc.C
|
||||
src/frontends/qt2/QURL.C
|
||||
|
@ -1,5 +1,8 @@
|
||||
2002-01-20 Herbert Voss <voss@perce.de>
|
||||
|
||||
* ControlInclude.[Ch]: better control of unexistings files
|
||||
when entered without the browser
|
||||
|
||||
* ControlGraphic.C (Browse): add extension "ps" when browsing for
|
||||
a filename
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlInset.tmpl"
|
||||
#include "buffer.h"
|
||||
#include "Alert.h"
|
||||
#include "BufferView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
@ -80,3 +81,15 @@ void ControlInclude::load(string const & file)
|
||||
{
|
||||
lv_.getLyXFunc()->dispatch(LFUN_CHILDOPEN, file);
|
||||
}
|
||||
|
||||
|
||||
bool const ControlInclude::fileExists(string const & file)
|
||||
{
|
||||
string const fileWithAbsPath = MakeAbsPath(file, OnlyPath(params().masterFilename_));
|
||||
if (IsFileReadable(fileWithAbsPath))
|
||||
return true;
|
||||
else
|
||||
Alert::alert(_("File doesn't exists!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,9 @@ public:
|
||||
/// load a file
|
||||
void load(string const & file);
|
||||
|
||||
/// test if file exist
|
||||
bool const fileExists(string const & file);
|
||||
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-01-20 Herbert Voss <voss@perce.de>
|
||||
|
||||
* FormInclude.[C]: better control of unexistings files
|
||||
when entered without the browser
|
||||
|
||||
2002-01-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* Toolbar_pimpl.C (update): disable layout combox when LFUN_LAYOUT
|
||||
|
@ -90,8 +90,11 @@ void FormInclude::apply()
|
||||
{
|
||||
controller().params().noload = fl_get_button(dialog_->check_typeset);
|
||||
|
||||
controller().params().cparams.
|
||||
setContents(fl_get_input(dialog_->input_filename));
|
||||
string const file = fl_get_input(dialog_->input_filename);
|
||||
if (controller().fileExists(file))
|
||||
controller().params().cparams.setContents(file);
|
||||
else
|
||||
controller().params().cparams.setContents("");
|
||||
|
||||
if (fl_get_button(dialog_->check_useinput))
|
||||
controller().params().flag = InsetInclude::INPUT;
|
||||
@ -127,8 +130,9 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long)
|
||||
|
||||
} else if (ob == dialog_->button_load) {
|
||||
string const in_name = fl_get_input(dialog_->input_filename);
|
||||
if (!strip(in_name).empty()) {
|
||||
ApplyButton();
|
||||
if (!strip(in_name).empty() && controller().fileExists(in_name)) {
|
||||
// ApplyButton();
|
||||
OKButton();
|
||||
controller().load(strip(in_name));
|
||||
action = ButtonPolicy::SMI_NOOP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user