using namespace lyx::support;
-//namespace lyx {
+namespace lyx {
FloatPlacement::FloatPlacement(QWidget *)
{
}
}
-//} // namespace lyx
+} // namespace lyx
#include "FloatPlacement_moc.cpp"
// -*- C++ -*-
/**
- * \file floatplacement.h
+ * \file FloatPlacement.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* Full author contact details are available in file CREDITS.
*/
-#ifndef QT_FLOATPLACEMENT_H
-#define QT_FLOATPLACEMENT_H
+#ifndef FLOATPLACEMENT_H
+#define FLOATPLACEMENT_H
#include "ui_FloatPlacementUi.h"
#include <QWidget>
#include <string>
-namespace lyx { class InsetFloatParams; }
+namespace lyx {
+
+class InsetFloatParams;
class FloatPlacement : public QWidget, public Ui::FloatPlacementUi {
Q_OBJECT
};
+} // namespace lyx
-//} // namespace lyx
-
-#endif
+#endif // FLOATPLACEMENT_H
#include "GuiApplication.h"
#include "GuiBranches.h"
+#include "GuiSelectionManager.h"
#include "LaTeXHighlighter.h"
#include "LengthCombo.h"
#include "PanelStack.h"
: public binary_function<string, string, int>
{
public:
- int operator()(string const & lhs, string const & rhs) const
+ bool operator()(string const & lhs, string const & rhs) const
{
// Ordering criteria:
// 1. Availability of text class
}
namespace frontend {
-
-
-///
-QModelIndex getSelectedIndex(QListView * lv)
-{
- QModelIndex retval = QModelIndex();
- QModelIndexList selIdx =
- lv->selectionModel()->selectedIndexes();
- if (!selIdx.empty())
- retval = selIdx.first();
- return retval;
-}
-
-
namespace {
vector<string> getRequiredList(string const & modName)
//
/////////////////////////////////////////////////////////////////////
-ModuleSelectionManager::ModuleSelectionManager(
- QListView * availableLV,
- QListView * selectedLV,
- QPushButton * addPB,
- QPushButton * delPB,
- QPushButton * upPB,
- QPushButton * downPB,
- GuiIdListModel * availableModel,
- GuiIdListModel * selectedModel) :
-GuiSelectionManager(availableLV, selectedLV, addPB, delPB,
+/// SelectionManager for use with modules
+class ModuleSelectionManager : public GuiSelectionManager
+{
+public:
+ ModuleSelectionManager(
+ QListView * availableLV,
+ QListView * selectedLV,
+ QPushButton * addPB,
+ QPushButton * delPB,
+ QPushButton * upPB,
+ QPushButton * downPB,
+ GuiIdListModel * availableModel,
+ GuiIdListModel * selectedModel)
+ : GuiSelectionManager(availableLV, selectedLV, addPB, delPB,
upPB, downPB, availableModel, selectedModel)
-{}
+ {}
+private:
+ ///
+ virtual void updateAddPB();
+ ///
+ virtual void updateUpPB();
+ ///
+ virtual void updateDownPB();
+ ///
+ virtual void updateDelPB();
+ /// returns availableModel as a GuiIdListModel
+ GuiIdListModel * getAvailableModel()
+ {
+ return dynamic_cast<GuiIdListModel *>(availableModel);
+ }
+ /// returns selectedModel as a GuiIdListModel
+ GuiIdListModel * getSelectedModel()
+ {
+ return dynamic_cast<GuiIdListModel *>(selectedModel);
+ }
+};
+
void ModuleSelectionManager::updateAddPB()
{
int const arows = availableModel->rowCount();
#include "BulletsModule.h"
#include "GuiDialog.h"
#include "GuiIdListModel.h"
-#include "GuiSelectionManager.h"
#include "ui_DocumentUi.h"
#include "ui_FontUi.h"
#include <map>
#include <vector>
-class FloatPlacement;
-
namespace lyx {
class BufferParams;
+class FloatPlacement;
class TextClass;
namespace frontend {
class GuiBranches;
+class GuiSelectionManager;
class PreambleModule;
-///
-QModelIndex getSelectedIndex(QListView * lv);
-
///
typedef void const * BufferId;
};
-/// SelectionManager for use with modules
-class ModuleSelectionManager : public GuiSelectionManager
-{
-public:
- ModuleSelectionManager(
- QListView * availableLV,
- QListView * selectedLV,
- QPushButton * addPB,
- QPushButton * delPB,
- QPushButton * upPB,
- QPushButton * downPB,
- GuiIdListModel * availableModel,
- GuiIdListModel * selectedModel);
-private:
- ///
- virtual void updateAddPB();
- ///
- virtual void updateUpPB();
- ///
- virtual void updateDownPB();
- ///
- virtual void updateDelPB();
- /// returns availableModel as a GuiIdListModel
- GuiIdListModel * getAvailableModel()
- {
- return dynamic_cast<GuiIdListModel *>(availableModel);
- }
- /// returns selectedModel as a GuiIdListModel
- GuiIdListModel * getSelectedModel()
- {
- return dynamic_cast<GuiIdListModel *>(selectedModel);
- }
-};
-
-
class GuiDocument : public GuiDialog, public Ui::DocumentUi
{
Q_OBJECT
*/
#include <config.h>
+
#include "GuiSelectionManager.h"
-#include "GuiDocument.h"
#include "support/debug.h"
-using std::vector;
+#include <QKeyEvent>
+#include <QListView>
+#include <QPushButton>
+#include <QAbstractListModel>
+
namespace lyx {
namespace frontend {
-
GuiSelectionManager::GuiSelectionManager(
QListView * avail,
QListView * sel,
void GuiSelectionManager::addPB_clicked()
{
- QModelIndex const idxToAdd = getSelectedIndex(availableLV);
- if (!idxToAdd.isValid())
+ QModelIndexList selIdx =
+ availableLV->selectionModel()->selectedIndexes();
+ if (selIdx.isEmpty())
return;
+
+ QModelIndex const idxToAdd = selectedLV->currentIndex();
QModelIndex const idx = selectedLV->currentIndex();
int const srows = selectedModel->rowCount();
insertRowToSelected(srows, qm);
selectionChanged(); //signal
-
+
if (idx.isValid())
selectedLV->setCurrentIndex(idx);
void GuiSelectionManager::deletePB_clicked()
{
- QModelIndex idx = getSelectedIndex(selectedLV);
- if (!idx.isValid())
+ QModelIndexList selIdx =
+ selectedLV->selectionModel()->selectedIndexes();
+ if (selIdx.isEmpty())
return;
-
+ QModelIndex idx = selIdx.first();
selectedModel->removeRow(idx.row());
selectionChanged(); //signal
if (keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) {
if (!keyModifiers)
addPB_clicked();
- else if ((keyModifiers == Qt::ControlModifier) ||
- (keyModifiers == Qt::KeypadModifier) ||
- (keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier))
- ) {
+ else if (keyModifiers == Qt::ControlModifier ||
+ keyModifiers == Qt::KeypadModifier ||
+ keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier)) {
if (addPB->isEnabled()) {
addPB_clicked();
okHook(); //signal
#ifndef GUISELECTIONMANAGER_H
#define GUISELECTIONMANAGER_H
-#include "Dialog.h"
-
#include <QObject>
-#include <QKeyEvent>
-#include <QStringList>
-#include <QAbstractListModel>
-#include <QListView>
-#include <QPushButton>
-
-#include "support/qstring_helpers.h"
-#include <vector>
+class QAbstractListModel;
+class QModelIndex;
+class QListView;
+class QPushButton;
+class QVariant;
+template <class T, class U> class QMap;
namespace lyx {
namespace frontend {
*/
class GuiSelectionManager : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
///
bool selectedFocused() { return selectedHasFocus_; };
Q_SIGNALS:
- ///Emitted when the list of selected items has changed.
+ /// Emitted when the list of selected items has changed.
void selectionChanged();
- ///Emitted when something has changed that might lead the containing
- ///dialog to want to update---the focused subwidget or selected item.
- ///(Specifically, it is emitted by *_PB_clicked() and *_LV_clicked.)
- ///NOTE: No automatic update of the button state is done here. If you
- ///just want to do that, connect updateHook() to updateView(). Much of the
- ///time, though, you will want to do a bit more processing first, so
- ///you can connect to some other function that itself calls updateView().
+ /// Emitted when something has changed that might lead the containing
+ /// dialog to want to update---the focused subwidget or selected item.
+ /// (Specifically, it is emitted by *_PB_clicked() and *_LV_clicked.)
+ /// NOTE: No automatic update of the button state is done here. If you
+ /// just want to do that, connect updateHook() to updateView(). Much of the
+ /// time, though, you will want to do a bit more processing first, so
+ /// you can connect to some other function that itself calls updateView().
void updateHook();
- ///Emitted on Ctrl-Enter in the availableLV. Intended to be connected
- ///to an "OK" event in the parent dialog.
+ /// Emitted on Ctrl-Enter in the availableLV. Intended to be connected
+ /// to an "OK" event in the parent dialog.
void okHook();
protected:
- ///Given a QModelIndex from availableLV, determines whether it has
- ///been selected (i.e., is also in selectedLV).
+ /// Given a QModelIndex from availableLV, determines whether it has
+ /// been selected (i.e., is also in selectedLV).
bool isSelected(const QModelIndex & idx);
///
bool insertRowToSelected(int i, QMap<int, QVariant> const & itemData);
<number>6</number>
</property>
<item>
- <widget class="FloatPlacement" name="floatFP" />
+ <widget class="lyx::FloatPlacement" name="floatFP" />
</item>
<item>
<layout class="QHBoxLayout" >