mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
bibfile parsing and insetgraphics fixes from Herbert; FormToc fix from John; compile fix from Kayvan
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3704 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4fff141501
commit
6bfec9b307
@ -71,10 +71,10 @@ src/frontends/qt2/QURL.C
|
||||
src/frontends/qt2/QVCLog.C
|
||||
src/frontends/xforms/Alert_pimpl.C
|
||||
src/frontends/xforms/combox.C
|
||||
src/frontends/xforms/FeedbackController.C
|
||||
src/frontends/xforms/FileDialog.C
|
||||
src/frontends/xforms/form_aboutlyx.C
|
||||
src/frontends/xforms/FormAboutlyx.C
|
||||
src/frontends/xforms/FormBase.C
|
||||
src/frontends/xforms/form_bibitem.C
|
||||
src/frontends/xforms/FormBibitem.C
|
||||
src/frontends/xforms/form_bibtex.C
|
||||
@ -191,7 +191,6 @@ src/lyxfont.C
|
||||
src/lyxfunc.C
|
||||
src/lyx_main.C
|
||||
src/lyxrc.C
|
||||
src/LyXSendto.C
|
||||
src/lyxtextclasslist.C
|
||||
src/lyxvc.C
|
||||
src/LyXView.C
|
||||
|
@ -1,3 +1,13 @@
|
||||
2002-03-10 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* biblio.C (parseBibTeX): fix bug
|
||||
(familyName): improve parsing
|
||||
|
||||
2002-03-09 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* ControlGraphics.[Ch]: adding checkFilename() for testing
|
||||
of non-existing files
|
||||
|
||||
2002-03-07 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* ControlSendto.C (allFormats): fix a iterators are not pointers
|
||||
@ -9,7 +19,8 @@
|
||||
|
||||
2002-03-05 Herbert Voss <voss@lyx.org>
|
||||
|
||||
biblio.C: (getInfo) simplify if using paragraph layout "bibliography".
|
||||
* biblio.C (getInfo): simplify if using paragraph layout
|
||||
"bibliography".
|
||||
|
||||
2002-03-05 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "helper_funcs.h" // for browseFile
|
||||
#include "support/lstrings.h"
|
||||
#include "support/filetools.h" // for AddName, zippedFile
|
||||
#include "frontends/Alert.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
using std::pair;
|
||||
@ -132,3 +133,10 @@ string const ControlGraphics::readBB(string const & file)
|
||||
}
|
||||
|
||||
|
||||
void ControlGraphics::checkFilename(string const & fname) {
|
||||
if (!IsFileReadable(fname))
|
||||
Alert::alert(_("Warning!"),
|
||||
_("Filename") + ' '
|
||||
+ fname + _(" does not exist!"));
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
string const readBB(string const & file);
|
||||
/// Control the bb
|
||||
bool bbChanged;
|
||||
|
||||
/// test if file exist
|
||||
void checkFilename(string const & fname);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
|
@ -146,10 +146,18 @@ string const familyName(string const & name)
|
||||
// Very simple parser
|
||||
string fname = name;
|
||||
|
||||
string::size_type idx = fname.rfind(".");
|
||||
// possible authorname combinations are:
|
||||
// "Surname, FirstName"
|
||||
// "Surname, F."
|
||||
// "FirstName Surname"
|
||||
// "F. Surname"
|
||||
string::size_type idx = fname.find(",");
|
||||
if (idx != string::npos)
|
||||
return frontStrip(fname.substr(0,idx));
|
||||
idx = fname.rfind(".");
|
||||
if (idx != string::npos)
|
||||
fname = frontStrip(fname.substr(idx+1));
|
||||
|
||||
|
||||
return fname;
|
||||
}
|
||||
|
||||
@ -212,10 +220,6 @@ string const getYear(InfoMap const & map, string const & key)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// A functor for use with std::sort, leading to case insensitive sorting
|
||||
struct compareNoCase: public std::binary_function<string, string, bool>
|
||||
{
|
||||
@ -339,8 +343,8 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
string::size_type const idx =
|
||||
dummy.empty() ? string::npos : dummy.find('%');
|
||||
if (idx != string::npos) {
|
||||
// ignore lines with a beginning '%'
|
||||
if (idx > 0) {
|
||||
// This is safe. data MUST contain a '%'
|
||||
data_ += dummy.substr(0,data.find('%'));
|
||||
}
|
||||
} else {
|
||||
@ -379,12 +383,12 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
data = strip(data, '}');// maybe there is a main closing '}'
|
||||
// happens, when last keyword
|
||||
string::size_type const idx =
|
||||
data.empty() ? data.find('=') : string::npos;
|
||||
!data.empty() ? data.find('=') : string::npos;
|
||||
|
||||
if (idx == string::npos)
|
||||
return string();
|
||||
|
||||
data = data.substr(idx, data.length() - 1);
|
||||
data = data.substr(idx);
|
||||
data = frontStrip(strip(data));
|
||||
|
||||
if (data.length() < 2 || data[0] != '=') { // a valid entry?
|
||||
@ -403,16 +407,16 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
} else {
|
||||
return data; // no {} and no "", pure data
|
||||
}
|
||||
string tmp = data.substr(keypos, data.length()-1);
|
||||
string tmp = data.substr(keypos);
|
||||
while (tmp.find('{') != string::npos &&
|
||||
tmp.find('}') != string::npos &&
|
||||
tmp.find('{') < tmp.find('}') &&
|
||||
tmp.find('{') < tmp.find(enclosing)) {
|
||||
|
||||
keypos += tmp.find('{') + 1;
|
||||
tmp = data.substr(keypos, data.length() - 1);
|
||||
tmp = data.substr(keypos);
|
||||
keypos += tmp.find('}') + 1;
|
||||
tmp = data.substr(keypos, data.length() - 1);
|
||||
tmp = data.substr(keypos);
|
||||
}
|
||||
if (tmp.find(enclosing) == string::npos)
|
||||
return data;
|
||||
|
@ -1,3 +1,11 @@
|
||||
2002-03-09 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* FormGraphics.C: test if file exists, simplify an if command
|
||||
|
||||
2002-03-10 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* FormToc.C: make goto not reset the dialog
|
||||
|
||||
2002-03-08 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FeedbackController.[Ch]: new files, providing a standard interface to
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "input_validators.h"
|
||||
#include "debug.h" // for lyxerr
|
||||
#include "support/lstrings.h" // for strToDbl & tostr
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h" // for MakeAbsPath etc
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "lyxrc.h" // for lyxrc.display_graphics
|
||||
@ -43,7 +42,7 @@ int const WIDTH_MAXDIGITS = 10;
|
||||
int const HEIGHT_MAXDIGITS = 10;
|
||||
int const ROTATE_MAXCHARS = 4;
|
||||
int const FILENAME_MAXCHARS = 1024;
|
||||
string defaultUnit = "cm";
|
||||
string defaultUnit("cm");
|
||||
|
||||
} // namespace anon
|
||||
|
||||
@ -164,6 +163,9 @@ void FormGraphics::build()
|
||||
fl_addto_tabfolder(dialog_->tabFolder, _("LaTeX Size"), size_->form);
|
||||
fl_addto_tabfolder(dialog_->tabFolder, _("Bounding Box"), bbox_->form);
|
||||
fl_addto_tabfolder(dialog_->tabFolder, _("Extras"), special_->form);
|
||||
// set the right default unit
|
||||
if (lyxrc.default_papersize < 3)
|
||||
defaultUnit = "in";
|
||||
}
|
||||
|
||||
|
||||
@ -174,6 +176,7 @@ 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);
|
||||
@ -266,8 +269,6 @@ void FormGraphics::apply()
|
||||
|
||||
|
||||
void FormGraphics::update() {
|
||||
if (lyxrc.default_papersize < 3)
|
||||
defaultUnit = string("in");
|
||||
// Update dialog with details from inset
|
||||
InsetGraphicsParams & igp = controller().params();
|
||||
|
||||
@ -281,7 +282,7 @@ void FormGraphics::update() {
|
||||
fl_set_input(file_->input_rotate_angle,
|
||||
tostr(igp.rotateAngle).c_str());
|
||||
if (igp.rotateOrigin.empty())
|
||||
fl_set_choice(file_->choice_origin,0);
|
||||
fl_set_choice(file_->choice_origin,1);
|
||||
else
|
||||
fl_set_choice_text(file_->choice_origin,igp.rotateOrigin.c_str());
|
||||
setEnabled(file_->input_rotate_angle,
|
||||
@ -310,9 +311,9 @@ void FormGraphics::update() {
|
||||
break;
|
||||
}
|
||||
updateWidgetsFromLength(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth, igp.lyxwidth,defaultUnit);
|
||||
lyxview_->choice_width_lyxwidth, igp.lyxwidth, defaultUnit);
|
||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight, igp.lyxheight,defaultUnit);
|
||||
lyxview_->choice_width_lyxheight, igp.lyxheight, defaultUnit);
|
||||
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
||||
switch (igp.lyxsize_type) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||
@ -347,9 +348,9 @@ void FormGraphics::update() {
|
||||
// the size section
|
||||
// Update the draft and clip mode
|
||||
updateWidgetsFromLength(size_->input_width,
|
||||
size_->choice_width_units,igp.width,defaultUnit);
|
||||
size_->choice_width_units, igp.width, defaultUnit);
|
||||
updateWidgetsFromLength(size_->input_height,
|
||||
size_->choice_height_units,igp.height,defaultUnit);
|
||||
size_->choice_height_units, igp.height, defaultUnit);
|
||||
fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
|
||||
switch (igp.size_type) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||
@ -483,13 +484,10 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
} else if (ob == lyxview_->button_latex_values) {
|
||||
if (fl_get_choice(size_->choice_width_units) > 3
|
||||
&& fl_get_choice(size_->choice_width_units) < 8
|
||||
|| fl_get_choice(size_->choice_height_units) > 3
|
||||
&& fl_get_choice(size_->choice_height_units) < 8)
|
||||
Alert::alert(_("Warning!"),
|
||||
_("The units t%, p%, c% and l% are not allowed here."),
|
||||
_("Cannot use the values from LaTeX size!"));
|
||||
if (contains(fl_get_choice_text(size_->choice_width_units),'%'))
|
||||
Alert::alert(_("Warning!"),
|
||||
_("The units t%, p%, c% and l% are not allowed here."),
|
||||
_("Cannot use the values from LaTeX size!"));
|
||||
else {
|
||||
LyXLength dummy = LyXLength(getLengthFromWidgets(size_->input_width,
|
||||
size_->choice_width_units));
|
||||
|
@ -60,18 +60,21 @@ void FormToc::update()
|
||||
|
||||
ButtonPolicy::SMInput FormToc::input(FL_OBJECT * ob, long)
|
||||
{
|
||||
if (ob == dialog_->browser_toc) {
|
||||
unsigned int const choice = fl_get_browser(dialog_->browser_toc);
|
||||
|
||||
if (choice - 1 < toclist_.size() && choice >= 1) {
|
||||
controller().Goto(toclist_[choice - 1].par->id());
|
||||
}
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
if (ob != dialog_->choice_toc_type) {
|
||||
updateType();
|
||||
}
|
||||
|
||||
updateContents();
|
||||
|
||||
unsigned int const choice = fl_get_browser(dialog_->browser_toc);
|
||||
|
||||
if (choice - 1 < toclist_.size() && choice >= 1) {
|
||||
controller().Goto(toclist_[choice - 1].par->id());
|
||||
}
|
||||
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-03-11 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* lyxsum.C: compilation fix
|
||||
|
||||
2002-03-02 Herbert Voss <voss@perce.de>
|
||||
|
||||
* filetools.C: fix bug for xbm format and added some more debug
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "support/lyxlib.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
// Various implementations of lyx::sum(), depending on what methods
|
||||
// are available. Order is faster to slowest.
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
|
||||
@ -31,7 +33,6 @@
|
||||
#include <sys/mman.h>
|
||||
|
||||
using std::ifstream;
|
||||
using std::endl;
|
||||
using std::for_each;
|
||||
using std::istreambuf_iterator;
|
||||
using std::istream_iterator;
|
||||
@ -89,6 +90,9 @@ unsigned long do_crc(InputIterator first, InputIterator last)
|
||||
} // namespace
|
||||
|
||||
#if HAVE_DECL_ISTREAMBUF_ITERATOR
|
||||
using std::ifstream;
|
||||
using std::istreambuf_iterator;
|
||||
|
||||
unsigned long lyx::sum(string const & file)
|
||||
{
|
||||
lyxerr[Debug::FILES] << "lyx::sum() using istreambuf_iterator (fast)"
|
||||
|
Loading…
Reference in New Issue
Block a user