1
////////////////////////////////////////////////////////////////////////////////
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1995, 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
////////////////////////////////////////////////////////////////////////////////
25
#include "selectareacmd.h"
26
#include "sizeshapecmd.h"
27
#include "draghandlecmd.h"
28
#include "dragshapescmd.h"
29
#include "dragstlabelcmd.h"
30
#include "draghlinecmd.h"
31
#include "transitionarrow.h"
32
#include "nodeshape.h"
34
STViewer::STViewer(Config *c, STWindow *d): DiagramViewer(c, d) { }
36
TransitionArrow *STViewer::HitHLine(int x, int y) {
37
List<GShape *> *shapes = GetCurView()->GetShapes();
38
for (shapes->first(); !shapes->done(); shapes->next()) {
39
GShape *shape = shapes->cur();
40
if (shape->GetClassType()==Code::TRANSITION_ARROW &&
42
TransitionArrow *h = (TransitionArrow *)shape;
43
if (h->HitHLine(x, y))
50
Command *STViewer::Drag(int x, int y) {
51
double x1 = GetScaler()->ScaleCorrect(x);
52
double y1 = GetScaler()->ScaleCorrect(y);
55
if ((line = GetCurView()->HitLineHandle(static_cast<int>(0.5 + x1),
56
static_cast<int>(0.5 + y1), w)))
57
return new DragHandleCmd(line, w);
59
if ((textShape = GetCurView()->HitTextShape(static_cast<int>(0.5 + x1),
60
static_cast<int>(0.5 + y1))))
61
return new DragSTLabelCmd(textShape);
62
// look for horizontal transition line to drag.
64
if ((shape = HitHLine(static_cast<int>(0.5 + x1),
65
static_cast<int>(0.5 + y1))))
66
return new DragHLineCmd((TransitionArrow *)shape);
67
return DiagramViewer::Drag(x, y);
69
// look for nodes shapes.
70
// else if ((shape = curView->HitNodeShape(x, y))) {
71
// if (shape->IsSelected() && (w = shape->HitHandles(x, y)) >= 0)
72
// return new SizeShapeCenterCmd(shape, w);
73
// else if (shape->IsSelected() && curView->NrSelected() > 1)
74
// return new DragShapesCmd(curView);
76
// return new DragShapeCmd(shape);
79
// return new SelectAreaCmd(GetCurView());