Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
15600 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
 
43
#if defined(_MSC_VER)
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 "text/nlsconfig.h"
61
#include "ui/autoform.h"
15661 jghali 62
#include "ui/nodeeditpalette.h"
17020 jghali 63
#include "ui/propertiespalette.h"
15600 jghali 64
#include "ui/propertiespalette_utils.h"
17020 jghali 65
#include "ui/propertiespalette_xyz.h"
15600 jghali 66
#include "ui/transparencypalette.h"
67
 
68
PropertiesPalette_Group::PropertiesPalette_Group( QWidget* parent) : QWidget(parent)
69
{
70
        m_ScMW = 0;
71
        m_doc  = 0;
72
        m_haveDoc   = false;
73
        m_haveItem  = false;
74
        m_unitRatio = 1.0;
75
 
76
        m_tmpSelection = new Selection(this, false);
77
        m_tmpSelection->clear();
78
 
16077 jghali 79
        setupUi(this);
15600 jghali 80
 
16077 jghali 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")));
15600 jghali 86
 
16077 jghali 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));
15600 jghali 92
 
16077 jghali 93
        transPalWidget->hideSelectionButtons();
15600 jghali 94
 
95
        languageChange();
96
 
16077 jghali 97
        connect(textFlowBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleTextFlow()));
15600 jghali 98
 
16077 jghali 99
        connect(customShape  , SIGNAL(FormSel(int, int, qreal *)), this, SLOT(handleNewShape(int, int, qreal *)));
16805 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()));
16077 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 )));
15600 jghali 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
                {
16173 jghali 115
                        currentItem = m_doc->m_Selection->itemAt(0);
15600 jghali 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
 
16957 jghali 130
        connect(this->transPalWidget, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged()));
16179 jghali 131
        connect(this                , SIGNAL(DocChanged())     , m_ScMW, SLOT(slotDocCh()));
132
        connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int)));
15600 jghali 133
}
134
 
135
void PropertiesPalette_Group::setDoc(ScribusDoc *d)
136
{
137
        if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
138
                return;
139
 
140
        if (m_doc)
141
        {
142
                disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
143
                disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
144
        }
145
 
16077 jghali 146
        disconnect(this->transPalWidget, SIGNAL(NewTrans(double)), 0, 0);
147
        disconnect(this->transPalWidget, SIGNAL(NewBlend(int)), 0, 0);
148
        disconnect(this->transPalWidget, SIGNAL(NewGradient(int)), 0, 0);
149
        disconnect(this->transPalWidget, SIGNAL(NewPattern(QString)), 0, 0);
150
        disconnect(this->transPalWidget, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
15600 jghali 151
 
152
        m_doc  = d;
153
        m_item = NULL;
154
        m_unitRatio   = m_doc->unitRatio();
155
        m_unitIndex   = m_doc->unitIndex();
156
 
16077 jghali 157
        transPalWidget->setDocument(m_doc);
158
        transPalWidget->setCurrentItem(NULL);
15600 jghali 159
 
160
        m_haveDoc  = true;
161
        m_haveItem = false;
162
 
16077 jghali 163
        connect(this->transPalWidget, SIGNAL(NewTrans(double))   , this, SLOT(handleGroupTransparency(double)));
164
        connect(this->transPalWidget, SIGNAL(NewBlend(int))      , this, SLOT(handleGroupBlending(int)));
165
        connect(this->transPalWidget, SIGNAL(NewGradient(int))   , this, SLOT(handleGroupGradMask(int)));
166
        connect(this->transPalWidget, SIGNAL(NewPattern(QString)), this, SLOT(handleGroupPatternMask(QString)));
167
        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)));
15600 jghali 168
 
169
        connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
170
        connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
171
}
172
 
173
void PropertiesPalette_Group::unsetDoc()
174
{
15741 jghali 175
        if (m_doc)
176
        {
177
                disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
178
                disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
179
        }
180
 
15600 jghali 181
        m_haveDoc  = false;
182
        m_haveItem = false;
183
        m_doc   = NULL;
184
        m_item  = NULL;
185
 
16077 jghali 186
        transPalWidget->setDocument(NULL);
187
        transPalWidget->setCurrentItem(NULL);
15600 jghali 188
 
189
        setEnabled(false);
190
}
191
 
192
void PropertiesPalette_Group::unsetItem()
193
{
194
        m_haveItem = false;
195
        m_item     = NULL;
16077 jghali 196
        transPalWidget->setCurrentItem(NULL);
15600 jghali 197
        handleSelectionChanged();
198
}
199
 
200
void PropertiesPalette_Group::handleSelectionChanged()
201
{
202
        if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
203
                return;
204
 
205
        PageItem* currItem = currentItemFromSelection();
206
        if (m_doc->m_Selection->count() > 1)
207
        {
208
                bool widgetEnabled = false;
209
                if (m_haveItem && m_item)
210
                {
16173 jghali 211
                        if ((m_item->isGroup()) && (!m_item->isSingleSel))
15600 jghali 212
                                widgetEnabled = true;
213
                }
214
                setEnabled(widgetEnabled);
215
        }
216
        else
217
        {
218
                int itemType = currItem ? (int) currItem->itemType() : -1;
219
                m_haveItem = (itemType != -1);
220
 
221
                switch (itemType)
222
                {
223
                case -1:
224
                        setEnabled(false);
225
                        break;
226
                case PageItem::ImageFrame:
227
                case PageItem::LatexFrame:
228
                case PageItem::OSGFrame:
229
                        if (currItem->asOSGFrame())
230
                        {
231
                                setEnabled(false);
232
                        }
233
                        break;
16222 jghali 234
                case PageItem::Arc:
15600 jghali 235
                case PageItem::TextFrame:
236
                case PageItem::Line:
237
                case PageItem::ItemType1:
238
                case PageItem::ItemType3:
239
                case PageItem::Polygon:
240
                case PageItem::PolyLine:
241
                case PageItem::PathText:
16222 jghali 242
                case PageItem::RegularPolygon:
243
                        setEnabled(false);
15600 jghali 244
                        break;
245
                case PageItem::Symbol:
246
                        setEnabled(true);
247
                        break;
248
                }
249
        }
250
        if (currItem)
251
        {
252
                setCurrentItem(currItem);
253
        }
254
        updateGeometry();
255
        repaint();
256
}
257
 
16179 jghali 258
void PropertiesPalette_Group::handleUpdateRequest(int updateFlags)
259
{
260
        if (updateFlags & reqColorsUpdate)
261
                updateColorList();
262
}
263
 
15600 jghali 264
void PropertiesPalette_Group::setCurrentItem(PageItem *item)
265
{
266
        if (!m_ScMW || m_ScMW->scriptIsRunning())
267
                return;
268
        //CB We shouldnt really need to process this if our item is the same one
269
        //maybe we do if the item has been changed by scripter.. but that should probably
270
        //set some status if so.
271
        //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL.
272
        //if (m_item == i)
273
        //      return;
274
 
275
        if (!m_doc)
276
                setDoc(item->doc());
277
 
278
        m_haveItem = false;
279
        m_item = item;
280
 
281
        bool   mirrorX, mirrorY;
282
        double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
283
        m_item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
284
        m_item->patternFlip(mirrorX, mirrorY);
285
 
16077 jghali 286
        transPalWidget->setCurrentItem(m_item);
16781 jghali 287
        nonZero->setChecked(!m_item->fillRule);
288
        evenOdd->setChecked(m_item->fillRule);
15600 jghali 289
 
16173 jghali 290
        if ((m_item->isGroup()) && (!m_item->isSingleSel))
15600 jghali 291
        {
292
                setEnabled(true);
293
                if (m_item->FrameType == 0)
16077 jghali 294
                        customShape->setIcon(customShape->getIconPixmap(0));
15600 jghali 295
                if (m_item->FrameType == 1)
16077 jghali 296
                        customShape->setIcon(customShape->getIconPixmap(1));
15600 jghali 297
                if (m_item->FrameType > 3)
16077 jghali 298
                        customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2));
299
                transPalWidget->updateFromItem();
300
                transPalWidget->setActPattern(m_item->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
301
                customShape->setEnabled(true);
302
                editShape->setEnabled(true);
303
                shapeGroup->setEnabled(true);
304
                textFlowDisabled->setEnabled(true);
305
                textFlowUsesFrameShape->setEnabled(true);
306
                textFlowUsesBoundingBox->setEnabled(true);
307
                textFlowUsesContourLine->setEnabled(true);
308
                textFlowUsesImageClipping->setEnabled(false);
15600 jghali 309
        }
310
        else
311
        {
312
                setEnabled(false);
313
        }
314
 
315
        m_haveItem = true;
316
 
317
        if (m_item->asOSGFrame())
318
        {
319
                setEnabled(false);
320
        }
321
        if (m_item->asSymbolFrame())
322
        {
323
                setEnabled(true);
324
                if (m_item->FrameType == 0)
16077 jghali 325
                        customShape->setIcon(customShape->getIconPixmap(0));
15600 jghali 326
                if (m_item->FrameType == 1)
16077 jghali 327
                        customShape->setIcon(customShape->getIconPixmap(1));
15600 jghali 328
                if (m_item->FrameType > 3)
16077 jghali 329
                        customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2));
330
                transPalWidget->updateFromItem();
331
                transPalWidget->setActPattern(m_item->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
332
                customShape->setEnabled(true);
333
                editShape->setEnabled(true);
334
                shapeGroup->setEnabled(true);
335
                textFlowDisabled->setEnabled(true);
336
                textFlowUsesFrameShape->setEnabled(true);
337
                textFlowUsesBoundingBox->setEnabled(true);
338
                textFlowUsesContourLine->setEnabled(true);
339
                textFlowUsesImageClipping->setEnabled(false);
15600 jghali 340
        }
341
}
342
 
343
void PropertiesPalette_Group::displayTextFlowMode(PageItem::TextFlowMode mode)
344
{
345
        if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveItem)
346
                return;
16173 jghali 347
        if (m_item->isGroup())
15600 jghali 348
        {
349
                if (mode == PageItem::TextFlowDisabled)
16077 jghali 350
                        textFlowDisabled->setChecked(true);
15600 jghali 351
                else if (mode == PageItem::TextFlowUsesFrameShape)
16077 jghali 352
                        textFlowUsesFrameShape->setChecked(true);
15600 jghali 353
                else if (mode == PageItem::TextFlowUsesBoundingBox)
16077 jghali 354
                        textFlowUsesBoundingBox->setChecked(true);
15600 jghali 355
                else if (mode == PageItem::TextFlowUsesContourLine)
16077 jghali 356
                        textFlowUsesContourLine->setChecked(true);
15600 jghali 357
                else if (mode == PageItem::TextFlowUsesImageClipping)
16077 jghali 358
                        textFlowUsesImageClipping->setChecked(true);
15600 jghali 359
                if ((m_item->asImageFrame()) && (m_item->imageClip.size() != 0))
16077 jghali 360
                        textFlowUsesImageClipping->setEnabled(true);
15600 jghali 361
                else
16077 jghali 362
                        textFlowUsesImageClipping->setEnabled(false);
15600 jghali 363
        }
364
}
365
 
366
void PropertiesPalette_Group::updateColorList()
367
{
368
        if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
369
                return;
16077 jghali 370
        transPalWidget->setColors(m_doc->PageColors);
371
        transPalWidget->setPatterns(&m_doc->docPatterns);
372
        transPalWidget->setGradients(&m_doc->docGradients);
15600 jghali 373
}
374
 
375
void PropertiesPalette_Group::updateColorSpecialGradient()
376
{
377
        if (!m_haveDoc)
378
                return;
379
        if(m_doc->m_Selection->isEmpty())
380
                return;
381
        double ratio = m_doc->unitRatio();
382
        PageItem *currItem = m_doc->m_Selection->itemAt(0);
383
        if (currItem)
384
        {
385
                switch (m_ScMW->view->editStrokeGradient)
386
                {
387
                case 0:
388
                case 1:
389
                case 3:
390
                case 4:
391
                case 5:
392
                case 6:
393
                case 7:
394
                        break;
395
                default:
16173 jghali 396
                        if (currItem->isGroup())
16077 jghali 397
                                transPalWidget->setSpecialGradient(currItem->GrMaskStartX * ratio, currItem->GrMaskStartY * ratio, currItem->GrMaskEndX * ratio, currItem->GrMaskEndY * ratio, currItem->GrMaskFocalX * ratio, currItem->GrMaskFocalY * ratio, currItem->GrMaskScale, currItem->GrMaskSkew);
15600 jghali 398
                }
399
        }
400
}
401
 
16957 jghali 402
void PropertiesPalette_Group::handleGradientChanged()
403
{
404
        if (m_haveDoc)
405
        {
406
                VGradient vg(transPalWidget->gradEdit->gradient());
407
                m_doc->itemSelection_SetMaskGradient(vg);
408
        }
409
}
410
 
15614 jghali 411
void PropertiesPalette_Group::handleGroupTransparency(double trans)
412
{
413
        if ((m_haveDoc) && (m_haveItem))
414
        {
415
                m_item->setFillTransparency(trans);
416
                m_item->update();
417
                emit DocChanged();
418
        }
419
}
420
 
421
void PropertiesPalette_Group::handleGroupBlending(int blend)
422
{
423
        if ((m_haveDoc) && (m_haveItem))
424
        {
425
                m_item->setFillBlendmode(blend);
426
                m_item->update();
427
                emit DocChanged();
428
        }
429
}
430
 
431
void PropertiesPalette_Group::handleGroupGradMask(int typ)
432
{
433
        if ((m_haveDoc) && (m_haveItem))
434
        {
435
                m_item->GrMask = typ;
436
                if ((typ > 0) && (typ < 7))
437
                        m_item->updateGradientVectors();
438
                m_item->update();
439
                emit DocChanged();
440
        }
441
}
442
 
443
void PropertiesPalette_Group::handleGroupPatternMask(QString pattern)
444
{
445
        if ((m_haveDoc) && (m_haveItem))
446
        {
447
                m_item->setPatternMask(pattern);
448
                m_item->update();
449
                emit DocChanged();
450
        }
451
}
452
 
453
void PropertiesPalette_Group::handleGroupPatternMaskProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
454
{
455
        if ((m_haveDoc) && (m_haveItem))
456
        {
457
                m_item->setMaskTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY);
458
                m_item->setMaskFlip(mirrorX, mirrorY);
459
                m_item->update();
460
                emit DocChanged();
461
        }
462
}
463
 
15600 jghali 464
void PropertiesPalette_Group::handleNewShape(int frameType, int count, qreal *points)
465
{
466
        if (!m_ScMW || m_ScMW->scriptIsRunning())
467
                return;
468
        if ((m_haveDoc) && (m_haveItem))
469
        {
470
                if ((m_item->itemType() == PageItem::PolyLine) || (m_item->itemType() == PageItem::PathText))
471
                        return;
472
 
473
                m_doc->item_setFrameShape(m_item, frameType, count, points);
474
 
475
                //ScribusDoc::changed() is called in item_setFrameShape()
476
                //Hope this is enough
477
                //emit DocChanged();
478
                emit shapeChanged(frameType);
479
        }
480
}
481
 
482
void PropertiesPalette_Group::handleTextFlow()
483
{
484
        if (!m_ScMW || m_ScMW->scriptIsRunning())
485
                return;
486
        if ((m_haveDoc) && (m_haveItem))
487
        {
488
                PageItem::TextFlowMode mode = PageItem::TextFlowDisabled;
16173 jghali 489
                if (m_item->isGroup())
15600 jghali 490
                {
16077 jghali 491
                        if (textFlowDisabled->isChecked())
15600 jghali 492
                                mode = PageItem::TextFlowDisabled;
16077 jghali 493
                        if (textFlowUsesFrameShape->isChecked())
15600 jghali 494
                                mode = PageItem::TextFlowUsesFrameShape;
16077 jghali 495
                        if (textFlowUsesBoundingBox->isChecked())
15600 jghali 496
                                mode = PageItem::TextFlowUsesBoundingBox;
16077 jghali 497
                        if (textFlowUsesContourLine->isChecked())
15600 jghali 498
                                mode = PageItem::TextFlowUsesContourLine;
16077 jghali 499
                        if (textFlowUsesImageClipping->isChecked())
15600 jghali 500
                                mode = PageItem::TextFlowUsesImageClipping;
501
                }
502
                m_item->setTextFlowMode(mode);
503
                m_ScMW->view->DrawNew();
504
                emit DocChanged();
505
        }
506
}
507
 
508
void PropertiesPalette_Group::handleGradientEdit()
509
{
510
        if (!m_ScMW || m_ScMW->scriptIsRunning())
511
                return;
512
        if ((m_haveDoc) && (m_haveItem))
513
        {
514
                m_ScMW->view->editStrokeGradient = 2;
16077 jghali 515
                if (transPalWidget->gradEditButton->isChecked())
15600 jghali 516
                        m_ScMW->view->requestMode(modeEditGradientVectors);
517
                else
518
                        m_ScMW->view->requestMode(modeNormal);
519
        }
520
}
521
 
522
void PropertiesPalette_Group::handleSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
523
{
524
        if (!m_ScMW || m_ScMW->scriptIsRunning())
525
                return;
526
        if ((m_haveDoc) && (m_haveItem))
527
        {
528
                QRectF upRect;
529
                m_item->GrMaskStartX = x1 / m_unitRatio;
530
                m_item->GrMaskStartY = y1 / m_unitRatio;
531
                m_item->GrMaskEndX = x2 / m_unitRatio;
532
                m_item->GrMaskEndY = y2 / m_unitRatio;
533
                m_item->GrMaskFocalX = fx / m_unitRatio;
534
                m_item->GrMaskFocalY = fy / m_unitRatio;
535
                m_item->GrMaskScale = sg;
536
                m_item->GrMaskSkew = sk;
537
                if ((m_item->GrMask == 1) || (m_item->GrMask == 4))
538
                {
539
                        m_item->GrMaskFocalX = m_item->GrMaskStartX;
540
                        m_item->GrMaskFocalY = m_item->GrMaskStartY;
541
                }
542
                m_item->update();
543
                upRect = QRectF(QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY), QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY));
544
                double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
545
                double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
546
                QTransform m;
547
                m.translate(m_item->GrMaskStartX, m_item->GrMaskStartY);
548
                m.rotate(rotEnd);
549
                m.rotate(-90);
550
                m.rotate(m_item->GrMaskSkew);
551
                m.translate(radEnd * m_item->GrMaskScale, 0);
552
                QPointF shP = m.map(QPointF(0,0));
553
                upRect |= QRectF(shP, QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY)).normalized();
554
                upRect |= QRectF(shP, QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY)).normalized();
555
                upRect |= QRectF(shP, QPointF(0, 0)).normalized();
556
                upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
557
                upRect.translate(m_item->xPos(), m_item->yPos());
558
                m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
559
                emit DocChanged();
560
        }
561
}
562
 
16781 jghali 563
void PropertiesPalette_Group::handleFillRule()
564
{
565
        if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
566
                return;
567
        m_item->fillRule = evenOdd->isChecked();
568
        m_item->update();
569
        emit DocChanged();
570
}
571
 
15661 jghali 572
void PropertiesPalette_Group::handleShapeEdit()
15600 jghali 573
{
574
        if (!m_ScMW || m_ScMW->scriptIsRunning())
575
                return;
576
        if ((m_haveDoc) && (m_haveItem))
577
        {
578
                m_tmpSelection->clear();
579
                m_tmpSelection->copy(*m_doc->m_Selection, true);
580
                m_doc->m_Selection->clear();
581
                m_doc->m_Selection->addItem(m_item);
582
                m_item->isSingleSel = true;
583
                m_item->update();
584
                m_ScMW->view->requestMode(modeEditClip);
17020 jghali 585
                m_ScMW->scrActions["itemUngroup"]->setEnabled(false);
586
                m_ScMW->propertiesPalette->xyzPal->doUnGroup->setEnabled(false);
15661 jghali 587
                connect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded()));
15600 jghali 588
                emit shapeEditStarted();
589
        }
590
}
591
 
15661 jghali 592
void PropertiesPalette_Group::handleShapeEditEnded()
593
{
594
        disconnect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded()));
595
        if ((m_haveDoc) && (m_haveItem))
596
        {
597
                if (m_tmpSelection->count() > 0)
598
                {
599
                        m_doc->m_Selection->copy(*m_tmpSelection, false);
600
                        m_doc->m_Selection->connectItemToGUI();
601
                }
602
                m_tmpSelection->clear();
17020 jghali 603
//              m_ScMW->propertiesPalette->setCurrentItem(m_doc->m_Selection->itemAt(0));
604
//              m_ScMW->scrActions["itemGroup"]->setEnabled(true);
605
//              m_ScMW->propertiesPalette->xyzPal->doUnGroup->setEnabled(true);
15661 jghali 606
        }
607
}
608
 
15600 jghali 609
void PropertiesPalette_Group::changeEvent(QEvent *e)
610
{
611
        if (e->type() == QEvent::LanguageChange)
612
        {
613
                languageChange();
614
                return;
615
        }
616
        QWidget::changeEvent(e);
617
}
618
 
619
 
620
void PropertiesPalette_Group::languageChange()
621
{
16077 jghali 622
        editShape->setText( tr("&Edit..."));
623
        shapeGroup->setTitle( tr("Shape"));
15600 jghali 624
 
16077 jghali 625
        textFlowGroup->setTitle( tr("Text &Flow Around Frame"));
626
        textFlowDisabled->setText( tr("Disabled"));
627
        textFlowUsesFrameShape->setText( tr("Use Frame &Shape"));
628
        textFlowUsesBoundingBox->setText( tr("Use &Bounding Box"));
629
        textFlowUsesContourLine->setText( tr("&Use Contour Line"));
630
        textFlowUsesImageClipping->setText( tr("Use Image Clip Path"));
15600 jghali 631
 
16077 jghali 632
        textFlowDisabled->setToolTip( tr("Disable text flow from lower frames around object"));
633
        textFlowUsesFrameShape->setToolTip( tr("Use the frame shape for text flow of text frames below the object."));
634
        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>" );
635
        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>" );
636
        textFlowUsesImageClipping->setToolTip(  "<qt>" + tr("Use the clipping path of the image") + "</qt>" );
15600 jghali 637
}
638
 
639
void PropertiesPalette_Group::unitChange()
640
{
641
        if (!m_doc)
642
                return;
643
 
644
        double oldRatio = m_unitRatio;
645
        m_unitRatio = m_doc->unitRatio();
646
        m_unitIndex = m_doc->unitIndex();
647
 
16077 jghali 648
        transPalWidget->blockSignals(true);
649
        transPalWidget->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
650
        transPalWidget->blockSignals(false);
16781 jghali 651
}