1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 2000, Vrije Universiteit Amsterdam and University of Twente.
5
// Author: Frank Dehne (frank@cs.vu.nl).
6
// Author: Henk van de Zandschulp (henkz@cs.utwente.nl).
8
// TCM is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
13
// TCM is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with TCM; if not, write to the Free Software Foundation, Inc.,
20
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
//-----------------------------------------------------------------------------
24
#include "cbupdateactortypecmd.h"
26
#include "ssddoubleclassbox.h" // compatibility
27
#include "ssdtripleclassbox.h" // compatibility
28
#include "ssdupdateclassboxpropertycmd.h"
29
#include "updatemessagedirectioncmd.h"
30
#include "cbdmessage.h"
32
CBViewer::CBViewer(Config *c, CBWindow *w): ERViewer(c, w) { }
34
Command *CBViewer::Drag(int x, int y) {
36
double x1 = GetScaler()->ScaleCorrect(x);
37
double y1 = GetScaler()->ScaleCorrect(y);
38
// do note allow moving messages
39
if ((textShape = GetCurView()->HitTextShape(static_cast<int>(0.5 + x1),
40
static_cast<int>(0.5 + y1), False))) {
41
Subject *subj = textShape->GetParent()->GetSubject();
43
if ((*textShape->GetDescription() == "Message") &&
44
((subj->GetClassType() == Code::CBD_CLASS_LINK_EDGE) ||
45
(subj->GetClassType() == Code::CBD_OBJECT_LINK_EDGE))) {
46
SetStatus("aborted: message can not be dragged");
50
return ERViewer::Drag(x,y);
53
void CBViewer::UpdateNodeShapeType(int actorType) {
54
SetStatus("action: Update actor type");
56
t.add(new int(Code::UCD_SINGLE_CLASS_BOX));
57
t.add(new int(Code::STICKMAN));
58
if (GetCurView()->NrSelected() > 0) {
59
NewCommand(new CBUpdateActorTypeCmd(
60
GetCurView(), &t, actorType));
64
EmptySelectionMessage();
69
void CBViewer::UpdateShowStereotypes(bool b) {
71
SetStatus("action: show stereotypes");
73
SetStatus("action: hide stereotypes");
74
if (GetCurView()->NrSelected() > 0) {
75
NewCommand(new SSDUpdateClassBoxPropertyCmd(
77
SSDUpdateClassBoxPropertyCmd::STEREOTYPE, b));
81
EmptySelectionMessage();
85
void CBViewer::UpdateShowProperties(bool b) {
87
SetStatus("action: show properties");
89
SetStatus("action: hide properties");
90
if (GetCurView()->NrSelected() > 0) {
91
NewCommand(new SSDUpdateClassBoxPropertyCmd(
93
SSDUpdateClassBoxPropertyCmd::PROPERTIES, b));
97
EmptySelectionMessage();
101
void CBViewer::UpdateMessageDirection(TextShape *t, CBDMessage *msg, int k,
102
ReadDirection::Type dir) {
103
SetStatus("action: Update message direction");
104
if (GetCurView()->NrSelected() > 0) {
105
NewCommand(new UpdateMessageDirectionCmd(GetCurView(), t, msg, k, dir));
109
EmptySelectionMessage();