2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiInclude.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2007-10-06 12:03:13 +00:00
|
|
|
* \author Alejandro Aguilar Sierra
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author John Levon
|
2007-10-06 12:03:13 +00:00
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "GuiInclude.h"
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
#include "frontend_helpers.h"
|
|
|
|
|
|
|
|
#include "Buffer.h"
|
|
|
|
#include "Format.h"
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "LyXRC.h"
|
2007-01-12 03:19:58 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyXRC.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
#include "support/os.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "support/FileFilterList.h"
|
|
|
|
#include "support/filetools.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-10-06 12:03:13 +00:00
|
|
|
#include "insets/InsetInclude.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QLineEdit>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
using std::string;
|
2007-05-14 20:42:14 +00:00
|
|
|
using std::vector;
|
2007-10-06 12:03:13 +00:00
|
|
|
using std::pair;
|
|
|
|
using std::string;
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
using support::FileFilterList;
|
|
|
|
using support::FileName;
|
|
|
|
using support::isFileReadable;
|
|
|
|
using support::makeAbsPath;
|
|
|
|
using support::onlyPath;
|
|
|
|
using support::os::internal_path;
|
|
|
|
using support::prefixIs;
|
|
|
|
using support::getStringFromVector;
|
|
|
|
using support::getVectorFromString;
|
|
|
|
|
|
|
|
|
|
|
|
GuiInclude::GuiInclude(LyXView & lv)
|
2007-10-09 19:34:27 +00:00
|
|
|
: GuiDialog(lv, "include"), params_("include")
|
2007-04-25 10:57:54 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
setViewTitle(_("Child Document"));
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
|
|
connect(visiblespaceCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(filenameED, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-06 12:03:13 +00:00
|
|
|
connect(editPB, SIGNAL(clicked()), this, SLOT(edit()));
|
|
|
|
connect(browsePB, SIGNAL(clicked()), this, SLOT(browse()));
|
2007-04-25 10:57:54 +00:00
|
|
|
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
|
|
|
|
connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
2007-05-14 20:42:14 +00:00
|
|
|
connect(captionLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(labelLE, SIGNAL(textChanged(const QString&)), this, SLOT(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
|
|
|
connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
|
2007-07-27 18:17:00 +00:00
|
|
|
connect(listingsED, SIGNAL(textChanged()), this, SLOT(set_listings_msg()));
|
2007-06-12 17:10:28 +00:00
|
|
|
connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
2007-07-27 18:17:00 +00:00
|
|
|
connect(bypassCB, SIGNAL(clicked()), this, SLOT(set_listings_msg()));
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
|
|
setFocusProxy(filenameED);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
bc().addReadOnly(filenameED);
|
|
|
|
bc().addReadOnly(browsePB);
|
|
|
|
bc().addReadOnly(visiblespaceCB);
|
|
|
|
bc().addReadOnly(typeCO);
|
|
|
|
bc().addReadOnly(listingsED);
|
|
|
|
|
|
|
|
bc().addCheckedLineEdit(filenameED, filenameLA);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::change_adaptor()
|
2007-04-25 10:57:54 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-25 10:57:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
docstring GuiInclude::validate_listings_params()
|
2007-07-27 18:17:00 +00:00
|
|
|
{
|
|
|
|
// use a cache here to avoid repeated validation
|
|
|
|
// of the same parameters
|
|
|
|
static string param_cache = string();
|
|
|
|
static docstring msg_cache = docstring();
|
|
|
|
|
|
|
|
if (typeCO->currentIndex() != 3 || bypassCB->isChecked())
|
|
|
|
return docstring();
|
|
|
|
|
|
|
|
string params = fromqstr(listingsED->toPlainText());
|
|
|
|
if (params != param_cache) {
|
|
|
|
param_cache = params;
|
|
|
|
msg_cache = InsetListingsParams(params).validate();
|
|
|
|
}
|
|
|
|
return msg_cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::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-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::closeEvent(QCloseEvent * e)
|
2007-04-25 10:57:54 +00:00
|
|
|
{
|
2007-09-11 17:06:15 +00:00
|
|
|
slotClose();
|
2007-04-25 10:57:54 +00:00
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::typeChanged(int v)
|
2007-04-25 10:57:54 +00:00
|
|
|
{
|
|
|
|
switch (v) {
|
|
|
|
//case Include
|
|
|
|
case 0:
|
|
|
|
visiblespaceCB->setEnabled(false);
|
|
|
|
visiblespaceCB->setChecked(false);
|
|
|
|
previewCB->setEnabled(false);
|
|
|
|
previewCB->setChecked(false);
|
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
|
|
|
listingsGB->setEnabled(false);
|
2007-04-25 10:57:54 +00:00
|
|
|
break;
|
|
|
|
//case Input
|
|
|
|
case 1:
|
|
|
|
visiblespaceCB->setEnabled(false);
|
|
|
|
visiblespaceCB->setChecked(false);
|
|
|
|
previewCB->setEnabled(true);
|
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
|
|
|
listingsGB->setEnabled(false);
|
|
|
|
break;
|
|
|
|
//case listings
|
|
|
|
case 3:
|
|
|
|
visiblespaceCB->setEnabled(false);
|
|
|
|
visiblespaceCB->setChecked(false);
|
|
|
|
previewCB->setEnabled(false);
|
2007-05-30 22:01:12 +00:00
|
|
|
previewCB->setChecked(false);
|
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
|
|
|
listingsGB->setEnabled(true);
|
2007-04-25 10:57:54 +00:00
|
|
|
break;
|
|
|
|
//case Verbatim
|
|
|
|
default:
|
|
|
|
visiblespaceCB->setEnabled(true);
|
|
|
|
previewCB->setEnabled(false);
|
|
|
|
previewCB->setChecked(false);
|
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
|
|
|
listingsGB->setEnabled(false);
|
2007-04-25 10:57:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-30 22:01:12 +00:00
|
|
|
//see this thread
|
|
|
|
// http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg118471.html
|
|
|
|
//for the reason this is here.
|
|
|
|
okPB->setDefault(true);
|
2007-04-25 10:57:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::updateContents()
|
2007-04-25 10:57:54 +00:00
|
|
|
{
|
2007-10-06 12:03:13 +00:00
|
|
|
filenameED->setText(toqstr(params_["filename"]));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
visiblespaceCB->setChecked(false);
|
|
|
|
visiblespaceCB->setEnabled(false);
|
|
|
|
previewCB->setChecked(false);
|
|
|
|
previewCB->setEnabled(false);
|
|
|
|
listingsGB->setEnabled(false);
|
|
|
|
captionLE->clear();
|
|
|
|
labelLE->clear();
|
|
|
|
listingsED->clear();
|
|
|
|
listingsTB->setPlainText(
|
2007-05-29 21:23:23 +00:00
|
|
|
qt_("Input listing parameters on the right. Enter ? for a list of parameters."));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
string cmdname = params_.getCmdName();
|
2006-03-05 17:24:44 +00:00
|
|
|
if (cmdname != "include" &&
|
|
|
|
cmdname != "verbatiminput" &&
|
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
|
|
|
cmdname != "verbatiminput*" &&
|
|
|
|
cmdname != "lstinputlisting")
|
2006-03-05 17:24:44 +00:00
|
|
|
cmdname = "input";
|
|
|
|
|
2007-03-18 03:42:40 +00:00
|
|
|
if (cmdname == "include") {
|
2007-09-05 20:33:29 +00:00
|
|
|
typeCO->setCurrentIndex(0);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-03-18 03:42:40 +00:00
|
|
|
} else if (cmdname == "input") {
|
2007-09-05 20:33:29 +00:00
|
|
|
typeCO->setCurrentIndex(1);
|
|
|
|
previewCB->setEnabled(true);
|
2007-10-06 12:03:13 +00:00
|
|
|
previewCB->setChecked(params_.preview());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
} else if (cmdname == "verbatiminput*") {
|
2007-09-05 20:33:29 +00:00
|
|
|
typeCO->setCurrentIndex(2);
|
|
|
|
visiblespaceCB->setEnabled(true);
|
|
|
|
visiblespaceCB->setChecked(true);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
} else if (cmdname == "verbatiminput") {
|
2007-09-05 20:33:29 +00:00
|
|
|
typeCO->setCurrentIndex(2);
|
|
|
|
visiblespaceCB->setEnabled(true);
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
|
|
|
} else if (cmdname == "lstinputlisting") {
|
2007-09-05 20:33:29 +00:00
|
|
|
typeCO->setCurrentIndex(3);
|
|
|
|
listingsGB->setEnabled(true);
|
|
|
|
listingsED->setEnabled(true);
|
2007-10-06 12:03:13 +00:00
|
|
|
InsetListingsParams par(params_.getOptions());
|
2007-05-14 20:42:14 +00:00
|
|
|
// extract caption and label and put them into their respective editboxes
|
|
|
|
vector<string> pars = getVectorFromString(par.separatedParams(), "\n");
|
|
|
|
for (vector<string>::iterator it = pars.begin();
|
|
|
|
it != pars.end(); ++it) {
|
|
|
|
if (prefixIs(*it, "caption=")) {
|
|
|
|
string cap = it->substr(8);
|
2007-10-06 12:03:13 +00:00
|
|
|
if (cap[0] == '{' && cap[cap.size() - 1] == '}') {
|
|
|
|
captionLE->setText(toqstr(cap.substr(1, cap.size() - 2)));
|
2007-06-12 17:10:28 +00:00
|
|
|
*it = "";
|
|
|
|
}
|
2007-05-14 20:42:14 +00:00
|
|
|
} else if (prefixIs(*it, "label=")) {
|
|
|
|
string lbl = it->substr(6);
|
2007-06-12 17:10:28 +00:00
|
|
|
if (lbl[0] == '{' && lbl[lbl.size()-1] == '}') {
|
2007-10-06 12:03:13 +00:00
|
|
|
labelLE->setText(toqstr(lbl.substr(1, lbl.size() - 2)));
|
2007-06-12 17:10:28 +00:00
|
|
|
*it = "";
|
|
|
|
}
|
2007-05-14 20:42:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// 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()));
|
2007-05-28 22:27:45 +00:00
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 12:03:13 +00:00
|
|
|
params_["filename"] = from_utf8(internal_path(fromqstr(filenameED->text())));
|
|
|
|
params_.preview(previewCB->isChecked());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
int const item = typeCO->currentIndex();
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
if (item == 0) {
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setCmdName("include");
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
} else if (item == 1) {
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setCmdName("input");
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
} else if (item == 3) {
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setCmdName("lstinputlisting");
|
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
|
|
|
// the parameter string should have passed validation
|
2007-09-05 20:33:29 +00:00
|
|
|
InsetListingsParams par(fromqstr(listingsED->toPlainText()));
|
|
|
|
string caption = fromqstr(captionLE->text());
|
|
|
|
string label = fromqstr(labelLE->text());
|
2007-05-14 20:42:14 +00:00
|
|
|
if (!caption.empty())
|
|
|
|
par.addParam("caption", "{" + caption + "}");
|
|
|
|
if (!label.empty())
|
|
|
|
par.addParam("label", "{" + label + "}");
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setOptions(par.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
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
if (visiblespaceCB->isChecked())
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setCmdName("verbatiminput*");
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2007-10-06 12:03:13 +00:00
|
|
|
params_.setCmdName("verbatiminput");
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::browse()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 12:03:13 +00:00
|
|
|
Type type;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
int const item = typeCO->currentIndex();
|
2006-03-05 17:24:44 +00:00
|
|
|
if (item == 0)
|
2007-10-06 12:03:13 +00:00
|
|
|
type = INCLUDE;
|
2007-03-18 03:42:40 +00:00
|
|
|
else if (item == 1)
|
2007-10-06 12:03:13 +00:00
|
|
|
type = INPUT;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
else if (item == 2)
|
2007-10-06 12:03:13 +00:00
|
|
|
type = VERBATIM;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
else
|
2007-10-06 12:03:13 +00:00
|
|
|
type = LISTINGS;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
docstring const & name = browse(qstring_to_ucs4(filenameED->text()), type);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (!name.empty())
|
2007-09-05 20:33:29 +00:00
|
|
|
filenameED->setText(toqstr(name));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::edit()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
if (isValid()) {
|
2007-09-05 20:33:29 +00:00
|
|
|
string const file = fromqstr(filenameED->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
slotOK();
|
2007-10-06 12:03:13 +00:00
|
|
|
edit(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiInclude::isValid()
|
|
|
|
{
|
|
|
|
return !filenameED->text().isEmpty() && validate_listings_params().empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiInclude::initialiseParams(string const & data)
|
|
|
|
{
|
|
|
|
InsetIncludeMailer::string2params(data, params_);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiInclude::clearParams()
|
|
|
|
{
|
|
|
|
params_.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiInclude::dispatchParams()
|
|
|
|
{
|
|
|
|
dispatch(FuncRequest(getLfun(), InsetIncludeMailer::params2string(params_)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
docstring GuiInclude::browse(docstring const & in_name, Type in_type) const
|
|
|
|
{
|
|
|
|
docstring const title = _("Select document to include");
|
|
|
|
|
|
|
|
// input TeX, verbatim, or LyX file ?
|
|
|
|
FileFilterList filters;
|
|
|
|
switch (in_type) {
|
|
|
|
case INCLUDE:
|
|
|
|
case INPUT:
|
|
|
|
filters = FileFilterList(_("LaTeX/LyX Documents (*.tex *.lyx)"));
|
|
|
|
break;
|
|
|
|
case VERBATIM:
|
|
|
|
break;
|
|
|
|
case LISTINGS:
|
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
2007-10-06 12:03:13 +00:00
|
|
|
|
|
|
|
pair<docstring, docstring> dir1(_("Documents|#o#O"),
|
|
|
|
from_utf8(lyxrc.document_path));
|
|
|
|
|
|
|
|
docstring const docpath = from_utf8(onlyPath(buffer().fileName()));
|
|
|
|
|
|
|
|
return browseRelFile(in_name, docpath, title,
|
|
|
|
filters, false, dir1);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
void GuiInclude::edit(string const & file)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 12:03:13 +00:00
|
|
|
string const ext = support::getExtension(file);
|
|
|
|
if (ext == "lyx")
|
|
|
|
dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file));
|
|
|
|
else
|
|
|
|
// tex file or other text file in verbatim mode
|
|
|
|
formats.edit(buffer(),
|
|
|
|
FileName(makeAbsPath(file, onlyPath(buffer().fileName()))),
|
|
|
|
"text");
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
|
|
|
|
Dialog * createGuiInclude(LyXView & lv) { return new GuiInclude(lv); }
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiInclude_moc.cpp"
|