~ubuntu-branches/ubuntu/maverick/scribus-ng/maverick-backports

« back to all changes in this revision

Viewing changes to scribus/smwidgets.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2009-02-09 09:25:18 UTC
  • mfrom: (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090209092518-iqsxmh3pjspgrdyd
Tags: 1.3.5.dfsg~svn20090208-2
debian/control: Use "type-handling -n arm,armel,armeb any" to generate the
list of architectures to build on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 "smwidgets.h"
9
 
#include "smwidgets.moc"
10
 
#include <qtooltip.h>
11
 
#include <qlineedit.h>
12
 
#include "units.h"
13
 
 
14
 
/***********************************************************************/
15
 
/***********************************************************************/
16
 
 
17
 
SMSpinBox::SMSpinBox(QWidget *parent, const char *name)
18
 
: QSpinBox(parent, name),
19
 
  hasParent_(false),
20
 
  useParentValue_(false),
21
 
  pValue_(0)
22
 
{
23
 
 
24
 
}
25
 
 
26
 
void SMSpinBox::setValue(int val)
27
 
{
28
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
29
 
        hasParent_ = false;
30
 
        pValue_ = 0;
31
 
        setFont(false);
32
 
 
33
 
        QSpinBox::setValue(val);
34
 
}
35
 
 
36
 
void SMSpinBox::setValue(int val, bool isParentVal)
37
 
{
38
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
39
 
        hasParent_ = true;
40
 
        pValue_ = val;
41
 
        setFont(!isParentVal);
42
 
 
43
 
        QSpinBox::setValue(val);
44
 
        connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
45
 
}
46
 
 
47
 
void SMSpinBox::clear()
48
 
{
49
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
50
 
        editor()->clear();
51
 
        connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
52
 
}
53
 
 
54
 
void SMSpinBox::setParentValue(int val)
55
 
{
56
 
        hasParent_ = true;
57
 
        pValue_ = val;
58
 
}
59
 
 
60
 
bool SMSpinBox::useParentValue()
61
 
{
62
 
        bool ret = useParentValue_;
63
 
        useParentValue_ = false;
64
 
        return ret;
65
 
}
66
 
 
67
 
void SMSpinBox::interpretText()
68
 
{
69
 
//      QString t = text();
70
 
//      if (hasParent_ && (t == "" || t.isEmpty() || t == QString::null))
71
 
        if (hasParent_ && text().isEmpty())
72
 
        {
73
 
                useParentValue_ = true;
74
 
                setValue(pValue_, true);
75
 
        }
76
 
        QSpinBox::interpretText();
77
 
}
78
 
 
79
 
void SMSpinBox::setFont(bool wantBold)
80
 
{
81
 
        QFont f(font());
82
 
        f.setBold(wantBold);
83
 
        QSpinBox::setFont(f);
84
 
}
85
 
 
86
 
void SMSpinBox::slotValueChanged()
87
 
{
88
 
        if(hasParent_)
89
 
                setFont(true);
90
 
}
91
 
 
92
 
/***********************************************************************/
93
 
/***********************************************************************/
94
 
 
95
 
SMMSpinBox::SMMSpinBox(QWidget *pa, int s)
96
 
: MSpinBox(pa, s),
97
 
  hasParent_(false),
98
 
  useParentValue_(false),
99
 
  pValue_(0.0)
100
 
{
101
 
        
102
 
}
103
 
 
104
 
SMMSpinBox::SMMSpinBox(double minValue, double maxValue, QWidget *pa, int s)
105
 
: MSpinBox(minValue, maxValue, pa, s),
106
 
  hasParent_(false),
107
 
  useParentValue_(false),
108
 
  pValue_(0.0)
109
 
{
110
 
        
111
 
}
112
 
 
113
 
SMMSpinBox::SMMSpinBox(QWidget *parent, const char * name)
114
 
: MSpinBox(parent, name),
115
 
  hasParent_(false),
116
 
  useParentValue_(false),
117
 
  pValue_(0.0)
118
 
{
119
 
        
120
 
}
121
 
 
122
 
void SMMSpinBox::setValue(double val)
123
 
{
124
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
125
 
        hasParent_ = false;
126
 
        pValue_ = 0.0;
127
 
        setFont(false);
128
 
 
129
 
        MSpinBox::setValue(val);
130
 
}
131
 
 
132
 
void SMMSpinBox::setValue(double val, bool isParentVal)
133
 
{
134
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
135
 
        hasParent_ = true;
136
 
        pValue_ = val;
137
 
        setFont(!isParentVal);
138
 
 
139
 
        MSpinBox::setValue(val);
140
 
        connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
141
 
}
142
 
 
143
 
void SMMSpinBox::clear()
144
 
{
145
 
        disconnect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
146
 
        editor()->clear();
147
 
        connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
148
 
}
149
 
 
150
 
void SMMSpinBox::setParentValue(double val)
151
 
{
152
 
        hasParent_ = true;
153
 
        pValue_ = val;
154
 
}
155
 
 
156
 
bool SMMSpinBox::useParentValue()
157
 
{
158
 
        bool ret = useParentValue_;
159
 
        useParentValue_ = false;
160
 
        return ret;
161
 
}
162
 
 
163
 
void SMMSpinBox::interpretText()
164
 
{
165
 
//      QString t = text();
166
 
//      if (hasParent_ && (t == "" || t.isEmpty() || t == QString::null))
167
 
        if (hasParent_ && text().isEmpty())
168
 
        {
169
 
                useParentValue_ = true;
170
 
                setValue(pValue_, true);
171
 
        }
172
 
        MSpinBox::interpretText();
173
 
}
174
 
 
175
 
void SMMSpinBox::setFont(bool wantBold)
176
 
{
177
 
        QFont f(font());
178
 
        f.setBold(wantBold);
179
 
        MSpinBox::setFont(f);
180
 
}
181
 
 
182
 
void SMMSpinBox::slotValueChanged()
183
 
{
184
 
        if(hasParent_)
185
 
                setFont(true);
186
 
}
187
 
 
188
 
/***********************************************************************/
189
 
/***********************************************************************/
190
 
 
191
 
SMScComboBox::SMScComboBox(QWidget *parent, const char *name)
192
 
: ScComboBox(parent, name),
193
 
  hasParent_(false),
194
 
  useParentValue_(false),
195
 
  pItem_(0)
196
 
{
197
 
        
198
 
}
199
 
 
200
 
SMScComboBox::SMScComboBox(bool rw, QWidget* parent, const char* name)
201
 
: ScComboBox(rw, parent, name),
202
 
  hasParent_(false),
203
 
  useParentValue_(false),
204
 
  pItem_(0)
205
 
{
206
 
        
207
 
}
208
 
 
209
 
void SMScComboBox::setCurrentItem(int i)
210
 
{
211
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
212
 
        setFont(false);
213
 
        hasParent_ = false;
214
 
        pItem_ = 0;
215
 
        ScComboBox::setCurrentItem(i);
216
 
}
217
 
 
218
 
void SMScComboBox::setCurrentItem(int i, bool isParentValue)
219
 
{
220
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
221
 
        hasParent_ = true;
222
 
        pItem_ = i;
223
 
        setFont(!isParentValue);
224
 
        if (!isParentValue)
225
 
        {
226
 
                useParentValue_ = true;
227
 
                insertItem( tr("Use Parent Value"));
228
 
        }
229
 
 
230
 
        ScComboBox::setCurrentItem(i);
231
 
        connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
232
 
}
233
 
 
234
 
void SMScComboBox::setParentItem(int i)
235
 
{
236
 
        hasParent_ = true;
237
 
        pItem_ = i;
238
 
}
239
 
 
240
 
bool SMScComboBox::useParentValue()
241
 
{
242
 
        bool ret = false;
243
 
 
244
 
        if (useParentValue_ && hasParent_)
245
 
        {
246
 
                ret = currentItem() == (count() - 1);
247
 
                if (ret)
248
 
                {
249
 
                        removeItem(count() - 1);
250
 
                        setFont(false);
251
 
                        setCurrentItem(pItem_, true);
252
 
                        useParentValue_ = false;
253
 
                }
254
 
        }
255
 
 
256
 
        return ret;
257
 
}
258
 
 
259
 
void SMScComboBox::setFont(bool wantBold)
260
 
{
261
 
        QFont f(font());
262
 
        f.setBold(wantBold);
263
 
        ScComboBox::setFont(f);
264
 
}
265
 
 
266
 
void SMScComboBox::currentChanged()
267
 
{
268
 
        if (hasParent_ && !useParentValue_)
269
 
        {
270
 
                setFont(true);
271
 
                insertItem( tr("Use Parent Value"));
272
 
                useParentValue_ = true;
273
 
        }
274
 
}
275
 
 
276
 
/***********************************************************************/
277
 
/***********************************************************************/
278
 
 
279
 
SMAlignSelect::SMAlignSelect(QWidget *parent)
280
 
: AlignSelect(parent),
281
 
  hasParent_(false),
282
 
  useParentStyle_(false),
283
 
  pStyle_(0)
284
 
{
285
 
        parentButton = new QToolButton(this, "parentButton");
286
 
        parentButton->setMaximumSize( QSize( 22, 22 ) );
287
 
        parentButton->setToggleButton( true );
288
 
        parentButton->setText( tr("P", "P as in Parent"));
289
 
        QToolTip::add(parentButton, tr("Use parent style's alignment instead of overriding it"));
290
 
        GroupAlignLayout->addWidget( parentButton, 0, 5 );
291
 
        resize(minimumSizeHint());
292
 
        parentButton->hide();
293
 
}
294
 
 
295
 
void SMAlignSelect::setStyle(int i)
296
 
{
297
 
        disconnect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
298
 
        disconnect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
299
 
        setFont(false);
300
 
        hasParent_ = false;
301
 
        pStyle_ = 0;
302
 
        parentButton->hide();
303
 
        AlignSelect::setStyle(i);
304
 
}
305
 
 
306
 
void SMAlignSelect::setStyle(int i, bool isParentValue)
307
 
{
308
 
        disconnect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
309
 
        disconnect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
310
 
        hasParent_ = true;
311
 
        pStyle_ = i;
312
 
        setFont(!isParentValue);
313
 
        if (isParentValue)
314
 
                parentButton->hide();
315
 
        else
316
 
                parentButton->show();
317
 
 
318
 
        AlignSelect::setStyle(i);
319
 
        connect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
320
 
        connect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
321
 
}
322
 
 
323
 
void SMAlignSelect::setParentItem(int i)
324
 
{
325
 
        hasParent_ = true;
326
 
        pStyle_ = i;
327
 
}
328
 
 
329
 
bool SMAlignSelect::useParentValue()
330
 
{
331
 
        bool ret = useParentStyle_;
332
 
        useParentStyle_ = false;
333
 
        if (ret)
334
 
                setStyle(pStyle_, true);
335
 
 
336
 
        return ret;
337
 
}
338
 
 
339
 
void SMAlignSelect::setFont(bool wantBold)
340
 
{
341
 
        QFont f(font());
342
 
        f.setBold(wantBold);
343
 
        parentButton->setFont(f);
344
 
}
345
 
 
346
 
void SMAlignSelect::styleChanged()
347
 
{
348
 
        if (hasParent_)
349
 
        {
350
 
                setFont(true);
351
 
                parentButton->show();
352
 
        }
353
 
}
354
 
 
355
 
void SMAlignSelect::pbPressed()
356
 
{
357
 
        useParentStyle_ = true;
358
 
}
359
 
 
360
 
/***********************************************************************/
361
 
/***********************************************************************/
362
 
 
363
 
SMStyleSelect::SMStyleSelect(QWidget *parent)
364
 
: StyleSelect(parent),
365
 
  hasParent_(false),
366
 
  useParentStyle_(false),
367
 
  pStyle_(0)
368
 
{
369
 
        parentButton = new QToolButton(this, "parentButton");
370
 
        parentButton->setMaximumSize(QSize(22, 22));
371
 
        parentButton->setMinimumSize(QSize(22, 22));
372
 
        parentButton->setText( tr("P", "P as in Parent"));
373
 
        QToolTip::add(parentButton, tr("Use parent style's effects instead of overriding them"));
374
 
        ssLayout->addWidget(parentButton);
375
 
        resize(minimumSizeHint());
376
 
        parentButton->hide();
377
 
}
378
 
 
379
 
void SMStyleSelect::setStyle(int i)
380
 
{
381
 
        disconnect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
382
 
        disconnect(ShadowVal->Xoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
383
 
        disconnect(ShadowVal->Yoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
384
 
        disconnect(OutlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
385
 
        disconnect(UnderlineVal->LPos, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
386
 
        disconnect(UnderlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
387
 
        disconnect(StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
388
 
        disconnect(StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
389
 
        disconnect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
390
 
        setFont(false);
391
 
        hasParent_ = false;
392
 
        pStyle_ = 0;
393
 
        parentButton->hide();
394
 
        StyleSelect::setStyle(i);
395
 
}
396
 
 
397
 
void SMStyleSelect::setStyle(int i, bool isParentValue)
398
 
{
399
 
        disconnect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
400
 
        disconnect(ShadowVal->Xoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
401
 
        disconnect(ShadowVal->Yoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
402
 
        disconnect(OutlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
403
 
        disconnect(UnderlineVal->LPos, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
404
 
        disconnect(UnderlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
405
 
        disconnect(StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
406
 
        disconnect(StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
407
 
        disconnect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
408
 
        hasParent_ = true;
409
 
        pStyle_ = i;
410
 
        setFont(!isParentValue);
411
 
        if (isParentValue)
412
 
                parentButton->hide();
413
 
        else
414
 
                parentButton->show();
415
 
        parentButton->setOn(true);
416
 
        StyleSelect::setStyle(i);
417
 
        connect(this, SIGNAL(State(int)), this, SLOT(styleChanged()));
418
 
        connect(ShadowVal->Xoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
419
 
        connect(ShadowVal->Yoffset, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
420
 
        connect(OutlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
421
 
        connect(UnderlineVal->LPos, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
422
 
        connect(UnderlineVal->LWidth, SIGNAL(valueChanged(int)),this, SLOT(styleChanged()));
423
 
        connect(StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
424
 
        connect(StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
425
 
        connect(parentButton, SIGNAL(pressed()), this, SLOT(pbPressed()));
426
 
}
427
 
 
428
 
void SMStyleSelect::setParentItem(int i)
429
 
{
430
 
        hasParent_ = true;
431
 
        pStyle_ = i;
432
 
}
433
 
 
434
 
bool SMStyleSelect::useParentValue()
435
 
{
436
 
        bool ret = useParentStyle_;
437
 
        useParentStyle_ = false;
438
 
        if (ret)
439
 
                setStyle(pStyle_, true);
440
 
 
441
 
        return ret;
442
 
}
443
 
 
444
 
void SMStyleSelect::setFont(bool wantBold)
445
 
{
446
 
        QFont f(font());
447
 
        f.setBold(wantBold);
448
 
        parentButton->setFont(f);
449
 
        ShadowVal->Xoffset->setFont(f);
450
 
        ShadowVal->Yoffset->setFont(f);
451
 
        OutlineVal->LWidth->setFont(f);
452
 
        UnderlineVal->LPos->setFont(f);
453
 
        UnderlineVal->LWidth->setFont(f);
454
 
        StrikeVal->LPos->setFont(f);
455
 
        StrikeVal->LWidth->setFont(f);
456
 
        StyleSelect::setFont(f);
457
 
}
458
 
 
459
 
void SMStyleSelect::styleChanged()
460
 
{
461
 
        if (hasParent_)
462
 
        {
463
 
                setFont(true);
464
 
                parentButton->show();
465
 
        }
466
 
}
467
 
 
468
 
void SMStyleSelect::pbPressed()
469
 
{
470
 
        useParentStyle_ = true;
471
 
        emit State(getStyle());
472
 
}
473
 
 
474
 
/***********************************************************************/
475
 
/***********************************************************************/
476
 
 
477
 
/***********************************************************************/
478
 
/***********************************************************************/
479
 
 
480
 
SMShadeButton::SMShadeButton(QWidget *parent)
481
 
: ShadeButton(parent),
482
 
  hasParent_(false),
483
 
  useParentValue_(false),
484
 
  pValue_(0)
485
 
{
486
 
        
487
 
}
488
 
 
489
 
void SMShadeButton::setValue(int i)
490
 
{
491
 
        disconnect(this, SIGNAL(pressed()), this, SLOT(currentChanged()));
492
 
        setFont(false);
493
 
        hasParent_ = false;
494
 
        pValue_ = 0;
495
 
        ShadeButton::setValue(i);
496
 
}
497
 
 
498
 
void SMShadeButton::setValue(int i, bool isParentValue)
499
 
{
500
 
        disconnect(this, SIGNAL(pressed()), this, SLOT(currentChanged()));
501
 
        hasParent_ = true;
502
 
        pValue_ = i;
503
 
        setFont(!isParentValue);
504
 
        ShadeButton::setValue(i);
505
 
        connect(this, SIGNAL(pressed()), this, SLOT(currentChanged()));
506
 
}
507
 
 
508
 
void SMShadeButton::setParentValue(int i)
509
 
{
510
 
        hasParent_ = true;
511
 
        pValue_ = i;
512
 
}
513
 
 
514
 
bool SMShadeButton::useParentValue()
515
 
{
516
 
        bool ret = useParentValue_;
517
 
        useParentValue_ = false;
518
 
 
519
 
        if (ret)
520
 
        {
521
 
                setValue(pValue_, true);
522
 
                FillSh->removeItemAt(FillSh->count() - 1);
523
 
        }
524
 
        
525
 
 
526
 
        return ret;
527
 
}
528
 
 
529
 
void SMShadeButton::setFont(bool wantBold)
530
 
{
531
 
        QFont f(font());
532
 
        f.setBold(wantBold);
533
 
        FillSh->setFont(f);
534
 
        ShadeButton::setFont(f);
535
 
}
536
 
 
537
 
void SMShadeButton::currentChanged()
538
 
{
539
 
        if (hasParent_)
540
 
        {
541
 
                setFont(true);
542
 
                QString upv = tr("Use Parent Value");
543
 
                if (FillSh->text(FillSh->idAt(FillSh->count() - 1)) != upv)
544
 
                        FillSh->insertItem(upv, this, SLOT(slotUseParent()));
545
 
        }
546
 
}
547
 
 
548
 
void SMShadeButton::slotUseParent()
549
 
{
550
 
        useParentValue_ = true;
551
 
        FillSh->removeItemAt(FillSh->count() - 1);
552
 
        emit clicked();
553
 
}
554
 
 
555
 
/***********************************************************************/
556
 
/***********************************************************************/
557
 
 
558
 
/***********************************************************************/
559
 
/***********************************************************************/
560
 
 
561
 
SMColorCombo::SMColorCombo(QWidget *parent, const char *name)
562
 
: ColorCombo(parent, name),
563
 
  hasParent_(false),
564
 
  useParentValue_(false),
565
 
  pItem_(0)
566
 
{
567
 
        
568
 
}
569
 
 
570
 
SMColorCombo::SMColorCombo(bool rw, QWidget* parent, const char* name)
571
 
: ColorCombo(rw, parent, name),
572
 
  hasParent_(false),
573
 
  useParentValue_(false),
574
 
  pItem_(0),
575
 
  pText_(QString::null)
576
 
{
577
 
        
578
 
}
579
 
 
580
 
void SMColorCombo::setCurrentItem(int i)
581
 
{
582
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
583
 
        setFont(false);
584
 
        hasParent_ = false;
585
 
        pItem_ = 0;
586
 
        pText_ = QString::null;
587
 
        ColorCombo::setCurrentItem(i);
588
 
}
589
 
 
590
 
void SMColorCombo::setCurrentItem(int i, bool isParentValue)
591
 
{
592
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
593
 
        hasParent_ = true;
594
 
        pItem_ = i;
595
 
        pText_ = QString::null;
596
 
        ColorCombo::setCurrentItem(i);
597
 
        setFont(!isParentValue);
598
 
        connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
599
 
}
600
 
 
601
 
void SMColorCombo::setCurrentText(const QString &s)
602
 
{
603
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
604
 
        setFont(false);
605
 
        hasParent_ = false;
606
 
        pItem_ = -1;
607
 
        pText_ = s;
608
 
        ColorCombo::setCurrentText(s);
609
 
}
610
 
 
611
 
void SMColorCombo::setCurrentText(const QString &s, bool isParentValue)
612
 
{
613
 
        disconnect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
614
 
        hasParent_ = true;
615
 
        pItem_ = -1;
616
 
        pText_ = s;
617
 
        ColorCombo::setCurrentText(s);
618
 
        setFont(!isParentValue);
619
 
        connect(this, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
620
 
}
621
 
 
622
 
void SMColorCombo::setParentItem(int i)
623
 
{
624
 
        hasParent_ = true;
625
 
        pItem_ = i;
626
 
        pText_ = QString::null;
627
 
}
628
 
 
629
 
void SMColorCombo::setParentText(const QString &s)
630
 
{
631
 
        hasParent_ = true;
632
 
        pText_ = s;
633
 
}
634
 
 
635
 
bool SMColorCombo::useParentValue()
636
 
{
637
 
        bool ret = false;
638
 
 
639
 
        if (useParentValue_ && hasParent_)
640
 
        {
641
 
                ret = currentItem() == (count() - 1);
642
 
                if (ret)
643
 
                {
644
 
                        removeItem(count() - 1);
645
 
                        setFont(false);
646
 
                        if (!pText_.isNull())
647
 
                                setCurrentText(pText_, true);
648
 
                        else
649
 
                                setCurrentItem(pItem_, true);
650
 
                        useParentValue_ = false;
651
 
                }
652
 
        }
653
 
 
654
 
        return ret;
655
 
}
656
 
 
657
 
void SMColorCombo::setFont(bool wantBold)
658
 
{
659
 
        QFont f(font());
660
 
        f.setBold(wantBold);
661
 
        ColorCombo::setFont(f);
662
 
}
663
 
 
664
 
void SMColorCombo::currentChanged()
665
 
{
666
 
        if (hasParent_ && !useParentValue_)
667
 
        {
668
 
                setFont(true);
669
 
                insertItem( tr("Use Parent Value"));
670
 
                useParentValue_ = true;
671
 
        }
672
 
}
673
 
 
674
 
 
675
 
/***********************************************************************/
676
 
/***********************************************************************/
677
 
 
678
 
SMFontComboH::SMFontComboH(QWidget *parent)
679
 
: FontComboH(parent, true),
680
 
  hasParent_(false),
681
 
  useParentValue_(false),
682
 
  pFont_(QString::null),
683
 
  usePFont_( tr("Use Parent Font"))
684
 
{
685
 
        
686
 
}
687
 
 
688
 
void SMFontComboH::setCurrentFont(const QString &s)
689
 
{
690
 
        disconnect(fontFamily, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
691
 
        disconnect(fontStyle, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
692
 
        setFont(false);
693
 
        hasParent_ = false;
694
 
        pFont_ = s;
695
 
        FontComboH::setCurrentFont(s);
696
 
}
697
 
 
698
 
void SMFontComboH::setCurrentFont(const QString &s, bool isParentValue)
699
 
{
700
 
        disconnect(fontFamily, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
701
 
        disconnect(fontStyle, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
702
 
        hasParent_ = true;
703
 
        pFont_ = s;
704
 
        FontComboH::setCurrentFont(s);
705
 
        setFont(!isParentValue);
706
 
        connect(fontFamily, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
707
 
        connect(fontStyle, SIGNAL(highlighted(int)), this, SLOT(currentChanged()));
708
 
}
709
 
 
710
 
void SMFontComboH::setParentFont(const QString &s)
711
 
{
712
 
        hasParent_ = true;
713
 
        pFont_ = s;
714
 
}
715
 
 
716
 
bool SMFontComboH::useParentFont()
717
 
{
718
 
        bool ret = false;
719
 
 
720
 
        if (useParentValue_ && hasParent_)
721
 
        {
722
 
                ret = fontFamily->currentItem() == (fontFamily->count() - 1) ||
723
 
                                fontStyle->currentItem() == (fontStyle->count() - 1);
724
 
 
725
 
                if (ret)
726
 
                {
727
 
                        fontFamily->removeItem(fontFamily->count() - 1);
728
 
                        fontStyle->removeItem(fontStyle->count() - 1);
729
 
                        setFont(false);
730
 
                        setCurrentFont(pFont_, true);
731
 
                        useParentValue_ = false;
732
 
                }
733
 
        }
734
 
 
735
 
        return ret;
736
 
}
737
 
 
738
 
void SMFontComboH::setFont(bool wantBold)
739
 
{
740
 
        QFont f(font());
741
 
        f.setBold(wantBold);
742
 
        fontFamily->setFont(f);
743
 
        fontStyle->setFont(f);
744
 
}
745
 
 
746
 
void SMFontComboH::currentChanged()
747
 
{
748
 
        if (hasParent_ && !useParentValue_)
749
 
        {
750
 
                setFont(true);
751
 
                fontFamily->insertItem(usePFont_);
752
 
                fontStyle->insertItem(usePFont_);
753
 
                useParentValue_ = true;
754
 
        }
755
 
        else if (hasParent_)
756
 
                checkStyle();
757
 
}
758
 
 
759
 
void SMFontComboH::checkStyle()
760
 
{
761
 
        if (hasParent_ && useParentValue_)
762
 
        {
763
 
                if (fontStyle->text(fontStyle->count() - 1) != usePFont_)
764
 
                        fontStyle->insertItem(usePFont_);
765
 
        }
766
 
}
767
 
 
768
 
/***********************************************************************/
769
 
/***********************************************************************/
770
 
 
771
 
SMTabruler::SMTabruler(QWidget* parent, bool haveFirst, int dEin,
772
 
                                           QValueList<ParagraphStyle::TabRecord> Tabs, double wid)
773
 
: Tabruler(parent, haveFirst, dEin, Tabs, wid)
774
 
{
775
 
        parentButton_ = new QToolButton(this, "parentButton_");
776
 
        Q_CHECK_PTR(parentButton_);
777
 
        parentButton_->setText( tr(" Parent Tabs "));
778
 
        indentLayout->addWidget(parentButton_);
779
 
        parentButton_->hide();
780
 
        QFont f(font());
781
 
        f.setBold(true);
782
 
        parentButton_->setFont(f);
783
 
        connect(parentButton_, SIGNAL(clicked()), this, SLOT(pbClicked()));
784
 
        hasParent_ = false;
785
 
        tabsChanged_ = false;
786
 
        useParentTabs_ = false;
787
 
        first_ = new SMMSpinBox(-3000, 4000, this, 1);
788
 
        Q_CHECK_PTR(first_);
789
 
        left_ = new SMMSpinBox(0, 4000, this, 1);
790
 
        Q_CHECK_PTR(left_);
791
 
        right_ = new SMMSpinBox(0, 4000, this, 1);
792
 
        Q_CHECK_PTR(right_);
793
 
 
794
 
        indentLayout->remove(firstLineData);
795
 
        firstLineData->hide();
796
 
        indentLayout->insertWidget(1, first_);
797
 
        first_->show();
798
 
 
799
 
        layout4->remove(leftIndentData);
800
 
        leftIndentData->hide();
801
 
        layout4->insertWidget(1, left_);
802
 
        left_->show();
803
 
 
804
 
        indentLayout->remove(rightIndentData);
805
 
        rightIndentData->hide();
806
 
        indentLayout->insertWidget(3, right_);
807
 
        right_->show();
808
 
 
809
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
810
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
811
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
812
 
 
813
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
814
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
815
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
816
 
}
817
 
 
818
 
void SMTabruler::setTabs(QValueList<ParagraphStyle::TabRecord> Tabs, int dEin)
819
 
{
820
 
        disconnect(this, SIGNAL(tabsChanged()), this, SLOT(slotTabsChanged()));
821
 
        disconnect(this, SIGNAL(mouseReleased()), this, SLOT(slotTabsChanged()));
822
 
        hasParent_ = false;
823
 
        parentButton_->hide();
824
 
        Tabruler::setTabs(Tabs, dEin);
825
 
        Tabruler::repaint();
826
 
        QString ein = unitGetSuffixFromIndex(dEin);
827
 
        if (dEin == 2)
828
 
        {
829
 
                first_->setDecimals(10000);
830
 
                left_->setDecimals(10000);
831
 
                right_->setDecimals(10000);
832
 
                tabData->setDecimals(10000);
833
 
        } // TODO else What's the decimal for other dEins?
834
 
        first_->setSuffix(ein);
835
 
        left_->setSuffix(ein);
836
 
        right_->setSuffix(ein);
837
 
        tabData->setSuffix(ein);
838
 
}
839
 
 
840
 
void SMTabruler::setTabs(QValueList<ParagraphStyle::TabRecord> Tabs, int dEin, bool isParentValue)
841
 
{
842
 
        disconnect(this, SIGNAL(tabsChanged()), this, SLOT(slotTabsChanged()));
843
 
        disconnect(this, SIGNAL(mouseReleased()), this, SLOT(slotTabsChanged()));
844
 
        hasParent_ = true;
845
 
        pDein_ = dEin;
846
 
        if (isParentValue)
847
 
                parentButton_->hide();
848
 
        else
849
 
                parentButton_->show();
850
 
        Tabruler::setTabs(Tabs, dEin);
851
 
        Tabruler::repaint();
852
 
        QString ein = unitGetSuffixFromIndex(dEin);
853
 
        if (dEin == 2)
854
 
        {
855
 
                first_->setDecimals(10000);
856
 
                left_->setDecimals(10000);
857
 
                right_->setDecimals(10000);
858
 
                tabData->setDecimals(10000);
859
 
        } // TODO else What's the decimal for other dEins?
860
 
        first_->setSuffix(ein);
861
 
        left_->setSuffix(ein);
862
 
        right_->setSuffix(ein);
863
 
        tabData->setSuffix(ein);
864
 
 
865
 
        connect(this, SIGNAL(tabsChanged()), this, SLOT(slotTabsChanged()));
866
 
        connect(this, SIGNAL(mouseReleased()), this, SLOT(slotTabsChanged()));
867
 
}
868
 
 
869
 
void SMTabruler::setParentTabs(QValueList<ParagraphStyle::TabRecord> Tabs)
870
 
{
871
 
        hasParent_ = true;
872
 
        pTabs_ = Tabs;
873
 
}
874
 
 
875
 
void SMTabruler::setFirstLineValue(double t)
876
 
{
877
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
878
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
879
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
880
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
881
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
882
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
883
 
        first_->setValue(t);
884
 
        firstLineData->setValue(t);
885
 
        setLeftIndent();
886
 
        setFirstLine();
887
 
        setRightIndent();
888
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
889
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
890
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
891
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
892
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
893
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
894
 
}
895
 
 
896
 
void SMTabruler::setFirstLineValue(double t, bool isParentValue)
897
 
{
898
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
899
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
900
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
901
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
902
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
903
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
904
 
        isSetupFirst_ = true;
905
 
        first_->setValue(t, isParentValue);
906
 
        firstLineData->setValue(t);
907
 
        setLeftIndent();
908
 
        setFirstLine();
909
 
        setRightIndent();
910
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
911
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
912
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
913
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
914
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
915
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
916
 
}
917
 
 
918
 
void SMTabruler::setParentFirstLine(double t)
919
 
{
920
 
        first_->setParentValue(t);
921
 
}
922
 
 
923
 
void SMTabruler::setLeftIndentValue(double t)
924
 
{
925
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
926
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
927
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
928
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
929
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
930
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
931
 
        left_->setValue(t);
932
 
        leftIndentData->setValue(t);
933
 
        setLeftIndent();
934
 
        setFirstLine();
935
 
        setRightIndent();
936
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
937
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
938
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
939
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
940
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
941
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
942
 
}
943
 
 
944
 
void SMTabruler::setLeftIndentValue(double t, bool isParentValue)
945
 
{
946
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
947
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
948
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
949
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
950
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
951
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
952
 
        isSetupLeft_ = true;
953
 
        left_->setValue(t, isParentValue);
954
 
        leftIndentData->setValue(t);
955
 
        setLeftIndent();
956
 
        setFirstLine();
957
 
        setRightIndent();
958
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
959
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
960
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
961
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
962
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
963
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
964
 
}
965
 
 
966
 
void SMTabruler::setParentLeftIndent(double t)
967
 
{
968
 
        left_->setParentValue(t);
969
 
}
970
 
 
971
 
void SMTabruler::setRightIndentValue(double t)
972
 
{
973
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
974
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
975
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
976
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
977
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
978
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
979
 
        right_->setValue(t);
980
 
        rightIndentData->setValue(t);
981
 
        setLeftIndent();
982
 
        setFirstLine();
983
 
        setRightIndent();
984
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
985
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
986
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
987
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
988
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
989
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
990
 
}
991
 
 
992
 
void SMTabruler::setRightIndentValue(double t, bool isParentValue)
993
 
{
994
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
995
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
996
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
997
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
998
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
999
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1000
 
        isSetupRight_ = true;
1001
 
        right_->setValue(t, isParentValue);
1002
 
        rightIndentData->setValue(t);
1003
 
        setLeftIndent();
1004
 
        setFirstLine();
1005
 
        setRightIndent();
1006
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1007
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1008
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1009
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1010
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1011
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1012
 
}
1013
 
 
1014
 
void SMTabruler::setParentRightIndent(double t)
1015
 
{
1016
 
        right_->setParentValue(t);
1017
 
}
1018
 
 
1019
 
bool SMTabruler::useParentTabs()
1020
 
{
1021
 
        bool ret = useParentTabs_;
1022
 
        if (ret && hasParent_)
1023
 
        {
1024
 
                setTabs(pTabs_, pDein_, true);
1025
 
                Tabruler::repaint();
1026
 
                parentButton_->hide();
1027
 
        }
1028
 
        else if (hasParent_)
1029
 
        {
1030
 
                parentButton_->show();
1031
 
        }
1032
 
 
1033
 
        return ret;
1034
 
}
1035
 
 
1036
 
bool SMTabruler::useParentFirstLine()
1037
 
{
1038
 
        return first_->useParentValue();
1039
 
}
1040
 
 
1041
 
bool SMTabruler::useParentLeftIndent()
1042
 
{
1043
 
        return left_->useParentValue();
1044
 
}
1045
 
 
1046
 
bool SMTabruler::useParentRightIndent()
1047
 
{
1048
 
        return right_->useParentValue();
1049
 
}
1050
 
 
1051
 
void SMTabruler::slotTabsChanged()
1052
 
{
1053
 
        if (hasParent_)
1054
 
        {
1055
 
                useParentTabs_ = false;
1056
 
                tabsChanged_ = true;
1057
 
        }
1058
 
}
1059
 
 
1060
 
void SMTabruler::pbClicked()
1061
 
{
1062
 
        if (hasParent_)
1063
 
        {
1064
 
                useParentTabs_ = true;
1065
 
                emit mouseReleased();
1066
 
        }
1067
 
}
1068
 
 
1069
 
void SMTabruler::leftDataChanged()
1070
 
{
1071
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1072
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1073
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1074
 
        double a, b, value;
1075
 
        int c;
1076
 
        leftIndentData->getValues(&a, &b, &c, &value);
1077
 
        if (hasParent_ && !isSetupLeft_)
1078
 
                left_->setValue(value, false);
1079
 
        else if (!hasParent_)
1080
 
                left_->setValue(value);
1081
 
 
1082
 
        isSetupLeft_ = false;
1083
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1084
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1085
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1086
 
}
1087
 
 
1088
 
void SMTabruler::rightDataChanged()
1089
 
{
1090
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1091
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1092
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1093
 
        double a, b, value;
1094
 
        int c;
1095
 
        rightIndentData->getValues(&a, &b, &c, &value);
1096
 
        if (hasParent_ && !isSetupRight_)
1097
 
                right_->setValue(value, false);
1098
 
        else if (!hasParent_)
1099
 
                right_->setValue(value);
1100
 
 
1101
 
        isSetupRight_ = false;
1102
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1103
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1104
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1105
 
}
1106
 
 
1107
 
void SMTabruler::firstDataChanged()
1108
 
{
1109
 
        disconnect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1110
 
        disconnect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1111
 
        disconnect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1112
 
        double a, b, value;
1113
 
        int c;
1114
 
        firstLineData->getValues(&a, &b, &c, &value);
1115
 
        if (hasParent_ && !isSetupFirst_)
1116
 
                first_->setValue(value, false);
1117
 
        else if (!hasParent_)
1118
 
                first_->setValue(value);
1119
 
 
1120
 
        isSetupFirst_ = false;
1121
 
        connect(first_, SIGNAL(valueChanged(int)), this, SLOT(firstValueChanged()));
1122
 
        connect(right_, SIGNAL(valueChanged(int)), this, SLOT(rightValueChanged()));
1123
 
        connect(left_, SIGNAL(valueChanged(int)), this, SLOT(leftValueChanged()));
1124
 
}
1125
 
 
1126
 
void SMTabruler::firstValueChanged()
1127
 
{
1128
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1129
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1130
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1131
 
        double a, b, value;
1132
 
        int c;
1133
 
        first_->getValues(&a, &b, &c, &value);
1134
 
        setFirstLineData(value);
1135
 
        setLeftIndent();
1136
 
        setFirstLine();
1137
 
        setRightIndent();
1138
 
        isSetupFirst_ = true;
1139
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1140
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1141
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1142
 
}
1143
 
 
1144
 
void SMTabruler::leftValueChanged()
1145
 
{
1146
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1147
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1148
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1149
 
        double a, b, value;
1150
 
        int c;
1151
 
        left_->getValues(&a, &b, &c, &value);
1152
 
        setLeftIndentData(value);
1153
 
        setLeftIndent();
1154
 
        setFirstLine();
1155
 
        setRightIndent();
1156
 
        isSetupLeft_ = true;
1157
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1158
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1159
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1160
 
}
1161
 
 
1162
 
void SMTabruler::rightValueChanged()
1163
 
{
1164
 
        disconnect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1165
 
        disconnect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1166
 
        disconnect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1167
 
        double a, b, value;
1168
 
        int c;
1169
 
        right_->getValues(&a, &b, &c, &value);
1170
 
        setRightIndentData(value);
1171
 
        setLeftIndent();
1172
 
        setFirstLine();
1173
 
        setRightIndent();
1174
 
        isSetupRight_ = true;
1175
 
        connect(firstLineData, SIGNAL(valueChanged(int)), this, SLOT(firstDataChanged()));
1176
 
        connect(rightIndentData, SIGNAL(valueChanged(int)), this, SLOT(rightDataChanged()));
1177
 
        connect(leftIndentData, SIGNAL(valueChanged(int)), this, SLOT(leftDataChanged()));
1178
 
}
1179
 
 
1180