1
////////////////////////////////////////////////////////////////////////////////
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
////////////////////////////////////////////////////////////////////////////////
22
#include "tableviewer.h"
26
#include "dragrowcmd.h"
28
DragRowCmd::DragRowCmd(Table *t, TableViewer *v, LinePiece *l): DragCmd(t, v) {
29
GetMainWindow()->SetCursor(MouseCursor::V_DOUBLE_ARROW);
30
SetOldPosition(l->GetBegin());
31
// find the row to be resized.
32
Point tmp = *GetOldPosition();
33
int f = v->HitRow(tmp.x+1, tmp.y-1);
42
oldSize = row->GetHeight();
45
void DragRowCmd::Execute() {
47
int newSize = oldSize + GetDelta()->y;
48
GetTableViewer()->ResizeRow(row, newSize);
52
GetMainWindow()->SetStatus("aborted: drag row");
57
void DragRowCmd::UnExecute() {
59
GetTableViewer()->ResizeRow(row, oldSize);
63
GetMainWindow()->SetStatus("aborted: undo drag row");
66
void DragRowCmd::DrawOutLine(const Point *d) {
67
Point p = ScaleCorrect(d);
68
Point pt1 = *GetOldPosition() + p;
70
pt1.x = GetTableViewer()->GetTopLeft()->x;
71
pt2.x = GetTableViewer()->GetTopLeft()->x +
72
GetTableViewer()->GetWidth();
73
GetGrafport()->SetLineWidth(1);
74
GetGrafport()->SetLineStyle(LineStyle::DOTTED);
75
GetGrafport()->DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);