+
+2002-06-26 André Pönitz <poenitz@gmx.net>
+
+ * lyxrc.[Ch]: introduce \preview, revive half-dead \show_banner
+
2002-06-25 Angus Leeming <leeming@lyx.org>
* lyxfunc.C (dispatch): Comment out the call to
/// This is a singleton class. Get the instance.
static SplashScreen const & get();
///
- grfx::GImage const * image() const { return image_.get(); }
+ grfx::GImage const * image() const { return graphic_->image().get(); }
///
string const & text() const { return text_; }
///
* erased unexpectedly by the cache itself.
*/
grfx::GraphicPtr graphic_;
- /** We generate a pixmap from a copy of the grfx::GImage * stored in
- * the cache.
- */
- grfx::ImagePtr image_;
/// The loading status of the image.
grfx::ImageStatus status_;
/// The text to be written on top of the pixmap
void SplashScreen::createPixmap()
{
- if (!graphic_.get() || image_.get())
- return;
-
- if (graphic_->status() != grfx::Loaded)
+ if (!graphic_.get() || status_ != grfx::WaitingToLoad)
return;
- if (status_ != grfx::WaitingToLoad)
+ // We aren't going to modify the image, so don't bother making a
+ // local copy
+ grfx::GImage * const image = graphic_->image().get();
+ if (!image)
return;
- // Strictly speaking, we need to create a copy only if we're going to
- // modify the image (scale, etc).
- image_.reset(graphic_->image()->clone());
-
- bool const success = image_->setPixmap(grfx::GParams());
-
- if (success) {
+ if (image->getPixmap()) {
status_ = grfx::Loaded;
- } else {
- image_.reset();
- status_ = grfx::ErrorScalingEtc;
+ return;
}
+
+ bool const success = image->setPixmap(grfx::GParams());
+ status_ = success ? grfx::Loaded : grfx::ErrorLoading;
}
} // namespace anon
namespace {
+// when adding something to this array keep it sorted!
keyword_item lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
{ "\\alternate_language", LyXRC::RC_ALT_LANG },
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
{ "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
+ { "\\preview", LyXRC::RC_PREVIEW },
{ "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
{ "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
{ "\\print_command", LyXRC::RC_PRINT_COMMAND },
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
{ "\\set_color", LyXRC::RC_SET_COLOR },
+ { "\\show_banner", LyXRC::RC_SHOW_BANNER },
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
cursor_follows_scrollbar = false;
dialogs_iconify_with_main = false;
label_init_length = 3;
+ preview = false;
/// These variables are not stored on disk (perhaps they
// should be moved from the LyXRC class).
label_init_length = lexrc.getInteger();
break;
+ case RC_SHOW_BANNER:
+ if (lexrc.next())
+ show_banner = lexrc.getBool();
+ break;
+
+ case RC_PREVIEW:
+ if (lexrc.next())
+ preview = lexrc.getBool();
+ break;
+
case RC_LAST: break; // this is just a dummy
}
}
<< "\n";
}
+ case RC_SHOW_BANNER:
+ if (show_banner != system_lyxrc.show_banner) {
+ os << "\\show_banner " << tostr(show_banner) << "\n";
+ }
+
+ case RC_PREVIEW:
+ if (preview != system_lyxrc.preview) {
+ os << "\\preview " << tostr(preview) << "\n";
+ }
+
os << "\n#\n"
<< "# SCREEN & FONTS SECTION ############################\n"
<< "#\n\n";
str = _("Maximum number of words in the initialization string for a new label");
break;
+ case RC_PREVIEW:
+ str = _("Shows a typeset preview besides formulas");
+ break;
+
default:
break;
}
RC_DEFAULT_LANGUAGE,
RC_LABEL_INIT_LENGTH,
RC_DISPLAY_GRAPHICS,
+ RC_PREVIEW,
#ifdef USE_PSPELL
RC_USE_PSPELL,
#endif
///
void setDefaults();
///
- int read (string const & filename);
+ int read(string const & filename);
///
void readBindFileIfNeeded();
///
int label_init_length;
///
string display_graphics;
+ ///
+ bool show_banner;
+ ///
+ bool preview;
private:
/// Is a bind file already (or currently) read?
bool hasBindFile;
par_->draw(pi, x, y);
// preview stuff
-#if 0
- ostringstream os;
- WriteStream wi(os, false, false);
- par_->write(wi);
- if (preview(os.str(), preview_)) {
- cerr << "image could be drawn\n";
- pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
+ if (lyxrc.preview) {
+ ostringstream os;
+ WriteStream wi(os, false, false);
+ par_->write(wi);
+ if (preview(os.str(), preview_)) {
+ cerr << "image could be drawn\n";
+ pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
+ }
}
-#endif
xx += par_->width();
xo_ = x;
if (gr->status() == grfx::Loaded) {
cerr << "file '" << file << "' ready for display\n";
graphic = gr;
- return graphic->image()->setPixmap(grfx::GParams());
+ grfx::GParams pars;
+ bool const res = graphic->image()->setPixmap(pars);
+ return res;
}
// otherwise we have to wait again
// The real work starts.
string const texfile = dir + base + ".tex";
std::ofstream of(texfile.c_str());
- of << "\\documentclass{article}"
+ of << "\\batchmode"
+ << "\\documentclass{article}"
<< "\\usepackage{amssymb}"
<< "\\thispagestyle{empty}"
+ << "\\pdfoutput=0"
<< "\\begin{document}"
<< str
<< "\\end{document}\n";
of.close();
string const cmd =
- "latex " + base + ".tex ; dvips -E -o " + base + ".eps " + base + ".dvi ";
+// "latex " + base + ".tex ; " + "
+// "dvips -x 2500 -R -E -o " + base + ".eps " + base + ".dvi ";
+ // Herbert says this is faster
+ "pdflatex --interaction batchmode " + base + "; " +
+ "dvips -x 2000 -R -E -o " + base + ".eps " + base + ".dvi ";
//cerr << "calling: '" << "(cd " + dir + "; " + cmd + ")\n";
Systemcall sc;
sc.startscript(Systemcall::Wait, "(cd " + dir + "; " + cmd + ")");