owner_->updateLayoutChoice();
owner_->updateWindowTitle();
- if (lyx::graphics::Previews::activated() && buffer_)
+ if (buffer_ && lyx::graphics::Previews::status() != LyXRC::PREVIEW_OFF)
lyx::graphics::Previews::get().generateBufferPreviews(*buffer_);
}
+2004-04-19 Angus Leeming <leeming@lyx.org>
+
+ * BufferView_pimpl.C (setBuffer): changed preview interface.
+
+ * lyxrc.[Ch] (preview): no longer a bool. Now an enum with three
+ possible values.
+
2004-04-19 John Levon <levon@movementarian.org>
* BufferView_pimpl.C:
QPrefDisplayModule * displaymod(dialog_->displayModule);
- rc.preview = displaymod->previewCB->isChecked();
-
+ switch (displaymod->instantPreviewCO->currentItem()) {
+ case 0:
+ rc.preview = LyXRC::PREVIEW_OFF;
+ break;
+ case 1:
+ rc.preview = LyXRC::PREVIEW_NO_MATH;
+ break;
+ case 2:
+ rc.preview = LyXRC::PREVIEW_ON;
+ break;
+ }
+
lyx::graphics::DisplayType dtype(lyx::graphics::ColorDisplay);
switch (displaymod->displayGraphicsCO->currentItem()) {
- case 3: dtype = lyx::graphics::NoDisplay; break;
- case 2: dtype = lyx::graphics::ColorDisplay; break;
- case 1: dtype = lyx::graphics::GrayscaleDisplay; break;
- case 0: dtype = lyx::graphics::MonochromeDisplay; break;
+ case 3: dtype = lyx::graphics::NoDisplay; break;
+ case 2: dtype = lyx::graphics::ColorDisplay; break;
+ case 1: dtype = lyx::graphics::GrayscaleDisplay; break;
+ case 0: dtype = lyx::graphics::MonochromeDisplay; break;
}
rc.display_graphics = dtype;
QPrefDisplayModule * displaymod(dialog_->displayModule);
- displaymod->previewCB->setChecked(rc.preview);
-
+ switch (rc.preview) {
+ case LyXRC::PREVIEW_OFF:
+ displaymod->instantPreviewCO->setCurrentItem(0);
+ break;
+ case LyXRC::PREVIEW_NO_MATH :
+ displaymod->instantPreviewCO->setCurrentItem(1);
+ break;
+ case LyXRC::PREVIEW_ON :
+ displaymod->instantPreviewCO->setCurrentItem(2);
+ break;
+ }
+
int item = 2;
switch (rc.display_graphics) {
connect(latexModule->latexAutoresetCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(latexModule->latexDviPaperED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(latexModule->latexPaperSizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
- connect(displayModule->previewCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
+ connect(displayModule->instantPreviewCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(displayModule->displayGraphicsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(pathsModule->workingDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->templateDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
<rect>
<x>0</x>
<y>0</y>
- <width>240</width>
- <height>102</height>
+ <width>264</width>
+ <height>133</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Display insets</string>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
<name>spacing</name>
<number>6</number>
</property>
- <widget>
+ <widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout1</cstring>
+ <cstring>Layout3</cstring>
</property>
<grid>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>displayGraphicsLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Display &Graphics:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>displayGraphicsCO</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Off</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>No math</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>On</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>instantPreviewCO</cstring>
+ </property>
+ </widget>
<widget row="0" column="1" >
<class>QComboBox</class>
<item>
<cstring>displayGraphicsCO</cstring>
</property>
</widget>
- <widget row="0" column="0" >
+ <widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>displayGraphicsLA</cstring>
+ <cstring>instantPreviewLA</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Display &Graphics:</string>
+ <string>Instant &Preview:</string>
</property>
<property>
<name>buddy</name>
- <cstring>displayGraphicsCO</cstring>
+ <cstring>instantPreviewCO</cstring>
</property>
</widget>
</grid>
</widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>previewCB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Instant &preview</string>
- </property>
- </widget>
- <spacer>
+ <spacer row="1" column="0" >
<property>
<name>name</name>
<cstring>Spacer1</cstring>
</size>
</property>
</spacer>
- </vbox>
+ </grid>
</widget>
</UI>
fl_get_button(dialog_->check_cursor_follows_scrollbar);
rc.dialogs_iconify_with_main =
fl_get_button(dialog_->check_dialogs_iconify_with_main);
- rc.preview = fl_get_button(dialog_->check_preview_latex);
+
+ switch (fl_get_choice(dialog_->choice_instant_preview)) {
+ case 1:
+ rc.preview = LyXRC::PREVIEW_OFF;
+ break;
+ case 2:
+ rc.preview = LyXRC::PREVIEW_NO_MATH;
+ break;
+ case 3:
+ rc.preview = LyXRC::PREVIEW_ON;
+ break;
+ }
+
rc.autosave = static_cast<unsigned int>
(fl_get_counter_value(dialog_->counter_autosave));
rc.wheel_jump = static_cast<unsigned int>
// See FIXME below
// lyx::graphics::DisplayType old_value = rc.display_graphics;
- switch (fl_get_choice(dialog_->choice_display)) {
+ switch (fl_get_choice(dialog_->choice_graphics_display)) {
case 4:
rc.display_graphics = lyx::graphics::NoDisplay;
break;
setPrehandler(dialog_->counter_autosave);
setPrehandler(dialog_->check_cursor_follows_scrollbar);
setPrehandler(dialog_->check_dialogs_iconify_with_main);
- setPrehandler(dialog_->check_preview_latex);
+ setPrehandler(dialog_->choice_instant_preview);
setPrehandler(dialog_->counter_wm_jump);
- fl_addto_choice(dialog_->choice_display,
+ fl_addto_choice(dialog_->choice_graphics_display,
_("Monochrome|Grayscale|Color|Do not display").c_str());
+
+ fl_addto_choice(dialog_->choice_instant_preview,
+ _("Off|No math|On").c_str());
}
return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
if (ob == dialog_->check_dialogs_iconify_with_main)
return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
- if (ob == dialog_->check_preview_latex)
+ if (ob == dialog_->choice_instant_preview)
return LyXRC::getDescription(LyXRC::RC_PREVIEW);
if (ob == dialog_->counter_autosave)
return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
if (ob == dialog_->counter_wm_jump)
return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
- if (ob == dialog_->choice_display)
+ if (ob == dialog_->choice_graphics_display)
return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
return string();
}
rc.cursor_follows_scrollbar);
fl_set_button(dialog_->check_dialogs_iconify_with_main,
rc.dialogs_iconify_with_main);
- fl_set_button(dialog_->check_preview_latex,
- rc.preview);
+
+ switch (rc.preview) {
+ case LyXRC::PREVIEW_OFF:
+ fl_set_choice(dialog_->choice_instant_preview, 1);
+ break;
+ case LyXRC::PREVIEW_NO_MATH:
+ fl_set_choice(dialog_->choice_instant_preview, 2);
+ break;
+ case LyXRC::PREVIEW_ON:
+ fl_set_choice(dialog_->choice_instant_preview, 3);
+ break;
+ }
+
fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
switch (rc.display_graphics) {
case lyx::graphics::NoDisplay:
- fl_set_choice(dialog_->choice_display, 4);
+ fl_set_choice(dialog_->choice_graphics_display, 4);
break;
case lyx::graphics::ColorDisplay:
- fl_set_choice(dialog_->choice_display, 3);
+ fl_set_choice(dialog_->choice_graphics_display, 3);
break;
case lyx::graphics::GrayscaleDisplay:
- fl_set_choice(dialog_->choice_display, 2);
+ fl_set_choice(dialog_->choice_graphics_display, 2);
break;
case lyx::graphics::MonochromeDisplay:
- fl_set_choice(dialog_->choice_display, 1);
+ fl_set_choice(dialog_->choice_graphics_display, 1);
break;
default:
- fl_set_choice(dialog_->choice_display, 3);
+ fl_set_choice(dialog_->choice_graphics_display, 3);
break;
}
}
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 15 25 30 30
+box: 300 20 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 15 75 30 30
+box: 300 60 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 15 130 30 30
+box: 300 100 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
--------------------
class: FL_COUNTER
type: NORMAL_COUNTER
-box: 310 190 115 30
+box: 300 260 115 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_TOP
--------------------
class: FL_COUNTER
type: NORMAL_COUNTER
-box: 310 115 115 30
+box: 80 260 115 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_TOP
sstep: 1
--------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 15 185 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 300 150 130 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Instant Preview|#P
+label: Graphics display:|#G
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_preview_latex
+name: choice_graphics_display
callback: C_FormDialogView_InputCB
argument: 0
- value: 1
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 305 40 130 30
+box: 300 200 130 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_TOP
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Graphics display:|#G
+label: Instant Preview:|#p
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: choice_display
+name: choice_instant_preview
callback: C_FormDialogView_InputCB
argument: 0
namespace lyx {
namespace graphics {
-bool Previews::activated()
+LyXRC_PreviewStatus Previews::status()
{
return lyxrc.preview;
}
#include <boost/scoped_ptr.hpp>
class Buffer;
+class LyXRC_PreviewStatus;
namespace lyx {
namespace graphics {
class Previews : boost::noncopyable {
public:
/// a wrapper for lyxrc.preview
- static bool activated();
+ static LyXRC_PreviewStatus status();
/// This is a singleton class. Get the instance.
static Previews & get();
+2004-04-19 Angus Leeming <leeming@lyx.org>
+
+ * insetexternal.C:
+ * insetinclude.C:
+ * render_preview.[Ch]: changes due to changes to LyXRC::preview.
+
2004-04-19 Angus Leeming <leeming@lyx.org>
* insetexternal.C (priv_dispatch): remove unnecessary invocation of
return RENDERBUTTON;
if (p.display == external::PreviewDisplay) {
- if (RenderPreview::activated())
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF)
return RENDERPREVIEW;
return RENDERBUTTON;
}
{
InsetExternalParams const & params = inset.params();
- if (RenderPreview::activated() &&
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
preview_wanted(params)) {
renderer.setAbsFile(params.filename.absFilename());
string const snippet = latex_string(inset, buffer);
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "lyx_main.h"
+#include "lyxrc.h"
#include "lyxlex.h"
#include "metricsinfo.h"
#include "outputparams.h"
BOOST_ASSERT(mi.base.bv && mi.base.bv->buffer());
bool use_preview = false;
- if (RenderPreview::activated()) {
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*mi.base.bv->buffer());
use_preview = pimage && pimage->image();
BOOST_ASSERT(pi.base.bv && pi.base.bv->buffer());
bool use_preview = false;
- if (RenderPreview::activated()) {
+ if (RenderPreview::status() == LyXRC::PREVIEW_OFF) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*pi.base.bv->buffer());
use_preview = pimage && pimage->image();
Buffer const & buffer)
{
InsetCommandParams const & params = inset.params();
- if (RenderPreview::activated() && preview_wanted(params, buffer)) {
+ if (RenderPreview::status() == LyXRC::PREVIEW_OFF &&
+ preview_wanted(params, buffer)) {
renderer.setAbsFile(includedFilename(buffer, params));
string const snippet = latex_string(inset, buffer);
renderer.addPreview(snippet, buffer);
#include "gettext.h"
#include "LColor.h"
#include "lyx_main.h"
+#include "lyxrc.h"
#include "metricsinfo.h"
#include "frontends/font_metrics.h"
namespace support = lyx::support;
-bool RenderPreview::activated()
+LyXRC_PreviewStatus RenderPreview::status()
{
- return graphics::Previews::activated();
+ return graphics::Previews::status();
}
void RenderPreview::startLoading(Buffer const & buffer) const
{
- if (!activated() && !snippet_.empty())
+ if (status() == LyXRC::PREVIEW_OFF || snippet_.empty())
return;
graphics::Previews & previews = graphics::Previews::get();
void RenderPreview::addPreview(string const & latex_snippet,
Buffer const & buffer)
{
- if (!activated())
+ if (status() == LyXRC::PREVIEW_OFF)
return;
graphics::Previews & previews = graphics::Previews::get();
void RenderPreview::addPreview(string const & latex_snippet,
graphics::PreviewLoader & ploader)
{
- if (!activated())
+ if (status() == LyXRC::PREVIEW_OFF)
return;
snippet_ = support::trim(latex_snippet);
class Buffer;
class BufferView;
+class LyXRC_PreviewStatus;
class MetricsInfo;
class PainterInfo;
class RenderPreview : public RenderBase, public boost::signals::trackable {
public:
- /// a wrapper for Previews::activated()
- static bool activated();
+ /// a wrapper for Previews::status()
+ static LyXRC_PreviewStatus status();
RenderPreview(InsetBase const *);
RenderPreview(RenderPreview const &, InsetBase const *);
cursor_follows_scrollbar = false;
dialogs_iconify_with_main = false;
label_init_length = 3;
- preview = false;
+ preview = PREVIEW_OFF;
preview_hashed_labels = false;
preview_scale_factor = 0.9;
case RC_PREVIEW:
if (lexrc.next()) {
- preview = lexrc.getBool();
+ string const tmp = lexrc.getString();
+ if (tmp == "true" || tmp == "on")
+ preview = PREVIEW_ON;
+ else if (tmp == "no_math")
+ preview = PREVIEW_NO_MATH;
+ else {
+ preview = PREVIEW_OFF;
+ if (tmp != "false" && tmp != "off")
+ lyxerr << "Unrecognized "
+ "preview status \""
+ << tmp << '\n' << endl;
+ }
}
break;
case RC_PREVIEW:
if (ignore_system_lyxrc ||
preview != system_lyxrc.preview) {
- os << "\\preview " << tostr(preview) << '\n';
+ string status;
+ switch (preview) {
+ case PREVIEW_ON:
+ status = "on";
+ break;
+ case PREVIEW_NO_MATH:
+ status = "no_math";
+ break;
+ case PREVIEW_OFF:
+ status = "off";
+ break;
+ }
+ os << "\\preview " << status << '\n';
}
case RC_PREVIEW_HASHED_LABELS:
///
bool show_banner;
///
- bool preview;
+ enum PreviewStatus {
+ PREVIEW_OFF,
+ PREVIEW_NO_MATH,
+ PREVIEW_ON
+ };
+ ///
+ PreviewStatus preview;
///
bool preview_hashed_labels;
///
std::string user_email;
};
+
+/** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
+ * It can be forward-declared and passed as a function argument without
+ * having to expose lyxrc.h.
+ */
+class LyXRC_PreviewStatus {
+ LyXRC::PreviewStatus val_;
+public:
+ LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
+ operator LyXRC::PreviewStatus() const{ return val_; }
+};
+
+
///
extern LyXRC lyxrc;
///
+2004-04-19 Angus Leeming <leeming@lyx.org>
+
+ * math_hullinset.C: changes due to changes to LyXRC::preview.
+
2004-04-19 Angus Leeming <leeming@lyx.org>
* math_hullinset.C (metrics, draw): changes due to the changed
BOOST_ASSERT(mi.base.bv && mi.base.bv->buffer());
bool use_preview = false;
- if (!editing(mi.base.bv) && RenderPreview::activated()) {
+ if (!editing(mi.base.bv) &&
+ RenderPreview::status() == LyXRC::PREVIEW_ON) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*mi.base.bv->buffer());
use_preview = pimage && pimage->image();
BOOST_ASSERT(pi.base.bv && pi.base.bv->buffer());
bool use_preview = false;
- if (!editing(pi.base.bv) && RenderPreview::activated()) {
+ if (!editing(pi.base.bv) &&
+ RenderPreview::status() == LyXRC::PREVIEW_ON) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*pi.base.bv->buffer());
use_preview = pimage && pimage->image();
void MathHullInset::notifyCursorLeaves(LCursor & cur)
{
- if (!RenderPreview::activated())
+ if (RenderPreview::status() != LyXRC::PREVIEW_ON)
return;
Buffer const & buffer = cur.buffer();