mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
finally apply DepTable patch; simplify file browsing in ControlExternal
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3398 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a61a18e2a0
commit
36aa4ee109
@ -1,3 +1,7 @@
|
|||||||
|
2002-01-16 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
|
* examples/fr_EtiquetteMath.lyx: removed
|
||||||
|
|
||||||
2002-01-16 José Matos <jamatos@fep.up.pt>
|
2002-01-16 José Matos <jamatos@fep.up.pt>
|
||||||
|
|
||||||
* layouts/db_stdlayouts.inc: Fix name for caption.
|
* layouts/db_stdlayouts.inc: Fix name for caption.
|
||||||
|
@ -1,162 +0,0 @@
|
|||||||
#LyX 1.1 created this file. For more info see http://www.lyx.org/
|
|
||||||
\lyxformat 218
|
|
||||||
\textclass article
|
|
||||||
\language frenchb
|
|
||||||
\inputencoding latin1
|
|
||||||
\fontscheme default
|
|
||||||
\graphics none
|
|
||||||
\paperfontsize 10
|
|
||||||
\spacing single
|
|
||||||
\papersize a4paper
|
|
||||||
\paperpackage a4
|
|
||||||
\use_geometry 0
|
|
||||||
\use_amsmath 0
|
|
||||||
\paperorientation portrait
|
|
||||||
\secnumdepth 3
|
|
||||||
\tocdepth 3
|
|
||||||
\paragraph_separation indent
|
|
||||||
\defskip medskip
|
|
||||||
\quotes_language french
|
|
||||||
\quotes_times 2
|
|
||||||
\papercolumns 1
|
|
||||||
\papersides 1
|
|
||||||
\paperpagestyle plain
|
|
||||||
|
|
||||||
\layout Title
|
|
||||||
|
|
||||||
Numéroter et Étiqueter des équations
|
|
||||||
\begin_inset Info
|
|
||||||
Informations de révision :
|
|
||||||
Traduction : Mise à jour Date: 2001/02/16
|
|
||||||
Original : Révision: 1.3, Date: 2000/11/03
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Author
|
|
||||||
|
|
||||||
Alejandro Aguilar-Sierra
|
|
||||||
\begin_float footnote
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Traduction par Adrien
|
|
||||||
\noun on
|
|
||||||
Rebollo
|
|
||||||
\noun default
|
|
||||||
|
|
||||||
\family typewriter
|
|
||||||
<Adrien.Rebollo@wanadoo.fr>
|
|
||||||
\family default
|
|
||||||
.
|
|
||||||
\end_float
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Une équation simple peut être numérotée de deux façons.
|
|
||||||
La première est d'invoquer la commande LyX
|
|
||||||
\family typewriter
|
|
||||||
math-number
|
|
||||||
\family default
|
|
||||||
.
|
|
||||||
Le numéro correspondant
|
|
||||||
\begin_float footnote
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Ou un symbole # parce que la vraie numérotation n'est pas encore implémentée.
|
|
||||||
\end_float
|
|
||||||
apparaîtra à droite après l'équation.
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Formula \begin{equation}
|
|
||||||
x=y^{2}-3
|
|
||||||
\end{equation}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Fréquemment on se référera au numéro de l'équation dans le document.
|
|
||||||
Il est plus sûr d'assigner une étiquette à l'équation
|
|
||||||
\begin_float footnote
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
On procède de la même façon que pour une étiquette dans le corps du texte,
|
|
||||||
mais à partir du mode mathématique.
|
|
||||||
\end_float
|
|
||||||
, plutôt que d'utiliser un numéro fixé.
|
|
||||||
Assigner une étiquette à une équation non numérotée la numérotera automatiqueme
|
|
||||||
nt.
|
|
||||||
Avec l'étiquette
|
|
||||||
\series bold
|
|
||||||
planck
|
|
||||||
\series default
|
|
||||||
on peut se référer à l'équation (
|
|
||||||
\begin_inset LatexCommand \ref{planck}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
).
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Formula \begin{equation}
|
|
||||||
\label{planck}
|
|
||||||
E=hv
|
|
||||||
\end{equation}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Dans le cas d'équations sur plusieurs lignes, chaque ligne est numérotée
|
|
||||||
séquentiellement.
|
|
||||||
Il est possible de supprimer le numéro d'une ligne donnée avec la commande
|
|
||||||
|
|
||||||
\family typewriter
|
|
||||||
math-nonumber
|
|
||||||
\family default
|
|
||||||
.
|
|
||||||
Le curseur doit être sur la rangée dont vous voulez ôter la numérotation.
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Formula \begin{eqnarray}
|
|
||||||
(x+y)(x-y) & = & x^{2}-xy+xy-y^{2}\nonumber \\
|
|
||||||
& = & x^{2}-y^{2}
|
|
||||||
\end{eqnarray}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Il est possible d'étiqueter plus d'une ligne.
|
|
||||||
Avec l'équation multi-lignes suivante on peut se référer aux équations
|
|
||||||
(
|
|
||||||
\begin_inset LatexCommand \ref{eq:gs1}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
) et (
|
|
||||||
\begin_inset LatexCommand \ref{eq:gs2}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
) en utilisant les étiquettes correspondantes.
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Formula \begin{eqnarray}
|
|
||||||
v_{k+1} & = & w_{k}+b_{1}\label{eq:gs1} \\
|
|
||||||
w_{k+1} & = & v_{k+1}+b_{2}\label{eq:gs2}
|
|
||||||
\end{eqnarray}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
Pour voir le résultat final veuillez utiliser une visionneuse ou imprimer
|
|
||||||
ce document.
|
|
||||||
\the_end
|
|
@ -9,7 +9,6 @@ src/converter.C
|
|||||||
src/CutAndPaste.C
|
src/CutAndPaste.C
|
||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
src/ext_l10n.h
|
|
||||||
src/figure_form.C
|
src/figure_form.C
|
||||||
src/figureForm.C
|
src/figureForm.C
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2001-12-12 Ben Stanley <bds02@uow.edu.au>
|
||||||
|
|
||||||
|
* DepTable.h
|
||||||
|
* DepTable.C: Implement mtime checking to reduce time spent doing
|
||||||
|
CRCs.
|
||||||
|
|
||||||
2002-01-16 Juergen Vigna <jug@sad.it>
|
2002-01-16 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* tabular.C (GetAdditionalHeight): one of error fixed.
|
* tabular.C (GetAdditionalHeight): one of error fixed.
|
||||||
|
178
src/DepTable.C
178
src/DepTable.C
@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* This file is Copyright 1996-2001
|
* This file is Copyright 1996-2001
|
||||||
* Lars Gullik Bjønnes
|
* Lars Gullik Bjønnes
|
||||||
|
* Ben Stanley
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*/
|
*/
|
||||||
@ -35,69 +36,78 @@ using std::ofstream;
|
|||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
inline bool DepTable::dep_info::changed() const
|
||||||
|
{
|
||||||
|
return crc_prev != crc_cur && crc_cur != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void DepTable::insert(string const & fi,
|
void DepTable::insert(string const & fi,
|
||||||
bool upd,
|
bool upd)
|
||||||
unsigned long one,
|
|
||||||
unsigned long two)
|
|
||||||
{
|
{
|
||||||
// not quite sure if this is the correct place for MakeAbsPath
|
// not quite sure if this is the correct place for MakeAbsPath
|
||||||
string f = MakeAbsPath(fi);
|
string f = MakeAbsPath(fi);
|
||||||
if (deplist.find(f) == deplist.end()) {
|
if (deplist.find(f) == deplist.end()) {
|
||||||
long mtime = 0;
|
dep_info di;
|
||||||
|
di.crc_prev = 0;
|
||||||
if (upd) {
|
if (upd) {
|
||||||
one = two;
|
lyxerr[Debug::DEPEND] << " CRC..." << flush;
|
||||||
two = lyx::sum(f);
|
di.crc_cur = lyx::sum(f);
|
||||||
|
lyxerr[Debug::DEPEND] << "done." << endl;
|
||||||
struct stat f_info;
|
struct stat f_info;
|
||||||
stat(fi.c_str(), &f_info);
|
stat(fi.c_str(), &f_info);
|
||||||
mtime = f_info.st_mtime;
|
di.mtime_cur = f_info.st_mtime;
|
||||||
|
} else {
|
||||||
|
di.crc_cur = 0;
|
||||||
|
di.mtime_cur = 0;
|
||||||
}
|
}
|
||||||
dep_info di;
|
|
||||||
di.first = one;
|
|
||||||
di.second = two;
|
|
||||||
di.mtime = mtime;
|
|
||||||
#if 0
|
|
||||||
deplist[f] = make_pair(one, two);
|
|
||||||
#else
|
|
||||||
deplist[f] = di;
|
deplist[f] = di;
|
||||||
#endif
|
} else {
|
||||||
|
lyxerr[Debug::DEPEND] << " Already in DepTable" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DepTable::update()
|
void DepTable::update()
|
||||||
{
|
{
|
||||||
for (DepList::iterator itr = deplist.begin();
|
lyxerr[Debug::DEPEND] << "Updating DepTable..." << endl;
|
||||||
itr != deplist.end();
|
time_t start_time = time(0);
|
||||||
++itr) {
|
|
||||||
unsigned long const one = itr->second.second;
|
|
||||||
unsigned long two = one;
|
|
||||||
long mtime = itr->second.mtime;
|
|
||||||
struct stat f_info;
|
|
||||||
stat(itr->first.c_str(), &f_info);
|
|
||||||
|
|
||||||
if (mtime != f_info.st_mtime) {
|
DepList::iterator itr = deplist.begin();
|
||||||
two = lyx::sum(itr->first);
|
while (itr != deplist.end()) {
|
||||||
mtime = f_info.st_mtime;
|
dep_info &di = itr->second;
|
||||||
|
|
||||||
|
struct stat f_info;
|
||||||
|
if (0 == stat(itr->first.c_str(), &f_info) ) {
|
||||||
|
if (di.mtime_cur == f_info.st_mtime) {
|
||||||
|
di.crc_prev = di.crc_cur;
|
||||||
|
lyxerr[Debug::DEPEND] << itr->first << " same mtime";
|
||||||
|
} else {
|
||||||
|
di.crc_prev = di.crc_cur;
|
||||||
|
lyxerr[Debug::DEPEND] << itr->first << " CRC... ";
|
||||||
|
di.crc_cur = lyx::sum(itr->first);
|
||||||
|
lyxerr[Debug::DEPEND] << "done";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// file doesn't exist
|
||||||
|
// remove stale files - if it's re-created, it
|
||||||
|
// will be re-inserted by deplog.
|
||||||
|
lyxerr[Debug::DEPEND] << itr->first
|
||||||
|
<< " doesn't exist. removing from DepTable." << endl;
|
||||||
|
DepList::iterator doomed = itr++;
|
||||||
|
deplist.erase(doomed);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
itr->second = make_pair(one, two);
|
|
||||||
#else
|
|
||||||
dep_info di;
|
|
||||||
di.first = one;
|
|
||||||
di.second = two;
|
|
||||||
di.mtime = mtime;
|
|
||||||
|
|
||||||
itr->second = di;
|
|
||||||
#endif
|
|
||||||
if (lyxerr.debugging(Debug::DEPEND)) {
|
if (lyxerr.debugging(Debug::DEPEND)) {
|
||||||
lyxerr << "Update dep: " << itr->first << " "
|
if (di.changed())
|
||||||
<< one << " " << two;
|
|
||||||
if (one != two)
|
|
||||||
lyxerr << " +";
|
lyxerr << " +";
|
||||||
lyxerr << endl;
|
lyxerr << endl;
|
||||||
}
|
}
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
time_t time_sec = time(0) - start_time;
|
||||||
|
lyxerr[Debug::DEPEND] << "Finished updating DepTable ("
|
||||||
|
<< time_sec << " sec)." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +116,7 @@ bool DepTable::sumchange() const
|
|||||||
for (DepList::const_iterator cit = deplist.begin();
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
cit != deplist.end();
|
cit != deplist.end();
|
||||||
++cit) {
|
++cit) {
|
||||||
if ((*cit).second.first != cit->second.second) return true;
|
if ((*cit).second.changed()) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -118,8 +128,7 @@ bool DepTable::haschanged(string const & f) const
|
|||||||
string fil = MakeAbsPath(f);
|
string fil = MakeAbsPath(f);
|
||||||
DepList::const_iterator cit = deplist.find(fil);
|
DepList::const_iterator cit = deplist.find(fil);
|
||||||
if (cit != deplist.end()) {
|
if (cit != deplist.end()) {
|
||||||
if (cit->second.first != cit->second.second
|
if (cit->second.changed())
|
||||||
&& cit->second.second != 0)
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -132,7 +141,7 @@ bool DepTable::extchanged(string const & ext) const
|
|||||||
cit != deplist.end();
|
cit != deplist.end();
|
||||||
++cit) {
|
++cit) {
|
||||||
if (suffixIs(cit->first, ext)) {
|
if (suffixIs(cit->first, ext)) {
|
||||||
if (cit->second.first != cit->second.second)
|
if (cit->second.changed())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,24 +149,53 @@ bool DepTable::extchanged(string const & ext) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DepTable::ext_exist(const string& ext ) const
|
||||||
|
{
|
||||||
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
|
cit != deplist.end(); ++cit ) {
|
||||||
|
|
||||||
|
if ( suffixIs(cit->first, ext) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool DepTable::exist(string const & fil) const
|
bool DepTable::exist(string const & fil) const
|
||||||
{
|
{
|
||||||
DepList::const_iterator cit = deplist.find(fil);
|
return deplist.find(fil) != deplist.end();
|
||||||
if (cit != deplist.end()) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DepTable::remove_files_with_extension(string const & suf)
|
void DepTable::remove_files_with_extension(string const & suf)
|
||||||
{
|
{
|
||||||
DepList tmp;
|
DepList::iterator cit = deplist.begin();
|
||||||
// we want const_iterator (Lgb)
|
while (cit != deplist.end()) {
|
||||||
for (DepList::iterator cit = deplist.begin();
|
if (suffixIs(cit->first, suf)) {
|
||||||
cit != deplist.end(); ++cit) {
|
// Can't erase the current iterator, but we can increment and then erase.
|
||||||
if (!suffixIs(cit->first, suf))
|
// deplist is a map so only the erased iterator is invalidated.
|
||||||
tmp[cit->first] = cit->second;
|
DepList::iterator doomed = cit++;
|
||||||
|
deplist.erase(doomed);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cit++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DepTable::remove_file(string const & filename)
|
||||||
|
{
|
||||||
|
DepList::iterator cit = deplist.begin();
|
||||||
|
while (cit != deplist.end()) {
|
||||||
|
if (OnlyFilename(cit->first) == filename) {
|
||||||
|
// Can't erase the current iterator, but we can increment and then erase.
|
||||||
|
// deplist is a map so only the erased iterator is invalidated.
|
||||||
|
DepList::iterator doomed = cit++;
|
||||||
|
deplist.erase(doomed);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cit++;
|
||||||
}
|
}
|
||||||
deplist.swap(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,16 +205,16 @@ void DepTable::write(string const & f) const
|
|||||||
for (DepList::const_iterator cit = deplist.begin();
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
cit != deplist.end(); ++cit) {
|
cit != deplist.end(); ++cit) {
|
||||||
if (lyxerr.debugging(Debug::DEPEND)) {
|
if (lyxerr.debugging(Debug::DEPEND)) {
|
||||||
|
// Store the second (most recently calculated) CRC value.
|
||||||
|
// The older one is effectively set to 0 upon re-load.
|
||||||
lyxerr << "Write dep: "
|
lyxerr << "Write dep: "
|
||||||
<< cit->first << " "
|
<< cit->first << " "
|
||||||
<< cit->second.first << " "
|
<< cit->second.crc_cur << " "
|
||||||
<< cit->second.second << " "
|
<< cit->second.mtime_cur << endl;
|
||||||
<< cit->second.mtime << endl;
|
|
||||||
}
|
}
|
||||||
ofs << cit->first << " "
|
ofs << cit->first << " "
|
||||||
<< cit->second.first << " "
|
<< cit->second.crc_cur << " "
|
||||||
<< cit->second.second << " "
|
<< cit->second.mtime_cur << endl;
|
||||||
<< cit->second.mtime << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,26 +223,18 @@ void DepTable::read(string const & f)
|
|||||||
{
|
{
|
||||||
ifstream ifs(f.c_str());
|
ifstream ifs(f.c_str());
|
||||||
string nome;
|
string nome;
|
||||||
unsigned long one = 0;
|
dep_info di;
|
||||||
unsigned long two = 0;
|
// This doesn't change through the loop.
|
||||||
unsigned long mtime = 0;
|
di.crc_prev = 0;
|
||||||
|
|
||||||
while (ifs >> nome >> one >> two >> mtime) {
|
while (ifs >> nome >> di.crc_cur >> di.mtime_cur) {
|
||||||
if (lyxerr.debugging(Debug::DEPEND)) {
|
if (lyxerr.debugging(Debug::DEPEND)) {
|
||||||
lyxerr << "Read dep: "
|
lyxerr << "Read dep: "
|
||||||
<< nome << " "
|
<< nome << " "
|
||||||
<< one << " "
|
<< di.crc_cur << " "
|
||||||
<< two << " "
|
<< di.mtime_cur << endl;
|
||||||
<< mtime << endl;
|
|
||||||
}
|
}
|
||||||
dep_info di;
|
|
||||||
di.first = one;
|
|
||||||
di.second = two;
|
|
||||||
di.mtime = mtime;
|
|
||||||
#if 0
|
|
||||||
deplist[nome] = make_pair(one, two);
|
|
||||||
#else
|
|
||||||
deplist[nome] = di;
|
deplist[nome] = di;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* This file is Copyright 1996-2001
|
* This file is Copyright 1996-2001
|
||||||
* Lars Gullik Bjønnes
|
* Lars Gullik Bjønnes
|
||||||
|
* Ben Stanley
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*/
|
*/
|
||||||
@ -29,9 +30,7 @@ public:
|
|||||||
filename. Should we insert files with .sty .cls etc as
|
filename. Should we insert files with .sty .cls etc as
|
||||||
extension? */
|
extension? */
|
||||||
void insert(string const & f,
|
void insert(string const & f,
|
||||||
bool upd = false,
|
bool upd = false);
|
||||||
unsigned long one = 0,
|
|
||||||
unsigned long two = 0);
|
|
||||||
///
|
///
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
@ -47,14 +46,23 @@ public:
|
|||||||
bool extchanged(string const & ext) const;
|
bool extchanged(string const & ext) const;
|
||||||
///
|
///
|
||||||
bool exist(string const & fil) const;
|
bool exist(string const & fil) const;
|
||||||
|
/// returns true if any files with ext exist
|
||||||
|
bool ext_exist(string const& ext) const;
|
||||||
///
|
///
|
||||||
void remove_files_with_extension(string const &);
|
void remove_files_with_extension(string const &);
|
||||||
|
///
|
||||||
|
void remove_file(string const &);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
struct dep_info {
|
struct dep_info {
|
||||||
unsigned long first;
|
/// Previously calculated CRC value
|
||||||
unsigned long second;
|
unsigned long crc_prev;
|
||||||
long mtime;
|
/// Current CRC value - only re-computed if mtime has changed.
|
||||||
|
unsigned long crc_cur;
|
||||||
|
/// mtime from last time current CRC was calculated.
|
||||||
|
long mtime_cur;
|
||||||
|
///
|
||||||
|
bool changed() const;
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
typedef std::map<string, dep_info> DepList;
|
typedef std::map<string, dep_info> DepList;
|
||||||
@ -63,3 +71,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-01-16 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
|
* ControlExternal.C (Browse): simplify to use browseRelFile
|
||||||
|
|
||||||
2002-01-16 Angus Leeming <a.leeming@ic.ac.uk>
|
2002-01-16 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* ButtonController.tmpl: added // -*- C++ -*-
|
* ButtonController.tmpl: added // -*- C++ -*-
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ViewBase.h"
|
#include "BufferView.h"
|
||||||
#include "ButtonControllerBase.h"
|
#include "ButtonControllerBase.h"
|
||||||
#include "ControlExternal.h"
|
#include "ControlExternal.h"
|
||||||
#include "ControlInset.tmpl"
|
#include "ControlInset.tmpl"
|
||||||
#include "buffer.h"
|
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "Liason.h"
|
#include "Liason.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "support/filetools.h"
|
#include "ViewBase.h"
|
||||||
#include "support/lstrings.h"
|
#include "buffer.h"
|
||||||
#include "frontends/FileDialog.h"
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "BufferView.h"
|
#include "helper_funcs.h"
|
||||||
|
#include "lyxrc.h"
|
||||||
|
#include "support/filetools.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -149,61 +150,21 @@ ExternalTemplate ControlExternal::getTemplate(int i) const
|
|||||||
|
|
||||||
string const ControlExternal::Browse(string const & input) const
|
string const ControlExternal::Browse(string const & input) const
|
||||||
{
|
{
|
||||||
#ifdef WITH_WARNINGS
|
string const title = _("Select external file");
|
||||||
#warning Candidate for using browseRelFile
|
|
||||||
#endif
|
|
||||||
string buf;
|
|
||||||
string const bufpath = lv_.buffer()->filePath();
|
string const bufpath = lv_.buffer()->filePath();
|
||||||
|
|
||||||
if (!input.empty()) {
|
|
||||||
buf = MakeAbsPath(input, bufpath);
|
|
||||||
buf = OnlyPath(buf);
|
|
||||||
} else {
|
|
||||||
buf = bufpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileDialog fileDlg(&lv_,
|
|
||||||
_("Select external file"),
|
|
||||||
LFUN_SELECT_FILE_SYNC,
|
|
||||||
make_pair(string(_("Document|#o#O")), string(buf)));
|
|
||||||
|
|
||||||
/// Determine the template file extension
|
/// Determine the template file extension
|
||||||
ExternalTemplate const & et = params().templ;
|
ExternalTemplate const & et = params().templ;
|
||||||
|
string pattern = et.fileRegExp;
|
||||||
string regexp = et.fileRegExp;
|
if (pattern.empty())
|
||||||
if (regexp.empty())
|
pattern = "*";
|
||||||
regexp = "*";
|
|
||||||
|
|
||||||
// FIXME: a temporary hack until the FileDialog interface is updated
|
// FIXME: a temporary hack until the FileDialog interface is updated
|
||||||
regexp += "|";
|
pattern += "|";
|
||||||
|
|
||||||
static int once;
|
pair<string, string> dir1(N_("Documents|#o#O"),
|
||||||
string current_path;
|
string(lyxrc.document_path));
|
||||||
|
|
||||||
while (1) {
|
return browseRelFile(&lv_, input, bufpath, title, pattern, dir1);
|
||||||
string const path = (once) ? current_path : buf;
|
|
||||||
FileDialog::Result result = fileDlg.Select(path, regexp, input);
|
|
||||||
|
|
||||||
if (result.second.empty())
|
|
||||||
return string();
|
|
||||||
|
|
||||||
string p = result.second;
|
|
||||||
|
|
||||||
buf = MakeRelPath(p, bufpath);
|
|
||||||
current_path = OnlyPath(p);
|
|
||||||
once = 1;
|
|
||||||
|
|
||||||
if (contains(p, "#") ||
|
|
||||||
contains(p, "~") ||
|
|
||||||
contains(p, "$") ||
|
|
||||||
contains(p, "%")) {
|
|
||||||
Alert::alert(_("Filename can't contain any "
|
|
||||||
"of these characters:"),
|
|
||||||
// xgettext:no-c-format
|
|
||||||
_("'#', '~', '$' or '%'."));
|
|
||||||
} else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void ControlInclude::applyParamsToInset()
|
|||||||
|
|
||||||
string const ControlInclude::Browse(string const & in_name, Type in_type)
|
string const ControlInclude::Browse(string const & in_name, Type in_type)
|
||||||
{
|
{
|
||||||
string const title = N_("Select document to include");
|
string const title = _("Select document to include");
|
||||||
|
|
||||||
// input TeX, verbatim, or LyX file ?
|
// input TeX, verbatim, or LyX file ?
|
||||||
string pattern;
|
string pattern;
|
||||||
|
@ -82,7 +82,8 @@ string const browseFile(LyXView * lv, string const & filename,
|
|||||||
pair<string,string> const & dir2)
|
pair<string,string> const & dir2)
|
||||||
{
|
{
|
||||||
string lastPath = ".";
|
string lastPath = ".";
|
||||||
if (!filename.empty()) lastPath = OnlyPath(filename);
|
if (!filename.empty())
|
||||||
|
lastPath = OnlyPath(filename);
|
||||||
|
|
||||||
FileDialog fileDlg(lv, title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
|
FileDialog fileDlg(lv, title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-01-16 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
|
* insetbib.C (getFiles): uncomment Path variable.
|
||||||
|
|
||||||
2002-01-16 Juergen Vigna <jug@sad.it>
|
2002-01-16 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* insettabular.C (forceDefaultParagraphs): fixed bug returning value
|
* insettabular.C (forceDefaultParagraphs): fixed bug returning value
|
||||||
|
@ -210,15 +210,10 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<string> const InsetBibtex::getFiles(Buffer const &) const
|
vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
|
||||||
{
|
{
|
||||||
// Doesn't appear to be used (Angus, 31 July 2001)
|
// Doesn't appear to be used (Angus, 31 July 2001)
|
||||||
// Path p(buffer->filePath());
|
Path p(buffer.filePath());
|
||||||
#ifdef WITH_WARNINGS
|
|
||||||
#warning Angus, do you now that this is not supposed to be used but to change path?
|
|
||||||
// I would say this is needed to find bib files which are in the
|
|
||||||
// document directory (JMarc 14/01/2002)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vector<string> vec;
|
vector<string> vec;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user