2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiInclude.h
|
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
|
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIINCLUDE_H
|
|
|
|
#define GUIINCLUDE_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "GuiDialog.h"
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_IncludeUi.h"
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-10-06 12:03:13 +00:00
|
|
|
#include "insets/InsetCommandParams.h"
|
|
|
|
|
|
|
|
#include "support/docstring.h"
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-23 15:58:10 +00:00
|
|
|
//FIXME This could, and therefore probably should, inherit from
|
|
|
|
//GuiCommand.
|
2007-10-09 19:34:27 +00:00
|
|
|
class GuiInclude : public GuiDialog, public Ui::IncludeUi
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-04-25 10:57:54 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public:
|
2007-10-06 12:03:13 +00:00
|
|
|
GuiInclude(LyXView & lv);
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void change_adaptor();
|
2007-10-06 12:03:13 +00:00
|
|
|
/// edit the child document, .lyx file will be opened in lyx
|
|
|
|
/// other formats will be edited by external applications.
|
|
|
|
void edit();
|
|
|
|
/// browse for a file
|
|
|
|
void browse();
|
|
|
|
///
|
2007-09-05 20:33:29 +00:00
|
|
|
void typeChanged(int v);
|
2007-07-27 18:17:00 +00:00
|
|
|
/// AFAIK, QValidator only works for QLineEdit so
|
|
|
|
/// I have to validate listingsED (QTextEdit) manually.
|
|
|
|
/// This function displays a hint or error message returned by
|
|
|
|
/// validate_listings_params
|
|
|
|
void set_listings_msg();
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private:
|
|
|
|
void closeEvent(QCloseEvent * e);
|
2006-03-05 17:24:44 +00:00
|
|
|
///
|
2007-09-05 20:33:29 +00:00
|
|
|
void updateLists();
|
|
|
|
/// validate listings parameters and return an error message, if any
|
|
|
|
docstring validate_listings_params();
|
2007-10-06 12:03:13 +00:00
|
|
|
///
|
|
|
|
void edit(std::string const & file);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool isValid();
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Apply changes
|
2007-09-05 20:33:29 +00:00
|
|
|
void applyView();
|
2006-03-05 17:24:44 +00:00
|
|
|
/// update
|
2007-09-11 18:33:42 +00:00
|
|
|
void updateContents();
|
2007-10-06 12:03:13 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
enum Type {
|
|
|
|
///
|
|
|
|
INPUT,
|
|
|
|
///
|
|
|
|
VERBATIM,
|
|
|
|
///
|
|
|
|
INCLUDE,
|
|
|
|
///
|
|
|
|
LISTINGS,
|
|
|
|
};
|
|
|
|
|
|
|
|
///
|
|
|
|
bool initialiseParams(std::string const & data);
|
|
|
|
/// clean-up on hide.
|
|
|
|
void clearParams();
|
|
|
|
/// clean-up on hide.
|
|
|
|
void dispatchParams();
|
|
|
|
///
|
|
|
|
bool isBufferDependent() const { return true; }
|
|
|
|
|
|
|
|
/// Browse for a file
|
|
|
|
docstring browse(docstring const &, Type) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
InsetCommandParams params_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIINCLUDE_H
|