2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file BufferParams.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author Martin Vermeer
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "BufferParams.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Author.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "BranchList.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
#include "Bullet.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "debug.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Encoding.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "gettext.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Language.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-05-01 08:26:40 +00:00
|
|
|
|
#include "Messages.h"
|
2007-04-26 17:34:20 +00:00
|
|
|
|
#include "Color.h"
|
2007-04-29 18:17:15 +00:00
|
|
|
|
#include "Font.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
|
#include "Lexer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyXRC.h"
|
2007-04-29 19:53:54 +00:00
|
|
|
|
#include "TextClassList.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "OutputParams.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "Spacing.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "TexRow.h"
|
|
|
|
|
#include "VSpace.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "frontends/alert.h"
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
#include "insets/InsetListingsParams.h"
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2003-02-16 00:54:43 +00:00
|
|
|
|
#include "support/lyxalgo.h" // for lyx::count
|
2005-01-06 16:39:35 +00:00
|
|
|
|
#include "support/convert.h"
|
Rename files in src/support, step one.
src/support/package.h src/support/Package.h Package
src/support/package.C.in src/support/Package.C.in Package
src/support/path.h src/support/Path.h Path
src/support/fs_extras.h src/support/fs_extras.h NOCLASSES
src/support/RandomAccessList.h src/support/RandomAccessList.h RandomAccessList
src/support/lyxmanip.h src/support/lyxmanip.h NOCLASSES
src/support/rename.C src/support/rename.cpp NOCLASSES
src/support/abort.C src/support/abort.cpp NOCLASSES
src/support/lyxlib.h src/support/lyxlib.h NOCLASSES
src/support/ExceptionMessage.h src/support/ExceptionMessage.h ExceptionMessage
src/support/copy.C src/support/copy.cpp NOCLASSES
src/support/limited_stack.h src/support/limited_stack.h limited_stack
src/support/filefilterlist.C src/support/FileFilterList.cpp ['FileFilterList', 'Filter']
src/support/cow_ptr.h src/support/cow_ptr.h cow_ptr
src/support/os_unix.C src/support/os_unix.cpp NOCLASSES
src/support/socktools.h src/support/socktools.h NOCLASSES
src/support/forkedcontr.h src/support/ForkedcallsController.h ForkedcallsController
src/support/os.h src/support/os.h NOCLASSES
src/support/FileMonitor.h src/support/FileMonitor.h FileMonitor
src/support/copied_ptr.h src/support/copied_ptr.h copied_ptr
src/support/translator.h src/support/Translator.h Translator
src/support/filetools.C src/support/filetools.cpp NOCLASSES
src/support/unlink.C src/support/unlink.cpp NOCLASSES
src/support/os_win32.C src/support/os_win32.cpp GetFolderPath
src/support/lstrings.C src/support/lstrings.cpp NOCLASSES
src/support/qstring_helpers.C src/support/qstring_helpers.cpp NOCLASSES
src/support/getcwd.C src/support/getcwd.cpp NOCLASSES
src/support/systemcall.C src/support/Systemcall.cpp Systemcall
src/support/lyxalgo.h src/support/lyxalgo.h NOCLASSES
src/support/filefilterlist.h src/support/FileFilterList.h ['FileFilterList', 'Filter']
src/support/unicode.C src/support/unicode.cpp IconvProcessor
src/support/userinfo.C src/support/userinfo.cpp NOCLASSES
src/support/lyxtime.C src/support/lyxtime.cpp NOCLASSES
src/support/kill.C src/support/kill.cpp NOCLASSES
src/support/docstring.C src/support/docstring.cpp to_local8bit_failure
src/support/os_cygwin.C src/support/os_cygwin.cpp NOCLASSES
src/support/lyxsum.C src/support/lyxsum.cpp NOCLASSES
src/support/environment.C src/support/environment.cpp NOCLASSES
src/support/filetools.h src/support/filetools.h NOCLASSES
src/support/textutils.C src/support/textutils.cpp NOCLASSES
src/support/mkdir.C src/support/mkdir.cpp NOCLASSES
src/support/forkedcall.C src/support/Forkedcall.cpp ['ForkedProcess', 'Forkedcall']
src/support/tempname.C src/support/tempname.cpp NOCLASSES
src/support/os_win32.h src/support/os_win32.h GetFolderPath
src/support/types.h src/support/types.h NOCLASSES
src/support/lstrings.h src/support/lstrings.h NOCLASSES
src/support/forkedcallqueue.C src/support/ForkedCallQueue.cpp ForkedCallQueue
src/support/qstring_helpers.h src/support/qstring_helpers.h NOCLASSES
src/support/convert.C src/support/convert.cpp NOCLASSES
src/support/filename.C src/support/FileName.cpp ['FileName', 'DocFileName']
src/support/tests/convert.C src/support/tests/convert.cpp NOCLASSES
src/support/tests/filetools.C src/support/tests/filetools.cpp NOCLASSES
src/support/tests/lstrings.C src/support/tests/lstrings.cpp NOCLASSES
src/support/tests/boost.C src/support/tests/boost.cpp NOCLASSES
src/support/docstream.C src/support/docstream.cpp ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/std_istream.h src/support/std_istream.h NOCLASSES
src/support/systemcall.h src/support/Systemcall.h Systemcall
src/support/chdir.C src/support/chdir.cpp NOCLASSES
src/support/std_ostream.h src/support/std_ostream.h NOCLASSES
src/support/unicode.h src/support/unicode.h IconvProcessor
src/support/path.C src/support/Path.cpp Path
src/support/fs_extras.C src/support/fs_extras.cpp NOCLASSES
src/support/userinfo.h src/support/userinfo.h NOCLASSES
src/support/lyxtime.h src/support/lyxtime.h NOCLASSES
src/support/docstring.h src/support/docstring.h to_local8bit_failure
src/support/debugstream.h src/support/debugstream.h basic_debugstream
src/support/environment.h src/support/environment.h NOCLASSES
src/support/textutils.h src/support/textutils.h NOCLASSES
src/support/forkedcall.h src/support/Forkedcall.h ['ForkedProcess', 'Forkedcall']
src/support/socktools.C src/support/socktools.cpp NOCLASSES
src/support/forkedcallqueue.h src/support/ForkedCallQueue.h ForkedCallQueue
src/support/forkedcontr.C src/support/ForkedcallsController.cpp ForkedcallsController
src/support/os.C src/support/os.cpp NOCLASSES
src/support/convert.h src/support/convert.h NOCLASSES
src/support/filename.h src/support/FileName.h ['FileName', 'DocFileName']
src/support/docstream.h src/support/docstream.h ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/FileMonitor.C src/support/FileMonitor.cpp FileMonitor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18024 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 05:12:52 +00:00
|
|
|
|
#include "support/Translator.h"
|
2003-05-03 19:24:36 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include <boost/array.hpp>
|
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
|
#include <sstream>
|
2000-02-22 00:36:17 +00:00
|
|
|
|
|
2003-09-06 23:36:02 +00:00
|
|
|
|
using std::endl;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::istringstream;
|
2007-12-03 16:41:53 +00:00
|
|
|
|
using std::make_pair;
|
2000-04-04 00:19:15 +00:00
|
|
|
|
using std::ostream;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::ostringstream;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
using std::pair;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-04-30 21:01:24 +00:00
|
|
|
|
using lyx::support::bformat;
|
|
|
|
|
using lyx::support::rtrim;
|
|
|
|
|
using lyx::support::tokenPos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const string_paragraph_separation[] = {
|
|
|
|
|
"indent", "skip", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const string_quotes_language[] = {
|
|
|
|
|
"english", "swedish", "german", "polish", "french", "danish", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const string_papersize[] = {
|
|
|
|
|
"default", "custom", "letterpaper", "executivepaper", "legalpaper",
|
|
|
|
|
"a3paper", "a4paper", "a5paper", "b3paper", "b4paper", "b5paper", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const string_orientation[] = {
|
|
|
|
|
"portrait", "landscape", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const string_footnotekinds[] = {
|
|
|
|
|
"footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char const * const tex_graphics[] = {
|
|
|
|
|
"default", "dvips", "dvitops", "emtex",
|
|
|
|
|
"ln", "oztex", "textures", "none", ""
|
|
|
|
|
};
|
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
2007-04-30 21:01:24 +00:00
|
|
|
|
namespace lyx {
|
2003-05-13 16:24:49 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Local translators
|
2004-08-20 13:06:33 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paragraph separation
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, BufferParams::PARSEP> ParSepTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
ParSepTranslator const init_parseptranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
ParSepTranslator translator(string_paragraph_separation[0], BufferParams::PARSEP_INDENT);
|
|
|
|
|
translator.addPair(string_paragraph_separation[1], BufferParams::PARSEP_SKIP);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
ParSepTranslator const & parseptranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static ParSepTranslator translator = init_parseptranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Quotes language
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, InsetQuotes::quote_language> QuotesLangTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
QuotesLangTranslator const init_quoteslangtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
QuotesLangTranslator translator(string_quotes_language[0], InsetQuotes::EnglishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[2], InsetQuotes::GermanQ);
|
|
|
|
|
translator.addPair(string_quotes_language[3], InsetQuotes::PolishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQ);
|
|
|
|
|
translator.addPair(string_quotes_language[5], InsetQuotes::DanishQ);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
QuotesLangTranslator const & quoteslangtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static QuotesLangTranslator translator = init_quoteslangtranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paper size
|
2005-07-16 16:57:55 +00:00
|
|
|
|
typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperSizeTranslator const init_papersizetranslator()
|
|
|
|
|
{
|
2005-07-16 16:57:55 +00:00
|
|
|
|
PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT);
|
|
|
|
|
translator.addPair(string_papersize[1], PAPER_CUSTOM);
|
|
|
|
|
translator.addPair(string_papersize[2], PAPER_USLETTER);
|
|
|
|
|
translator.addPair(string_papersize[3], PAPER_USLEGAL);
|
|
|
|
|
translator.addPair(string_papersize[4], PAPER_USEXECUTIVE);
|
|
|
|
|
translator.addPair(string_papersize[5], PAPER_A3);
|
|
|
|
|
translator.addPair(string_papersize[6], PAPER_A4);
|
|
|
|
|
translator.addPair(string_papersize[7], PAPER_A5);
|
|
|
|
|
translator.addPair(string_papersize[8], PAPER_B3);
|
|
|
|
|
translator.addPair(string_papersize[9], PAPER_B4);
|
|
|
|
|
translator.addPair(string_papersize[10], PAPER_B5);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperSizeTranslator const & papersizetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static PaperSizeTranslator translator = init_papersizetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paper orientation
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, PAPER_ORIENTATION> PaperOrientationTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperOrientationTranslator const init_paperorientationtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
PaperOrientationTranslator translator(string_orientation[0], ORIENTATION_PORTRAIT);
|
|
|
|
|
translator.addPair(string_orientation[1], ORIENTATION_LANDSCAPE);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperOrientationTranslator const & paperorientationtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static PaperOrientationTranslator translator = init_paperorientationtranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Page sides
|
2007-04-29 19:53:54 +00:00
|
|
|
|
typedef Translator<int, TextClass::PageSides> SidesTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SidesTranslator const init_sidestranslator()
|
|
|
|
|
{
|
2007-04-29 19:53:54 +00:00
|
|
|
|
SidesTranslator translator(1, TextClass::OneSide);
|
|
|
|
|
translator.addPair(2, TextClass::TwoSides);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SidesTranslator const & sidestranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static SidesTranslator translator = init_sidestranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
// LaTeX packages
|
|
|
|
|
typedef Translator<int, BufferParams::Package> PackageTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator const init_packagetranslator()
|
2005-01-05 20:21:27 +00:00
|
|
|
|
{
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator translator(0, BufferParams::package_off);
|
|
|
|
|
translator.addPair(1, BufferParams::package_auto);
|
|
|
|
|
translator.addPair(2, BufferParams::package_on);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator const & packagetranslator()
|
2005-01-05 20:21:27 +00:00
|
|
|
|
{
|
2006-11-13 17:35:18 +00:00
|
|
|
|
static PackageTranslator translator = init_packagetranslator();
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cite engine
|
|
|
|
|
typedef Translator<string, biblio::CiteEngine> CiteEngineTranslator;
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
CiteEngineTranslator const init_citeenginetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
CiteEngineTranslator translator("basic", biblio::ENGINE_BASIC);
|
|
|
|
|
translator.addPair("natbib_numerical", biblio::ENGINE_NATBIB_NUMERICAL);
|
|
|
|
|
translator.addPair("natbib_authoryear", biblio::ENGINE_NATBIB_AUTHORYEAR);
|
|
|
|
|
translator.addPair("jurabib", biblio::ENGINE_JURABIB);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
CiteEngineTranslator const & citeenginetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static CiteEngineTranslator translator = init_citeenginetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Spacing
|
|
|
|
|
typedef Translator<string, Spacing::Space> SpaceTranslator;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SpaceTranslator const init_spacetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
SpaceTranslator translator("default", Spacing::Default);
|
|
|
|
|
translator.addPair("single", Spacing::Single);
|
|
|
|
|
translator.addPair("onehalf", Spacing::Onehalf);
|
|
|
|
|
translator.addPair("double", Spacing::Double);
|
2005-01-06 13:48:13 +00:00
|
|
|
|
translator.addPair("other", Spacing::Other);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SpaceTranslator const & spacetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static SpaceTranslator translator = init_spacetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-27 17:22:58 +00:00
|
|
|
|
|
|
|
|
|
textclass_type defaultTextclass()
|
|
|
|
|
{
|
|
|
|
|
// Initialize textclass to point to article. if `first' is
|
|
|
|
|
// true in the returned pair, then `second' is the textclass
|
|
|
|
|
// number; if it is false, second is 0. In both cases, second
|
|
|
|
|
// is what we want.
|
|
|
|
|
return textclasslist.numberOfClass("article").second;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-01-27 17:22:58 +00:00
|
|
|
|
} // anon namespace
|
|
|
|
|
|
2004-08-20 13:06:33 +00:00
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class BufferParams::Impl
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2005-01-19 15:03:31 +00:00
|
|
|
|
public:
|
2003-09-09 17:00:19 +00:00
|
|
|
|
Impl();
|
|
|
|
|
|
|
|
|
|
AuthorList authorlist;
|
|
|
|
|
BranchList branchlist;
|
|
|
|
|
boost::array<Bullet, 4> temp_bullets;
|
|
|
|
|
boost::array<Bullet, 4> user_defined_bullets;
|
|
|
|
|
Spacing spacing;
|
|
|
|
|
/** This is the amount of space used for paragraph_separation "skip",
|
|
|
|
|
* and for detached paragraphs in "indented" documents.
|
|
|
|
|
*/
|
|
|
|
|
VSpace defskip;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferParams::Impl::Impl()
|
|
|
|
|
: defskip(VSpace::MEDSKIP)
|
|
|
|
|
{
|
|
|
|
|
// set initial author
|
2006-12-21 13:58:28 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
authorlist.record(Author(from_utf8(lyxrc.user_name), from_utf8(lyxrc.user_email)));
|
2003-09-09 17:00:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
BufferParams::Impl *
|
|
|
|
|
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
|
|
|
|
|
{
|
2005-01-05 20:21:27 +00:00
|
|
|
|
BOOST_ASSERT(ptr);
|
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
return new BufferParams::Impl(*ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::MemoryTraits::destroy(BufferParams::Impl * ptr)
|
|
|
|
|
{
|
|
|
|
|
delete ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
BufferParams::BufferParams()
|
2007-01-27 17:22:58 +00:00
|
|
|
|
: textclass(defaultTextclass()), pimpl_(new Impl)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
1999-11-15 12:01:38 +00:00
|
|
|
|
paragraph_separation = PARSEP_INDENT;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
quotes_language = InsetQuotes::EnglishQ;
|
|
|
|
|
fontsize = "default";
|
1999-11-25 17:29:19 +00:00
|
|
|
|
|
2001-11-29 17:12:21 +00:00
|
|
|
|
/* PaperLayout */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
papersize = PAPER_DEFAULT;
|
|
|
|
|
orientation = ORIENTATION_PORTRAIT;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
use_geometry = false;
|
2006-11-13 17:35:18 +00:00
|
|
|
|
use_amsmath = package_auto;
|
|
|
|
|
use_esint = package_auto;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
cite_engine_ = biblio::ENGINE_BASIC;
|
2004-03-29 13:17:25 +00:00
|
|
|
|
use_bibtopic = false;
|
2006-10-06 18:53:35 +00:00
|
|
|
|
trackChanges = false;
|
|
|
|
|
outputChanges = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
secnumdepth = 3;
|
|
|
|
|
tocdepth = 3;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
language = default_language;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
fontsRoman = "default";
|
|
|
|
|
fontsSans = "default";
|
|
|
|
|
fontsTypewriter = "default";
|
|
|
|
|
fontsDefaultFamily = "default";
|
|
|
|
|
fontsSC = false;
|
|
|
|
|
fontsOSF = false;
|
|
|
|
|
fontsSansScale = 100;
|
|
|
|
|
fontsTypewriterScale = 100;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
inputenc = "auto";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
graphicsDriver = "default";
|
2007-04-29 19:53:54 +00:00
|
|
|
|
sides = TextClass::OneSide;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
columns = 1;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
listings_params = string();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
pagestyle = "default";
|
2003-07-28 14:40:29 +00:00
|
|
|
|
compressed = false;
|
2000-11-04 10:00:12 +00:00
|
|
|
|
for (int iter = 0; iter < 4; ++iter) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
|
|
|
|
|
temp_bullet(iter) = ITEMIZE_DEFAULTS[iter];
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
BufferParams::~BufferParams()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
|
docstring const BufferParams::B_(string const & l10n) const
|
|
|
|
|
{
|
|
|
|
|
BOOST_ASSERT(language);
|
|
|
|
|
return getMessages(language->code()).get(l10n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
AuthorList & BufferParams::authors()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->authorlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AuthorList const & BufferParams::authors() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->authorlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BranchList & BufferParams::branchlist()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->branchlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BranchList const & BufferParams::branchlist() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->branchlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->temp_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->temp_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->user_defined_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->user_defined_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Spacing & BufferParams::spacing()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Spacing const & BufferParams::spacing() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VSpace const & BufferParams::getDefSkip() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->defskip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::setDefSkip(VSpace const & vs)
|
|
|
|
|
{
|
|
|
|
|
pimpl_->defskip = vs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
string const BufferParams::readToken(Lexer & lex, string const & token)
|
2003-03-12 02:39:12 +00:00
|
|
|
|
{
|
|
|
|
|
if (token == "\\textclass") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-03-12 02:39:12 +00:00
|
|
|
|
string const classname = lex.getString();
|
2007-11-26 15:37:41 +00:00
|
|
|
|
// if there exists a local layout file, ignore the system one
|
|
|
|
|
// NOTE: in this case, the textclass (.cls file) is assumed to be available.
|
2007-12-03 16:41:53 +00:00
|
|
|
|
pair<bool, lyx::textclass_type> pp =
|
|
|
|
|
make_pair(false, textclass_type(0));
|
2007-12-02 17:57:49 +00:00
|
|
|
|
if (!filepath.empty())
|
|
|
|
|
pp = textclasslist.addTextClass(classname, filepath);
|
2007-11-26 15:37:41 +00:00
|
|
|
|
if (pp.first)
|
2003-03-12 02:39:12 +00:00
|
|
|
|
textclass = pp.second;
|
2007-11-26 15:37:41 +00:00
|
|
|
|
else {
|
|
|
|
|
pp = textclasslist.numberOfClass(classname);
|
|
|
|
|
if (pp.first)
|
2006-04-09 04:35:24 +00:00
|
|
|
|
textclass = pp.second;
|
2007-11-26 15:37:41 +00:00
|
|
|
|
else {
|
|
|
|
|
// a warning will be given for unknown class
|
2007-01-27 17:22:58 +00:00
|
|
|
|
textclass = defaultTextclass();
|
2006-04-09 04:35:24 +00:00
|
|
|
|
return classname;
|
2006-09-09 15:27:44 +00:00
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
2006-04-09 04:35:24 +00:00
|
|
|
|
// FIXME: isTeXClassAvailable will try to load the layout file, but will
|
|
|
|
|
// fail because of the lack of path info. Warnings will be given although
|
|
|
|
|
// the layout file will be correctly loaded later.
|
2007-04-29 19:53:54 +00:00
|
|
|
|
if (!getTextClass().isTeXClassAvailable()) {
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const msg =
|
2007-04-17 17:57:57 +00:00
|
|
|
|
bformat(_("The layout file requested by this document,\n"
|
2007-05-28 22:27:45 +00:00
|
|
|
|
"%1$s.layout,\n"
|
|
|
|
|
"is not usable. This is probably because a LaTeX\n"
|
|
|
|
|
"class or style file required by it is not\n"
|
|
|
|
|
"available. See the Customization documentation\n"
|
|
|
|
|
"for more information.\n"), from_utf8(classname));
|
2007-04-30 21:01:24 +00:00
|
|
|
|
frontend::Alert::warning(_("Document class not available"),
|
2006-09-11 08:54:10 +00:00
|
|
|
|
msg + _("LyX will not be able to produce output."));
|
2003-05-03 19:24:36 +00:00
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\begin_preamble") {
|
|
|
|
|
readPreamble(lex);
|
|
|
|
|
} else if (token == "\\options") {
|
|
|
|
|
lex.eatLine();
|
|
|
|
|
options = lex.getString();
|
|
|
|
|
} else if (token == "\\language") {
|
|
|
|
|
readLanguage(lex);
|
|
|
|
|
} else if (token == "\\inputencoding") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> inputenc;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\graphics") {
|
|
|
|
|
readGraphicsDriver(lex);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
} else if (token == "\\font_roman") {
|
|
|
|
|
lex >> fontsRoman;
|
|
|
|
|
} else if (token == "\\font_sans") {
|
|
|
|
|
lex >> fontsSans;
|
|
|
|
|
} else if (token == "\\font_typewriter") {
|
|
|
|
|
lex >> fontsTypewriter;
|
|
|
|
|
} else if (token == "\\font_default_family") {
|
|
|
|
|
lex >> fontsDefaultFamily;
|
|
|
|
|
} else if (token == "\\font_sc") {
|
|
|
|
|
lex >> fontsSC;
|
|
|
|
|
} else if (token == "\\font_osf") {
|
|
|
|
|
lex >> fontsOSF;
|
|
|
|
|
} else if (token == "\\font_sf_scale") {
|
|
|
|
|
lex >> fontsSansScale;
|
|
|
|
|
} else if (token == "\\font_tt_scale") {
|
|
|
|
|
lex >> fontsTypewriterScale;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paragraph_separation") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string parsep;
|
|
|
|
|
lex >> parsep;
|
|
|
|
|
paragraph_separation = parseptranslator().find(parsep);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\defskip") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-09-09 17:00:19 +00:00
|
|
|
|
pimpl_->defskip = VSpace(lex.getString());
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\quotes_language") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string quotes_lang;
|
|
|
|
|
lex >> quotes_lang;
|
|
|
|
|
quotes_language = quoteslangtranslator().find(quotes_lang);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papersize") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string ppsize;
|
|
|
|
|
lex >> ppsize;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
papersize = papersizetranslator().find(ppsize);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\use_geometry") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> use_geometry;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\use_amsmath") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
int use_ams;
|
|
|
|
|
lex >> use_ams;
|
2006-11-13 17:35:18 +00:00
|
|
|
|
use_amsmath = packagetranslator().find(use_ams);
|
|
|
|
|
} else if (token == "\\use_esint") {
|
|
|
|
|
int useesint;
|
|
|
|
|
lex >> useesint;
|
|
|
|
|
use_esint = packagetranslator().find(useesint);
|
2004-05-13 20:44:35 +00:00
|
|
|
|
} else if (token == "\\cite_engine") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string engine;
|
|
|
|
|
lex >> engine;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
cite_engine_ = citeenginetranslator().find(engine);
|
2004-03-29 13:17:25 +00:00
|
|
|
|
} else if (token == "\\use_bibtopic") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> use_bibtopic;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\tracking_changes") {
|
2006-10-06 18:53:35 +00:00
|
|
|
|
lex >> trackChanges;
|
2005-01-24 17:12:19 +00:00
|
|
|
|
} else if (token == "\\output_changes") {
|
2006-10-06 18:53:35 +00:00
|
|
|
|
lex >> outputChanges;
|
2003-08-17 11:28:23 +00:00
|
|
|
|
} else if (token == "\\branch") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2006-11-03 15:16:45 +00:00
|
|
|
|
docstring branch = lex.getDocString();
|
2003-09-09 17:00:19 +00:00
|
|
|
|
branchlist().add(branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
while (true) {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
string const tok = lex.getString();
|
|
|
|
|
if (tok == "\\end_branch")
|
|
|
|
|
break;
|
2003-12-14 16:33:56 +00:00
|
|
|
|
Branch * branch_ptr = branchlist().find(branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (tok == "\\selected") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
if (branch_ptr)
|
|
|
|
|
branch_ptr->setSelected(lex.getInteger());
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
// not yet operational
|
|
|
|
|
if (tok == "\\color") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.eatLine();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
string color = lex.getString();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
if (branch_ptr)
|
|
|
|
|
branch_ptr->setColor(color);
|
2007-04-26 17:34:20 +00:00
|
|
|
|
// Update also the Color table:
|
2003-09-09 17:25:35 +00:00
|
|
|
|
if (color == "none")
|
2007-04-26 17:34:20 +00:00
|
|
|
|
color = lcolor.getX11Name(Color::background);
|
2006-11-03 15:16:45 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
lcolor.setColor(to_utf8(branch), color);
|
2004-03-25 15:51:21 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\author") {
|
2004-08-23 11:02:20 +00:00
|
|
|
|
lex.eatLine();
|
2003-09-15 11:00:00 +00:00
|
|
|
|
istringstream ss(lex.getString());
|
2003-03-12 02:39:12 +00:00
|
|
|
|
Author a;
|
|
|
|
|
ss >> a;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
author_map.push_back(pimpl_->authorlist.record(a));
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperorientation") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string orient;
|
|
|
|
|
lex >> orient;
|
|
|
|
|
orientation = paperorientationtranslator().find(orient);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperwidth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> paperwidth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperheight") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> paperheight;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\leftmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> leftmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\topmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> topmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\rightmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> rightmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bottommargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> bottommargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\headheight") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> headheight;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\headsep") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> headsep;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\footskip") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> footskip;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperfontsize") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> fontsize;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papercolumns") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> columns;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
} else if (token == "\\listings_params") {
|
|
|
|
|
string par;
|
|
|
|
|
lex >> par;
|
2007-06-12 17:10:28 +00:00
|
|
|
|
listings_params = InsetListingsParams(par).params();
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papersides") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
int psides;
|
|
|
|
|
lex >> psides;
|
|
|
|
|
sides = sidestranslator().find(psides);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperpagestyle") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> pagestyle;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bullet") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
readBullets(lex);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bulletLaTeX") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
readBulletsLaTeX(lex);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\secnumdepth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> secnumdepth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\tocdepth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> tocdepth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\spacing") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string nspacing;
|
|
|
|
|
lex >> nspacing;
|
2005-01-06 13:48:13 +00:00
|
|
|
|
string tmp_val;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
if (nspacing == "other") {
|
|
|
|
|
lex >> tmp_val;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
2004-10-05 13:18:28 +00:00
|
|
|
|
spacing().set(spacetranslator().find(nspacing), tmp_val);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\float_placement") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> float_placement;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
return token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return string();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-02-22 00:36:17 +00:00
|
|
|
|
void BufferParams::writeFile(ostream & os) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
// The top of the file is written by the buffer.
|
|
|
|
|
// Prints out the buffer info into the .lyx file given by file
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
// the textclass
|
|
|
|
|
os << "\\textclass " << textclasslist[textclass].name() << '\n';
|
|
|
|
|
|
2007-03-12 15:15:21 +00:00
|
|
|
|
// then the preamble
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!preamble.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
// remove '\n' from the end of preamble
|
2002-07-28 22:50:13 +00:00
|
|
|
|
string const tmppreamble = rtrim(preamble, "\n");
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\begin_preamble\n"
|
2000-02-22 00:36:17 +00:00
|
|
|
|
<< tmppreamble
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\end_preamble\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
// the options
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!options.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\options " << options << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
// then the text parameters
|
2001-07-27 12:03:36 +00:00
|
|
|
|
if (language != ignore_language)
|
|
|
|
|
os << "\\language " << language->lang() << '\n';
|
|
|
|
|
os << "\\inputencoding " << inputenc
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
<< "\n\\font_roman " << fontsRoman
|
|
|
|
|
<< "\n\\font_sans " << fontsSans
|
|
|
|
|
<< "\n\\font_typewriter " << fontsTypewriter
|
|
|
|
|
<< "\n\\font_default_family " << fontsDefaultFamily
|
|
|
|
|
<< "\n\\font_sc " << convert<string>(fontsSC)
|
|
|
|
|
<< "\n\\font_osf " << convert<string>(fontsOSF)
|
|
|
|
|
<< "\n\\font_sf_scale " << fontsSansScale
|
|
|
|
|
<< "\n\\font_tt_scale " << fontsTypewriterScale
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\graphics " << graphicsDriver << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
if (!float_placement.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\float_placement " << float_placement << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperfontsize " << fontsize << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
spacing().writeFile(os);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2005-07-16 16:57:55 +00:00
|
|
|
|
os << "\\papersize " << string_papersize[papersize]
|
2005-01-06 15:40:49 +00:00
|
|
|
|
<< "\n\\use_geometry " << convert<string>(use_geometry)
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\use_amsmath " << use_amsmath
|
2006-11-13 17:35:18 +00:00
|
|
|
|
<< "\n\\use_esint " << use_esint
|
2007-03-25 01:12:38 +00:00
|
|
|
|
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
|
2005-01-06 15:40:49 +00:00
|
|
|
|
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\paperorientation " << string_orientation[orientation]
|
|
|
|
|
<< '\n';
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2005-10-25 15:21:49 +00:00
|
|
|
|
BranchList::const_iterator it = branchlist().begin();
|
|
|
|
|
BranchList::const_iterator end = branchlist().end();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
for (; it != end; ++it) {
|
2006-11-03 15:16:45 +00:00
|
|
|
|
os << "\\branch " << to_utf8(it->getBranch())
|
2003-09-09 17:25:35 +00:00
|
|
|
|
<< "\n\\selected " << it->getSelected()
|
2006-03-23 20:04:05 +00:00
|
|
|
|
<< "\n\\color " << lyx::X11hexname(it->getColor())
|
2003-09-09 17:25:35 +00:00
|
|
|
|
<< "\n\\end_branch"
|
2003-08-17 11:28:23 +00:00
|
|
|
|
<< "\n";
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!paperwidth.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperwidth "
|
|
|
|
|
<< VSpace(paperwidth).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!paperheight.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperheight "
|
|
|
|
|
<< VSpace(paperheight).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!leftmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\leftmargin "
|
|
|
|
|
<< VSpace(leftmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!topmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\topmargin "
|
|
|
|
|
<< VSpace(topmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!rightmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\rightmargin "
|
|
|
|
|
<< VSpace(rightmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!bottommargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\bottommargin "
|
|
|
|
|
<< VSpace(bottommargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!headheight.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\headheight "
|
|
|
|
|
<< VSpace(headheight).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!headsep.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\headsep "
|
|
|
|
|
<< VSpace(headsep).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!footskip.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\footskip "
|
|
|
|
|
<< VSpace(footskip).asLyXCommand() << '\n';
|
|
|
|
|
os << "\\secnumdepth " << secnumdepth
|
|
|
|
|
<< "\n\\tocdepth " << tocdepth
|
|
|
|
|
<< "\n\\paragraph_separation "
|
|
|
|
|
<< string_paragraph_separation[paragraph_separation]
|
2003-09-09 17:00:19 +00:00
|
|
|
|
<< "\n\\defskip " << getDefSkip().asLyXCommand()
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\quotes_language "
|
2005-10-13 10:59:39 +00:00
|
|
|
|
<< string_quotes_language[quotes_language]
|
2004-10-05 13:18:28 +00:00
|
|
|
|
<< "\n\\papercolumns " << columns
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\papersides " << sides
|
|
|
|
|
<< "\n\\paperpagestyle " << pagestyle << '\n';
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
if (!listings_params.empty())
|
2007-05-28 22:27:45 +00:00
|
|
|
|
os << "\\listings_params \"" <<
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
InsetListingsParams(listings_params).encodedString() << "\"\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
|
|
|
|
|
if (user_defined_bullet(i).getFont() != -1) {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
os << "\\bullet " << i << " "
|
|
|
|
|
<< user_defined_bullet(i).getFont() << " "
|
|
|
|
|
<< user_defined_bullet(i).getCharacter() << " "
|
|
|
|
|
<< user_defined_bullet(i).getSize() << "\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2006-10-20 19:26:23 +00:00
|
|
|
|
// FIXME UNICODE
|
2004-08-14 18:41:27 +00:00
|
|
|
|
os << "\\bulletLaTeX " << i << " \""
|
2006-10-20 19:26:23 +00:00
|
|
|
|
<< lyx::to_ascii(user_defined_bullet(i).getText())
|
2004-08-14 18:41:27 +00:00
|
|
|
|
<< "\"\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2006-10-06 18:53:35 +00:00
|
|
|
|
os << "\\tracking_changes " << convert<string>(trackChanges) << "\n";
|
|
|
|
|
os << "\\output_changes " << convert<string>(outputChanges) << "\n";
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2006-10-20 12:44:37 +00:00
|
|
|
|
AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
|
|
|
|
|
AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
|
|
|
|
|
for (; a_it != a_end; ++a_it) {
|
2007-07-09 20:52:34 +00:00
|
|
|
|
if (a_it->second.used())
|
|
|
|
|
os << "\\author " << a_it->second << "\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\author " << Author() << "\n";
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
2003-02-16 00:54:43 +00:00
|
|
|
|
TexRow & texrow) const
|
|
|
|
|
{
|
|
|
|
|
os << "\\documentclass";
|
|
|
|
|
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & tclass = getTextClass();
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
ostringstream clsoptions; // the document class options.
|
|
|
|
|
|
|
|
|
|
if (tokenPos(tclass.opt_fontsize(),
|
|
|
|
|
'|', fontsize) >= 0) {
|
|
|
|
|
// only write if existing in list (and not default)
|
|
|
|
|
clsoptions << fontsize << "pt,";
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-16 16:57:55 +00:00
|
|
|
|
// custom, A3, B3 and B4 paper sizes need geometry
|
2007-05-28 22:27:45 +00:00
|
|
|
|
bool nonstandard_papersize = papersize == PAPER_B3
|
2006-10-22 10:15:23 +00:00
|
|
|
|
|| papersize == PAPER_B4
|
|
|
|
|
|| papersize == PAPER_A3
|
|
|
|
|
|| papersize == PAPER_CUSTOM;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
2005-07-17 11:17:13 +00:00
|
|
|
|
if (!use_geometry) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (papersize) {
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "a4paper,";
|
|
|
|
|
break;
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
clsoptions << "letterpaper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "a5paper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "b5paper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "executivepaper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "legalpaper,";
|
|
|
|
|
break;
|
2003-06-10 14:39:45 +00:00
|
|
|
|
case PAPER_DEFAULT:
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
|
|
|
|
case PAPER_B3:
|
|
|
|
|
case PAPER_B4:
|
|
|
|
|
case PAPER_CUSTOM:
|
2003-06-10 14:39:45 +00:00
|
|
|
|
break;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if needed
|
|
|
|
|
if (sides != tclass.sides()) {
|
|
|
|
|
switch (sides) {
|
2007-04-29 19:53:54 +00:00
|
|
|
|
case TextClass::OneSide:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "oneside,";
|
|
|
|
|
break;
|
2007-04-29 19:53:54 +00:00
|
|
|
|
case TextClass::TwoSides:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "twoside,";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if needed
|
|
|
|
|
if (columns != tclass.columns()) {
|
|
|
|
|
if (columns == 2)
|
|
|
|
|
clsoptions << "twocolumn,";
|
|
|
|
|
else
|
|
|
|
|
clsoptions << "onecolumn,";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!use_geometry
|
|
|
|
|
&& orientation == ORIENTATION_LANDSCAPE)
|
|
|
|
|
clsoptions << "landscape,";
|
|
|
|
|
|
|
|
|
|
// language should be a parameter to \documentclass
|
|
|
|
|
if (language->babel() == "hebrew"
|
|
|
|
|
&& default_language->babel() != "hebrew")
|
|
|
|
|
// This seems necessary
|
|
|
|
|
features.useLanguage(default_language);
|
|
|
|
|
|
2003-05-23 11:18:43 +00:00
|
|
|
|
ostringstream language_options;
|
|
|
|
|
bool const use_babel = features.useBabel();
|
|
|
|
|
if (use_babel) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
language_options << features.getLanguages();
|
2007-05-05 19:18:34 +00:00
|
|
|
|
if (!language->babel().empty()) {
|
|
|
|
|
if (!language_options.str().empty())
|
|
|
|
|
language_options << ',';
|
|
|
|
|
language_options << language->babel();
|
|
|
|
|
}
|
2007-05-12 00:13:35 +00:00
|
|
|
|
if (lyxrc.language_global_options && !language_options.str().empty())
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << language_options.str() << ',';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the user-defined options
|
|
|
|
|
if (!options.empty()) {
|
|
|
|
|
clsoptions << options << ',';
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-15 11:00:00 +00:00
|
|
|
|
string strOptions(clsoptions.str());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!strOptions.empty()) {
|
|
|
|
|
strOptions = rtrim(strOptions, ",");
|
2006-10-19 16:51:30 +00:00
|
|
|
|
// FIXME UNICODE
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << '[' << from_utf8(strOptions) << ']';
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << '{' << from_ascii(tclass.latexname()) << "}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
// end of \documentclass defs
|
|
|
|
|
|
|
|
|
|
// font selection must be done before loading fontenc.sty
|
2006-09-09 15:27:44 +00:00
|
|
|
|
string const fonts =
|
2007-02-08 15:18:36 +00:00
|
|
|
|
loadFonts(fontsRoman, fontsSans,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
fontsTypewriter, fontsSC, fontsOSF,
|
|
|
|
|
fontsSansScale, fontsTypewriterScale);
|
|
|
|
|
if (!fonts.empty()) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << from_ascii(fonts);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
if (fontsDefaultFamily != "default")
|
2006-09-09 15:27:44 +00:00
|
|
|
|
os << "\\renewcommand{\\familydefault}{\\"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(fontsDefaultFamily) << "}\n";
|
2007-06-22 22:23:37 +00:00
|
|
|
|
|
|
|
|
|
// set font encoding
|
2003-02-16 00:54:43 +00:00
|
|
|
|
// this one is not per buffer
|
2007-06-26 00:11:03 +00:00
|
|
|
|
// for arabic_arabi and farsi we also need to load the LAE and LFE encoding
|
2007-06-22 22:31:49 +00:00
|
|
|
|
if (lyxrc.fontenc != "default") {
|
2007-06-26 00:11:03 +00:00
|
|
|
|
if (language->lang() == "arabic_arabi" || language->lang() == "farsi") {
|
2007-06-22 22:31:49 +00:00
|
|
|
|
os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
|
|
|
|
|
<< ",LFE,LAE]{fontenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
} else {
|
|
|
|
|
os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
|
|
|
|
|
<< "]{fontenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-05-28 07:43:15 +00:00
|
|
|
|
// handle inputenc etc.
|
2007-05-28 12:25:53 +00:00
|
|
|
|
writeEncodingPreamble(os, features, texrow);
|
2007-05-01 17:48:04 +00:00
|
|
|
|
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
if (!listings_params.empty()) {
|
|
|
|
|
os << "\\usepackage{listings}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
os << "\\lstset{";
|
|
|
|
|
// do not test validity because listings_params is supposed to be valid
|
|
|
|
|
string par = InsetListingsParams(listings_params).separatedParams(true);
|
|
|
|
|
os << from_ascii(par);
|
|
|
|
|
// count the number of newlines
|
|
|
|
|
for (size_t i = 0; i < par.size(); ++i)
|
|
|
|
|
if (par[i] == '\n')
|
|
|
|
|
texrow.newline();
|
|
|
|
|
os << "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2005-07-16 16:57:55 +00:00
|
|
|
|
if (use_geometry || nonstandard_papersize) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << "\\usepackage{geometry}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
os << "\\geometry{verbose";
|
|
|
|
|
if (orientation == ORIENTATION_LANDSCAPE)
|
|
|
|
|
os << ",landscape";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
switch (papersize) {
|
|
|
|
|
case PAPER_CUSTOM:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!paperwidth.empty())
|
|
|
|
|
os << ",paperwidth="
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(paperwidth);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!paperheight.empty())
|
|
|
|
|
os << ",paperheight="
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(paperheight);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLETTER:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",letterpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",legalpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",executivepaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b5paper";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2005-07-16 16:57:55 +00:00
|
|
|
|
// default papersize ie PAPER_DEFAULT
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (lyxrc.default_papersize) {
|
|
|
|
|
case PAPER_DEFAULT: // keep compiler happy
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
os << ",letterpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",legalpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",executivepaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B3:
|
|
|
|
|
case PAPER_B4:
|
|
|
|
|
case PAPER_CUSTOM:
|
|
|
|
|
break;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!topmargin.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!bottommargin.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!leftmargin.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!rightmargin.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!headheight.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",headheight=" << from_ascii(Length(headheight).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!headsep.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",headsep=" << from_ascii(Length(headsep).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!footskip.empty())
|
2007-04-28 12:58:49 +00:00
|
|
|
|
os << ",footskip=" << from_ascii(Length(footskip).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tokenPos(tclass.opt_pagestyle(),
|
|
|
|
|
'|', pagestyle) >= 0) {
|
|
|
|
|
if (pagestyle == "fancy") {
|
|
|
|
|
os << "\\usepackage{fancyhdr}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << "\\pagestyle{" << from_ascii(pagestyle) << "}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-24 11:57:19 +00:00
|
|
|
|
// Only if class has a ToC hierarchy
|
|
|
|
|
if (tclass.hasTocLevels()) {
|
|
|
|
|
if (secnumdepth != tclass.secnumdepth()) {
|
|
|
|
|
os << "\\setcounter{secnumdepth}{"
|
|
|
|
|
<< secnumdepth
|
|
|
|
|
<< "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
if (tocdepth != tclass.tocdepth()) {
|
|
|
|
|
os << "\\setcounter{tocdepth}{"
|
|
|
|
|
<< tocdepth
|
|
|
|
|
<< "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (paragraph_separation) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
switch (getDefSkip().kind()) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
case VSpace::SMALLSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\smallskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\medskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\bigskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::LENGTH:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
<< from_utf8(getDefSkip().length().asLatexString())
|
2003-02-16 00:54:43 +00:00
|
|
|
|
<< "}\n";
|
|
|
|
|
break;
|
|
|
|
|
default: // should never happen // Then delete it.
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\medskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
texrow.newline();
|
|
|
|
|
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parindent}{0pt}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-07 14:33:17 +00:00
|
|
|
|
// If we use jurabib, we have to call babel here.
|
|
|
|
|
if (use_babel && features.isRequired("jurabib")) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << from_ascii(babelCall(language_options.str()))
|
2004-03-07 14:33:17 +00:00
|
|
|
|
<< '\n'
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(features.getBabelOptions());
|
2004-03-07 14:33:17 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2003-02-16 00:54:43 +00:00
|
|
|
|
// Now insert the LyX specific LaTeX commands...
|
|
|
|
|
|
|
|
|
|
// The optional packages;
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring lyxpreamble(from_ascii(features.getPackages()));
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
// this might be useful...
|
|
|
|
|
lyxpreamble += "\n\\makeatletter\n";
|
|
|
|
|
|
|
|
|
|
// Some macros LyX will need
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring tmppreamble(from_ascii(features.getMacros()));
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
if (!tmppreamble.empty()) {
|
|
|
|
|
lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"LyX specific LaTeX commands.\n"
|
|
|
|
|
+ tmppreamble + '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the text class specific preamble
|
|
|
|
|
tmppreamble = features.getTClassPreamble();
|
|
|
|
|
if (!tmppreamble.empty()) {
|
|
|
|
|
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"Textclass specific LaTeX commands.\n"
|
|
|
|
|
+ tmppreamble + '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* the user-defined preamble */
|
|
|
|
|
if (!preamble.empty()) {
|
2006-11-08 17:22:44 +00:00
|
|
|
|
// FIXME UNICODE
|
2003-02-16 00:54:43 +00:00
|
|
|
|
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"User specified LaTeX commands.\n"
|
2006-11-08 17:22:44 +00:00
|
|
|
|
+ from_utf8(preamble) + '\n';
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Itemize bullet settings need to be last in case the user
|
|
|
|
|
// defines their own bullets that use a package included
|
|
|
|
|
// in the user-defined preamble -- ARRae
|
|
|
|
|
// Actually it has to be done much later than that
|
|
|
|
|
// since some packages like frenchb make modifications
|
|
|
|
|
// at \begin{document} time -- JMarc
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring bullets_def;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (bullets_def.empty())
|
2006-11-08 17:22:44 +00:00
|
|
|
|
bullets_def += "\\AtBeginDocument{\n";
|
2006-03-10 16:25:20 +00:00
|
|
|
|
bullets_def += " \\def\\labelitemi";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (i) {
|
|
|
|
|
// `i' is one less than the item to modify
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
bullets_def += 'i';
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
bullets_def += "ii";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
bullets_def += 'v';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2006-03-10 16:25:20 +00:00
|
|
|
|
bullets_def += '{' +
|
2006-11-08 17:22:44 +00:00
|
|
|
|
user_defined_bullet(i).getText()
|
2003-02-16 00:54:43 +00:00
|
|
|
|
+ "}\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!bullets_def.empty())
|
|
|
|
|
lyxpreamble += bullets_def + "}\n\n";
|
|
|
|
|
|
|
|
|
|
// We try to load babel late, in case it interferes
|
2004-04-03 08:37:12 +00:00
|
|
|
|
// with other packages.
|
2004-03-07 14:33:17 +00:00
|
|
|
|
// Jurabib has to be called after babel, though.
|
|
|
|
|
if (use_babel && !features.isRequired("jurabib")) {
|
2006-11-08 17:22:44 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
|
|
|
|
|
lyxpreamble += from_utf8(features.getBabelOptions());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-22 22:23:37 +00:00
|
|
|
|
lyxpreamble += "\\makeatother\n\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
int const nlines =
|
|
|
|
|
int(lyx::count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
|
|
|
|
|
for (int j = 0; j != nlines; ++j) {
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-08 17:22:44 +00:00
|
|
|
|
os << lyxpreamble;
|
2003-05-22 22:44:30 +00:00
|
|
|
|
return use_babel;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
void BufferParams::useClassDefaults()
|
|
|
|
|
{
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & tclass = textclasslist[textclass];
|
1999-11-04 01:40:20 +00:00
|
|
|
|
|
|
|
|
|
sides = tclass.sides();
|
|
|
|
|
columns = tclass.columns();
|
|
|
|
|
pagestyle = tclass.pagestyle();
|
|
|
|
|
options = tclass.options();
|
2006-03-24 11:57:19 +00:00
|
|
|
|
// Only if class has a ToC hierarchy
|
|
|
|
|
if (tclass.hasTocLevels()) {
|
|
|
|
|
secnumdepth = tclass.secnumdepth();
|
|
|
|
|
tocdepth = tclass.tocdepth();
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
bool BufferParams::hasClassDefaults() const
|
|
|
|
|
{
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & tclass = textclasslist[textclass];
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
return (sides == tclass.sides()
|
|
|
|
|
&& columns == tclass.columns()
|
|
|
|
|
&& pagestyle == tclass.pagestyle()
|
|
|
|
|
&& options == tclass.options()
|
|
|
|
|
&& secnumdepth == tclass.secnumdepth()
|
|
|
|
|
&& tocdepth == tclass.tocdepth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & BufferParams::getTextClass() const
|
2002-07-21 21:21:06 +00:00
|
|
|
|
{
|
|
|
|
|
return textclasslist[textclass];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 18:17:15 +00:00
|
|
|
|
Font const BufferParams::getFont() const
|
2006-02-05 13:20:16 +00:00
|
|
|
|
{
|
2007-04-29 19:53:54 +00:00
|
|
|
|
Font f = getTextClass().defaultfont();
|
2006-02-05 13:20:16 +00:00
|
|
|
|
f.setLanguage(language);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
if (fontsDefaultFamily == "rmdefault")
|
2007-04-29 18:17:15 +00:00
|
|
|
|
f.setFamily(Font::ROMAN_FAMILY);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
else if (fontsDefaultFamily == "sfdefault")
|
2007-04-29 18:17:15 +00:00
|
|
|
|
f.setFamily(Font::SANS_FAMILY);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
else if (fontsDefaultFamily == "ttdefault")
|
2007-04-29 18:17:15 +00:00
|
|
|
|
f.setFamily(Font::TYPEWRITER_FAMILY);
|
2006-02-05 13:20:16 +00:00
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void BufferParams::readPreamble(Lexer & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2001-08-06 19:12:46 +00:00
|
|
|
|
if (lex.getString() != "\\begin_preamble")
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr << "Error (BufferParams::readPreamble):"
|
|
|
|
|
"consistency check failed." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
preamble = lex.getLongString("\\end_preamble");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void BufferParams::readLanguage(Lexer & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-08-06 19:12:46 +00:00
|
|
|
|
string const tmptok = lex.getString();
|
2000-03-12 10:35:05 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// check if tmptok is part of tex_babel in tex-defs.h
|
2000-10-10 12:36:36 +00:00
|
|
|
|
language = languages.getLanguage(tmptok);
|
|
|
|
|
if (!language) {
|
|
|
|
|
// Language tmptok was not found
|
|
|
|
|
language = default_language;
|
2000-11-28 06:46:06 +00:00
|
|
|
|
lyxerr << "Warning: Setting language `"
|
|
|
|
|
<< tmptok << "' to `" << language->lang()
|
2000-10-10 12:36:36 +00:00
|
|
|
|
<< "'." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void BufferParams::readGraphicsDriver(Lexer & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-08-06 19:12:46 +00:00
|
|
|
|
string const tmptok = lex.getString();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// check if tmptok is part of tex_graphics in tex_defs.h
|
2000-11-21 15:46:13 +00:00
|
|
|
|
int n = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while (true) {
|
2000-11-21 15:46:13 +00:00
|
|
|
|
string const test = tex_graphics[n++];
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
|
|
if (test == tmptok) {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
graphicsDriver = tmptok;
|
|
|
|
|
break;
|
2005-02-12 16:21:32 +00:00
|
|
|
|
} else if (test == "") {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
lex.printError(
|
|
|
|
|
"Warning: graphics driver `$$Token' not recognized!\n"
|
|
|
|
|
" Setting graphics driver to `default'.\n");
|
|
|
|
|
graphicsDriver = "default";
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-17 08:23:33 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void BufferParams::readBullets(Lexer & lex)
|
2004-10-05 13:18:28 +00:00
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
|
|
|
|
|
|
|
|
|
int const index = lex.getInteger();
|
|
|
|
|
lex.next();
|
|
|
|
|
int temp_int = lex.getInteger();
|
|
|
|
|
user_defined_bullet(index).setFont(temp_int);
|
|
|
|
|
temp_bullet(index).setFont(temp_int);
|
|
|
|
|
lex >> temp_int;
|
|
|
|
|
user_defined_bullet(index).setCharacter(temp_int);
|
|
|
|
|
temp_bullet(index).setCharacter(temp_int);
|
|
|
|
|
lex >> temp_int;
|
|
|
|
|
user_defined_bullet(index).setSize(temp_int);
|
2004-10-26 21:16:44 +00:00
|
|
|
|
temp_bullet(index).setSize(temp_int);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void BufferParams::readBulletsLaTeX(Lexer & lex)
|
2004-10-05 13:18:28 +00:00
|
|
|
|
{
|
|
|
|
|
// The bullet class should be able to read this.
|
|
|
|
|
if (!lex.next()) return;
|
|
|
|
|
int const index = lex.getInteger();
|
|
|
|
|
lex.next(true);
|
2006-10-20 19:26:23 +00:00
|
|
|
|
docstring const temp_str = lex.getDocString();
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
user_defined_bullet(index).setText(temp_str);
|
|
|
|
|
temp_bullet(index).setText(temp_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-07-17 08:23:33 +00:00
|
|
|
|
string const BufferParams::paperSizeName() const
|
|
|
|
|
{
|
|
|
|
|
char real_papersize = papersize;
|
|
|
|
|
if (real_papersize == PAPER_DEFAULT)
|
|
|
|
|
real_papersize = lyxrc.default_papersize;
|
|
|
|
|
|
|
|
|
|
switch (real_papersize) {
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a3";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a4";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a5";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "b5";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "foolscap";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "legal";
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
default:
|
|
|
|
|
return "letter";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const BufferParams::dvips_options() const
|
|
|
|
|
{
|
|
|
|
|
string result;
|
|
|
|
|
|
|
|
|
|
if (use_geometry
|
2005-07-16 16:57:55 +00:00
|
|
|
|
&& papersize == PAPER_CUSTOM
|
2003-07-17 08:23:33 +00:00
|
|
|
|
&& !lyxrc.print_paper_dimension_flag.empty()
|
|
|
|
|
&& !paperwidth.empty()
|
|
|
|
|
&& !paperheight.empty()) {
|
|
|
|
|
// using a custom papersize
|
|
|
|
|
result = lyxrc.print_paper_dimension_flag;
|
|
|
|
|
result += ' ' + paperwidth;
|
|
|
|
|
result += ',' + paperheight;
|
|
|
|
|
} else {
|
|
|
|
|
string const paper_option = paperSizeName();
|
|
|
|
|
if (paper_option != "letter" ||
|
|
|
|
|
orientation != ORIENTATION_LANDSCAPE) {
|
2003-07-28 14:40:29 +00:00
|
|
|
|
// dvips won't accept -t letter -t landscape.
|
2003-07-17 08:23:33 +00:00
|
|
|
|
// In all other cases, include the paper size
|
|
|
|
|
// explicitly.
|
|
|
|
|
result = lyxrc.print_paper_flag;
|
|
|
|
|
result += ' ' + paper_option;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (orientation == ORIENTATION_LANDSCAPE &&
|
2005-07-16 16:57:55 +00:00
|
|
|
|
papersize != PAPER_CUSTOM)
|
2003-07-17 08:23:33 +00:00
|
|
|
|
result += ' ' + lyxrc.print_landscape_flag;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2004-03-07 14:33:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const BufferParams::babelCall(string const & lang_opts) const
|
|
|
|
|
{
|
2007-05-09 21:10:55 +00:00
|
|
|
|
string lang_pack = lyxrc.language_package;
|
2007-05-12 00:13:35 +00:00
|
|
|
|
if (lang_pack != "\\usepackage{babel}")
|
|
|
|
|
return lang_pack;
|
|
|
|
|
// suppress the babel call when there is no babel language defined
|
|
|
|
|
// for the document language in the lib/languages file and if no
|
|
|
|
|
// other languages are used (lang_opts is then empty)
|
|
|
|
|
if (lang_opts.empty())
|
|
|
|
|
return string();
|
|
|
|
|
if (!lyxrc.language_global_options)
|
2007-05-12 00:22:37 +00:00
|
|
|
|
return "\\usepackage[" + lang_opts + "]{babel}";
|
2007-05-09 21:10:55 +00:00
|
|
|
|
return lang_pack;
|
2004-03-07 14:33:17 +00:00
|
|
|
|
}
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
|
|
|
|
|
|
2007-05-28 12:25:53 +00:00
|
|
|
|
void BufferParams::writeEncodingPreamble(odocstream & os,
|
|
|
|
|
LaTeXFeatures & features, TexRow & texrow) const
|
2007-05-28 07:43:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (inputenc == "auto") {
|
|
|
|
|
string const doc_encoding =
|
|
|
|
|
language->encoding()->latexName();
|
|
|
|
|
Encoding::Package const package =
|
|
|
|
|
language->encoding()->package();
|
|
|
|
|
|
|
|
|
|
// Create a list with all the input encodings used
|
|
|
|
|
// in the document
|
|
|
|
|
std::set<string> encodings =
|
|
|
|
|
features.getEncodingSet(doc_encoding);
|
|
|
|
|
|
|
|
|
|
if (!encodings.empty() || package == Encoding::inputenc) {
|
|
|
|
|
os << "\\usepackage[";
|
|
|
|
|
std::set<string>::const_iterator it = encodings.begin();
|
|
|
|
|
std::set<string>::const_iterator const end = encodings.end();
|
|
|
|
|
if (it != end) {
|
|
|
|
|
os << from_ascii(*it);
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
for (; it != end; ++it)
|
|
|
|
|
os << ',' << from_ascii(*it);
|
|
|
|
|
if (package == Encoding::inputenc) {
|
|
|
|
|
if (!encodings.empty())
|
|
|
|
|
os << ',';
|
|
|
|
|
os << from_ascii(doc_encoding);
|
|
|
|
|
}
|
|
|
|
|
os << "]{inputenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2007-11-17 12:35:50 +00:00
|
|
|
|
if (package == Encoding::CJK || features.mustProvide("CJK")) {
|
2007-05-28 07:43:15 +00:00
|
|
|
|
os << "\\usepackage{CJK}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
} else if (inputenc != "default") {
|
2007-07-23 16:46:26 +00:00
|
|
|
|
switch (encoding().package()) {
|
2007-05-28 07:43:15 +00:00
|
|
|
|
case Encoding::none:
|
|
|
|
|
break;
|
|
|
|
|
case Encoding::inputenc:
|
|
|
|
|
os << "\\usepackage[" << from_ascii(inputenc)
|
|
|
|
|
<< "]{inputenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
break;
|
|
|
|
|
case Encoding::CJK:
|
|
|
|
|
os << "\\usepackage{CJK}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The encoding "armscii8" is only available when the package "armtex" is loaded.
|
|
|
|
|
// armscii8 is used for Armenian.
|
|
|
|
|
if (language->encoding()->latexName() == "armscii8" || inputenc == "armscii8") {
|
|
|
|
|
os << "\\usepackage{armtex}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-08 15:18:36 +00:00
|
|
|
|
string const BufferParams::loadFonts(string const & rm,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
string const & sf, string const & tt,
|
|
|
|
|
bool const & sc, bool const & osf,
|
|
|
|
|
int const & sfscale, int const & ttscale) const
|
|
|
|
|
{
|
|
|
|
|
/* The LaTeX font world is in a flux. In the PSNFSS font interface,
|
|
|
|
|
several packages have been replaced by others, that might not
|
|
|
|
|
be installed on every system. We have to take care for that
|
|
|
|
|
(see psnfss.pdf). We try to support all psnfss fonts as well
|
|
|
|
|
as the fonts that have become de facto standard in the LaTeX
|
|
|
|
|
world (e.g. Latin Modern). We do not support obsolete fonts
|
|
|
|
|
(like PSLatex). In general, it should be possible to mix any
|
|
|
|
|
rm font with any sf or tt font, respectively. (JSpitzm)
|
|
|
|
|
TODO:
|
|
|
|
|
-- separate math fonts.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (rm == "default" && sf == "default" && tt == "default")
|
|
|
|
|
//nothing to do
|
|
|
|
|
return string();
|
|
|
|
|
|
|
|
|
|
ostringstream os;
|
|
|
|
|
|
|
|
|
|
// ROMAN FONTS
|
|
|
|
|
// Computer Modern (must be explicitely selectable -- there might be classes
|
|
|
|
|
// that define a different default font!
|
|
|
|
|
if (rm == "cmr") {
|
|
|
|
|
os << "\\renewcommand{\\rmdefault}{cmr}\n";
|
|
|
|
|
// osf for Computer Modern needs eco.sty
|
|
|
|
|
if (osf)
|
|
|
|
|
os << "\\usepackage{eco}\n";
|
|
|
|
|
}
|
|
|
|
|
// Latin Modern Roman
|
|
|
|
|
else if (rm == "lmodern")
|
|
|
|
|
os << "\\usepackage{lmodern}\n";
|
|
|
|
|
// AE
|
|
|
|
|
else if (rm == "ae") {
|
|
|
|
|
// not needed when using OT1 font encoding.
|
|
|
|
|
if (lyxrc.fontenc != "default")
|
|
|
|
|
os << "\\usepackage{ae,aecompl}\n";
|
|
|
|
|
}
|
|
|
|
|
// Times
|
|
|
|
|
else if (rm == "times") {
|
|
|
|
|
// try to load the best available package
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("mathptmx"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathptmx}\n";
|
2007-02-08 15:18:36 +00:00
|
|
|
|
else if (LaTeXFeatures::isAvailable("mathptm"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathptm}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{times}\n";
|
|
|
|
|
}
|
|
|
|
|
// Palatino
|
|
|
|
|
else if (rm == "palatino") {
|
|
|
|
|
// try to load the best available package
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("mathpazo")) {
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage";
|
|
|
|
|
if (osf || sc) {
|
|
|
|
|
os << '[';
|
|
|
|
|
if (!osf)
|
|
|
|
|
os << "sc";
|
|
|
|
|
else
|
|
|
|
|
// "osf" includes "sc"!
|
|
|
|
|
os << "osf";
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << "{mathpazo}\n";
|
|
|
|
|
}
|
2007-02-08 15:18:36 +00:00
|
|
|
|
else if (LaTeXFeatures::isAvailable("mathpple"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathpple}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{palatino}\n";
|
|
|
|
|
}
|
|
|
|
|
// Utopia
|
|
|
|
|
else if (rm == "utopia") {
|
|
|
|
|
// fourier supersedes utopia.sty, but does
|
|
|
|
|
// not work with OT1 encoding.
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("fourier")
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
&& lyxrc.fontenc != "default") {
|
|
|
|
|
os << "\\usepackage";
|
|
|
|
|
if (osf || sc) {
|
|
|
|
|
os << '[';
|
|
|
|
|
if (sc)
|
|
|
|
|
os << "expert";
|
|
|
|
|
if (osf && sc)
|
|
|
|
|
os << ',';
|
|
|
|
|
if (osf)
|
|
|
|
|
os << "oldstyle";
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << "{fourier}\n";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{utopia}\n";
|
|
|
|
|
}
|
|
|
|
|
// Bera (complete fontset)
|
|
|
|
|
else if (rm == "bera" && sf == "default" && tt == "default")
|
|
|
|
|
os << "\\usepackage{bera}\n";
|
|
|
|
|
// everything else
|
|
|
|
|
else if (rm != "default")
|
|
|
|
|
os << "\\usepackage" << "{" << rm << "}\n";
|
|
|
|
|
|
|
|
|
|
// SANS SERIF
|
|
|
|
|
// Helvetica, Bera Sans
|
|
|
|
|
if (sf == "helvet" || sf == "berasans") {
|
|
|
|
|
if (sfscale != 100)
|
|
|
|
|
os << "\\usepackage[scaled=" << float(sfscale) / 100
|
|
|
|
|
<< "]{" << sf << "}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{" << sf << "}\n";
|
|
|
|
|
}
|
|
|
|
|
// Avant Garde
|
|
|
|
|
else if (sf == "avant")
|
|
|
|
|
os << "\\usepackage{" << sf << "}\n";
|
|
|
|
|
// Computer Modern, Latin Modern, CM Bright
|
|
|
|
|
else if (sf != "default")
|
|
|
|
|
os << "\\renewcommand{\\sfdefault}{" << sf << "}\n";
|
|
|
|
|
|
|
|
|
|
// monospaced/typewriter
|
|
|
|
|
// Courier, LuxiMono
|
|
|
|
|
if (tt == "luximono" || tt == "beramono") {
|
|
|
|
|
if (ttscale != 100)
|
|
|
|
|
os << "\\usepackage[scaled=" << float(ttscale) / 100
|
|
|
|
|
<< "]{" << tt << "}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{" << tt << "}\n";
|
|
|
|
|
}
|
|
|
|
|
// Courier
|
|
|
|
|
else if (tt == "courier" )
|
|
|
|
|
os << "\\usepackage{" << tt << "}\n";
|
|
|
|
|
// Computer Modern, Latin Modern, CM Bright
|
|
|
|
|
else if (tt != "default")
|
|
|
|
|
os << "\\renewcommand{\\ttdefault}{" << tt << "}\n";
|
|
|
|
|
|
|
|
|
|
return os.str();
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
2006-12-10 16:08:52 +00:00
|
|
|
|
Encoding const & BufferParams::encoding() const
|
|
|
|
|
{
|
2007-01-13 14:36:54 +00:00
|
|
|
|
if (inputenc == "auto" || inputenc == "default")
|
2006-12-10 16:08:52 +00:00
|
|
|
|
return *(language->encoding());
|
2007-01-13 14:36:54 +00:00
|
|
|
|
Encoding const * const enc =
|
2006-12-29 09:24:18 +00:00
|
|
|
|
encodings.getFromLaTeXName(inputenc);
|
2006-12-10 16:08:52 +00:00
|
|
|
|
if (enc)
|
|
|
|
|
return *enc;
|
2007-01-13 14:36:54 +00:00
|
|
|
|
lyxerr << "Unknown inputenc value `" << inputenc
|
|
|
|
|
<< "'. Using `auto' instead." << endl;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
return *(language->encoding());
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-22 07:22:16 +00:00
|
|
|
|
|
2007-03-25 01:12:38 +00:00
|
|
|
|
biblio::CiteEngine BufferParams::getEngine() const
|
2007-03-22 07:22:16 +00:00
|
|
|
|
{
|
|
|
|
|
// FIXME the class should provide the numerical/
|
|
|
|
|
// authoryear choice
|
2007-04-29 19:53:54 +00:00
|
|
|
|
if (getTextClass().provides("natbib")
|
2007-03-25 01:12:38 +00:00
|
|
|
|
&& cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL)
|
2007-03-22 07:22:16 +00:00
|
|
|
|
return biblio::ENGINE_NATBIB_AUTHORYEAR;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
return cite_engine_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::setCiteEngine(biblio::CiteEngine const cite_engine)
|
|
|
|
|
{
|
|
|
|
|
cite_engine_ = cite_engine;
|
2007-03-22 07:22:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|