mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
* InsetHyperlink.{cpp,h}:
* stdcontext.inc: - basic implementation of inset-edit (only for file: now) (part of bug #6864) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35230 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d427010975
commit
435067c0f1
@ -645,6 +645,8 @@ Menuset
|
||||
#
|
||||
Menu "context-hyperlink"
|
||||
Item "Settings...|S" "inset-settings"
|
||||
Separator
|
||||
Item "Open Target...|O" "inset-edit"
|
||||
End
|
||||
|
||||
End
|
||||
|
@ -13,12 +13,18 @@
|
||||
|
||||
#include "InsetHyperlink.h"
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "Format.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "OutputParams.h"
|
||||
#include "output_xhtml.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -63,6 +69,45 @@ docstring InsetHyperlink::screenLabel() const
|
||||
return temp + url;
|
||||
}
|
||||
|
||||
void InsetHyperlink::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
switch (cmd.action()) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
viewTarget();
|
||||
break;
|
||||
|
||||
default:
|
||||
InsetCommand::doDispatch(cur, cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool InsetHyperlink::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action()) {
|
||||
case LFUN_INSET_EDIT:
|
||||
flag.setEnabled(getParam("type") == "file:");
|
||||
return true;
|
||||
|
||||
default:
|
||||
return InsetCommand::getStatus(cur, cmd, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetHyperlink::viewTarget() const
|
||||
{
|
||||
// FIXME implement viewer for web url
|
||||
if (getParam("type") != "file:")
|
||||
return;
|
||||
FileName url = makeAbsPath(to_utf8(getParam("target")), buffer().filePath());
|
||||
string format = formats.getFormatFromFile(url);
|
||||
formats.view(buffer(), url, format);
|
||||
}
|
||||
|
||||
|
||||
int InsetHyperlink::latex(odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
|
@ -60,6 +60,14 @@ public:
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
private:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
bool getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const;
|
||||
///
|
||||
void viewTarget() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetHyperlink(*this); }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user