mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #6134: Reload context menu for graphics inset.
This shouldn't be necessary, but sometimes it is. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31014 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
603a1c545c
commit
770aa71839
@ -358,6 +358,7 @@ Menuset
|
||||
|
||||
Menu "context-graphics"
|
||||
Item "Settings...|S" "inset-settings"
|
||||
Item "Reload...|U" "graphics-reload"
|
||||
Separator
|
||||
Item "Edit Externally...|x" "inset-edit"
|
||||
Separator
|
||||
|
@ -440,6 +440,7 @@ enum FuncCode
|
||||
// 340
|
||||
LFUN_BRANCHES_RENAME, // spitz 20090709
|
||||
LFUN_BUFFER_CLOSE_ALL, // vfr 20090806
|
||||
LFUN_GRAPHICS_RELOAD, // vfr 20090810
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -3403,6 +3403,16 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_SECTION_SELECT, "section-select", ReadOnly, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_GRAPHICS_RELOAD
|
||||
* \li Action: Reloads the image if necessary.
|
||||
* \li Syntax: graphics-reload
|
||||
* \li Origin: vfr, 10 Aug 2009
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_GRAPHICS_RELOAD, "graphics-reload", ReadOnly | AtPoint, Edit },
|
||||
|
||||
|
||||
{ LFUN_NOACTION, "", Noop, Hidden }
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
};
|
||||
|
@ -349,6 +349,8 @@ static string const findTargetFormat(string const & from)
|
||||
bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from)
|
||||
{
|
||||
// First, check that the file exists!
|
||||
// force a refresh.
|
||||
filename_.lastModified();
|
||||
if (!filename_.isReadableFile()) {
|
||||
if (status_ != ErrorNoFile) {
|
||||
status_ = ErrorNoFile;
|
||||
|
@ -279,6 +279,12 @@ void Loader::startLoading() const
|
||||
}
|
||||
|
||||
|
||||
void Loader::reload() const
|
||||
{
|
||||
pimpl_->cached_item_->startLoading();
|
||||
}
|
||||
|
||||
|
||||
void Loader::startMonitoring() const
|
||||
{
|
||||
if (!pimpl_->cached_item_.get())
|
||||
|
@ -68,6 +68,10 @@ public:
|
||||
*/
|
||||
void startLoading() const;
|
||||
|
||||
/** Tries to reload the image.
|
||||
*/
|
||||
void reload() const;
|
||||
|
||||
/** Monitor any changes to the file.
|
||||
* There is no point monitoring the file before startLoading() is
|
||||
* invoked.
|
||||
|
@ -216,6 +216,10 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.bv().updateDialog("graphics", params2string(params(), buffer()));
|
||||
break;
|
||||
|
||||
case LFUN_GRAPHICS_RELOAD:
|
||||
graphic_->reload();
|
||||
break;
|
||||
|
||||
default:
|
||||
Inset::doDispatch(cur, cmd);
|
||||
break;
|
||||
@ -230,6 +234,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
case LFUN_GRAPHICS_RELOAD:
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
|
@ -52,6 +52,10 @@ RenderBase * RenderGraphic::clone(Inset const * inset) const
|
||||
return new RenderGraphic(*this, inset);
|
||||
}
|
||||
|
||||
void RenderGraphic::reload() const
|
||||
{
|
||||
loader_.reload();
|
||||
}
|
||||
|
||||
void RenderGraphic::update(graphics::Params const & params)
|
||||
{
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
|
||||
/// Refresh the info about which file to display and how to display it.
|
||||
void update(graphics::Params const & params);
|
||||
/// Reloads the image if necessary
|
||||
void reload() const;
|
||||
|
||||
/// equivalent to dynamic_cast
|
||||
virtual RenderGraphic * asGraphic() { return this; }
|
||||
|
Loading…
Reference in New Issue
Block a user