mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
There is now a \preview lyxrc variable defaulting to 'false'.
Would be nice if someone would make this available in the preferences dialog. And this incorporates Herberts' patch to use pdfLaTeX which means we are approaching TeXMacs ballpark of sluggishness... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4484 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a153642391
commit
9c1a896972
@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
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>
|
2002-06-25 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* lyxfunc.C (dispatch): Comment out the call to
|
* lyxfunc.C (dispatch): Comment out the call to
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
/// This is a singleton class. Get the instance.
|
/// This is a singleton class. Get the instance.
|
||||||
static SplashScreen const & get();
|
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_; }
|
string const & text() const { return text_; }
|
||||||
///
|
///
|
||||||
@ -73,10 +73,6 @@ private:
|
|||||||
* erased unexpectedly by the cache itself.
|
* erased unexpectedly by the cache itself.
|
||||||
*/
|
*/
|
||||||
grfx::GraphicPtr graphic_;
|
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.
|
/// The loading status of the image.
|
||||||
grfx::ImageStatus status_;
|
grfx::ImageStatus status_;
|
||||||
/// The text to be written on top of the pixmap
|
/// The text to be written on top of the pixmap
|
||||||
@ -140,27 +136,22 @@ SplashScreen::~SplashScreen()
|
|||||||
|
|
||||||
void SplashScreen::createPixmap()
|
void SplashScreen::createPixmap()
|
||||||
{
|
{
|
||||||
if (!graphic_.get() || image_.get())
|
if (!graphic_.get() || status_ != grfx::WaitingToLoad)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (graphic_->status() != grfx::Loaded)
|
// 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;
|
return;
|
||||||
|
|
||||||
if (status_ != grfx::WaitingToLoad)
|
if (image->getPixmap()) {
|
||||||
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) {
|
|
||||||
status_ = grfx::Loaded;
|
status_ = grfx::Loaded;
|
||||||
} else {
|
return;
|
||||||
image_.reset();
|
|
||||||
status_ = grfx::ErrorScalingEtc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool const success = image->setPixmap(grfx::GParams());
|
||||||
|
status_ = success ? grfx::Loaded : grfx::ErrorLoading;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
28
src/lyxrc.C
28
src/lyxrc.C
@ -43,6 +43,7 @@ extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// when adding something to this array keep it sorted!
|
||||||
keyword_item lyxrcTags[] = {
|
keyword_item lyxrcTags[] = {
|
||||||
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
|
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
|
||||||
{ "\\alternate_language", LyXRC::RC_ALT_LANG },
|
{ "\\alternate_language", LyXRC::RC_ALT_LANG },
|
||||||
@ -94,6 +95,7 @@ keyword_item lyxrcTags[] = {
|
|||||||
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
|
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
|
||||||
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
|
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
|
||||||
{ "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
|
{ "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
|
||||||
|
{ "\\preview", LyXRC::RC_PREVIEW },
|
||||||
{ "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
|
{ "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
|
||||||
{ "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
|
{ "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
|
||||||
{ "\\print_command", LyXRC::RC_PRINT_COMMAND },
|
{ "\\print_command", LyXRC::RC_PRINT_COMMAND },
|
||||||
@ -130,6 +132,7 @@ keyword_item lyxrcTags[] = {
|
|||||||
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
|
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
|
||||||
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
||||||
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
||||||
|
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
|
||||||
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
|
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
|
||||||
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
|
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
|
||||||
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
|
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
|
||||||
@ -253,6 +256,7 @@ void LyXRC::setDefaults() {
|
|||||||
cursor_follows_scrollbar = false;
|
cursor_follows_scrollbar = false;
|
||||||
dialogs_iconify_with_main = false;
|
dialogs_iconify_with_main = false;
|
||||||
label_init_length = 3;
|
label_init_length = 3;
|
||||||
|
preview = false;
|
||||||
|
|
||||||
/// These variables are not stored on disk (perhaps they
|
/// These variables are not stored on disk (perhaps they
|
||||||
// should be moved from the LyXRC class).
|
// should be moved from the LyXRC class).
|
||||||
@ -935,6 +939,16 @@ int LyXRC::read(string const & filename)
|
|||||||
label_init_length = lexrc.getInteger();
|
label_init_length = lexrc.getInteger();
|
||||||
break;
|
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
|
case RC_LAST: break; // this is just a dummy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1109,6 +1123,16 @@ void LyXRC::output(ostream & os) const
|
|||||||
<< "\n";
|
<< "\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"
|
os << "\n#\n"
|
||||||
<< "# SCREEN & FONTS SECTION ############################\n"
|
<< "# SCREEN & FONTS SECTION ############################\n"
|
||||||
<< "#\n\n";
|
<< "#\n\n";
|
||||||
@ -1976,6 +2000,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
|||||||
str = _("Maximum number of words in the initialization string for a new label");
|
str = _("Maximum number of words in the initialization string for a new label");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_PREVIEW:
|
||||||
|
str = _("Shows a typeset preview besides formulas");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ enum LyXRCTags {
|
|||||||
RC_DEFAULT_LANGUAGE,
|
RC_DEFAULT_LANGUAGE,
|
||||||
RC_LABEL_INIT_LENGTH,
|
RC_LABEL_INIT_LENGTH,
|
||||||
RC_DISPLAY_GRAPHICS,
|
RC_DISPLAY_GRAPHICS,
|
||||||
|
RC_PREVIEW,
|
||||||
#ifdef USE_PSPELL
|
#ifdef USE_PSPELL
|
||||||
RC_USE_PSPELL,
|
RC_USE_PSPELL,
|
||||||
#endif
|
#endif
|
||||||
@ -345,6 +346,10 @@ enum LyXRCTags {
|
|||||||
int label_init_length;
|
int label_init_length;
|
||||||
///
|
///
|
||||||
string display_graphics;
|
string display_graphics;
|
||||||
|
///
|
||||||
|
bool show_banner;
|
||||||
|
///
|
||||||
|
bool preview;
|
||||||
private:
|
private:
|
||||||
/// Is a bind file already (or currently) read?
|
/// Is a bind file already (or currently) read?
|
||||||
bool hasBindFile;
|
bool hasBindFile;
|
||||||
|
@ -188,7 +188,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
|||||||
par_->draw(pi, x, y);
|
par_->draw(pi, x, y);
|
||||||
|
|
||||||
// preview stuff
|
// preview stuff
|
||||||
#if 0
|
if (lyxrc.preview) {
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
WriteStream wi(os, false, false);
|
WriteStream wi(os, false, false);
|
||||||
par_->write(wi);
|
par_->write(wi);
|
||||||
@ -196,7 +196,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
|||||||
cerr << "image could be drawn\n";
|
cerr << "image could be drawn\n";
|
||||||
pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
|
pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
xx += par_->width();
|
xx += par_->width();
|
||||||
xo_ = x;
|
xo_ = x;
|
||||||
|
@ -48,7 +48,9 @@ bool preview(string const & str, grfx::GraphicPtr & graphic)
|
|||||||
if (gr->status() == grfx::Loaded) {
|
if (gr->status() == grfx::Loaded) {
|
||||||
cerr << "file '" << file << "' ready for display\n";
|
cerr << "file '" << file << "' ready for display\n";
|
||||||
graphic = gr;
|
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
|
// otherwise we have to wait again
|
||||||
@ -59,16 +61,22 @@ bool preview(string const & str, grfx::GraphicPtr & graphic)
|
|||||||
// The real work starts.
|
// The real work starts.
|
||||||
string const texfile = dir + base + ".tex";
|
string const texfile = dir + base + ".tex";
|
||||||
std::ofstream of(texfile.c_str());
|
std::ofstream of(texfile.c_str());
|
||||||
of << "\\documentclass{article}"
|
of << "\\batchmode"
|
||||||
|
<< "\\documentclass{article}"
|
||||||
<< "\\usepackage{amssymb}"
|
<< "\\usepackage{amssymb}"
|
||||||
<< "\\thispagestyle{empty}"
|
<< "\\thispagestyle{empty}"
|
||||||
|
<< "\\pdfoutput=0"
|
||||||
<< "\\begin{document}"
|
<< "\\begin{document}"
|
||||||
<< str
|
<< str
|
||||||
<< "\\end{document}\n";
|
<< "\\end{document}\n";
|
||||||
of.close();
|
of.close();
|
||||||
|
|
||||||
string const cmd =
|
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";
|
//cerr << "calling: '" << "(cd " + dir + "; " + cmd + ")\n";
|
||||||
Systemcall sc;
|
Systemcall sc;
|
||||||
sc.startscript(Systemcall::Wait, "(cd " + dir + "; " + cmd + ")");
|
sc.startscript(Systemcall::Wait, "(cd " + dir + "; " + cmd + ")");
|
||||||
|
Loading…
Reference in New Issue
Block a user