mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Added html export for LinuxDoc and DocBook. LinuxDoc import now available in file menus.
The LinuxDoc and DocBook export now are controled by lyxrc flags. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@623 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
90343c7ade
commit
91a2ea274e
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2000-03-20 José Abílio Matos <jamatos@lyx.org>
|
||||||
|
|
||||||
|
* src/lyxrc.[Ch] Removed \sgml_extra_options, added 6 other flags
|
||||||
|
for linuxdoc and docbook import and export format options.
|
||||||
|
|
||||||
|
* lib/lyxrc.example Example of default values for the previous flags.
|
||||||
|
|
||||||
|
* src/lyx_cb.C Use those flags instead of the hardwired values for
|
||||||
|
linuxdoc and docbook export.
|
||||||
|
|
||||||
|
* src/lyxfunc.[Ch] Added HTML export for linuxdoc and docbook, added
|
||||||
|
linuxdoc import.
|
||||||
|
|
||||||
|
* src/menus.C Added menus entries for the new import/exports formats.
|
||||||
|
|
||||||
2000-03-09 André Pönitz <poenitz@mathematik.tu-chemnitz.de>
|
2000-03-09 André Pönitz <poenitz@mathematik.tu-chemnitz.de>
|
||||||
|
|
||||||
* src/lyxrc.*: Added support for running without Gui
|
* src/lyxrc.*: Added support for running without Gui
|
||||||
|
@ -150,11 +150,6 @@
|
|||||||
# Example: use this to let math be italic with tth.
|
# Example: use this to let math be italic with tth.
|
||||||
#\html_command "tth -t -i < '$$FName' > '$$OutName'"
|
#\html_command "tth -t -i < '$$FName' > '$$OutName'"
|
||||||
|
|
||||||
# If you want to pass extra flags to the LinuxDoc sgml scripts, insert them
|
|
||||||
# here.
|
|
||||||
# Example: the next line activates iso-latin1 support:
|
|
||||||
#\sgml_extra_options -l
|
|
||||||
|
|
||||||
# Keyboard Mapping. Use this to set the correct mapping file for your
|
# Keyboard Mapping. Use this to set the correct mapping file for your
|
||||||
# keyboard, that is if you need one. You'll need one if you for instance
|
# keyboard, that is if you need one. You'll need one if you for instance
|
||||||
# want to type German documents on an American keyboard. In that case,
|
# want to type German documents on an American keyboard. In that case,
|
||||||
@ -460,6 +455,36 @@
|
|||||||
#\font_encoding default
|
#\font_encoding default
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# LINUXDOC SECTION #######################################################
|
||||||
|
#
|
||||||
|
|
||||||
|
# If you want to pass extra flags to the LinuxDoc sgml scripts, insert them
|
||||||
|
# here.
|
||||||
|
# Example: the next line activates iso-latin1 support:
|
||||||
|
#\linuxdoc_to_latex_command "sgml2latex -c latin"
|
||||||
|
|
||||||
|
# Here you have the command to convert from linuxdoc to html.
|
||||||
|
# Example: one html file only.
|
||||||
|
#\linuxdoc_to_html_command "sgml2html -s 0"
|
||||||
|
|
||||||
|
# The LinuxDoc to LyX converter
|
||||||
|
#\linuxdoc_to_lyx_command "sgml2lyx"
|
||||||
|
|
||||||
|
#
|
||||||
|
# DOCBOOK SECTION ########################################################
|
||||||
|
#
|
||||||
|
|
||||||
|
# Command to convert a docbook file to dvi
|
||||||
|
#\docbook_to_dvi_command "sgmltools -b dvi"
|
||||||
|
|
||||||
|
# Command to convert a docbook file to html
|
||||||
|
#\docbook_to_html_command "sgmltools -b html"
|
||||||
|
|
||||||
|
# Command to convert a docbook file to pdf
|
||||||
|
#\docbook_to_pdf_command ""
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# FILE SECTION ##########################################################
|
# FILE SECTION ##########################################################
|
||||||
#
|
#
|
||||||
|
69
src/lyx_cb.C
69
src/lyx_cb.C
@ -11,6 +11,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
using std::copy;
|
using std::copy;
|
||||||
@ -947,6 +948,57 @@ void MenuMakeHTML(Buffer * buffer)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuMakeHTML_LinuxDoc(Buffer * buffer)
|
||||||
|
{
|
||||||
|
// First, create LinuxDoc file
|
||||||
|
MenuMakeLinuxDoc(buffer);
|
||||||
|
|
||||||
|
// And now, run the converter
|
||||||
|
string file = buffer->fileName();
|
||||||
|
|
||||||
|
string result = ChangeExtension(file, ".html", false);
|
||||||
|
string infile = ChangeExtension(file, ".sgml", false);
|
||||||
|
string tmp = lyxrc.linuxdoc_to_html_command;
|
||||||
|
tmp = subst(tmp, "$$FName", infile);
|
||||||
|
tmp = subst(tmp, "$$OutName", result);
|
||||||
|
Systemcalls one;
|
||||||
|
int res = one.startscript(Systemcalls::System, tmp);
|
||||||
|
if (res == 0) {
|
||||||
|
ShowMessage(buffer,_("Document exported as HTML to file `")
|
||||||
|
+ MakeDisplayPath(result) +'\'');
|
||||||
|
} else {
|
||||||
|
ShowMessage(buffer,_("Unable to convert to HTML the file `")
|
||||||
|
+ MakeDisplayPath(infile)
|
||||||
|
+ '\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuMakeHTML_DocBook(Buffer * buffer)
|
||||||
|
{
|
||||||
|
// First, create LaTeX file
|
||||||
|
MenuMakeDocBook(buffer);
|
||||||
|
|
||||||
|
// And now, run the converter
|
||||||
|
string file = buffer->fileName();
|
||||||
|
string result = ChangeExtension(file, ".html", false);
|
||||||
|
string infile = ChangeExtension(file, ".sgml", false);
|
||||||
|
string tmp = lyxrc.docbook_to_html_command;
|
||||||
|
tmp = subst(tmp, "$$FName", infile);
|
||||||
|
tmp = subst(tmp, "$$OutName", result);
|
||||||
|
Systemcalls one;
|
||||||
|
int res = one.startscript(Systemcalls::System, tmp);
|
||||||
|
if (res == 0) {
|
||||||
|
ShowMessage(buffer,_("Document exported as HTML to file `")
|
||||||
|
+ MakeDisplayPath(result) +'\'');
|
||||||
|
} else {
|
||||||
|
ShowMessage(buffer,_("Unable to convert to HTML the file `")
|
||||||
|
+ MakeDisplayPath(infile)
|
||||||
|
+ '\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MenuExport(Buffer * buffer, string const & extyp)
|
void MenuExport(Buffer * buffer, string const & extyp)
|
||||||
{
|
{
|
||||||
// latex
|
// latex
|
||||||
@ -996,6 +1048,14 @@ void MenuExport(Buffer * buffer, string const & extyp)
|
|||||||
else if (extyp == "html") {
|
else if (extyp == "html") {
|
||||||
MenuMakeHTML(buffer);
|
MenuMakeHTML(buffer);
|
||||||
}
|
}
|
||||||
|
// HTML from linuxdoc
|
||||||
|
else if (extyp == "html-linuxdoc") {
|
||||||
|
MenuMakeHTML_LinuxDoc(buffer);
|
||||||
|
}
|
||||||
|
// HTML from docbook
|
||||||
|
else if (extyp == "html-docbook") {
|
||||||
|
MenuMakeHTML_DocBook(buffer);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ShowMessage(buffer, _("Unknown export type: ") + extyp);
|
ShowMessage(buffer, _("Unknown export type: ") + extyp);
|
||||||
}
|
}
|
||||||
@ -1327,15 +1387,13 @@ int RunLinuxDoc(BufferView * bv, int flag, string const & filename)
|
|||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 0: /* TeX output asked */
|
case 0: /* TeX output asked */
|
||||||
bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to TeX file..."));
|
bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to TeX file..."));
|
||||||
s2 = "sgml2latex " + add_flags + " -o tex "
|
s2 = lyxrc.linuxdoc_to_latex_command + ' ' + add_flags + " -o tex " + ' ' + name;
|
||||||
+ lyxrc.sgml_extra_options + ' ' + name;
|
|
||||||
if (one.startscript(Systemcalls::System, s2))
|
if (one.startscript(Systemcalls::System, s2))
|
||||||
errorcode = 1;
|
errorcode = 1;
|
||||||
break;
|
break;
|
||||||
case 1: /* dvi output asked */
|
case 1: /* dvi output asked */
|
||||||
bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to dvi file..."));
|
bv->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to dvi file..."));
|
||||||
s2 = "sgml2latex " + add_flags + " -o dvi "
|
s2 = lyxrc.linuxdoc_to_latex_command + ' ' + add_flags + " -o dvi " + ' ' + name;
|
||||||
+ lyxrc.sgml_extra_options + ' ' + name;
|
|
||||||
if (one.startscript(Systemcalls::System, s2)) {
|
if (one.startscript(Systemcalls::System, s2)) {
|
||||||
errorcode = 1;
|
errorcode = 1;
|
||||||
} else
|
} else
|
||||||
@ -1372,6 +1430,7 @@ int RunDocBook(int flag, string const & filename)
|
|||||||
current_view->buffer()->makeDocBookFile(name, 0);
|
current_view->buffer()->makeDocBookFile(name, 0);
|
||||||
|
|
||||||
// Shall this code go or should it stay? (Lgb)
|
// Shall this code go or should it stay? (Lgb)
|
||||||
|
// This code is a placeholder for future implementation. (Jose')
|
||||||
// string add_flags;
|
// string add_flags;
|
||||||
// LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
|
// LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
|
||||||
// switch (ps) {
|
// switch (ps) {
|
||||||
@ -1387,7 +1446,7 @@ int RunDocBook(int flag, string const & filename)
|
|||||||
case 1: /* dvi output asked */
|
case 1: /* dvi output asked */
|
||||||
{
|
{
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Converting DocBook SGML to dvi file..."));
|
current_view->owner()->getMiniBuffer()->Set(_("Converting DocBook SGML to dvi file..."));
|
||||||
string s2 = "sgmltools --backend dvi " + name;
|
string s2 = lyxrc.docbook_to_dvi_command + ' ' + name;
|
||||||
if (one.startscript(Systemcalls::System, s2)) {
|
if (one.startscript(Systemcalls::System, s2)) {
|
||||||
errorcode = 1;
|
errorcode = 1;
|
||||||
} else
|
} else
|
||||||
|
@ -356,12 +356,18 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
case LFUN_IMPORT:
|
case LFUN_IMPORT:
|
||||||
if (argument == "latex")
|
if (argument == "latex")
|
||||||
disable = lyxrc.relyx_command == "none";
|
disable = lyxrc.relyx_command == "none";
|
||||||
|
if (argument == "linuxdoc")
|
||||||
|
disable = lyxrc.linuxdoc_to_lyx_command == "none";
|
||||||
break;
|
break;
|
||||||
case LFUN_EXPORT:
|
case LFUN_EXPORT:
|
||||||
if (argument == "dvi" || argument == "postscript")
|
if (argument == "dvi" || argument == "postscript")
|
||||||
disable = noLaTeX;
|
disable = noLaTeX;
|
||||||
if (argument == "html")
|
if (argument == "html")
|
||||||
disable = lyxrc.html_command == "none";
|
disable = lyxrc.html_command == "none";
|
||||||
|
if (argument == "html-linuxdoc")
|
||||||
|
disable = lyxrc.linuxdoc_to_html_command == "none";
|
||||||
|
if (argument == "html-docbook")
|
||||||
|
disable = lyxrc.docbook_to_html_command == "none";
|
||||||
break;
|
break;
|
||||||
case LFUN_UNDO:
|
case LFUN_UNDO:
|
||||||
disable = buf->undostack.empty();
|
disable = buf->undostack.empty();
|
||||||
@ -769,6 +775,8 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
// noweb
|
// noweb
|
||||||
} else if (imtyp == "noweb") {
|
} else if (imtyp == "noweb") {
|
||||||
doImportLaTeX(true);
|
doImportLaTeX(true);
|
||||||
|
} else if (imtyp == "linuxdoc") {
|
||||||
|
doImportLinuxDoc();
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage(string(N_("Unknown import type: "))
|
setErrorMessage(string(N_("Unknown import type: "))
|
||||||
+ imtyp);
|
+ imtyp);
|
||||||
@ -2922,6 +2930,95 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXFunc::doImportLinuxDoc()
|
||||||
|
{
|
||||||
|
string initpath = lyxrc.document_path;
|
||||||
|
LyXFileDlg fileDlg;
|
||||||
|
|
||||||
|
if (owner->view()->available()) {
|
||||||
|
string trypath = owner->buffer()->filepath;
|
||||||
|
// If directory is writeable, use this as default.
|
||||||
|
if (IsDirWriteable(trypath) == 1)
|
||||||
|
initpath = trypath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// launches dialog
|
||||||
|
ProhibitInput();
|
||||||
|
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
||||||
|
fileDlg.SetButton(1, _("Examples"),
|
||||||
|
AddPath(system_lyxdir, "examples"));
|
||||||
|
|
||||||
|
string filename = fileDlg.Select(_("Select LinuxDoc file to Import"),
|
||||||
|
initpath, "*.sgml");
|
||||||
|
|
||||||
|
AllowInput();
|
||||||
|
|
||||||
|
// check selected filename
|
||||||
|
if (filename.empty()) {
|
||||||
|
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get absolute path of file
|
||||||
|
filename = MakeAbsPath(filename);
|
||||||
|
|
||||||
|
// Check if the document already is open
|
||||||
|
string LyXfilename = ChangeExtension(filename, ".lyx", false);
|
||||||
|
if (bufferlist.exists(LyXfilename)){
|
||||||
|
switch(AskConfirmation(_("Document is already open:"),
|
||||||
|
MakeDisplayPath(LyXfilename, 50),
|
||||||
|
_("Do you want to close that document now?\n"
|
||||||
|
"('No' will just switch to the open version)")))
|
||||||
|
{
|
||||||
|
case 1: // Yes: close the document
|
||||||
|
if (!bufferlist.close(bufferlist.getBuffer(LyXfilename)))
|
||||||
|
// If close is canceled, we cancel here too.
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
case 2: // No: switch to the open document
|
||||||
|
owner->view()->buffer(
|
||||||
|
bufferlist.getBuffer(LyXfilename));
|
||||||
|
return;
|
||||||
|
case 3: // Cancel: Do nothing
|
||||||
|
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a LyX document by the same root exists in filesystem
|
||||||
|
FileInfo f(LyXfilename, true);
|
||||||
|
if (f.exist() && !AskQuestion(_("A document by the name"),
|
||||||
|
MakeDisplayPath(LyXfilename),
|
||||||
|
_("already exists. Overwrite?"))) {
|
||||||
|
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// loads document
|
||||||
|
owner->getMiniBuffer()->Set(_("Importing LinuxDoc file"),
|
||||||
|
MakeDisplayPath(filename), "...");
|
||||||
|
|
||||||
|
// run sgml2lyx
|
||||||
|
string tmp = lyxrc.linuxdoc_to_lyx_command + filename;
|
||||||
|
Systemcalls one;
|
||||||
|
Buffer * buf = 0;
|
||||||
|
|
||||||
|
int result = one.startscript(Systemcalls::System, tmp);
|
||||||
|
if (result == 0) {
|
||||||
|
string filename = ChangeExtension(filename, ".lyx", false);
|
||||||
|
// File was generated without problems. Load it.
|
||||||
|
buf = bufferlist.loadLyXFile(filename);
|
||||||
|
owner->view()->buffer(buf);
|
||||||
|
owner->getMiniBuffer()->Set(_("LinuxDoc file "),
|
||||||
|
MakeDisplayPath(filename),
|
||||||
|
_("imported."));
|
||||||
|
} else {
|
||||||
|
owner->getMiniBuffer()->Set(_("Could not import LinuxDoc file"),
|
||||||
|
MakeDisplayPath(filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXFunc::MenuInsertLyXFile(string const & filen)
|
void LyXFunc::MenuInsertLyXFile(string const & filen)
|
||||||
{
|
{
|
||||||
string filename = filen;
|
string filename = filen;
|
||||||
|
@ -114,6 +114,9 @@ private:
|
|||||||
///
|
///
|
||||||
void doImportASCII(bool);
|
void doImportASCII(bool);
|
||||||
|
|
||||||
|
///
|
||||||
|
void doImportLinuxDoc();
|
||||||
|
|
||||||
///
|
///
|
||||||
void MenuInsertLyXFile(string const &);
|
void MenuInsertLyXFile(string const &);
|
||||||
|
|
||||||
|
74
src/lyxrc.C
74
src/lyxrc.C
@ -86,7 +86,6 @@ enum LyXRCTags {
|
|||||||
RC_SCREEN_FONT_ENCODING,
|
RC_SCREEN_FONT_ENCODING,
|
||||||
RC_SCREEN_FONT_ENCODING_MENU,
|
RC_SCREEN_FONT_ENCODING_MENU,
|
||||||
RC_AUTOSAVE,
|
RC_AUTOSAVE,
|
||||||
RC_SGML_EXTRA_OPTIONS,
|
|
||||||
RC_DOCUMENTPATH,
|
RC_DOCUMENTPATH,
|
||||||
RC_TEMPLATEPATH,
|
RC_TEMPLATEPATH,
|
||||||
RC_TEMPDIRPATH,
|
RC_TEMPDIRPATH,
|
||||||
@ -148,6 +147,12 @@ enum LyXRCTags {
|
|||||||
RC_DATE_INSERT_FORMAT,
|
RC_DATE_INSERT_FORMAT,
|
||||||
RC_SHOW_BANNER,
|
RC_SHOW_BANNER,
|
||||||
RC_USE_GUI,
|
RC_USE_GUI,
|
||||||
|
RC_LINUXDOC_TO_LYX_COMMAND,
|
||||||
|
RC_LINUXDOC_TO_HTML_COMMAND,
|
||||||
|
RC_LINUXDOC_TO_LATEX_COMMAND,
|
||||||
|
RC_DOCBOOK_TO_DVI_COMMAND,
|
||||||
|
RC_DOCBOOK_TO_HTML_COMMAND,
|
||||||
|
RC_DOCBOOK_TO_PDF_COMMAND,
|
||||||
RC_LAST
|
RC_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,6 +181,9 @@ keyword_item lyxrcTags[] = {
|
|||||||
{ "\\date_insert_format", RC_DATE_INSERT_FORMAT },
|
{ "\\date_insert_format", RC_DATE_INSERT_FORMAT },
|
||||||
{ "\\default_papersize", RC_DEFAULT_PAPERSIZE },
|
{ "\\default_papersize", RC_DEFAULT_PAPERSIZE },
|
||||||
{ "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
|
{ "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
|
||||||
|
{ "\\docbook_to_dvi_command", RC_DOCBOOK_TO_DVI_COMMAND },
|
||||||
|
{ "\\docbook_to_html_command", RC_DOCBOOK_TO_HTML_COMMAND },
|
||||||
|
{ "\\docbook_to_pdf_command", RC_DOCBOOK_TO_PDF_COMMAND },
|
||||||
{ "\\document_path", RC_DOCUMENTPATH },
|
{ "\\document_path", RC_DOCUMENTPATH },
|
||||||
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
|
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
|
||||||
{ "\\escape_chars", RC_ESC_CHARS },
|
{ "\\escape_chars", RC_ESC_CHARS },
|
||||||
@ -195,6 +203,9 @@ keyword_item lyxrcTags[] = {
|
|||||||
{ "\\language_package", RC_LANGUAGE_PACKAGE },
|
{ "\\language_package", RC_LANGUAGE_PACKAGE },
|
||||||
{ "\\lastfiles", RC_LASTFILES },
|
{ "\\lastfiles", RC_LASTFILES },
|
||||||
{ "\\latex_command", RC_LATEX_COMMAND },
|
{ "\\latex_command", RC_LATEX_COMMAND },
|
||||||
|
{ "\\linuxdoc_to_html_command", RC_LINUXDOC_TO_HTML_COMMAND },
|
||||||
|
{ "\\linuxdoc_to_latex_command", RC_LINUXDOC_TO_LATEX_COMMAND },
|
||||||
|
{ "\\linuxdoc_to_lyx_command", RC_LINUXDOC_TO_LYX_COMMAND },
|
||||||
{ "\\literate_command", RC_LITERATE_COMMAND },
|
{ "\\literate_command", RC_LITERATE_COMMAND },
|
||||||
{ "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
|
{ "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
|
||||||
{ "\\literate_extension", RC_LITERATE_EXTENSION },
|
{ "\\literate_extension", RC_LITERATE_EXTENSION },
|
||||||
@ -239,7 +250,6 @@ keyword_item lyxrcTags[] = {
|
|||||||
{ "\\screen_zoom", RC_SCREEN_ZOOM },
|
{ "\\screen_zoom", RC_SCREEN_ZOOM },
|
||||||
{ "\\selection_color", RC_SELECTION_COLOR },
|
{ "\\selection_color", RC_SELECTION_COLOR },
|
||||||
{ "\\serverpipe", RC_SERVERPIPE },
|
{ "\\serverpipe", RC_SERVERPIPE },
|
||||||
{ "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
|
|
||||||
{ "\\show_banner", RC_SHOW_BANNER },
|
{ "\\show_banner", RC_SHOW_BANNER },
|
||||||
{ "\\spell_command", RC_SPELL_COMMAND },
|
{ "\\spell_command", RC_SPELL_COMMAND },
|
||||||
{ "\\tempdir_path", RC_TEMPDIRPATH },
|
{ "\\tempdir_path", RC_TEMPDIRPATH },
|
||||||
@ -362,6 +372,16 @@ void LyXRC::setDefaults() {
|
|||||||
date_insert_format = "%A, %e %B %Y";
|
date_insert_format = "%A, %e %B %Y";
|
||||||
show_banner = true;
|
show_banner = true;
|
||||||
use_gui = true;
|
use_gui = true;
|
||||||
|
|
||||||
|
///
|
||||||
|
linuxdoc_to_latex_command="none";
|
||||||
|
linuxdoc_to_lyx_command="none";
|
||||||
|
linuxdoc_to_html_command="none";
|
||||||
|
|
||||||
|
docbook_to_dvi_command="none";
|
||||||
|
docbook_to_html_command="none";
|
||||||
|
docbook_to_pdf_command="none";
|
||||||
|
|
||||||
//
|
//
|
||||||
defaultKeyBindings();
|
defaultKeyBindings();
|
||||||
}
|
}
|
||||||
@ -740,11 +760,6 @@ int LyXRC::read(string const & filename)
|
|||||||
autosave = lexrc.GetInteger();
|
autosave = lexrc.GetInteger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_SGML_EXTRA_OPTIONS:
|
|
||||||
if (lexrc.next())
|
|
||||||
sgml_extra_options = lexrc.GetString();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RC_DOCUMENTPATH:
|
case RC_DOCUMENTPATH:
|
||||||
if (lexrc.next()) {
|
if (lexrc.next()) {
|
||||||
document_path = ExpandPath(lexrc.GetString());
|
document_path = ExpandPath(lexrc.GetString());
|
||||||
@ -997,6 +1012,30 @@ int LyXRC::read(string const & filename)
|
|||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
use_gui = lexrc.GetBool();
|
use_gui = lexrc.GetBool();
|
||||||
break;
|
break;
|
||||||
|
case RC_LINUXDOC_TO_LYX_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
linuxdoc_to_lyx_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
|
case RC_LINUXDOC_TO_HTML_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
linuxdoc_to_html_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
|
case RC_LINUXDOC_TO_LATEX_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
linuxdoc_to_latex_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
|
case RC_DOCBOOK_TO_DVI_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
docbook_to_dvi_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
|
case RC_DOCBOOK_TO_HTML_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
docbook_to_html_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
|
case RC_DOCBOOK_TO_PDF_COMMAND:
|
||||||
|
if ( lexrc.next())
|
||||||
|
docbook_to_pdf_command = lexrc.GetString();
|
||||||
|
break;
|
||||||
case RC_LAST: break; // this is just a dummy
|
case RC_LAST: break; // this is just a dummy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1201,9 +1240,6 @@ void LyXRC::output(ostream & os) const
|
|||||||
os << "\\chktex_command \"" << chktex_command << "\"\n";
|
os << "\\chktex_command \"" << chktex_command << "\"\n";
|
||||||
case RC_HTML_COMMAND:
|
case RC_HTML_COMMAND:
|
||||||
os << "\\html_command \"" << html_command << "\"\n";
|
os << "\\html_command \"" << html_command << "\"\n";
|
||||||
case RC_SGML_EXTRA_OPTIONS:
|
|
||||||
os << "\\sgml_extra_options \"" << sgml_extra_options
|
|
||||||
<< "\"\n";
|
|
||||||
case RC_KBMAP:
|
case RC_KBMAP:
|
||||||
os << "\\kbmap " << tostr(use_kbmap) << "\n";
|
os << "\\kbmap " << tostr(use_kbmap) << "\n";
|
||||||
case RC_KBMAP_PRIMARY:
|
case RC_KBMAP_PRIMARY:
|
||||||
@ -1316,6 +1352,24 @@ void LyXRC::output(ostream & os) const
|
|||||||
os << "\\show_banner " << tostr(show_banner) << "\n";
|
os << "\\show_banner " << tostr(show_banner) << "\n";
|
||||||
case RC_USE_GUI:
|
case RC_USE_GUI:
|
||||||
os << "\\use_gui " << tostr(show_banner) << "\n";
|
os << "\\use_gui " << tostr(show_banner) << "\n";
|
||||||
|
case RC_LINUXDOC_TO_LYX_COMMAND:
|
||||||
|
os << "\\linuxdoc_to_lyx_command \"" << linuxdoc_to_lyx_command
|
||||||
|
<< "\"\n";
|
||||||
|
case RC_LINUXDOC_TO_HTML_COMMAND:
|
||||||
|
os << "\\linuxdoc_to_html_command \"" << linuxdoc_to_html_command
|
||||||
|
<< "\"\n";
|
||||||
|
case RC_LINUXDOC_TO_LATEX_COMMAND:
|
||||||
|
os << "\\linuxdoc_to_latex_command \"" << linuxdoc_to_latex_command
|
||||||
|
<< "\"\n";
|
||||||
|
case RC_DOCBOOK_TO_DVI_COMMAND:
|
||||||
|
os << "\\docbook_to_dvi_command \"" << docbook_to_dvi_command
|
||||||
|
<< "\"\n";
|
||||||
|
case RC_DOCBOOK_TO_HTML_COMMAND:
|
||||||
|
os << "\\docbook_to_html_command \"" << docbook_to_html_command
|
||||||
|
<< "\"\n";
|
||||||
|
case RC_DOCBOOK_TO_PDF_COMMAND:
|
||||||
|
os << "\\docbook_to_pdf_command \"" << docbook_to_pdf_command
|
||||||
|
<< "\"\n";
|
||||||
}
|
}
|
||||||
os.flush();
|
os.flush();
|
||||||
}
|
}
|
||||||
|
14
src/lyxrc.h
14
src/lyxrc.h
@ -121,8 +121,6 @@ public:
|
|||||||
/// command to run an html converter incl. options
|
/// command to run an html converter incl. options
|
||||||
string html_command;
|
string html_command;
|
||||||
///
|
///
|
||||||
string sgml_extra_options;
|
|
||||||
///
|
|
||||||
string document_path;
|
string document_path;
|
||||||
///
|
///
|
||||||
string template_path;
|
string template_path;
|
||||||
@ -229,6 +227,18 @@ public:
|
|||||||
/// Do we have to use a GUI?
|
/// Do we have to use a GUI?
|
||||||
bool use_gui;
|
bool use_gui;
|
||||||
///
|
///
|
||||||
|
string linuxdoc_to_lyx_command;
|
||||||
|
///
|
||||||
|
string linuxdoc_to_html_command;
|
||||||
|
///
|
||||||
|
string linuxdoc_to_latex_command;
|
||||||
|
///
|
||||||
|
string docbook_to_dvi_command;
|
||||||
|
///
|
||||||
|
string docbook_to_html_command;
|
||||||
|
///
|
||||||
|
string docbook_to_pdf_command;
|
||||||
|
///
|
||||||
typedef map<string, int> Bindings;
|
typedef map<string, int> Bindings;
|
||||||
///
|
///
|
||||||
Bindings bindings;
|
Bindings bindings;
|
||||||
|
39
src/menus.C
39
src/menus.C
@ -467,12 +467,14 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
"|LaTeX...%x30"
|
"|LaTeX...%x30"
|
||||||
"|Ascii Text as Lines...%x31"
|
"|Ascii Text as Lines...%x31"
|
||||||
"|Ascii Text as Paragraphs%x32"
|
"|Ascii Text as Paragraphs%x32"
|
||||||
"|Noweb%x33"));
|
"|Noweb%x33"
|
||||||
|
"|LinuxDoc%x34"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubFileImport, 30, scex(_("FIM|Ll#l#L")));
|
fl_setpup_shortcut(SubFileImport, 30, scex(_("FIM|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubFileImport, 31, scex(_("FIM|Aa#a#A")));
|
fl_setpup_shortcut(SubFileImport, 31, scex(_("FIM|Aa#a#A")));
|
||||||
fl_setpup_shortcut(SubFileImport, 32, scex(_("FIM|Pp#p#P")));
|
fl_setpup_shortcut(SubFileImport, 32, scex(_("FIM|Pp#p#P")));
|
||||||
fl_setpup_shortcut(SubFileImport, 33, scex(_("FIM|Nn#n#N")));
|
fl_setpup_shortcut(SubFileImport, 33, scex(_("FIM|Nn#n#N")));
|
||||||
|
fl_setpup_shortcut(SubFileImport, 34, scex(_("FIM|Dd#d#D")));
|
||||||
|
|
||||||
// Export sub-menu
|
// Export sub-menu
|
||||||
|
|
||||||
@ -494,21 +496,24 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
"|as LinuxDoc...%x40"
|
"|as LinuxDoc...%x40"
|
||||||
"|as DVI...%x41"
|
"|as DVI...%x41"
|
||||||
"|as PostScript...%x42"
|
"|as PostScript...%x42"
|
||||||
"|as Ascii Text...%x43"));
|
"|as Ascii Text...%x43"
|
||||||
|
"|as HTML...%x44"));
|
||||||
else if(DocBook)
|
else if(DocBook)
|
||||||
SubFileExport= fl_defpup(FL_ObjWin(ob),
|
SubFileExport= fl_defpup(FL_ObjWin(ob),
|
||||||
_("Export%t"
|
_("Export%t"
|
||||||
"|as DocBook...%x40"
|
"|as DocBook...%x40"
|
||||||
"|as DVI...%x41"
|
"|as DVI...%x41"
|
||||||
"|as PostScript...%x42"
|
"|as PostScript...%x42"
|
||||||
"|as Ascii Text...%x43"));
|
"|as Ascii Text...%x43"
|
||||||
|
"|as HTML...%x44"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
|
fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
|
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
|
||||||
fl_setpup_shortcut(SubFileExport, 42, scex(_("FEX|Pp#p#P")));
|
fl_setpup_shortcut(SubFileExport, 42, scex(_("FEX|Pp#p#P")));
|
||||||
fl_setpup_shortcut(SubFileExport, 43, scex(_("FEX|Tt#t#T")));
|
fl_setpup_shortcut(SubFileExport, 43, scex(_("FEX|Tt#t#T")));
|
||||||
|
fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|Hh#h#H")));
|
||||||
|
|
||||||
if (!LinuxDoc && !DocBook) {
|
if (!LinuxDoc && !DocBook) {
|
||||||
fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|Hh#h#H")));
|
|
||||||
fl_setpup_shortcut(SubFileExport, 45, scex(_("FEX|mM#m#M")));
|
fl_setpup_shortcut(SubFileExport, 45, scex(_("FEX|mM#m#M")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,13 +580,18 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
fl_setpup_mode(SubFileImport, 33, FL_PUP_GREY);
|
fl_setpup_mode(SubFileImport, 33, FL_PUP_GREY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( lyxrc.linuxdoc_to_lyx_command == "none")
|
||||||
|
fl_setpup_mode(SubFileImport, 34, FL_PUP_GREY);
|
||||||
|
|
||||||
if (!hasLaTeX) {
|
if (!hasLaTeX) {
|
||||||
// Disable export dvi and export postscript
|
// Disable export dvi and export postscript
|
||||||
fl_setpup_mode(SubFileExport, 41, FL_PUP_GREY);
|
fl_setpup_mode(SubFileExport, 41, FL_PUP_GREY);
|
||||||
fl_setpup_mode(SubFileExport, 42, FL_PUP_GREY);
|
fl_setpup_mode(SubFileExport, 42, FL_PUP_GREY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lyxrc.html_command == "none") {
|
if ((!LinuxDoc && !DocBook && lyxrc.html_command == "none") ||
|
||||||
|
( LinuxDoc && lyxrc.linuxdoc_to_html_command == "none") ||
|
||||||
|
( DocBook && lyxrc.docbook_to_html_command == "none")) {
|
||||||
// Disable export HTML
|
// Disable export HTML
|
||||||
fl_setpup_mode(SubFileExport, 44, FL_PUP_GREY);
|
fl_setpup_mode(SubFileExport, 44, FL_PUP_GREY);
|
||||||
}
|
}
|
||||||
@ -644,6 +654,8 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
break;
|
break;
|
||||||
case 33: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
|
case 33: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
|
||||||
break;
|
break;
|
||||||
|
case 34: tmpfunc->Dispatch(LFUN_IMPORT, "linuxdoc");
|
||||||
|
break;
|
||||||
case 16: // export menu
|
case 16: // export menu
|
||||||
case 40:
|
case 40:
|
||||||
if (!LinuxDoc && !DocBook)
|
if (!LinuxDoc && !DocBook)
|
||||||
@ -659,7 +671,13 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
break;
|
break;
|
||||||
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
|
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
|
||||||
break;
|
break;
|
||||||
case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
|
case 44:
|
||||||
|
if (!LinuxDoc && !DocBook)
|
||||||
|
tmpfunc->Dispatch(LFUN_EXPORT, "html");
|
||||||
|
else if(LinuxDoc)
|
||||||
|
tmpfunc->Dispatch(LFUN_EXPORT, "html-linuxdoc");
|
||||||
|
else
|
||||||
|
tmpfunc->Dispatch(LFUN_EXPORT, "html-docbook");
|
||||||
break;
|
break;
|
||||||
case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
|
case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
|
||||||
break;
|
break;
|
||||||
@ -706,12 +724,14 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
|||||||
"|LaTeX...%x15"
|
"|LaTeX...%x15"
|
||||||
"|Ascii Text as Lines...%x16"
|
"|Ascii Text as Lines...%x16"
|
||||||
"|Ascii Text as Paragraphs...%x17"
|
"|Ascii Text as Paragraphs...%x17"
|
||||||
"|Noweb...%x18"));
|
"|Noweb...%x18"
|
||||||
|
"|LinuxDoc...%x19"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
|
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
|
fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
|
||||||
fl_setpup_shortcut(SubFileImport, 17, scex(_("FIM|Pp#p#P")));
|
fl_setpup_shortcut(SubFileImport, 17, scex(_("FIM|Pp#p#P")));
|
||||||
fl_setpup_shortcut(SubFileImport, 18, scex(_("FIM|Nn#n#N")));
|
fl_setpup_shortcut(SubFileImport, 18, scex(_("FIM|Nn#n#N")));
|
||||||
|
fl_setpup_shortcut(SubFileImport, 19, scex(_("FIM|Dd#d#D")));
|
||||||
|
|
||||||
bool hasReLyX = lyxrc.relyx_command != "none";
|
bool hasReLyX = lyxrc.relyx_command != "none";
|
||||||
if (!hasReLyX) {
|
if (!hasReLyX) {
|
||||||
@ -720,6 +740,9 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
|||||||
fl_setpup_mode(SubFileImport, 18, FL_PUP_GREY);
|
fl_setpup_mode(SubFileImport, 18, FL_PUP_GREY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( lyxrc.linuxdoc_to_lyx_command == "none")
|
||||||
|
fl_setpup_mode(SubFileImport, 19, FL_PUP_GREY);
|
||||||
|
|
||||||
// This can be done cleaner later.
|
// This can be done cleaner later.
|
||||||
int FileMenu = fl_defpup(FL_ObjWin(ob),
|
int FileMenu = fl_defpup(FL_ObjWin(ob),
|
||||||
_("New..."
|
_("New..."
|
||||||
@ -777,6 +800,8 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
|||||||
break;
|
break;
|
||||||
case 18: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
|
case 18: tmpfunc->Dispatch(LFUN_IMPORT, "noweb");
|
||||||
break;
|
break;
|
||||||
|
case 19: tmpfunc->Dispatch(LFUN_IMPORT, "linuxdoc");
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
tmpfunc->Dispatch(LFUN_QUIT);
|
tmpfunc->Dispatch(LFUN_QUIT);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user