Dialog.cpp   Dialog.cpp 
skipping to change at line 17 skipping to change at line 17
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <QDebug> #include <QDebug>
#include "Dialog.hpp" #include "Dialog.hpp"
#include "StelMainWindow.hpp"
void BarFrame::mousePressEvent(QMouseEvent *event) void BarFrame::mousePressEvent(QMouseEvent *event)
{ {
mousePos = event->pos(); mousePos = event->pos();
moving = true; moving = true;
} }
void BarFrame::mouseReleaseEvent(QMouseEvent *) void BarFrame::mouseReleaseEvent(QMouseEvent *)
{ {
moving = false; moving = false;
} }
void BarFrame::mouseMoveEvent(QMouseEvent *event) void BarFrame::mouseMoveEvent(QMouseEvent *event)
{ {
if (!moving) return; if (!moving) return;
QPoint dpos = event->pos() - mousePos; QPoint dpos = event->pos() - mousePos;
QWidget* p = dynamic_cast<QWidget*>(QFrame::parent()); QWidget* p = dynamic_cast<QWidget*>(QFrame::parent());
p->move(p->pos() + dpos); QPoint targetPos = p->pos() + dpos;
// Prevent the title bar from being dragged to an unreachable positi
on.
StelMainWindow& mainWindow = StelMainWindow::getInstance();
int leftBoundX = 10 - width();
int rightBoundX = mainWindow.width() - 10;
if (targetPos.x() < leftBoundX)
targetPos.setX(leftBoundX);
else if (targetPos.x() > rightBoundX)
targetPos.setX(rightBoundX);
int lowerBoundY = mainWindow.height() - height();
if (targetPos.y() < 0)
targetPos.setY(0);
else if (targetPos.y() > lowerBoundY)
targetPos.setY(lowerBoundY);
p->move(targetPos);
} }
void ResizeFrame::mouseMoveEvent(QMouseEvent *event) void ResizeFrame::mouseMoveEvent(QMouseEvent *event)
{ {
QPoint dpos = event->pos() - mousePos; QPoint dpos = event->pos() - mousePos;
QWidget* p = dynamic_cast<QWidget*>(QFrame::parent()->parent()); QWidget* p = dynamic_cast<QWidget*>(QFrame::parent()->parent());
int w = p->size().width(); int w = p->size().width();
int h = p->size().height(); int h = p->size().height();
int minw; int minw;
int minh; int minh;
 End of changes. 3 change blocks. 
2 lines changed or deleted 21 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/