]> git.pld-linux.org Git - packages/scribus.git/commitdiff
- usability fixes (fixes gtk->qt clipboard handling)
authordeejay1 <deejay1@pld-linux.org>
Wed, 1 Sep 2004 16:20:12 +0000 (16:20 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    scribus-post12.patch -> 1.1

scribus-post12.patch [new file with mode: 0644]

diff --git a/scribus-post12.patch b/scribus-post12.patch
new file mode 100644 (file)
index 0000000..4492dce
--- /dev/null
@@ -0,0 +1,389 @@
+diff -urN scribus-1.2.0.final/scribus/newfile.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/newfile.cpp
+--- scribus-1.2.0.final/scribus/newfile.cpp    2004-08-25 17:41:13.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/newfile.cpp    2004-08-31 18:27:31.000000000 -0500
+@@ -1,6 +1,12 @@
+ #include "newfile.h"
+ #include "newfile.moc"
+ #include <qtooltip.h>
++
++// definitions for clear reading the code - pv
++#define PORTRAIT    0
++#define LANDSCAPE   1
++#define USERFORMAT 30
++
+ extern QPixmap loadIcon(QString nam);
+ NewDoc::NewDoc( QWidget* parent, preV *Vor )
+@@ -8,27 +14,14 @@
+ {
+       QString units[] = { tr(" pt"), tr(" mm"), tr(" in"), tr(" p")};
+       int decimals;
+-      ein = units[Vor->Einheit];
+-      switch (Vor->Einheit)
+-      {
+-      case 0:
+-              Umrech = 1.0;
+-              decimals = 2;
+-              break;
+-      case 1:
+-              Umrech = 0.3527777;
+-              decimals = 3;
+-              break;
+-      case 2:
+-              Umrech = 1.0 / 72.0;
+-              decimals = 4;
+-              break;
+-      case 3:
+-              Umrech = 1.0 / 12.0;
+-              decimals = 2;
+-              break;
+-      }
++      // pv - removed switch hell
++      double umr[] = {1.0, 0.3527777, (1.0 / 72.0), (1.0 / 12.0)};
++      int dec[] = {2, 3, 4, 2};
++
+       einheit = Vor->Einheit;
++      ein = units[einheit];
++      Umrech = umr[einheit];
++      decimals = dec[einheit];
+       Orient = 0;
+       setCaption( tr( "New Document" ) );
+       setIcon(loadIcon("AppIcon.png"));
+@@ -270,6 +263,15 @@
+ void NewDoc::code_repeat(int m)
+ {
++      // #869 pv - auto-flip landscape/portrait based on the height:width ratio
++      if (ComboBox1->currentItem() == USERFORMAT)
++      {
++              if (Breite->value() > Hoehe->value())
++                      ComboBox2->setCurrentItem(LANDSCAPE);
++              else
++                      ComboBox2->setCurrentItem(PORTRAIT);
++      } // end of #869
++
+       switch (m)
+       {
+       case 0 :
+@@ -339,6 +341,10 @@
+       int decimals;
+       double AltUmrech = Umrech;
+       double val, oldB, oldBM, oldH, oldHM;
++      // pv - removed switch hell
++      double umr[] = {1.0, 0.3527777, (1.0 / 72.0), (1.0 / 12.0)};
++      int dec[] = {100, 1000, 10000, 100};
++
+       disconnect(Breite, SIGNAL(valueChanged(int)), this, SLOT(setBreite(int)));
+       disconnect(Hoehe, SIGNAL(valueChanged(int)), this, SLOT(setHoehe(int)));
+       disconnect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
+@@ -351,25 +357,9 @@
+       Hoehe->getValues(&oldH, &oldHM, &decimals, &val);
+       oldH /= AltUmrech;
+       oldHM /= AltUmrech;
+-      switch (u)
+-      {
+-      case 0:
+-              Umrech = 1.0;
+-              decimals = 100;
+-              break;
+-      case 1:
+-              Umrech = 0.3527777;
+-              decimals = 1000;
+-              break;
+-      case 2:
+-              Umrech = 1.0 / 72.0;
+-              decimals = 10000;
+-              break;
+-      case 3:
+-              Umrech = 1.0 / 12.0;
+-              decimals = 100;
+-              break;
+-      }
++
++      Umrech = umr[u];
++      decimals = dec[u];
+       einheit = u;
+       Breite->setValues(oldB * Umrech, oldBM * Umrech, decimals, Pagebr * Umrech);
+       Hoehe->setValues(oldH * Umrech, oldHM * Umrech, decimals, Pageho * Umrech);
+@@ -396,20 +386,9 @@
+ void NewDoc::ExitOK()
+ {
+-      if (ComboBox1->currentItem() == 30)
+-      {
+               Pagebr = Breite->value() / Umrech;
+               Pageho = Hoehe->value() / Umrech;
+               accept();
+-              return;
+-      }
+-      if (Orient == 1)
+-      {
+-              double br = Pagebr;
+-              Pagebr = Pageho;
+-              Pageho = br;
+-      }
+-      accept();
+ }
+ void NewDoc::setOrien(int ori)
+@@ -423,10 +402,10 @@
+               Breite->setValue(Hoehe->value());
+               Hoehe->setValue(br);
+       }
+-      if (ori == 0)
+-              Orient = 0;
+-      else
+-              Orient = 1;
++      // #869 pv - defined constants added + code repeat (check w/h)
++      (ori == PORTRAIT) ? Orient = PORTRAIT : Orient = LANDSCAPE;
++      code_repeat(666); // just check w/h
++      // end of #869
+       RightR->setMaxValue(Breite->value() - LeftR->value());
+       LeftR->setMaxValue(Breite->value() - RightR->value());
+       TopR->setMaxValue(Hoehe->value() - BottomR->value());
+@@ -437,7 +416,7 @@
+ void NewDoc::setPGsize()
+ {
+-      if (ComboBox1->currentItem() == 30)
++      if (ComboBox1->currentItem() == USERFORMAT)
+               setSize(ComboBox1->currentItem());
+       else
+       {
+@@ -458,15 +437,22 @@
+                       355, 250, 178, 125, 89, 462, 298, 312, 542, 595, 1224, 612, 612, 792};
+       int page_y[] = {3368, 2380, 1684, 1190, 842, 595, 421, 297, 210, 148, 4008, 2836, 2004, 1418, 1002, 709,
+                       501, 355, 250, 178, 125, 649, 683, 624, 720, 935, 792, 1008, 792, 1225};
+-      if (gr == 30)
++      if (gr == USERFORMAT)
+       {
+               Breite->setEnabled(true);
+               Hoehe->setEnabled(true);
+       }
+       else
+       {
++              // pv - correct handling of the disabled spins
++              if (ComboBox2->currentItem() == PORTRAIT)
++              {
+               Pagebr = page_x[gr];
+               Pageho = page_y[gr];
++              } else {
++                      Pagebr = page_y[gr];
++                      Pageho = page_x[gr];
++              }
+       }
+       Breite->setValue(Pagebr * Umrech);
+       Hoehe->setValue(Pageho * Umrech);
+diff -urN scribus-1.2.0.final/scribus/page.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/page.cpp
+--- scribus-1.2.0.final/scribus/page.cpp       2004-08-25 17:27:25.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/page.cpp       2004-08-31 18:27:31.000000000 -0500
+@@ -5464,12 +5464,42 @@
+               if (!inText)
+               {
+                       Deselect(true);
++                      slotDoCurs(true);
+                       if (!SeleItem(m))
+                       {
+-                              slotDoCurs(true);
+                               emit Amode(1);
+                               return;
+                       }
++                      else
++                      {
++                              b = doku->ActPage->SelItem.at(0);
++                              if ((m->button() == MidButton) && (b->PType == 4))
++                              {
++                                      Mpressed = false;
++                                      MidButt = false;
++                                      QString cc;
++                                      cc = QApplication::clipboard()->text(QClipboard::Selection);
++                                      if (cc.isNull())
++                                              cc = QApplication::clipboard()->text(QClipboard::Clipboard);
++                                      if (!cc.isNull())
++                                      {
++                                              Serializer *ss = new Serializer("");
++                                              ss->Objekt = cc;
++                                              int st = doku->CurrentABStil;
++                                              ss->GetText(b, st, doku->Vorlagen[st].Font, doku->Vorlagen[st].FontSize, true);
++                                              delete ss;
++                                              if (doku->Trenner->AutoCheck)
++                                                      doku->Trenner->slotHyphenate(b);
++                                      }
++                                      else
++                                      {
++                                              if (ScApp->Buffer2.startsWith("<SCRIBUSTEXT"))
++                                                      ScApp->slotEditPaste();
++                                      }
++                                      RefreshItem(b);
++                              }
++                              return;
++                      }
+               }
+               b = doku->ActPage->SelItem.at(0);
+               oldCp = b->CPos;
+@@ -5494,6 +5524,34 @@
+                               qApp->setOverrideCursor(QCursor(ArrowCursor), true);
+                       }
+               }
++              else
++              {
++                      if ((m->button() == MidButton) && (b->PType == 4))
++                      {
++                              Mpressed = false;
++                              MidButt = false;
++                              QString cc;
++                              cc = QApplication::clipboard()->text(QClipboard::Selection);
++                              if (cc.isNull())
++                                      cc = QApplication::clipboard()->text(QClipboard::Clipboard);
++                              if (!cc.isNull())
++                              {
++                                      Serializer *ss = new Serializer("");
++                                      ss->Objekt = cc;
++                                      int st = doku->CurrentABStil;
++                                      ss->GetText(b, st, doku->Vorlagen[st].Font, doku->Vorlagen[st].FontSize, true);
++                                      delete ss;
++                                      if (doku->Trenner->AutoCheck)
++                                              doku->Trenner->slotHyphenate(b);
++                              }
++                              else
++                              {
++                                      if (ScApp->Buffer2.startsWith("<SCRIBUSTEXT"))
++                                              ScApp->slotEditPaste();
++                              }
++                              RefreshItem(b);
++                      }
++              }
+               break;
+       case 8:
+               SeleItem(m);
+diff -urN scribus-1.2.0.final/scribus/scribus.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/scribus.cpp
+--- scribus-1.2.0.final/scribus/scribus.cpp    2004-08-23 17:06:34.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/scribus.cpp    2004-08-31 18:27:32.000000000 -0500
+@@ -4233,9 +4233,9 @@
+ {
+       QString cc;
+ #if QT_VERSION  >= 0x030100
+-      cc = ClipB->text(QClipboard::Clipboard);
++      cc = ClipB->text(QClipboard::Selection);
+       if (cc.isNull())
+-              cc = ClipB->text(QClipboard::Selection);
++              cc = ClipB->text(QClipboard::Clipboard);
+ #else
+       cc = ClipB->text();
+ #endif
+diff -urN scribus-1.2.0.final/scribus/seiten.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/seiten.cpp
+--- scribus-1.2.0.final/scribus/seiten.cpp     2004-08-01 10:42:03.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/seiten.cpp     2004-08-31 18:27:32.000000000 -0500
+@@ -813,16 +813,18 @@
+ {
+       QString tmp;
+       QPainter p;
+-      p.begin(&ret);
+-      p.setBrush(white);
+-      p.setBackgroundColor(white);
+-      p.setBackgroundMode(QPainter::OpaqueMode);
+-      p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
+-      p.setFont(QFont("Helvetica", 12, QFont::Bold));
+-      tmp = tmp.setNum(nr+1);
+-      QRect b = p.boundingRect(3,0, ret.width(), ret.height(), Qt::AlignCenter, tmp);
+-      p.drawRect(QRect(b.x()-2, b.y()-2, b.width()+4, b.height()+4));
+-      p.drawText(b, Qt::AlignCenter, tmp);
+-      p.end();
++      if (p.begin(&ret))
++      {
++              p.setBrush(white);
++              p.setBackgroundColor(white);
++              p.setBackgroundMode(QPainter::OpaqueMode);
++              p.setPen(QPen(black, 1, SolidLine, FlatCap, MiterJoin));
++              p.setFont(QFont("Helvetica", 12, QFont::Bold));
++              tmp = tmp.setNum(nr+1);
++              QRect b = p.boundingRect(3,0, ret.width(), ret.height(), Qt::AlignCenter, tmp);
++              p.drawRect(QRect(b.x()-2, b.y()-2, b.width()+4, b.height()+4));
++              p.drawText(b, Qt::AlignCenter, tmp);
++              p.end();
++      }
+       return ret;
+ }
+diff -urN scribus-1.2.0.final/scribus/story.cpp ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.cpp
+--- scribus-1.2.0.final/scribus/story.cpp      2004-08-24 16:47:54.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.cpp      2004-08-31 18:27:32.000000000 -0500
+@@ -159,6 +159,7 @@
+       viewport()->setAcceptDrops(false);
+       ClipData = 0;
+       connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
++      connect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
+ }
+ void SEditor::keyPressEvent(QKeyEvent *k)
+@@ -1171,11 +1172,13 @@
+       if ((hasSelectedText()) && (selectedText() != ""))
+       {
+               disconnect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
++              disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
+               tBuffer = selectedText();
+               copyStyledText();
+               QApplication::clipboard()->setText(tBuffer, QClipboard::Clipboard);
+               ClipData = 1;
+               connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
++              connect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
+               emit PasteAvail();
+       }
+       emit SideBarUp(true);
+@@ -1198,19 +1201,29 @@
+ {
+       emit SideBarUp(false);
+       int p, i;
++      QString data = "";
+       getCursorPosition(&p, &i);
+-      if (ClipData == 2)
++      if (ClipData == 1)
++              insStyledText();
++      else
+       {
+-              QString data = QApplication::clipboard()->text(QClipboard::Clipboard);
++              QString data = QApplication::clipboard()->text(QClipboard::Selection);
++              if (data.isNull())
++                      data = QApplication::clipboard()->text(QClipboard::Clipboard);
+               if (!data.isNull())
+               {
+                       data.replace(QRegExp("\r"), "");
+                       data.replace(QRegExp("\n"), QChar(13));
+                       insChars(data);
++                      ClipData = 2;
++                      emit PasteAvail();
++              }
++              else
++              {
++                      emit SideBarUp(true);
++                      return;
+               }
+       }
+-      else
+-              insStyledText();
+       updateAll();
+       emit SideBarUp(true);
+       emit SideBarUpdate();
+@@ -1226,6 +1239,12 @@
+       return p;
+ }
++void SEditor::SelClipChange()
++{
++      ClipData = 3;
++      emit PasteAvail();
++}
++
+ void SEditor::ClipChange()
+ {
+       ClipData = 2;
+diff -urN scribus-1.2.0.final/scribus/story.h ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.h
+--- scribus-1.2.0.final/scribus/story.h        2004-08-20 16:38:23.000000000 -0500
++++ ../../../2004-08-31/scribus-1.2.0.final+cvs20040831/scribus/story.h        2004-08-31 18:27:32.000000000 -0500
+@@ -114,6 +114,7 @@
+       void copy();
+       void paste();
+       void ClipChange();
++      void SelClipChange();
+ signals:
+       void setProps(int, int);
This page took 0.046024 seconds and 4 git commands to generate.