ws + small stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6285 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-02-26 16:05:35 +00:00
parent 0ee3291622
commit eb2886967b
2 changed files with 28 additions and 49 deletions

View File

@ -22,7 +22,6 @@
#include "Lsstream.h" #include "Lsstream.h"
using std::ostream; using std::ostream;
using std::endl;
InsetCommand::InsetCommand(InsetCommandParams const & p, bool) InsetCommand::InsetCommand(InsetCommandParams const & p, bool)

View File

@ -135,17 +135,15 @@ string findTargetFormat(string const & suffix)
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n"; lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
if (contains(suffix, "ps") || suffix == "pdf") if (contains(suffix, "ps") || suffix == "pdf")
return "pdf"; return "pdf";
else if (suffix == "jpg") // pdflatex can use jpeg if (suffix == "jpg") // pdflatex can use jpeg
return suffix; return suffix;
else return "png"; // and also png
return "png"; // and also png
} }
// If it's postscript, we always do eps. // If it's postscript, we always do eps.
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PostScript mode\n"; lyxerr[Debug::GRAPHICS] << "findTargetFormat: PostScript mode\n";
if (suffix != "ps") // any other than ps if (suffix != "ps") // any other than ps
return "eps"; // is changed to eps return "eps"; // is changed to eps
else return suffix; // let ps untouched
return suffix; // let ps untouched
} }
} // namespace anon } // namespace anon
@ -206,6 +204,12 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig,
} }
Inset * InsetGraphics::clone(Buffer const & buffer, bool same_id) const
{
return new InsetGraphics(*this, buffer.filePath(), same_id);
}
InsetGraphics::~InsetGraphics() InsetGraphics::~InsetGraphics()
{ {
// Emits the hide signal to the dialog connected (if any) // Emits the hide signal to the dialog connected (if any)
@ -215,45 +219,31 @@ InsetGraphics::~InsetGraphics()
string const InsetGraphics::statusMessage() const string const InsetGraphics::statusMessage() const
{ {
string msg;
switch (cache_->loader.status()) { switch (cache_->loader.status()) {
case grfx::WaitingToLoad: case grfx::WaitingToLoad:
msg = _("Not shown."); return _("Not shown.");
break;
case grfx::Loading: case grfx::Loading:
msg = _("Loading..."); return _("Loading...");
break;
case grfx::Converting: case grfx::Converting:
msg = _("Converting to loadable format..."); return _("Converting to loadable format...");
break;
case grfx::Loaded: case grfx::Loaded:
msg = _("Loaded into memory. Must now generate pixmap."); return _("Loaded into memory. Must now generate pixmap.");
break;
case grfx::ScalingEtc: case grfx::ScalingEtc:
msg = _("Scaling etc..."); return _("Scaling etc...");
break;
case grfx::Ready: case grfx::Ready:
msg = _("Ready to display"); return _("Ready to display");
break;
case grfx::ErrorNoFile: case grfx::ErrorNoFile:
msg = _("No file found!"); return _("No file found!");
break;
case grfx::ErrorConverting: case grfx::ErrorConverting:
msg = _("Error converting to loadable format"); return _("Error converting to loadable format");
break;
case grfx::ErrorLoading: case grfx::ErrorLoading:
msg = _("Error loading file into memory"); return _("Error loading file into memory");
break;
case grfx::ErrorGeneratingPixmap: case grfx::ErrorGeneratingPixmap:
msg = _("Error generating the pixmap"); return _("Error generating the pixmap");
break;
case grfx::ErrorUnknown: case grfx::ErrorUnknown:
msg = _("No image"); return _("No image");
break;
} }
return string();
return msg;
} }
@ -688,7 +678,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
} }
int InsetGraphics::latex(Buffer const *buf, ostream & os, int InsetGraphics::latex(Buffer const * buf, ostream & os,
bool /*fragile*/, bool/*fs*/) const bool /*fragile*/, bool/*fs*/) const
{ {
// If there is no file specified or not existing, // If there is no file specified or not existing,
@ -699,7 +689,7 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
// A missing (e)ps-extension is no problem for LaTeX, so // A missing (e)ps-extension is no problem for LaTeX, so
// we have to test three different cases // we have to test three different cases
string const file_(MakeAbsPath(params().filename, buf->filePath())); string const file_ = MakeAbsPath(params().filename, buf->filePath());
bool const file_exists = bool const file_exists =
!file_.empty() && !file_.empty() &&
(IsFileReadable(file_) || // original (IsFileReadable(file_) || // original
@ -756,10 +746,7 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
os << latex_str; os << latex_str;
// Return how many newlines we issued. // Return how many newlines we issued.
int const newlines = return int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
return newlines;
} }
@ -808,7 +795,7 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
{ {
// If we have no image, we should not require anything. // If we have no image, we should not require anything.
if (params().filename.empty()) if (params().filename.empty())
return ; return;
features.includeFile(graphic_label, RemoveExtension(params().filename)); features.includeFile(graphic_label, RemoveExtension(params().filename));
@ -830,9 +817,8 @@ bool InsetGraphics::setParams(InsetGraphicsParams const & p,
string const & filepath) string const & filepath)
{ {
// If nothing is changed, just return and say so. // If nothing is changed, just return and say so.
if (params() == p && !p.filename.empty()) { if (params() == p && !p.filename.empty())
return false; return false;
}
// Copy the new parameters. // Copy the new parameters.
params_ = p; params_ = p;
@ -849,9 +835,3 @@ InsetGraphicsParams const & InsetGraphics::params() const
{ {
return params_; return params_;
} }
Inset * InsetGraphics::clone(Buffer const & buffer, bool same_id) const
{
return new InsetGraphics(*this, buffer.filePath(), same_id);
}