2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiDocument.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
* \author Richard Heck (modules)
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiDocument.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-05-08 09:18:45 +00:00
|
|
|
#include "GuiApplication.h"
|
|
|
|
#include "GuiBranches.h"
|
2009-04-16 07:29:01 +00:00
|
|
|
#include "GuiIndices.h"
|
2008-09-20 13:44:51 +00:00
|
|
|
#include "GuiSelectionManager.h"
|
2008-05-08 09:18:45 +00:00
|
|
|
#include "LaTeXHighlighter.h"
|
|
|
|
#include "LengthCombo.h"
|
|
|
|
#include "PanelStack.h"
|
|
|
|
#include "Validator.h"
|
|
|
|
|
2008-03-07 03:53:21 +00:00
|
|
|
#include "LayoutFile.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "BranchList.h"
|
|
|
|
#include "buffer_funcs.h"
|
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "BufferView.h"
|
2007-11-02 23:42:27 +00:00
|
|
|
#include "Color.h"
|
2009-04-11 21:40:11 +00:00
|
|
|
#include "ColorCache.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "Encoding.h"
|
2006-08-25 13:40:01 +00:00
|
|
|
#include "FloatPlacement.h"
|
2009-04-10 11:06:53 +00:00
|
|
|
#include "Format.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "FuncRequest.h"
|
2009-07-19 21:13:27 +00:00
|
|
|
#include "HSpace.h"
|
2009-04-16 07:29:01 +00:00
|
|
|
#include "IndicesList.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "Language.h"
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "Layout.h"
|
2009-02-12 15:07:22 +00:00
|
|
|
#include "LayoutModuleList.h"
|
2009-02-06 21:24:13 +00:00
|
|
|
#include "LyXRC.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "ModuleList.h"
|
|
|
|
#include "OutputParams.h"
|
|
|
|
#include "PDFOptions.h"
|
2007-05-14 12:09:14 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-10-06 22:43:21 +00:00
|
|
|
#include "Spacing.h"
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
#include "TextClass.h"
|
2007-05-14 12:09:14 +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
|
|
|
#include "insets/InsetListingsParams.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
#include "support/debug.h"
|
2007-12-05 09:23:19 +00:00
|
|
|
#include "support/FileName.h"
|
|
|
|
#include "support/filetools.h"
|
2008-05-08 09:18:45 +00:00
|
|
|
#include "support/gettext.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2008-01-15 10:38:19 +00:00
|
|
|
#include "frontends/alert.h"
|
|
|
|
|
2008-05-14 10:34:19 +00:00
|
|
|
#include <QAbstractItemModel>
|
2009-08-18 07:20:40 +00:00
|
|
|
#include <QHeaderView>
|
2009-04-11 21:40:11 +00:00
|
|
|
#include <QColor>
|
|
|
|
#include <QColorDialog>
|
2007-05-14 12:09:14 +00:00
|
|
|
#include <QCloseEvent>
|
2009-04-06 06:58:30 +00:00
|
|
|
#include <QFontDatabase>
|
2007-05-14 14:23:55 +00:00
|
|
|
#include <QScrollBar>
|
2007-05-14 12:09:14 +00:00
|
|
|
#include <QTextCursor>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
#include <sstream>
|
2008-10-14 14:04:21 +00:00
|
|
|
#include <vector>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-04-16 16:48:12 +00:00
|
|
|
#ifdef IN
|
|
|
|
#undef IN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-04-11 21:40:11 +00:00
|
|
|
// a style sheet for buttons
|
|
|
|
// this is for example used for the background color setting button
|
2009-04-12 09:13:46 +00:00
|
|
|
static inline QString colorButtonStyleSheet(QColor const & bgColor)
|
2009-04-11 21:40:11 +00:00
|
|
|
{
|
2009-04-12 09:13:46 +00:00
|
|
|
if (bgColor.isValid()) {
|
2010-04-02 23:50:39 +00:00
|
|
|
QString rc = QLatin1String("background-color:");
|
2009-04-12 09:13:46 +00:00
|
|
|
rc += bgColor.name();
|
|
|
|
return rc;
|
|
|
|
}
|
2009-04-12 10:11:54 +00:00
|
|
|
return QString();
|
2009-04-11 21:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 19:57:42 +00:00
|
|
|
using namespace lyx::support;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-01-14 19:52:16 +00:00
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
namespace {
|
2008-01-14 19:52:16 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * const tex_graphics[] =
|
|
|
|
{
|
2008-09-29 19:33:37 +00:00
|
|
|
"default", "dvialw", "dvilaser", "dvipdf", "dvipdfm", "dvipdfmx",
|
|
|
|
"dvips", "dvipsone", "dvitops", "dviwin", "dviwindo", "dvi2ps", "emtex",
|
|
|
|
"ln", "oztex", "pctexhp", "pctexps", "pctexwin", "pctex32", "pdftex",
|
|
|
|
"psprint", "pubps", "tcidvi", "textures", "truetex", "vtex", "xdvi",
|
|
|
|
"xetex", "none", ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * const tex_graphics_gui[] =
|
|
|
|
{
|
2008-09-29 19:33:37 +00:00
|
|
|
N_("Default"), "dvialw", "DviLaser", "dvipdf", "DVIPDFM", "DVIPDFMx",
|
|
|
|
"Dvips", "DVIPSONE", "DVItoPS", "DVIWIN", "DVIWindo", "dvi2ps", "EmTeX",
|
|
|
|
"LN", "OzTeX", "pctexhp", "pctexps", "pctexwin", "PCTeX32", "pdfTeX",
|
|
|
|
"psprint", "pubps", "tcidvi", "Textures", "TrueTeX", "VTeX", "xdvi",
|
|
|
|
"XeTeX", N_("None"), ""
|
2007-06-01 17:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * const tex_fonts_roman[] =
|
|
|
|
{
|
|
|
|
"default", "cmr", "lmodern", "ae", "times", "palatino",
|
|
|
|
"charter", "newcent", "bookman", "utopia", "beraserif",
|
|
|
|
"ccfonts", "chancery", ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * tex_fonts_roman_gui[] =
|
|
|
|
{
|
|
|
|
N_("Default"), N_("Computer Modern Roman"), N_("Latin Modern Roman"),
|
|
|
|
N_("AE (Almost European)"), N_("Times Roman"), N_("Palatino"),
|
|
|
|
N_("Bitstream Charter"), N_("New Century Schoolbook"), N_("Bookman"),
|
|
|
|
N_("Utopia"), N_("Bera Serif"), N_("Concrete Roman"), N_("Zapf Chancery"),
|
|
|
|
""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * const tex_fonts_sans[] =
|
|
|
|
{
|
|
|
|
"default", "cmss", "lmss", "helvet", "avant", "berasans", "cmbr", ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * tex_fonts_sans_gui[] =
|
|
|
|
{
|
|
|
|
N_("Default"), N_("Computer Modern Sans"), N_("Latin Modern Sans"),
|
|
|
|
N_("Helvetica"), N_("Avant Garde"), N_("Bera Sans"), N_("CM Bright"), ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * const tex_fonts_monospaced[] =
|
|
|
|
{
|
|
|
|
"default", "cmtt", "lmtt", "courier", "beramono", "luximono", "cmtl", ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
char const * tex_fonts_monospaced_gui[] =
|
|
|
|
{
|
|
|
|
N_("Default"), N_("Computer Modern Typewriter"),
|
|
|
|
N_("Latin Modern Typewriter"), N_("Courier"), N_("Bera Mono"),
|
|
|
|
N_("LuxiMono"), N_("CM Typewriter Light"), ""
|
2007-04-30 21:01:24 +00:00
|
|
|
};
|
|
|
|
|
2007-06-01 17:44:04 +00:00
|
|
|
|
2008-10-13 16:01:02 +00:00
|
|
|
char const * backref_opts[] =
|
|
|
|
{
|
|
|
|
"false", "section", "slide", "page", ""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
char const * backref_opts_gui[] =
|
|
|
|
{
|
|
|
|
N_("Off"), N_("Section"), N_("Slide"), N_("Page"), ""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-20 12:57:12 +00:00
|
|
|
vector<pair<string, QString> > pagestyles;
|
2007-06-01 17:44:04 +00:00
|
|
|
|
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
} // anonymous namespace
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
namespace lyx {
|
2008-02-28 21:04:55 +00:00
|
|
|
|
2009-04-11 21:40:11 +00:00
|
|
|
RGBColor set_backgroundcolor;
|
2010-04-05 20:31:10 +00:00
|
|
|
bool is_backgroundcolor;
|
2010-04-02 23:39:36 +00:00
|
|
|
RGBColor set_fontcolor;
|
|
|
|
bool is_fontcolor;
|
2010-03-31 00:46:50 +00:00
|
|
|
RGBColor set_notefontcolor;
|
2010-04-08 00:14:08 +00:00
|
|
|
RGBColor set_boxbgcolor;
|
2009-04-11 21:40:11 +00:00
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
namespace {
|
|
|
|
// used when sorting the textclass list.
|
|
|
|
class less_textclass_avail_desc
|
|
|
|
: public binary_function<string, string, int>
|
|
|
|
{
|
|
|
|
public:
|
2008-09-20 13:44:51 +00:00
|
|
|
bool operator()(string const & lhs, string const & rhs) const
|
2008-02-28 21:04:55 +00:00
|
|
|
{
|
|
|
|
// Ordering criteria:
|
|
|
|
// 1. Availability of text class
|
|
|
|
// 2. Description (lexicographic)
|
2008-03-07 03:53:21 +00:00
|
|
|
LayoutFile const & tc1 = LayoutFileList::get()[lhs];
|
|
|
|
LayoutFile const & tc2 = LayoutFileList::get()[rhs];
|
2009-08-06 12:44:06 +00:00
|
|
|
int const order = compare_no_case(
|
2009-03-18 18:47:42 +00:00
|
|
|
translateIfPossible(from_utf8(tc1.description())),
|
|
|
|
translateIfPossible(from_utf8(tc2.description())));
|
2008-02-28 21:04:55 +00:00
|
|
|
return (tc1.isTeXClassAvailable() && !tc2.isTeXClassAvailable()) ||
|
2009-08-06 12:44:06 +00:00
|
|
|
(tc1.isTeXClassAvailable() == tc2.isTeXClassAvailable() && order < 0);
|
2008-02-28 21:04:55 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
namespace frontend {
|
2008-01-09 18:51:02 +00:00
|
|
|
namespace {
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
vector<string> getRequiredList(string const & modName)
|
|
|
|
{
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModule const * const mod = theModuleList[modName];
|
2008-09-20 12:17:15 +00:00
|
|
|
if (!mod)
|
|
|
|
return vector<string>(); //empty such thing
|
|
|
|
return mod->getRequiredModules();
|
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
vector<string> getExcludedList(string const & modName)
|
|
|
|
{
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModule const * const mod = theModuleList[modName];
|
2008-09-20 12:17:15 +00:00
|
|
|
if (!mod)
|
|
|
|
return vector<string>(); //empty such thing
|
|
|
|
return mod->getExcludedModules();
|
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
docstring getModuleDescription(string const & modName)
|
|
|
|
{
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModule const * const mod = theModuleList[modName];
|
2008-09-20 12:17:15 +00:00
|
|
|
if (!mod)
|
|
|
|
return _("Module not found!");
|
2008-11-04 15:44:02 +00:00
|
|
|
// FIXME Unicode
|
2008-11-04 15:38:37 +00:00
|
|
|
return translateIfPossible(from_utf8(mod->getDescription()));
|
2008-09-20 12:17:15 +00:00
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
vector<string> getPackageList(string const & modName)
|
|
|
|
{
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModule const * const mod = theModuleList[modName];
|
2008-09-20 12:17:15 +00:00
|
|
|
if (!mod)
|
|
|
|
return vector<string>(); //empty such thing
|
|
|
|
return mod->getPackageList();
|
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
bool isModuleAvailable(string const & modName)
|
|
|
|
{
|
2009-08-14 15:46:10 +00:00
|
|
|
LyXModule const * const mod = theModuleList[modName];
|
2008-09-20 12:17:15 +00:00
|
|
|
if (!mod)
|
|
|
|
return false;
|
|
|
|
return mod->isAvailable();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// ModuleSelectionManager
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
2008-01-09 18:51:02 +00:00
|
|
|
|
2008-09-20 13:44:51 +00:00
|
|
|
/// SelectionManager for use with modules
|
|
|
|
class ModuleSelectionManager : public GuiSelectionManager
|
|
|
|
{
|
|
|
|
public:
|
2008-10-16 13:41:25 +00:00
|
|
|
///
|
2008-09-20 13:44:51 +00:00
|
|
|
ModuleSelectionManager(
|
2009-08-14 20:37:22 +00:00
|
|
|
QTreeView * availableLV,
|
2008-09-20 13:44:51 +00:00
|
|
|
QListView * selectedLV,
|
|
|
|
QPushButton * addPB,
|
|
|
|
QPushButton * delPB,
|
|
|
|
QPushButton * upPB,
|
|
|
|
QPushButton * downPB,
|
|
|
|
GuiIdListModel * availableModel,
|
2008-10-20 19:53:15 +00:00
|
|
|
GuiIdListModel * selectedModel,
|
|
|
|
GuiDocument const * container)
|
2008-09-20 13:44:51 +00:00
|
|
|
: GuiSelectionManager(availableLV, selectedLV, addPB, delPB,
|
2008-10-20 19:53:15 +00:00
|
|
|
upPB, downPB, availableModel, selectedModel), container_(container)
|
2008-09-20 13:44:51 +00:00
|
|
|
{}
|
2008-10-23 00:27:03 +00:00
|
|
|
///
|
2009-02-12 15:07:22 +00:00
|
|
|
void updateProvidedModules(LayoutModuleList const & pm)
|
|
|
|
{ provided_modules_ = pm.list(); }
|
2008-10-23 00:27:03 +00:00
|
|
|
///
|
2009-02-12 15:07:22 +00:00
|
|
|
void updateExcludedModules(LayoutModuleList const & em)
|
|
|
|
{ excluded_modules_ = em.list(); }
|
2008-09-20 13:44:51 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
virtual void updateAddPB();
|
|
|
|
///
|
|
|
|
virtual void updateUpPB();
|
|
|
|
///
|
|
|
|
virtual void updateDownPB();
|
|
|
|
///
|
|
|
|
virtual void updateDelPB();
|
|
|
|
/// returns availableModel as a GuiIdListModel
|
|
|
|
GuiIdListModel * getAvailableModel()
|
|
|
|
{
|
|
|
|
return dynamic_cast<GuiIdListModel *>(availableModel);
|
|
|
|
}
|
|
|
|
/// returns selectedModel as a GuiIdListModel
|
|
|
|
GuiIdListModel * getSelectedModel()
|
|
|
|
{
|
|
|
|
return dynamic_cast<GuiIdListModel *>(selectedModel);
|
|
|
|
}
|
2008-10-23 00:27:03 +00:00
|
|
|
/// keeps a list of the modules the text class provides
|
2010-01-01 02:43:44 +00:00
|
|
|
list<string> provided_modules_;
|
2008-10-23 00:27:03 +00:00
|
|
|
/// similarly...
|
2010-01-01 02:43:44 +00:00
|
|
|
list<string> excluded_modules_;
|
2008-10-20 19:53:15 +00:00
|
|
|
///
|
|
|
|
GuiDocument const * container_;
|
2008-09-20 13:44:51 +00:00
|
|
|
};
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
void ModuleSelectionManager::updateAddPB()
|
2008-01-09 18:51:02 +00:00
|
|
|
{
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
int const arows = availableModel->rowCount();
|
2008-10-20 20:31:33 +00:00
|
|
|
QModelIndexList const avail_sels =
|
2008-01-09 18:51:02 +00:00
|
|
|
availableLV->selectionModel()->selectedIndexes();
|
2008-10-16 15:04:48 +00:00
|
|
|
|
|
|
|
// disable if there aren't any modules (?), if none of them is chosen
|
|
|
|
// in the dialog, or if the chosen one is already selected for use.
|
2008-10-20 20:31:33 +00:00
|
|
|
if (arows == 0 || avail_sels.isEmpty() || isSelected(avail_sels.first())) {
|
2008-01-09 18:51:02 +00:00
|
|
|
addPB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-16 15:04:48 +00:00
|
|
|
|
2008-01-09 18:51:02 +00:00
|
|
|
QModelIndex const & idx = availableLV->selectionModel()->currentIndex();
|
2008-10-20 20:31:33 +00:00
|
|
|
string const modname = getAvailableModel()->getIDString(idx.row());
|
2008-01-09 18:51:02 +00:00
|
|
|
|
2008-10-20 19:53:15 +00:00
|
|
|
bool const enable =
|
2008-10-20 20:31:33 +00:00
|
|
|
container_->params().moduleCanBeAdded(modname);
|
2008-10-20 19:53:15 +00:00
|
|
|
addPB->setEnabled(enable);
|
2008-01-09 18:51:02 +00:00
|
|
|
}
|
|
|
|
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
void ModuleSelectionManager::updateDownPB()
|
2008-01-10 01:33:24 +00:00
|
|
|
{
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
int const srows = selectedModel->rowCount();
|
2008-01-10 01:33:24 +00:00
|
|
|
if (srows == 0) {
|
|
|
|
downPB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-20 20:31:33 +00:00
|
|
|
QModelIndex const & curidx = selectedLV->selectionModel()->currentIndex();
|
|
|
|
int const curRow = curidx.row();
|
2008-10-14 17:14:25 +00:00
|
|
|
if (curRow < 0 || curRow >= srows - 1) { // invalid or last item
|
2008-01-10 01:33:24 +00:00
|
|
|
downPB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-14 17:14:25 +00:00
|
|
|
|
|
|
|
// determine whether immediately succeding element requires this one
|
2008-10-20 20:31:33 +00:00
|
|
|
string const curmodname = getSelectedModel()->getIDString(curRow);
|
|
|
|
string const nextmodname = getSelectedModel()->getIDString(curRow + 1);
|
2008-01-10 01:33:24 +00:00
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
vector<string> reqs = getRequiredList(nextmodname);
|
2008-01-10 01:33:24 +00:00
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// if it doesn't require anything....
|
2008-01-10 01:33:24 +00:00
|
|
|
if (reqs.empty()) {
|
|
|
|
downPB->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// Enable it if this module isn't required.
|
|
|
|
// FIXME This should perhaps be more flexible and check whether, even
|
2008-10-14 17:35:49 +00:00
|
|
|
// if the next one is required, there is also an earlier one that will do.
|
2008-01-10 01:33:24 +00:00
|
|
|
downPB->setEnabled(
|
2008-10-20 20:31:33 +00:00
|
|
|
find(reqs.begin(), reqs.end(), curmodname) == reqs.end());
|
2008-01-10 01:33:24 +00:00
|
|
|
}
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
void ModuleSelectionManager::updateUpPB()
|
2008-01-10 01:33:24 +00:00
|
|
|
{
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
int const srows = selectedModel->rowCount();
|
2008-01-10 01:33:24 +00:00
|
|
|
if (srows == 0) {
|
|
|
|
upPB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
|
|
|
|
QModelIndex const & curIdx = selectedLV->selectionModel()->currentIndex();
|
|
|
|
int curRow = curIdx.row();
|
2008-10-14 17:14:25 +00:00
|
|
|
if (curRow <= 0 || curRow > srows - 1) { // first item or invalid
|
|
|
|
upPB->setEnabled(false);
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-10-20 20:31:33 +00:00
|
|
|
string const curmodname = getSelectedModel()->getIDString(curRow);
|
2008-10-14 17:35:49 +00:00
|
|
|
|
|
|
|
// determine whether immediately preceding element is required by this one
|
2008-10-20 20:31:33 +00:00
|
|
|
vector<string> reqs = getRequiredList(curmodname);
|
2008-10-16 13:41:25 +00:00
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// if this one doesn't require anything....
|
2008-01-10 01:33:24 +00:00
|
|
|
if (reqs.empty()) {
|
|
|
|
upPB->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// Enable it if the preceding module isn't required.
|
2008-10-14 17:35:49 +00:00
|
|
|
// NOTE This is less flexible than it might be. We could check whether, even
|
|
|
|
// if the previous one is required, there is an earlier one that would do.
|
2008-10-20 20:31:33 +00:00
|
|
|
string const premod = getSelectedModel()->getIDString(curRow - 1);
|
|
|
|
upPB->setEnabled(find(reqs.begin(), reqs.end(), premod) == reqs.end());
|
2008-01-10 01:33:24 +00:00
|
|
|
}
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
void ModuleSelectionManager::updateDelPB()
|
2008-01-10 01:33:24 +00:00
|
|
|
{
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
int const srows = selectedModel->rowCount();
|
2008-01-10 01:33:24 +00:00
|
|
|
if (srows == 0) {
|
|
|
|
deletePB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-20 19:53:15 +00:00
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
QModelIndex const & curidx =
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
selectedLV->selectionModel()->currentIndex();
|
2008-10-20 20:31:33 +00:00
|
|
|
int const curRow = curidx.row();
|
2008-10-14 17:14:25 +00:00
|
|
|
if (curRow < 0 || curRow >= srows) { // invalid index?
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
deletePB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-16 13:41:25 +00:00
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
string const curmodname = getSelectedModel()->getIDString(curRow);
|
2008-10-16 13:41:25 +00:00
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// We're looking here for a reason NOT to enable the button. If we
|
|
|
|
// find one, we disable it and return. If we don't, we'll end up at
|
|
|
|
// the end of the function, and then we enable it.
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
for (int i = curRow + 1; i < srows; ++i) {
|
|
|
|
string const thisMod = getSelectedModel()->getIDString(i);
|
|
|
|
vector<string> reqs = getRequiredList(thisMod);
|
2008-01-10 01:33:24 +00:00
|
|
|
//does this one require us?
|
2008-10-20 20:31:33 +00:00
|
|
|
if (find(reqs.begin(), reqs.end(), curmodname) == reqs.end())
|
2008-01-10 01:33:24 +00:00
|
|
|
//no...
|
|
|
|
continue;
|
|
|
|
|
2008-10-12 22:21:56 +00:00
|
|
|
// OK, so this module requires us
|
|
|
|
// is there an EARLIER module that also satisfies the require?
|
|
|
|
// NOTE We demand that it be earlier to keep the list of modules
|
|
|
|
// consistent with the rule that a module must be proceeded by a
|
|
|
|
// required module. There would be more flexible ways to proceed,
|
|
|
|
// but that would be a lot more complicated, and the logic here is
|
|
|
|
// already complicated. (That's why I've left the debugging code.)
|
2010-01-01 02:43:44 +00:00
|
|
|
// lyxerr << "Testing " << thisMod << endl;
|
2008-10-20 20:31:33 +00:00
|
|
|
bool foundone = false;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
for (int j = 0; j < curRow; ++j) {
|
|
|
|
string const mod = getSelectedModel()->getIDString(j);
|
2010-01-01 02:43:44 +00:00
|
|
|
// lyxerr << "In loop: Testing " << mod << endl;
|
2008-10-12 22:21:56 +00:00
|
|
|
// do we satisfy the require?
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (find(reqs.begin(), reqs.end(), mod) != reqs.end()) {
|
2010-01-01 02:43:44 +00:00
|
|
|
// lyxerr << mod << " does the trick." << endl;
|
2008-10-20 20:31:33 +00:00
|
|
|
foundone = true;
|
2008-01-10 01:33:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-10-12 22:21:56 +00:00
|
|
|
// did we find a module to satisfy the require?
|
2008-10-20 20:31:33 +00:00
|
|
|
if (!foundone) {
|
2010-01-01 02:43:44 +00:00
|
|
|
// lyxerr << "No matching module found." << endl;
|
2008-01-10 01:33:24 +00:00
|
|
|
deletePB->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2010-01-01 02:43:44 +00:00
|
|
|
// lyxerr << "All's well that ends well." << endl;
|
2008-01-10 01:33:24 +00:00
|
|
|
deletePB->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2008-01-09 18:51:02 +00:00
|
|
|
|
2007-05-14 12:09:14 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// PreambleModule
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-09-20 12:17:15 +00:00
|
|
|
PreambleModule::PreambleModule() : current_id_(0)
|
2007-05-14 12:09:14 +00:00
|
|
|
{
|
|
|
|
// This is not a memory leak. The object will be destroyed
|
|
|
|
// with this.
|
|
|
|
(void) new LaTeXHighlighter(preambleTE->document());
|
|
|
|
setFocusProxy(preambleTE);
|
2007-05-14 16:54:27 +00:00
|
|
|
connect(preambleTE, SIGNAL(textChanged()), this, SIGNAL(changed()));
|
2007-05-14 12:09:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-14 16:41:50 +00:00
|
|
|
void PreambleModule::update(BufferParams const & params, BufferId id)
|
2007-05-14 12:09:14 +00:00
|
|
|
{
|
|
|
|
QString preamble = toqstr(params.preamble);
|
|
|
|
// Nothing to do if the params and preamble are unchanged.
|
2007-05-28 22:27:45 +00:00
|
|
|
if (id == current_id_
|
2007-05-14 12:09:14 +00:00
|
|
|
&& preamble == preambleTE->document()->toPlainText())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QTextCursor cur = preambleTE->textCursor();
|
|
|
|
// Save the coords before switching to the new one.
|
2007-05-28 22:27:45 +00:00
|
|
|
preamble_coords_[current_id_] =
|
2007-05-14 12:09:14 +00:00
|
|
|
make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
|
|
|
|
|
|
|
|
// Save the params address for further use.
|
|
|
|
current_id_ = id;
|
|
|
|
preambleTE->document()->setPlainText(preamble);
|
|
|
|
Coords::const_iterator it = preamble_coords_.find(current_id_);
|
|
|
|
if (it == preamble_coords_.end())
|
|
|
|
// First time we open this one.
|
2008-09-08 01:18:33 +00:00
|
|
|
preamble_coords_[current_id_] = make_pair(0, 0);
|
2007-05-14 12:09:14 +00:00
|
|
|
else {
|
|
|
|
// Restore saved coords.
|
|
|
|
QTextCursor cur = preambleTE->textCursor();
|
|
|
|
cur.setPosition(it->second.first);
|
|
|
|
preambleTE->setTextCursor(cur);
|
|
|
|
preambleTE->verticalScrollBar()->setValue(it->second.second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PreambleModule::apply(BufferParams & params)
|
|
|
|
{
|
|
|
|
params.preamble = fromqstr(preambleTE->document()->toPlainText());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PreambleModule::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
// Save the coords before closing.
|
|
|
|
QTextCursor cur = preambleTE->textCursor();
|
2007-05-28 22:27:45 +00:00
|
|
|
preamble_coords_[current_id_] =
|
2007-05-14 12:09:14 +00:00
|
|
|
make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// LocalLayout
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
LocalLayout::LocalLayout() : current_id_(0), is_valid_(false)
|
|
|
|
{
|
|
|
|
connect(locallayoutTE, SIGNAL(textChanged()), this, SLOT(textChanged()));
|
|
|
|
connect(validatePB, SIGNAL(clicked()), this, SLOT(validatePressed()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LocalLayout::update(BufferParams const & params, BufferId id)
|
|
|
|
{
|
|
|
|
QString layout = toqstr(params.local_layout);
|
|
|
|
// Nothing to do if the params and preamble are unchanged.
|
|
|
|
if (id == current_id_
|
|
|
|
&& layout == locallayoutTE->document()->toPlainText())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Save the params address for further use.
|
|
|
|
current_id_ = id;
|
|
|
|
locallayoutTE->document()->setPlainText(layout);
|
|
|
|
validate();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LocalLayout::apply(BufferParams & params)
|
|
|
|
{
|
|
|
|
string const layout = fromqstr(locallayoutTE->document()->toPlainText());
|
|
|
|
params.local_layout = layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LocalLayout::textChanged()
|
|
|
|
{
|
|
|
|
static const QString unknown = qt_("Press button to check validity...");
|
|
|
|
|
|
|
|
is_valid_ = false;
|
|
|
|
infoLB->setText(unknown);
|
|
|
|
validatePB->setEnabled(true);
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LocalLayout::validate() {
|
|
|
|
static const QString valid = qt_("Layout is valid!");
|
|
|
|
static const QString vtext =
|
|
|
|
toqstr("<p style=\"font-weight: bold; \">")
|
|
|
|
+ valid + toqstr("</p>");
|
|
|
|
static const QString invalid = qt_("Layout is invalid!");
|
|
|
|
static const QString ivtext =
|
|
|
|
toqstr("<p style=\"color: #c00000; font-weight: bold; \">")
|
|
|
|
+ invalid + toqstr("</p>");
|
|
|
|
|
2010-09-03 13:33:05 +00:00
|
|
|
string const layout =
|
|
|
|
fromqstr(locallayoutTE->document()->toPlainText().trimmed());
|
|
|
|
if (layout.empty()) {
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
is_valid_ = true;
|
2010-09-03 13:33:05 +00:00
|
|
|
infoLB->setText("");
|
|
|
|
} else {
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
is_valid_ = TextClass::validate(layout);
|
2010-09-03 13:33:05 +00:00
|
|
|
infoLB->setText(is_valid_ ? vtext : ivtext);
|
|
|
|
}
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
validatePB->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LocalLayout::validatePressed() {
|
|
|
|
validate();
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// DocumentDialog
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiDocument::GuiDocument(GuiView & lv)
|
2008-05-15 08:41:17 +00:00
|
|
|
: GuiDialog(lv, "document", qt_("Document Settings"))
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2008-03-08 07:59:47 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
|
|
|
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(savePB, SIGNAL(clicked()), this, SLOT(saveDefaultClicked()));
|
|
|
|
connect(defaultPB, SIGNAL(clicked()), this, SLOT(useDefaultsClicked()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// Manage the restore, ok, apply, restore and cancel/close buttons
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setApply(applyPB);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
bc().setRestore(restorePB);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// text layout
|
2010-04-02 22:11:50 +00:00
|
|
|
textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(setLSpacing(int)));
|
2008-02-23 16:45:38 +00:00
|
|
|
connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString &)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2009-07-19 21:13:27 +00:00
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->indentRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-07-19 21:13:27 +00:00
|
|
|
connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)),
|
|
|
|
textLayoutModule->indentCO, SLOT(setEnabled(bool)));
|
|
|
|
connect(textLayoutModule->indentCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->indentCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(setIndent(int)));
|
|
|
|
connect(textLayoutModule->indentLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->indentLengthCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
connect(textLayoutModule->skipRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)),
|
|
|
|
textLayoutModule->skipCO, SLOT(setEnabled(bool)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->skipCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-07-19 21:13:27 +00:00
|
|
|
connect(textLayoutModule->skipCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(setSkip(int)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-07-19 21:13:27 +00:00
|
|
|
|
|
|
|
connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(enableIndent(bool)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(enableSkip(bool)));
|
2009-07-19 21:13:27 +00:00
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-02-19 05:39:36 +00:00
|
|
|
connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(setColSep()));
|
2009-07-20 08:09:32 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
|
|
|
|
textLayoutModule->lspacingLE));
|
2009-07-19 21:13:27 +00:00
|
|
|
textLayoutModule->indentLE->setValidator(unsignedLengthValidator(
|
|
|
|
textLayoutModule->indentLE));
|
2009-07-20 05:05:48 +00:00
|
|
|
textLayoutModule->skipLE->setValidator(unsignedGlueLengthValidator(
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->skipLE));
|
|
|
|
|
2009-07-19 21:13:27 +00:00
|
|
|
textLayoutModule->indentCO->addItem(qt_("Default"));
|
|
|
|
textLayoutModule->indentCO->addItem(qt_("Custom"));
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->skipCO->addItem(qt_("SmallSkip"));
|
|
|
|
textLayoutModule->skipCO->addItem(qt_("MedSkip"));
|
|
|
|
textLayoutModule->skipCO->addItem(qt_("BigSkip"));
|
2009-07-20 08:14:21 +00:00
|
|
|
textLayoutModule->skipCO->addItem(qt_("Custom"));
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->lspacingCO->insertItem(
|
|
|
|
Spacing::Single, qt_("Single"));
|
|
|
|
textLayoutModule->lspacingCO->insertItem(
|
|
|
|
Spacing::Onehalf, qt_("OneHalf"));
|
|
|
|
textLayoutModule->lspacingCO->insertItem(
|
|
|
|
Spacing::Double, qt_("Double"));
|
|
|
|
textLayoutModule->lspacingCO->insertItem(
|
|
|
|
Spacing::Other, qt_("Custom"));
|
|
|
|
// initialize the length validator
|
2009-07-19 21:13:27 +00:00
|
|
|
bc().addCheckedLineEdit(textLayoutModule->indentLE);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(textLayoutModule->skipLE);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
// master/child handling
|
|
|
|
masterChildModule = new UiWidget<Ui::MasterChildUi>;
|
|
|
|
|
|
|
|
connect(masterChildModule->childrenTW, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
|
|
|
|
this, SLOT(includeonlyClicked(QTreeWidgetItem *, int)));
|
|
|
|
connect(masterChildModule->includeonlyRB, SIGNAL(toggled(bool)),
|
|
|
|
masterChildModule->childrenTW, SLOT(setEnabled(bool)));
|
2010-01-10 13:25:41 +00:00
|
|
|
connect(masterChildModule->includeonlyRB, SIGNAL(toggled(bool)),
|
|
|
|
masterChildModule->maintainAuxCB, SLOT(setEnabled(bool)));
|
2010-01-07 10:01:26 +00:00
|
|
|
connect(masterChildModule->includeallRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(masterChildModule->includeonlyRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-01-10 13:25:41 +00:00
|
|
|
connect(masterChildModule->maintainAuxCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-01-07 10:01:26 +00:00
|
|
|
masterChildModule->childrenTW->setColumnCount(2);
|
|
|
|
masterChildModule->childrenTW->headerItem()->setText(0, qt_("Child Document"));
|
|
|
|
masterChildModule->childrenTW->headerItem()->setText(1, qt_("Include to Output"));
|
|
|
|
masterChildModule->childrenTW->resizeColumnToContents(1);
|
|
|
|
masterChildModule->childrenTW->resizeColumnToContents(2);
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2009-04-10 11:06:53 +00:00
|
|
|
// output
|
|
|
|
outputModule = new UiWidget<Ui::OutputUi>;
|
|
|
|
|
|
|
|
connect(outputModule->defaultFormatCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-04-21 15:20:31 +00:00
|
|
|
connect(outputModule->mathimgSB, SIGNAL(valueChanged(double)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(outputModule->strictCB, SIGNAL(stateChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(outputModule->mathoutCB, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-04-10 11:06:53 +00:00
|
|
|
|
2010-05-25 11:53:58 +00:00
|
|
|
connect(outputModule->outputsyncCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(outputModule->synccustomCB, SIGNAL(editTextChanged(QString)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
outputModule->synccustomCB->addItem("");
|
|
|
|
outputModule->synccustomCB->addItem("\\synctex=1");
|
|
|
|
outputModule->synccustomCB->addItem("\\synctex=-1");
|
|
|
|
outputModule->synccustomCB->addItem("\\usepackage[active]{srcltx}");
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// fonts
|
2009-04-10 11:06:53 +00:00
|
|
|
fontModule = new UiWidget<Ui::FontUi>;
|
2010-11-26 09:42:03 +00:00
|
|
|
connect(fontModule->osFontsCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->osFontsCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(osFontsChanged(bool)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(romanChanged(int)));
|
|
|
|
connect(fontModule->fontsSansCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontsSansCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(sansChanged(int)));
|
|
|
|
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(ttChanged(int)));
|
|
|
|
connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-11-29 14:43:00 +00:00
|
|
|
connect(fontModule->fontencCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontencCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(fontencChanged(int)));
|
|
|
|
connect(fontModule->fontencLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(fontModule->fontsizeCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-06-05 06:18:34 +00:00
|
|
|
connect(fontModule->cjkFontLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontScCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontModule->fontOsfCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-04-06 06:58:30 +00:00
|
|
|
updateFontlist();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-06-01 17:44:04 +00:00
|
|
|
fontModule->fontsizeCO->addItem(qt_("Default"));
|
2007-04-24 19:37:34 +00:00
|
|
|
fontModule->fontsizeCO->addItem(qt_("10"));
|
|
|
|
fontModule->fontsizeCO->addItem(qt_("11"));
|
|
|
|
fontModule->fontsizeCO->addItem(qt_("12"));
|
|
|
|
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencCO->addItem(qt_("Default"));
|
|
|
|
fontModule->fontencCO->addItem(qt_("Custom"));
|
|
|
|
fontModule->fontencCO->addItem(qt_("None (no fontenc)"));
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
for (int n = 0; GuiDocument::fontfamilies_gui[n][0]; ++n)
|
2007-04-24 19:37:34 +00:00
|
|
|
fontModule->fontsDefaultCO->addItem(
|
2007-10-06 22:43:21 +00:00
|
|
|
qt_(GuiDocument::fontfamilies_gui[n]));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
// page layout
|
2010-04-02 22:11:50 +00:00
|
|
|
pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
|
2009-07-16 08:39:22 +00:00
|
|
|
this, SLOT(papersizeChanged(int)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
|
2009-07-16 08:39:22 +00:00
|
|
|
this, SLOT(papersizeChanged(int)));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(pageLayoutModule->portraitRB, SIGNAL(clicked()),
|
2010-05-18 02:56:36 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->portraitRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->landscapeRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->facingPagesCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-06-01 17:44:04 +00:00
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("Default"));
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("empty"));
|
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
|
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
|
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(pageLayoutModule->paperheightLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->paperheightL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(pageLayoutModule->paperwidthLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->paperwidthL);
|
|
|
|
|
|
|
|
QComboBox * cb = pageLayoutModule->papersizeCO;
|
|
|
|
cb->addItem(qt_("Default"));
|
|
|
|
cb->addItem(qt_("Custom"));
|
|
|
|
cb->addItem(qt_("US letter"));
|
|
|
|
cb->addItem(qt_("US legal"));
|
|
|
|
cb->addItem(qt_("US executive"));
|
2010-05-18 01:22:08 +00:00
|
|
|
cb->addItem(qt_("A0"));
|
|
|
|
cb->addItem(qt_("A1"));
|
|
|
|
cb->addItem(qt_("A2"));
|
2007-04-24 19:37:34 +00:00
|
|
|
cb->addItem(qt_("A3"));
|
|
|
|
cb->addItem(qt_("A4"));
|
|
|
|
cb->addItem(qt_("A5"));
|
2010-05-18 01:22:08 +00:00
|
|
|
cb->addItem(qt_("A6"));
|
|
|
|
cb->addItem(qt_("B0"));
|
|
|
|
cb->addItem(qt_("B1"));
|
|
|
|
cb->addItem(qt_("B2"));
|
2007-04-24 19:37:34 +00:00
|
|
|
cb->addItem(qt_("B3"));
|
|
|
|
cb->addItem(qt_("B4"));
|
|
|
|
cb->addItem(qt_("B5"));
|
2010-05-18 01:22:08 +00:00
|
|
|
cb->addItem(qt_("B6"));
|
2010-07-13 01:06:20 +00:00
|
|
|
cb->addItem(qt_("C0"));
|
|
|
|
cb->addItem(qt_("C1"));
|
|
|
|
cb->addItem(qt_("C2"));
|
|
|
|
cb->addItem(qt_("C3"));
|
|
|
|
cb->addItem(qt_("C4"));
|
|
|
|
cb->addItem(qt_("C5"));
|
|
|
|
cb->addItem(qt_("C6"));
|
2010-05-18 01:22:08 +00:00
|
|
|
cb->addItem(qt_("JIS B0"));
|
|
|
|
cb->addItem(qt_("JIS B1"));
|
|
|
|
cb->addItem(qt_("JIS B2"));
|
|
|
|
cb->addItem(qt_("JIS B3"));
|
|
|
|
cb->addItem(qt_("JIS B4"));
|
|
|
|
cb->addItem(qt_("JIS B5"));
|
|
|
|
cb->addItem(qt_("JIS B6"));
|
2007-04-24 19:37:34 +00:00
|
|
|
// remove the %-items from the unit choice
|
|
|
|
pageLayoutModule->paperwidthUnitCO->noPercents();
|
|
|
|
pageLayoutModule->paperheightUnitCO->noPercents();
|
|
|
|
pageLayoutModule->paperheightLE->setValidator(unsignedLengthValidator(
|
|
|
|
pageLayoutModule->paperheightLE));
|
|
|
|
pageLayoutModule->paperwidthLE->setValidator(unsignedLengthValidator(
|
|
|
|
pageLayoutModule->paperwidthLE));
|
|
|
|
|
|
|
|
|
|
|
|
// margins
|
2010-04-02 22:11:50 +00:00
|
|
|
marginsModule = new UiWidget<Ui::MarginsUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(marginsModule->marginCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(setCustomMargins(bool)));
|
|
|
|
connect(marginsModule->marginCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->topLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->topUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->bottomLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->bottomUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->innerLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->innerUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->outerLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->outerUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->headheightLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headheightUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->headsepLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->headsepUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->footskipLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(marginsModule->columnsepLE, SIGNAL(textChanged(QString)),
|
2008-02-19 05:24:48 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(marginsModule->columnsepUnit, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->topLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->topLE));
|
|
|
|
marginsModule->bottomLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->bottomLE));
|
|
|
|
marginsModule->innerLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->innerLE));
|
|
|
|
marginsModule->outerLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->outerLE));
|
|
|
|
marginsModule->headsepLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->headsepLE));
|
|
|
|
marginsModule->headheightLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->headheightLE));
|
|
|
|
marginsModule->footskipLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->footskipLE));
|
2008-02-19 05:24:48 +00:00
|
|
|
marginsModule->columnsepLE->setValidator(unsignedLengthValidator(
|
|
|
|
marginsModule->columnsepLE));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->topLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->topL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->bottomLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->bottomL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->innerLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->innerL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->outerLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->outerL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->headsepLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->headsepL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->headheightLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->headheightL);
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->footskipLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
marginsModule->footskipL);
|
2008-02-19 05:24:48 +00:00
|
|
|
bc().addCheckedLineEdit(marginsModule->columnsepLE,
|
|
|
|
marginsModule->columnsepL);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
// language & quote
|
2010-04-02 22:11:50 +00:00
|
|
|
langModule = new UiWidget<Ui::LanguageUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(langModule->languageCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-09-19 12:29:08 +00:00
|
|
|
connect(langModule->defaultencodingRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->otherencodingRB, SIGNAL(clicked()),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->encodingCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2008-05-14 10:34:19 +00:00
|
|
|
QAbstractItemModel * language_model = guiApp->languageModel();
|
|
|
|
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
|
|
|
|
language_model->sort(0);
|
|
|
|
langModule->languageCO->setModel(language_model);
|
2010-02-10 08:10:31 +00:00
|
|
|
langModule->languageCO->setModelColumn(0);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// Always put the default encoding in the first position.
|
2008-09-01 08:39:19 +00:00
|
|
|
langModule->encodingCO->addItem(qt_("Language Default (no inputenc)"));
|
2008-07-11 08:56:17 +00:00
|
|
|
QStringList encodinglist;
|
2007-04-24 19:37:34 +00:00
|
|
|
Encodings::const_iterator it = encodings.begin();
|
|
|
|
Encodings::const_iterator const end = encodings.end();
|
|
|
|
for (; it != end; ++it)
|
2008-07-11 08:56:17 +00:00
|
|
|
encodinglist.append(qt_(it->guiName()));
|
|
|
|
encodinglist.sort();
|
|
|
|
langModule->encodingCO->addItems(encodinglist);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
langModule->quoteStyleCO->addItem(qt_("``text''"));
|
|
|
|
langModule->quoteStyleCO->addItem(qt_("''text''"));
|
|
|
|
langModule->quoteStyleCO->addItem(qt_(",,text``"));
|
|
|
|
langModule->quoteStyleCO->addItem(qt_(",,text''"));
|
2008-08-04 00:04:09 +00:00
|
|
|
langModule->quoteStyleCO->addItem(qt_("<<text>>"));
|
|
|
|
langModule->quoteStyleCO->addItem(qt_(">>text<<"));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
// color
|
|
|
|
colorModule = new UiWidget<Ui::ColorUi>;
|
2010-04-02 23:39:36 +00:00
|
|
|
connect(colorModule->fontColorPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changeFontColor()));
|
|
|
|
connect(colorModule->delFontColorTB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(deleteFontColor()));
|
2010-04-02 22:11:50 +00:00
|
|
|
connect(colorModule->noteFontColorPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changeNoteFontColor()));
|
|
|
|
connect(colorModule->delNoteFontColorTB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(deleteNoteFontColor()));
|
|
|
|
connect(colorModule->backgroundPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changeBackgroundColor()));
|
2010-04-05 20:31:10 +00:00
|
|
|
connect(colorModule->delBackgroundTB, SIGNAL(clicked()),
|
2010-04-02 22:11:50 +00:00
|
|
|
this, SLOT(deleteBackgroundColor()));
|
2010-04-08 00:14:08 +00:00
|
|
|
connect(colorModule->boxBackgroundPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changeBoxBackgroundColor()));
|
|
|
|
connect(colorModule->delBoxBackgroundTB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(deleteBoxBackgroundColor()));
|
2010-04-02 22:11:50 +00:00
|
|
|
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// numbering
|
2010-04-02 22:11:50 +00:00
|
|
|
numberingModule = new UiWidget<Ui::NumberingUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(updateNumbering()));
|
|
|
|
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(updateNumbering()));
|
2007-04-24 19:37:34 +00:00
|
|
|
numberingModule->tocTW->setColumnCount(3);
|
|
|
|
numberingModule->tocTW->headerItem()->setText(0, qt_("Example"));
|
|
|
|
numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
|
|
|
|
numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
|
|
|
|
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
// biblio
|
2007-04-24 19:37:34 +00:00
|
|
|
biblioModule = new UiWidget<Ui::BiblioUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
|
|
|
|
biblioModule->citationStyleL, SLOT(setEnabled(bool)));
|
|
|
|
connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
|
|
|
|
biblioModule->citeStyleCO, SLOT(setEnabled(bool)));
|
|
|
|
connect(biblioModule->citeDefaultRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->citeNatbibRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->citeJurabibRB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-05-22 07:20:00 +00:00
|
|
|
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(bibtexChanged(int)));
|
|
|
|
connect(biblioModule->bibtexOptionsED, SIGNAL(textChanged(QString)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
biblioModule->citeStyleCO->addItem(qt_("Author-year"));
|
|
|
|
biblioModule->citeStyleCO->addItem(qt_("Numerical"));
|
|
|
|
biblioModule->citeStyleCO->setCurrentIndex(0);
|
2009-05-22 07:20:00 +00:00
|
|
|
|
|
|
|
biblioModule->bibtexCO->clear();
|
|
|
|
biblioModule->bibtexCO->addItem(qt_("Default"), QString("default"));
|
2009-05-28 12:49:41 +00:00
|
|
|
for (set<string>::const_iterator it = lyxrc.bibtex_alternatives.begin();
|
2009-05-22 07:20:00 +00:00
|
|
|
it != lyxrc.bibtex_alternatives.end(); ++it) {
|
|
|
|
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
|
|
|
biblioModule->bibtexCO->addItem(command, command);
|
|
|
|
}
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
// indices
|
|
|
|
indicesModule = new GuiIndices;
|
|
|
|
connect(indicesModule, SIGNAL(changed()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
// maths
|
2007-04-24 19:37:34 +00:00
|
|
|
mathsModule = new UiWidget<Ui::MathsUi>;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
|
|
|
|
mathsModule->amsCB, SLOT(setDisabled(bool)));
|
|
|
|
connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)),
|
|
|
|
mathsModule->esintCB, SLOT(setDisabled(bool)));
|
2009-11-11 01:48:07 +00:00
|
|
|
connect(mathsModule->mhchemautoCB, SIGNAL(toggled(bool)),
|
|
|
|
mathsModule->mhchemCB, SLOT(setDisabled(bool)));
|
2010-08-31 23:34:54 +00:00
|
|
|
connect(mathsModule->mathdotsautoCB, SIGNAL(toggled(bool)),
|
|
|
|
mathsModule->mathdotsCB, SLOT(setDisabled(bool)));
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(mathsModule->amsCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(mathsModule->amsautoCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(mathsModule->esintCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(mathsModule->esintautoCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-11-11 01:48:07 +00:00
|
|
|
connect(mathsModule->mhchemCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(mathsModule->mhchemautoCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-08-31 02:04:46 +00:00
|
|
|
connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-08-31 23:34:54 +00:00
|
|
|
connect(mathsModule->mathdotsautoCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// latex class
|
2010-04-02 22:11:50 +00:00
|
|
|
latexModule = new UiWidget<Ui::LaTeXUi>;
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(latexModule->optionsLE, SIGNAL(textChanged(QString)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-10-12 09:36:00 +00:00
|
|
|
connect(latexModule->defaultOptionsCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(latexModule->psdriverCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->classCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(classChanged()));
|
2008-01-15 10:38:19 +00:00
|
|
|
connect(latexModule->classCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-03-10 21:31:22 +00:00
|
|
|
connect(latexModule->layoutPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(browseLayout()));
|
2008-07-11 02:43:02 +00:00
|
|
|
connect(latexModule->layoutPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-04-28 16:38:56 +00:00
|
|
|
connect(latexModule->childDocGB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(latexModule->childDocLE, SIGNAL(textChanged(QString)),
|
2008-04-28 16:38:56 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->childDocPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(browseMaster()));
|
2009-08-14 00:52:33 +00:00
|
|
|
connect(latexModule->suppressDateCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2010-10-13 12:36:53 +00:00
|
|
|
connect(latexModule->refstyleCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-10-20 19:53:15 +00:00
|
|
|
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
// postscript drivers
|
2007-04-24 19:37:34 +00:00
|
|
|
for (int n = 0; tex_graphics[n][0]; ++n) {
|
2007-06-01 17:44:04 +00:00
|
|
|
QString enc = qt_(tex_graphics_gui[n]);
|
2007-04-24 19:37:34 +00:00
|
|
|
latexModule->psdriverCO->addItem(enc);
|
|
|
|
}
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
// latex classes
|
2008-02-28 21:04:55 +00:00
|
|
|
latexModule->classCO->setModel(&classes_model_);
|
2008-03-07 03:53:21 +00:00
|
|
|
LayoutFileList const & bcl = LayoutFileList::get();
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
vector<LayoutFileIndex> classList = bcl.classList();
|
2008-02-28 21:04:55 +00:00
|
|
|
sort(classList.begin(), classList.end(), less_textclass_avail_desc());
|
|
|
|
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
vector<LayoutFileIndex>::const_iterator cit = classList.begin();
|
|
|
|
vector<LayoutFileIndex>::const_iterator cen = classList.end();
|
2008-02-28 21:04:55 +00:00
|
|
|
for (int i = 0; cit != cen; ++cit, ++i) {
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
LayoutFile const & tc = bcl[*cit];
|
2008-02-28 21:04:55 +00:00
|
|
|
docstring item = (tc.isTeXClassAvailable()) ?
|
|
|
|
from_utf8(tc.description()) :
|
|
|
|
bformat(_("Unavailable: %1$s"), from_utf8(tc.description()));
|
2008-03-01 16:32:16 +00:00
|
|
|
classes_model_.insertRow(i, toqstr(item), *cit);
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// branches
|
2007-08-31 05:53:55 +00:00
|
|
|
branchesModule = new GuiBranches;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(branchesModule, SIGNAL(changed()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2009-07-10 06:49:51 +00:00
|
|
|
connect(branchesModule, SIGNAL(renameBranches(docstring const &, docstring const &)),
|
|
|
|
this, SLOT(branchesRename(docstring const &, docstring const &)));
|
2009-07-09 09:48:34 +00:00
|
|
|
updateUnknownBranches();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// preamble
|
2007-05-14 12:09:14 +00:00
|
|
|
preambleModule = new PreambleModule;
|
|
|
|
connect(preambleModule, SIGNAL(changed()),
|
2007-04-24 19:37:34 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
|
|
|
|
localLayout = new LocalLayout;
|
|
|
|
connect(localLayout, SIGNAL(changed()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// bullets
|
|
|
|
bulletsModule = new BulletsModule;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(bulletsModule, SIGNAL(changed()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2008-10-19 01:21:59 +00:00
|
|
|
// Modules
|
|
|
|
modulesModule = new UiWidget<Ui::ModulesUi>;
|
2009-08-17 18:43:25 +00:00
|
|
|
modulesModule->availableLV->header()->setVisible(false);
|
2008-10-19 01:21:59 +00:00
|
|
|
selectionManager =
|
|
|
|
new ModuleSelectionManager(modulesModule->availableLV,
|
|
|
|
modulesModule->selectedLV,
|
|
|
|
modulesModule->addPB, modulesModule->deletePB,
|
|
|
|
modulesModule->upPB, modulesModule->downPB,
|
2008-10-20 19:53:15 +00:00
|
|
|
availableModel(), selectedModel(), this);
|
2008-10-19 01:21:59 +00:00
|
|
|
connect(selectionManager, SIGNAL(updateHook()),
|
|
|
|
this, SLOT(updateModuleInfo()));
|
|
|
|
connect(selectionManager, SIGNAL(updateHook()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-10-20 19:31:05 +00:00
|
|
|
connect(selectionManager, SIGNAL(selectionChanged()),
|
|
|
|
this, SLOT(modulesChanged()));
|
2008-10-19 01:21:59 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-09-20 22:31:18 +00:00
|
|
|
// PDF support
|
|
|
|
pdfSupportModule = new UiWidget<Ui::PDFSupportUi>;
|
2007-09-22 22:20:15 +00:00
|
|
|
connect(pdfSupportModule->use_hyperrefGB, SIGNAL(toggled(bool)),
|
2008-06-09 15:20:38 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(pdfSupportModule->titleLE, SIGNAL(textChanged(QString)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(pdfSupportModule->authorLE, SIGNAL(textChanged(QString)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(pdfSupportModule->subjectLE, SIGNAL(textChanged(QString)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(pdfSupportModule->keywordsLE, SIGNAL(textChanged(QString)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->bookmarksGB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->bookmarksnumberedCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->bookmarksopenGB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-09-22 22:20:15 +00:00
|
|
|
connect(pdfSupportModule->bookmarksopenlevelSB, SIGNAL(valueChanged(int)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->breaklinksCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->pdfborderCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(pdfSupportModule->colorlinksCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-10-13 16:01:02 +00:00
|
|
|
connect(pdfSupportModule->backrefCO, SIGNAL(activated(int)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-10 00:34:23 +00:00
|
|
|
connect(pdfSupportModule->pdfusetitleCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-09-20 22:31:18 +00:00
|
|
|
connect(pdfSupportModule->fullscreenCB, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-20 12:57:12 +00:00
|
|
|
connect(pdfSupportModule->optionsLE, SIGNAL(textChanged(QString)),
|
2007-09-20 22:31:18 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-10-13 16:01:02 +00:00
|
|
|
for (int i = 0; backref_opts[i][0]; ++i)
|
|
|
|
pdfSupportModule->backrefCO->addItem(qt_(backref_opts_gui[i]));
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// float
|
|
|
|
floatModule = new FloatPlacement;
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(floatModule, SIGNAL(changed()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// listings
|
|
|
|
listingsModule = new UiWidget<Ui::ListingsSettingsUi>;
|
|
|
|
connect(listingsModule->listingsED, SIGNAL(textChanged()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(setListingsMessage()));
|
|
|
|
connect(listingsModule->listingsED, SIGNAL(textChanged()),
|
|
|
|
this, SLOT(setListingsMessage()));
|
|
|
|
listingsModule->listingsTB->setPlainText(
|
|
|
|
qt_("Input listings parameters below. Enter ? for a list of parameters."));
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
|
|
|
// add the panels
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(latexModule, qt_("Document Class"));
|
2010-01-07 10:01:26 +00:00
|
|
|
docPS->addPanel(masterChildModule, qt_("Child Documents"));
|
2008-10-19 01:21:59 +00:00
|
|
|
docPS->addPanel(modulesModule, qt_("Modules"));
|
2010-09-17 01:46:45 +00:00
|
|
|
docPS->addPanel(localLayout, qt_("Local Layout"));
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(fontModule, qt_("Fonts"));
|
|
|
|
docPS->addPanel(textLayoutModule, qt_("Text Layout"));
|
|
|
|
docPS->addPanel(pageLayoutModule, qt_("Page Layout"));
|
|
|
|
docPS->addPanel(marginsModule, qt_("Page Margins"));
|
|
|
|
docPS->addPanel(langModule, qt_("Language"));
|
2010-04-02 22:11:50 +00:00
|
|
|
docPS->addPanel(colorModule, qt_("Colors"));
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(numberingModule, qt_("Numbering & TOC"));
|
|
|
|
docPS->addPanel(biblioModule, qt_("Bibliography"));
|
2009-05-02 15:54:45 +00:00
|
|
|
docPS->addPanel(indicesModule, qt_("Indexes"));
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(pdfSupportModule, qt_("PDF Properties"));
|
|
|
|
docPS->addPanel(mathsModule, qt_("Math Options"));
|
|
|
|
docPS->addPanel(floatModule, qt_("Float Placement"));
|
2009-07-20 08:09:32 +00:00
|
|
|
docPS->addPanel(listingsModule, qt_("Listings"));
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(bulletsModule, qt_("Bullets"));
|
|
|
|
docPS->addPanel(branchesModule, qt_("Branches"));
|
2009-04-10 11:06:53 +00:00
|
|
|
docPS->addPanel(outputModule, qt_("Output"));
|
2008-03-05 20:48:19 +00:00
|
|
|
docPS->addPanel(preambleModule, qt_("LaTeX Preamble"));
|
|
|
|
docPS->setCurrentPanel(qt_("Document Class"));
|
2007-04-24 19:37:34 +00:00
|
|
|
// FIXME: hack to work around resizing bug in Qt >= 4.2
|
|
|
|
// bug verified with Qt 4.2.{0-3} (JSpitzm)
|
|
|
|
#if QT_VERSION >= 0x040200
|
|
|
|
docPS->updateGeometry();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::saveDefaultClicked()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
saveDocDefault();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::useDefaultsClicked()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
useClassDefaults();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::change_adaptor()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
void GuiDocument::includeonlyClicked(QTreeWidgetItem * item, int)
|
|
|
|
{
|
|
|
|
if (item == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string child = fromqstr(item->text(0));
|
|
|
|
if (child.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (std::find(includeonlys_.begin(),
|
|
|
|
includeonlys_.end(), child) != includeonlys_.end())
|
|
|
|
includeonlys_.remove(child);
|
|
|
|
else
|
|
|
|
includeonlys_.push_back(child);
|
|
|
|
|
|
|
|
updateIncludeonlys();
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-20 12:07:18 +00:00
|
|
|
QString GuiDocument::validateListingsParameters()
|
2007-07-27 18:17:00 +00:00
|
|
|
{
|
|
|
|
// use a cache here to avoid repeated validation
|
|
|
|
// of the same parameters
|
2008-09-20 12:07:18 +00:00
|
|
|
static string param_cache;
|
|
|
|
static QString msg_cache;
|
2007-07-27 18:17:00 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
if (listingsModule->bypassCB->isChecked())
|
2008-09-20 12:07:18 +00:00
|
|
|
return QString();
|
2007-07-27 18:17:00 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
string params = fromqstr(listingsModule->listingsED->toPlainText());
|
2007-07-27 18:17:00 +00:00
|
|
|
if (params != param_cache) {
|
|
|
|
param_cache = params;
|
2008-09-20 12:07:18 +00:00
|
|
|
msg_cache = toqstr(InsetListingsParams(params).validate());
|
2007-07-27 18:17:00 +00:00
|
|
|
}
|
|
|
|
return msg_cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-20 12:07:18 +00:00
|
|
|
void GuiDocument::setListingsMessage()
|
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
|
|
|
{
|
|
|
|
static bool isOK = true;
|
2008-09-20 12:07:18 +00:00
|
|
|
QString msg = validateListingsParameters();
|
|
|
|
if (msg.isEmpty()) {
|
2007-06-12 17:10:28 +00:00
|
|
|
if (isOK)
|
|
|
|
return;
|
|
|
|
isOK = true;
|
|
|
|
// listingsTB->setTextColor("black");
|
2009-07-20 08:09:32 +00:00
|
|
|
listingsModule->listingsTB->setPlainText(
|
|
|
|
qt_("Input listings parameters below. "
|
2008-09-20 12:07:18 +00:00
|
|
|
"Enter ? for a list of parameters."));
|
2007-06-12 17:10:28 +00:00
|
|
|
} else {
|
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
|
|
|
isOK = false;
|
|
|
|
// listingsTB->setTextColor("red");
|
2009-07-20 08:09:32 +00:00
|
|
|
listingsModule->listingsTB->setPlainText(msg);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::setLSpacing(int item)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
textLayoutModule->lspacingLE->setEnabled(item == 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-19 21:13:27 +00:00
|
|
|
void GuiDocument::setIndent(int item)
|
|
|
|
{
|
|
|
|
bool const enable = (item == 1);
|
|
|
|
textLayoutModule->indentLE->setEnabled(enable);
|
|
|
|
textLayoutModule->indentLengthCO->setEnabled(enable);
|
|
|
|
textLayoutModule->skipLE->setEnabled(false);
|
|
|
|
textLayoutModule->skipLengthCO->setEnabled(false);
|
|
|
|
isValid();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::enableIndent(bool indent)
|
|
|
|
{
|
|
|
|
textLayoutModule->skipLE->setEnabled(!indent);
|
|
|
|
textLayoutModule->skipLengthCO->setEnabled(!indent);
|
|
|
|
if (indent)
|
|
|
|
setIndent(textLayoutModule->indentCO->currentIndex());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::setSkip(int item)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
bool const enable = (item == 3);
|
|
|
|
textLayoutModule->skipLE->setEnabled(enable);
|
|
|
|
textLayoutModule->skipLengthCO->setEnabled(enable);
|
2009-07-19 21:13:27 +00:00
|
|
|
isValid();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::enableSkip(bool skip)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2009-07-19 21:13:27 +00:00
|
|
|
textLayoutModule->indentLE->setEnabled(!skip);
|
|
|
|
textLayoutModule->indentLengthCO->setEnabled(!skip);
|
2007-04-24 19:37:34 +00:00
|
|
|
if (skip)
|
|
|
|
setSkip(textLayoutModule->skipCO->currentIndex());
|
|
|
|
}
|
|
|
|
|
2009-04-06 06:58:30 +00:00
|
|
|
|
2010-05-18 02:56:36 +00:00
|
|
|
void GuiDocument::setMargins()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2009-03-28 10:48:16 +00:00
|
|
|
bool const extern_geometry =
|
|
|
|
documentClass().provides("geometry");
|
|
|
|
marginsModule->marginCB->setEnabled(!extern_geometry);
|
|
|
|
if (extern_geometry) {
|
|
|
|
marginsModule->marginCB->setChecked(false);
|
|
|
|
setCustomMargins(true);
|
2010-05-18 21:08:06 +00:00
|
|
|
} else {
|
|
|
|
marginsModule->marginCB->setChecked(!bp_.use_geometry);
|
|
|
|
setCustomMargins(!bp_.use_geometry);
|
2009-03-28 10:48:16 +00:00
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-16 08:39:22 +00:00
|
|
|
void GuiDocument::papersizeChanged(int paper_size)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2009-07-16 08:39:22 +00:00
|
|
|
setCustomPapersize(paper_size == 1);
|
|
|
|
}
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-16 08:39:22 +00:00
|
|
|
void GuiDocument::setCustomPapersize(bool custom)
|
|
|
|
{
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->paperwidthL->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperwidthLE->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightL->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightLE->setEnabled(custom);
|
|
|
|
pageLayoutModule->paperheightLE->setFocus();
|
|
|
|
pageLayoutModule->paperheightUnitCO->setEnabled(custom);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-19 05:39:36 +00:00
|
|
|
void GuiDocument::setColSep()
|
|
|
|
{
|
|
|
|
setCustomMargins(marginsModule->marginCB->checkState() == Qt::Checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::setCustomMargins(bool custom)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
marginsModule->topL->setEnabled(!custom);
|
|
|
|
marginsModule->topLE->setEnabled(!custom);
|
|
|
|
marginsModule->topUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->bottomL->setEnabled(!custom);
|
|
|
|
marginsModule->bottomLE->setEnabled(!custom);
|
|
|
|
marginsModule->bottomUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->innerL->setEnabled(!custom);
|
|
|
|
marginsModule->innerLE->setEnabled(!custom);
|
|
|
|
marginsModule->innerUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->outerL->setEnabled(!custom);
|
|
|
|
marginsModule->outerLE->setEnabled(!custom);
|
|
|
|
marginsModule->outerUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->headheightL->setEnabled(!custom);
|
|
|
|
marginsModule->headheightLE->setEnabled(!custom);
|
|
|
|
marginsModule->headheightUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->headsepL->setEnabled(!custom);
|
|
|
|
marginsModule->headsepLE->setEnabled(!custom);
|
|
|
|
marginsModule->headsepUnit->setEnabled(!custom);
|
|
|
|
|
|
|
|
marginsModule->footskipL->setEnabled(!custom);
|
|
|
|
marginsModule->footskipLE->setEnabled(!custom);
|
|
|
|
marginsModule->footskipUnit->setEnabled(!custom);
|
2008-02-19 05:24:48 +00:00
|
|
|
|
2008-02-19 05:39:36 +00:00
|
|
|
bool const enableColSep = !custom &&
|
|
|
|
textLayoutModule->twoColumnCB->checkState() == Qt::Checked;
|
|
|
|
marginsModule->columnsepL->setEnabled(enableColSep);
|
|
|
|
marginsModule->columnsepLE->setEnabled(enableColSep);
|
|
|
|
marginsModule->columnsepUnit->setEnabled(enableColSep);
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2009-04-11 21:40:11 +00:00
|
|
|
void GuiDocument::changeBackgroundColor()
|
|
|
|
{
|
2009-04-12 09:13:46 +00:00
|
|
|
QColor const & newColor = QColorDialog::getColor(
|
2009-04-12 12:33:35 +00:00
|
|
|
rgb2qcolor(set_backgroundcolor), asQWidget());
|
2009-04-11 21:40:11 +00:00
|
|
|
if (!newColor.isValid())
|
|
|
|
return;
|
2010-04-05 20:31:10 +00:00
|
|
|
// set the button color and text
|
2010-04-02 22:11:50 +00:00
|
|
|
colorModule->backgroundPB->setStyleSheet(
|
2009-04-11 21:40:11 +00:00
|
|
|
colorButtonStyleSheet(newColor));
|
2010-04-05 20:31:10 +00:00
|
|
|
colorModule->backgroundPB->setText(toqstr("Change..."));
|
2009-04-12 09:13:46 +00:00
|
|
|
// save color
|
2009-04-11 21:40:11 +00:00
|
|
|
set_backgroundcolor = rgbFromHexName(fromqstr(newColor.name()));
|
2010-04-05 20:31:10 +00:00
|
|
|
is_backgroundcolor = true;
|
2009-04-11 21:40:11 +00:00
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::deleteBackgroundColor()
|
|
|
|
{
|
2010-04-05 20:31:10 +00:00
|
|
|
// set the button color back to default by setting an epmty StyleSheet
|
|
|
|
colorModule->backgroundPB->setStyleSheet(QLatin1String(""));
|
|
|
|
// change button text
|
|
|
|
colorModule->backgroundPB->setText(toqstr("Default..."));
|
|
|
|
// save default color (white)
|
2009-04-11 21:40:11 +00:00
|
|
|
set_backgroundcolor = rgbFromHexName("#ffffff");
|
2010-04-05 20:31:10 +00:00
|
|
|
is_backgroundcolor = false;
|
2009-04-11 21:40:11 +00:00
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 23:39:36 +00:00
|
|
|
void GuiDocument::changeFontColor()
|
|
|
|
{
|
|
|
|
QColor const & newColor = QColorDialog::getColor(
|
|
|
|
rgb2qcolor(set_fontcolor), asQWidget());
|
|
|
|
if (!newColor.isValid())
|
|
|
|
return;
|
|
|
|
// set the button color and text
|
|
|
|
colorModule->fontColorPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(newColor));
|
|
|
|
colorModule->fontColorPB->setText(toqstr("Change..."));
|
|
|
|
// save color
|
|
|
|
set_fontcolor = rgbFromHexName(fromqstr(newColor.name()));
|
|
|
|
is_fontcolor = true;
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::deleteFontColor()
|
|
|
|
{
|
|
|
|
// set the button color back to default by setting an epmty StyleSheet
|
|
|
|
colorModule->fontColorPB->setStyleSheet(QLatin1String(""));
|
|
|
|
// change button text
|
|
|
|
colorModule->fontColorPB->setText(toqstr("Default..."));
|
|
|
|
// save default color (black)
|
|
|
|
set_fontcolor = rgbFromHexName("#000000");
|
|
|
|
is_fontcolor = false;
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-31 00:46:50 +00:00
|
|
|
void GuiDocument::changeNoteFontColor()
|
|
|
|
{
|
|
|
|
QColor const & newColor = QColorDialog::getColor(
|
|
|
|
rgb2qcolor(set_notefontcolor), asQWidget());
|
|
|
|
if (!newColor.isValid())
|
|
|
|
return;
|
|
|
|
// set the button color
|
2010-04-02 22:11:50 +00:00
|
|
|
colorModule->noteFontColorPB->setStyleSheet(
|
2010-03-31 00:46:50 +00:00
|
|
|
colorButtonStyleSheet(newColor));
|
|
|
|
// save color
|
|
|
|
set_notefontcolor = rgbFromHexName(fromqstr(newColor.name()));
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::deleteNoteFontColor()
|
|
|
|
{
|
|
|
|
// set the button color back to light gray
|
2010-04-02 22:11:50 +00:00
|
|
|
colorModule->noteFontColorPB->setStyleSheet(
|
2010-03-31 00:46:50 +00:00
|
|
|
colorButtonStyleSheet(QColor(204, 204, 204, 255)));
|
|
|
|
// save light gray as the set color
|
|
|
|
set_notefontcolor = rgbFromHexName("#cccccc");
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-08 00:14:08 +00:00
|
|
|
void GuiDocument::changeBoxBackgroundColor()
|
|
|
|
{
|
|
|
|
QColor const & newColor = QColorDialog::getColor(
|
|
|
|
rgb2qcolor(set_boxbgcolor), asQWidget());
|
|
|
|
if (!newColor.isValid())
|
|
|
|
return;
|
|
|
|
// set the button color
|
|
|
|
colorModule->boxBackgroundPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(newColor));
|
|
|
|
// save color
|
|
|
|
set_boxbgcolor = rgbFromHexName(fromqstr(newColor.name()));
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::deleteBoxBackgroundColor()
|
|
|
|
{
|
|
|
|
// set the button color back to red
|
|
|
|
colorModule->boxBackgroundPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(QColor(Qt::red)));
|
|
|
|
// save red as the set color
|
|
|
|
set_boxbgcolor = rgbFromHexName("#ff0000");
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
void GuiDocument::osFontsChanged(bool nontexfonts)
|
2009-04-06 06:58:30 +00:00
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
bool const tex_fonts = !nontexfonts;
|
2009-04-06 06:58:30 +00:00
|
|
|
updateFontlist();
|
2009-04-10 11:06:53 +00:00
|
|
|
updateDefaultFormat();
|
2010-11-26 09:42:03 +00:00
|
|
|
langModule->encodingCO->setEnabled(tex_fonts &&
|
2009-04-06 06:58:30 +00:00
|
|
|
!langModule->defaultencodingRB->isChecked());
|
2010-11-26 09:42:03 +00:00
|
|
|
langModule->defaultencodingRB->setEnabled(tex_fonts);
|
|
|
|
langModule->otherencodingRB->setEnabled(tex_fonts);
|
2009-04-10 14:39:22 +00:00
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
fontModule->fontsDefaultCO->setEnabled(tex_fonts);
|
|
|
|
fontModule->fontsDefaultLA->setEnabled(tex_fonts);
|
|
|
|
fontModule->cjkFontLE->setEnabled(tex_fonts);
|
|
|
|
fontModule->cjkFontLA->setEnabled(tex_fonts);
|
2009-04-10 14:39:22 +00:00
|
|
|
string font;
|
2010-11-26 09:42:03 +00:00
|
|
|
if (tex_fonts)
|
2009-04-10 14:39:22 +00:00
|
|
|
font = tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
|
|
|
|
bool scaleable = providesScale(font);
|
|
|
|
fontModule->scaleSansSB->setEnabled(scaleable);
|
|
|
|
fontModule->scaleSansLA->setEnabled(scaleable);
|
2010-11-26 09:42:03 +00:00
|
|
|
if (tex_fonts)
|
2009-04-10 14:39:22 +00:00
|
|
|
font = tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
|
|
|
|
scaleable = providesScale(font);
|
|
|
|
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
|
|
|
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
2010-11-26 09:42:03 +00:00
|
|
|
if (tex_fonts)
|
2009-04-10 14:39:22 +00:00
|
|
|
font = tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
|
|
|
|
fontModule->fontScCB->setEnabled(providesSC(font));
|
|
|
|
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
2009-11-29 14:43:00 +00:00
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
fontModule->fontencLA->setEnabled(tex_fonts);
|
|
|
|
fontModule->fontencCO->setEnabled(tex_fonts);
|
|
|
|
if (!tex_fonts)
|
2010-06-25 03:33:15 +00:00
|
|
|
fontModule->fontencLE->setEnabled(false);
|
|
|
|
else
|
|
|
|
fontencChanged(fontModule->fontencCO->currentIndex());
|
2009-04-06 06:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::updateFontsize(string const & items, string const & sel)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
fontModule->fontsizeCO->clear();
|
2007-06-01 17:44:04 +00:00
|
|
|
fontModule->fontsizeCO->addItem(qt_("Default"));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
for (int n = 0; !token(items,'|',n).empty(); ++n)
|
|
|
|
fontModule->fontsizeCO->
|
|
|
|
addItem(toqstr(token(items,'|',n)));
|
|
|
|
|
|
|
|
for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
|
|
|
|
if (fromqstr(fontModule->fontsizeCO->itemText(n)) == sel) {
|
|
|
|
fontModule->fontsizeCO->setCurrentIndex(n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-06 06:58:30 +00:00
|
|
|
void GuiDocument::updateFontlist()
|
|
|
|
{
|
|
|
|
fontModule->fontsRomanCO->clear();
|
|
|
|
fontModule->fontsSansCO->clear();
|
|
|
|
fontModule->fontsTypewriterCO->clear();
|
|
|
|
|
|
|
|
// With XeTeX, we have access to all system fonts, but not the LaTeX fonts
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked()) {
|
2009-04-06 06:58:30 +00:00
|
|
|
fontModule->fontsRomanCO->addItem(qt_("Default"));
|
|
|
|
fontModule->fontsSansCO->addItem(qt_("Default"));
|
|
|
|
fontModule->fontsTypewriterCO->addItem(qt_("Default"));
|
|
|
|
|
|
|
|
QFontDatabase fontdb;
|
|
|
|
QStringList families(fontdb.families());
|
|
|
|
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
|
|
|
fontModule->fontsRomanCO->addItem(*it);
|
|
|
|
fontModule->fontsSansCO->addItem(*it);
|
|
|
|
fontModule->fontsTypewriterCO->addItem(*it);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int n = 0; tex_fonts_roman[n][0]; ++n) {
|
|
|
|
QString font = qt_(tex_fonts_roman_gui[n]);
|
|
|
|
if (!isFontAvailable(tex_fonts_roman[n]))
|
|
|
|
font += qt_(" (not installed)");
|
|
|
|
fontModule->fontsRomanCO->addItem(font);
|
|
|
|
}
|
|
|
|
for (int n = 0; tex_fonts_sans[n][0]; ++n) {
|
|
|
|
QString font = qt_(tex_fonts_sans_gui[n]);
|
|
|
|
if (!isFontAvailable(tex_fonts_sans[n]))
|
|
|
|
font += qt_(" (not installed)");
|
|
|
|
fontModule->fontsSansCO->addItem(font);
|
|
|
|
}
|
|
|
|
for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
|
|
|
|
QString font = qt_(tex_fonts_monospaced_gui[n]);
|
|
|
|
if (!isFontAvailable(tex_fonts_monospaced[n]))
|
|
|
|
font += qt_(" (not installed)");
|
|
|
|
fontModule->fontsTypewriterCO->addItem(font);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-29 14:43:00 +00:00
|
|
|
void GuiDocument::fontencChanged(int item)
|
|
|
|
{
|
|
|
|
fontModule->fontencLE->setEnabled(item == 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::romanChanged(int item)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-06 06:58:30 +00:00
|
|
|
return;
|
2007-04-24 19:37:34 +00:00
|
|
|
string const font = tex_fonts_roman[item];
|
2007-10-06 22:43:21 +00:00
|
|
|
fontModule->fontScCB->setEnabled(providesSC(font));
|
|
|
|
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::sansChanged(int item)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-06 06:58:30 +00:00
|
|
|
return;
|
2007-04-24 19:37:34 +00:00
|
|
|
string const font = tex_fonts_sans[item];
|
2007-10-06 22:43:21 +00:00
|
|
|
bool scaleable = providesScale(font);
|
2007-04-24 19:37:34 +00:00
|
|
|
fontModule->scaleSansSB->setEnabled(scaleable);
|
|
|
|
fontModule->scaleSansLA->setEnabled(scaleable);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::ttChanged(int item)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-06 06:58:30 +00:00
|
|
|
return;
|
2007-04-24 19:37:34 +00:00
|
|
|
string const font = tex_fonts_monospaced[item];
|
2007-10-06 22:43:21 +00:00
|
|
|
bool scaleable = providesScale(font);
|
2007-04-24 19:37:34 +00:00
|
|
|
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
|
|
|
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::updatePagestyle(string const & items, string const & sel)
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2007-06-01 17:44:04 +00:00
|
|
|
pagestyles.clear();
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->pagestyleCO->clear();
|
2007-06-01 17:44:04 +00:00
|
|
|
pageLayoutModule->pagestyleCO->addItem(qt_("Default"));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-09-20 12:57:12 +00:00
|
|
|
for (int n = 0; !token(items, '|', n).empty(); ++n) {
|
2007-06-01 17:44:04 +00:00
|
|
|
string style = token(items, '|', n);
|
2008-09-20 12:57:12 +00:00
|
|
|
QString style_gui = qt_(style);
|
|
|
|
pagestyles.push_back(pair<string, QString>(style, style_gui));
|
|
|
|
pageLayoutModule->pagestyleCO->addItem(style_gui);
|
2007-06-01 17:44:04 +00:00
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-06-01 17:44:04 +00:00
|
|
|
if (sel == "default") {
|
|
|
|
pageLayoutModule->pagestyleCO->setCurrentIndex(0);
|
|
|
|
return;
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
2007-06-01 17:44:04 +00:00
|
|
|
|
2007-09-08 21:00:49 +00:00
|
|
|
int nn = 0;
|
2007-06-01 17:44:04 +00:00
|
|
|
|
|
|
|
for (size_t i = 0; i < pagestyles.size(); ++i)
|
|
|
|
if (pagestyles[i].first == sel)
|
2008-09-20 12:57:12 +00:00
|
|
|
nn = pageLayoutModule->pagestyleCO->findText(pagestyles[i].second);
|
2007-06-01 17:44:04 +00:00
|
|
|
|
2007-09-08 21:00:49 +00:00
|
|
|
if (nn > 0)
|
2007-09-08 22:08:46 +00:00
|
|
|
pageLayoutModule->pagestyleCO->setCurrentIndex(nn);
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-10 21:31:22 +00:00
|
|
|
void GuiDocument::browseLayout()
|
|
|
|
{
|
|
|
|
QString const label1 = qt_("Layouts|#o#O");
|
|
|
|
QString const dir1 = toqstr(lyxrc.document_path);
|
2008-04-20 19:56:01 +00:00
|
|
|
QStringList const filter(qt_("LyX Layout (*.layout)"));
|
2010-04-21 01:19:30 +00:00
|
|
|
QString file = browseRelFile(QString(), bufferFilePath(),
|
2008-03-10 21:31:22 +00:00
|
|
|
qt_("Local layout file"), filter, false,
|
|
|
|
label1, dir1);
|
|
|
|
|
2008-04-20 21:05:35 +00:00
|
|
|
if (!file.endsWith(".layout"))
|
2008-03-10 21:31:22 +00:00
|
|
|
return;
|
|
|
|
|
2008-04-21 06:36:06 +00:00
|
|
|
FileName layoutFile = support::makeAbsPath(fromqstr(file),
|
2010-04-21 01:19:30 +00:00
|
|
|
fromqstr(bufferFilePath()));
|
2008-03-10 21:31:22 +00:00
|
|
|
|
2008-07-11 02:43:02 +00:00
|
|
|
int const ret = Alert::prompt(_("Local layout file"),
|
|
|
|
_("The layout file you have selected is a local layout\n"
|
|
|
|
"file, not one in the system or user directory. Your\n"
|
|
|
|
"document may not work with this layout if you do not\n"
|
|
|
|
"keep the layout file in the document directory."),
|
|
|
|
1, 1, _("&Set Layout"), _("&Cancel"));
|
|
|
|
if (ret == 1)
|
|
|
|
return;
|
|
|
|
|
2008-03-10 21:31:22 +00:00
|
|
|
// load the layout file
|
|
|
|
LayoutFileList & bcl = LayoutFileList::get();
|
|
|
|
string classname = layoutFile.onlyFileName();
|
2008-07-11 02:43:02 +00:00
|
|
|
// this will update an existing layout if that layout has been loaded before.
|
|
|
|
LayoutFileIndex name = bcl.addLocalLayout(
|
2008-03-10 21:31:22 +00:00
|
|
|
classname.substr(0, classname.size() - 7),
|
2010-04-21 01:19:09 +00:00
|
|
|
layoutFile.onlyPath().absFileName());
|
2008-03-10 21:31:22 +00:00
|
|
|
|
|
|
|
if (name.empty()) {
|
|
|
|
Alert::error(_("Error"),
|
|
|
|
_("Unable to read local layout file."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// do not trigger classChanged if there is no change.
|
|
|
|
if (latexModule->classCO->currentText() == toqstr(name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// add to combo box
|
|
|
|
int idx = latexModule->classCO->findText(toqstr(name));
|
|
|
|
if (idx == -1) {
|
|
|
|
classes_model_.insertRow(0, toqstr(name), name);
|
|
|
|
latexModule->classCO->setCurrentIndex(0);
|
|
|
|
} else
|
|
|
|
latexModule->classCO->setCurrentIndex(idx);
|
2008-07-11 02:43:02 +00:00
|
|
|
|
2008-03-10 21:31:22 +00:00
|
|
|
classChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-28 16:38:56 +00:00
|
|
|
void GuiDocument::browseMaster()
|
|
|
|
{
|
|
|
|
QString const title = qt_("Select master document");
|
|
|
|
QString const dir1 = toqstr(lyxrc.document_path);
|
|
|
|
QString const old = latexModule->childDocLE->text();
|
|
|
|
QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
|
|
|
|
QStringList const filter(qt_("LyX Files (*.lyx)"));
|
|
|
|
QString file = browseRelFile(old, docpath, title, filter, false,
|
|
|
|
qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
|
|
|
|
|
2010-01-01 02:45:22 +00:00
|
|
|
if (!file.isEmpty())
|
|
|
|
latexModule->childDocLE->setText(file);
|
2008-04-28 16:38:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::classChanged()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2008-02-28 21:04:55 +00:00
|
|
|
int idx = latexModule->classCO->currentIndex();
|
|
|
|
if (idx < 0)
|
|
|
|
return;
|
|
|
|
string const classname = classes_model_.getIDString(idx);
|
2008-07-11 02:43:02 +00:00
|
|
|
|
2008-10-14 17:03:57 +00:00
|
|
|
// check whether the selected modules have changed.
|
2008-10-20 20:31:33 +00:00
|
|
|
bool modules_changed = false;
|
2008-10-14 17:35:49 +00:00
|
|
|
unsigned int const srows = selectedModel()->rowCount();
|
2008-10-14 17:03:57 +00:00
|
|
|
if (srows != bp_.getModules().size())
|
2008-10-20 20:31:33 +00:00
|
|
|
modules_changed = true;
|
2008-10-14 17:03:57 +00:00
|
|
|
else {
|
|
|
|
list<string>::const_iterator mit = bp_.getModules().begin();
|
|
|
|
list<string>::const_iterator men = bp_.getModules().end();
|
2008-10-14 17:35:49 +00:00
|
|
|
for (unsigned int i = 0; i < srows && mit != men; ++i, ++mit)
|
2008-10-14 17:03:57 +00:00
|
|
|
if (selectedModel()->getIDString(i) != *mit) {
|
2008-10-20 20:31:33 +00:00
|
|
|
modules_changed = true;
|
2008-10-14 17:03:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
if (modules_changed || lyxrc.auto_reset_options) {
|
2008-01-15 10:38:19 +00:00
|
|
|
if (applyPB->isEnabled()) {
|
|
|
|
int const ret = Alert::prompt(_("Unapplied changes"),
|
2008-03-02 12:36:30 +00:00
|
|
|
_("Some changes in the dialog were not yet applied.\n"
|
2008-01-15 10:38:19 +00:00
|
|
|
"If you do not apply now, they will be lost after this action."),
|
|
|
|
1, 1, _("&Apply"), _("&Dismiss"));
|
|
|
|
if (ret == 0)
|
|
|
|
applyView();
|
|
|
|
}
|
2008-01-10 06:22:42 +00:00
|
|
|
}
|
2008-10-14 18:06:08 +00:00
|
|
|
|
|
|
|
// We load the TextClass as soon as it is selected. This is
|
|
|
|
// necessary so that other options in the dialog can be updated
|
|
|
|
// according to the new class. Note, however, that, if you use
|
|
|
|
// the scroll wheel when sitting on the combo box, we'll load a
|
|
|
|
// lot of TextClass objects very quickly....
|
|
|
|
if (!bp_.setBaseClass(classname)) {
|
|
|
|
Alert::error(_("Error"), _("Unable to set document class."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (lyxrc.auto_reset_options)
|
|
|
|
bp_.useClassDefaults();
|
|
|
|
|
2008-10-12 22:02:31 +00:00
|
|
|
// With the introduction of modules came a distinction between the base
|
2008-10-12 22:21:56 +00:00
|
|
|
// class and the document class. The former corresponds to the main layout
|
|
|
|
// file; the latter is that plus the modules (or the document-specific layout,
|
2008-10-12 22:02:31 +00:00
|
|
|
// or whatever else there could be). Our parameters come from the document
|
2008-10-12 22:07:47 +00:00
|
|
|
// class. So when we set the base class, we also need to recreate the document
|
2008-10-12 22:02:31 +00:00
|
|
|
// class. Otherwise, we still have the old one.
|
|
|
|
bp_.makeDocumentClass();
|
2008-10-14 16:59:28 +00:00
|
|
|
paramsToDialog();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-22 07:20:00 +00:00
|
|
|
void GuiDocument::bibtexChanged(int n)
|
|
|
|
{
|
|
|
|
biblioModule->bibtexOptionsED->setEnabled(n != 0);
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-09 18:51:02 +00:00
|
|
|
namespace {
|
2010-10-29 13:06:52 +00:00
|
|
|
// FIXME unicode
|
|
|
|
// both of these should take a vector<docstring>
|
|
|
|
|
2008-02-24 15:44:11 +00:00
|
|
|
// This is an insanely complicated attempt to make this sort of thing
|
|
|
|
// work with RTL languages.
|
2008-01-09 18:51:02 +00:00
|
|
|
docstring formatStrVec(vector<string> const & v, docstring const & s)
|
|
|
|
{
|
|
|
|
//this mess formats the list as "v[0], v[1], ..., [s] v[n]"
|
|
|
|
if (v.size() == 0)
|
|
|
|
return docstring();
|
2008-09-20 12:57:12 +00:00
|
|
|
if (v.size() == 1)
|
2010-10-29 08:34:26 +00:00
|
|
|
return translateIfPossible(from_utf8(v[0]));
|
2008-09-20 12:57:12 +00:00
|
|
|
if (v.size() == 2) {
|
2008-01-09 18:51:02 +00:00
|
|
|
docstring retval = _("%1$s and %2$s");
|
|
|
|
retval = subst(retval, _("and"), s);
|
2010-10-29 08:34:26 +00:00
|
|
|
return bformat(retval, translateIfPossible(from_utf8(v[0])),
|
|
|
|
translateIfPossible(from_utf8(v[1])));
|
2008-01-09 18:51:02 +00:00
|
|
|
}
|
2008-09-20 12:57:12 +00:00
|
|
|
// The idea here is to format all but the last two items...
|
|
|
|
int const vSize = v.size();
|
2008-01-09 18:51:02 +00:00
|
|
|
docstring t2 = _("%1$s, %2$s");
|
2010-10-29 08:34:26 +00:00
|
|
|
docstring retval = translateIfPossible(from_utf8(v[0]));
|
2008-01-09 18:51:02 +00:00
|
|
|
for (int i = 1; i < vSize - 2; ++i)
|
2010-10-29 08:34:26 +00:00
|
|
|
retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
|
2008-01-09 18:51:02 +00:00
|
|
|
//...and then to plug them, and the last two, into this schema
|
|
|
|
docstring t = _("%1$s, %2$s, and %3$s");
|
|
|
|
t = subst(t, _("and"), s);
|
2010-10-29 08:34:26 +00:00
|
|
|
return bformat(t, retval, translateIfPossible(from_utf8(v[vSize - 2])),
|
|
|
|
translateIfPossible(from_utf8(v[vSize - 1])));
|
2008-01-09 18:51:02 +00:00
|
|
|
}
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
|
|
|
|
vector<string> idsToNames(vector<string> const & idList)
|
|
|
|
{
|
|
|
|
vector<string> retval;
|
|
|
|
vector<string>::const_iterator it = idList.begin();
|
|
|
|
vector<string>::const_iterator end = idList.end();
|
|
|
|
for (; it != end; ++it) {
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModule const * const mod = theModuleList[*it];
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (!mod)
|
2010-10-29 13:06:52 +00:00
|
|
|
retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"),
|
|
|
|
translateIfPossible(from_utf8(*it)))));
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
else
|
|
|
|
retval.push_back(mod->getName());
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
2010-07-12 17:40:54 +00:00
|
|
|
} // end anonymous namespace
|
2008-01-09 18:51:02 +00:00
|
|
|
|
|
|
|
|
2008-10-20 20:38:40 +00:00
|
|
|
void GuiDocument::modulesToParams(BufferParams & bp)
|
2008-10-20 19:31:05 +00:00
|
|
|
{
|
|
|
|
// update list of loaded modules
|
2008-10-20 20:38:40 +00:00
|
|
|
bp.clearLayoutModules();
|
2008-10-20 19:31:05 +00:00
|
|
|
int const srows = modules_sel_model_.rowCount();
|
|
|
|
for (int i = 0; i < srows; ++i)
|
2008-10-20 20:38:40 +00:00
|
|
|
bp.addLayoutModule(modules_sel_model_.getIDString(i));
|
2008-10-20 19:31:05 +00:00
|
|
|
|
|
|
|
// update the list of removed modules
|
2008-10-20 20:38:40 +00:00
|
|
|
bp.clearRemovedModules();
|
2009-02-12 15:07:22 +00:00
|
|
|
LayoutModuleList const & reqmods = bp.baseClass()->defaultModules();
|
2008-10-20 19:31:05 +00:00
|
|
|
list<string>::const_iterator rit = reqmods.begin();
|
|
|
|
list<string>::const_iterator ren = reqmods.end();
|
|
|
|
|
|
|
|
// check each of the default modules
|
|
|
|
for (; rit != ren; rit++) {
|
2008-10-20 20:38:40 +00:00
|
|
|
list<string>::const_iterator mit = bp.getModules().begin();
|
|
|
|
list<string>::const_iterator men = bp.getModules().end();
|
2008-10-20 19:31:05 +00:00
|
|
|
bool found = false;
|
|
|
|
for (; mit != men; mit++) {
|
|
|
|
if (*rit == *mit) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
// the module isn't present so must have been removed by the user
|
2008-10-20 20:38:40 +00:00
|
|
|
bp.addRemovedModule(*rit);
|
2008-10-20 19:31:05 +00:00
|
|
|
}
|
|
|
|
}
|
2008-10-20 20:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiDocument::modulesChanged()
|
|
|
|
{
|
|
|
|
modulesToParams(bp_);
|
2008-10-20 19:31:05 +00:00
|
|
|
bp_.makeDocumentClass();
|
|
|
|
paramsToDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::updateModuleInfo()
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
{
|
|
|
|
selectionManager->update();
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
//Module description
|
2008-10-20 20:31:33 +00:00
|
|
|
bool const focus_on_selected = selectionManager->selectedFocused();
|
2009-08-14 20:37:12 +00:00
|
|
|
QAbstractItemView * lv;
|
|
|
|
if (focus_on_selected)
|
|
|
|
lv = modulesModule->selectedLV;
|
|
|
|
else
|
|
|
|
lv= modulesModule->availableLV;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (lv->selectionModel()->selectedIndexes().isEmpty()) {
|
2008-10-19 01:21:59 +00:00
|
|
|
modulesModule->infoML->document()->clear();
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
QModelIndex const & idx = lv->selectionModel()->currentIndex();
|
2008-10-20 20:31:33 +00:00
|
|
|
GuiIdListModel const & id_model =
|
|
|
|
focus_on_selected ? modules_sel_model_ : modules_av_model_;
|
|
|
|
string const modName = id_model.getIDString(idx.row());
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
docstring desc = getModuleDescription(modName);
|
|
|
|
|
2009-02-12 15:07:22 +00:00
|
|
|
LayoutModuleList const & provmods = bp_.baseClass()->providedModules();
|
2008-10-23 00:27:03 +00:00
|
|
|
if (std::find(provmods.begin(), provmods.end(), modName) != provmods.end()) {
|
|
|
|
if (!desc.empty())
|
|
|
|
desc += "\n";
|
|
|
|
desc += _("Module provided by document class.");
|
|
|
|
}
|
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
vector<string> pkglist = getPackageList(modName);
|
|
|
|
docstring pkgdesc = formatStrVec(pkglist, _("and"));
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (!pkgdesc.empty()) {
|
|
|
|
if (!desc.empty())
|
|
|
|
desc += "\n";
|
|
|
|
desc += bformat(_("Package(s) required: %1$s."), pkgdesc);
|
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
pkglist = getRequiredList(modName);
|
|
|
|
if (!pkglist.empty()) {
|
|
|
|
vector<string> const reqdescs = idsToNames(pkglist);
|
|
|
|
pkgdesc = formatStrVec(reqdescs, _("or"));
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (!desc.empty())
|
|
|
|
desc += "\n";
|
2010-10-28 20:23:39 +00:00
|
|
|
desc += bformat(_("Modules required: %1$s."), pkgdesc);
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
2008-10-20 20:31:33 +00:00
|
|
|
pkglist = getExcludedList(modName);
|
|
|
|
if (!pkglist.empty()) {
|
|
|
|
vector<string> const reqdescs = idsToNames(pkglist);
|
|
|
|
pkgdesc = formatStrVec(reqdescs, _( "and"));
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (!desc.empty())
|
|
|
|
desc += "\n";
|
|
|
|
desc += bformat(_("Modules excluded: %1$s."), pkgdesc);
|
|
|
|
}
|
2008-01-09 18:51:02 +00:00
|
|
|
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (!isModuleAvailable(modName)) {
|
|
|
|
if (!desc.empty())
|
|
|
|
desc += "\n";
|
2008-10-16 17:29:01 +00:00
|
|
|
desc += _("WARNING: Some required packages are unavailable!");
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
}
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
|
2008-10-19 01:21:59 +00:00
|
|
|
modulesModule->infoML->document()->setPlainText(toqstr(desc));
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::updateNumbering()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
2008-10-12 15:34:08 +00:00
|
|
|
DocumentClass const & tclass = documentClass();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
numberingModule->tocTW->setUpdatesEnabled(false);
|
|
|
|
numberingModule->tocTW->clear();
|
|
|
|
|
|
|
|
int const depth = numberingModule->depthSL->value();
|
|
|
|
int const toc = numberingModule->tocSL->value();
|
|
|
|
QString const no = qt_("No");
|
|
|
|
QString const yes = qt_("Yes");
|
|
|
|
QTreeWidgetItem * item = 0;
|
2008-03-06 05:59:21 +00:00
|
|
|
|
|
|
|
DocumentClass::const_iterator lit = tclass.begin();
|
|
|
|
DocumentClass::const_iterator len = tclass.end();
|
|
|
|
for (; lit != len; ++lit) {
|
2008-03-06 20:01:30 +00:00
|
|
|
int const toclevel = lit->toclevel;
|
|
|
|
if (toclevel != Layout::NOT_IN_TOC && lit->labeltype == LABEL_COUNTER) {
|
2007-04-24 19:37:34 +00:00
|
|
|
item = new QTreeWidgetItem(numberingModule->tocTW);
|
2008-03-06 20:01:30 +00:00
|
|
|
item->setText(0, toqstr(translateIfPossible(lit->name())));
|
2007-04-24 19:37:34 +00:00
|
|
|
item->setText(1, (toclevel <= depth) ? yes : no);
|
|
|
|
item->setText(2, (toclevel <= toc) ? yes : no);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
numberingModule->tocTW->setUpdatesEnabled(true);
|
|
|
|
numberingModule->tocTW->update();
|
|
|
|
}
|
|
|
|
|
2007-09-20 22:31:18 +00:00
|
|
|
|
2009-04-10 11:06:53 +00:00
|
|
|
void GuiDocument::updateDefaultFormat()
|
|
|
|
{
|
2010-02-01 14:44:12 +00:00
|
|
|
if (!bufferview())
|
|
|
|
return;
|
2009-04-10 11:06:53 +00:00
|
|
|
// make a copy in order to consider unapplied changes
|
2010-03-19 13:35:32 +00:00
|
|
|
Buffer * tmpbuf = buffer().clone();
|
2010-11-26 09:42:03 +00:00
|
|
|
tmpbuf->params().useNonTeXFonts =
|
|
|
|
fontModule->osFontsCB->isChecked();
|
2009-04-10 11:06:53 +00:00
|
|
|
int idx = latexModule->classCO->currentIndex();
|
|
|
|
if (idx >= 0) {
|
|
|
|
string const classname = classes_model_.getIDString(idx);
|
|
|
|
tmpbuf->params().setBaseClass(classname);
|
|
|
|
tmpbuf->params().makeDocumentClass();
|
|
|
|
}
|
|
|
|
outputModule->defaultFormatCO->blockSignals(true);
|
|
|
|
outputModule->defaultFormatCO->clear();
|
|
|
|
outputModule->defaultFormatCO->addItem(qt_("Default"),
|
|
|
|
QVariant(QString("default")));
|
|
|
|
typedef vector<Format const *> Formats;
|
|
|
|
Formats formats = tmpbuf->exportableFormats(true);
|
|
|
|
Formats::const_iterator cit = formats.begin();
|
|
|
|
Formats::const_iterator end = formats.end();
|
|
|
|
for (; cit != end; ++cit)
|
|
|
|
outputModule->defaultFormatCO->addItem(qt_((*cit)->prettyname()),
|
|
|
|
QVariant(toqstr((*cit)->name())));
|
|
|
|
outputModule->defaultFormatCO->blockSignals(false);
|
2010-03-19 13:35:32 +00:00
|
|
|
// delete the copy
|
|
|
|
delete tmpbuf;
|
2009-04-10 11:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
bool GuiDocument::isChildIncluded(string const & child)
|
|
|
|
{
|
|
|
|
if (includeonlys_.empty())
|
|
|
|
return false;
|
|
|
|
return (std::find(includeonlys_.begin(),
|
|
|
|
includeonlys_.end(), child) != includeonlys_.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
void GuiDocument::applyView()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
// preamble
|
2008-10-20 21:00:33 +00:00
|
|
|
preambleModule->apply(bp_);
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
localLayout->apply(bp_);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-08-14 00:52:33 +00:00
|
|
|
// date
|
|
|
|
bp_.suppress_date = latexModule->suppressDateCB->isChecked();
|
2010-10-13 12:36:53 +00:00
|
|
|
bp_.use_refstyle = latexModule->refstyleCB->isChecked();
|
2009-08-14 00:52:33 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// biblio
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.setCiteEngine(ENGINE_BASIC);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
if (biblioModule->citeNatbibRB->isChecked()) {
|
|
|
|
bool const use_numerical_citations =
|
|
|
|
biblioModule->citeStyleCO->currentIndex();
|
|
|
|
if (use_numerical_citations)
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.setCiteEngine(ENGINE_NATBIB_NUMERICAL);
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.setCiteEngine(ENGINE_NATBIB_AUTHORYEAR);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
} else if (biblioModule->citeJurabibRB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.setCiteEngine(ENGINE_JURABIB);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_bibtopic =
|
2007-04-24 19:37:34 +00:00
|
|
|
biblioModule->bibtopicCB->isChecked();
|
|
|
|
|
2009-05-22 07:20:00 +00:00
|
|
|
string const bibtex_command =
|
|
|
|
fromqstr(biblioModule->bibtexCO->itemData(
|
|
|
|
biblioModule->bibtexCO->currentIndex()).toString());
|
2009-05-28 00:25:40 +00:00
|
|
|
string const bibtex_options =
|
|
|
|
fromqstr(biblioModule->bibtexOptionsED->text());
|
|
|
|
if (bibtex_command == "default" || bibtex_options.empty())
|
2009-05-22 07:20:00 +00:00
|
|
|
bp_.bibtex_command = bibtex_command;
|
|
|
|
else
|
2009-05-28 00:25:40 +00:00
|
|
|
bp_.bibtex_command = bibtex_command + " " + bibtex_options;
|
2009-05-22 07:20:00 +00:00
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
// Indices
|
|
|
|
indicesModule->apply(bp_);
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// language & quotes
|
2007-09-19 12:29:08 +00:00
|
|
|
if (langModule->defaultencodingRB->isChecked()) {
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.inputenc = "auto";
|
2007-04-24 19:37:34 +00:00
|
|
|
} else {
|
|
|
|
int i = langModule->encodingCO->currentIndex();
|
|
|
|
if (i == 0)
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.inputenc = "default";
|
2008-07-11 08:56:17 +00:00
|
|
|
else {
|
|
|
|
QString const enc_gui =
|
|
|
|
langModule->encodingCO->currentText();
|
|
|
|
Encodings::const_iterator it = encodings.begin();
|
|
|
|
Encodings::const_iterator const end = encodings.end();
|
|
|
|
bool found = false;
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
if (qt_(it->guiName()) == enc_gui) {
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.inputenc = it->latexName();
|
2008-07-11 08:56:17 +00:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
// should not happen
|
|
|
|
lyxerr << "GuiDocument::apply: Unknown encoding! Resetting to default" << endl;
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.inputenc = "default";
|
2008-07-11 08:56:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2008-03-15 00:22:54 +00:00
|
|
|
InsetQuotes::QuoteLanguage lga = InsetQuotes::EnglishQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
switch (langModule->quoteStyleCO->currentIndex()) {
|
|
|
|
case 0:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::EnglishQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::SwedishQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::GermanQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::PolishQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::FrenchQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2008-03-15 00:22:54 +00:00
|
|
|
lga = InsetQuotes::DanishQuotes;
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.quotes_language = lga;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-05-08 09:18:45 +00:00
|
|
|
QString const lang = langModule->languageCO->itemData(
|
|
|
|
langModule->languageCO->currentIndex()).toString();
|
2009-11-07 12:50:30 +00:00
|
|
|
bp_.language = lyx::languages.getLanguage(fromqstr(lang));
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
//color
|
|
|
|
bp_.backgroundcolor = set_backgroundcolor;
|
2010-04-05 20:31:10 +00:00
|
|
|
bp_.isbackgroundcolor = is_backgroundcolor;
|
2010-04-02 23:39:36 +00:00
|
|
|
bp_.fontcolor = set_fontcolor;
|
|
|
|
bp_.isfontcolor = is_fontcolor;
|
2010-04-02 22:11:50 +00:00
|
|
|
bp_.notefontcolor = set_notefontcolor;
|
2010-04-08 00:14:08 +00:00
|
|
|
bp_.boxbgcolor = set_boxbgcolor;
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// numbering
|
2008-10-20 21:00:33 +00:00
|
|
|
if (bp_.documentClass().hasTocLevels()) {
|
|
|
|
bp_.tocdepth = numberingModule->tocSL->value();
|
|
|
|
bp_.secnumdepth = numberingModule->depthSL->value();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// bullets
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.user_defined_bullet(0) = bulletsModule->bullet(0);
|
|
|
|
bp_.user_defined_bullet(1) = bulletsModule->bullet(1);
|
|
|
|
bp_.user_defined_bullet(2) = bulletsModule->bullet(2);
|
|
|
|
bp_.user_defined_bullet(3) = bulletsModule->bullet(3);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// packages
|
2010-11-26 18:42:53 +00:00
|
|
|
bp_.graphics_driver =
|
2007-06-01 17:44:04 +00:00
|
|
|
tex_graphics[latexModule->psdriverCO->currentIndex()];
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
|
2008-01-05 17:04:56 +00:00
|
|
|
// text layout
|
2008-02-28 21:04:55 +00:00
|
|
|
int idx = latexModule->classCO->currentIndex();
|
|
|
|
if (idx >= 0) {
|
|
|
|
string const classname = classes_model_.getIDString(idx);
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.setBaseClass(classname);
|
2008-02-28 21:04:55 +00:00
|
|
|
}
|
2008-01-05 17:04:56 +00:00
|
|
|
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
// Modules
|
2008-10-20 21:00:33 +00:00
|
|
|
modulesToParams(bp_);
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Math
|
2010-08-31 02:04:46 +00:00
|
|
|
if (mathsModule->amsautoCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_amsmath = BufferParams::package_auto;
|
2010-08-31 02:04:46 +00:00
|
|
|
else {
|
2007-04-24 19:37:34 +00:00
|
|
|
if (mathsModule->amsCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_amsmath = BufferParams::package_on;
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_amsmath = BufferParams::package_off;
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
if (mathsModule->esintautoCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_esint = BufferParams::package_auto;
|
2007-04-24 19:37:34 +00:00
|
|
|
else {
|
|
|
|
if (mathsModule->esintCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_esint = BufferParams::package_on;
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_esint = BufferParams::package_off;
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
2009-11-11 01:48:07 +00:00
|
|
|
if (mathsModule->mhchemautoCB->isChecked())
|
|
|
|
bp_.use_mhchem = BufferParams::package_auto;
|
|
|
|
else {
|
|
|
|
if (mathsModule->mhchemCB->isChecked())
|
|
|
|
bp_.use_mhchem = BufferParams::package_on;
|
|
|
|
else
|
|
|
|
bp_.use_mhchem = BufferParams::package_off;
|
|
|
|
}
|
2010-08-31 23:34:54 +00:00
|
|
|
if (mathsModule->mathdotsautoCB->isChecked())
|
|
|
|
bp_.use_mathdots = BufferParams::package_auto;
|
|
|
|
else {
|
|
|
|
if (mathsModule->mathdotsCB->isChecked())
|
|
|
|
bp_.use_mathdots = BufferParams::package_on;
|
|
|
|
else
|
|
|
|
bp_.use_mathdots = BufferParams::package_off;
|
|
|
|
}
|
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Page Layout
|
2007-06-01 17:44:04 +00:00
|
|
|
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.pagestyle = "default";
|
2007-06-01 17:44:04 +00:00
|
|
|
else {
|
2008-09-20 12:57:12 +00:00
|
|
|
QString style_gui = pageLayoutModule->pagestyleCO->currentText();
|
|
|
|
for (size_t i = 0; i != pagestyles.size(); ++i)
|
2007-06-01 17:44:04 +00:00
|
|
|
if (pagestyles[i].second == style_gui)
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.pagestyle = pagestyles[i].first;
|
2007-06-01 17:44:04 +00:00
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Text Layout
|
2007-04-24 19:37:34 +00:00
|
|
|
switch (textLayoutModule->lspacingCO->currentIndex()) {
|
|
|
|
case 0:
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.spacing().set(Spacing::Single);
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.spacing().set(Spacing::Onehalf);
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.spacing().set(Spacing::Double);
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
2010-05-14 19:12:59 +00:00
|
|
|
case 3: {
|
|
|
|
string s = widgetToDoubleStr(textLayoutModule->lspacingLE);
|
|
|
|
if (s.empty())
|
|
|
|
bp_.spacing().set(Spacing::Single);
|
|
|
|
else
|
|
|
|
bp_.spacing().set(Spacing::Other, s);
|
2007-04-24 19:37:34 +00:00
|
|
|
break;
|
2010-05-14 19:12:59 +00:00
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (textLayoutModule->twoColumnCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.columns = 2;
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.columns = 1;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-19 21:13:27 +00:00
|
|
|
if (textLayoutModule->indentRB->isChecked()) {
|
|
|
|
// if paragraphs are separated by an indentation
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.paragraph_separation = BufferParams::ParagraphIndentSeparation;
|
2009-07-19 21:13:27 +00:00
|
|
|
switch (textLayoutModule->indentCO->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
bp_.setIndentation(HSpace(HSpace::DEFAULT));
|
|
|
|
break;
|
|
|
|
case 1: {
|
|
|
|
HSpace indent = HSpace(
|
|
|
|
widgetsToLength(textLayoutModule->indentLE,
|
|
|
|
textLayoutModule->indentLengthCO)
|
|
|
|
);
|
|
|
|
bp_.setIndentation(indent);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
// this should never happen
|
|
|
|
bp_.setIndentation(HSpace(HSpace::DEFAULT));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// if paragraphs are separated by a skip
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.paragraph_separation = BufferParams::ParagraphSkipSeparation;
|
2009-07-19 21:13:27 +00:00
|
|
|
switch (textLayoutModule->skipCO->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
bp_.setDefSkip(VSpace(VSpace::SMALLSKIP));
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
bp_.setDefSkip(VSpace(VSpace::MEDSKIP));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
bp_.setDefSkip(VSpace(VSpace::BIGSKIP));
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
VSpace vs = VSpace(
|
|
|
|
widgetsToLength(textLayoutModule->skipLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->skipLengthCO)
|
2009-07-19 21:13:27 +00:00
|
|
|
);
|
|
|
|
bp_.setDefSkip(vs);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
// this should never happen
|
|
|
|
bp_.setDefSkip(VSpace(VSpace::MEDSKIP));
|
|
|
|
break;
|
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.options =
|
2007-04-24 19:37:34 +00:00
|
|
|
fromqstr(latexModule->optionsLE->text());
|
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.use_default_options =
|
2008-10-12 09:36:00 +00:00
|
|
|
latexModule->defaultOptionsCB->isChecked();
|
|
|
|
|
2008-04-28 16:38:56 +00:00
|
|
|
if (latexModule->childDocGB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.master =
|
2008-04-28 16:38:56 +00:00
|
|
|
fromqstr(latexModule->childDocLE->text());
|
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.master = string();
|
2008-04-28 16:38:56 +00:00
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
// Master/Child
|
|
|
|
bp_.clearIncludedChildren();
|
|
|
|
if (masterChildModule->includeonlyRB->isChecked()) {
|
|
|
|
list<string>::const_iterator it = includeonlys_.begin();
|
|
|
|
for (; it != includeonlys_.end() ; ++it) {
|
|
|
|
bp_.addIncludedChildren(*it);
|
|
|
|
}
|
|
|
|
}
|
2010-01-10 13:25:41 +00:00
|
|
|
bp_.maintain_unincluded_children =
|
|
|
|
masterChildModule->maintainAuxCB->isChecked();
|
2010-01-07 10:01:26 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Float Placement
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.float_placement = floatModule->get();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Listings
|
|
|
|
// text should have passed validation
|
|
|
|
bp_.listings_params =
|
|
|
|
InsetListingsParams(fromqstr(listingsModule->listingsED->toPlainText())).params();
|
|
|
|
|
2009-04-10 11:06:53 +00:00
|
|
|
// output
|
2010-11-26 18:42:53 +00:00
|
|
|
bp_.default_output_format = fromqstr(outputModule->defaultFormatCO->itemData(
|
2009-04-10 11:06:53 +00:00
|
|
|
outputModule->defaultFormatCO->currentIndex()).toString());
|
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
bool const nontexfonts = fontModule->osFontsCB->isChecked();
|
|
|
|
bp_.useNonTeXFonts = nontexfonts;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-05-25 11:36:00 +00:00
|
|
|
bp_.output_sync = outputModule->outputsyncCB->isChecked();
|
|
|
|
bp_.output_sync_macro = fromqstr(outputModule->synccustomCB->currentText());
|
|
|
|
|
2010-04-21 15:20:31 +00:00
|
|
|
int mathfmt = outputModule->mathoutCB->currentIndex();
|
|
|
|
if (mathfmt == -1)
|
|
|
|
mathfmt = 0;
|
|
|
|
BufferParams::MathOutput const mo =
|
|
|
|
static_cast<BufferParams::MathOutput>(mathfmt);
|
|
|
|
bp_.html_math_output = mo;
|
|
|
|
bp_.html_be_strict = outputModule->strictCB->isChecked();
|
|
|
|
bp_.html_math_img_scale = outputModule->mathimgSB->value();
|
|
|
|
|
2009-04-10 11:06:53 +00:00
|
|
|
// fonts
|
2010-11-26 09:42:03 +00:00
|
|
|
if (nontexfonts) {
|
2009-04-06 06:58:30 +00:00
|
|
|
if (fontModule->fontsRomanCO->currentIndex() == 0)
|
2010-11-26 18:20:48 +00:00
|
|
|
bp_.fonts_roman = "default";
|
2009-04-06 06:58:30 +00:00
|
|
|
else
|
2010-11-26 18:20:48 +00:00
|
|
|
bp_.fonts_roman =
|
2009-04-06 06:58:30 +00:00
|
|
|
fromqstr(fontModule->fontsRomanCO->currentText());
|
|
|
|
|
|
|
|
if (fontModule->fontsSansCO->currentIndex() == 0)
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_sans = "default";
|
2009-04-06 06:58:30 +00:00
|
|
|
else
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_sans =
|
2009-04-06 06:58:30 +00:00
|
|
|
fromqstr(fontModule->fontsSansCO->currentText());
|
|
|
|
|
|
|
|
if (fontModule->fontsTypewriterCO->currentIndex() == 0)
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_typewriter = "default";
|
2009-04-06 06:58:30 +00:00
|
|
|
else
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_typewriter =
|
2009-04-06 06:58:30 +00:00
|
|
|
fromqstr(fontModule->fontsTypewriterCO->currentText());
|
|
|
|
} else {
|
2010-11-26 18:20:48 +00:00
|
|
|
bp_.fonts_roman =
|
2009-04-06 06:58:30 +00:00
|
|
|
tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_sans =
|
2009-04-06 06:58:30 +00:00
|
|
|
tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_typewriter =
|
2009-04-06 06:58:30 +00:00
|
|
|
tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
|
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-11-29 14:43:00 +00:00
|
|
|
if (fontModule->fontencCO->currentIndex() == 0)
|
|
|
|
bp_.fontenc = "global";
|
|
|
|
else if (fontModule->fontencCO->currentIndex() == 1)
|
|
|
|
bp_.fontenc = fromqstr(fontModule->fontencLE->text());
|
|
|
|
else if (fontModule->fontencCO->currentIndex() == 2)
|
|
|
|
bp_.fontenc = "default";
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_cjk =
|
2008-06-05 06:18:34 +00:00
|
|
|
fromqstr(fontModule->cjkFontLE->text());
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_sans_scale = fontModule->scaleSansSB->value();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_typewriter_scale = fontModule->scaleTypewriterSB->value();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_expert_sc = fontModule->fontScCB->isChecked();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_old_figures = fontModule->fontOsfCB->isChecked();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
if (nontexfonts)
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_default_family = "default";
|
2009-04-07 08:39:56 +00:00
|
|
|
else
|
2010-11-26 18:32:29 +00:00
|
|
|
bp_.fonts_default_family = GuiDocument::fontfamilies[
|
2009-04-07 08:39:56 +00:00
|
|
|
fontModule->fontsDefaultCO->currentIndex()];
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
if (fontModule->fontsizeCO->currentIndex() == 0)
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.fontsize = "default";
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.fontsize =
|
2007-04-24 19:37:34 +00:00
|
|
|
fromqstr(fontModule->fontsizeCO->currentText());
|
|
|
|
|
|
|
|
// paper
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.papersize = PAPER_SIZE(
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->papersizeCO->currentIndex());
|
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->paperwidthUnitCO);
|
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.paperheight = widgetsToLength(pageLayoutModule->paperheightLE,
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->paperheightUnitCO);
|
|
|
|
|
|
|
|
if (pageLayoutModule->facingPagesCB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.sides = TwoSides;
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.sides = OneSide;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
if (pageLayoutModule->landscapeRB->isChecked())
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.orientation = ORIENTATION_LANDSCAPE;
|
2007-04-24 19:37:34 +00:00
|
|
|
else
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.orientation = ORIENTATION_PORTRAIT;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// margins
|
2010-05-18 02:56:36 +00:00
|
|
|
bp_.use_geometry = !marginsModule->marginCB->isChecked();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-03-08 07:59:47 +00:00
|
|
|
Ui::MarginsUi const * m = marginsModule;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-10-20 21:00:33 +00:00
|
|
|
bp_.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
|
|
|
|
bp_.topmargin = widgetsToLength(m->topLE, m->topUnit);
|
|
|
|
bp_.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
|
|
|
|
bp_.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
|
|
|
|
bp_.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
|
|
|
|
bp_.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
|
|
|
|
bp_.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
|
|
|
|
bp_.columnsep = widgetsToLength(m->columnsepLE, m->columnsepUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-11 10:53:29 +00:00
|
|
|
// branches
|
2008-10-20 21:00:33 +00:00
|
|
|
branchesModule->apply(bp_);
|
2007-09-20 22:31:18 +00:00
|
|
|
|
|
|
|
// PDF support
|
2008-10-20 21:00:33 +00:00
|
|
|
PDFOptions & pdf = bp_.pdfoptions();
|
2007-09-22 22:20:15 +00:00
|
|
|
pdf.use_hyperref = pdfSupportModule->use_hyperrefGB->isChecked();
|
2007-09-21 01:00:31 +00:00
|
|
|
pdf.title = fromqstr(pdfSupportModule->titleLE->text());
|
|
|
|
pdf.author = fromqstr(pdfSupportModule->authorLE->text());
|
|
|
|
pdf.subject = fromqstr(pdfSupportModule->subjectLE->text());
|
|
|
|
pdf.keywords = fromqstr(pdfSupportModule->keywordsLE->text());
|
|
|
|
|
|
|
|
pdf.bookmarks = pdfSupportModule->bookmarksGB->isChecked();
|
|
|
|
pdf.bookmarksnumbered = pdfSupportModule->bookmarksnumberedCB->isChecked();
|
|
|
|
pdf.bookmarksopen = pdfSupportModule->bookmarksopenGB->isChecked();
|
2007-09-22 22:20:15 +00:00
|
|
|
pdf.bookmarksopenlevel = pdfSupportModule->bookmarksopenlevelSB->value();
|
2007-09-20 22:31:18 +00:00
|
|
|
|
2007-09-21 01:00:31 +00:00
|
|
|
pdf.breaklinks = pdfSupportModule->breaklinksCB->isChecked();
|
|
|
|
pdf.pdfborder = pdfSupportModule->pdfborderCB->isChecked();
|
2007-10-10 00:34:23 +00:00
|
|
|
pdf.pdfusetitle = pdfSupportModule->pdfusetitleCB->isChecked();
|
2007-09-21 01:00:31 +00:00
|
|
|
pdf.colorlinks = pdfSupportModule->colorlinksCB->isChecked();
|
2008-10-13 16:01:02 +00:00
|
|
|
pdf.backref =
|
|
|
|
backref_opts[pdfSupportModule->backrefCO->currentIndex()];
|
2007-09-20 22:31:18 +00:00
|
|
|
if (pdfSupportModule->fullscreenCB->isChecked())
|
2007-09-21 01:00:31 +00:00
|
|
|
pdf.pagemode = pdf.pagemode_fullscreen;
|
2007-09-22 22:20:15 +00:00
|
|
|
else
|
|
|
|
pdf.pagemode.clear();
|
2008-03-05 01:14:15 +00:00
|
|
|
pdf.quoted_options = pdf.quoted_options_check(
|
|
|
|
fromqstr(pdfSupportModule->optionsLE->text()));
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-14 16:59:28 +00:00
|
|
|
void GuiDocument::paramsToDialog()
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
// set the default unit
|
2009-02-06 21:24:13 +00:00
|
|
|
Length::UNIT const defaultUnit = Length::defaultUnit();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// preamble
|
2008-10-14 16:59:28 +00:00
|
|
|
preambleModule->update(bp_, id());
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
localLayout->update(bp_, id());
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-08-14 00:52:33 +00:00
|
|
|
// date
|
|
|
|
latexModule->suppressDateCB->setChecked(bp_.suppress_date);
|
2010-10-13 12:36:53 +00:00
|
|
|
latexModule->refstyleCB->setChecked(bp_.use_refstyle);
|
2009-08-14 00:52:33 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// biblio
|
|
|
|
biblioModule->citeDefaultRB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.citeEngine() == ENGINE_BASIC);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
biblioModule->citeNatbibRB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.citeEngine() == ENGINE_NATBIB_NUMERICAL ||
|
|
|
|
bp_.citeEngine() == ENGINE_NATBIB_AUTHORYEAR);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
biblioModule->citeStyleCO->setCurrentIndex(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.citeEngine() == ENGINE_NATBIB_NUMERICAL);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
biblioModule->citeJurabibRB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.citeEngine() == ENGINE_JURABIB);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
biblioModule->bibtopicCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_bibtopic);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-05-22 07:20:00 +00:00
|
|
|
string command;
|
|
|
|
string options =
|
|
|
|
split(bp_.bibtex_command, command, ' ');
|
|
|
|
|
|
|
|
int const bpos = biblioModule->bibtexCO->findData(toqstr(command));
|
|
|
|
if (bpos != -1) {
|
|
|
|
biblioModule->bibtexCO->setCurrentIndex(bpos);
|
|
|
|
biblioModule->bibtexOptionsED->setText(toqstr(options).trimmed());
|
|
|
|
} else {
|
|
|
|
biblioModule->bibtexCO->setCurrentIndex(0);
|
|
|
|
biblioModule->bibtexOptionsED->clear();
|
|
|
|
}
|
|
|
|
biblioModule->bibtexOptionsED->setEnabled(
|
|
|
|
biblioModule->bibtexCO->currentIndex() != 0);
|
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
// indices
|
|
|
|
indicesModule->update(bp_);
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// language & quotes
|
2008-05-08 09:18:45 +00:00
|
|
|
int const pos = langModule->languageCO->findData(toqstr(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.language->lang()));
|
2007-04-24 19:37:34 +00:00
|
|
|
langModule->languageCO->setCurrentIndex(pos);
|
|
|
|
|
|
|
|
langModule->quoteStyleCO->setCurrentIndex(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.quotes_language);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-09-19 12:29:08 +00:00
|
|
|
bool default_enc = true;
|
2008-10-14 16:59:28 +00:00
|
|
|
if (bp_.inputenc != "auto") {
|
2007-09-19 12:29:08 +00:00
|
|
|
default_enc = false;
|
2008-10-14 16:59:28 +00:00
|
|
|
if (bp_.inputenc == "default") {
|
2007-04-24 19:37:34 +00:00
|
|
|
langModule->encodingCO->setCurrentIndex(0);
|
|
|
|
} else {
|
2008-07-11 08:56:17 +00:00
|
|
|
string enc_gui;
|
|
|
|
Encodings::const_iterator it = encodings.begin();
|
|
|
|
Encodings::const_iterator const end = encodings.end();
|
|
|
|
for (; it != end; ++it) {
|
2008-10-14 16:59:28 +00:00
|
|
|
if (it->latexName() == bp_.inputenc) {
|
2008-07-11 08:56:17 +00:00
|
|
|
enc_gui = it->guiName();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
int const i = langModule->encodingCO->findText(
|
2008-07-11 08:56:17 +00:00
|
|
|
qt_(enc_gui));
|
2007-04-24 19:37:34 +00:00
|
|
|
if (i >= 0)
|
|
|
|
langModule->encodingCO->setCurrentIndex(i);
|
|
|
|
else
|
|
|
|
// unknown encoding. Set to default.
|
2007-09-19 12:29:08 +00:00
|
|
|
default_enc = true;
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-19 12:29:08 +00:00
|
|
|
langModule->defaultencodingRB->setChecked(default_enc);
|
|
|
|
langModule->otherencodingRB->setChecked(!default_enc);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
//color
|
2010-04-02 23:39:36 +00:00
|
|
|
if (bp_.isfontcolor) {
|
|
|
|
colorModule->fontColorPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(rgb2qcolor(bp_.fontcolor)));
|
|
|
|
}
|
|
|
|
set_fontcolor = bp_.fontcolor;
|
|
|
|
is_fontcolor = bp_.isfontcolor;
|
|
|
|
|
2010-04-02 22:11:50 +00:00
|
|
|
colorModule->noteFontColorPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(rgb2qcolor(bp_.notefontcolor)));
|
|
|
|
set_notefontcolor = bp_.notefontcolor;
|
2010-04-02 23:39:36 +00:00
|
|
|
|
2010-04-05 20:31:10 +00:00
|
|
|
if (bp_.isbackgroundcolor) {
|
|
|
|
colorModule->backgroundPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(rgb2qcolor(bp_.backgroundcolor)));
|
|
|
|
}
|
2010-04-02 22:11:50 +00:00
|
|
|
set_backgroundcolor = bp_.backgroundcolor;
|
2010-04-05 20:31:10 +00:00
|
|
|
is_backgroundcolor = bp_.isbackgroundcolor;
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2010-04-08 00:14:08 +00:00
|
|
|
colorModule->boxBackgroundPB->setStyleSheet(
|
|
|
|
colorButtonStyleSheet(rgb2qcolor(bp_.boxbgcolor)));
|
|
|
|
set_boxbgcolor = bp_.boxbgcolor;
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// numbering
|
2008-02-28 21:04:55 +00:00
|
|
|
int const min_toclevel = documentClass().min_toclevel();
|
|
|
|
int const max_toclevel = documentClass().max_toclevel();
|
|
|
|
if (documentClass().hasTocLevels()) {
|
2007-04-24 19:37:34 +00:00
|
|
|
numberingModule->setEnabled(true);
|
|
|
|
numberingModule->depthSL->setMinimum(min_toclevel - 1);
|
|
|
|
numberingModule->depthSL->setMaximum(max_toclevel);
|
2008-10-14 16:59:28 +00:00
|
|
|
numberingModule->depthSL->setValue(bp_.secnumdepth);
|
2007-04-24 19:37:34 +00:00
|
|
|
numberingModule->tocSL->setMaximum(min_toclevel - 1);
|
|
|
|
numberingModule->tocSL->setMaximum(max_toclevel);
|
2008-10-14 16:59:28 +00:00
|
|
|
numberingModule->tocSL->setValue(bp_.tocdepth);
|
2007-04-24 19:37:34 +00:00
|
|
|
updateNumbering();
|
|
|
|
} else {
|
|
|
|
numberingModule->setEnabled(false);
|
|
|
|
numberingModule->tocTW->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// bullets
|
2008-10-14 16:59:28 +00:00
|
|
|
bulletsModule->setBullet(0, bp_.user_defined_bullet(0));
|
|
|
|
bulletsModule->setBullet(1, bp_.user_defined_bullet(1));
|
|
|
|
bulletsModule->setBullet(2, bp_.user_defined_bullet(2));
|
|
|
|
bulletsModule->setBullet(3, bp_.user_defined_bullet(3));
|
2007-04-24 19:37:34 +00:00
|
|
|
bulletsModule->init();
|
|
|
|
|
|
|
|
// packages
|
2010-11-26 18:42:53 +00:00
|
|
|
int nitem = findToken(tex_graphics, bp_.graphics_driver);
|
2007-06-01 17:44:04 +00:00
|
|
|
if (nitem >= 0)
|
|
|
|
latexModule->psdriverCO->setCurrentIndex(nitem);
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
updateModuleInfo();
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
mathsModule->amsCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_amsmath == BufferParams::package_on);
|
2007-04-24 19:37:34 +00:00
|
|
|
mathsModule->amsautoCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_amsmath == BufferParams::package_auto);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
mathsModule->esintCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_esint == BufferParams::package_on);
|
2007-04-24 19:37:34 +00:00
|
|
|
mathsModule->esintautoCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_esint == BufferParams::package_auto);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-11-11 01:48:07 +00:00
|
|
|
mathsModule->mhchemCB->setChecked(
|
|
|
|
bp_.use_mhchem == BufferParams::package_on);
|
|
|
|
mathsModule->mhchemautoCB->setChecked(
|
|
|
|
bp_.use_mhchem == BufferParams::package_auto);
|
|
|
|
|
2010-08-31 23:34:54 +00:00
|
|
|
mathsModule->mathdotsCB->setChecked(
|
|
|
|
bp_.use_mathdots == BufferParams::package_on);
|
|
|
|
mathsModule->mathdotsautoCB->setChecked(
|
|
|
|
bp_.use_mathdots == BufferParams::package_auto);
|
2010-08-31 02:04:46 +00:00
|
|
|
|
2008-10-14 16:59:28 +00:00
|
|
|
switch (bp_.spacing().getSpace()) {
|
2007-04-24 19:37:34 +00:00
|
|
|
case Spacing::Other: nitem = 3; break;
|
|
|
|
case Spacing::Double: nitem = 2; break;
|
|
|
|
case Spacing::Onehalf: nitem = 1; break;
|
|
|
|
case Spacing::Default: case Spacing::Single: nitem = 0; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// text layout
|
2008-10-14 16:59:28 +00:00
|
|
|
string const & layoutID = bp_.baseClassID();
|
2008-03-01 22:08:16 +00:00
|
|
|
setLayoutComboByIDString(layoutID);
|
2008-02-28 21:04:55 +00:00
|
|
|
|
|
|
|
updatePagestyle(documentClass().opt_pagestyle(),
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.pagestyle);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
textLayoutModule->lspacingCO->setCurrentIndex(nitem);
|
2008-10-14 16:59:28 +00:00
|
|
|
if (bp_.spacing().getSpace() == Spacing::Other) {
|
2009-07-12 15:44:26 +00:00
|
|
|
doubleToWidget(textLayoutModule->lspacingLE,
|
|
|
|
bp_.spacing().getValueAsString());
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
setLSpacing(nitem);
|
|
|
|
|
2009-07-19 21:13:27 +00:00
|
|
|
if (bp_.paragraph_separation == BufferParams::ParagraphIndentSeparation) {
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->indentRB->setChecked(true);
|
2009-07-19 21:13:27 +00:00
|
|
|
string indentation = bp_.getIndentation().asLyXCommand();
|
|
|
|
int indent = 0;
|
2009-07-20 01:34:09 +00:00
|
|
|
if (indentation != "default") {
|
2009-07-19 21:13:27 +00:00
|
|
|
lengthToWidgets(textLayoutModule->indentLE,
|
|
|
|
textLayoutModule->indentLengthCO,
|
|
|
|
indentation, defaultUnit);
|
|
|
|
indent = 1;
|
|
|
|
}
|
|
|
|
textLayoutModule->indentCO->setCurrentIndex(indent);
|
|
|
|
setIndent(indent);
|
|
|
|
} else {
|
2007-04-24 19:37:34 +00:00
|
|
|
textLayoutModule->skipRB->setChecked(true);
|
2009-07-19 21:13:27 +00:00
|
|
|
int skip = 0;
|
|
|
|
switch (bp_.getDefSkip().kind()) {
|
|
|
|
case VSpace::SMALLSKIP:
|
|
|
|
skip = 0;
|
|
|
|
break;
|
|
|
|
case VSpace::MEDSKIP:
|
|
|
|
skip = 1;
|
|
|
|
break;
|
|
|
|
case VSpace::BIGSKIP:
|
|
|
|
skip = 2;
|
|
|
|
break;
|
|
|
|
case VSpace::LENGTH:
|
|
|
|
{
|
|
|
|
skip = 3;
|
|
|
|
string const length = bp_.getDefSkip().asLyXCommand();
|
|
|
|
lengthToWidgets(textLayoutModule->skipLE,
|
|
|
|
textLayoutModule->skipLengthCO,
|
|
|
|
length, defaultUnit);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
skip = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
textLayoutModule->skipCO->setCurrentIndex(skip);
|
|
|
|
setSkip(skip);
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
textLayoutModule->twoColumnCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.columns == 2);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2008-10-14 16:59:28 +00:00
|
|
|
if (!bp_.options.empty()) {
|
2007-04-24 19:37:34 +00:00
|
|
|
latexModule->optionsLE->setText(
|
2008-10-14 16:59:28 +00:00
|
|
|
toqstr(bp_.options));
|
2007-04-24 19:37:34 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
latexModule->optionsLE->setText(QString());
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2008-10-14 17:35:49 +00:00
|
|
|
// latex
|
2008-10-12 09:36:00 +00:00
|
|
|
latexModule->defaultOptionsCB->setChecked(
|
2008-10-14 17:35:49 +00:00
|
|
|
bp_.use_default_options);
|
2008-10-23 00:27:03 +00:00
|
|
|
updateSelectedModules();
|
|
|
|
selectionManager->updateProvidedModules(
|
|
|
|
bp_.baseClass()->providedModules());
|
|
|
|
selectionManager->updateExcludedModules(
|
|
|
|
bp_.baseClass()->excludedModules());
|
2008-10-12 09:36:00 +00:00
|
|
|
|
|
|
|
if (!documentClass().options().empty()) {
|
|
|
|
latexModule->defaultOptionsLE->setText(
|
|
|
|
toqstr(documentClass().options()));
|
|
|
|
} else {
|
|
|
|
latexModule->defaultOptionsLE->setText(
|
|
|
|
toqstr(_("[No options predefined]")));
|
|
|
|
}
|
|
|
|
|
|
|
|
latexModule->defaultOptionsLE->setEnabled(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.use_default_options
|
2008-10-12 09:36:00 +00:00
|
|
|
&& !documentClass().options().empty());
|
|
|
|
|
|
|
|
latexModule->defaultOptionsCB->setEnabled(
|
|
|
|
!documentClass().options().empty());
|
|
|
|
|
2008-10-14 16:59:28 +00:00
|
|
|
if (!bp_.master.empty()) {
|
2008-04-28 16:38:56 +00:00
|
|
|
latexModule->childDocGB->setChecked(true);
|
|
|
|
latexModule->childDocLE->setText(
|
2008-10-14 16:59:28 +00:00
|
|
|
toqstr(bp_.master));
|
2008-04-28 16:38:56 +00:00
|
|
|
} else {
|
|
|
|
latexModule->childDocLE->setText(QString());
|
|
|
|
latexModule->childDocGB->setChecked(false);
|
|
|
|
}
|
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
// Master/Child
|
2010-10-13 12:43:13 +00:00
|
|
|
if (!bufferview() || !buffer().hasChildren()) {
|
2010-01-10 13:25:41 +00:00
|
|
|
masterChildModule->childrenTW->clear();
|
2010-01-07 10:01:26 +00:00
|
|
|
includeonlys_.clear();
|
2010-01-10 14:46:39 +00:00
|
|
|
docPS->showPanel(qt_("Child Documents"), false);
|
|
|
|
if (docPS->isCurrentPanel(qt_("Child Documents")))
|
|
|
|
docPS->setCurrentPanel(qt_("Document Class"));
|
2010-01-07 10:01:26 +00:00
|
|
|
} else {
|
2010-01-10 14:46:39 +00:00
|
|
|
docPS->showPanel(qt_("Child Documents"), true);
|
2010-01-07 10:01:26 +00:00
|
|
|
masterChildModule->setEnabled(true);
|
|
|
|
includeonlys_ = bp_.getIncludedChildren();
|
|
|
|
updateIncludeonlys();
|
|
|
|
}
|
2010-01-10 13:25:41 +00:00
|
|
|
masterChildModule->maintainAuxCB->setChecked(
|
|
|
|
bp_.maintain_unincluded_children);
|
2010-01-07 10:01:26 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// Float Settings
|
2008-10-14 16:59:28 +00:00
|
|
|
floatModule->set(bp_.float_placement);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2009-07-20 08:09:32 +00:00
|
|
|
// ListingsSettings
|
|
|
|
// break listings_params to multiple lines
|
|
|
|
string lstparams =
|
|
|
|
InsetListingsParams(bp_.listings_params).separatedParams();
|
|
|
|
listingsModule->listingsED->setPlainText(toqstr(lstparams));
|
|
|
|
|
2009-04-10 11:06:53 +00:00
|
|
|
// Output
|
|
|
|
// update combobox with formats
|
|
|
|
updateDefaultFormat();
|
|
|
|
int index = outputModule->defaultFormatCO->findData(toqstr(
|
2010-11-26 18:42:53 +00:00
|
|
|
bp_.default_output_format));
|
2009-04-10 11:06:53 +00:00
|
|
|
// set to default if format is not found
|
|
|
|
if (index == -1)
|
|
|
|
index = 0;
|
|
|
|
outputModule->defaultFormatCO->setCurrentIndex(index);
|
2010-11-26 09:42:03 +00:00
|
|
|
fontModule->osFontsCB->setEnabled(bp_.baseClass()->outputType() == lyx::LATEX);
|
|
|
|
fontModule->osFontsCB->setChecked(
|
|
|
|
bp_.baseClass()->outputType() == lyx::LATEX && bp_.useNonTeXFonts);
|
2009-04-10 11:06:53 +00:00
|
|
|
|
2010-05-25 11:36:00 +00:00
|
|
|
outputModule->outputsyncCB->setChecked(bp_.output_sync);
|
|
|
|
outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro));
|
|
|
|
|
2010-04-21 15:20:31 +00:00
|
|
|
outputModule->mathimgSB->setValue(bp_.html_math_img_scale);
|
|
|
|
outputModule->mathoutCB->setCurrentIndex(bp_.html_math_output);
|
|
|
|
outputModule->strictCB->setChecked(bp_.html_be_strict);
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
// Fonts
|
2008-02-28 21:04:55 +00:00
|
|
|
updateFontsize(documentClass().opt_fontsize(),
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.fontsize);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-11-26 09:42:03 +00:00
|
|
|
if (bp_.useNonTeXFonts) {
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencLA->setEnabled(false);
|
|
|
|
fontModule->fontencCO->setEnabled(false);
|
|
|
|
fontModule->fontencLE->setEnabled(false);
|
2009-04-06 06:58:30 +00:00
|
|
|
for (int i = 0; i < fontModule->fontsRomanCO->count(); ++i) {
|
2010-11-26 18:20:48 +00:00
|
|
|
if (fontModule->fontsRomanCO->itemText(i) == toqstr(bp_.fonts_roman)) {
|
2009-04-06 06:58:30 +00:00
|
|
|
fontModule->fontsRomanCO->setCurrentIndex(i);
|
2010-12-11 15:28:02 +00:00
|
|
|
break;
|
2009-04-06 06:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < fontModule->fontsSansCO->count(); ++i) {
|
2010-11-26 18:32:29 +00:00
|
|
|
if (fontModule->fontsSansCO->itemText(i) == toqstr(bp_.fonts_sans)) {
|
2009-04-06 06:58:30 +00:00
|
|
|
fontModule->fontsSansCO->setCurrentIndex(i);
|
2010-12-11 15:28:02 +00:00
|
|
|
break;
|
2009-04-06 06:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < fontModule->fontsTypewriterCO->count(); ++i) {
|
|
|
|
if (fontModule->fontsTypewriterCO->itemText(i) ==
|
2010-11-26 18:32:29 +00:00
|
|
|
toqstr(bp_.fonts_typewriter)) {
|
2009-04-06 06:58:30 +00:00
|
|
|
fontModule->fontsTypewriterCO->setCurrentIndex(i);
|
2010-12-11 15:28:02 +00:00
|
|
|
break;
|
2009-04-06 06:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencLA->setEnabled(true);
|
|
|
|
fontModule->fontencCO->setEnabled(true);
|
|
|
|
fontModule->fontencLE->setEnabled(true);
|
2010-11-26 18:20:48 +00:00
|
|
|
int n = findToken(tex_fonts_roman, bp_.fonts_roman);
|
2009-04-06 06:58:30 +00:00
|
|
|
if (n >= 0) {
|
|
|
|
fontModule->fontsRomanCO->setCurrentIndex(n);
|
|
|
|
romanChanged(n);
|
|
|
|
}
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
n = findToken(tex_fonts_sans, bp_.fonts_sans);
|
2009-04-06 06:58:30 +00:00
|
|
|
if (n >= 0) {
|
|
|
|
fontModule->fontsSansCO->setCurrentIndex(n);
|
|
|
|
sansChanged(n);
|
|
|
|
}
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
n = findToken(tex_fonts_monospaced, bp_.fonts_typewriter);
|
2009-04-06 06:58:30 +00:00
|
|
|
if (n >= 0) {
|
|
|
|
fontModule->fontsTypewriterCO->setCurrentIndex(n);
|
|
|
|
ttChanged(n);
|
|
|
|
}
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
if (!bp_.fonts_cjk.empty())
|
2008-06-05 06:18:34 +00:00
|
|
|
fontModule->cjkFontLE->setText(
|
2010-11-26 18:32:29 +00:00
|
|
|
toqstr(bp_.fonts_cjk));
|
2008-06-05 06:18:34 +00:00
|
|
|
else
|
|
|
|
fontModule->cjkFontLE->setText(QString());
|
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
fontModule->fontScCB->setChecked(bp_.fonts_expert_sc);
|
|
|
|
fontModule->fontOsfCB->setChecked(bp_.fonts_old_figures);
|
|
|
|
fontModule->scaleSansSB->setValue(bp_.fonts_sans_scale);
|
|
|
|
fontModule->scaleTypewriterSB->setValue(bp_.fonts_typewriter_scale);
|
2010-04-02 22:11:50 +00:00
|
|
|
|
2010-11-26 18:32:29 +00:00
|
|
|
int nn = findToken(GuiDocument::fontfamilies, bp_.fonts_default_family);
|
2009-04-06 06:58:30 +00:00
|
|
|
if (nn >= 0)
|
|
|
|
fontModule->fontsDefaultCO->setCurrentIndex(nn);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2010-06-25 03:33:15 +00:00
|
|
|
if (bp_.fontenc == "global") {
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencCO->setCurrentIndex(0);
|
2010-06-25 03:33:15 +00:00
|
|
|
fontModule->fontencLE->setEnabled(false);
|
|
|
|
} else if (bp_.fontenc == "default") {
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencCO->setCurrentIndex(2);
|
2010-06-25 03:33:15 +00:00
|
|
|
fontModule->fontencLE->setEnabled(false);
|
|
|
|
} else {
|
2009-11-29 14:43:00 +00:00
|
|
|
fontModule->fontencCO->setCurrentIndex(1);
|
|
|
|
fontModule->fontencLE->setText(toqstr(bp_.fontenc));
|
|
|
|
}
|
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
// paper
|
2009-03-28 10:48:16 +00:00
|
|
|
bool const extern_geometry =
|
|
|
|
documentClass().provides("geometry");
|
2008-10-14 16:59:28 +00:00
|
|
|
int const psize = bp_.papersize;
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->papersizeCO->setCurrentIndex(psize);
|
2009-07-16 08:39:22 +00:00
|
|
|
setCustomPapersize(!extern_geometry && psize == 1);
|
2009-03-28 10:48:16 +00:00
|
|
|
pageLayoutModule->papersizeCO->setEnabled(!extern_geometry);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
bool const landscape =
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.orientation == ORIENTATION_LANDSCAPE;
|
2007-04-24 19:37:34 +00:00
|
|
|
pageLayoutModule->landscapeRB->setChecked(landscape);
|
|
|
|
pageLayoutModule->portraitRB->setChecked(!landscape);
|
2009-03-28 10:48:16 +00:00
|
|
|
pageLayoutModule->landscapeRB->setEnabled(!extern_geometry);
|
|
|
|
pageLayoutModule->portraitRB->setEnabled(!extern_geometry);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
pageLayoutModule->facingPagesCB->setChecked(
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.sides == TwoSides);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(pageLayoutModule->paperwidthLE,
|
2008-10-14 16:59:28 +00:00
|
|
|
pageLayoutModule->paperwidthUnitCO, bp_.paperwidth, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
lengthToWidgets(pageLayoutModule->paperheightLE,
|
2008-10-14 16:59:28 +00:00
|
|
|
pageLayoutModule->paperheightUnitCO, bp_.paperheight, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
// margins
|
|
|
|
Ui::MarginsUi * m = marginsModule;
|
|
|
|
|
2010-05-18 02:56:36 +00:00
|
|
|
setMargins();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->topLE, m->topUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.topmargin, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->bottomLE, m->bottomUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.bottommargin, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->innerLE, m->innerUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.leftmargin, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->outerLE, m->outerUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.rightmargin, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->headheightLE, m->headheightUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.headheight, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->headsepLE, m->headsepUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.headsep, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
lengthToWidgets(m->footskipLE, m->footskipUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.footskip, defaultUnit);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-02-19 05:24:48 +00:00
|
|
|
lengthToWidgets(m->columnsepLE, m->columnsepUnit,
|
2008-10-14 16:59:28 +00:00
|
|
|
bp_.columnsep, defaultUnit);
|
2008-02-19 05:24:48 +00:00
|
|
|
|
2009-07-09 09:48:34 +00:00
|
|
|
// branches
|
|
|
|
updateUnknownBranches();
|
2008-10-14 16:59:28 +00:00
|
|
|
branchesModule->update(bp_);
|
2007-09-20 22:31:18 +00:00
|
|
|
|
|
|
|
// PDF support
|
2008-10-14 16:59:28 +00:00
|
|
|
PDFOptions const & pdf = bp_.pdfoptions();
|
2007-09-22 22:20:15 +00:00
|
|
|
pdfSupportModule->use_hyperrefGB->setChecked(pdf.use_hyperref);
|
2007-09-21 01:00:31 +00:00
|
|
|
pdfSupportModule->titleLE->setText(toqstr(pdf.title));
|
|
|
|
pdfSupportModule->authorLE->setText(toqstr(pdf.author));
|
|
|
|
pdfSupportModule->subjectLE->setText(toqstr(pdf.subject));
|
|
|
|
pdfSupportModule->keywordsLE->setText(toqstr(pdf.keywords));
|
2007-09-20 22:31:18 +00:00
|
|
|
|
2007-09-21 01:00:31 +00:00
|
|
|
pdfSupportModule->bookmarksGB->setChecked(pdf.bookmarks);
|
|
|
|
pdfSupportModule->bookmarksnumberedCB->setChecked(pdf.bookmarksnumbered);
|
|
|
|
pdfSupportModule->bookmarksopenGB->setChecked(pdf.bookmarksopen);
|
2007-09-20 22:31:18 +00:00
|
|
|
|
2007-09-22 22:20:15 +00:00
|
|
|
pdfSupportModule->bookmarksopenlevelSB->setValue(pdf.bookmarksopenlevel);
|
2007-09-20 22:31:18 +00:00
|
|
|
|
2007-09-21 01:00:31 +00:00
|
|
|
pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
|
|
|
|
pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
|
2007-10-10 00:34:23 +00:00
|
|
|
pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
|
2007-09-21 01:00:31 +00:00
|
|
|
pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
|
2008-10-13 16:01:02 +00:00
|
|
|
|
2009-04-06 06:58:30 +00:00
|
|
|
nn = findToken(backref_opts, pdf.backref);
|
|
|
|
if (nn >= 0)
|
|
|
|
pdfSupportModule->backrefCO->setCurrentIndex(nn);
|
2008-10-13 16:01:02 +00:00
|
|
|
|
2007-09-20 22:31:18 +00:00
|
|
|
pdfSupportModule->fullscreenCB->setChecked
|
2007-09-21 01:00:31 +00:00
|
|
|
(pdf.pagemode == pdf.pagemode_fullscreen);
|
2007-09-20 22:31:18 +00:00
|
|
|
|
|
|
|
pdfSupportModule->optionsLE->setText(
|
2007-09-21 01:00:31 +00:00
|
|
|
toqstr(pdf.quoted_options));
|
2009-02-22 23:02:35 +00:00
|
|
|
|
|
|
|
// Make sure that the bc is in the INITIAL state
|
|
|
|
if (bc().policy().buttonStatus(ButtonPolicy::RESTORE))
|
|
|
|
bc().restore();
|
2009-07-11 10:31:32 +00:00
|
|
|
|
|
|
|
// clear changed branches cache
|
|
|
|
changedBranches_.clear();
|
2007-04-24 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::saveDocDefault()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
// we have to apply the params first
|
2007-09-03 20:28:26 +00:00
|
|
|
applyView();
|
2007-10-06 22:43:21 +00:00
|
|
|
saveAsDefault();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
void GuiDocument::updateAvailableModules()
|
|
|
|
{
|
2008-02-28 21:04:55 +00:00
|
|
|
modules_av_model_.clear();
|
2008-10-14 14:04:21 +00:00
|
|
|
list<modInfoStruct> const & modInfoList = getModuleInfo();
|
|
|
|
list<modInfoStruct>::const_iterator mit = modInfoList.begin();
|
|
|
|
list<modInfoStruct>::const_iterator men = modInfoList.end();
|
|
|
|
for (int i = 0; mit != men; ++mit, ++i)
|
|
|
|
modules_av_model_.insertRow(i, mit->name, mit->id,
|
|
|
|
mit->description);
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::updateSelectedModules()
|
This is the last of a series of patches that merges the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the GUI for managing modules.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20282 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-15 01:55:09 +00:00
|
|
|
{
|
2008-02-28 21:04:55 +00:00
|
|
|
modules_sel_model_.clear();
|
2008-10-14 14:04:21 +00:00
|
|
|
list<modInfoStruct> const selModList = getSelectedModules();
|
|
|
|
list<modInfoStruct>::const_iterator mit = selModList.begin();
|
|
|
|
list<modInfoStruct>::const_iterator men = selModList.end();
|
|
|
|
for (int i = 0; mit != men; ++mit, ++i)
|
|
|
|
modules_sel_model_.insertRow(i, mit->name, mit->id,
|
|
|
|
mit->description);
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-07 10:01:26 +00:00
|
|
|
void GuiDocument::updateIncludeonlys()
|
|
|
|
{
|
|
|
|
masterChildModule->childrenTW->clear();
|
|
|
|
QString const no = qt_("No");
|
|
|
|
QString const yes = qt_("Yes");
|
|
|
|
|
|
|
|
if (includeonlys_.empty()) {
|
|
|
|
masterChildModule->includeallRB->setChecked(true);
|
|
|
|
masterChildModule->childrenTW->setEnabled(false);
|
2010-01-10 13:25:41 +00:00
|
|
|
masterChildModule->maintainAuxCB->setEnabled(false);
|
2010-01-07 10:01:26 +00:00
|
|
|
} else {
|
|
|
|
masterChildModule->includeonlyRB->setChecked(true);
|
|
|
|
masterChildModule->childrenTW->setEnabled(true);
|
2010-01-10 13:25:41 +00:00
|
|
|
masterChildModule->maintainAuxCB->setEnabled(true);
|
2010-01-07 10:01:26 +00:00
|
|
|
}
|
|
|
|
QTreeWidgetItem * item = 0;
|
2010-09-29 13:05:57 +00:00
|
|
|
ListOfBuffers children = buffer().getChildren();
|
2010-09-29 11:55:10 +00:00
|
|
|
ListOfBuffers::const_iterator it = children.begin();
|
|
|
|
ListOfBuffers::const_iterator end = children.end();
|
2010-01-07 10:01:26 +00:00
|
|
|
bool has_unincluded = false;
|
|
|
|
bool all_unincluded = true;
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
item = new QTreeWidgetItem(masterChildModule->childrenTW);
|
|
|
|
// FIXME Unicode
|
|
|
|
string const name =
|
2010-04-21 01:19:09 +00:00
|
|
|
to_utf8(makeRelPath(from_utf8((*it)->fileName().absFileName()),
|
2010-01-07 10:01:26 +00:00
|
|
|
from_utf8(buffer().filePath())));
|
|
|
|
item->setText(0, toqstr(name));
|
|
|
|
item->setText(1, isChildIncluded(name) ? yes : no);
|
|
|
|
if (!isChildIncluded(name))
|
|
|
|
has_unincluded = true;
|
|
|
|
else
|
|
|
|
all_unincluded = false;
|
|
|
|
}
|
|
|
|
// Both if all childs are included and if none is included
|
|
|
|
// is equal to "include all" (i.e., ommit \includeonly).
|
|
|
|
// Thus, reset the GUI.
|
|
|
|
if (!has_unincluded || all_unincluded) {
|
|
|
|
masterChildModule->includeallRB->setChecked(true);
|
|
|
|
masterChildModule->childrenTW->setEnabled(false);
|
|
|
|
includeonlys_.clear();
|
|
|
|
}
|
|
|
|
// If all are included, we need to update again.
|
|
|
|
if (!has_unincluded)
|
|
|
|
updateIncludeonlys();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
void GuiDocument::updateContents()
|
|
|
|
{
|
2008-05-15 08:41:17 +00:00
|
|
|
// Nothing to do here as the document settings is not cursor dependant.
|
|
|
|
return;
|
2008-01-15 10:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
void GuiDocument::useClassDefaults()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2008-01-15 10:38:19 +00:00
|
|
|
if (applyPB->isEnabled()) {
|
|
|
|
int const ret = Alert::prompt(_("Unapplied changes"),
|
2008-03-09 16:29:01 +00:00
|
|
|
_("Some changes in the dialog were not yet applied.\n"
|
2008-01-15 10:38:19 +00:00
|
|
|
"If you do not apply now, they will be lost after this action."),
|
|
|
|
1, 1, _("&Apply"), _("&Dismiss"));
|
|
|
|
if (ret == 0)
|
|
|
|
applyView();
|
|
|
|
}
|
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
int idx = latexModule->classCO->currentIndex();
|
|
|
|
string const classname = classes_model_.getIDString(idx);
|
|
|
|
if (!bp_.setBaseClass(classname)) {
|
|
|
|
Alert::error(_("Error"), _("Unable to set document class."));
|
|
|
|
return;
|
|
|
|
}
|
2007-10-06 22:43:21 +00:00
|
|
|
bp_.useClassDefaults();
|
2008-10-14 16:59:28 +00:00
|
|
|
paramsToDialog();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2007-07-27 18:17:00 +00:00
|
|
|
|
2008-10-14 14:04:21 +00:00
|
|
|
void GuiDocument::setLayoutComboByIDString(string const & idString)
|
2008-03-01 22:08:16 +00:00
|
|
|
{
|
|
|
|
int idx = classes_model_.findIDString(idString);
|
|
|
|
if (idx < 0)
|
|
|
|
Alert::warning(_("Can't set layout!"),
|
|
|
|
bformat(_("Unable to set layout for ID: %1$s"), from_utf8(idString)));
|
|
|
|
else
|
|
|
|
latexModule->classCO->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
bool GuiDocument::isValid()
|
2007-07-27 18:17:00 +00:00
|
|
|
{
|
A UI for document-local layout information. LyX has supported this for a
while, but without any UI for it. (There has been local layout in the
Customization manual for a long time, in fact.)
Yes, this is an advanced feature. But, absent a layout editor, it is the
one thing that will make it easier, and possible, for "normal users" to
experiment with layout without having to go through reconfiguration,
etc, etc. To keep too many people from shooting themselves, we validate
the layout information before allowing the user to apply it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35061 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 22:47:42 +00:00
|
|
|
return
|
|
|
|
validateListingsParameters().isEmpty() &&
|
|
|
|
localLayout->isValid() &&
|
|
|
|
(
|
|
|
|
// if we're asking for skips between paragraphs
|
|
|
|
!textLayoutModule->skipRB->isChecked() ||
|
|
|
|
// then either we haven't chosen custom
|
|
|
|
textLayoutModule->skipCO->currentIndex() != 3 ||
|
|
|
|
// or else a length has been given
|
|
|
|
!textLayoutModule->skipLE->text().isEmpty()
|
|
|
|
) &&
|
|
|
|
(
|
|
|
|
// if we're asking for indentation
|
|
|
|
!textLayoutModule->indentRB->isChecked() ||
|
|
|
|
// then either we haven't chosen custom
|
|
|
|
textLayoutModule->indentCO->currentIndex() != 1 ||
|
|
|
|
// or else a length has been given
|
|
|
|
!textLayoutModule->indentLE->text().isEmpty()
|
|
|
|
);
|
2007-07-27 18:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
char const * const GuiDocument::fontfamilies[5] = {
|
|
|
|
"default", "rmdefault", "sfdefault", "ttdefault", ""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
char const * GuiDocument::fontfamilies_gui[5] = {
|
|
|
|
N_("Default"), N_("Roman"), N_("Sans Serif"), N_("Typewriter"), ""
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiDocument::initialiseParams(string const &)
|
|
|
|
{
|
2008-09-29 10:52:17 +00:00
|
|
|
BufferView const * view = bufferview();
|
2008-05-15 08:41:17 +00:00
|
|
|
if (!view) {
|
|
|
|
bp_ = BufferParams();
|
2008-10-14 16:59:28 +00:00
|
|
|
paramsToDialog();
|
2008-05-15 08:41:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bp_ = view->buffer().params();
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
loadModuleInfo();
|
2008-05-15 08:41:17 +00:00
|
|
|
updateAvailableModules();
|
|
|
|
//FIXME It'd be nice to make sure here that the selected
|
|
|
|
//modules are consistent: That required modules are actually
|
|
|
|
//selected, and that we don't have conflicts. If so, we could
|
|
|
|
//at least pop up a warning.
|
2008-10-14 16:59:28 +00:00
|
|
|
paramsToDialog();
|
2007-10-06 22:43:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::clearParams()
|
|
|
|
{
|
|
|
|
bp_ = BufferParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BufferId GuiDocument::id() const
|
|
|
|
{
|
2008-05-15 08:41:17 +00:00
|
|
|
BufferView const * const view = bufferview();
|
|
|
|
return view? &view->buffer() : 0;
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-14 14:04:21 +00:00
|
|
|
list<GuiDocument::modInfoStruct> const & GuiDocument::getModuleInfo()
|
2007-10-06 22:43:21 +00:00
|
|
|
{
|
|
|
|
return moduleNames_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-23 00:27:03 +00:00
|
|
|
list<GuiDocument::modInfoStruct> const
|
2009-02-12 15:07:22 +00:00
|
|
|
GuiDocument::makeModuleInfo(LayoutModuleList const & mods)
|
2007-10-06 22:43:21 +00:00
|
|
|
{
|
2009-02-12 15:07:22 +00:00
|
|
|
LayoutModuleList::const_iterator it = mods.begin();
|
|
|
|
LayoutModuleList::const_iterator end = mods.end();
|
2008-10-14 14:04:21 +00:00
|
|
|
list<modInfoStruct> mInfo;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
for (; it != end; ++it) {
|
|
|
|
modInfoStruct m;
|
|
|
|
m.id = *it;
|
2009-08-14 15:46:10 +00:00
|
|
|
LyXModule const * const mod = theModuleList[*it];
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
if (mod)
|
2008-11-04 15:44:02 +00:00
|
|
|
// FIXME Unicode
|
2008-11-04 15:38:37 +00:00
|
|
|
m.name = toqstr(translateIfPossible(from_utf8(mod->getName())));
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
else
|
2008-04-17 03:27:20 +00:00
|
|
|
m.name = toqstr(*it) + toqstr(" (") + qt_("Not Found") + toqstr(")");
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
mInfo.push_back(m);
|
|
|
|
}
|
|
|
|
return mInfo;
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-23 00:27:03 +00:00
|
|
|
list<GuiDocument::modInfoStruct> const GuiDocument::getSelectedModules()
|
|
|
|
{
|
|
|
|
return makeModuleInfo(params().getModules());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
list<GuiDocument::modInfoStruct> const GuiDocument::getProvidedModules()
|
|
|
|
{
|
|
|
|
return makeModuleInfo(params().baseClass()->providedModules());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 21:04:55 +00:00
|
|
|
DocumentClass const & GuiDocument::documentClass() const
|
2007-10-06 22:43:21 +00:00
|
|
|
{
|
2008-02-28 21:04:55 +00:00
|
|
|
return bp_.documentClass();
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
static void dispatch_bufferparams(Dialog const & dialog,
|
2008-03-15 01:20:36 +00:00
|
|
|
BufferParams const & bp, FuncCode lfun)
|
2007-10-06 22:43:21 +00:00
|
|
|
{
|
|
|
|
ostringstream ss;
|
|
|
|
ss << "\\begin_header\n";
|
|
|
|
bp.writeFile(ss);
|
|
|
|
ss << "\\end_header\n";
|
2007-10-09 21:21:01 +00:00
|
|
|
dialog.dispatch(FuncRequest(lfun, ss.str()));
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::dispatchParams()
|
|
|
|
{
|
|
|
|
// This must come first so that a language change is correctly noticed
|
|
|
|
setLanguage();
|
|
|
|
|
|
|
|
// Apply the BufferParams. Note that this will set the base class
|
|
|
|
// and then update the buffer's layout.
|
|
|
|
dispatch_bufferparams(*this, params(), LFUN_BUFFER_PARAMS_APPLY);
|
|
|
|
|
2008-04-28 16:38:56 +00:00
|
|
|
if (!params().master.empty()) {
|
|
|
|
FileName const master_file = support::makeAbsPath(params().master,
|
|
|
|
support::onlyPath(buffer().absFileName()));
|
2010-04-21 01:19:31 +00:00
|
|
|
if (isLyXFileName(master_file.absFileName())) {
|
2008-04-28 16:38:56 +00:00
|
|
|
Buffer * master = checkAndLoadLyXFile(master_file);
|
2009-01-08 07:59:37 +00:00
|
|
|
if (master) {
|
|
|
|
if (master->isChild(const_cast<Buffer *>(&buffer())))
|
|
|
|
const_cast<Buffer &>(buffer()).setParent(master);
|
|
|
|
else
|
|
|
|
Alert::warning(_("Assigned master does not include this file"),
|
|
|
|
bformat(_("You must include this file in the document\n"
|
|
|
|
"'%1$s' in order to use the master document\n"
|
|
|
|
"feature."), from_utf8(params().master)));
|
|
|
|
} else
|
|
|
|
Alert::warning(_("Could not load master"),
|
2009-01-08 08:00:37 +00:00
|
|
|
bformat(_("The master document '%1$s'\n"
|
2009-01-08 07:59:37 +00:00
|
|
|
"could not be loaded."),
|
|
|
|
from_utf8(params().master)));
|
2008-04-28 16:38:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-06 22:43:21 +00:00
|
|
|
// Generate the colours requested by each new branch.
|
|
|
|
BranchList & branchlist = params().branchlist();
|
|
|
|
if (!branchlist.empty()) {
|
|
|
|
BranchList::const_iterator it = branchlist.begin();
|
|
|
|
BranchList::const_iterator const end = branchlist.end();
|
|
|
|
for (; it != end; ++it) {
|
2008-09-21 19:27:20 +00:00
|
|
|
docstring const & current_branch = it->branch();
|
2007-10-06 22:43:21 +00:00
|
|
|
Branch const * branch = branchlist.find(current_branch);
|
2008-09-21 19:27:20 +00:00
|
|
|
string const x11hexname = X11hexname(branch->color());
|
2007-10-06 22:43:21 +00:00
|
|
|
// display the new color
|
|
|
|
docstring const str = current_branch + ' ' + from_ascii(x11hexname);
|
|
|
|
dispatch(FuncRequest(LFUN_SET_COLOR, str));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open insets of selected branches, close deselected ones
|
2010-04-08 12:39:41 +00:00
|
|
|
dispatch(FuncRequest(LFUN_INSET_FORALL,
|
|
|
|
"Branch inset-toggle assign"));
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
2009-07-11 10:53:29 +00:00
|
|
|
// rename branches in the document
|
|
|
|
executeBranchRenaming();
|
|
|
|
// and clear changed branches cache
|
|
|
|
changedBranches_.clear();
|
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
// Generate the colours requested by indices.
|
|
|
|
IndicesList & indiceslist = params().indiceslist();
|
|
|
|
if (!indiceslist.empty()) {
|
|
|
|
IndicesList::const_iterator it = indiceslist.begin();
|
|
|
|
IndicesList::const_iterator const end = indiceslist.end();
|
|
|
|
for (; it != end; ++it) {
|
2009-07-13 06:46:52 +00:00
|
|
|
docstring const & current_index = it->shortcut();
|
|
|
|
Index const * index = indiceslist.findShortcut(current_index);
|
2009-04-16 07:29:01 +00:00
|
|
|
string const x11hexname = X11hexname(index->color());
|
|
|
|
// display the new color
|
|
|
|
docstring const str = current_index + ' ' + from_ascii(x11hexname);
|
|
|
|
dispatch(FuncRequest(LFUN_SET_COLOR, str));
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 15:04:57 +00:00
|
|
|
// FIXME LFUN
|
|
|
|
// If we used an LFUN, we would not need these two lines:
|
2008-09-29 10:52:17 +00:00
|
|
|
BufferView * bv = const_cast<BufferView *>(bufferview());
|
|
|
|
bv->processUpdateFlags(Update::Force | Update::FitCursor);
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::setLanguage() const
|
|
|
|
{
|
|
|
|
Language const * const newL = bp_.language;
|
|
|
|
if (buffer().params().language == newL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const & lang_name = newL->lang();
|
|
|
|
dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::saveAsDefault() const
|
|
|
|
{
|
|
|
|
dispatch_bufferparams(*this, params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiDocument::isFontAvailable(string const & font) const
|
|
|
|
{
|
|
|
|
if (font == "default" || font == "cmr"
|
|
|
|
|| font == "cmss" || font == "cmtt")
|
|
|
|
// these are standard
|
|
|
|
return true;
|
|
|
|
if (font == "lmodern" || font == "lmss" || font == "lmtt")
|
|
|
|
return LaTeXFeatures::isAvailable("lmodern");
|
|
|
|
if (font == "times" || font == "palatino"
|
|
|
|
|| font == "helvet" || font == "courier")
|
|
|
|
return LaTeXFeatures::isAvailable("psnfss");
|
|
|
|
if (font == "cmbr" || font == "cmtl")
|
|
|
|
return LaTeXFeatures::isAvailable("cmbright");
|
|
|
|
if (font == "utopia")
|
|
|
|
return LaTeXFeatures::isAvailable("utopia")
|
|
|
|
|| LaTeXFeatures::isAvailable("fourier");
|
|
|
|
if (font == "beraserif" || font == "berasans"
|
|
|
|
|| font == "beramono")
|
|
|
|
return LaTeXFeatures::isAvailable("bera");
|
|
|
|
return LaTeXFeatures::isAvailable(font);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiDocument::providesOSF(string const & font) const
|
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-10 14:39:22 +00:00
|
|
|
// FIXME: we should check if the fonts really
|
|
|
|
// have OSF support. But how?
|
|
|
|
return true;
|
2007-10-06 22:43:21 +00:00
|
|
|
if (font == "cmr")
|
|
|
|
return isFontAvailable("eco");
|
|
|
|
if (font == "palatino")
|
|
|
|
return isFontAvailable("mathpazo");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiDocument::providesSC(string const & font) const
|
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-10 14:39:22 +00:00
|
|
|
return false;
|
2007-10-06 22:43:21 +00:00
|
|
|
if (font == "palatino")
|
|
|
|
return isFontAvailable("mathpazo");
|
|
|
|
if (font == "utopia")
|
|
|
|
return isFontAvailable("fourier");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiDocument::providesScale(string const & font) const
|
|
|
|
{
|
2010-11-26 09:42:03 +00:00
|
|
|
if (fontModule->osFontsCB->isChecked())
|
2009-04-10 14:39:22 +00:00
|
|
|
return true;
|
2007-10-06 22:43:21 +00:00
|
|
|
return font == "helvet" || font == "luximono"
|
|
|
|
|| font == "berasans" || font == "beramono";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
void GuiDocument::loadModuleInfo()
|
2007-10-06 22:43:21 +00:00
|
|
|
{
|
|
|
|
moduleNames_.clear();
|
2009-08-14 15:37:34 +00:00
|
|
|
LyXModuleList::const_iterator it = theModuleList.begin();
|
|
|
|
LyXModuleList::const_iterator end = theModuleList.end();
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
for (; it != end; ++it) {
|
|
|
|
modInfoStruct m;
|
|
|
|
m.id = it->getID();
|
2008-11-04 15:44:02 +00:00
|
|
|
// FIXME Unicode
|
2008-11-04 15:38:37 +00:00
|
|
|
m.name = toqstr(translateIfPossible(from_utf8(it->getName())));
|
2008-04-17 03:27:20 +00:00
|
|
|
// this is supposed to give us the first sentence of the description
|
2008-11-04 15:44:02 +00:00
|
|
|
// FIXME Unicode
|
|
|
|
QString desc =
|
|
|
|
toqstr(translateIfPossible(from_utf8(it->getDescription())));
|
2008-04-17 03:27:20 +00:00
|
|
|
int const pos = desc.indexOf(".");
|
|
|
|
if (pos > 0)
|
|
|
|
desc.truncate(pos + 1);
|
|
|
|
m.description = desc;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
moduleNames_.push_back(m);
|
|
|
|
}
|
2007-10-06 22:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-09 09:48:34 +00:00
|
|
|
void GuiDocument::updateUnknownBranches()
|
|
|
|
{
|
2010-02-01 14:44:12 +00:00
|
|
|
if (!bufferview())
|
|
|
|
return;
|
2009-07-09 09:48:34 +00:00
|
|
|
list<docstring> used_branches;
|
|
|
|
buffer().getUsedBranches(used_branches);
|
|
|
|
list<docstring>::const_iterator it = used_branches.begin();
|
|
|
|
QStringList unknown_branches;
|
2009-07-09 11:16:27 +00:00
|
|
|
for (; it != used_branches.end() ; ++it) {
|
2009-07-09 09:48:34 +00:00
|
|
|
if (!buffer().params().branchlist().find(*it))
|
|
|
|
unknown_branches.append(toqstr(*it));
|
|
|
|
}
|
|
|
|
branchesModule->setUnknownBranches(unknown_branches);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-10 06:49:51 +00:00
|
|
|
void GuiDocument::branchesRename(docstring const & oldname, docstring const & newname)
|
|
|
|
{
|
2009-07-11 09:37:28 +00:00
|
|
|
map<docstring, docstring>::iterator it = changedBranches_.begin();
|
|
|
|
for (; it != changedBranches_.end() ; ++it) {
|
|
|
|
if (it->second == oldname) {
|
|
|
|
// branch has already been renamed
|
|
|
|
it->second = newname;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// store new name
|
|
|
|
changedBranches_[oldname] = newname;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiDocument::executeBranchRenaming() const
|
|
|
|
{
|
|
|
|
map<docstring, docstring>::const_iterator it = changedBranches_.begin();
|
|
|
|
for (; it != changedBranches_.end() ; ++it) {
|
|
|
|
docstring const arg = '"' + it->first + '"' + " " + '"' + it->second + '"';
|
|
|
|
dispatch(FuncRequest(LFUN_BRANCHES_RENAME, arg));
|
|
|
|
}
|
2009-07-10 06:49:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
|
2007-10-06 22:43:21 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiDocument.cpp"
|