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

« back to all changes in this revision

Viewing changes to scribus/plugins/scriptplugin/cmdsetprop.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2009-10-30 20:00:37 UTC
  • mfrom: (0.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091030200037-tes6nzts7t35gg5h
Tags: 1.3.5.dfsg+svn20091030-1
* Upstream svn update with bugfixes. Prepare the tarball for uploading into
  Debian (Closes: #534510, #552026).
* debian/control:
  - Refresh arch list.
  - Update Standards-Version to 3.8.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
                return NULL;
19
19
        if(!checkHaveDocument())
20
20
                return NULL;
 
21
        if ((shade1 < 0) || (shade1 > 100) || (shade2 < 0) || (shade2 > 100))
 
22
        {
 
23
                PyErr_SetString(PyExc_ValueError, QObject::tr("Stop shade out of bounds, must be 0 <= shade <= 100.","python error").toLocal8Bit().constData());
 
24
                return NULL;
 
25
        }
21
26
        PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
22
27
        if (currItem == NULL)
23
28
                return NULL;
77
82
        //ScCore->primaryMainWindow()->view->updateGradientVectors(currItem);
78
83
        currItem->updateGradientVectors();
79
84
        currItem->update();
80
 
//      Py_INCREF(Py_None);
81
 
//      return Py_None;
 
85
        Py_RETURN_NONE;
 
86
}
 
87
 
 
88
PyObject *scribus_setgradstop(PyObject* /* self */, PyObject* args)
 
89
{
 
90
        char *Name = const_cast<char*>("");
 
91
        char *Color1;
 
92
        int  shade1;
 
93
        double rampPoint, opacity;
 
94
        if (!PyArg_ParseTuple(args, "esidd|es", "utf-8", &Color1, &shade1, &opacity, &rampPoint, "utf-8", &Name))
 
95
                return NULL;
 
96
        if(!checkHaveDocument())
 
97
                return NULL;
 
98
        if ((shade1 < 0) || (shade1 > 100))
 
99
        {
 
100
                PyErr_SetString(PyExc_ValueError, QObject::tr("Stop shade out of bounds, must be 0 <= shade <= 100.","python error").toLocal8Bit().constData());
 
101
                return NULL;
 
102
        }
 
103
        if ((rampPoint < 0.0) || (rampPoint > 1.0))
 
104
        {
 
105
                PyErr_SetString(PyExc_ValueError, QObject::tr("Ramp point out of bounds, must be 0 <= rampPoint <= 1.","python error").toLocal8Bit().constData());
 
106
                return NULL;
 
107
        }
 
108
        if ((opacity < 0.0) || (opacity > 1.0))
 
109
        {
 
110
                PyErr_SetString(PyExc_ValueError, QObject::tr("Opacity out of bounds, must be 0 <= transparency <= 1.","python error").toLocal8Bit().constData());
 
111
                return NULL;
 
112
        }
 
113
        PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
 
114
        if (currItem == NULL)
 
115
                return NULL;
 
116
        QColor tmp;
 
117
        QString c1 = QString::fromUtf8(Color1);
 
118
        currItem->SetQColor(&tmp, c1, shade1);
 
119
        currItem->fill_gradient.setStop(tmp, rampPoint, 0.5, opacity, c1, shade1);
 
120
        currItem->updateGradientVectors();
 
121
        currItem->update();
82
122
        Py_RETURN_NONE;
83
123
}
84
124
 
94
134
        if (i == NULL)
95
135
                return NULL;
96
136
        i->setFillColor(QString::fromUtf8(Color));
97
 
 //     Py_INCREF(Py_None);
98
 
 //     return Py_None;
99
137
        Py_RETURN_NONE;
100
138
}
101
139
 
116
154
        if (i == NULL)
117
155
                return NULL;
118
156
        i->setFillTransparency(1.0 - w);
119
 
 //     Py_INCREF(Py_None);
120
 
//      return Py_None;
121
157
        Py_RETURN_NONE;
122
158
}
123
159
 
138
174
        if (i == NULL)
139
175
                return NULL;
140
176
        i->setFillBlendmode(w);
141
 
 //     Py_INCREF(Py_None);
142
 
 //     return Py_None;
143
177
        Py_RETURN_NONE;
144
178
}
145
179
 
155
189
        if (it == NULL)
156
190
                return NULL;
157
191
        it->setLineColor(QString::fromUtf8(Color));
158
 
//      Py_INCREF(Py_None);
159
 
//      return Py_None;
160
192
        Py_RETURN_NONE;
161
193
}
162
194
 
177
209
        if (i == NULL)
178
210
                return NULL;
179
211
        i->setLineTransparency(1.0 - w);
180
 
 //     Py_INCREF(Py_None);
181
 
 //     return Py_None;
182
212
        Py_RETURN_NONE;
183
213
}
184
214
 
199
229
        if (i == NULL)
200
230
                return NULL;
201
231
        i->setLineBlendmode(w);
202
 
 //     Py_INCREF(Py_None);
203
 
//      return Py_None;
204
232
        Py_RETURN_NONE;
205
233
}
206
234
 
221
249
        if (i == NULL)
222
250
                return NULL;
223
251
        i->setLineWidth(w);
224
 
//      Py_INCREF(Py_None);
225
 
//      return Py_None;
226
252
        Py_RETURN_NONE;
227
253
}
228
254
 
243
269
        if (it == NULL)
244
270
                return NULL;
245
271
        it->setLineShade(w);
246
 
 //     Py_INCREF(Py_None);
247
 
//      return Py_None;
248
272
        Py_RETURN_NONE;
249
273
}
250
274
 
265
289
        if (i == NULL)
266
290
                return NULL;
267
291
        i->setFillShade(w);
268
 
 //     Py_INCREF(Py_None);
269
 
//      return Py_None;
270
292
        Py_RETURN_NONE;
271
293
}
272
294
 
282
304
        if (i == NULL)
283
305
                return NULL;
284
306
        i->PLineJoin = Qt::PenJoinStyle(w);
285
 
 //     Py_INCREF(Py_None);
286
 
 //     return Py_None;
287
307
        Py_RETURN_NONE;
288
308
}
289
309
 
299
319
        if (i == NULL)
300
320
                return NULL;
301
321
        i->PLineEnd = Qt::PenCapStyle(w);
302
 
//      Py_INCREF(Py_None);
303
 
//      return Py_None;
304
322
        Py_RETURN_NONE;
305
323
}
306
324
 
316
334
        if (i == NULL)
317
335
                return NULL;
318
336
        i->PLineArt = Qt::PenStyle(w);
319
 
 //     Py_INCREF(Py_None);
320
 
//      return Py_None;
321
337
        Py_RETURN_NONE;
322
338
}
323
339
 
342
358
        currItem->SetFrameRound();
343
359
        ScCore->primaryMainWindow()->doc->setRedrawBounding(currItem);
344
360
        ScCore->primaryMainWindow()->view->SetFrameRounded();
345
 
 //     Py_INCREF(Py_None);
346
 
//      return Py_None;
347
361
        Py_RETURN_NONE;
348
362
}
349
363
 
364
378
                return NULL;
365
379
        }
366
380
        currItem->NamedLStyle = QString::fromUtf8(Style);
367
 
 //     Py_INCREF(Py_None);
368
 
//      return Py_None;
369
381
        Py_RETURN_NONE;
370
382
}
371
383
 
375
387
void cmdsetpropdocwarnings()
376
388
{
377
389
        QStringList s;
378
 
        s << scribus_setgradfill__doc__  << scribus_setfillcolor__doc__
379
 
          << scribus_setfilltrans__doc__ << scribus_setfillblend__doc__
380
 
          << scribus_setlinecolor__doc__ << scribus_setlinetrans__doc__
381
 
          << scribus_setlineblend__doc__ << scribus_setlinewidth__doc__
382
 
          << scribus_setlineshade__doc__ << scribus_setlinejoin__doc__
383
 
          << scribus_setlineend__doc__   << scribus_setlinestyle__doc__
384
 
          << scribus_setfillshade__doc__ << scribus_setcornerrad__doc__
385
 
          <<  scribus_setmultiline__doc__;
 
390
        s << scribus_setgradfill__doc__  << scribus_setgradstop__doc__
 
391
          << scribus_setfillcolor__doc__ << scribus_setfilltrans__doc__ 
 
392
          << scribus_setfillblend__doc__ << scribus_setlinecolor__doc__ 
 
393
          << scribus_setlinetrans__doc__ << scribus_setlineblend__doc__ 
 
394
          << scribus_setlinewidth__doc__ << scribus_setlineshade__doc__ 
 
395
          << scribus_setlinejoin__doc__  << scribus_setlineend__doc__   
 
396
          << scribus_setlinestyle__doc__ << scribus_setfillshade__doc__ 
 
397
          << scribus_setcornerrad__doc__ <<  scribus_setmultiline__doc__;
386
398
}