]> git.pld-linux.org Git - packages/scribus.git/blame - scribus-post12.patch
- usability fixes (fixes gtk->qt clipboard handling)
[packages/scribus.git] / scribus-post12.patch
CommitLineData
80a2324b 1diff -urN scribus-1.2.0.final/scribus/newfile.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/newfile.cpp
2--- scribus-1.2.0.final/scribus/newfile.cpp 2004-08-25 17:41:13.000000000 -0500
3+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/newfile.cpp 2004-08-31 18:27:31.000000000 -0500
4@@ -1,6 +1,12 @@
5 #include "newfile.h"
6 #include "newfile.moc"
7 #include <qtooltip.h>
8+
9+// definitions for clear reading the code - pv
10+#define PORTRAIT 0
11+#define LANDSCAPE 1
12+#define USERFORMAT 30
13+
14 extern QPixmap loadIcon(QString nam);
15
16 NewDoc::NewDoc( QWidget* parent, preV *Vor )
17@@ -8,27 +14,14 @@
18 {
19 QString units[] = { tr(" pt"), tr(" mm"), tr(" in"), tr(" p")};
20 int decimals;
21- ein = units[Vor->Einheit];
22- switch (Vor->Einheit)
23- {
24- case 0:
25- Umrech = 1.0;
26- decimals = 2;
27- break;
28- case 1:
29- Umrech = 0.3527777;
30- decimals = 3;
31- break;
32- case 2:
33- Umrech = 1.0 / 72.0;
34- decimals = 4;
35- break;
36- case 3:
37- Umrech = 1.0 / 12.0;
38- decimals = 2;
39- break;
40- }
41+ // pv - removed switch hell
42+ double umr[] = {1.0, 0.3527777, (1.0 / 72.0), (1.0 / 12.0)};
43+ int dec[] = {2, 3, 4, 2};
44+
45 einheit = Vor->Einheit;
46+ ein = units[einheit];
47+ Umrech = umr[einheit];
48+ decimals = dec[einheit];
49 Orient = 0;
50 setCaption( tr( "New Document" ) );
51 setIcon(loadIcon("AppIcon.png"));
52@@ -270,6 +263,15 @@
53
54 void NewDoc::code_repeat(int m)
55 {
56+ // #869 pv - auto-flip landscape/portrait based on the height:width ratio
57+ if (ComboBox1->currentItem() == USERFORMAT)
58+ {
59+ if (Breite->value() > Hoehe->value())
60+ ComboBox2->setCurrentItem(LANDSCAPE);
61+ else
62+ ComboBox2->setCurrentItem(PORTRAIT);
63+ } // end of #869
64+
65 switch (m)
66 {
67 case 0 :
68@@ -339,6 +341,10 @@
69 int decimals;
70 double AltUmrech = Umrech;
71 double val, oldB, oldBM, oldH, oldHM;
72+ // pv - removed switch hell
73+ double umr[] = {1.0, 0.3527777, (1.0 / 72.0), (1.0 / 12.0)};
74+ int dec[] = {100, 1000, 10000, 100};
75+
76 disconnect(Breite, SIGNAL(valueChanged(int)), this, SLOT(setBreite(int)));
77 disconnect(Hoehe, SIGNAL(valueChanged(int)), this, SLOT(setHoehe(int)));
78 disconnect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
79@@ -351,25 +357,9 @@
80 Hoehe->getValues(&oldH, &oldHM, &decimals, &val);
81 oldH /= AltUmrech;
82 oldHM /= AltUmrech;
83- switch (u)
84- {
85- case 0:
86- Umrech = 1.0;
87- decimals = 100;
88- break;
89- case 1:
90- Umrech = 0.3527777;
91- decimals = 1000;
92- break;
93- case 2:
94- Umrech = 1.0 / 72.0;
95- decimals = 10000;
96- break;
97- case 3:
98- Umrech = 1.0 / 12.0;
99- decimals = 100;
100- break;
101- }
102+
103+ Umrech = umr[u];
104+ decimals = dec[u];
105 einheit = u;
106 Breite->setValues(oldB * Umrech, oldBM * Umrech, decimals, Pagebr * Umrech);
107 Hoehe->setValues(oldH * Umrech, oldHM * Umrech, decimals, Pageho * Umrech);
108@@ -396,20 +386,9 @@
109
110 void NewDoc::ExitOK()
111 {
112- if (ComboBox1->currentItem() == 30)
113- {
114 Pagebr = Breite->value() / Umrech;
115 Pageho = Hoehe->value() / Umrech;
116 accept();
117- return;
118- }
119- if (Orient == 1)
120- {
121- double br = Pagebr;
122- Pagebr = Pageho;
123- Pageho = br;
124- }
125- accept();
126 }
127
128 void NewDoc::setOrien(int ori)
129@@ -423,10 +402,10 @@
130 Breite->setValue(Hoehe->value());
131 Hoehe->setValue(br);
132 }
133- if (ori == 0)
134- Orient = 0;
135- else
136- Orient = 1;
137+ // #869 pv - defined constants added + code repeat (check w/h)
138+ (ori == PORTRAIT) ? Orient = PORTRAIT : Orient = LANDSCAPE;
139+ code_repeat(666); // just check w/h
140+ // end of #869
141 RightR->setMaxValue(Breite->value() - LeftR->value());
142 LeftR->setMaxValue(Breite->value() - RightR->value());
143 TopR->setMaxValue(Hoehe->value() - BottomR->value());
144@@ -437,7 +416,7 @@
145
146 void NewDoc::setPGsize()
147 {
148- if (ComboBox1->currentItem() == 30)
149+ if (ComboBox1->currentItem() == USERFORMAT)
150 setSize(ComboBox1->currentItem());
151 else
152 {
153@@ -458,15 +437,22 @@
154 355, 250, 178, 125, 89, 462, 298, 312, 542, 595, 1224, 612, 612, 792};
155 int page_y[] = {3368, 2380, 1684, 1190, 842, 595, 421, 297, 210, 148, 4008, 2836, 2004, 1418, 1002, 709,
156 501, 355, 250, 178, 125, 649, 683, 624, 720, 935, 792, 1008, 792, 1225};
157- if (gr == 30)
158+ if (gr == USERFORMAT)
159 {
160 Breite->setEnabled(true);
161 Hoehe->setEnabled(true);
162 }
163 else
164 {
165+ // pv - correct handling of the disabled spins
166+ if (ComboBox2->currentItem() == PORTRAIT)
167+ {
168 Pagebr = page_x[gr];
169 Pageho = page_y[gr];
170+ } else {
171+ Pagebr = page_y[gr];
172+ Pageho = page_x[gr];
173+ }
174 }
175 Breite->setValue(Pagebr * Umrech);
176 Hoehe->setValue(Pageho * Umrech);
177diff -urN scribus-1.2.0.final/scribus/page.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/page.cpp
178--- scribus-1.2.0.final/scribus/page.cpp 2004-08-25 17:27:25.000000000 -0500
179+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/page.cpp 2004-08-31 18:27:31.000000000 -0500
180@@ -5464,12 +5464,42 @@
181 if (!inText)
182 {
183 Deselect(true);
184+ slotDoCurs(true);
185 if (!SeleItem(m))
186 {
187- slotDoCurs(true);
188 emit Amode(1);
189 return;
190 }
191+ else
192+ {
193+ b = doku->ActPage->SelItem.at(0);
194+ if ((m->button() == MidButton) && (b->PType == 4))
195+ {
196+ Mpressed = false;
197+ MidButt = false;
198+ QString cc;
199+ cc = QApplication::clipboard()->text(QClipboard::Selection);
200+ if (cc.isNull())
201+ cc = QApplication::clipboard()->text(QClipboard::Clipboard);
202+ if (!cc.isNull())
203+ {
204+ Serializer *ss = new Serializer("");
205+ ss->Objekt = cc;
206+ int st = doku->CurrentABStil;
207+ ss->GetText(b, st, doku->Vorlagen[st].Font, doku->Vorlagen[st].FontSize, true);
208+ delete ss;
209+ if (doku->Trenner->AutoCheck)
210+ doku->Trenner->slotHyphenate(b);
211+ }
212+ else
213+ {
214+ if (ScApp->Buffer2.startsWith("<SCRIBUSTEXT"))
215+ ScApp->slotEditPaste();
216+ }
217+ RefreshItem(b);
218+ }
219+ return;
220+ }
221 }
222 b = doku->ActPage->SelItem.at(0);
223 oldCp = b->CPos;
224@@ -5494,6 +5524,34 @@
225 qApp->setOverrideCursor(QCursor(ArrowCursor), true);
226 }
227 }
228+ else
229+ {
230+ if ((m->button() == MidButton) && (b->PType == 4))
231+ {
232+ Mpressed = false;
233+ MidButt = false;
234+ QString cc;
235+ cc = QApplication::clipboard()->text(QClipboard::Selection);
236+ if (cc.isNull())
237+ cc = QApplication::clipboard()->text(QClipboard::Clipboard);
238+ if (!cc.isNull())
239+ {
240+ Serializer *ss = new Serializer("");
241+ ss->Objekt = cc;
242+ int st = doku->CurrentABStil;
243+ ss->GetText(b, st, doku->Vorlagen[st].Font, doku->Vorlagen[st].FontSize, true);
244+ delete ss;
245+ if (doku->Trenner->AutoCheck)
246+ doku->Trenner->slotHyphenate(b);
247+ }
248+ else
249+ {
250+ if (ScApp->Buffer2.startsWith("<SCRIBUSTEXT"))
251+ ScApp->slotEditPaste();
252+ }
253+ RefreshItem(b);
254+ }
255+ }
256 break;
257 case 8:
258 SeleItem(m);
259diff -urN scribus-1.2.0.final/scribus/scribus.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/scribus.cpp
260--- scribus-1.2.0.final/scribus/scribus.cpp 2004-08-23 17:06:34.000000000 -0500
261+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/scribus.cpp 2004-08-31 18:27:32.000000000 -0500
262@@ -4233,9 +4233,9 @@
263 {
264 QString cc;
265 #if QT_VERSION >= 0x030100
266- cc = ClipB->text(QClipboard::Clipboard);
267+ cc = ClipB->text(QClipboard::Selection);
268 if (cc.isNull())
269- cc = ClipB->text(QClipboard::Selection);
270+ cc = ClipB->text(QClipboard::Clipboard);
271 #else
272 cc = ClipB->text();
273 #endif
274diff -urN scribus-1.2.0.final/scribus/seiten.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/seiten.cpp
275--- scribus-1.2.0.final/scribus/seiten.cpp 2004-08-01 10:42:03.000000000 -0500
276+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/seiten.cpp 2004-08-31 18:27:32.000000000 -0500
277@@ -813,16 +813,18 @@
278 {
279 QString tmp;
280 QPainter p;
281- p.begin(&ret);
282- p.setBrush(white);
283- p.setBackgroundColor(white);
284- p.setBackgroundMode(QPainter::OpaqueMode);
285- p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
286- p.setFont(QFont("Helvetica", 12, QFont::Bold));
287- tmp = tmp.setNum(nr+1);
288- QRect b = p.boundingRect(3,0, ret.width(), ret.height(), Qt::AlignCenter, tmp);
289- p.drawRect(QRect(b.x()-2, b.y()-2, b.width()+4, b.height()+4));
290- p.drawText(b, Qt::AlignCenter, tmp);
291- p.end();
292+ if (p.begin(&ret))
293+ {
294+ p.setBrush(white);
295+ p.setBackgroundColor(white);
296+ p.setBackgroundMode(QPainter::OpaqueMode);
297+ p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
298+ p.setFont(QFont("Helvetica", 12, QFont::Bold));
299+ tmp = tmp.setNum(nr+1);
300+ QRect b = p.boundingRect(3,0, ret.width(), ret.height(), Qt::AlignCenter, tmp);
301+ p.drawRect(QRect(b.x()-2, b.y()-2, b.width()+4, b.height()+4));
302+ p.drawText(b, Qt::AlignCenter, tmp);
303+ p.end();
304+ }
305 return ret;
306 }
307diff -urN scribus-1.2.0.final/scribus/story.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.cpp
308--- scribus-1.2.0.final/scribus/story.cpp 2004-08-24 16:47:54.000000000 -0500
309+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.cpp 2004-08-31 18:27:32.000000000 -0500
310@@ -159,6 +159,7 @@
311 viewport()->setAcceptDrops(false);
312 ClipData = 0;
313 connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
314+ connect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
315 }
316
317 void SEditor::keyPressEvent(QKeyEvent *k)
318@@ -1171,11 +1172,13 @@
319 if ((hasSelectedText()) && (selectedText() != ""))
320 {
321 disconnect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
322+ disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
323 tBuffer = selectedText();
324 copyStyledText();
325 QApplication::clipboard()->setText(tBuffer, QClipboard::Clipboard);
326 ClipData = 1;
327 connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
328+ connect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
329 emit PasteAvail();
330 }
331 emit SideBarUp(true);
332@@ -1198,19 +1201,29 @@
333 {
334 emit SideBarUp(false);
335 int p, i;
336+ QString data = "";
337 getCursorPosition(&p, &i);
338- if (ClipData == 2)
339+ if (ClipData == 1)
340+ insStyledText();
341+ else
342 {
343- QString data = QApplication::clipboard()->text(QClipboard::Clipboard);
344+ QString data = QApplication::clipboard()->text(QClipboard::Selection);
345+ if (data.isNull())
346+ data = QApplication::clipboard()->text(QClipboard::Clipboard);
347 if (!data.isNull())
348 {
349 data.replace(QRegExp("\r"), "");
350 data.replace(QRegExp("\n"), QChar(13));
351 insChars(data);
352+ ClipData = 2;
353+ emit PasteAvail();
354+ }
355+ else
356+ {
357+ emit SideBarUp(true);
358+ return;
359 }
360 }
361- else
362- insStyledText();
363 updateAll();
364 emit SideBarUp(true);
365 emit SideBarUpdate();
366@@ -1226,6 +1239,12 @@
367 return p;
368 }
369
370+void SEditor::SelClipChange()
371+{
372+ ClipData = 3;
373+ emit PasteAvail();
374+}
375+
376 void SEditor::ClipChange()
377 {
378 ClipData = 2;
379diff -urN scribus-1.2.0.final/scribus/story.h ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.h
380--- scribus-1.2.0.final/scribus/story.h 2004-08-20 16:38:23.000000000 -0500
381+++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.h 2004-08-31 18:27:32.000000000 -0500
382@@ -114,6 +114,7 @@
383 void copy();
384 void paste();
385 void ClipChange();
386+ void SelClipChange();
387
388 signals:
389 void setProps(int, int);
This page took 0.930647 seconds and 4 git commands to generate.