mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* Use JMarc's browseRelFiles rather than browseFiles.
* Prevent activation of Ok,Apply in graphics dialog when file is not found * Partial fix for bug 229. Still need to emit updateParagraph when leaving an inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e4b8d67f26
commit
b97138d0e8
@ -1,3 +1,11 @@
|
||||
2002-03-22 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ControlBibtex.C (Browse):
|
||||
* ControlGraphics.C (Browse):
|
||||
* ControlPrint.C (Browse): use Jean-Marc's browseRelFile.
|
||||
|
||||
* ControlGraphics.[Ch]: replace checkFilename with isFilenameValid.
|
||||
|
||||
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* most files: ws cleanup
|
||||
|
@ -66,5 +66,6 @@ string const ControlBibtex::Browse(string const & in_name,
|
||||
string const & pattern)
|
||||
{
|
||||
pair<string, string> dir1(N_("Documents|#o#O"), string(lyxrc.document_path));
|
||||
return browseFile(&lv_, in_name, title, pattern, dir1);
|
||||
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
|
||||
title, pattern, dir1);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "ControlGraphics.h"
|
||||
#include "ControlInset.tmpl"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "gettext.h"
|
||||
@ -33,11 +34,9 @@
|
||||
#include "insets/insetgraphicsParams.h" // need operator!=()
|
||||
|
||||
#include "support/FileInfo.h" // for FileInfo
|
||||
#include "helper_funcs.h" // for browseFile
|
||||
#include "helper_funcs.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/filetools.h" // for AddName, zippedFile
|
||||
#include "frontends/Alert.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
@ -98,7 +97,8 @@ string const ControlGraphics::Browse(string const & in_name)
|
||||
pair<string, string> dir1(N_("Clipart|#C#c"), clipdir);
|
||||
pair<string, string> dir2(N_("Documents|#o#O"), string(lyxrc.document_path));
|
||||
// Show the file browser dialog
|
||||
return browseFile(&lv_, in_name, title, pattern, dir1, dir2);
|
||||
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
|
||||
title, pattern, dir1, dir2);
|
||||
}
|
||||
|
||||
|
||||
@ -135,10 +135,9 @@ string const ControlGraphics::readBB(string const & file)
|
||||
}
|
||||
|
||||
|
||||
void ControlGraphics::checkFilename(string const & fname) {
|
||||
if (!IsFileReadable(fname))
|
||||
Alert::alert(_("Warning!"),
|
||||
_("Filename") + ' '
|
||||
+ fname + _(" does not exist!"));
|
||||
|
||||
bool ControlGraphics::isFilenameValid(string const & fname) const
|
||||
{
|
||||
// It may be that the filename is relative.
|
||||
string const name = MakeAbsPath(fname, lv_.buffer()->filePath());
|
||||
return IsFileReadable(name);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
/// Control the bb
|
||||
bool bbChanged;
|
||||
/// test if file exist
|
||||
void checkFilename(string const & fname);
|
||||
bool isFilenameValid(string const & fname) const;
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
|
@ -24,10 +24,9 @@
|
||||
#include "buffer.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxrc.h"
|
||||
#include "PrinterParams.h"
|
||||
#include "Liason.h"
|
||||
#include "helper_funcs.h" // browseFile
|
||||
#include "helper_funcs.h"
|
||||
#include "frontends/Alert.h"
|
||||
#include "gettext.h"
|
||||
#include "BufferView.h"
|
||||
@ -91,5 +90,6 @@ string const ControlPrint::Browse(string const & in_name)
|
||||
string const pattern = "*.ps";
|
||||
|
||||
// Show the file browser dialog
|
||||
return browseFile(&lv_, in_name, title, pattern);
|
||||
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
|
||||
title, pattern);
|
||||
}
|
||||
|
@ -1,5 +1,13 @@
|
||||
2002-03-22 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormGraphics.C (input): don't activate the Ok, Apply buttons if the
|
||||
file can't be found.
|
||||
|
||||
* FormParagraph.C (changedParagraph): activate the Ok, Apply buttons
|
||||
only if the underlying paragraph will accept changes.
|
||||
|
||||
* FormPreferences.C (browse): use Jean-Marc's browseRelFile.
|
||||
|
||||
* xforms_helper.C (updateWidgetsFromLength): fix crash when trying to
|
||||
set the choice to a unit that isn't present in the choice!
|
||||
Also remove #if 0 sections of code.
|
||||
|
@ -199,7 +199,6 @@ void FormGraphics::apply()
|
||||
|
||||
// the file section
|
||||
igp.filename = getStringFromInput(file_->input_filename);
|
||||
controller().checkFilename(igp.filename);
|
||||
igp.subcaption = fl_get_button(file_->check_subcaption);
|
||||
igp.subcaptionText = getStringFromInput(file_->input_subcaption);
|
||||
igp.rotate = fl_get_button(file_->check_rotate);
|
||||
@ -484,6 +483,14 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
if (out_name != in_name && !out_name.empty()) {
|
||||
fl_set_input(file_->input_filename, out_name.c_str());
|
||||
}
|
||||
if (!controller().isFilenameValid(out_name))
|
||||
return ButtonPolicy::SMI_INVALID;
|
||||
|
||||
} else if (ob == file_->input_filename) {
|
||||
string name = getStringFromInput(file_->input_filename);
|
||||
if (!controller().isFilenameValid(name))
|
||||
return ButtonPolicy::SMI_INVALID;
|
||||
|
||||
} else if (ob == file_->check_subcaption) {
|
||||
setEnabled(file_->input_subcaption,
|
||||
fl_get_button(file_->check_subcaption));
|
||||
|
@ -80,15 +80,17 @@ void FormParagraph::changedParagraph()
|
||||
if (p == 0 || p == par_)
|
||||
return;
|
||||
|
||||
// OBS FIX LOOK HERE
|
||||
// For now, don't bother checking if the params are different.
|
||||
|
||||
// shouldn't we chage the par_ pointer too?
|
||||
// anyway for me the below function does just nothing!
|
||||
// (Jug 20020108)
|
||||
// Will the underlying paragraph accept our changes?
|
||||
Inset * const inset = p->inInset();
|
||||
bool const accept = !(inset && inset->forceDefaultParagraphs(inset));
|
||||
bc().valid(accept);
|
||||
|
||||
if (!accept) {
|
||||
postWarning(_("Cannot apply paragraph settings to this inset!"));
|
||||
}
|
||||
|
||||
// For now don't bother checking if the params are different,
|
||||
// just activate the Apply button
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,35 +8,31 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <utility>
|
||||
#include <iomanip>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "Color.h"
|
||||
#include "LColor.h"
|
||||
#include "Lsstream.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "form_preferences.h"
|
||||
#include "ButtonController.tmpl"
|
||||
#include "input_validators.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "converter.h"
|
||||
#include "debug.h"
|
||||
#include "LyXView.h"
|
||||
#include "language.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "combox.h"
|
||||
#include "debug.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LColor.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "combox.h"
|
||||
#include "Color.h"
|
||||
#include "input_validators.h"
|
||||
#include "xforms_helpers.h"
|
||||
#include "helper_funcs.h"
|
||||
#include "converter.h"
|
||||
|
||||
#include "support/lyxfunctional.h"
|
||||
#include "support/lyxmanip.h"
|
||||
@ -45,6 +41,10 @@
|
||||
|
||||
#include "graphics/GraphicsCache.h"
|
||||
|
||||
#include <utility>
|
||||
#include <iomanip>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
@ -2999,7 +2999,8 @@ void FormPreferences::browse(FL_OBJECT * inpt,
|
||||
|
||||
// Show the file browser dialog
|
||||
string const new_filename =
|
||||
browseFile(lv_, filename, title, pattern, dir1, dir2);
|
||||
browseRelFile(lv_, filename, lv_->buffer()->filePath(),
|
||||
title, pattern, dir1, dir2);
|
||||
|
||||
// Save the filename to the dialog
|
||||
if (new_filename != filename && !new_filename.empty()) {
|
||||
|
@ -17,25 +17,16 @@
|
||||
#include "ControlPrint.h"
|
||||
#include "FormPrint.h"
|
||||
#include "form_print.h"
|
||||
#include "input_validators.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "lyxrc.h" // needed by PrinterParams
|
||||
#include "LyXView.h"
|
||||
|
||||
#include "PrinterParams.h"
|
||||
|
||||
#include "LyXView.h"
|
||||
#include "xforms_helpers.h" // for browseFile
|
||||
#include "input_validators.h"
|
||||
#include "xforms_helpers.h"
|
||||
|
||||
/*
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "Liason.h"
|
||||
#include "debug.h"
|
||||
#include "BufferView.h"
|
||||
*/
|
||||
#include "support/lstrings.h"
|
||||
|
||||
//using Liason::printBuffer;
|
||||
//using Liason::getPrinterParams;
|
||||
using std::make_pair;
|
||||
|
||||
typedef FormCB<ControlPrint, FormDB<FD_form_print> > base_class;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-03-22 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* insettext.C (edit): emit an updateParagraph signal on entering a text
|
||||
inset. Needs to be emitted when leaving the inset also.
|
||||
|
||||
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* all files: ws cleanup
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "lyxfind.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
|
||||
#include "support/textutils.h"
|
||||
#include "support/LAssert.h"
|
||||
@ -684,6 +685,9 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
if (drawFrame_ == LOCKED)
|
||||
code = CURSOR|DRAW_FRAME;
|
||||
updateLocal(bv, code, false);
|
||||
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->owner()->getDialogs()->updateParagraph();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user