]> git.lyx.org Git - lyx.git/commitdiff
make sure eol-style native is set and fix eol style
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 30 Jun 2006 14:50:44 +0000 (14:50 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 30 Jun 2006 14:50:44 +0000 (14:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14279 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/InsertTableWidget.C
src/frontends/qt4/InsertTableWidget.h

index 7b43f45bbd0c27aa4c3f2b6755b5eca46175bc76..61a9961fb4514d493d9221862ace2a479b1598ff 100644 (file)
-/**\r
- * \file InsertTableWidget.C\r
- *\r
- * This file is part of LyX, the document processor.\r
- * Licence details can be found in the file COPYING.\r
- *\r
- * \author Edwin Leuven\r
- *\r
- * Full author contact details are available in file CREDITS.\r
- */\r
-\r
-#include <config.h>\r
-\r
-#include "BufferView.h"        // needed for lyxfunc\r
-#include "lyxfunc.h"\r
-#include "FuncStatus.h"\r
-#include "funcrequest.h"\r
-#include "LyXView.h"\r
-\r
-#include "qt_helpers.h"\r
-\r
-#include "InsertTableWidget.h"\r
-#include <QMouseEvent>\r
-#include <QString>\r
-#include <QToolTip>\r
-#include <QPainter>\r
-\r
-\r
-namespace lyx {\r
-namespace frontend {\r
-\r
-InsertTableWidget::InsertTableWidget(LyXView & lyxView, QWidget * parent)\r
-       : QWidget(parent, Qt::Popup), colwidth_(20), rowheight_(12), lyxView_(lyxView)\r
-{\r
-       init();\r
-       setMouseTracking(true);\r
-}\r
-\r
-\r
-void InsertTableWidget::init()\r
-{\r
-       rows_ = 5;\r
-       cols_ = 5;\r
-       bottom_ = 0;\r
-       right_ = 0;\r
-       underMouse_ = false;\r
-}\r
-\r
-\r
-void InsertTableWidget::show(bool show)\r
-{\r
-       if (!show)\r
-               return;\r
-\r
-       init();\r
-       resetGeometry();\r
-       setVisible(true);\r
-        // emit signal\r
-       visible(true);\r
-}\r
-\r
-\r
-void InsertTableWidget::resetGeometry()\r
-{\r
-       QPoint p = parentWidget()->mapToGlobal(parentWidget()->geometry().bottomLeft());\r
-       setGeometry(p.x() - parentWidget()->pos().x(), \r
-                               p.y() - parentWidget()->pos().y(),\r
-                               cols_ * colwidth_ + 1, rows_ * rowheight_ + 1);\r
-}\r
-\r
-\r
-void InsertTableWidget::mouseMoveEvent(QMouseEvent * event)\r
-{\r
-       // do this ourselves because when the mouse leaves the app\r
-       // we get an enter event (ie underMouse() is true)!!\r
-       underMouse_ = geometry().contains(event->globalPos());\r
-       if (!underMouse_) {\r
-               bottom_ = 0;\r
-               right_ = 0;\r
-               update();\r
-               return;\r
-       }\r
-\r
-       int const r0 = right_;\r
-       int const b0 = bottom_;\r
-       right_ = event->x() / colwidth_ + 1;\r
-       bottom_ = event->y() / rowheight_ + 1;\r
-\r
-       if (bottom_ == rows_) {\r
-               ++rows_;\r
-               resetGeometry();\r
-       }\r
-\r
-       if (right_ == cols_) {\r
-               ++cols_;\r
-               resetGeometry();\r
-       }\r
-\r
-       if (bottom_ != b0 || right_ != r0) {\r
-               update();\r
-               QString const status = QString("%1x%2").arg(bottom_).arg(right_);\r
-               QToolTip::showText(event->globalPos(), status , this);\r
-       }\r
-}\r
-\r
-\r
-void InsertTableWidget::mouseReleaseEvent(QMouseEvent * event)\r
-{\r
-       if (underMouse_) {\r
-               QString const data = QString("%1 %2").arg(bottom_).arg(right_);\r
-               lyxView_.getLyXFunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));\r
-       }\r
-        // emit signal\r
-       visible(false);\r
-       close();\r
-}\r
-\r
-\r
-void InsertTableWidget::mousePressEvent(QMouseEvent * event)\r
-{\r
-       // swallow this one\r
-}\r
-\r
-\r
-void InsertTableWidget::paintEvent(QPaintEvent * event)\r
-{\r
-       drawGrid(rows_, cols_, Qt::white);\r
-       if (underMouse_)\r
-               drawGrid(bottom_, right_, Qt::darkBlue);\r
-}\r
-\r
-\r
-void InsertTableWidget::drawGrid(int const rows, int const cols, Qt::GlobalColor const color)\r
-{\r
-       QPainter painter(this);\r
-       painter.setPen(Qt::darkGray);\r
-       painter.setBrush(color);\r
-\r
-       for (int r = 0 ; r < rows ; ++r ) {\r
-               for (int c = 0 ; c < cols ; ++c ) {\r
-                       QRect rectangle(c * colwidth_, r * rowheight_, colwidth_, rowheight_);\r
-                       painter.drawRect(rectangle);\r
-               }\r
-       }\r
-}\r
-\r
-\r
-void InsertTableWidget::updateParent()\r
-{\r
-       bool status = lyxView_.getLyXFunc().getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();\r
-       parentWidget()->setEnabled(status);\r
-}\r
-\r
-\r
-} // namespace frontend\r
-} // namespace lyx\r
-\r
-#include "InsertTableWidget_moc.cpp"\r
+/**
+ * \file InsertTableWidget.C
+ *
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "BufferView.h"        // needed for lyxfunc
+#include "lyxfunc.h"
+#include "FuncStatus.h"
+#include "funcrequest.h"
+#include "LyXView.h"
+
+#include "qt_helpers.h"
+
+#include "InsertTableWidget.h"
+#include <QMouseEvent>
+#include <QString>
+#include <QToolTip>
+#include <QPainter>
+
+
+namespace lyx {
+namespace frontend {
+
+InsertTableWidget::InsertTableWidget(LyXView & lyxView, QWidget * parent)
+       : QWidget(parent, Qt::Popup), colwidth_(20), rowheight_(12), lyxView_(lyxView)
+{
+       init();
+       setMouseTracking(true);
+}
+
+
+void InsertTableWidget::init()
+{
+       rows_ = 5;
+       cols_ = 5;
+       bottom_ = 0;
+       right_ = 0;
+       underMouse_ = false;
+}
+
+
+void InsertTableWidget::show(bool show)
+{
+       if (!show)
+               return;
+
+       init();
+       resetGeometry();
+       setVisible(true);
+        // emit signal
+       visible(true);
+}
+
+
+void InsertTableWidget::resetGeometry()
+{
+       QPoint p = parentWidget()->mapToGlobal(parentWidget()->geometry().bottomLeft());
+       setGeometry(p.x() - parentWidget()->pos().x(), 
+                               p.y() - parentWidget()->pos().y(),
+                               cols_ * colwidth_ + 1, rows_ * rowheight_ + 1);
+}
+
+
+void InsertTableWidget::mouseMoveEvent(QMouseEvent * event)
+{
+       // do this ourselves because when the mouse leaves the app
+       // we get an enter event (ie underMouse() is true)!!
+       underMouse_ = geometry().contains(event->globalPos());
+       if (!underMouse_) {
+               bottom_ = 0;
+               right_ = 0;
+               update();
+               return;
+       }
+
+       int const r0 = right_;
+       int const b0 = bottom_;
+       right_ = event->x() / colwidth_ + 1;
+       bottom_ = event->y() / rowheight_ + 1;
+
+       if (bottom_ == rows_) {
+               ++rows_;
+               resetGeometry();
+       }
+
+       if (right_ == cols_) {
+               ++cols_;
+               resetGeometry();
+       }
+
+       if (bottom_ != b0 || right_ != r0) {
+               update();
+               QString const status = QString("%1x%2").arg(bottom_).arg(right_);
+               QToolTip::showText(event->globalPos(), status , this);
+       }
+}
+
+
+void InsertTableWidget::mouseReleaseEvent(QMouseEvent * event)
+{
+       if (underMouse_) {
+               QString const data = QString("%1 %2").arg(bottom_).arg(right_);
+               lyxView_.getLyXFunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
+       }
+        // emit signal
+       visible(false);
+       close();
+}
+
+
+void InsertTableWidget::mousePressEvent(QMouseEvent * event)
+{
+       // swallow this one
+}
+
+
+void InsertTableWidget::paintEvent(QPaintEvent * event)
+{
+       drawGrid(rows_, cols_, Qt::white);
+       if (underMouse_)
+               drawGrid(bottom_, right_, Qt::darkBlue);
+}
+
+
+void InsertTableWidget::drawGrid(int const rows, int const cols, Qt::GlobalColor const color)
+{
+       QPainter painter(this);
+       painter.setPen(Qt::darkGray);
+       painter.setBrush(color);
+
+       for (int r = 0 ; r < rows ; ++r ) {
+               for (int c = 0 ; c < cols ; ++c ) {
+                       QRect rectangle(c * colwidth_, r * rowheight_, colwidth_, rowheight_);
+                       painter.drawRect(rectangle);
+               }
+       }
+}
+
+
+void InsertTableWidget::updateParent()
+{
+       bool status = lyxView_.getLyXFunc().getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();
+       parentWidget()->setEnabled(status);
+}
+
+
+} // namespace frontend
+} // namespace lyx
+
+#include "InsertTableWidget_moc.cpp"
index 311b4f928856fbfc4e45aedf2b258add07fb1d42..6c78c6960870d58d2a7cd5fd296fd37a365f7a80 100644 (file)
@@ -1,74 +1,74 @@
-// -*- C++ -*-\r
-/**\r
- * \file InsertTableWidget.h\r
- * This file is part of LyX, the document processor.\r
- * Licence details can be found in the file COPYING.\r
- *\r
- * \author Edwin Leuven\r
- *\r
- * Full author contact details are available in file CREDITS.\r
- */\r
-\r
-\r
-#ifndef INSERTTABLEWIDGET_H\r
-#define INSERTTABLEWIDGET_H\r
-\r
-#include "frontends/LyXView.h"\r
-#include <QWidget>\r
-\r
-namespace lyx {\r
-namespace frontend {\r
-\r
-\r
-class InsertTableWidget : public QWidget {\r
-       Q_OBJECT\r
-public:\r
-\r
-       InsertTableWidget(LyXView &, QWidget *);\r
-\r
-Q_SIGNALS:\r
-       //! widget is visible\r
-       void visible(bool);\r
-\r
-public Q_SLOTS:\r
-       //! show the widget\r
-       void show(bool);\r
-       //! enable/disable parent\r
-       void updateParent();\r
-\r
-protected Q_SLOTS:\r
-       void mouseMoveEvent(QMouseEvent *);\r
-       void mouseReleaseEvent(QMouseEvent *);\r
-       void mousePressEvent(QMouseEvent *);\r
-       void paintEvent(QPaintEvent *);\r
-       \r
-private:\r
-       //! update the geometry\r
-       void resetGeometry();\r
-       //! initialize parameters to default values\r
-       void init();\r
-       //! draw the grid\r
-       void drawGrid(int rows, int cols, Qt::GlobalColor color);\r
-\r
-       //! colwidth in pixels\r
-       int colwidth_;\r
-       //! rowheight in pixels\r
-       int rowheight_;\r
-       //! total rows\r
-       int rows_;\r
-       //! total cols\r
-       int cols_;\r
-       //! row of pointer\r
-       int bottom_;\r
-       //! column of pointer\r
-       int right_;     \r
-       //! the lyxview we need to dispatch the funcrequest\r
-       LyXView & lyxView_;\r
-       //! widget under mouse\r
-       bool underMouse_;\r
-};\r
-\r
-} // namespace frontend\r
-} // namespace lyx\r
-\r
-#endif // INSERTTABLEWIDGET_H\r
+// -*- C++ -*-
+/**
+ * \file InsertTableWidget.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+
+#ifndef INSERTTABLEWIDGET_H
+#define INSERTTABLEWIDGET_H
+
+#include "frontends/LyXView.h"
+#include <QWidget>
+
+namespace lyx {
+namespace frontend {
+
+
+class InsertTableWidget : public QWidget {
+       Q_OBJECT
+public:
+
+       InsertTableWidget(LyXView &, QWidget *);
+
+Q_SIGNALS:
+       //! widget is visible
+       void visible(bool);
+
+public Q_SLOTS:
+       //! show the widget
+       void show(bool);
+       //! enable/disable parent
+       void updateParent();
+
+protected Q_SLOTS:
+       void mouseMoveEvent(QMouseEvent *);
+       void mouseReleaseEvent(QMouseEvent *);
+       void mousePressEvent(QMouseEvent *);
+       void paintEvent(QPaintEvent *);
+       
+private:
+       //! update the geometry
+       void resetGeometry();
+       //! initialize parameters to default values
+       void init();
+       //! draw the grid
+       void drawGrid(int rows, int cols, Qt::GlobalColor color);
+
+       //! colwidth in pixels
+       int colwidth_;
+       //! rowheight in pixels
+       int rowheight_;
+       //! total rows
+       int rows_;
+       //! total cols
+       int cols_;
+       //! row of pointer
+       int bottom_;
+       //! column of pointer
+       int right_;     
+       //! the lyxview we need to dispatch the funcrequest
+       LyXView & lyxView_;
+       //! widget under mouse
+       bool underMouse_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // INSERTTABLEWIDGET_H