busylabel, SLOT(hide()));
QFontMetrics const fm(statusBar()->fontMetrics());
- int const roheight = max(int(d.normalIconSize), fm.height());
- QSize const rosize(roheight, roheight);
- QPixmap readonly = QIcon(getPixmap("images/", "emblem-readonly", "svgz,png")).pixmap(rosize);
+ int const iconheight = max(int(d.normalIconSize), fm.height());
+ QSize const iconsize(iconheight, iconheight);
+
+ QPixmap shellescape = QIcon(getPixmap("images/", "emblem-shellescape", "svgz,png")).pixmap(iconsize);
+ shell_escape_ = new QLabel(statusBar());
+ shell_escape_->setPixmap(shellescape);
+ shell_escape_->setScaledContents(true);
+ shell_escape_->setAlignment(Qt::AlignCenter);
+ shell_escape_->setContextMenuPolicy(Qt::CustomContextMenu);
+ shell_escape_->setToolTip(qt_("WARNING: LaTeX is allowed to execute "
+ "external commands for this document. "
+ "Right click to change."));
+ SEMenu * menu = new SEMenu(this);
+ connect(shell_escape_, SIGNAL(customContextMenuRequested(QPoint)),
+ menu, SLOT(showMenu(QPoint)));
+ shell_escape_->hide();
+ statusBar()->addPermanentWidget(shell_escape_);
+
+ QPixmap readonly = QIcon(getPixmap("images/", "emblem-readonly", "svgz,png")).pixmap(iconsize);
read_only_ = new QLabel(statusBar());
read_only_->setPixmap(readonly);
read_only_->setScaledContents(true);
}
+void GuiView::disableShellEscape()
+{
+ BufferView * bv = documentBufferView();
+ if (!bv)
+ return;
+ theSession().shellescapeFiles().remove(bv->buffer().absFileName());
+ bv->buffer().params().shell_escape = false;
+ bv->processUpdateFlags(Update::Force);
+}
+
+
QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
{
QVector<GuiWorkArea*> areas;
void GuiView::saveLayout() const
{
QSettings settings;
- settings.setValue("zoom", lyxrc.currentZoom);
+ settings.setValue("zoom_ratio", zoom_ratio_);
settings.setValue("devel_mode", devel_mode_);
settings.beginGroup("views");
settings.beginGroup(QString::number(id_));
void GuiView::saveUISettings() const
{
+ QSettings settings;
+
// Save the toolbar private states
ToolbarMap::iterator end = d.toolbars_.end();
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
- it->second->saveSession();
+ it->second->saveSession(settings);
// Now take care of all other dialogs
map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
for (; it!= d.dialogs_.end(); ++it)
- it->second->saveSession();
+ it->second->saveSession(settings);
}
bool GuiView::restoreLayout()
{
QSettings settings;
- lyxrc.currentZoom = settings.value("zoom", lyxrc.zoom).toInt();
- lyx::dispatch(FuncRequest(LFUN_BUFFER_ZOOM, convert<docstring>(lyxrc.currentZoom)));
+ zoom_ratio_ = settings.value("zoom_ratio", 1.0).toDouble();
+ // Actual zoom value: default zoom + fractional offset
+ int zoom = lyxrc.defaultZoom * zoom_ratio_;
+ if (zoom < static_cast<int>(zoom_min_))
+ zoom = zoom_min_;
+ lyxrc.currentZoom = zoom;
devel_mode_ = settings.value("devel_mode", devel_mode_).toBool();
settings.beginGroup("views");
settings.beginGroup(QString::number(id_));
// Tell Qt whether the current document is changed
setWindowModified(!buf.isClean());
+ if (buf.params().shell_escape)
+ shell_escape_->show();
+ else
+ shell_escape_->hide();
+
if (buf.hasReadonlyFlag())
read_only_->show();
else
case LFUN_DIALOG_TOGGLE:
flag.setOnOff(isDialogVisible(cmd.getArg(0)));
- // fall through to set "enable"
+ // to set "enable"
+ // fall through
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
if (!doc_buffer)
bool GuiView::reloadBuffer(Buffer & buf)
{
+ currentBufferView()->cursor().reset();
Buffer::ReadStatus status = buf.reload();
return status == Buffer::ReadSuccess;
}
case LFUN_BUFFER_ZOOM_IN:
case LFUN_BUFFER_ZOOM_OUT:
case LFUN_BUFFER_ZOOM: {
- // use a signed temp to avoid overflow
- int zoom = lyxrc.currentZoom;
if (cmd.argument().empty()) {
if (cmd.action() == LFUN_BUFFER_ZOOM)
- zoom = lyxrc.zoom;
+ zoom_ratio_ = 1.0;
else if (cmd.action() == LFUN_BUFFER_ZOOM_IN)
- zoom += 20;
+ zoom_ratio_ += 0.1;
else
- zoom -= 20;
+ zoom_ratio_ -= 0.1;
} else {
if (cmd.action() == LFUN_BUFFER_ZOOM)
- zoom = convert<int>(cmd.argument());
+ zoom_ratio_ = convert<int>(cmd.argument()) / double(lyxrc.defaultZoom);
else if (cmd.action() == LFUN_BUFFER_ZOOM_IN)
- zoom += convert<int>(cmd.argument());
+ zoom_ratio_ += convert<int>(cmd.argument()) / 100.0;
else
- zoom -= convert<int>(cmd.argument());
+ zoom_ratio_ -= convert<int>(cmd.argument()) / 100.0;
}
+ // Actual zoom value: default zoom + fractional extra value
+ int zoom = lyxrc.defaultZoom * zoom_ratio_;
if (zoom < static_cast<int>(zoom_min_))
zoom = zoom_min_;
lyxrc.currentZoom = zoom;
- dr.setMessage(bformat(_("Zoom level is now %1$d%"), lyxrc.currentZoom));
+ dr.setMessage(bformat(_("Zoom level is now %1$d% (default value: %2$d%)"),
+ lyxrc.currentZoom, lyxrc.defaultZoom));
// The global QPixmapCache is used in GuiPainter to cache text
// painting so we must reset it.
QPixmapCache::clear();
guiApp->fontLoader().update();
- lyx::dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
+ dr.screenUpdate(Update::Force | Update::FitCursor);
break;
}
continue;
Buffer const * buffer = &(wa->bufferView().buffer());
if (inset_buffer == buffer)
- wa->scheduleRedraw();
+ wa->scheduleRedraw(true);
}
return inset_buffer;
}
-void GuiView::restartCursor()
+void GuiView::restartCaret()
{
/* When we move around, or type, it's nice to be able to see
- * the cursor immediately after the keypress.
+ * the caret immediately after the keypress.
*/
if (d.current_work_area_)
- d.current_work_area_->startBlinkingCursor();
+ d.current_work_area_->startBlinkingCaret();
// Take this occasion to update the other GUI elements.
updateDialogs();
// Now update controls with current buffer.
guiApp->setCurrentView(this);
restoreLayout();
- restartCursor();
+ restartCaret();
}
}
+SEMenu::SEMenu(QWidget * parent)
+{
+ QAction * action = addAction(qt_("Disable Shell Escape"));
+ connect(action, SIGNAL(triggered()),
+ parent, SLOT(disableShellEscape()));
+}
+
+
} // namespace frontend
} // namespace lyx