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-08-31 05:53:55 +00:00
|
|
|
* \file GuiListings.cpp
|
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
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Bo Peng
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Spitzmüller
|
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
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiListings.h"
|
2007-09-05 20:33:29 +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 "qt_helpers.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
2017-06-07 00:55:23 +02:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferParams.h"
|
2007-10-05 21:53:54 +00:00
|
|
|
#include "FuncRequest.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
#include "insets/InsetListings.h"
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
#include "insets/InsetListingsParams.h"
|
|
|
|
|
2008-09-30 18:00:02 +00:00
|
|
|
#include "support/convert.h"
|
2012-06-28 20:52:20 +02:00
|
|
|
#include "support/debug.h"
|
2008-02-05 12:43:19 +00:00
|
|
|
#include "support/gettext.h"
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
2007-05-13 04:06:37 +00:00
|
|
|
#include <QValidator>
|
Allow compiling with Qt6
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
2021-03-15 17:09:09 +01:00
|
|
|
#if QT_VERSION < 0x060000
|
2007-05-13 04:06:37 +00:00
|
|
|
#include <QRegExpValidator>
|
Allow compiling with Qt6
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
2021-03-15 17:09:09 +01:00
|
|
|
#else
|
|
|
|
#include <QRegularExpressionValidator>
|
|
|
|
#endif
|
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-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
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-12-12 10:16:00 +00:00
|
|
|
namespace lyx {
|
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
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-05 21:53:54 +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
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-10-05 21:53:54 +00:00
|
|
|
// GuiListings
|
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
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2010-01-30 11:34:28 +00:00
|
|
|
char const * languages_supported[] =
|
2019-04-15 11:55:46 +02:00
|
|
|
{ "no language", "ABAP", "ACM", "ACMscript", "ACSL", "Ada", "ALGOL", "Ant", "Assembler", "Awk", "bash", "Basic", "C",
|
|
|
|
"C++", "Caml", "CIL", "Clean", "Cobol", "Comal 80", "command.com", "Comsol", "csh", "Delphi",
|
|
|
|
"Eiffel", "Elan", "elisp", "erlang", "Euphoria", "Fortran", "GAP", "GCL", "Gnuplot", "Go",
|
|
|
|
"hansl", "Haskell", "HTML", "IDL", "inform",
|
|
|
|
"Java", "JVMIS", "ksh", "Lingo", "Lisp", "LLVM", "Logo", "Lua", "make", "Mathematica", "Matlab", "Mercury",
|
|
|
|
"MetaPost", "Miranda", "Mizar", "ML", "Modula-2", "MuPAD", "NASTRAN", "Oberon-2", "OCL", "Octave", "OORexx",
|
2007-05-23 02:05:01 +00:00
|
|
|
"Oz", "Pascal", "Perl", "PHP", "PL/I", "Plasm", "PostScript", "POV", "Prolog", "Promela",
|
2019-04-15 11:55:46 +02:00
|
|
|
"PSTricks", "Python", "R", "Reduce", "Rexx", "RSL", "Ruby", "S", "SAS", "Scala", "Scilab", "sh",
|
|
|
|
"SHELXL", "Simula", "SPARQL", "SQL", "Swift", "tcl", "TeX", "VBScript", "Verilog", "VHDL",
|
2007-05-23 02:05:01 +00:00
|
|
|
"VRML", "XML", "XSLT", "" };
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
char const * languages_gui[] =
|
2019-04-15 11:55:46 +02:00
|
|
|
{ N_("No language"), "ABAP", "ACM", "ACMscript", "ACSL", "Ada", "ALGOL", "Ant", "Assembler", "Awk", "bash", "Basic", "C",
|
|
|
|
"C++", "Caml", "CIL", "Clean", "Cobol", "Comal 80", "command.com", "Comsol", "csh", "Delphi",
|
|
|
|
"Eiffel", "Elan", "elisp", "erlang", "Euphoria", "Fortran", "GAP", "GCL", "Gnuplot", "Go",
|
|
|
|
"hansl", "Haskell", "HTML", "IDL", "inform",
|
|
|
|
"Java", "JVMIS", "ksh", "Lingo", "Lisp", "LLVM", "Logo", "Lua", "make", "Mathematica", "Matlab", "Mercury",
|
|
|
|
"MetaPost", "Miranda", "Mizar", "ML", "Modula-2", "MuPAD", "NASTRAN", "Oberon-2", "OCL", "Octave", "OORexx",
|
2007-05-23 02:05:01 +00:00
|
|
|
"Oz", "Pascal", "Perl", "PHP", "PL/I", "Plasm", "PostScript", "POV", "Prolog", "Promela",
|
2019-04-15 11:55:46 +02:00
|
|
|
"PSTricks", "Python", "R", "Reduce", "Rexx", "RSL", "Ruby", "S", "SAS", "Scala", "Scilab", "sh",
|
|
|
|
"SHELXL", "Simula", "SPARQL", "SQL", "Swift", "tcl", "TeX", "VBScript", "Verilog", "VHDL",
|
2007-05-23 02:05:01 +00:00
|
|
|
"VRML", "XML", "XSLT", "" };
|
|
|
|
|
|
|
|
|
|
|
|
struct dialect_info {
|
|
|
|
/// the dialect
|
|
|
|
char const * dialect;
|
|
|
|
/// the associated language
|
|
|
|
char const * language;
|
|
|
|
/// representation of the dialect in the gui
|
|
|
|
char const * gui;
|
|
|
|
/// is this the default dialect?
|
|
|
|
bool is_default;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
dialect_info const dialects[] = {
|
|
|
|
{ "R/2 4.3", "ABAP", "R/2 4.3", false },
|
|
|
|
{ "R/2 5.0", "ABAP", "R/2 5.0", false },
|
|
|
|
{ "R/3 3.1", "ABAP", "R/3 3.1", false },
|
|
|
|
{ "R/3 4.6C", "ABAP", "R/3 4.6C", false },
|
|
|
|
{ "R/3 6.10", "ABAP", "R/3 6.10", true },
|
|
|
|
{ "2005", "Ada", "2005", true },
|
|
|
|
{ "83", "Ada", "83", false },
|
|
|
|
{ "95", "Ada", "95", false },
|
|
|
|
{ "60", "Algol", "60", false },
|
|
|
|
{ "68", "Algol", "68", true },
|
|
|
|
{ "Motorola68k", "Assembler", "Motorola 68xxx", false },
|
|
|
|
{ "x86masm", "Assembler", "x86 (MASM)", false },
|
|
|
|
{ "gnu", "Awk", "gnu", true },
|
|
|
|
{ "POSIX", "Awk", "POSIX", false },
|
|
|
|
{ "Visual", "Basic", "Visual", false },
|
|
|
|
{ "ANSI", "C", "ANSI", true },
|
|
|
|
{ "Handel", "C", "Handel", false },
|
|
|
|
{ "Objective", "C", "Objective", false },
|
|
|
|
{ "Sharp", "C", "Sharp", false },
|
|
|
|
{ "ANSI", "C++", "ANSI", false },
|
|
|
|
{ "GNU", "C++", "GNU", false },
|
|
|
|
{ "ISO", "C++", "ISO", true },
|
|
|
|
{ "Visual", "C++", "Visual", false },
|
|
|
|
{ "light", "Caml", "light", true },
|
|
|
|
{ "Objective", "Caml", "Objective", false },
|
|
|
|
{ "1974", "Cobol", "1974", false },
|
|
|
|
{ "1985", "Cobol", "1985", true },
|
|
|
|
{ "ibm", "Cobol", "IBM", false },
|
|
|
|
{ "WinXP", "command.com", "Windows XP", true },
|
|
|
|
{ "77", "Fortran", "77", false },
|
|
|
|
{ "90", "Fortran", "90", false },
|
|
|
|
{ "95", "Fortran", "95", true },
|
|
|
|
{ "CORBA", "IDL", "CORBA", false },
|
|
|
|
{ "AspectJ", "Java", "Aspect J", false },
|
|
|
|
{ "Auto", "Lisp", "Auto", false },
|
|
|
|
{ "gnu", "make", "gnu", false },
|
|
|
|
{ "1.0", "Mathematica", "1.0", false },
|
|
|
|
{ "3.0", "Mathematica", "3.0", false },
|
|
|
|
{ "5.2", "Mathematica", "5.2", true },
|
|
|
|
{ "decorative", "OCL", "decorative", false },
|
|
|
|
{ "OMG", "OCL", "OMG", true },
|
|
|
|
{ "Borland6", "Pascal", "Borland 6", false },
|
|
|
|
{ "Standard", "Pascal", "Standard", true },
|
|
|
|
{ "XSC", "Pascal", "XSC", false },
|
|
|
|
{ "PLUS", "S", "PLUS", false },
|
|
|
|
{ "67", "Simula", "67", true },
|
|
|
|
{ "CII", "Simula", "CII", false },
|
|
|
|
{ "DEC", "Simula", "DEC", false },
|
|
|
|
{ "IBM", "Simula", "IBM", false },
|
|
|
|
{ "tk", "tcl", "tk", false },
|
|
|
|
{ "AlLaTeX", "TeX", "AlLaTeX", false },
|
2007-06-01 12:27:04 +00:00
|
|
|
{ "common", "TeX", "common", false },
|
2007-05-23 02:05:01 +00:00
|
|
|
{ "LaTeX", "TeX", "LaTeX", false },
|
2007-06-01 12:27:04 +00:00
|
|
|
{ "plain", "TeX", "plain", true },
|
|
|
|
{ "primitive", "TeX", "primitive", false },
|
2007-05-23 02:05:01 +00:00
|
|
|
{ "AMS", "VHDL", "AMS", false },
|
|
|
|
{ "97", "VRML", "97", true }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
size_t const nr_dialects = sizeof(dialects) / sizeof(dialect_info);
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
char const * font_sizes[] =
|
|
|
|
{ "default", "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
|
|
|
|
"Large", "" };
|
|
|
|
|
|
|
|
char const * font_sizes_gui[] =
|
|
|
|
{ N_("Default"), N_("Tiny"), N_("Smallest"), N_("Smaller"), N_("Small"), N_("Normal"),
|
|
|
|
N_("Large"), N_("Larger"), "" };
|
|
|
|
|
|
|
|
char const * font_styles[] =
|
|
|
|
{ "default", "rmfamily", "ttfamily", "sffamily", "" };
|
|
|
|
|
|
|
|
char const * font_styles_gui[] =
|
|
|
|
{ N_("Default"), N_("Roman"), N_("Typewriter"), N_("Sans Serif"), "" };
|
|
|
|
|
|
|
|
|
2007-05-13 04:06:37 +00:00
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiListings::GuiListings(GuiView & lv)
|
2008-02-05 12:43:19 +00:00
|
|
|
: GuiDialog(lv, "listings", qt_("Program Listing Settings"))
|
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
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2018-07-10 09:04:42 +02:00
|
|
|
connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
|
|
|
|
this, SLOT(slotButtonBox(QAbstractButton *)));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
connect(languageCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(dialectCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(inlineCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(floatCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-05 21:53:54 +00:00
|
|
|
connect(placementLE, SIGNAL(textChanged(QString)),
|
2007-09-05 20:33:29 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(numberSideCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-05 21:53:54 +00:00
|
|
|
connect(numberStepLE, SIGNAL(textChanged(QString)),
|
2007-09-05 20:33:29 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(numberFontSizeCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-05 21:53:54 +00:00
|
|
|
connect(firstlineLE, SIGNAL(textChanged(QString)),
|
2007-09-05 20:33:29 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-05 21:53:54 +00:00
|
|
|
connect(lastlineLE, SIGNAL(textChanged(QString)),
|
2007-09-05 20:33:29 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontsizeCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(fontstyleCO, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(breaklinesCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(spaceCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(spaceInStringCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
2008-09-30 18:00:02 +00:00
|
|
|
connect(tabsizeSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(extendedcharsCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
connect(listingsED, SIGNAL(textChanged()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(listingsED, SIGNAL(textChanged()),
|
2009-05-23 09:06:50 +00:00
|
|
|
this, SLOT(setListingsMsg()));
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(bypassCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(bypassCB, SIGNAL(clicked()),
|
2009-05-23 09:06:50 +00:00
|
|
|
this, SLOT(setListingsMsg()));
|
2007-05-20 14:31:15 +00:00
|
|
|
|
2010-01-30 11:34:28 +00:00
|
|
|
for (int n = 0; languages_supported[n][0]; ++n)
|
2007-06-01 12:27:04 +00:00
|
|
|
languageCO->addItem(qt_(languages_gui[n]));
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
for (int n = 0; font_styles[n][0]; ++n)
|
2007-06-01 12:27:04 +00:00
|
|
|
fontstyleCO->addItem(qt_(font_styles_gui[n]));
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
for (int n = 0; font_sizes[n][0]; ++n) {
|
2007-06-01 12:27:04 +00:00
|
|
|
QString font = qt_(font_sizes_gui[n]);
|
2007-05-20 14:31:15 +00:00
|
|
|
fontsizeCO->addItem(font);
|
|
|
|
numberFontSizeCO->addItem(font);
|
|
|
|
}
|
|
|
|
|
|
|
|
// set validators
|
|
|
|
numberStepLE->setValidator(new QIntValidator(0, 1000000, this));
|
|
|
|
firstlineLE->setValidator(new QIntValidator(0, 1000000, this));
|
|
|
|
lastlineLE->setValidator(new QIntValidator(0, 1000000, this));
|
Allow compiling with Qt6
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
2021-03-15 17:09:09 +01:00
|
|
|
#if QT_VERSION < 0x060000
|
2007-05-25 15:05:46 +00:00
|
|
|
placementLE->setValidator(new QRegExpValidator(QRegExp("[\\*tbph]*"), this));
|
Allow compiling with Qt6
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
2021-03-15 17:09:09 +01:00
|
|
|
#else
|
|
|
|
placementLE->setValidator(new QRegularExpressionValidator(QRegularExpression("[\\*tbph]*"), this));
|
|
|
|
#endif
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2008-09-08 21:51:38 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
2018-07-10 09:04:42 +02:00
|
|
|
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
|
|
|
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
|
|
|
|
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
|
2007-09-05 20:33:29 +00:00
|
|
|
listingsTB->setPlainText(
|
|
|
|
qt_("Input listing parameters on the right. Enter ? for a list of parameters."));
|
|
|
|
|
2007-09-11 18:33:42 +00:00
|
|
|
updateContents();
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::change_adaptor()
|
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-09-05 20:33:29 +00:00
|
|
|
changed();
|
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-05 21:53:54 +00:00
|
|
|
string GuiListings::construct_params()
|
2007-05-13 04:06:37 +00:00
|
|
|
{
|
2010-01-30 11:34:28 +00:00
|
|
|
string language = languages_supported[qMax(0, languageCO->currentIndex())];
|
2007-05-23 02:05:01 +00:00
|
|
|
string dialect;
|
|
|
|
string const dialect_gui = fromqstr(dialectCO->currentText());
|
|
|
|
if (dialectCO->currentIndex() > 0) {
|
2007-10-05 21:53:54 +00:00
|
|
|
for (size_t i = 0; i != nr_dialects; ++i) {
|
2007-05-23 02:05:01 +00:00
|
|
|
if (dialect_gui == dialects[i].gui
|
|
|
|
&& dialects[i].language == language
|
|
|
|
&& !dialects[i].is_default) {
|
|
|
|
dialect = dialects[i].dialect;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
bool float_ = floatCB->isChecked();
|
|
|
|
string placement;
|
|
|
|
if (placementLE->isEnabled())
|
|
|
|
placement = fromqstr(placementLE->text());
|
|
|
|
|
|
|
|
string numberSide;
|
2008-03-26 19:50:20 +00:00
|
|
|
switch (qMax(0, numberSideCO->currentIndex())) {
|
2007-05-20 14:31:15 +00:00
|
|
|
case 0:
|
|
|
|
numberSide = "none";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
numberSide = "left";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
numberSide = "right";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
numberSide = "none";
|
|
|
|
break;
|
|
|
|
}
|
2007-05-14 20:42:14 +00:00
|
|
|
string stepnumber = fromqstr(numberStepLE->text());
|
2008-03-26 19:50:20 +00:00
|
|
|
string numberfontsize = font_sizes[qMax(0, numberFontSizeCO->currentIndex())];
|
2007-05-13 04:06:37 +00:00
|
|
|
string firstline = fromqstr(firstlineLE->text());
|
|
|
|
string lastline = fromqstr(lastlineLE->text());
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2008-03-26 19:50:20 +00:00
|
|
|
string fontsize = font_sizes[qMax(0, fontsizeCO->currentIndex())];
|
|
|
|
string fontstyle = font_styles[qMax(0, fontstyleCO->currentIndex())];
|
2007-05-13 04:06:37 +00:00
|
|
|
string basicstyle;
|
2017-06-07 00:55:23 +02:00
|
|
|
string mintedsize;
|
2019-04-19 19:03:29 +02:00
|
|
|
// FIXME: We should not compose listings- or minted-dependant string here
|
|
|
|
// This breaks if a users switches the backend without opening and
|
|
|
|
// re-applying all listings insets. Use a backend-abstract syntax!
|
2017-06-07 00:55:23 +02:00
|
|
|
bool const use_minted = buffer().params().use_minted;
|
|
|
|
if (fontsize != "default") {
|
|
|
|
if (use_minted)
|
|
|
|
mintedsize = "\\" + fontsize;
|
|
|
|
else
|
|
|
|
basicstyle = "\\" + fontsize;
|
|
|
|
}
|
|
|
|
if (fontstyle != "default") {
|
|
|
|
if (use_minted)
|
|
|
|
basicstyle = fontstyle.substr(0, 2);
|
|
|
|
else
|
|
|
|
basicstyle += "\\" + fontstyle;
|
|
|
|
}
|
2007-05-20 14:31:15 +00:00
|
|
|
bool breakline = breaklinesCB->isChecked();
|
|
|
|
bool space = spaceCB->isChecked();
|
2008-09-30 18:00:02 +00:00
|
|
|
int tabsize = tabsizeSB->value();
|
2007-05-23 02:05:01 +00:00
|
|
|
bool spaceInString = spaceInStringCB->isChecked();
|
2007-05-20 14:31:15 +00:00
|
|
|
bool extendedchars = extendedcharsCB->isChecked();
|
2007-05-13 04:06:37 +00:00
|
|
|
string extra = fromqstr(listingsED->toPlainText());
|
|
|
|
|
|
|
|
// compose a string
|
|
|
|
InsetListingsParams par;
|
2017-06-07 00:55:23 +02:00
|
|
|
par.setMinted(use_minted);
|
|
|
|
if (use_minted) {
|
2018-07-22 22:22:13 +02:00
|
|
|
if (language == "no language" && !contains(extra, "language=")) {
|
|
|
|
string const & blp = buffer().params().listings_params;
|
|
|
|
size_t start = blp.find("language=");
|
|
|
|
if (start != string::npos) {
|
|
|
|
start += strlen("language=");
|
|
|
|
size_t len = blp.find(",", start);
|
|
|
|
if (len != string::npos)
|
|
|
|
len -= start;
|
|
|
|
par.addParam("language", blp.substr(start, len));
|
|
|
|
} else
|
|
|
|
par.addParam("language", "TeX");
|
|
|
|
} else
|
2017-06-07 00:55:23 +02:00
|
|
|
par.addParam("language", language);
|
|
|
|
} else if (language != "no language" && !contains(extra, "language=")) {
|
2007-05-23 02:05:01 +00:00
|
|
|
if (dialect.empty())
|
|
|
|
par.addParam("language", language);
|
|
|
|
else
|
|
|
|
par.addParam("language", "{[" + dialect + "]" + language + "}");
|
|
|
|
}
|
2007-05-25 14:38:22 +00:00
|
|
|
// this dialog uses float=placement instead of float,floatplacement=placement
|
|
|
|
// because float accepts *tbph and floatplacement accepts bph.
|
|
|
|
// our placement textedit is actually for the float parameter
|
2007-05-13 04:06:37 +00:00
|
|
|
if (float_)
|
2007-05-25 14:38:22 +00:00
|
|
|
par.addParam("float", placement);
|
2007-05-16 20:28:46 +00:00
|
|
|
if (numberSide != "none")
|
|
|
|
par.addParam("numbers", numberSide);
|
2017-06-07 00:55:23 +02:00
|
|
|
if (numberfontsize != "default" && numberSide != "none" && !use_minted)
|
2007-05-13 04:06:37 +00:00
|
|
|
par.addParam("numberstyle", "\\" + numberfontsize);
|
2007-05-20 14:31:15 +00:00
|
|
|
if (!stepnumber.empty() && numberSide != "none")
|
|
|
|
par.addParam("stepnumber", stepnumber);
|
2007-05-13 04:06:37 +00:00
|
|
|
if (!firstline.empty())
|
|
|
|
par.addParam("firstline", firstline);
|
|
|
|
if (!lastline.empty())
|
|
|
|
par.addParam("lastline", lastline);
|
2007-05-14 20:42:14 +00:00
|
|
|
if (!basicstyle.empty())
|
2017-06-07 00:55:23 +02:00
|
|
|
par.addParam(use_minted ? "fontfamily" : "basicstyle", basicstyle);
|
|
|
|
if (!mintedsize.empty())
|
|
|
|
par.addParam("fontsize", mintedsize);
|
2007-05-13 04:06:37 +00:00
|
|
|
if (breakline)
|
|
|
|
par.addParam("breaklines", "true");
|
|
|
|
if (space)
|
|
|
|
par.addParam("showspaces", "true");
|
2017-06-07 00:55:23 +02:00
|
|
|
if (!spaceInString && !use_minted)
|
2007-05-23 02:05:01 +00:00
|
|
|
par.addParam("showstringspaces", "false");
|
2008-09-30 18:00:02 +00:00
|
|
|
if (tabsize != 8)
|
|
|
|
par.addParam("tabsize", convert<string>(tabsize));
|
2017-06-07 00:55:23 +02:00
|
|
|
if (extendedchars && !use_minted)
|
2007-05-13 04:06:37 +00:00
|
|
|
par.addParam("extendedchars", "true");
|
|
|
|
par.addParams(extra);
|
|
|
|
return par.params();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
docstring GuiListings::validate_listings_params()
|
2007-07-27 18:17:00 +00:00
|
|
|
{
|
|
|
|
if (bypassCB->isChecked())
|
|
|
|
return docstring();
|
2016-07-31 00:42:51 +01:00
|
|
|
return InsetListingsParams(construct_params()).validate();
|
2007-07-27 18:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-23 09:06:50 +00:00
|
|
|
void GuiListings::setListingsMsg()
|
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
|
|
|
{
|
2013-10-07 18:59:05 -04:00
|
|
|
// FIXME THREAD
|
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;
|
2007-07-27 18:17:00 +00:00
|
|
|
docstring msg = validate_listings_params();
|
2007-06-12 17:10:28 +00:00
|
|
|
if (msg.empty()) {
|
|
|
|
if (isOK)
|
|
|
|
return;
|
|
|
|
isOK = true;
|
|
|
|
listingsTB->setPlainText(
|
|
|
|
qt_("Input listing parameters on the right. Enter ? for a list of parameters."));
|
|
|
|
} 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;
|
2007-06-12 17:10:28 +00:00
|
|
|
listingsTB->setPlainText(toqstr(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-05-18 15:26:42 +00:00
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::on_floatCB_stateChanged(int state)
|
2007-05-18 15:26:42 +00:00
|
|
|
{
|
|
|
|
if (state == Qt::Checked) {
|
|
|
|
inlineCB->setChecked(false);
|
|
|
|
placementLE->setEnabled(true);
|
|
|
|
} else
|
|
|
|
placementLE->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::on_inlineCB_stateChanged(int state)
|
2007-05-18 15:26:42 +00:00
|
|
|
{
|
|
|
|
if (state == Qt::Checked) {
|
|
|
|
floatCB->setChecked(false);
|
|
|
|
placementLE->setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::on_numberSideCO_currentIndexChanged(int index)
|
2007-05-20 14:31:15 +00:00
|
|
|
{
|
|
|
|
numberStepLE->setEnabled(index > 0);
|
|
|
|
numberFontSizeCO->setEnabled(index > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::on_languageCO_currentIndexChanged(int index)
|
2007-05-23 02:05:01 +00:00
|
|
|
{
|
|
|
|
dialectCO->clear();
|
|
|
|
// 0 is "no dialect"
|
|
|
|
int default_dialect = 0;
|
|
|
|
dialectCO->addItem(qt_("No dialect"));
|
2010-01-30 11:34:28 +00:00
|
|
|
string const language = languages_supported[index];
|
2007-05-23 02:05:01 +00:00
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
for (size_t i = 0; i != nr_dialects; ++i) {
|
2007-05-23 02:05:01 +00:00
|
|
|
if (language == dialects[i].language) {
|
2007-06-01 12:27:04 +00:00
|
|
|
dialectCO->addItem(qt_(dialects[i].gui));
|
2007-05-23 02:05:01 +00:00
|
|
|
if (dialects[i].is_default)
|
|
|
|
default_dialect =
|
2007-06-01 12:27:04 +00:00
|
|
|
dialectCO->findText(qt_(dialects[i].gui));
|
2007-05-23 02:05:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
dialectCO->setCurrentIndex(default_dialect);
|
2017-06-07 15:31:13 +02:00
|
|
|
dialectCO->setEnabled(dialectCO->count() > 1
|
|
|
|
&& !buffer().params().use_minted);
|
2007-05-23 02:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::applyView()
|
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
|
|
|
{
|
2017-06-07 00:55:23 +02:00
|
|
|
params_.setMinted(buffer().params().use_minted);
|
2007-10-05 21:53:54 +00:00
|
|
|
params_.setInline(inlineCB->isChecked());
|
|
|
|
params_.setParams(construct_params());
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
static string plainParam(string const & par)
|
2007-05-22 04:43:30 +00:00
|
|
|
{
|
|
|
|
// remove enclosing braces
|
|
|
|
if (prefixIs(par, "{") && suffixIs(par, "}"))
|
|
|
|
return par.substr(1, par.size() - 2);
|
|
|
|
return par;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
void GuiListings::updateContents()
|
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
|
|
|
{
|
2017-06-07 00:55:23 +02:00
|
|
|
bool const use_minted = buffer().params().use_minted;
|
2007-05-28 22:27:45 +00:00
|
|
|
// set default values
|
2007-09-05 20:33:29 +00:00
|
|
|
listingsTB->setPlainText(
|
2007-05-29 21:23:23 +00:00
|
|
|
qt_("Input listing parameters on the right. Enter ? for a list of parameters."));
|
2010-01-30 11:34:28 +00:00
|
|
|
languageCO->setCurrentIndex(findToken(languages_supported, "no language"));
|
2007-09-05 20:33:29 +00:00
|
|
|
dialectCO->setCurrentIndex(0);
|
|
|
|
floatCB->setChecked(false);
|
|
|
|
placementLE->clear();
|
|
|
|
numberSideCO->setCurrentIndex(0);
|
|
|
|
numberStepLE->clear();
|
|
|
|
numberFontSizeCO->setCurrentIndex(findToken(font_sizes, "default"));
|
|
|
|
firstlineLE->clear();
|
|
|
|
lastlineLE->clear();
|
|
|
|
fontstyleCO->setCurrentIndex(findToken(font_styles, "default"));
|
|
|
|
fontsizeCO->setCurrentIndex(findToken(font_sizes, "default"));
|
|
|
|
breaklinesCB->setChecked(false);
|
|
|
|
spaceCB->setChecked(false);
|
|
|
|
spaceInStringCB->setChecked(true);
|
2008-09-30 18:00:02 +00:00
|
|
|
tabsizeSB->setValue(8);
|
2007-09-05 20:33:29 +00:00
|
|
|
extendedcharsCB->setChecked(false);
|
2007-05-13 04:06:37 +00:00
|
|
|
|
|
|
|
// set values from param string
|
2007-10-05 21:53:54 +00:00
|
|
|
inlineCB->setChecked(params_.isInline());
|
|
|
|
if (params_.isInline()) {
|
2007-09-05 20:33:29 +00:00
|
|
|
floatCB->setChecked(false);
|
|
|
|
placementLE->setEnabled(false);
|
2007-05-18 15:26:42 +00:00
|
|
|
}
|
2007-05-13 04:06:37 +00:00
|
|
|
// break other parameters and set values
|
2007-10-05 21:53:54 +00:00
|
|
|
vector<string> pars = getVectorFromString(params_.separatedParams(), "\n");
|
2007-05-13 04:06:37 +00:00
|
|
|
// process each of them
|
|
|
|
for (vector<string>::iterator it = pars.begin();
|
|
|
|
it != pars.end(); ++it) {
|
|
|
|
if (prefixIs(*it, "language=")) {
|
2007-05-23 02:05:01 +00:00
|
|
|
string arg = plainParam(it->substr(9));
|
|
|
|
// has dialect?
|
|
|
|
string language;
|
|
|
|
string dialect;
|
|
|
|
bool in_gui = false;
|
|
|
|
if (prefixIs(arg, "[") && contains(arg, "]")) {
|
2007-11-23 21:39:51 +00:00
|
|
|
size_t end_dialect = arg.find("]");
|
2007-05-23 02:05:01 +00:00
|
|
|
dialect = arg.substr(1, end_dialect - 1);
|
|
|
|
language = arg.substr(end_dialect + 1);
|
2007-11-23 21:39:51 +00:00
|
|
|
} else {
|
2007-05-23 02:05:01 +00:00
|
|
|
language = arg;
|
2007-11-23 21:39:51 +00:00
|
|
|
}
|
2010-01-30 11:34:28 +00:00
|
|
|
int n = findToken(languages_supported, language);
|
2007-05-22 04:43:30 +00:00
|
|
|
if (n >= 0) {
|
2007-09-05 20:33:29 +00:00
|
|
|
languageCO->setCurrentIndex(n);
|
2007-05-23 02:05:01 +00:00
|
|
|
in_gui = true;
|
2007-05-22 04:43:30 +00:00
|
|
|
}
|
2007-05-23 02:05:01 +00:00
|
|
|
// on_languageCO_currentIndexChanged should have set dialects
|
|
|
|
if (!dialect.empty()) {
|
|
|
|
string dialect_gui;
|
2007-10-05 21:53:54 +00:00
|
|
|
for (size_t i = 0; i != nr_dialects; ++i) {
|
2007-05-23 02:05:01 +00:00
|
|
|
if (dialect == dialects[i].dialect
|
|
|
|
&& dialects[i].language == language) {
|
|
|
|
dialect_gui = dialects[i].gui;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
n = dialectCO->findText(qt_(dialect_gui));
|
2007-05-23 02:05:01 +00:00
|
|
|
if (n >= 0)
|
2007-09-05 20:33:29 +00:00
|
|
|
dialectCO->setCurrentIndex(n);
|
2007-05-23 02:05:01 +00:00
|
|
|
else
|
|
|
|
in_gui = false;
|
|
|
|
}
|
|
|
|
if (in_gui)
|
|
|
|
*it = "";
|
2007-09-05 20:33:29 +00:00
|
|
|
languageCO->setEnabled(in_gui);
|
2017-06-07 00:55:23 +02:00
|
|
|
dialectCO->setEnabled(!use_minted &&
|
2007-09-05 20:33:29 +00:00
|
|
|
in_gui && dialectCO->count() > 1);
|
2007-05-13 04:06:37 +00:00
|
|
|
} else if (prefixIs(*it, "float")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
floatCB->setChecked(true);
|
|
|
|
inlineCB->setChecked(false);
|
|
|
|
placementLE->setEnabled(true);
|
2007-05-13 04:06:37 +00:00
|
|
|
if (prefixIs(*it, "float="))
|
2007-09-05 20:33:29 +00:00
|
|
|
placementLE->setText(
|
2007-05-22 04:43:30 +00:00
|
|
|
toqstr(plainParam(it->substr(6))));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "numbers=")) {
|
2007-05-22 04:43:30 +00:00
|
|
|
string s = plainParam(it->substr(8));
|
2007-05-20 14:31:15 +00:00
|
|
|
int n = 0;
|
|
|
|
if (s == "left")
|
|
|
|
n = 1;
|
|
|
|
else if (s == "right")
|
|
|
|
n = 2;
|
2007-09-05 20:33:29 +00:00
|
|
|
numberSideCO->setCurrentIndex(n);
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "stepnumber=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
numberStepLE->setText(
|
2007-05-22 04:43:30 +00:00
|
|
|
toqstr(plainParam(it->substr(11))));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "numberstyle=")) {
|
2007-05-22 04:43:30 +00:00
|
|
|
string par = plainParam(it->substr(12));
|
|
|
|
int n = findToken(font_sizes, par.substr(1));
|
|
|
|
if (n >= 0)
|
2007-09-05 20:33:29 +00:00
|
|
|
numberFontSizeCO->setCurrentIndex(n);
|
2007-05-20 14:31:15 +00:00
|
|
|
*it = "";
|
2007-05-13 04:06:37 +00:00
|
|
|
} else if (prefixIs(*it, "firstline=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
firstlineLE->setText(
|
2007-05-22 04:43:30 +00:00
|
|
|
toqstr(plainParam(it->substr(10))));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "lastline=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
lastlineLE->setText(
|
2007-05-22 04:43:30 +00:00
|
|
|
toqstr(plainParam(it->substr(9))));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "basicstyle=")) {
|
|
|
|
string style;
|
|
|
|
string size;
|
2007-05-20 14:31:15 +00:00
|
|
|
for (int n = 0; font_styles[n][0]; ++n) {
|
|
|
|
string const s = font_styles[n];
|
|
|
|
if (contains(*it, "\\" + s)) {
|
|
|
|
style = "\\" + s;
|
2007-05-13 04:06:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-20 14:31:15 +00:00
|
|
|
}
|
|
|
|
for (int n = 0; font_sizes[n][0]; ++n) {
|
|
|
|
string const s = font_sizes[n];
|
|
|
|
if (contains(*it, "\\" + s)) {
|
|
|
|
size = "\\" + s;
|
2007-05-13 04:06:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-20 14:31:15 +00:00
|
|
|
}
|
2007-05-23 02:05:01 +00:00
|
|
|
if (plainParam(it->substr(11)) == style + size
|
2007-05-22 04:43:30 +00:00
|
|
|
|| plainParam(it->substr(11)) == size + style) {
|
|
|
|
if (!style.empty()) {
|
|
|
|
int n = findToken(font_styles, style.substr(1));
|
|
|
|
if (n >= 0)
|
2007-09-05 20:33:29 +00:00
|
|
|
fontstyleCO->setCurrentIndex(n);
|
2007-05-22 04:43:30 +00:00
|
|
|
}
|
|
|
|
if (!size.empty()) {
|
|
|
|
int n = findToken(font_sizes, size.substr(1));
|
|
|
|
if (n >= 0)
|
2007-09-05 20:33:29 +00:00
|
|
|
fontsizeCO->setCurrentIndex(n);
|
2007-05-22 04:43:30 +00:00
|
|
|
}
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
}
|
2017-06-07 00:55:23 +02:00
|
|
|
} else if (prefixIs(*it, "fontsize=")) {
|
|
|
|
string size;
|
|
|
|
for (int n = 0; font_sizes[n][0]; ++n) {
|
|
|
|
string const s = font_sizes[n];
|
|
|
|
if (contains(*it, "\\" + s)) {
|
|
|
|
size = "\\" + s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!size.empty()) {
|
|
|
|
int n = findToken(font_sizes, size.substr(1));
|
|
|
|
if (n >= 0)
|
|
|
|
fontsizeCO->setCurrentIndex(n);
|
|
|
|
}
|
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "fontfamily=")) {
|
|
|
|
string style;
|
|
|
|
for (int n = 0; font_styles[n][0]; ++n) {
|
|
|
|
string const s = font_styles[n];
|
|
|
|
if (contains(*it, "=" + s.substr(0,2))) {
|
|
|
|
style = "\\" + s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!style.empty()) {
|
|
|
|
int n = findToken(font_styles, style.substr(1));
|
|
|
|
if (n >= 0)
|
|
|
|
fontstyleCO->setCurrentIndex(n);
|
|
|
|
}
|
|
|
|
*it = "";
|
2007-05-13 04:06:37 +00:00
|
|
|
} else if (prefixIs(*it, "breaklines=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
breaklinesCB->setChecked(contains(*it, "true"));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
} else if (prefixIs(*it, "showspaces=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
spaceCB->setChecked(contains(*it, "true"));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
2007-05-23 02:05:01 +00:00
|
|
|
} else if (prefixIs(*it, "showstringspaces=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
spaceInStringCB->setChecked(contains(*it, "true"));
|
2007-05-23 02:05:01 +00:00
|
|
|
*it = "";
|
2008-09-30 18:00:02 +00:00
|
|
|
} else if (prefixIs(*it, "tabsize=")) {
|
|
|
|
tabsizeSB->setValue(convert<int>(plainParam(it->substr(8))));
|
|
|
|
*it = "";
|
2007-05-13 04:06:37 +00:00
|
|
|
} else if (prefixIs(*it, "extendedchars=")) {
|
2007-09-05 20:33:29 +00:00
|
|
|
extendedcharsCB->setChecked(contains(*it, "true"));
|
2007-05-13 04:06:37 +00:00
|
|
|
*it = "";
|
|
|
|
}
|
|
|
|
}
|
2007-05-20 14:31:15 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
numberStepLE->setEnabled(numberSideCO->currentIndex() > 0);
|
2017-06-07 00:55:23 +02:00
|
|
|
numberFontSizeCO->setEnabled(numberSideCO->currentIndex() > 0
|
|
|
|
&& !use_minted);
|
|
|
|
spaceInStringCB->setEnabled(!use_minted);
|
|
|
|
extendedcharsCB->setEnabled(!use_minted);
|
2007-05-13 04:06:37 +00:00
|
|
|
// parameters that can be handled by widgets are cleared
|
|
|
|
// the rest is put to the extra edit box.
|
|
|
|
string extra = getStringFromVector(pars);
|
2007-09-05 20:33:29 +00:00
|
|
|
listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
|
2017-06-07 00:55:23 +02:00
|
|
|
params_.setMinted(use_minted);
|
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-05 21:53:54 +00:00
|
|
|
bool GuiListings::isValid()
|
2007-07-27 18:17:00 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
return validate_listings_params().empty();
|
2007-07-27 18:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-24 01:01:34 -05:00
|
|
|
bool GuiListings::initialiseParams(string const & sdata)
|
2007-10-05 21:53:54 +00:00
|
|
|
{
|
2018-02-24 01:01:34 -05:00
|
|
|
InsetListings::string2params(sdata, params_);
|
2007-10-05 21:53:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::clearParams()
|
|
|
|
{
|
|
|
|
params_.clear();
|
2017-06-07 00:55:23 +02:00
|
|
|
params_.setMinted(buffer().params().use_minted);
|
2007-10-05 21:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::dispatchParams()
|
|
|
|
{
|
2008-03-27 22:26:24 +00:00
|
|
|
string const lfun = InsetListings::params2string(params_);
|
2007-10-05 21:53:54 +00:00
|
|
|
dispatch(FuncRequest(getLfun(), lfun));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::setParams(InsetListingsParams const & params)
|
|
|
|
{
|
|
|
|
params_ = params;
|
2017-06-07 00:55:23 +02:00
|
|
|
params_.setMinted(buffer().params().use_minted);
|
2007-10-05 21:53:54 +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
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiListings.cpp"
|