Subversion Repositories Scribus

Rev

Rev 3934 | Rev 4430 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
#include "frameedit.h"
2
#include "frameedit.moc"
3
#include "page.h"
456 fschmid 4
#include "pageitem.h"
838 cbradney 5
#include "scribusview.h"
3934 cbradney 6
#include "selection.h"
1525 cbradney 7
#include "units.h"
1518 tsoots 8
#include "undomanager.h"
9
#include "undostate.h"
3 paul 10
 
11
extern QPixmap loadIcon(QString nam);
12
 
1545 cbradney 13
NodePalette::NodePalette( QWidget* parent) : ScrPaletteBase( parent, "nodePalette", false, 0)
3 paul 14
{
218 Franz 15
        setIcon(loadIcon("AppIcon.png"));
16
        NodePaletteLayout = new QVBoxLayout( this );
17
        NodePaletteLayout->setSpacing( 2 );
18
        NodePaletteLayout->setMargin( 5 );
3 paul 19
 
218 Franz 20
        ButtonGroup1 = new QButtonGroup( this, "ButtonGroup1" );
21
        ButtonGroup1->setFrameShape( QButtonGroup::NoFrame );
22
        ButtonGroup1->setFrameShadow( QButtonGroup::Plain );
283 Franz 23
        ButtonGroup1->setTitle( "" );
218 Franz 24
        ButtonGroup1->setExclusive( true );
25
        ButtonGroup1->setColumnLayout(0, Qt::Vertical );
26
        ButtonGroup1->layout()->setSpacing( 0 );
27
        ButtonGroup1->layout()->setMargin( 0 );
28
        ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
29
        ButtonGroup1Layout->setAlignment( Qt::AlignTop );
30
        ButtonGroup1Layout->setSpacing( 0 );
31
        ButtonGroup1Layout->setMargin( 0 );
3 paul 32
 
218 Franz 33
        MoveNode = new QToolButton( ButtonGroup1, "MoveNode" );
283 Franz 34
        MoveNode->setText( "" );
218 Franz 35
        MoveNode->setPixmap(loadIcon("MoveNode.png"));
36
        MoveNode->setToggleButton( true );
161 Franz 37
        MoveNode->setOn(true);
218 Franz 38
        ButtonGroup1Layout->addWidget( MoveNode, 0, 0 );
39
        MoveControl = new QToolButton( ButtonGroup1, "MoveControl" );
283 Franz 40
        MoveControl->setText( "" );
218 Franz 41
        MoveControl->setPixmap(loadIcon("MoveKontrol.png"));
42
        MoveControl->setToggleButton( true );
43
        ButtonGroup1Layout->addWidget( MoveControl, 0, 1 );
44
        AddNode = new QToolButton( ButtonGroup1, "AddNode" );
283 Franz 45
        AddNode->setText( "" );
218 Franz 46
        AddNode->setPixmap(loadIcon("AddNode.png"));
47
        AddNode->setToggleButton( true );
48
        ButtonGroup1Layout->addWidget( AddNode, 0, 2 );
49
        DeleteNode = new QToolButton( ButtonGroup1, "DeleteNode" );
283 Franz 50
        DeleteNode->setText( "" );
218 Franz 51
        DeleteNode->setPixmap(loadIcon("DeleteNode.png"));
52
        DeleteNode->setToggleButton( true );
53
        ButtonGroup1Layout->addWidget( DeleteNode, 0, 3 );
3 paul 54
 
218 Franz 55
        AsymMove = new QToolButton( ButtonGroup1, "AsymMove" );
56
        AsymMove->setEnabled( false );
283 Franz 57
        AsymMove->setText( "" );
218 Franz 58
        AsymMove->setPixmap(loadIcon("MoveAsym.png"));
59
        AsymMove->setToggleButton( true );
60
        ButtonGroup1Layout->addWidget( AsymMove, 1, 0 );
61
        SymMove = new QToolButton( ButtonGroup1, "SymMove" );
62
        SymMove->setEnabled( false );
283 Franz 63
        SymMove->setText( "" );
218 Franz 64
        SymMove->setPixmap(loadIcon("MoveSym.png"));
65
        SymMove->setToggleButton( true );
66
        ButtonGroup1Layout->addWidget( SymMove, 1, 1 );
67
        ResNode = new QToolButton( ButtonGroup1, "resnode" );
68
        ResNode->setEnabled( false );
283 Franz 69
        ResNode->setText( "" );
218 Franz 70
        ResNode->setPixmap(loadIcon("ResetNode.png"));
71
        ButtonGroup1Layout->addWidget( ResNode, 1, 2 );
72
        Res1Node = new QToolButton( ButtonGroup1, "res1node" );
73
        Res1Node->setEnabled( false );
283 Franz 74
        Res1Node->setText( "" );
218 Franz 75
        Res1Node->setPixmap(loadIcon("Reset1Node.png"));
76
        ButtonGroup1Layout->addWidget( Res1Node, 1, 3 );
3 paul 77
 
218 Franz 78
        PolySplit = new QToolButton( ButtonGroup1, "PolySplit" );
79
        PolySplit->setEnabled( false );
283 Franz 80
        PolySplit->setText( "" );
218 Franz 81
        PolySplit->setToggleButton( true );
82
        PolySplit->setPixmap(loadIcon("PolyCut.png"));
83
        ButtonGroup1Layout->addWidget( PolySplit, 2, 0 );
84
        BezierClose = new QToolButton( ButtonGroup1, "BezierClose" );
85
        BezierClose->setEnabled( false );
283 Franz 86
        BezierClose->setText( "" );
218 Franz 87
        BezierClose->setPixmap(loadIcon("BezierClose.png"));
88
        ButtonGroup1Layout->addWidget( BezierClose, 2, 1 );
3 paul 89
 
218 Franz 90
        PolyMirrorH = new QToolButton( ButtonGroup1, "MirrorH" );
283 Franz 91
        PolyMirrorH->setText( "" );
218 Franz 92
        PolyMirrorH->setPixmap(loadIcon("hmirror.png"));
93
        ButtonGroup1Layout->addWidget( PolyMirrorH, 2, 2 );
3 paul 94
 
218 Franz 95
        PolyMirrorV = new QToolButton( ButtonGroup1, "MirrorV" );
283 Franz 96
        PolyMirrorV->setText( "" );
218 Franz 97
        PolyMirrorV->setPixmap(loadIcon("vmirror.png"));
98
        ButtonGroup1Layout->addWidget( PolyMirrorV, 2, 3 );
3 paul 99
 
218 Franz 100
        PolyShearL = new QToolButton( ButtonGroup1, "ShearL" );
161 Franz 101
        PolyShearL->setAutoRepeat(true);
283 Franz 102
        PolyShearL->setText( "" );
218 Franz 103
        PolyShearL->setPixmap(loadIcon("shear_left.png"));
104
        ButtonGroup1Layout->addWidget( PolyShearL, 3, 0 );
105
        PolyShearR = new QToolButton( ButtonGroup1, "ShearR" );
161 Franz 106
        PolyShearR->setAutoRepeat(true);
283 Franz 107
        PolyShearR->setText( "" );
218 Franz 108
        PolyShearR->setPixmap(loadIcon("shear_right.png"));
109
        ButtonGroup1Layout->addWidget( PolyShearR, 3, 1 );
110
        PolyShearU = new QToolButton( ButtonGroup1, "ShearU" );
161 Franz 111
        PolyShearU->setAutoRepeat(true);
283 Franz 112
        PolyShearU->setText( "" );
218 Franz 113
        PolyShearU->setPixmap(loadIcon("shear_up.png"));
114
        ButtonGroup1Layout->addWidget( PolyShearU, 3, 2 );
115
        PolyShearD = new QToolButton( ButtonGroup1, "ShearD" );
161 Franz 116
        PolyShearD->setAutoRepeat(true);
283 Franz 117
        PolyShearD->setText( "" );
218 Franz 118
        PolyShearD->setPixmap(loadIcon("shear_down.png"));
119
        ButtonGroup1Layout->addWidget( PolyShearD, 3, 3 );
13 Franz 120
 
218 Franz 121
        RotateCCW = new QToolButton( ButtonGroup1, "RotateCCW" );
161 Franz 122
        RotateCCW->setAutoRepeat(true);
283 Franz 123
        RotateCCW->setText( "" );
218 Franz 124
        RotateCCW->setPixmap(loadIcon("rotate_ccw.png"));
125
        ButtonGroup1Layout->addWidget( RotateCCW, 4, 0 );
126
        RotateCW = new QToolButton( ButtonGroup1, "RotateCW" );
161 Franz 127
        RotateCW->setAutoRepeat(true);
283 Franz 128
        RotateCW->setText( "" );
218 Franz 129
        RotateCW->setPixmap(loadIcon("rotate_cw.png"));
130
        ButtonGroup1Layout->addWidget( RotateCW, 4, 1 );
3446 cbradney 131
        RotVal = new QSpinBox( 1, 180, 1, ButtonGroup1, "RotVal");
343 Franz 132
        RotVal->setSuffix( QString::fromUtf8(" °"));
133
        ButtonGroup1Layout->addMultiCellWidget( RotVal, 4, 4, 2, 3 );
134
 
218 Franz 135
        Expand = new QToolButton( ButtonGroup1, "Expand" );
161 Franz 136
        Expand->setAutoRepeat(true);
283 Franz 137
        Expand->setText( "" );
218 Franz 138
        Expand->setPixmap(loadIcon("expand.png"));
343 Franz 139
        ButtonGroup1Layout->addWidget( Expand, 5, 0 );
218 Franz 140
        Crop = new QToolButton( ButtonGroup1, "Crop" );
161 Franz 141
        Crop->setAutoRepeat(true);
283 Franz 142
        Crop->setText( "" );
218 Franz 143
        Crop->setPixmap(loadIcon("crop.png"));
343 Franz 144
        ButtonGroup1Layout->addWidget( Crop, 5, 1 );
145
        ScaleVal = new QSpinBox( ButtonGroup1, "RotVal");
146
        ScaleVal->setMinValue(1);
147
        ScaleVal->setMaxValue(100);
148
        ScaleVal->setValue(10);
149
        ButtonGroup1Layout->addMultiCellWidget( ScaleVal, 5, 5, 2, 3 );
132 Franz 150
 
218 Franz 151
        /*    QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
152
            ButtonGroup4Layout->addItem( spacer_2 );  */
153
        NodePaletteLayout->addWidget( ButtonGroup1 );
13 Franz 154
 
2210 cbradney 155
        AbsMode = new QCheckBox( "&Absolute Coordinates", this, "Textflow" );
161 Franz 156
        AbsMode->setChecked(false);
218 Franz 157
        NodePaletteLayout->addWidget( AbsMode );
97 Franz 158
 
218 Franz 159
        Layout2 = new QGridLayout( 0, 1, 1, 0, 5, "Layout2");
360 Franz 160
        XSpin = new MSpinBox( this, 2 );
456 fschmid 161
        XSpin->setMaxValue(30000);
360 Franz 162
        XSpin->setEnabled(false);
218 Franz 163
        YSpin = new MSpinBox( this, 2 );
456 fschmid 164
        YSpin->setMaxValue(30000);
161 Franz 165
        YSpin->setEnabled(false);
2210 cbradney 166
        TextLabel1 = new QLabel( XSpin, "&X-Pos:", this, "TextLabel1" );
167
        TextLabel2 = new QLabel( YSpin, "&Y-Pos:", this, "TextLabel2" );
348 Franz 168
        Layout2->addWidget( TextLabel1, 0, 0 );
169
        Layout2->addWidget( TextLabel2, 1, 0 );
218 Franz 170
        Layout2->addWidget( XSpin, 0, 1 );
348 Franz 171
        Layout2->addWidget( YSpin, 1, 1 );
218 Franz 172
        NodePaletteLayout->addLayout( Layout2 );
3 paul 173
 
2210 cbradney 174
        EditCont = new QCheckBox( "Edit &Contour Line", this, "EditCont" );
340 Franz 175
        EditCont->setChecked(false);
176
        NodePaletteLayout->addWidget( EditCont );
177
 
2210 cbradney 178
        ResetCont = new QPushButton( "&Reset Contour Line", this, "PushButton1" );
343 Franz 179
        NodePaletteLayout->addWidget( ResetCont );
180
 
2210 cbradney 181
        PushButton1 = new QPushButton( "&End Editing", this, "PushButton1" );
343 Franz 182
        PushButton1->setDefault(true);
218 Franz 183
        NodePaletteLayout->addWidget( PushButton1 );
3 paul 184
 
2210 cbradney 185
        languageChange();
186
 
218 Franz 187
        // signals and slots connections
188
        connect(PushButton1, SIGNAL(clicked()), this, SLOT(EndEdit()));
189
        connect(DeleteNode, SIGNAL(clicked()), this, SLOT(DelN()));
190
        connect(AddNode, SIGNAL(clicked()), this, SLOT(AddN()));
191
        connect(MoveNode, SIGNAL(clicked()), this, SLOT(MoveN()));
192
        connect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym()));
193
        connect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym()));
194
        connect(ResNode, SIGNAL(clicked()), this, SLOT(ResetControl()));
195
        connect(Res1Node, SIGNAL(clicked()), this, SLOT(Reset1Control()));
196
        connect(BezierClose, SIGNAL(clicked()), this, SLOT(CloseBezier()));
197
        connect(PolySplit, SIGNAL(clicked()), this, SLOT(SplitPoly()));
198
        connect(MoveControl, SIGNAL(clicked()), this, SLOT(MoveK()));
161 Franz 199
        connect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
200
        connect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
218 Franz 201
        connect(PolyMirrorH, SIGNAL(clicked()), this, SLOT(MirrorH()));
202
        connect(PolyMirrorV, SIGNAL(clicked()), this, SLOT(MirrorV()));
203
        connect(PolyShearR, SIGNAL(clicked()), this, SLOT(ShearR()));
204
        connect(PolyShearL, SIGNAL(clicked()), this, SLOT(ShearL()));
205
        connect(PolyShearU, SIGNAL(clicked()), this, SLOT(ShearU()));
206
        connect(PolyShearD, SIGNAL(clicked()), this, SLOT(ShearD()));
207
        connect(RotateCCW, SIGNAL(clicked()), this, SLOT(doRotCCW()));
208
        connect(RotateCW, SIGNAL(clicked()), this, SLOT(doRotCW()));
209
        connect(Crop, SIGNAL(clicked()), this, SLOT(doCrop()));
210
        connect(Expand, SIGNAL(clicked()), this, SLOT(doExpand()));
161 Franz 211
        connect(AbsMode, SIGNAL(clicked()), this, SLOT(ToggleAbsMode()));
340 Franz 212
        connect(EditCont, SIGNAL(clicked()), this, SLOT(ToggleConMode()));
343 Franz 213
        connect(ResetCont, SIGNAL(clicked()), this, SLOT(ResetContour()));
3 paul 214
}
215
 
456 fschmid 216
void NodePalette::setDoc(ScribusDoc *dc, ScribusView *vi)
3 paul 217
{
218
        doc = dc;
456 fschmid 219
        view = vi;
341 Franz 220
        disconnect(EditCont, SIGNAL(clicked()), this, SLOT(ToggleConMode()));
97 Franz 221
        disconnect(AbsMode, SIGNAL(clicked()), this, SLOT(ToggleAbsMode()));
2965 cbradney 222
        YSpin->setSuffix(unitGetSuffixFromIndex(doc->unitIndex()));
223
        XSpin->setSuffix(unitGetSuffixFromIndex(doc->unitIndex()));
97 Franz 224
        AbsMode->setChecked(false);
341 Franz 225
        EditCont->setChecked(false);
97 Franz 226
        connect(AbsMode, SIGNAL(clicked()), this, SLOT(ToggleAbsMode()));
341 Franz 227
        connect(EditCont, SIGNAL(clicked()), this, SLOT(ToggleConMode()));
3 paul 228
}
229
 
230
void NodePalette::SplitPoly()
231
{
232
        MoveN();
233
        doc->EditClipMode = 3;
234
        PolySplit->setOn(true);
235
}
236
 
237
void NodePalette::IsOpen()
238
{
239
        PolySplit->setOn(false);
240
        BezierClose->setEnabled(true);
241
        PolySplit->setEnabled(true);
340 Franz 242
        EditCont->setEnabled(false);
3 paul 243
}
244
 
245
void NodePalette::PolyStatus(int typ, uint size)
246
{
80 Franz 247
        bool setter;
3 paul 248
        switch (typ)
161 Franz 249
        {
218 Franz 250
        case 6:
251
                PolySplit->setEnabled(true);
252
                BezierClose->setEnabled(false);
253
                break;
254
        case 7:
255
                setter = size > 7 ? true : false;
256
                BezierClose->setEnabled(setter);
257
                PolySplit->setEnabled(setter);
258
                break;
259
        default:
260
                BezierClose->setEnabled(false);
261
                PolySplit->setEnabled(false);
262
                break;
161 Franz 263
        }
3 paul 264
}
265
 
266
void NodePalette::CloseBezier()
267
{
268
        MoveN();
456 fschmid 269
        view->Bezier2Poly();
3 paul 270
        BezierClose->setEnabled(false);
271
        PolySplit->setEnabled(true);
340 Franz 272
        EditCont->setEnabled(true);
3 paul 273
}
274
 
132 Franz 275
void NodePalette::doRotCCW()
276
{
277
        if (doc != 0)
456 fschmid 278
                view->TransformPoly(0, RotVal->value());
132 Franz 279
}
280
 
281
void NodePalette::doRotCW()
282
{
283
        if (doc != 0)
456 fschmid 284
                view->TransformPoly(1, RotVal->value());
132 Franz 285
}
286
 
287
void NodePalette::doCrop()
288
{
289
        if (doc != 0)
456 fschmid 290
                view->TransformPoly(2, 1, ScaleVal->value());
132 Franz 291
}
292
 
293
void NodePalette::doExpand()
294
{
295
        if (doc != 0)
456 fschmid 296
                view->TransformPoly(3, 1, ScaleVal->value());
132 Franz 297
}
298
 
13 Franz 299
void NodePalette::ShearR()
300
{
301
        if (doc != 0)
456 fschmid 302
                view->TransformPoly(5);
13 Franz 303
}
304
 
305
void NodePalette::ShearL()
306
{
307
        if (doc != 0)
456 fschmid 308
                view->TransformPoly(4);
13 Franz 309
}
310
 
311
void NodePalette::ShearU()
312
{
313
        if (doc != 0)
456 fschmid 314
                view->TransformPoly(6);
13 Franz 315
}
316
 
317
void NodePalette::ShearD()
318
{
319
        if (doc != 0)
456 fschmid 320
                view->TransformPoly(7);
13 Franz 321
}
322
 
3 paul 323
void NodePalette::MirrorH()
324
{
325
        if (doc != 0)
456 fschmid 326
                view->MirrorPolyH();
3 paul 327
}
328
 
329
void NodePalette::MirrorV()
330
{
331
        if (doc != 0)
456 fschmid 332
                view->MirrorPolyV();
3 paul 333
}
334
 
335
void NodePalette::ResetControl()
336
{
456 fschmid 337
        view->ResetControl();
3 paul 338
}
339
 
340
void NodePalette::Reset1Control()
341
{
456 fschmid 342
        view->Reset1Control();
3 paul 343
}
344
 
343 Franz 345
void NodePalette::ResetContour()
346
{
347
        if (doc != 0)
348
        {
1518 tsoots 349
                if (UndoManager::undoEnabled())
350
                {
351
                        ItemState<FPointArray> *is = new ItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
352
                        is->set("RESET_CONTOUR", "reset_contour");
3934 cbradney 353
                        //is->setItem(view->SelItem.at(0)->ContourLine);
354
                        is->setItem(doc->selection->itemAt(0)->ContourLine);
355
                        //UndoManager::instance()->action(view->SelItem.at(0), is);
356
                        UndoManager::instance()->action(doc->selection->itemAt(0), is);
1518 tsoots 357
                }
3934 cbradney 358
                //view->SelItem.at(0)->ContourLine = view->SelItem.at(0)->PoLine.copy();
359
                //FIXME make an internal item copy poline to contourline member
360
                doc->selection->itemAt(0)->ContourLine = doc->selection->itemAt(0)->PoLine.copy();
361
                //view->SelItem.at(0)->ClipEdited = true;
362
                doc->selection->itemAt(0)->ClipEdited = true;
456 fschmid 363
                view->updateContents();
343 Franz 364
        }
365
}
366
 
3 paul 367
void NodePalette::MovePoint()
368
{
369
        if (doc->EditClipMode == 0)
161 Franz 370
        {
3934 cbradney 371
                FPoint np(XSpin->value()/doc->unitRatio(), YSpin->value()/doc->unitRatio());
372
                FPoint zp(doc->selection->itemAt(0)->xPos(), doc->selection->itemAt(0)->yPos());
97 Franz 373
                if (AbsMode->isChecked())
374
                        np -= zp;
3934 cbradney 375
                view->MoveClipPoint(doc->selection->itemAt(0), np);
4078 fschmid 376
                view->AdjustItemSize(doc->selection->itemAt(0));
377
                emit DocChanged();
161 Franz 378
        }
3 paul 379
}
380
 
381
void NodePalette::SetSym()
382
{
456 fschmid 383
        view->MoveSym = true;
3 paul 384
}
385
 
386
void NodePalette::SetAsym()
387
{
456 fschmid 388
        view->MoveSym = false;
3 paul 389
}
390
 
80 Franz 391
void NodePalette::SetXY(double x, double y)
3 paul 392
{
3934 cbradney 393
        FPoint zp(0.0, 0.0);
3 paul 394
        disconnect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
395
        disconnect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
97 Franz 396
        if (AbsMode->isChecked())
3934 cbradney 397
                //zp = FPoint(view->SelItem.at(0)->xPos(), view->SelItem.at(0)->yPos());
398
                zp = FPoint(doc->selection->itemAt(0)->xPos(), doc->selection->itemAt(0)->yPos());
2965 cbradney 399
        XSpin->setValue((x + zp.x())*doc->unitRatio());
400
        YSpin->setValue((y + zp.y())*doc->unitRatio());
3 paul 401
        connect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
402
        connect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
403
}
404
 
97 Franz 405
void NodePalette::ToggleAbsMode()
406
{
3934 cbradney 407
        //FPoint zp = FPoint(view->SelItem.at(0)->xPos(), view->SelItem.at(0)->yPos());
408
        FPoint zp(doc->selection->itemAt(0)->xPos(), doc->selection->itemAt(0)->yPos());
97 Franz 409
        disconnect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
410
        disconnect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
2965 cbradney 411
        double unitRatio=doc->unitRatio();
3934 cbradney 412
        FPoint np(XSpin->value()/unitRatio, YSpin->value()/unitRatio);
97 Franz 413
        if (AbsMode->isChecked())
414
                np += zp;
415
        else
416
                np -= zp;
2965 cbradney 417
        XSpin->setValue(np.x()*unitRatio);
418
        YSpin->setValue(np.y()*unitRatio);
97 Franz 419
        connect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
420
        connect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
421
}
422
 
340 Franz 423
void NodePalette::ToggleConMode()
424
{
2951 fschmid 425
        disconnect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
426
        disconnect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
340 Franz 427
        if (doc != 0)
428
        {
456 fschmid 429
                view->EditContour = EditCont->isChecked();
430
                view->updateContents();
340 Franz 431
                if (EditCont->isChecked())
432
                {
433
                        BezierClose->setEnabled(false);
434
                        PolySplit->setEnabled(false);
343 Franz 435
                        ResetCont->setEnabled(true);
340 Franz 436
                        XSpin->setMinValue(-3000);
437
                        YSpin->setMinValue(-3000);
438
                }
439
                else
440
                {
441
                        BezierClose->setEnabled(false);
442
                        PolySplit->setEnabled(true);
343 Franz 443
                        ResetCont->setEnabled(false);
340 Franz 444
                        XSpin->setMinValue(0);
445
                        YSpin->setMinValue(0);
446
                }
447
        }
2951 fschmid 448
        connect(XSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
449
        connect(YSpin, SIGNAL(valueChanged(int)), this, SLOT(MovePoint()));
340 Franz 450
}
451
 
3 paul 452
void NodePalette::HaveNode(bool have, bool mov)
453
{
80 Franz 454
        bool setter = have ? true : false;
455
        XSpin->setEnabled(setter);
456
        YSpin->setEnabled(setter);
457
        if (setter == true)
458
        {
456 fschmid 459
                if (view->EdPoints)
218 Franz 460
                        ResNode->setEnabled(setter);
3 paul 461
                else
218 Franz 462
                        Res1Node->setEnabled(setter);
80 Franz 463
        }
3 paul 464
        else
80 Franz 465
        {
218 Franz 466
                ResNode->setEnabled(setter);
467
                Res1Node->setEnabled(setter);
80 Franz 468
        }
3586 fschmid 469
        if (doc->EditClipMode == 0)
470
        {
471
                disconnect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym()));
472
                disconnect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym()));
473
                if (mov)
474
                        SymMove->setOn(true);
475
                else
476
                        AsymMove->setOn(true);
477
                connect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym()));
478
                connect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym()));
479
        }
480
        if (doc->EditClipMode == 2)
481
        {
482
                uint cc;
483
                bool leaveEd = false;
3934 cbradney 484
                PageItem*currItem=doc->selection->itemAt(0);
3586 fschmid 485
                if (view->EditContour)
3934 cbradney 486
                        //cc = view->SelItem.at(0)->ContourLine.size();
487
                        cc = currItem->ContourLine.size();
3586 fschmid 488
                else
3934 cbradney 489
                        //cc = view->SelItem.at(0)->PoLine.size();
490
                        cc = currItem->PoLine.size();
491
                //if (view->SelItem.at(0)->asPolyLine())
492
                if (currItem->asPolyLine())
3586 fschmid 493
                {
494
                        if (cc < 5)
495
                                leaveEd = true;
496
                }
497
                else
498
                {
499
                        if (cc < 13)
500
                                leaveEd = true;
501
                }
502
                if (leaveEd)
503
                {
504
                        MoveN();
505
                        MoveControl->setEnabled(true);
506
                }
507
        }
3 paul 508
}
509
 
510
void NodePalette::MoveK()
511
{
512
        doc->EditClipMode = 0;
456 fschmid 513
        view->EdPoints = false;
3934 cbradney 514
        //PageItem *currItem = view->SelItem.at(0);
515
        PageItem *currItem = doc->selection->itemAt(0);
2934 fschmid 516
        if (view->EditContour)
517
                view->MarkClip(currItem, currItem->ContourLine, true);
518
        else
519
                view->MarkClip(currItem, currItem->PoLine, true);
161 Franz 520
        SymMove->setEnabled(true);
521
        AsymMove->setEnabled(true);
522
        ResNode->setEnabled(false);
523
        Res1Node->setEnabled(false);
3 paul 524
}
525
 
526
void NodePalette::MoveN()
527
{
528
        doc->EditClipMode = 0;
456 fschmid 529
        view->EdPoints = true;
3934 cbradney 530
        //PageItem *currItem = view->SelItem.at(0);
531
        PageItem *currItem = doc->selection->itemAt(0);
2934 fschmid 532
        if (view->EditContour)
533
                view->MarkClip(currItem, currItem->ContourLine, true);
534
        else
535
                view->MarkClip(currItem, currItem->PoLine, true);
3 paul 536
        MoveNode->setOn(true);
161 Franz 537
        SymMove->setEnabled(false);
538
        AsymMove->setEnabled(false);
539
        ResNode->setEnabled(false);
540
        Res1Node->setEnabled(false);
3 paul 541
}
542
 
543
void NodePalette::AddN()
544
{
545
        doc->EditClipMode = 1;
456 fschmid 546
        view->EdPoints = true;
161 Franz 547
        SymMove->setEnabled(false);
548
        AsymMove->setEnabled(false);
549
        ResNode->setEnabled(false);
550
        Res1Node->setEnabled(false);
3 paul 551
}
552
 
553
void NodePalette::DelN()
554
{
555
        doc->EditClipMode = 2;
456 fschmid 556
        view->EdPoints = true;
161 Franz 557
        SymMove->setEnabled(false);
558
        AsymMove->setEnabled(false);
559
        ResNode->setEnabled(false);
218 Franz 560
        Res1Node->setEnabled(false);
3 paul 561
}
562
 
1525 cbradney 563
void NodePalette::closeEvent(QCloseEvent *ce)
3 paul 564
{
565
        if (doc != 0)
161 Franz 566
        {
3 paul 567
                MoveN();
456 fschmid 568
                view->ClRe = -1;
2935 fschmid 569
                view->ClRe2 = -1;
570
                view->SegP1 = -1;
571
                view->SegP2 = -1;
572
                view->SelNode.clear();
161 Franz 573
        }
574
        PolySplit->setEnabled( false );
575
        BezierClose->setEnabled( false );
4078 fschmid 576
        emit Schliessen();
1525 cbradney 577
        ScrPaletteBase::closeEvent(ce);
3 paul 578
}
579
 
580
void NodePalette::EndEdit()
581
{
582
        if (doc != 0)
161 Franz 583
        {
3 paul 584
                MoveN();
456 fschmid 585
                view->ClRe = -1;
2935 fschmid 586
                view->ClRe2 = -1;
587
                view->SegP1 = -1;
588
                view->SegP2 = -1;
589
                view->SelNode.clear();
340 Franz 590
                EditCont->setChecked(false);
341 Franz 591
                ToggleConMode();
161 Franz 592
        }
593
        PolySplit->setEnabled( false );
594
        BezierClose->setEnabled( false );
340 Franz 595
        EditCont->setChecked(false);
3 paul 596
        emit Schliessen();
597
}
2210 cbradney 598
 
599
void NodePalette::languageChange()
600
{
601
        setCaption( tr( "Nodes" ) );
2397 cbradney 602
        ScaleVal->setSuffix( tr(" %"));
2210 cbradney 603
 
2397 cbradney 604
        AbsMode->setText( tr("&Absolute Coordinates"));
605
        TextLabel1->setText( tr("&X-Pos:"));
606
        TextLabel2->setText( tr("&Y-Pos:"));
607
        EditCont->setText( tr("Edit &Contour Line"));
608
        ResetCont->setText( tr("&Reset Contour Line"));
609
        PushButton1->setText( tr("&End Editing"));
2210 cbradney 610
        QToolTip::add(MoveNode, tr("Move Nodes"));
611
        QToolTip::add(MoveControl, tr("Move Control Points"));
612
        QToolTip::add(AddNode, tr("Add Nodes"));
613
        QToolTip::add(DeleteNode, tr("Delete Nodes"));
614
        QToolTip::add(AsymMove, tr("Move Control Points Independently"));
615
        QToolTip::add(SymMove, tr("Move Control Points Symmetrical"));
616
        QToolTip::add(ResNode, tr("Reset Control Points"));
617
        QToolTip::add(Res1Node, tr("Reset this Control Point"));
618
        QToolTip::add(PolySplit, tr("Open a Polygon or Cuts a Bezier Curve"));
619
        QToolTip::add(BezierClose, tr("Close this Bezier Curve"));
620
        QToolTip::add(PolyMirrorH, tr("Mirror the Path Horizontally"));
621
        QToolTip::add(PolyMirrorV, tr("Mirror the Path Vertically"));
622
        QToolTip::add(PolyShearR, tr("Shear the Path Horizontally to the Right"));
623
        QToolTip::add(PolyShearL, tr("Shear the Path Horizontally to the Left"));
624
        QToolTip::add(PolyShearU, tr("Shear the Path Vertically Up"));
625
        QToolTip::add(PolyShearD, tr("Shear the Path Vertically Down"));
626
        QToolTip::add(RotateCCW, tr("Rotate the Path Counter-Clockwise"));
627
        QToolTip::add(RotateCW, tr("Rotate the Path Clockwise"));
628
        QToolTip::add(Crop, tr("Reduce the Size of the Path by shown %"));
629
        QToolTip::add(Expand, tr("Enlarge the Size of the Path by shown %"));
630
        QToolTip::add(RotVal, tr("Angle of Rotation"));
631
        QToolTip::add(ScaleVal, tr("% to Enlarge or Reduce By"));
632
        QToolTip::add(EditCont, tr("Activate Contour Line Editing Mode"));
633
        QToolTip::add(ResetCont, tr("Reset the Contour Line to the Original Shape of the Frame"));
634
        QToolTip::add(AbsMode,  "<qt>" + tr("When checked use coordinates relative to the page, otherwise coordinates are relative to the Object.") + "</qt>");
635
}
3934 cbradney 636