+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
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);
}
#include "ControlGraphics.h"
#include "ControlInset.tmpl"
#include "buffer.h"
+#include "BufferView.h"
#include "Dialogs.h"
#include "LyXView.h"
#include "gettext.h"
#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;
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);
}
}
-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);
}
/// 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();
#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"
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);
}
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.
// 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);
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));
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();
}
#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 "lyxlex.h"
#include "lyxrc.h"
+#include "LColor.h"
+#include "Lsstream.h"
+
#include "combox.h"
-#include "debug.h"
-#include "lyxlex.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"
#include "graphics/GraphicsCache.h"
+#include <utility>
+#include <iomanip>
+#include <X11/Xlib.h>
+
using std::endl;
using std::pair;
using std::make_pair;
// 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()) {
#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 "support/lstrings.h"
-/*
-#include "LyXView.h"
-#include "Dialogs.h"
-#include "Liason.h"
-#include "debug.h"
-#include "BufferView.h"
-*/
-
-//using Liason::printBuffer;
-//using Liason::getPrinterParams;
using std::make_pair;
typedef FormCB<ControlPrint, FormDB<FD_form_print> > base_class;
+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
#include "lyxfind.h"
#include "frontends/Alert.h"
+#include "frontends/Dialogs.h"
#include "support/textutils.h"
#include "support/LAssert.h"
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();
}