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
|
2007-05-18 18:35:28 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>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"
|
2007-10-05 21:53:54 +00:00
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
#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"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/debug.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
|
|
|
|
|
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 <QCloseEvent>
|
|
|
|
|
#include <QPushButton>
|
2007-05-13 04:06:37 +00:00
|
|
|
|
#include <QValidator>
|
|
|
|
|
#include <QRegExpValidator>
|
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
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
char const * languages[] =
|
2007-05-23 02:05:01 +00:00
|
|
|
|
{ "no language", "ABAP", "ACSL", "Ada", "ALGOL", "Assembler", "Awk", "bash", "Basic", "C",
|
|
|
|
|
"C++", "Caml", "Clean", "Cobol", "Comal 80", "command.com", "Comsol", "csh", "Delphi",
|
2007-10-13 20:56:28 +00:00
|
|
|
|
"Eiffel", "Elan", "erlang", "Euphoria", "Fortran", "Gnuplot", "Haskell", "HTML", "IDL", "inform",
|
2007-05-23 02:05:01 +00:00
|
|
|
|
"Java", "JVMIS", "ksh", "Lingo", "Lisp", "Logo", "make", "Mathematica", "Matlab", "Mercury",
|
|
|
|
|
"MetaPost", "Miranda", "ML", "Modula-2", "MuPAD", "NASTRAN", "Oberon-2", "OCL", "Octave",
|
|
|
|
|
"Oz", "Pascal", "Perl", "PHP", "PL/I", "Plasm", "PostScript", "POV", "Prolog", "Promela",
|
|
|
|
|
"PSTricks", "Python", "R", "Reduce", "Rexx", "RSL", "Ruby", "S", "SAS", "Scilab", "sh",
|
|
|
|
|
"SHELXL", "Simula", "tcl", "SPARQL", "SQL", "tcl", "TeX", "VBScript", "Verilog", "VHDL",
|
|
|
|
|
"VRML", "XML", "XSLT", "" };
|
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
|
|
char const * languages_gui[] =
|
2007-05-23 02:05:01 +00:00
|
|
|
|
{ N_("No language"), "ABAP", "ACSL", "Ada", "ALGOL", "Assembler", "Awk", "bash", "Basic",
|
|
|
|
|
"C", "C++", "Caml", "Clean", "Cobol", "Comal 80", "command.com", "Comsol", "csh", "Delphi",
|
2007-10-13 20:56:28 +00:00
|
|
|
|
"Eiffel", "Elan", "Erlang", "Euphoria", "Fortran", "Gnuplot", "Haskell", "HTML", "IDL", "inform",
|
2007-05-23 02:05:01 +00:00
|
|
|
|
"Java", "JVMIS", "ksh", "Lingo", "Lisp", "Logo", "make", "Mathematica", "Matlab", "Mercury",
|
|
|
|
|
"MetaPost", "Miranda", "ML", "Modula-2", "MuPAD", "NASTRAN", "Oberon-2", "OCL", "Octave",
|
|
|
|
|
"Oz", "Pascal", "Perl", "PHP", "PL/I", "Plasm", "PostScript", "POV", "Prolog", "Promela",
|
|
|
|
|
"PSTricks", "Python", "R", "Reduce", "Rexx", "RSL", "Ruby", "S", "SAS", "Scilab", "sh",
|
|
|
|
|
"SHELXL", "Simula", "tcl", "SPARQL", "SQL", "tcl", "TeX", "VBScript", "Verilog", "VHDL",
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
|
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
|
|
|
|
|
|
|
|
|
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()));
|
|
|
|
|
connect(extendedcharsCB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
|
|
|
|
|
connect(listingsED, SIGNAL(textChanged()),
|
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
connect(listingsED, SIGNAL(textChanged()),
|
|
|
|
|
this, SLOT(set_listings_msg()));
|
|
|
|
|
connect(bypassCB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
connect(bypassCB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(set_listings_msg()));
|
2007-05-20 14:31:15 +00:00
|
|
|
|
|
|
|
|
|
for (int n = 0; languages[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));
|
2007-05-25 15:05:46 +00:00
|
|
|
|
placementLE->setValidator(new QRegExpValidator(QRegExp("[\\*tbph]*"), this));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
|
|
bc().setOK(okPB);
|
|
|
|
|
bc().setApply(applyPB);
|
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
|
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::closeEvent(QCloseEvent * e)
|
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-11 17:06:15 +00:00
|
|
|
|
slotClose();
|
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
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2007-05-20 14:31:15 +00:00
|
|
|
|
string language = languages[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;
|
|
|
|
|
switch (numberSideCO->currentIndex()) {
|
|
|
|
|
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());
|
2007-05-20 14:31:15 +00:00
|
|
|
|
string numberfontsize = font_sizes[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
|
|
|
|
|
2007-05-20 14:31:15 +00:00
|
|
|
|
string fontsize = font_sizes[fontsizeCO->currentIndex()];
|
|
|
|
|
string fontstyle = font_styles[fontstyleCO->currentIndex()];
|
2007-05-13 04:06:37 +00:00
|
|
|
|
string basicstyle;
|
|
|
|
|
if (fontsize != "default")
|
|
|
|
|
basicstyle = "\\" + fontsize;
|
|
|
|
|
if (fontstyle != "default")
|
|
|
|
|
basicstyle += "\\" + fontstyle;
|
2007-05-20 14:31:15 +00:00
|
|
|
|
bool breakline = breaklinesCB->isChecked();
|
|
|
|
|
bool space = spaceCB->isChecked();
|
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;
|
2007-05-23 02:05:01 +00:00
|
|
|
|
if (language != "no language" && !contains(extra, "language=")) {
|
|
|
|
|
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);
|
2007-05-20 14:31:15 +00:00
|
|
|
|
if (numberfontsize != "default" && numberSide != "none")
|
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())
|
2007-05-13 04:06:37 +00:00
|
|
|
|
par.addParam("basicstyle", basicstyle);
|
|
|
|
|
if (breakline)
|
|
|
|
|
par.addParam("breaklines", "true");
|
|
|
|
|
if (space)
|
|
|
|
|
par.addParam("showspaces", "true");
|
2007-05-23 02:05:01 +00:00
|
|
|
|
if (!spaceInString)
|
|
|
|
|
par.addParam("showstringspaces", "false");
|
2007-05-14 20:42:14 +00:00
|
|
|
|
if (extendedchars)
|
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
|
|
|
|
{
|
|
|
|
|
// use a cache here to avoid repeated validation
|
|
|
|
|
// of the same parameters
|
2007-10-05 21:53:54 +00:00
|
|
|
|
static string param_cache;
|
|
|
|
|
static docstring msg_cache;
|
2007-07-27 18:17:00 +00:00
|
|
|
|
|
|
|
|
|
if (bypassCB->isChecked())
|
|
|
|
|
return docstring();
|
|
|
|
|
|
|
|
|
|
string params = construct_params();
|
|
|
|
|
if (params != param_cache) {
|
|
|
|
|
param_cache = params;
|
|
|
|
|
msg_cache = InsetListingsParams(params).validate();
|
|
|
|
|
}
|
|
|
|
|
return msg_cache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
|
void GuiListings::set_listings_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
|
|
|
|
{
|
|
|
|
|
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"));
|
|
|
|
|
string const language = languages[index];
|
|
|
|
|
|
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);
|
|
|
|
|
dialectCO->setEnabled(dialectCO->count() > 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
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
|
|
|
|
{
|
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."));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
languageCO->setCurrentIndex(findToken(languages, "no language"));
|
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
}
|
2007-05-23 02:05:01 +00:00
|
|
|
|
int n = findToken(languages, 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);
|
|
|
|
|
dialectCO->setEnabled(
|
|
|
|
|
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 = "";
|
|
|
|
|
}
|
|
|
|
|
} 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 = "";
|
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);
|
|
|
|
|
numberFontSizeCO->setEnabled(numberSideCO->currentIndex() > 0);
|
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()));
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 21:53:54 +00:00
|
|
|
|
bool GuiListings::initialiseParams(string const & data)
|
|
|
|
|
{
|
|
|
|
|
InsetListingsMailer::string2params(data, params_);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::clearParams()
|
|
|
|
|
{
|
|
|
|
|
params_.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::dispatchParams()
|
|
|
|
|
{
|
|
|
|
|
string const lfun = InsetListingsMailer::params2string(params_);
|
|
|
|
|
dispatch(FuncRequest(getLfun(), lfun));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GuiListings::setParams(InsetListingsParams const & params)
|
|
|
|
|
{
|
|
|
|
|
params_ = params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
|
Dialog * createGuiListings(GuiView & lv) { return new GuiListings(lv); }
|
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
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiListings_moc.cpp"
|