2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiRef.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.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIREF_H
|
|
|
|
#define GUIREF_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiDialogView.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
#include "ControlRef.h"
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_RefUi.h"
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
|
|
#include <QDialog>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
class QListWidgetItem;
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiRef;
|
2007-04-25 10:57:54 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiRefDialog : public QDialog, public Ui::RefUi {
|
2007-04-25 10:57:54 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiRefDialog(GuiRef * form);
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
|
|
virtual void show();
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void changed_adaptor();
|
|
|
|
void gotoClicked();
|
|
|
|
void refHighlighted(QListWidgetItem *);
|
|
|
|
void selectionChanged();
|
|
|
|
void refSelected(QListWidgetItem *);
|
|
|
|
void sortToggled(bool);
|
|
|
|
void updateClicked();
|
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void reset_dialog();
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent * e);
|
|
|
|
private:
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiRef * form_;
|
2007-04-25 10:57:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
class GuiRef : public GuiView<GuiRefDialog>
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-31 05:53:55 +00:00
|
|
|
friend class GuiRefDialog;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
GuiRef(GuiDialog &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
/// parent controller
|
|
|
|
ControlRef & controller()
|
|
|
|
{ return static_cast<ControlRef &>(this->getController()); }
|
|
|
|
/// parent controller
|
|
|
|
ControlRef const & controller() const
|
|
|
|
{ return static_cast<ControlRef const &>(this->getController()); }
|
2006-03-05 17:24:44 +00:00
|
|
|
protected:
|
|
|
|
virtual bool isValid();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// apply changes
|
|
|
|
virtual void apply();
|
|
|
|
/// build dialog
|
|
|
|
virtual void build_dialog();
|
|
|
|
/// update dialog
|
|
|
|
virtual void update_contents();
|
|
|
|
|
|
|
|
/// is name allowed for this ?
|
|
|
|
bool nameAllowed();
|
|
|
|
/// is type allowed for this ?
|
|
|
|
bool typeAllowed();
|
|
|
|
/// go to current reference
|
|
|
|
void gotoRef();
|
|
|
|
/// set go back button
|
|
|
|
void setGoBack();
|
|
|
|
/// set goto ref button
|
|
|
|
void setGotoRef();
|
|
|
|
/// re-enter references
|
|
|
|
void redoRefs();
|
|
|
|
/// update references
|
|
|
|
void updateRefs();
|
|
|
|
|
|
|
|
/// sort or not persistent state
|
|
|
|
bool sort_;
|
2007-04-24 22:10:56 +00:00
|
|
|
/// went to a reference ?
|
2006-03-05 17:24:44 +00:00
|
|
|
bool at_ref_;
|
2007-04-24 22:10:56 +00:00
|
|
|
/// the last reference entered or examined
|
|
|
|
QString last_reference_;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// store the buffer settings
|
|
|
|
int restored_buffer_;
|
|
|
|
/// the references
|
2007-04-25 16:39:21 +00:00
|
|
|
std::vector<docstring> refs_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIREF_H
|