~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to umbrello/umbrello/worktoolbar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *   the Free Software Foundation; either version 2 of the License, or     *
6
6
 *   (at your option) any later version.                                   *
7
7
 *                                                                         *
8
 
 *   copyright (C) 2002-2007                                               *
 
8
 *   copyright (C) 2002-2008                                               *
9
9
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
10
10
 ***************************************************************************/
11
11
 
13
13
#include "worktoolbar.h"
14
14
 
15
15
// qt/kde include files
16
 
#include <qmainwindow.h>
 
16
#include <QtGui/QAction>
 
17
#include <Q3MainWindow>
 
18
#include <QtGui/QToolButton>
17
19
#include <kdebug.h>
18
20
#include <klocale.h>
19
 
#include <kstandarddirs.h>
20
 
#include <ktoolbarbutton.h>
21
21
 
22
22
// application specific includes
23
23
#include "uml.h"
24
24
#include "umldoc.h"
25
25
#include "umlview.h"
26
 
#include "worktoolbar.h"
27
 
 
28
 
 
29
 
WorkToolBar::WorkToolBar(QMainWindow *parentWindow, const char*name)
30
 
        : KToolBar(parentWindow,Qt::DockRight,false,name) {
 
26
#include "icon_utils.h"
 
27
 
 
28
 
 
29
WorkToolBar::WorkToolBar(QMainWindow *parentWindow)
 
30
        : KToolBar("worktoolbar", parentWindow, Qt::RightToolBarArea, false, true)
 
31
{
31
32
    m_CurrentButtonID = tbb_Undefined;
32
33
    loadPixmaps();
33
34
    m_Type = Uml::dt_Class; /* first time in just want it to load arrow,
34
35
                           needs anything but dt_Undefined  */
35
 
    setOrientation( Qt::Vertical );
36
 
    setVerticalStretchable( true );
 
36
    setOrientation(Qt::Vertical);
 
37
//     setVerticalStretchable( true );
37
38
    // initialize old tool map, everything starts with select tool (arrow)
38
 
    m_map.insert(Uml::dt_UseCase,tbb_Arrow);
39
 
    m_map.insert(Uml::dt_Collaboration,tbb_Arrow);
40
 
    m_map.insert(Uml::dt_Class,tbb_Arrow);
41
 
    m_map.insert(Uml::dt_Sequence,tbb_Arrow);
42
 
    m_map.insert(Uml::dt_State,tbb_Arrow);
43
 
    m_map.insert(Uml::dt_Activity,tbb_Arrow);
44
 
    m_map.insert(Uml::dt_Undefined,tbb_Arrow);
45
 
 
46
 
    slotCheckToolBar( Uml::dt_Undefined );
47
 
    connect( this, SIGNAL( released( int ) ), this, SLOT( buttonChanged (int ) ) );
48
 
}
49
 
 
50
 
WorkToolBar::~WorkToolBar() {
51
 
    disconnect(this, SIGNAL(released(int)),this,SLOT(buttonChanged(int)));
52
 
}
53
 
 
54
 
void WorkToolBar::insertHotBtn(ToolBar_Buttons tbb) {
55
 
    insertButton(m_ToolButtons[tbb].Symbol, tbb, true, m_ToolButtons[tbb].Label);
56
 
    setToggle(tbb, true);
57
 
}
58
 
 
59
 
void WorkToolBar::insertBasicAssociations()  {
 
39
    m_map.insert(Uml::dt_UseCase, tbb_Arrow);
 
40
    m_map.insert(Uml::dt_Collaboration, tbb_Arrow);
 
41
    m_map.insert(Uml::dt_Class, tbb_Arrow);
 
42
    m_map.insert(Uml::dt_Sequence, tbb_Arrow);
 
43
    m_map.insert(Uml::dt_State, tbb_Arrow);
 
44
    m_map.insert(Uml::dt_Activity, tbb_Arrow);
 
45
    m_map.insert(Uml::dt_Undefined, tbb_Arrow);
 
46
 
 
47
    slotCheckToolBar(Uml::dt_Undefined);
 
48
}
 
49
 
 
50
WorkToolBar::~WorkToolBar()
 
51
{
 
52
}
 
53
 
 
54
QAction* WorkToolBar::insertHotBtn(ToolBar_Buttons tbb)
 
55
{
 
56
    QAction* action = addAction(QIcon(m_ToolButtons[tbb].Symbol), m_ToolButtons[tbb].Label,
 
57
                                /*receiver*/this, /*member*/m_ToolButtons[tbb].Slot);
 
58
    m_actions[tbb] = action;
 
59
    action->setChecked(true);
 
60
    return action;
 
61
}
 
62
 
 
63
void WorkToolBar::insertBasicAssociations()
 
64
{
60
65
    insertHotBtn(tbb_Association);
61
66
    if (m_Type == Uml::dt_Class || m_Type == Uml::dt_UseCase) {
62
67
        insertHotBtn(tbb_UniAssociation);
65
70
    insertHotBtn(tbb_Generalization);
66
71
}
67
72
 
68
 
void WorkToolBar::slotCheckToolBar(Uml::Diagram_Type dt) {
69
 
    if ( dt == m_Type )
 
73
void WorkToolBar::slotCheckToolBar(Uml::Diagram_Type dt)
 
74
{
 
75
    if (dt == m_Type)
70
76
        return;
71
77
    clear();
72
78
    m_Type = dt;
73
79
 
74
 
    if ( m_Type == Uml::dt_Undefined )
 
80
    if (m_Type == Uml::dt_Undefined)
75
81
        return;
76
82
 
77
 
    //insert note, anchor and lines of text on all diagrams
78
 
    insertHotBtn(tbb_Arrow);
79
 
    toggleButton(tbb_Arrow);
 
83
    // insert note, anchor and lines of text on all diagrams
 
84
    QAction* action  = insertHotBtn(tbb_Arrow);
 
85
    action->setChecked(true);
80
86
    m_CurrentButtonID = tbb_Arrow;
81
87
 
82
88
    insertHotBtn(tbb_Note);
84
90
    insertHotBtn(tbb_Text);
85
91
    insertHotBtn(tbb_Box);
86
92
 
87
 
    //insert diagram specific tools
 
93
    // insert diagram specific tools
88
94
    switch (m_Type) {
89
95
    case Uml::dt_UseCase:
90
96
        insertHotBtn(tbb_Actor);
108
114
        insertHotBtn(tbb_Object);
109
115
        insertHotBtn(tbb_Seq_Message_Synchronous);
110
116
        insertHotBtn(tbb_Seq_Message_Asynchronous);
 
117
        insertHotBtn(tbb_Seq_Message_Found);
 
118
        insertHotBtn(tbb_Seq_Message_Lost);
 
119
        insertHotBtn(tbb_Seq_Combined_Fragment);
 
120
        insertHotBtn(tbb_Seq_Precondition);
111
121
        break;
112
122
 
113
123
    case Uml::dt_Collaboration:
133
143
        insertHotBtn(tbb_Initial_Activity);
134
144
        insertHotBtn(tbb_Activity);
135
145
        insertHotBtn(tbb_End_Activity);
 
146
        insertHotBtn(tbb_Final_Activity);
136
147
        insertHotBtn(tbb_Branch);
137
148
        insertHotBtn(tbb_Fork);
138
149
        insertHotBtn(tbb_Activity_Transition);
 
150
        insertHotBtn(tbb_Exception);
 
151
        insertHotBtn(tbb_PrePostCondition);
 
152
        insertHotBtn(tbb_Send_Signal);
 
153
        insertHotBtn(tbb_Accept_Signal);
 
154
        insertHotBtn(tbb_Accept_Time_Event);
 
155
        insertHotBtn(tbb_Region);
 
156
        insertHotBtn(tbb_Pin);
 
157
        insertHotBtn(tbb_Object_Node);
139
158
        break;
140
159
 
141
160
    case Uml::dt_Component:
155
174
 
156
175
    case Uml::dt_EntityRelationship:
157
176
        insertHotBtn(tbb_Entity);
 
177
        insertHotBtn(tbb_Category);
158
178
        insertHotBtn(tbb_Relationship);
 
179
        insertHotBtn(tbb_Category2Parent);
 
180
        insertHotBtn(tbb_Child2Category);
159
181
        break;
160
182
 
161
183
    default:
162
 
        kWarning() << "slotCheckToolBar() on unknown diagram type:"
163
 
        << m_Type << endl;
 
184
        uWarning() << "slotCheckToolBar() on unknown diagram type:" << m_Type;
164
185
        break;
165
186
    }
166
187
}
167
188
 
168
 
void WorkToolBar::buttonChanged(int b) {
 
189
void WorkToolBar::buttonChanged(int b)
 
190
{
169
191
    UMLView* view = UMLApp::app()->getCurrentView();
170
192
 
171
 
    //if trying to turn off arrow - stop it
 
193
    // if trying to turn off arrow - stop it
172
194
    ToolBar_Buttons tbb = (ToolBar_Buttons)b;
173
195
    if (tbb == tbb_Arrow && m_CurrentButtonID == tbb_Arrow) {
174
 
        toggleButton(tbb_Arrow);
 
196
        m_actions[tbb_Arrow]->toggle();
175
197
 
176
198
        // signal needed, in the case ( when switching diagrams ) that
177
199
        // Arrow Button gets activated, but the toolBarState of the Views may be different
178
 
        emit sigButtonChanged( m_CurrentButtonID );
 
200
        emit sigButtonChanged(m_CurrentButtonID);
179
201
 
180
 
        view->setCursor( currentCursor() );
 
202
        view->setCursor(currentCursor());
181
203
        return;
182
204
    }
183
205
 
184
 
    //if toggling off a button set to arrow
 
206
    // if toggling off a button set to arrow
185
207
    if (tbb == m_CurrentButtonID) {
186
208
        m_map[m_Type] = m_CurrentButtonID;  // store old tool for this diagram type
187
 
        toggleButton(tbb_Arrow);
 
209
        m_actions[tbb_Arrow]->toggle();
188
210
        m_CurrentButtonID = tbb_Arrow;
189
211
        emit sigButtonChanged(m_CurrentButtonID);
190
 
        view->setCursor( currentCursor() );
 
212
        view->setCursor(currentCursor());
191
213
        return;
192
214
    }
193
215
    m_map[m_Type] = m_CurrentButtonID;
194
 
    toggleButton(m_CurrentButtonID);
 
216
    m_actions[m_CurrentButtonID]->toggle();
195
217
    m_CurrentButtonID = tbb;
196
218
    emit sigButtonChanged(m_CurrentButtonID);
197
 
    view->setCursor( currentCursor() );
 
219
    view->setCursor(currentCursor());
198
220
}
199
221
 
200
 
QCursor WorkToolBar::currentCursor() {
 
222
QCursor WorkToolBar::currentCursor()
 
223
{
201
224
    return m_ToolButtons[m_CurrentButtonID].Cursor;
202
225
}
203
226
 
204
 
void WorkToolBar::slotResetToolBar() {
 
227
void WorkToolBar::slotResetToolBar()
 
228
{
 
229
    if (m_CurrentButtonID == tbb_Undefined)
 
230
        return;
205
231
    if (m_CurrentButtonID == tbb_Arrow)
206
 
        return;//really shouldn't occur
207
 
    toggleButton(m_CurrentButtonID);
 
232
        return;  // really shouldn't occur
 
233
    m_actions[m_CurrentButtonID]->toggle();
208
234
    m_CurrentButtonID = tbb_Arrow;
209
 
    toggleButton(m_CurrentButtonID);
 
235
    m_actions[m_CurrentButtonID]->toggle();
210
236
    emit sigButtonChanged(m_CurrentButtonID);
211
237
 
212
238
    QCursor curs;
218
244
    }
219
245
}
220
246
 
221
 
void WorkToolBar::setOldTool() {
222
 
    KToolBarButton *b = (KToolBarButton*) getWidget(m_map[m_Type]);
223
 
    if (b)
224
 
        b -> animateClick();
225
 
}
226
 
 
227
 
void WorkToolBar::setDefaultTool() {
228
 
    KToolBarButton *b = (KToolBarButton*) getWidget(tbb_Arrow);
229
 
    if (b)
230
 
        b -> animateClick();
231
 
}
232
 
 
233
 
QPixmap WorkToolBar::load(const QString & fileName) {
234
 
    QPixmap pxm;
235
 
    pxm.load(fileName);
236
 
    return pxm;
237
 
}
238
 
 
239
 
void WorkToolBar::loadPixmaps() {
 
247
void WorkToolBar::setOldTool()
 
248
{
 
249
    QToolButton *b = (QToolButton*) widgetForAction(m_actions[m_map[m_Type]]);
 
250
    if (b)
 
251
        b -> animateClick();
 
252
}
 
253
 
 
254
void WorkToolBar::setDefaultTool()
 
255
{
 
256
    QToolButton *b = (QToolButton*) widgetForAction(m_actions[tbb_Arrow]);
 
257
    if (b)
 
258
        b -> animateClick();
 
259
}
 
260
 
 
261
void WorkToolBar::loadPixmaps()
 
262
{
240
263
    const struct ButtonInfo {
241
264
        const ToolBar_Buttons tbb;
242
265
        const QString btnName;
243
 
        const char *pngName;
 
266
        const Icon_Utils::Icon_Type icon;
 
267
        const char *slotName;
244
268
    } buttonInfo[] = {
245
 
        { tbb_Object, i18n("Object"), "object.png" },
246
 
        { tbb_Seq_Message_Synchronous, i18n("Synchronous Message"), "message-synchronous.png" },
247
 
        { tbb_Seq_Message_Asynchronous, i18n("Asynchronous Message"), "message-asynchronous.png" },
248
 
        { tbb_Association, i18n("Association"), "association.png" },
249
 
        { tbb_Containment, i18n("Containment"), "containment.png" },
250
 
        { tbb_Anchor, i18n("Anchor"), "anchor.png" },
251
 
        { tbb_Text, i18n("Label"), "text.png" },
252
 
        { tbb_Note, i18n("Note"), "note.png" },
253
 
        { tbb_Box, i18n("Box"), "box.png" },
254
 
        { tbb_Actor, i18n("Actor"), "actor.png" },
255
 
        { tbb_Dependency, i18n("Dependency"), "dependency.png" },
256
 
        { tbb_Aggregation, i18n("Aggregation"), "aggregation.png" },
257
 
        { tbb_Relationship, i18n("Relationship"), "relationship.png" },
258
 
        { tbb_UniAssociation, i18n("Directional Association"), "uniassociation.png" },
259
 
        { tbb_Generalization, i18n("Implements (Generalisation/Realisation)"), "generalisation.png" },
260
 
        { tbb_Composition, i18n("Composition"), "composition.png" },
261
 
        { tbb_UseCase, i18n("Use Case"), "usecase.png" },
262
 
        { tbb_Class, i18n("Class"), "class.png" },
263
 
        { tbb_Initial_State, i18n("Initial State"), "initial_state.png" },
264
 
        { tbb_End_State, i18n("End State"), "end_state.png" },
265
 
        { tbb_Branch, i18n("Branch/Merge"), "branch.png" },
266
 
        { tbb_Fork, i18n("Fork/Join"), "fork.png" },
267
 
        { tbb_Package, i18n("Package"), "package.png" },
268
 
        { tbb_Component, i18n("Component"), "component.png" },
269
 
        { tbb_Node, i18n("Node"), "node.png" },
270
 
        { tbb_Artifact, i18n("Artifact"), "artifact.png" },
271
 
        { tbb_Interface, i18n("Interface"), "interface.png" },
272
 
        { tbb_Datatype, i18n("Datatype"), "datatype.png" },
273
 
        { tbb_Enum, i18n("Enum"), "enum.png" },
274
 
        { tbb_Entity, i18n("Entity"), "entity.png" },
275
 
        { tbb_DeepHistory, i18n("Deep History"), "deep-history.png" },          //NotYetImplemented
276
 
        { tbb_ShallowHistory, i18n("Shallow History"), "shallow-history.png" }, //NotYetImplemented
277
 
        { tbb_Join, i18n("Join"), "join.png" },    //NotYetImplemented
278
 
        { tbb_StateFork, i18n("Fork"), "state-fork.png" },
279
 
        { tbb_Junction, i18n("Junction"), "junction.png" },    //NotYetImplemented
280
 
        { tbb_Choice, i18n("Choice"), "choice-round.png" },    //NotYetImplemented
281
 
    //:TODO: let the user decide which symbol he wants (setting an option)
282
 
    //    { tbb_Choice, i18n("Choice"), "choice-rhomb.png" },    //NotYetImplemented
283
 
        //{ tbb_Andline, i18n("And Line"), "andline.png" },    //NotYetImplemented
284
 
        { tbb_State_Transition, i18n("State Transition"), "uniassociation.png" },
285
 
        { tbb_Activity_Transition, i18n("Activity Transition"), "uniassociation.png" },
286
 
        { tbb_Activity, i18n("Activity"), "usecase.png" },
287
 
        { tbb_State, i18n("State"), "usecase.png" },
288
 
        { tbb_End_Activity, i18n("End Activity"), "end_state.png" },
289
 
        { tbb_Initial_Activity, i18n("Initial Activity"), "initial_state.png" },
290
 
        { tbb_Coll_Message, i18n("Message"), "message-asynchronous.png" }
 
269
 
 
270
        { tbb_Object,                   i18n("Object"),                  Icon_Utils::it_Object,                  SLOT(slotObject()) },
 
271
        { tbb_Seq_Message_Synchronous,  i18n("Synchronous Message"),     Icon_Utils::it_Message_Sync,            SLOT(slotSeq_Message_Synchronous()) },
 
272
        { tbb_Seq_Message_Asynchronous, i18n("Asynchronous Message"),    Icon_Utils::it_Message_Async,           SLOT(slotSeq_Message_Asynchronous()) },
 
273
        { tbb_Seq_Message_Found,        i18n("Found Message"),           Icon_Utils::it_Message_Found,           SLOT(slotSeq_Message_Found()) },
 
274
        { tbb_Seq_Message_Lost,         i18n("Lost Message"),            Icon_Utils::it_Message_Lost,            SLOT(slotSeq_Message_Lost()) },
 
275
        { tbb_Seq_Combined_Fragment,    i18n("Combined Fragment"),       Icon_Utils::it_Combined_Fragment,       SLOT(slotSeq_Combined_Fragment()) },
 
276
        { tbb_Seq_Precondition,         i18n("Precondition"),            Icon_Utils::it_Precondition,            SLOT(slotSeq_Precondition()) },
 
277
        { tbb_Association,              i18n("Association"),             Icon_Utils::it_Association,             SLOT(slotAssociation()) },
 
278
        { tbb_Containment,              i18n("Containment"),             Icon_Utils::it_Containment,             SLOT(slotContainment()) },
 
279
        { tbb_Anchor,                   i18n("Anchor"),                  Icon_Utils::it_Anchor,                  SLOT(slotAnchor()) },
 
280
        { tbb_Text,                     i18n("Label"),                   Icon_Utils::it_Text,                    SLOT(slotText()) },
 
281
        { tbb_Note,                     i18n("Note"),                    Icon_Utils::it_Note,                    SLOT(slotNote()) },
 
282
        { tbb_Box,                      i18n("Box"),                     Icon_Utils::it_Box,                     SLOT(slotBox()) },
 
283
        { tbb_Actor,                    i18n("Actor"),                   Icon_Utils::it_Actor,                   SLOT(slotActor()) },
 
284
        { tbb_Dependency,               i18n("Dependency"),              Icon_Utils::it_Dependency,              SLOT(slotDependency()) },
 
285
        { tbb_Aggregation,              i18n("Aggregation"),             Icon_Utils::it_Aggregation,             SLOT(slotAggregation()) },
 
286
        { tbb_Relationship,             i18n("Relationship"),            Icon_Utils::it_Relationship,            SLOT(slotRelationship()) },
 
287
        { tbb_UniAssociation,           i18n("Directional Association"), Icon_Utils::it_Directional_Association, SLOT(slotUniAssociation()) },
 
288
        { tbb_Generalization,           i18n("Implements"),              Icon_Utils::it_Implements,              SLOT(slotGeneralization()) },
 
289
        { tbb_Composition,              i18n("Composition"),             Icon_Utils::it_Composition,             SLOT(slotComposition()) },
 
290
        { tbb_UseCase,                  i18n("Use Case"),                Icon_Utils::it_UseCase,                 SLOT(slotUseCase()) },
 
291
        { tbb_Class,                    i18nc("UML class", "Class"),     Icon_Utils::it_Class,                   SLOT(slotClass()) },
 
292
        { tbb_Initial_State,            i18n("Initial State"),           Icon_Utils::it_InitialState,            SLOT(slotInitial_State()) },
 
293
        { tbb_Region,                   i18n("Region"),                  Icon_Utils::it_Region,                  SLOT(slotRegion()) },
 
294
        { tbb_End_State,                i18n("End State"),               Icon_Utils::it_EndState,                SLOT(slotEnd_State()) },
 
295
        { tbb_Branch,                   i18n("Branch/Merge"),            Icon_Utils::it_Branch,                  SLOT(slotBranch()) },
 
296
        { tbb_Send_Signal,              i18n("Send signal"),             Icon_Utils::it_Send_Signal,             SLOT(slotSend_Signal()) },
 
297
        { tbb_Accept_Signal,            i18n("Accept signal"),           Icon_Utils::it_Accept_Signal,           SLOT(slotAccept_Signal()) },
 
298
        { tbb_Accept_Time_Event,        i18n("Accept time event"),       Icon_Utils::it_Accept_TimeEvent,        SLOT(slotAccept_Time_Event()) },
 
299
        { tbb_Fork,                     i18n("Fork/Join"),               Icon_Utils::it_Fork_Join,               SLOT(slotFork()) },
 
300
        { tbb_Package,                  i18n("Package"),                 Icon_Utils::it_Package,                 SLOT(slotPackage()) },
 
301
        { tbb_Component,                i18n("Component"),               Icon_Utils::it_Component,               SLOT(slotComponent()) },
 
302
        { tbb_Node,                     i18n("Node"),                    Icon_Utils::it_Node,                    SLOT(slotNode()) },
 
303
        { tbb_Artifact,                 i18n("Artifact"),                Icon_Utils::it_Artifact,                SLOT(slotArtifact()) },
 
304
        { tbb_Interface,                i18n("Interface"),               Icon_Utils::it_Interface,               SLOT(slotInterface()) },
 
305
        { tbb_Datatype,                 i18n("Datatype"),                Icon_Utils::it_Datatype,                SLOT(slotDatatype()) },
 
306
        { tbb_Enum,                     i18n("Enum"),                    Icon_Utils::it_Enum,                    SLOT(slotEnum()) },
 
307
        { tbb_Entity,                   i18n("Entity"),                  Icon_Utils::it_Entity,                  SLOT(slotEntity()) },
 
308
        { tbb_DeepHistory,              i18n("Deep History"),            Icon_Utils::it_History_Deep,            SLOT(slotDeepHistory()) },     //NotYetImplemented
 
309
        { tbb_ShallowHistory,           i18n("Shallow History"),         Icon_Utils::it_History_Shallow,         SLOT(slotShallowHistory()) },  //NotYetImplemented
 
310
        { tbb_Join,                     i18nc("join states", "Join"),    Icon_Utils::it_Join,                    SLOT(slotJoin()) },            //NotYetImplemented
 
311
        { tbb_StateFork,                i18n("Fork"),                    Icon_Utils::it_Fork_State,              SLOT(slotStateFork()) },
 
312
        { tbb_Junction,                 i18n("Junction"),                Icon_Utils::it_Junction,                SLOT(slotJunction()) },        //NotYetImplemented
 
313
        { tbb_Choice,                   i18nc("state choice", "Choice"), Icon_Utils::it_Choice_Round,            SLOT(slotChoice()) },          //NotYetImplemented
 
314
        //:TODO: let the user decide which symbol he wants (setting an option)
 
315
        //    { tbb_Choice,                   i18n("Choice"),                  Icon_Utils::it_Choice_Rhomb,           SLOT(slotChoice()) },          //NotYetImplemented
 
316
        { tbb_Andline,                  i18n("And Line"),                Icon_Utils::it_And_Line,                SLOT(slotAndline()) },         //NotYetImplemented
 
317
        { tbb_State_Transition,         i18n("State Transition"),        Icon_Utils::it_State_Transition,        SLOT(slotState_Transition()) },
 
318
        { tbb_Activity_Transition,      i18n("Activity Transition"),     Icon_Utils::it_Activity_Transition,     SLOT(slotActivity_Transition()) },
 
319
        { tbb_Activity,                 i18n("Activity"),                Icon_Utils::it_Activity,                SLOT(slotActivity()) },
 
320
        { tbb_State,                    i18nc("state diagram", "State"), Icon_Utils::it_State,                   SLOT(slotState()) },
 
321
        { tbb_End_Activity,             i18n("End Activity"),            Icon_Utils::it_Activity_End,            SLOT(slotEnd_Activity()) },
 
322
        { tbb_Final_Activity,           i18n("Final Activity"),          Icon_Utils::it_Activity_Final,          SLOT(slotFinal_Activity()) },
 
323
        { tbb_Pin,                      i18n("Pin"),                     Icon_Utils::it_Pin,                     SLOT(slotPin()) },
 
324
        { tbb_Initial_Activity,         i18n("Initial Activity"),        Icon_Utils::it_Activity_Initial,        SLOT(slotInitial_Activity()) },
 
325
        { tbb_Coll_Message,             i18n("Message"),                 Icon_Utils::it_Message,                 SLOT(slotColl_Message()) },
 
326
        { tbb_Exception,                i18n("Exception"),               Icon_Utils::it_Exception,               SLOT(slotException()) },
 
327
        { tbb_Object_Node,              i18n("Object Node"),             Icon_Utils::it_Object_Node,             SLOT(slotObject_Node()) },
 
328
        { tbb_PrePostCondition,         i18n("Pre/Post condition"),      Icon_Utils::it_Condition_PrePost,       SLOT(slotPrePostCondition()) },
 
329
        { tbb_Category,                 i18n("Category"),                Icon_Utils::it_Category,                SLOT(slotCategory())  },
 
330
        { tbb_Category2Parent,          i18n("Category to Parent"),      Icon_Utils::it_Category_Parent,         SLOT(slotCategory2Parent()) },
 
331
        { tbb_Child2Category,           i18n("Child to Category"),       Icon_Utils::it_Category_Child,          SLOT(slotChild2Category()) }
291
332
    };
292
 
    KStandardDirs * dirs = KGlobal::dirs();
293
 
    QString dataDir = dirs->findResourceDir( "data", "umbrello/pics/object.png" );
294
 
    dataDir += "/umbrello/pics/";
 
333
 
295
334
    const size_t n_buttonInfos = sizeof(buttonInfo) / sizeof(ButtonInfo);
296
335
 
297
 
    m_ToolButtons.insert(tbb_Undefined,
298
 
                         ToolButton(i18n("UNDEFINED"),
299
 
                                    0,
300
 
                                    QCursor()) );
 
336
    /*    m_ToolButtons.insert(tbb_Undefined,
 
337
                             ToolButton(i18n("UNDEFINED"),
 
338
                                        Icon_Utils::BarIcon(Icon_Utils::Arrow),
 
339
                                        QCursor(),
 
340
                                        SLOT(slotArrow())));    */
301
341
    m_ToolButtons.insert(tbb_Arrow,
302
 
                         ToolButton(i18n("Select"),
303
 
                                    load(dataDir + "arrow.png"),
304
 
                                    QCursor()) );
305
 
    kDebug() << "WorkToolBar::loadPixmaps: n_buttonInfos = " << n_buttonInfos << endl;
 
342
                         ToolButton(i18nc("selection arrow", "Select"),
 
343
                                    Icon_Utils::BarIcon(Icon_Utils::it_Arrow),
 
344
                                    QCursor(),
 
345
                                    SLOT(slotArrow())));
 
346
 
306
347
    for (uint i = 0; i < n_buttonInfos; i++) {
307
348
        const ButtonInfo& info = buttonInfo[i];
308
349
        m_ToolButtons.insert(info.tbb,
309
 
            ToolButton(info.btnName,
310
 
                       load(dataDir + info.pngName),
311
 
                       QCursor(load(dataDir + "cursor-" + info.pngName), 9, 9)));
 
350
                             ToolButton(info.btnName,
 
351
                                        Icon_Utils::BarIcon(info.icon),
 
352
                                        Icon_Utils::Cursor(info.icon),
 
353
                                        info.slotName));
312
354
    }
313
355
}
314
356
 
 
357
void WorkToolBar::slotArrow()                    { buttonChanged(tbb_Arrow);                    }
 
358
void WorkToolBar::slotGeneralization()           { buttonChanged(tbb_Generalization);           }
 
359
void WorkToolBar::slotAggregation()              { buttonChanged(tbb_Aggregation);              }
 
360
void WorkToolBar::slotDependency()               { buttonChanged(tbb_Dependency);               }
 
361
void WorkToolBar::slotAssociation()              { buttonChanged(tbb_Association);              }
 
362
void WorkToolBar::slotContainment()              { buttonChanged(tbb_Containment);              }
 
363
void WorkToolBar::slotColl_Message()             { buttonChanged(tbb_Coll_Message);             }
 
364
void WorkToolBar::slotSeq_Message_Synchronous()  { buttonChanged(tbb_Seq_Message_Synchronous);  }
 
365
void WorkToolBar::slotSeq_Message_Asynchronous() { buttonChanged(tbb_Seq_Message_Asynchronous); }
 
366
void WorkToolBar::slotSeq_Message_Found()        { buttonChanged(tbb_Seq_Message_Found);        }
 
367
void WorkToolBar::slotSeq_Message_Lost()         { buttonChanged(tbb_Seq_Message_Lost);         }
 
368
void WorkToolBar::slotSeq_Combined_Fragment()    { buttonChanged(tbb_Seq_Combined_Fragment);    }
 
369
void WorkToolBar::slotSeq_Precondition()         { buttonChanged(tbb_Seq_Precondition);         }
 
370
void WorkToolBar::slotComposition()              { buttonChanged(tbb_Composition);              }
 
371
void WorkToolBar::slotRelationship()             { buttonChanged(tbb_Relationship);             }
 
372
void WorkToolBar::slotUniAssociation()           { buttonChanged(tbb_UniAssociation);           }
 
373
void WorkToolBar::slotState_Transition()         { buttonChanged(tbb_State_Transition);         }
 
374
void WorkToolBar::slotActivity_Transition()      { buttonChanged(tbb_Activity_Transition);      }
 
375
void WorkToolBar::slotAnchor()                   { buttonChanged(tbb_Anchor);                   }
 
376
void WorkToolBar::slotNote()                     { buttonChanged(tbb_Note);                     }
 
377
void WorkToolBar::slotBox()                      { buttonChanged(tbb_Box);                      }
 
378
void WorkToolBar::slotText()                     { buttonChanged(tbb_Text);                     }
 
379
void WorkToolBar::slotActor()                    { buttonChanged(tbb_Actor);                    }
 
380
void WorkToolBar::slotUseCase()                  { buttonChanged(tbb_UseCase);                  }
 
381
void WorkToolBar::slotClass()                    { buttonChanged(tbb_Class);                    }
 
382
void WorkToolBar::slotInterface()                { buttonChanged(tbb_Interface);                }
 
383
void WorkToolBar::slotDatatype()                 { buttonChanged(tbb_Datatype);                 }
 
384
void WorkToolBar::slotEnum()                     { buttonChanged(tbb_Enum);                     }
 
385
void WorkToolBar::slotEntity()                   { buttonChanged(tbb_Entity);                   }
 
386
void WorkToolBar::slotPackage()                  { buttonChanged(tbb_Package);                  }
 
387
void WorkToolBar::slotComponent()                { buttonChanged(tbb_Component);                }
 
388
void WorkToolBar::slotNode()                     { buttonChanged(tbb_Node);                     }
 
389
void WorkToolBar::slotArtifact()                 { buttonChanged(tbb_Artifact);                 }
 
390
void WorkToolBar::slotObject()                   { buttonChanged(tbb_Object);                   }
 
391
void WorkToolBar::slotInitial_State()            { buttonChanged(tbb_Initial_State);            }
 
392
void WorkToolBar::slotState()                    { buttonChanged(tbb_State);                    }
 
393
void WorkToolBar::slotSend_Signal()              { buttonChanged(tbb_Send_Signal);              }
 
394
void WorkToolBar::slotAccept_Signal()            { buttonChanged(tbb_Accept_Signal);            }
 
395
void WorkToolBar::slotAccept_Time_Event()        { buttonChanged(tbb_Accept_Time_Event);        }
 
396
void WorkToolBar::slotEnd_State()                { buttonChanged(tbb_End_State);                }
 
397
void WorkToolBar::slotRegion()                   { buttonChanged(tbb_Region);                   }
 
398
void WorkToolBar::slotInitial_Activity()         { buttonChanged(tbb_Initial_Activity);         }
 
399
void WorkToolBar::slotActivity()                 { buttonChanged(tbb_Activity);                 }
 
400
void WorkToolBar::slotEnd_Activity()             { buttonChanged(tbb_End_Activity);             }
 
401
void WorkToolBar::slotFinal_Activity()           { buttonChanged(tbb_Final_Activity);           }
 
402
void WorkToolBar::slotBranch()                   { buttonChanged(tbb_Branch);                   }
 
403
void WorkToolBar::slotFork()                     { buttonChanged(tbb_Fork);                     }
 
404
void WorkToolBar::slotDeepHistory()              { buttonChanged(tbb_DeepHistory);              }
 
405
void WorkToolBar::slotShallowHistory()           { buttonChanged(tbb_ShallowHistory);           }
 
406
void WorkToolBar::slotJoin()                     { buttonChanged(tbb_Join);                     }
 
407
void WorkToolBar::slotPin()                      { buttonChanged(tbb_Pin);                      }
 
408
void WorkToolBar::slotStateFork()                { buttonChanged(tbb_StateFork);                }
 
409
void WorkToolBar::slotJunction()                 { buttonChanged(tbb_Junction);                 }
 
410
void WorkToolBar::slotChoice()                   { buttonChanged(tbb_Choice);                   }
 
411
void WorkToolBar::slotAndline()                  { buttonChanged(tbb_Andline);                  }
 
412
void WorkToolBar::slotException()                { buttonChanged(tbb_Exception);                }
 
413
void WorkToolBar::slotObject_Node()              { buttonChanged(tbb_Object_Node);              }
 
414
void WorkToolBar::slotPrePostCondition()         { buttonChanged(tbb_PrePostCondition);         }
 
415
void WorkToolBar::slotCategory()                 { buttonChanged(tbb_Category);                 }
 
416
void WorkToolBar::slotCategory2Parent()          { buttonChanged(tbb_Category2Parent);          }
 
417
void WorkToolBar::slotChild2Category()           { buttonChanged(tbb_Child2Category);           }
 
418
 
315
419
#include "worktoolbar.moc"