Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 23199 → Rev 23198

/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
39,7 → 39,7
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
 
masterPageList->setMinimumSize(QSize(130,70));
masterPageList->m_thumb = false;
masterPageList->Thumb = false;
masterPageList->setIconSize(QSize(60, 60));
 
QHeaderView *Header = pageView->verticalHeader();
128,7 → 128,7
m_scMW->Apply_MasterPage(masterpageName, pageIndex, false);
currView->reformPages();
currView->DrawNew();
SeItem* pageItem = pageView->getPageItem(pageIndex);
SeItem* pageItem = pageView->GetPageItem(pageIndex);
if (pageItem)
pageItem->setIcon(createIcon(pageIndex, masterpageName, pix));
}
135,9 → 135,9
 
void PagePalette_Pages::pageView_movePage(int r, int c)
{
if (r == c || r == pageView->m_pageCount - 1)
if (r == c || r == pageView->MaxC)
return;
if (c >= pageView->m_pageCount)
if (c > pageView->MaxC)
currView->Doc->movePage(r, r + 1, c, 2);
else
currView->Doc->movePage(r, r + 1, c, 0);
152,7 → 152,7
{
int p;
bool dummy;
p = pageView->getPage(r, c, &dummy);
p = pageView->GetPage(r, c, &dummy);
emit gotoPage(p);
}
}
197,7 → 197,7
{
const QString& pageName = it.key();
QString pageLabel = (pageName == CommonStrings::masterPageNormal) ? CommonStrings::trMasterPageNormal : pageName;
if (masterPageList->m_thumb)
if (masterPageList->Thumb)
{
pm = QPixmap::fromImage(currView->MPageToPixmap(pageName, 60));
item = new QListWidgetItem(QIcon(pm), pageLabel, masterPageList);
227,7 → 227,7
pageLayout->updateLayoutSelector(currView->Doc->pageSets());
pageLayout->selectItem(currView->Doc->pagePositioning());
pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage);
pageView->m_pageCount = currView->Doc->DocPages.count();
pageView->MaxC = currView->Doc->DocPages.count()-1;
int counter = currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage;
int cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
int rows = (currView->Doc->DocPages.count()+counter) / currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
262,12 → 262,12
pageView->setItem(rr, cc, tW);
}
}
pageView->m_coladd = coladd;
pageView->m_colmult = colmult;
pageView->m_rowadd = rowadd;
pageView->m_rowmult = rowmult;
pageView->m_firstPage = counter;
pageView->m_cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
pageView->coladd = coladd;
pageView->colmult = colmult;
pageView->rowadd = rowadd;
pageView->rowmult = rowmult;
pageView->firstP = counter;
pageView->cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
pageList.clear();
for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
{
345,9 → 345,9
 
void PagePalette_Pages::selMasterPage()
{
if (masterPageList->m_currItem == nullptr)
if (masterPageList->CurItem == nullptr)
return;
QVariant pageVar = masterPageList->m_currItem->data(Qt::UserRole);
QVariant pageVar = masterPageList->CurItem->data(Qt::UserRole);
emit gotoMasterPage(pageVar.toString());
}
 
/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
44,15 → 44,15
/* ListBox Subclass */
SeList::SeList(QWidget* parent) : QListWidget(parent)
{
m_currItem = nullptr;
m_mousePressed = false;
m_thumb = false;
CurItem = nullptr;
Mpressed = false;
Thumb = false;
setAcceptDrops(true);
}
 
void SeList::mouseReleaseEvent(QMouseEvent *m)
{
m_mousePressed = false;
Mpressed = false;
if (m->button() == Qt::RightButton)
{
QMenu *pmen = new QMenu();
59,7 → 59,7
// qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QAction *px = pmen->addAction( tr("Show Page Previews"), this, SLOT(toggleThumbnail()));
px->setCheckable(true);
if (m_thumb)
if (Thumb)
px->setChecked(true);
pmen->exec(QCursor::pos());
delete pmen;
69,7 → 69,7
 
void SeList::toggleThumbnail()
{
m_thumb = !m_thumb;
Thumb = !Thumb;
emit thumbnailChanged();
}
 
76,13 → 76,13
void SeList::mousePressEvent(QMouseEvent* e)
{
e->accept();
m_currItem = nullptr;
CurItem = nullptr;
QListWidgetItem *i = itemAt(e->pos());
if (i)
{
m_currItem = i;
m_mousePos = e->pos();
m_mousePressed = true;
CurItem = i;
Mpos = e->pos();
Mpressed = true;
}
QListWidget::mousePressEvent(e);
}
89,10 → 89,10
 
void SeList::mouseMoveEvent(QMouseEvent* e)
{
if ((m_mousePressed) && ((m_mousePos - e->pos()).manhattanLength() > 4))
if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
{
m_mousePressed = false;
QListWidgetItem *item = itemAt(m_mousePos);
Mpressed = false;
QListWidgetItem *item = itemAt(Mpos);
if (!item)
return;
QMimeData *mimeData = new QMimeData;
142,14 → 142,15
// viewport()->setAcceptDrops(true);
setShowGrid(false);
setWordWrap(true);
m_mousePressed = false;
m_pageCount = 0;
m_colmult = 1;
m_coladd = 0;
m_rowmult = 2;
m_rowadd = 1;
m_cols = 1;
m_firstPage = 0;
Mpressed = false;
Namen = true;
MaxC = -1;
colmult = 1;
coladd = 0;
rowmult = 2;
rowadd = 1;
cols = 1;
firstP = 0;
// setFocusPolicy(Qt::NoFocus);
}
 
156,8 → 157,8
void SeView::mousePressEvent(QMouseEvent* e)
{
e->accept();
m_mousePos = e->pos();
m_mousePressed = true;
Mpos = e->pos();
Mpressed = true;
QTableWidget::mousePressEvent(e);
}
 
164,17 → 165,38
void SeView::mouseReleaseEvent(QMouseEvent* e)
{
e->accept();
m_mousePressed = false;
 
Mpressed = false;
/* if (e->button() == RightButton)
{
QPopupMenu *pmen = new QPopupMenu();
qApp->setOverrideCursor(QCursor(Qt::ArrowCursor), true);
int px = pmen->insertItem( tr("Show Master Page Names"), this, SLOT(ToggleNam()));
if (Namen)
pmen->setItemChecked(px, true);
pmen->exec(QCursor::pos());
delete pmen;
} */
emit Click(rowAt(e->pos().y()), columnAt(e->pos().x()), e->button());
QTableWidget::mouseReleaseEvent(e);
}
 
void SeView::ToggleNam()
{
/* Namen = !Namen;
int val = 35;
if (Namen)
val = 100;
setColumnWidth(1, val);
setColumnWidth(3, val);
hide();
show(); */
}
 
void SeView::mouseMoveEvent(QMouseEvent* e)
{
if ((m_mousePressed) && ((m_mousePos - e->pos()).manhattanLength() > 4))
if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
{
m_mousePressed = false;
Mpressed = false;
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
if ((a != -1) && (b != -1))
187,11 → 209,11
SeItem* it = (SeItem*)ite;
QString str(it->pageName);
bool dummy;
int p = getPage(a, b, &dummy);
int p = GetPage(a, b, &dummy);
QString tmp;
QMimeData *mimeData = new QMimeData;
mimeData->setData("page/magic", "2 " + tmp.setNum(p).toLocal8Bit() + " " + str.toLocal8Bit());
mimeData->setText("2 " + tmp.setNum(p) + " " + str);
mimeData->setData("page/magic", "2 "+tmp.setNum(p).toLocal8Bit()+" "+str.toLocal8Bit());
mimeData->setText("2 "+tmp.setNum(p)+" "+str);
QDrag *dr = new QDrag(this);
dr->setMimeData(mimeData);
const QPixmap& pm = IconManager::instance().loadPixmap("doc.png");
221,7 → 243,7
// Fixed at least in Qt-4.4.2
// QApplication::restoreOverrideCursor();
str = e->mimeData()->text();
clearPix();
ClearPix();
if (str.startsWith("1"))
{
int a = rowAt(e->pos().y());
230,12 → 252,12
tmp = str.remove(0,1);
if ((a == -1) || (b == -1))
return;
if (a == rowCount() - 1)
if (a == rowCount()-1)
{
emit NewPage(m_pageCount, tmp);
emit NewPage(MaxC+1, tmp);
return;
}
p = getPage(a, b, &lastPage);
p = GetPage(a, b, &lastPage);
if (columnCount() == 1)
{
if ((a % 2) == 0)
257,7 → 279,7
if ((b % 2) == 0)
{
if (lastPage)
emit NewPage(p + 1, tmp);
emit NewPage(p+1, tmp);
else
emit NewPage(p, tmp);
}
278,7 → 300,7
if (str.startsWith("2"))
{
int st = str.indexOf(" ");
int en = str.indexOf(" ", st + 1);
int en = str.indexOf(" ", st+1);
tmp = str.mid(en+1);
int dr = str.midRef(st, en-st).toInt();
int a = rowAt(e->pos().y());
286,8 → 308,8
if ((a == -1) || (b == -1))
return;
QTableWidgetItem* ite = item(a, b);
int p = getPage(a, b, &lastPage);
if (a == rowCount() - 1)
int p = GetPage(a, b, &lastPage);
if (a == rowCount()-1)
{
emit movePage(dr, p+1);
return;
332,7 → 354,7
 
void SeView::dragLeaveEvent(QDragLeaveEvent *)
{
clearPix();
ClearPix();
}
 
void SeView::dragMoveEvent(QDragMoveEvent *e)
342,7 → 364,7
e->acceptProposedAction();
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
clearPix();
ClearPix();
if ((a == -1) || (b == -1))
return;
if (columnCount() == 1)
374,7 → 396,7
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
{
bool dummy;
int pageToDelete = getPage(currentRow(), currentColumn(), &dummy);
int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
emit DelPage(pageToDelete);
}
accepted = true;
383,7 → 405,7
QTableWidget::keyPressEvent(e);
}
 
void SeView::clearPix()
void SeView::ClearPix()
{
int counter = 0;
int rowcounter = 0;
417,22 → 439,22
}
}
 
int SeView::getPage(int r, int c, bool *last)
int SeView::GetPage(int r, int c, bool *last)
{
int counter = m_firstPage;
int counter = firstP;
int rowcounter = 0;
int ret = m_pageCount - 1;
int ret = MaxC;
*last = false;
if (r == rowCount() - 1)
if (r == rowCount()-1)
{
*last = true;
return ret;
}
if ((r == 0) && (c < m_firstPage * m_colmult + m_coladd))
if ((r == 0) && (c < firstP*colmult+coladd))
return 0;
for (int a = 0; a < m_pageCount; ++a)
for (int a = 0; a < MaxC+1; ++a)
{
if ((rowcounter * m_rowmult + m_rowadd == r) && (counter * m_colmult + m_coladd == c))
if ((rowcounter*rowmult+rowadd == r) && (counter*colmult+coladd == c))
{
ret = a;
return ret;
439,7 → 461,7
}
if (columnCount() == 1)
{
if ((rowcounter * m_rowmult) == r)
if ((rowcounter*rowmult) == r)
{
ret = a;
return ret;
447,7 → 469,7
}
else
{
if ((counter * m_colmult == c) && (rowcounter * m_rowmult + m_rowadd == r))
if ((counter*colmult == c) && (rowcounter*rowmult+rowadd == r))
{
ret = a;
return ret;
454,7 → 476,7
}
}
counter++;
if (counter > m_cols - 1)
if (counter > cols-1)
{
counter = 0;
rowcounter++;
464,7 → 486,7
return ret;
}
 
SeItem* SeView::getPageItem(int pageIndex)
SeItem* SeView::GetPageItem(int pageIndex)
{
int rows = this->rowCount();
int columns = this->columnCount();
/trunk/Scribus/scribus/ui/pagepalette_widgets.h
79,10 → 79,10
void mouseMoveEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
QPoint m_mousePos;
bool m_mousePressed;
QListWidgetItem *m_currItem;
bool m_thumb;
QPoint Mpos;
QListWidgetItem *CurItem;
bool Mpressed;
bool Thumb;
 
};
 
97,10 → 97,13
SeView(QWidget* parent);
~SeView() {};
 
void clearPix();
int getPage(int r, int c, bool *last);
SeItem* getPageItem(int pageIndex);
void ClearPix();
int GetPage(int r, int c, bool *last);
SeItem* GetPageItem(int pageIndex);
 
public slots:
void ToggleNam();
 
signals:
void UseTemp(QString, int);
void NewPage(int, QString);
118,15 → 121,16
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
QPoint m_mousePos;
bool m_mousePressed;
int m_pageCount;
int m_colmult;
int m_rowmult;
int m_coladd;
int m_rowadd;
int m_cols;
int m_firstPage;
QPoint Mpos;
bool Mpressed;
bool Namen;
int MaxC;
int colmult;
int rowmult;
int coladd;
int rowadd;
int cols;
int firstP;
};
 
class SCRIBUS_API TrashBin : public QLabel
136,7 → 140,6
public:
TrashBin( QWidget * parent );
~TrashBin() {};
 
void dragEnterEvent( QDragEnterEvent *e );
void dragLeaveEvent( QDragLeaveEvent * );
void dropEvent( QDropEvent * e );