mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
5f2e3c4c43
Kayvan's footnote patch Added a "Buffer const *" parameter to InsetButton::getScreenLabel and all daughter classes. Labels can now be tuned to suit, although non are yet. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2375 a592a061-630c-0410-9148-cb99ea01b6c8
96 lines
1.6 KiB
C
96 lines
1.6 KiB
C
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "inseturl.h"
|
|
#include "BufferView.h"
|
|
#include "LaTeXFeatures.h"
|
|
#include "LyXView.h"
|
|
#include "debug.h"
|
|
#include "frontends/Dialogs.h"
|
|
#include "gettext.h"
|
|
|
|
using std::ostream;
|
|
|
|
|
|
InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
|
|
: InsetCommand(p)
|
|
{}
|
|
|
|
|
|
void InsetUrl::edit(BufferView * bv, int, int, unsigned int)
|
|
{
|
|
bv->owner()->getDialogs()->showUrl( this );
|
|
}
|
|
|
|
|
|
void InsetUrl::edit(BufferView * bv, bool)
|
|
{
|
|
edit(bv, 0, 0, 0);
|
|
}
|
|
|
|
|
|
string const InsetUrl::getScreenLabel(Buffer const *) const
|
|
{
|
|
string temp;
|
|
if (getCmdName() == "url" )
|
|
temp = _("Url: ");
|
|
else
|
|
temp = _("HtmlUrl: ");
|
|
|
|
if (!getOptions().empty())
|
|
temp += getOptions();
|
|
else
|
|
temp += getContents();
|
|
|
|
return temp;
|
|
}
|
|
|
|
|
|
int InsetUrl::latex(Buffer const *, ostream & os,
|
|
bool fragile, bool /*free_spc*/) const
|
|
{
|
|
if (!getOptions().empty())
|
|
os << getOptions() + ' ';
|
|
if (fragile)
|
|
os << "\\protect";
|
|
os << "\\url{" << getContents() << '}';
|
|
return 0;
|
|
}
|
|
|
|
|
|
int InsetUrl::ascii(Buffer const *, ostream & os, int) const
|
|
{
|
|
if (getOptions().empty())
|
|
os << "[" << getContents() << "]";
|
|
else
|
|
os << "[" << getContents() << "||" << getOptions() << "]";
|
|
return 0;
|
|
}
|
|
|
|
|
|
int InsetUrl::linuxdoc(Buffer const *, ostream & os) const
|
|
{
|
|
os << "<" << getCmdName()
|
|
<< " url=\"" << getContents() << "\""
|
|
<< " name=\"" << getOptions() << "\">";
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
int InsetUrl::DocBook(Buffer const *, ostream & os) const
|
|
{
|
|
os << "<ulink url=\"" << getContents() << "\">"
|
|
<< getOptions() << "</ulink>";
|
|
return 0;
|
|
}
|
|
|
|
|
|
void InsetUrl::validate(LaTeXFeatures & features) const
|
|
{
|
|
features.url = true;
|
|
}
|