Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
16546 jghali 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
 
8
#include "propertiespalette_group.h"
9
 
10
#include <QButtonGroup>
11
#include <QCheckBox>
12
#include <QCloseEvent>
13
#include <QComboBox>
14
#include <QEvent>
15
#include <QFocusEvent>
16
#include <QFrame>
17
#include <QGridLayout>
18
#include <QGroupBox>
19
#include <QHBoxLayout>
20
#include <QImage>
21
#include <QKeyEvent>
22
#include <QLabel>
23
#include <QListView>
24
#include <QTransform>
25
#include <QMenu>
26
#include <QMessageBox>
27
#include <QObject>
28
#include <QPixmap>
29
#include <QPoint>
30
#include <QPushButton>
31
#include <QRadioButton>
32
#include <QRegExp>
33
#include <QSpacerItem>
34
#include <QSpinBox>
35
#include <QStackedWidget>
36
#include <QTimer>
37
#include <QToolBox>
38
#include <QToolTip>
39
#include <QVBoxLayout>
40
#include <QValidator>
41
#include <QWidget>
42
 
17539 jghali 43
#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
16546 jghali 44
#define _USE_MATH_DEFINES
45
#endif
46
#include <cmath>
47
#include "commonstrings.h"
48
#include "sccombobox.h"
49
#include "scribus.h"
50
#include "scribuscore.h"
51
#include "scraction.h"
52
#include "scribusview.h"
53
#include "selection.h"
54
#include "units.h"
55
#include "undomanager.h"
56
#include "util.h"
57
#include "util_icon.h"
58
#include "util_math.h"
59
 
60
#include "ui/autoform.h"
61
#include "ui/nodeeditpalette.h"
16976 fschmid 62
#include "ui/propertiespalette.h"
16546 jghali 63
#include "ui/propertiespalette_utils.h"
16976 fschmid 64
#include "ui/propertiespalette_xyz.h"
16546 jghali 65
#include "ui/transparencypalette.h"
66
 
67
PropertiesPalette_Group::PropertiesPalette_Group( QWidget* parent) : QWidget(parent)
68
{
69
        m_ScMW = 0;
70
        m_doc  = 0;
71
        m_haveDoc   = false;
72
        m_haveItem  = false;
73
        m_unitRatio = 1.0;
74
 
75
        m_tmpSelection = new Selection(this, false);
76
        m_tmpSelection->clear();
77
 
78
        setupUi(this);
17383 fschmid 79
        setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
16546 jghali 80
 
81
        textFlowDisabled->setIcon(QIcon(loadIcon("flow-none.png")));
82
        textFlowUsesFrameShape->setIcon(QIcon(loadIcon("flow-frame.png")));
83
        textFlowUsesBoundingBox->setIcon(QIcon(loadIcon("flow-bounding.png")));
84
        textFlowUsesContourLine->setIcon(QIcon(loadIcon("flow-contour.png")));
85
        textFlowUsesImageClipping->setIcon(QIcon(loadIcon("flow-contour.png")));
86
 
87
        textFlowDisabled->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
88
        textFlowUsesFrameShape->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
89
        textFlowUsesBoundingBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
90
        textFlowUsesContourLine->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
91
        textFlowUsesImageClipping->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
92
 
93
        transPalWidget->hideSelectionButtons();
94
 
95
        languageChange();
96
 
97
        connect(textFlowBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleTextFlow()));
98
 
99
        connect(customShape  , SIGNAL(FormSel(int, int, qreal *)), this, SLOT(handleNewShape(int, int, qreal *)));
17388 jghali 100
        connect(editShape    , SIGNAL(clicked())                 , this, SLOT(handleShapeEdit()));
101
        connect(evenOdd      , SIGNAL(clicked())                 , this, SLOT(handleFillRule()) );
102
        connect(nonZero      , SIGNAL(clicked())                 , this, SLOT(handleFillRule()) );
103
        connect(transPalWidget , SIGNAL(editGradient())          , this, SLOT(handleGradientEdit()));
16546 jghali 104
        connect(transPalWidget , SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SLOT(handleSpecialGradient(double, double, double, double, double, double, double, double )));
105
}
106
 
107
PageItem* PropertiesPalette_Group::currentItemFromSelection()
108
{
109
        PageItem *currentItem = NULL;
110
 
111
        if (m_doc)
112
        {
113
                if (m_doc->m_Selection->count() > 1)
114
                {
115
                        currentItem = m_doc->m_Selection->itemAt(0);
116
                }
117
                else if (m_doc->m_Selection->count() == 1)
118
                {
119
                        currentItem = m_doc->m_Selection->itemAt(0);
120
                }
121
        }
122
 
123
        return currentItem;
124
}
125
 
126
void PropertiesPalette_Group::setMainWindow(ScribusMainWindow *mw)
127
{
128
        m_ScMW = mw;
129
 
17388 jghali 130
        connect(this->transPalWidget, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged()));
16546 jghali 131
        connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int)));
132
}
133
 
134
void PropertiesPalette_Group::setDoc(ScribusDoc *d)
135
{
136
        if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
137
                return;
138
 
139
        if (m_doc)
140
        {
141
                disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
142
                disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
143
        }
144
 
145
        disconnect(this->transPalWidget, SIGNAL(NewTrans(double)), 0, 0);
146
        disconnect(this->transPalWidget, SIGNAL(NewBlend(int)), 0, 0);
147
        disconnect(this->transPalWidget, SIGNAL(NewGradient(int)), 0, 0);
148
        disconnect(this->transPalWidget, SIGNAL(NewPattern(QString)), 0, 0);
149
        disconnect(this->transPalWidget, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
150
 
151
        m_doc  = d;
152
        m_item = NULL;
153
        m_unitRatio   = m_doc->unitRatio();
154
        m_unitIndex   = m_doc->unitIndex();
155
 
156
        transPalWidget->setDocument(m_doc);
157
        transPalWidget->setCurrentItem(NULL);
158
 
159
        m_haveDoc  = true;
160
        m_haveItem = false;
161
 
162
        connect(this->transPalWidget, SIGNAL(NewTrans(double))   , this, SLOT(handleGroupTransparency(double)));
163
        connect(this->transPalWidget, SIGNAL(NewBlend(int))      , this, SLOT(handleGroupBlending(int)));
164
        connect(this->transPalWidget, SIGNAL(NewGradient(int))   , this, SLOT(handleGroupGradMask(int)));
165
        connect(this->transPalWidget, SIGNAL(NewPattern(QString)), this, SLOT(handleGroupPatternMask(QString)));
166
        connect(this->transPalWidget, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), this, SLOT(handleGroupPatternMaskProps(double, double, double, double, double, double, double, bool, bool)));
167
 
168
        connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
169
        connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
170
}
171
 
172
void PropertiesPalette_Group::unsetDoc()
173
{
174
        if (m_doc)
175
        {
176
                disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
177
                disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
178
        }
179
 
180
        m_haveDoc  = false;
181
        m_haveItem = false;
182
        m_doc   = NULL;
183
        m_item  = NULL;
184
 
185
        transPalWidget->setDocument(NULL);
186
        transPalWidget->setCurrentItem(NULL);
187
 
188
        setEnabled(false);
189
}
190
 
191
void PropertiesPalette_Group::unsetItem()
192
{
193
        m_haveItem = false;
194
        m_item     = NULL;
195
        transPalWidget->setCurrentItem(NULL);
196
        handleSelectionChanged();
197
}
198
 
199
void PropertiesPalette_Group::handleSelectionChanged()
200
{
201
        if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
202
                return;
203
 
204
        PageItem* currItem = currentItemFromSelection();
205
        if (m_doc->m_Selection->count() > 1)
206
        {
207
                bool widgetEnabled = false;
208
                if (m_haveItem && m_item)
209
                {
210
                        if ((m_item->isGroup()) && (!m_item->isSingleSel))
211
                                widgetEnabled = true;
212
                }
213
                setEnabled(widgetEnabled);
214
        }
215
        else
216
        {
217
                int itemType = currItem ? (int) currItem->itemType() : -1;
218
                m_haveItem = (itemType != -1);
219
 
220
                switch (itemType)
221
                {
222
                case -1:
223
                        setEnabled(false);
224
                        break;
225
                case PageItem::ImageFrame:
226
                case PageItem::LatexFrame:
227
                case PageItem::OSGFrame:
228
                        if (currItem->asOSGFrame())
229
                        {
230
                                setEnabled(false);
231
                        }
232
                        break;
233
                case PageItem::Arc:
234
                case PageItem::TextFrame:
235
                case PageItem::Line:
236
                case PageItem::ItemType1:
237
                case PageItem::ItemType3:
238
                case PageItem::Polygon:
239
                case PageItem::PolyLine:
240
                case PageItem::PathText:
241
                case PageItem::RegularPolygon:
242
                        setEnabled(false);
243
                        break;
244
                case PageItem::Symbol:
245
                        setEnabled(true);
246
                        break;
247
                }
248
        }
249
        if (currItem)
250
        {
251
                setCurrentItem(currItem);
252
        }
253
        updateGeometry();
18480 jghali 254
        //repaint();
16546 jghali 255
}
256
 
257
void PropertiesPalette_Group::handleUpdateRequest(int updateFlags)
258
{
259
        if (updateFlags & reqColorsUpdate)
260
                updateColorList();
261
}
262
 
263
void PropertiesPalette_Group::setCurrentItem(PageItem *item)
264
{
265
        if (!m_ScMW || m_ScMW->scriptIsRunning())
266
                return;
267
        //CB We shouldnt really need to process this if our item is the same one
268
        //maybe we do if the item has been changed by scripter.. but that should probably
269
        //set some status if so.
270
        //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL.
271
        //if (m_item == i)
272
        //      return;
273
 
274
        if (!m_doc)
275
                setDoc(item->doc());
276
 
277
        m_haveItem = false;
278
        m_item = item;
279
 
280
        bool   mirrorX, mirrorY;
281
        double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
282
        m_item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
283
        m_item->patternFlip(mirrorX, mirrorY);
284
 
285
        transPalWidget->setCurrentItem(m_item);
16744 fschmid 286
        nonZero->setChecked(!m_item->fillRule);
287
        evenOdd->setChecked(m_item->fillRule);
16546 jghali 288
 
289
        if ((m_item->isGroup()) && (!m_item->isSingleSel))
290
        {
291
                setEnabled(true);
292
                if (m_item->FrameType == 0)
293
                        customShape->setIcon(customShape->getIconPixmap(0));
294
                if (m_item->FrameType == 1)
295
                        customShape->setIcon(customShape->getIconPixmap(1));
296
                if (m_item->FrameType > 3)
297
                        customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2));
298
                transPalWidget->updateFromItem();
299
                transPalWidget->setActPattern(m_item->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
300
                customShape->setEnabled(true);
301
                editShape->setEnabled(true);
302
                shapeGroup->setEnabled(true);
303
                textFlowDisabled->setEnabled(true);
304
                textFlowUsesFrameShape->setEnabled(true);
305
                textFlowUsesBoundingBox->setEnabled(true);
306
                textFlowUsesContourLine->setEnabled(true);
307
                textFlowUsesImageClipping->setEnabled(false);
308
        }
309
        else
310
        {
311
                setEnabled(false);
312
        }
313
 
314
        m_haveItem = true;
315
 
316
        if (m_item->asOSGFrame())
317
        {
318
                setEnabled(false);
319
        }
320
        if (m_item->asSymbolFrame())
321
        {
322
                setEnabled(true);
323
                if (m_item->FrameType == 0)
324
                        customShape->setIcon(customShape->getIconPixmap(0));
325
                if (m_item->FrameType == 1)
326
                        customShape->setIcon(customShape->getIconPixmap(1));
327
                if (m_item->FrameType > 3)
328
                        customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2));
329
                transPalWidget->updateFromItem();
330
                transPalWidget->setActPattern(m_item->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
331
                customShape->setEnabled(true);
332
                editShape->setEnabled(true);
333
                shapeGroup->setEnabled(true);
334
                textFlowDisabled->setEnabled(true);
335
                textFlowUsesFrameShape->setEnabled(true);
336
                textFlowUsesBoundingBox->setEnabled(true);
337
                textFlowUsesContourLine->setEnabled(true);
338
                textFlowUsesImageClipping->setEnabled(false);
339
        }
17038 fschmid 340
        displayTextFlowMode(m_item->textFlowMode());
16546 jghali 341
}
342
 
343
void PropertiesPalette_Group::displayTextFlowMode(PageItem::TextFlowMode mode)
344
{
345
        if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveItem)
346
                return;
347
        if (m_item->isGroup())
348
        {
349
                if (mode == PageItem::TextFlowDisabled)
350
                        textFlowDisabled->setChecked(true);
351
                else if (mode == PageItem::TextFlowUsesFrameShape)
352
                        textFlowUsesFrameShape->setChecked(true);
353
                else if (mode == PageItem::TextFlowUsesBoundingBox)
354
                        textFlowUsesBoundingBox->setChecked(true);
355
                else if (mode == PageItem::TextFlowUsesContourLine)
356
                        textFlowUsesContourLine->setChecked(true);
357
                else if (mode == PageItem::TextFlowUsesImageClipping)
358
                        textFlowUsesImageClipping->setChecked(true);
359
                if ((m_item->asImageFrame()) && (m_item->imageClip.size() != 0))
360
                        textFlowUsesImageClipping->setEnabled(true);
361
                else
362
                        textFlowUsesImageClipping->setEnabled(false);
363
        }
364
}
365
 
366
void PropertiesPalette_Group::updateColorList()
367
{
368
        if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
369
                return;
370
        transPalWidget->setColors(m_doc->PageColors);
371
        transPalWidget->setPatterns(&m_doc->docPatterns);
372
        transPalWidget->setGradients(&m_doc->docGradients);
373
}
374
 
375
void PropertiesPalette_Group::updateColorSpecialGradient()
376
{
377
        if (!m_haveDoc)
378
                return;
379
        if(m_doc->m_Selection->isEmpty())
380
                return;
381
        PageItem *currItem = m_doc->m_Selection->itemAt(0);
382
        if (currItem)
383
        {
384
                switch (m_ScMW->view->editStrokeGradient)
385
                {
386
                case 0:
387
                case 1:
388
                case 3:
389
                case 4:
390
                case 5:
391
                case 6:
392
                case 7:
393
                        break;
394
                default:
395
                        if (currItem->isGroup())
18134 jghali 396
                                transPalWidget->setSpecialGradient(currItem->GrMaskStartX, currItem->GrMaskStartY, currItem->GrMaskEndX, currItem->GrMaskEndY, currItem->GrMaskFocalX, currItem->GrMaskFocalY, currItem->GrMaskScale, currItem->GrMaskSkew);
16546 jghali 397
                }
398
        }
399
}
400
 
17388 jghali 401
void PropertiesPalette_Group::handleGradientChanged()
402
{
403
        if (m_haveDoc)
404
        {
405
                VGradient vg(transPalWidget->gradEdit->gradient());
406
                m_doc->itemSelection_SetMaskGradient(vg);
407
        }
408
}
409
 
16546 jghali 410
void PropertiesPalette_Group::handleGroupTransparency(double trans)
411
{
412
        if ((m_haveDoc) && (m_haveItem))
413
        {
414
                m_item->setFillTransparency(trans);
415
                m_item->update();
416
        }
417
}
418
 
419
void PropertiesPalette_Group::handleGroupBlending(int blend)
420
{
421
        if ((m_haveDoc) && (m_haveItem))
422
        {
423
                m_item->setFillBlendmode(blend);
424
                m_item->update();
425
        }
426
}
427
 
428
void PropertiesPalette_Group::handleGroupGradMask(int typ)
429
{
430
        if ((m_haveDoc) && (m_haveItem))
431
        {
432
                m_item->GrMask = typ;
433
                if ((typ > 0) && (typ < 7))
434
                        m_item->updateGradientVectors();
435
                m_item->update();
436
        }
437
}
438
 
439
void PropertiesPalette_Group::handleGroupPatternMask(QString pattern)
440
{
441
        if ((m_haveDoc) && (m_haveItem))
442
        {
443
                m_item->setPatternMask(pattern);
444
                m_item->update();
445
        }
446
}
447
 
448
void PropertiesPalette_Group::handleGroupPatternMaskProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
449
{
450
        if ((m_haveDoc) && (m_haveItem))
451
        {
452
                m_item->setMaskTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY);
453
                m_item->setMaskFlip(mirrorX, mirrorY);
454
                m_item->update();
455
        }
456
}
457
 
458
void PropertiesPalette_Group::handleNewShape(int frameType, int count, qreal *points)
459
{
460
        if (!m_ScMW || m_ScMW->scriptIsRunning())
461
                return;
462
        if ((m_haveDoc) && (m_haveItem))
463
        {
464
                if ((m_item->itemType() == PageItem::PolyLine) || (m_item->itemType() == PageItem::PathText))
465
                        return;
466
 
467
                m_doc->item_setFrameShape(m_item, frameType, count, points);
17097 fschmid 468
                m_doc->invalidateAll();
469
                m_doc->regionsChanged()->update(QRect());
16546 jghali 470
 
471
                //ScribusDoc::changed() is called in item_setFrameShape()
472
                //Hope this is enough
473
                //emit DocChanged();
474
                emit shapeChanged(frameType);
475
        }
476
}
477
 
478
void PropertiesPalette_Group::handleTextFlow()
479
{
480
        if (!m_ScMW || m_ScMW->scriptIsRunning())
481
                return;
482
        if ((m_haveDoc) && (m_haveItem))
483
        {
484
                PageItem::TextFlowMode mode = PageItem::TextFlowDisabled;
485
                if (m_item->isGroup())
486
                {
487
                        if (textFlowDisabled->isChecked())
488
                                mode = PageItem::TextFlowDisabled;
489
                        if (textFlowUsesFrameShape->isChecked())
490
                                mode = PageItem::TextFlowUsesFrameShape;
491
                        if (textFlowUsesBoundingBox->isChecked())
492
                                mode = PageItem::TextFlowUsesBoundingBox;
493
                        if (textFlowUsesContourLine->isChecked())
494
                                mode = PageItem::TextFlowUsesContourLine;
495
                        if (textFlowUsesImageClipping->isChecked())
496
                                mode = PageItem::TextFlowUsesImageClipping;
497
                }
498
                m_item->setTextFlowMode(mode);
17099 jghali 499
                m_doc->changed();
17057 fschmid 500
                m_doc->invalidateAll();
17038 fschmid 501
                m_doc->regionsChanged()->update(QRect());
16546 jghali 502
        }
503
}
504
 
505
void PropertiesPalette_Group::handleGradientEdit()
506
{
507
        if (!m_ScMW || m_ScMW->scriptIsRunning())
508
                return;
509
        if ((m_haveDoc) && (m_haveItem))
510
        {
511
                m_ScMW->view->editStrokeGradient = 2;
512
                if (transPalWidget->gradEditButton->isChecked())
513
                        m_ScMW->view->requestMode(modeEditGradientVectors);
514
                else
515
                        m_ScMW->view->requestMode(modeNormal);
516
        }
517
}
518
 
519
void PropertiesPalette_Group::handleSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
520
{
521
        if (!m_ScMW || m_ScMW->scriptIsRunning())
522
                return;
523
        if ((m_haveDoc) && (m_haveItem))
524
        {
525
                QRectF upRect;
526
                m_item->GrMaskStartX = x1 / m_unitRatio;
527
                m_item->GrMaskStartY = y1 / m_unitRatio;
528
                m_item->GrMaskEndX = x2 / m_unitRatio;
529
                m_item->GrMaskEndY = y2 / m_unitRatio;
530
                m_item->GrMaskFocalX = fx / m_unitRatio;
531
                m_item->GrMaskFocalY = fy / m_unitRatio;
532
                m_item->GrMaskScale = sg;
533
                m_item->GrMaskSkew = sk;
534
                if ((m_item->GrMask == 1) || (m_item->GrMask == 4))
535
                {
536
                        m_item->GrMaskFocalX = m_item->GrMaskStartX;
537
                        m_item->GrMaskFocalY = m_item->GrMaskStartY;
538
                }
539
                m_item->update();
540
                upRect = QRectF(QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY), QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY));
541
                double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
542
                double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
543
                QTransform m;
544
                m.translate(m_item->GrMaskStartX, m_item->GrMaskStartY);
545
                m.rotate(rotEnd);
546
                m.rotate(-90);
547
                m.rotate(m_item->GrMaskSkew);
548
                m.translate(radEnd * m_item->GrMaskScale, 0);
549
                QPointF shP = m.map(QPointF(0,0));
550
                upRect |= QRectF(shP, QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY)).normalized();
551
                upRect |= QRectF(shP, QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY)).normalized();
552
                upRect |= QRectF(shP, QPointF(0, 0)).normalized();
553
                upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
554
                upRect.translate(m_item->xPos(), m_item->yPos());
555
                m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
17099 jghali 556
                m_doc->changed();
16546 jghali 557
        }
558
}
559
 
16744 fschmid 560
void PropertiesPalette_Group::handleFillRule()
561
{
562
        if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
563
                return;
564
        m_item->fillRule = evenOdd->isChecked();
565
        m_item->update();
566
}
567
 
16546 jghali 568
void PropertiesPalette_Group::handleShapeEdit()
569
{
570
        if (!m_ScMW || m_ScMW->scriptIsRunning())
571
                return;
572
        if ((m_haveDoc) && (m_haveItem))
573
        {
574
                m_tmpSelection->clear();
575
                m_tmpSelection->copy(*m_doc->m_Selection, true);
576
                m_doc->m_Selection->clear();
577
                m_doc->m_Selection->addItem(m_item);
578
                m_item->isSingleSel = true;
579
                m_item->update();
580
                m_ScMW->view->requestMode(modeEditClip);
16976 fschmid 581
                m_ScMW->scrActions["itemUngroup"]->setEnabled(false);
16546 jghali 582
                connect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded()));
583
                emit shapeEditStarted();
584
        }
585
}
586
 
587
void PropertiesPalette_Group::handleShapeEditEnded()
588
{
589
        disconnect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded()));
590
        if ((m_haveDoc) && (m_haveItem))
591
        {
592
                if (m_tmpSelection->count() > 0)
593
                {
594
                        m_doc->m_Selection->copy(*m_tmpSelection, false);
595
                        m_doc->m_Selection->connectItemToGUI();
596
                }
597
                m_tmpSelection->clear();
16976 fschmid 598
//              m_ScMW->propertiesPalette->setCurrentItem(m_doc->m_Selection->itemAt(0));
599
//              m_ScMW->scrActions["itemGroup"]->setEnabled(true);
600
//              m_ScMW->propertiesPalette->xyzPal->doUnGroup->setEnabled(true);
16546 jghali 601
        }
602
}
603
 
604
void PropertiesPalette_Group::changeEvent(QEvent *e)
605
{
606
        if (e->type() == QEvent::LanguageChange)
607
        {
608
                languageChange();
609
                return;
610
        }
611
        QWidget::changeEvent(e);
612
}
613
 
614
 
615
void PropertiesPalette_Group::languageChange()
616
{
617
        editShape->setText( tr("&Edit..."));
618
        shapeGroup->setTitle( tr("Shape"));
619
 
620
        textFlowGroup->setTitle( tr("Text &Flow Around Frame"));
621
        textFlowDisabled->setText( tr("Disabled"));
622
        textFlowUsesFrameShape->setText( tr("Use Frame &Shape"));
623
        textFlowUsesBoundingBox->setText( tr("Use &Bounding Box"));
624
        textFlowUsesContourLine->setText( tr("&Use Contour Line"));
625
        textFlowUsesImageClipping->setText( tr("Use Image Clip Path"));
626
 
627
        textFlowDisabled->setToolTip( tr("Disable text flow from lower frames around object"));
628
        textFlowUsesFrameShape->setToolTip( tr("Use the frame shape for text flow of text frames below the object."));
629
        textFlowUsesBoundingBox->setToolTip(  "<qt>" + tr("Use the bounding box, which is always rectangular, instead of the frame's shape for text flow of text frames below the object. ") + "</qt>" );
630
        textFlowUsesContourLine->setToolTip(  "<qt>" + tr("When chosen, the contour line can be edited with the Edit Shape Tool on the palette further above. When edited via the shape palette, this becomes a second separate line originally based on the frame's shape for text flow of text frames below the object.") + "</qt>" );
631
        textFlowUsesImageClipping->setToolTip(  "<qt>" + tr("Use the clipping path of the image") + "</qt>" );
632
}
633
 
634
void PropertiesPalette_Group::unitChange()
635
{
636
        if (!m_doc)
637
                return;
638
 
639
        double oldRatio = m_unitRatio;
640
        m_unitRatio = m_doc->unitRatio();
641
        m_unitIndex = m_doc->unitIndex();
642
 
643
        transPalWidget->blockSignals(true);
644
        transPalWidget->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
645
        transPalWidget->blockSignals(false);
16744 fschmid 646
}