The huge URL patch:

- rename the lfun to href-insert.png
- rename the files to Hyperlink...
- the former URLUi produces now \href commands (hyperref)

Only missing thing is the lyx2lyx conversion routine - this will be done by Richard

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-10-13 19:06:09 +00:00
parent 3b0bfc4c52
commit 7075eaadef
33 changed files with 200 additions and 196 deletions

View File

@ -1,6 +1,10 @@
LyX file-format changes
-----------------------
2007-10-12 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 295: get rid of the htmlurl command that was
needed for docbook, add the option to create a hyperlink instead
2007-10-12 Pavel Sanda <ps@twin.jikos.cz>
* Format incremented to 294: PDFOptions: add usetitle,
fix leftovers

View File

@ -770,6 +770,7 @@ src_frontends_qt4_header_files = Split('''
GuiFontLoader.h
GuiGraphics.h
GuiGraphicsUi.h
GuiHyperlink.h
GuiImage.h
GuiImplementation.h
GuiInclude.h
@ -802,7 +803,6 @@ src_frontends_qt4_header_files = Split('''
GuiToc.h
GuiToolbar.h
GuiToolbars.h
GuiURL.h
GuiView.h
GuiViewSource.h
GuiVSpace.h
@ -859,6 +859,7 @@ src_frontends_qt4_files = Split('''
GuiFontLoader.cpp
GuiFontMetrics.cpp
GuiGraphics.cpp
GuiHyperlink.cpp
GuiImage.cpp
GuiImplementation.cpp
GuiInclude.cpp
@ -891,7 +892,6 @@ src_frontends_qt4_files = Split('''
GuiToc.cpp
GuiToolbar.cpp
GuiToolbars.cpp
GuiURL.cpp
GuiView.cpp
GuiViewSource.cpp
GuiVSpace.cpp
@ -943,6 +943,7 @@ src_frontends_qt4_ui_files = Split('''
FloatUi.ui
FontUi.ui
GraphicsUi.ui
HyperlinkUi.ui
IncludeUi.ui
IndexUi.ui
LaTeXUi.ui
@ -988,7 +989,6 @@ src_frontends_qt4_ui_files = Split('''
TextLayoutUi.ui
ThesaurusUi.ui
TocUi.ui
URLUi.ui
VSpaceUi.ui
ViewSourceUi.ui
WrapUi.ui
@ -1027,6 +1027,7 @@ src_insets_header_files = Split('''
InsetGraphics.h
InsetGraphicsParams.h
InsetHFill.h
InsetHyperlink.h
InsetInclude.h
InsetIndex.h
InsetInfo.h
@ -1047,7 +1048,6 @@ src_insets_header_files = Split('''
InsetTOC.h
InsetTabular.h
InsetText.h
InsetUrl.h
InsetVSpace.h
InsetWrap.h
MailInset.h
@ -1083,6 +1083,7 @@ src_insets_files = Split('''
InsetGraphics.cpp
InsetGraphicsParams.cpp
InsetHFill.cpp
InsetHyperlink.cpp
InsetInclude.cpp
InsetIndex.cpp
InsetInfo.cpp
@ -1103,7 +1104,6 @@ src_insets_files = Split('''
InsetTOC.cpp
InsetTabular.cpp
InsetText.cpp
InsetUrl.cpp
InsetVSpace.cpp
InsetWrap.cpp
MailInset.cpp
@ -1434,6 +1434,7 @@ lib_images_files = Split('''
font-noun.png
font-sans.png
footnote-insert.png
href-insert.png
index-insert.png
label-insert.png
layout-document.png
@ -1496,7 +1497,6 @@ lib_images_files = Split('''
undo.png
unknown.png
up.png
url-insert.png
''')

View File

@ -296,6 +296,7 @@ dist_images_DATA = \
images/font-noun.png \
images/font-sans.png \
images/footnote-insert.png \
images/href-insert.png \
images/index-insert.png \
images/label-insert.png \
images/layout.png \
@ -357,8 +358,7 @@ dist_images_DATA = \
images/toolbar-toggle_table.png \
images/undo.png \
images/unknown.png \
images/up.png \
images/url-insert.png
images/up.png
imagesmathdir = $(imagesdir)/math
dist_imagesmath_DATA = \

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
("1_3", [221], minor_versions("1.3" , 7)),
("1_4", range(222,246), minor_versions("1.4" , 5)),
("1_5", range(246,277), minor_versions("1.5" , 2)),
("1_6", range(277,295), minor_versions("1.6" , 0))] # Pavel pdfoptions
("1_6", range(277,296), minor_versions("1.6" , 0))] # Uwe: htmlurl, href
def formats_list():

View File

@ -508,6 +508,32 @@ def revert_pdf_options_2(document):
document.header[i] = ''.join(values)
def convert_htmlurl(document):
'Convert "htmlurl" and "url" to "href" insets'
i = 0
while True:
i = find_token(document.body, "LatexCommand htmlurl", i)
if i == -1:
return
document.body[i] = "LatexCommand href"
i = find_token(document.body, "LatexCommand url", i)
if i == -1:
return
document.body[i] = "LatexCommand href"
i = i + 1
def revert_href(document):
'Reverts hyperlink insets (href) to url insets (url)'
i = 0
while True:
i = find_token(document.body, "LatexCommand href", i)
if i == -1:
return
document.body[i] = "LatexCommand url"
i = i + 1
##
# Conversion hub
#
@ -530,10 +556,12 @@ convert = [[277, [fix_wrong_tables]],
[291, []],
[292, []],
[293, []],
[294, [convert_pdf_options]]
[294, [convert_pdf_options]],
[295, [convert_htmlurl]]
]
revert = [[293, [revert_pdf_options_2]],
revert = [[294, [revert_href]],
[293, [revert_pdf_options_2]],
[292, [revert_inset_info]],
[291, [revert_japanese, revert_japanese_encoding]],
[290, [revert_vietnamese]],

View File

@ -310,7 +310,7 @@ Menuset
Separator
Item "Table...|T" "tabular-insert"
Item "Graphics...|G" "dialog-show-new-inset graphics"
Item "URL...|U" "url-insert"
Item "Hyperlink|y" "href-insert"
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
Item "Short Title|S" "optional-insert"

View File

@ -101,7 +101,7 @@ ToolbarSet
Item "Insert footnote" "footnote-insert"
Item "Insert margin note" "marginalnote-insert"
Item "Insert note" "note-insert"
Item "Insert URL" "url-insert"
Item "Insert Hyperlink" "href-insert"
Item "Insert TeX code" "ert-insert"
Item "Include file" "dialog-show-new-inset include"
Separator

View File

@ -154,7 +154,7 @@ namespace fs = boost::filesystem;
namespace {
int const LYX_FORMAT = 294; //pavel pdfoptions
int const LYX_FORMAT = 295; //Uwe: htmlurl, href
} // namespace anon

View File

@ -1168,7 +1168,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
// * Has to be loaded before the "LyX specific LaTeX commands" to
// avoid errors with algorithm floats.
odocstringstream oss;
pdfoptions().writeLaTeX(oss);
// use hyperref explicitely when it is required
pdfoptions().writeLaTeX(oss, features.isRequired("hyperref"));
lyxpreamble += oss.str();
// this might be useful...

View File

@ -436,7 +436,6 @@ char const * simplefeatures[] = {
"txfonts",
"mathrsfs",
"ascii",
"url",
};
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);

View File

@ -184,7 +184,6 @@ void LyXAction::init()
{ LFUN_FOOTNOTE_INSERT, "footnote-insert", Noop },
{ LFUN_HFILL_INSERT, "hfill-insert", Noop },
{ LFUN_HELP_OPEN, "help-open", NoBuffer | Argument},
{ LFUN_HTML_INSERT, "html-insert", Noop },
{ LFUN_HYPHENATION_POINT_INSERT, "hyphenation-point-insert", Noop },
{ LFUN_LIGATURE_BREAK_INSERT, "ligature-break-insert", Noop },
{ LFUN_INDEX_INSERT, "index-insert", Noop },
@ -295,7 +294,6 @@ void LyXAction::init()
{ LFUN_UNDO, "undo", Noop },
{ LFUN_UP, "up", ReadOnly | NoUpdate},
{ LFUN_UP_SELECT, "up-select", ReadOnly | SingleParUpdate },
{ LFUN_URL_INSERT, "url-insert", Noop },
{ LFUN_VC_CHECK_IN, "vc-check-in", ReadOnly },
{ LFUN_VC_CHECK_OUT, "vc-check-out", ReadOnly },
{ LFUN_VC_REGISTER, "vc-register", ReadOnly },
@ -331,6 +329,7 @@ void LyXAction::init()
{ LFUN_DIALOG_HIDE, "dialog-hide", NoBuffer },
{ LFUN_DIALOG_TOGGLE, "dialog-toggle", NoBuffer },
{ LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset", Noop },
{ LFUN_HYPERLINK_INSERT, "href-insert", Noop },
{ LFUN_INSET_APPLY, "inset-apply", Noop },
{ LFUN_INSET_DISSOLVE, "inset-dissolve", Noop },
{ LFUN_INSET_INSERT, "inset-insert", Noop },

View File

@ -1401,7 +1401,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
name == "nomenclature" ||
name == "ref" ||
name == "toc" ||
name == "url") {
name == "href") {
InsetCommandParams p(name);
data = InsetCommandMailer::params2string(name, p);
} else if (name == "include") {

View File

@ -520,6 +520,8 @@ liblyxinsets_la_SOURCES = \
insets/InsetGraphics.h \
insets/InsetHFill.cpp \
insets/InsetHFill.h \
insets/InsetHyperlink.cpp \
insets/InsetHyperlink.h \
insets/InsetInclude.cpp \
insets/InsetInclude.h \
insets/InsetIndex.cpp \
@ -560,8 +562,6 @@ liblyxinsets_la_SOURCES = \
insets/InsetText.h \
insets/InsetTOC.cpp \
insets/InsetTOC.h \
insets/InsetUrl.cpp \
insets/InsetUrl.h \
insets/InsetVSpace.cpp \
insets/InsetVSpace.h \
insets/InsetWrap.h \

View File

@ -86,9 +86,9 @@ void PDFOptions::writeFile(ostream & os) const
os << "\\pdf_quoted_options \"" << quoted_options << "\"\n";
}
void PDFOptions::writeLaTeX(odocstringstream &os) const
void PDFOptions::writeLaTeX(odocstringstream &os, bool hyper_required) const
{
if (!use_hyperref)
if (!use_hyperref && !hyper_required)
return;
string opt;

View File

@ -28,7 +28,7 @@ public:
/// output to lyx header
void writeFile(std::ostream &) const;
/// output to tex header
void writeLaTeX(odocstringstream &) const;
void writeLaTeX(odocstringstream &, bool hyper_required) const;
/// read tokens from lyx header
std::string readToken(Lexer &lex, std::string const & token);
/// set implicit settings for hyperref

View File

@ -808,7 +808,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
if ((inset->lyxCode() == GRAPHICS_CODE
|| inset->lyxCode() == MATH_CODE
|| inset->lyxCode() == URL_CODE)
|| inset->lyxCode() == HYPERLINK_CODE)
&& running_font.isRightToLeft()) {
if (running_font.language()->lang() == "farsi")
os << "\\beginL{}";

View File

@ -1060,8 +1060,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break;
}
case LFUN_URL_INSERT: {
InsetCommandParams p("url");
case LFUN_HYPERLINK_INSERT: {
InsetCommandParams p("href");
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
@ -1069,28 +1069,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
p["target"] = (cmd.argument().empty()) ?
content : cmd.argument();
string const data = InsetCommandMailer::params2string("url", p);
string const data = InsetCommandMailer::params2string("href", p);
if (p["target"].empty()) {
bv->showInsetDialog("url", data, 0);
} else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
}
break;
}
case LFUN_HTML_INSERT: {
InsetCommandParams p("htmlurl");
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
cutSelection(cur, true, false);
}
p["target"] = (cmd.argument().empty()) ?
content : cmd.argument();
string const data = InsetCommandMailer::params2string("url", p);
if (p["target"].empty()) {
bv->showInsetDialog("url", data, 0);
bv->showInsetDialog("href", data, 0);
} else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
@ -1637,6 +1618,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
code = FLOAT_CODE;
else if (cmd.argument() == "graphics")
code = GRAPHICS_CODE;
else if (cmd.argument() == "href")
code = HYPERLINK_CODE;
else if (cmd.argument() == "include")
code = INCLUDE_CODE;
else if (cmd.argument() == "index")
@ -1651,8 +1634,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
code = REF_CODE;
else if (cmd.argument() == "toc")
code = TOC_CODE;
else if (cmd.argument() == "url")
code = URL_CODE;
else if (cmd.argument() == "vspace")
code = VSPACE_CODE;
else if (cmd.argument() == "wrap")
@ -1747,9 +1728,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_TOC_INSERT:
code = TOC_CODE;
break;
case LFUN_HTML_INSERT:
case LFUN_URL_INSERT:
code = URL_CODE;
case LFUN_HYPERLINK_INSERT:
code = HYPERLINK_CODE;
break;
case LFUN_QUOTE_INSERT:
// always allow this, since we will inset a raw quote

View File

@ -52,7 +52,7 @@
#include "insets/InsetSpace.h"
#include "insets/InsetTabular.h"
#include "insets/InsetTOC.h"
#include "insets/InsetUrl.h"
#include "insets/InsetHyperlink.h"
#include "insets/InsetVSpace.h"
#include "insets/InsetWrap.h"
@ -281,6 +281,12 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
inset->setParams(igp);
return inset.release();
} else if (name == "href") {
InsetCommandParams icp(name);
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()),
icp);
return new InsetHyperlink(icp);
} else if (name == "include") {
InsetCommandParams iip(name);
InsetIncludeMailer::string2params(to_utf8(cmd.argument()), iip);
@ -313,12 +319,6 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
icp);
return new InsetTOC(icp);
} else if (name == "url") {
InsetCommandParams icp(name);
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()),
icp);
return new InsetUrl(icp);
} else if (name == "vspace") {
VSpace vspace;
InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), vspace);
@ -407,14 +407,14 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
inset.reset(new InsetBibtex(inscmd));
} else if (insetType == "index") {
inset.reset(new InsetIndex(buf.params()));
} else if (insetType == "nomenclature") {
inset.reset(new InsetNomencl(inscmd));
} else if (insetType == "href") {
inset.reset(new InsetHyperlink(inscmd));
} else if (insetType == "include") {
inset.reset(new InsetInclude(inscmd));
} else if (insetType == "label") {
inset.reset(new InsetLabel(inscmd));
} else if (insetType == "url") {
inset.reset(new InsetUrl(inscmd));
} else if (insetType == "nomenclature") {
inset.reset(new InsetNomencl(inscmd));
} else if (insetType == "ref") {
if (!inscmd["name"].empty()
|| !inscmd["reference"].empty()) {

View File

@ -36,7 +36,7 @@ char const * const dialognames[] = {
"thesaurus",
#endif
"texinfo", "toc", "url", "view-source", "vspace", "wrap", "listings" };
"texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
@ -92,7 +92,7 @@ Dialog * createGuiTabular(LyXView & lv);
Dialog * createGuiTexInfo(LyXView & lv);
Dialog * createGuiToc(LyXView & lv);
Dialog * createGuiThesaurus(LyXView & lv);
Dialog * createGuiURL(LyXView & lv);
Dialog * createGuiHyperlink(LyXView & lv);
Dialog * createGuiVSpace(LyXView & lv);
Dialog * createGuiViewSource(LyXView & lv);
Dialog * createGuiWrap(LyXView & lv);
@ -185,8 +185,8 @@ Dialog * Dialogs::build(string const & name)
#endif
if (name == "toc")
return createGuiToc(lyxview_);
if (name == "url")
return createGuiURL(lyxview_);
if (name == "href")
return createGuiHyperlink(lyxview_);
if (name == "vspace")
return createGuiVSpace(lyxview_);
if (name == "wrap")

View File

@ -1,5 +1,5 @@
/**
* \file GuiURL.cpp
* \file GuiHyperlink.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -11,9 +11,8 @@
#include <config.h>
#include "GuiURL.h"
#include "GuiHyperlink.h"
#include "GuiURL.h"
#include "qt_helpers.h"
#include "FuncRequest.h"
#include "insets/InsetCommand.h"
@ -27,69 +26,58 @@
namespace lyx {
namespace frontend {
GuiURL::GuiURL(LyXView & lv)
: GuiCommand(lv, "url")
GuiHyperlink::GuiHyperlink(LyXView & lv)
: GuiCommand(lv, "href")
{
setupUi(this);
setViewTitle( _("URL"));
setViewTitle( _("Hyperlink"));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(urlED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
connect(hyperlinkCB, SIGNAL(clicked()),
this, SLOT(changed_adaptor()));
connect(nameED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
setFocusProxy(urlED);
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
bc().setOK(okPB);
bc().setCancel(closePB);
bc().addReadOnly(urlED);
bc().addReadOnly(nameED);
bc().addReadOnly(hyperlinkCB);
}
void GuiURL::changed_adaptor()
void GuiHyperlink::changed_adaptor()
{
changed();
}
void GuiURL::closeEvent(QCloseEvent * e)
void GuiHyperlink::closeEvent(QCloseEvent * e)
{
slotClose();
e->accept();
}
void GuiURL::updateContents()
void GuiHyperlink::updateContents()
{
urlED->setText(toqstr(params_["target"]));
nameED->setText(toqstr(params_["name"]));
hyperlinkCB->setChecked(params_.getCmdName() != "url");
bc().setValid(isValid());
}
void GuiURL::applyView()
void GuiHyperlink::applyView()
{
params_["target"] = qstring_to_ucs4(urlED->text());
params_["name"] = qstring_to_ucs4(nameED->text());
if (hyperlinkCB->isChecked())
params_.setCmdName("htmlurl");
else
params_.setCmdName("url");
params_.setCmdName("href");
}
bool GuiURL::isValid()
bool GuiHyperlink::isValid()
{
QString const u = urlED->text();
QString const n = nameED->text();
@ -98,11 +86,11 @@ bool GuiURL::isValid()
}
Dialog * createGuiURL(LyXView & lv) { return new GuiURL(lv); }
Dialog * createGuiHyperlink(LyXView & lv) { return new GuiHyperlink(lv); }
} // namespace frontend
} // namespace lyx
#include "GuiURL_moc.cpp"
#include "GuiHyperlink_moc.cpp"

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file GuiURL.h
* \file GuiHyperlink.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -10,22 +10,22 @@
* Full author contact details are available in file CREDITS.
*/
#ifndef GUIURL_H
#define GUIURL_H
#ifndef GUIHYPERLINK_H
#define GUIHYPERLINK_H
#include "GuiDialog.h"
#include "ui_URLUi.h"
#include "ui_HyperlinkUi.h"
#include "insets/InsetCommandParams.h"
namespace lyx {
namespace frontend {
class GuiURL : public GuiCommand, public Ui::URLUi
class GuiHyperlink : public GuiCommand, public Ui::HyperlinkUi
{
Q_OBJECT
public:
GuiURL(LyXView & lv);
GuiHyperlink(LyXView & lv);
public Q_SLOTS:
void changed_adaptor();
@ -43,4 +43,4 @@ private:
} // namespace frontend
} // namespace lyx
#endif // GUIURL_H
#endif // GUIHYPERLINK_H

View File

@ -87,6 +87,7 @@ SOURCEFILES = \
GuiFontLoader.cpp \
GuiFontMetrics.cpp \
GuiGraphics.cpp \
GuiHyperlink.cpp \
GuiImage.cpp \
GuiImplementation.cpp \
GuiInclude.cpp \
@ -119,7 +120,6 @@ SOURCEFILES = \
GuiToc.cpp \
GuiToolbar.cpp \
GuiToolbars.cpp \
GuiURL.cpp \
GuiView.cpp \
GuiViewSource.cpp \
GuiVSpace.cpp \
@ -177,6 +177,7 @@ MOCHEADER = \
GuiFloat.h \
GuiFontExample.h \
GuiGraphics.h \
GuiHyperlink.h \
GuiImplementation.h \
GuiInclude.h \
GuiIndex.h \
@ -205,7 +206,6 @@ MOCHEADER = \
GuiThesaurus.h \
GuiToc.h \
GuiToolbar.h \
GuiURL.h \
GuiView.h \
GuiViewSource.h \
GuiVSpace.h \
@ -246,6 +246,7 @@ UIFILES = \
FloatUi.ui \
FontUi.ui \
GraphicsUi.ui \
HyperlinkUi.ui \
IncludeUi.ui \
IndexUi.ui \
LanguageUi.ui \
@ -290,7 +291,6 @@ UIFILES = \
TextLayoutUi.ui \
ThesaurusUi.ui \
TocUi.ui \
URLUi.ui \
ViewSourceUi.ui \
VSpaceUi.ui \
WrapUi.ui

View File

@ -1,6 +1,6 @@
<ui version="4.0" >
<class>URLUi</class>
<widget class="QDialog" name="URLUi" >
<class>HyperlinkUi</class>
<widget class="QDialog" name="HyperlinkUi" >
<property name="geometry" >
<rect>
<x>0</x>
@ -16,10 +16,22 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>11</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>11</number>
</property>
<property name="rightMargin" >
<number>11</number>
</property>
<property name="bottomMargin" >
<number>11</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
@ -64,22 +76,21 @@
</item>
<item row="2" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="hyperlinkCB" >
<property name="toolTip" >
<string>Output as a hyperlink ?</string>
</property>
<property name="text" >
<string>&amp;Generate hyperlink</string>
</property>
</widget>
</item>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
@ -117,17 +128,15 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<tabstops>
<tabstop>urlED</tabstop>
<tabstop>nameED</tabstop>
<tabstop>hyperlinkCB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -63,8 +63,7 @@ static TranslatorMap const build_translator()
InsetName("toc", TOC_CODE),
InsetName("quote", QUOTE_CODE),
InsetName("ref", REF_CODE),
InsetName("url", URL_CODE),
InsetName("htmlurl", HTMLURL_CODE),
InsetName("href", HYPERLINK_CODE),
InsetName("separator", SEPARATOR_CODE),
InsetName("ending", ENDING_CODE),
InsetName("label", LABEL_CODE),

View File

@ -243,7 +243,7 @@ public:
/** This enum indicates by which means the inset can be modified:
- NOT_EDITABLE: the inset's content cannot be modified at all
(e.g. printindex, insetspecialchar)
- IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, url)
- IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, href)
- HIGHLY_EDITABLE: content can be edited on screen (normally means that
insettext is contained, e.g. collapsables, tabular) */
// FIXME: This has not yet been fully implemented to math insets

View File

@ -36,9 +36,7 @@ enum InsetCode {
///
REF_CODE,
///
URL_CODE, // 5
///
HTMLURL_CODE,
HYPERLINK_CODE, // 5
///
SEPARATOR_CODE,
///

View File

@ -114,6 +114,15 @@ InsetCommandParams::findInfo(std::string const & insetType)
return &info;
}
// InsetHyperlink
if (insetType == "href") {
static const char * const paramnames[] =
{"name", "target", ""};
static const bool isoptional[] = {true, false};
static const CommandInfo info = {2, paramnames, isoptional};
return &info;
}
// InsetInclude
//FIXME This is really correct only for lstinputlistings, but it shouldn't
//cause a problem before we get things sorted out. Eventually, this calls
@ -166,15 +175,6 @@ InsetCommandParams::findInfo(std::string const & insetType)
return &info;
}
// InsetUrl
if (insetType == "url") {
static const char * const paramnames[] =
{"name", "target", ""};
static const bool isoptional[] = {true, false};
static const CommandInfo info = {2, paramnames, isoptional};
return &info;
}
return 0;
}
@ -200,6 +200,8 @@ std::string InsetCommandParams::getDefaultCmd(std::string insetType) {
return "";
if (insetType == "hfill")
return "hfill";
if (insetType == "href")
return "href";
if (insetType == "include")
return "include";
if (insetType == "index")
@ -216,8 +218,6 @@ std::string InsetCommandParams::getDefaultCmd(std::string insetType) {
return "ref";
if (insetType == "toc")
return "tableofcontents";
if (insetType == "url")
return "url";
return "";
}

View File

@ -289,8 +289,13 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_ACCENT_UNDERBAR:
case LFUN_ACCENT_UNDERDOT:
case LFUN_APPENDIX:
case LFUN_BIBITEM_INSERT:
case LFUN_BOX_INSERT:
case LFUN_BRANCH_INSERT:
case LFUN_BREAK_LINE:
case LFUN_CAPTION_INSERT:
case LFUN_CLEARPAGE_INSERT:
case LFUN_CLEARDOUBLEPAGE_INSERT:
case LFUN_DEPTH_DECREMENT:
case LFUN_DEPTH_INCREMENT:
case LFUN_DOTS_INSERT:
@ -298,9 +303,10 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_ENVIRONMENT_INSERT:
case LFUN_ERT_INSERT:
case LFUN_FILE_INSERT:
case LFUN_FLEX_INSERT:
case LFUN_FLOAT_INSERT:
case LFUN_FLOAT_LIST:
case LFUN_FLOAT_WIDE_INSERT:
case LFUN_WRAP_INSERT:
case LFUN_FONT_BOLD:
case LFUN_FONT_TYPEWRITER:
case LFUN_FONT_DEFAULT:
@ -317,18 +323,16 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_FONT_UNDERLINE:
case LFUN_FOOTNOTE_INSERT:
case LFUN_HFILL_INSERT:
case LFUN_HTML_INSERT:
case LFUN_HYPERLINK_INSERT:
case LFUN_HYPHENATION_POINT_INSERT:
case LFUN_LIGATURE_BREAK_INSERT:
case LFUN_INDEX_INSERT:
case LFUN_INDEX_PRINT:
case LFUN_INSET_INSERT:
case LFUN_LABEL_GOTO:
case LFUN_LABEL_INSERT:
case LFUN_OPTIONAL_INSERT:
case LFUN_BIBITEM_INSERT:
case LFUN_LIGATURE_BREAK_INSERT:
case LFUN_LINE_INSERT:
case LFUN_PAGEBREAK_INSERT:
case LFUN_CLEARPAGE_INSERT:
case LFUN_CLEARDOUBLEPAGE_INSERT:
case LFUN_LANGUAGE:
case LFUN_LAYOUT:
case LFUN_LAYOUT_PARAGRAPH:
@ -340,37 +344,32 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_MATH_MODE:
case LFUN_MENU_OPEN:
case LFUN_MENU_SEPARATOR_INSERT:
case LFUN_BRANCH_INSERT:
case LFUN_FLEX_INSERT:
case LFUN_NOACTION:
case LFUN_NOMENCL_INSERT:
case LFUN_NOMENCL_PRINT:
case LFUN_NOTE_INSERT:
case LFUN_BOX_INSERT:
case LFUN_NOTE_NEXT:
case LFUN_OPTIONAL_INSERT:
case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_SPACING:
case LFUN_LABEL_GOTO:
case LFUN_PARAGRAPH_UPDATE:
case LFUN_REFERENCE_NEXT:
case LFUN_SPACE_INSERT:
case LFUN_SERVER_GOTO_FILE_ROW:
case LFUN_SERVER_NOTIFY:
case LFUN_SERVER_SET_XY:
case LFUN_SPACE_INSERT:
case LFUN_TABULAR_INSERT:
case LFUN_TOC_INSERT:
case LFUN_URL_INSERT:
case LFUN_FLOAT_LIST:
case LFUN_INSET_INSERT:
case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_UPDATE:
case LFUN_NOMENCL_INSERT:
case LFUN_NOMENCL_PRINT:
case LFUN_NOACTION:
case LFUN_WRAP_INSERT:
status.enabled(false);
return true;
case LFUN_QUOTE_INSERT:
case LFUN_CLIPBOARD_PASTE:
case LFUN_INSET_MODIFY:
case LFUN_PASTE:
case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE:
case LFUN_QUOTE_INSERT:
status.enabled(true);
return true;

View File

@ -1,5 +1,5 @@
/**
* \file InsetUrl.cpp
* \file InsetHyperlink.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -10,7 +10,7 @@
#include <config.h>
#include "InsetUrl.h"
#include "InsetHyperlink.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
@ -31,21 +31,19 @@ using std::string;
using std::ostream;
InsetUrl::InsetUrl(InsetCommandParams const & p)
: InsetCommand(p, "url")
InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
: InsetCommand(p, "href")
{}
docstring const InsetUrl::getScreenLabel(Buffer const &) const
docstring const InsetHyperlink::getScreenLabel(Buffer const &) const
{
docstring const temp =
(getCmdName() == "url") ? _("Url: ") : _("HtmlUrl: ");
docstring const temp = from_ascii("Hyperlink: ");
docstring url;
if (!getParam("name").empty())
url += getParam("name");
else
url += getParam("name");
if (url.empty())
url += getParam("target");
// elide if long
@ -57,20 +55,22 @@ docstring const InsetUrl::getScreenLabel(Buffer const &) const
}
int InsetUrl::latex(Buffer const &, odocstream & os,
int InsetHyperlink::latex(Buffer const &, odocstream & os,
OutputParams const & runparams) const
{
docstring const & name = getParam("name");
if (!name.empty())
os << name + ' ';
if (runparams.moving_arg)
os << "\\protect";
os << "\\url{" << getParam("target") << '}';
//set the target for the name when no name is given
if (!getParam("name").empty())
os << "\\href{" << getParam("target") << "}{" << getParam("name") << '}';
else
os << "\\href{" << getParam("target") << "}{" << getParam("target") << '}';
return 0;
}
int InsetUrl::plaintext(Buffer const &, odocstream & os,
int InsetHyperlink::plaintext(Buffer const &, odocstream & os,
OutputParams const &) const
{
odocstringstream oss;
@ -87,7 +87,7 @@ int InsetUrl::plaintext(Buffer const &, odocstream & os,
}
int InsetUrl::docbook(Buffer const &, odocstream & os,
int InsetHyperlink::docbook(Buffer const &, odocstream & os,
OutputParams const &) const
{
os << "<ulink url=\""
@ -99,16 +99,16 @@ int InsetUrl::docbook(Buffer const &, odocstream & os,
}
int InsetUrl::textString(Buffer const & buf, odocstream & os,
int InsetHyperlink::textString(Buffer const & buf, odocstream & os,
OutputParams const & op) const
{
return plaintext(buf, os, op);
}
void InsetUrl::validate(LaTeXFeatures & features) const
void InsetHyperlink::validate(LaTeXFeatures & features) const
{
features.require("url");
features.require("hyperref");
}

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file InsetUrl.h
* \file InsetHyperlink.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -9,8 +9,8 @@
* Full author contact details are available in file CREDITS.
*/
#ifndef INSET_URL_H
#define INSET_URL_H
#ifndef INSET_HYPERLINK_H
#define INSET_HYPERLINK_H
#include "InsetCommand.h"
@ -20,15 +20,15 @@ namespace lyx {
class LaTeXFeatures;
/** The url inset
/** The hyperlink inset
*/
class InsetUrl : public InsetCommand {
class InsetHyperlink : public InsetCommand {
public:
///
explicit
InsetUrl(InsetCommandParams const &);
InsetHyperlink(InsetCommandParams const &);
///
InsetCode lyxCode() const { return URL_CODE; }
InsetCode lyxCode() const { return HYPERLINK_CODE; }
///
void validate(LaTeXFeatures &) const;
///
@ -51,7 +51,7 @@ public:
OutputParams const &) const;
private:
virtual Inset * clone() const {
return new InsetUrl(params());
return new InsetHyperlink(params());
}
};

View File

@ -256,8 +256,7 @@ enum kb_action {
LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR, // ARRae 971202
// 170
LFUN_BUFFER_CHKTEX, // Asger 971030
LFUN_HTML_INSERT, // CFO-G 971121; must co-exist with URL_INSERT as of 20060905
LFUN_URL_INSERT, // CFO-G 971121
LFUN_HYPERLINK_INSERT, // CFO-G 971121
LFUN_WORD_FIND_FORWARD, // Etienne 980216
LFUN_WORD_FIND_BACKWARD, // Etienne 980220
// 175

View File

@ -105,8 +105,9 @@ string parse_text_snippet(Parser & p, unsigned flags, const bool outer,
}
char const * const known_latex_commands[] = { "ref", "cite", "label", "index",
"printindex", "pageref", "url", "vref", "vpageref", "prettyref", "eqref", 0 };
char const * const known_latex_commands[] = { "ref", "cite", "label", "href",
"index", "printindex", "pageref", "url", "vref", "vpageref", "prettyref",
"eqref", 0 };
/*!
* natbib commands.