Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 17513 → Rev 17512

/trunk/Scribus/scribus/ui/pagepalette_pages.h
File deleted
/trunk/Scribus/scribus/ui/pagepalette_pagesbase.ui
File deleted
/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
File deleted
/trunk/Scribus/scribus/ui/pagepalette_widgets.h
File deleted
/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
File deleted
/trunk/Scribus/scribus/ui/pagepalette_masterpagesbase.ui
File deleted
/trunk/Scribus/scribus/ui/pagepalette_masterpages.h
File deleted
/trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
File deleted
/trunk/Scribus/scribus/ui/pagepalette.cpp
7,17 → 7,21
 
 
#include <QApplication>
#include <QBitmap>
#include <QCursor>
#include <QDrag>
#include <QEvent>
#include <QHeaderView>
#include <QLabel>
#include <QList>
#include <QMenu>
#include <QMimeData>
#include <QMessageBox>
#include <QPainter>
#include <QStackedWidget>
 
#include "commonstrings.h"
#include "pagelayout.h"
#include "pagepalette.h"
#include "pagepalette_masterpages.h"
#include "pagepalette_pages.h"
#include "pagepalette_widgets.h"
#include "sccombobox.h"
#include "scpage.h"
#include "scribus.h"
24,183 → 28,930
#include "scribusview.h"
#include "util_icon.h"
 
PagePalette::PagePalette(QWidget* parent) : ScDockPalette(parent, "PagePalette", 0)
/* IconItems Code */
SeItem::SeItem(QString text, uint nr, const QPixmap& Pix) : QTableWidgetItem(QIcon(Pix), "", 1002)
{
m_scMW = (ScribusMainWindow*) parent;
m_view = 0;
pageNumber = nr;
pageName = text;
setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
 
setObjectName(QString::fromLocal8Bit("PagePalette"));
const QString& SeItem::getPageName()
{
return pageName;
}
 
QStackedWidget* stackedWidget = new QStackedWidget(this);
stackedWidget->setObjectName(QString::fromLocal8Bit("stackedWidget"));
/* ListBox Subclass */
SeList::SeList(QWidget* parent) : QListWidget(parent)
{
Mpressed = false;
setAcceptDrops(true);
}
 
PagePalette_Pages* pageWidget = new PagePalette_Pages(stackedWidget);
pageWidget->setObjectName(QString::fromLocal8Bit("PagePalette_Pages"));
stackedWidget->addWidget(pageWidget);
void SeList::mouseReleaseEvent(QMouseEvent *m)
{
Mpressed = false;
if (m->button() == Qt::RightButton)
{
QMenu *pmen = new QMenu();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QAction *px = pmen->addAction( tr("Show Page Previews"), this, SLOT(toggleThumbnail()));
px->setCheckable(true);
if (Thumb)
px->setChecked(true);
pmen->exec(QCursor::pos());
delete pmen;
}
QListWidget::mouseReleaseEvent(m);
}
 
setWidget(stackedWidget);
void SeList::toggleThumbnail()
{
Thumb = !Thumb;
emit thumbnailChanged();
}
 
connect(pageWidget, SIGNAL(gotoMasterPage(QString)), m_scMW, SLOT(manageMasterPages(QString)));
Rebuild();
languageChange();
void SeList::mousePressEvent(QMouseEvent* e)
{
e->accept();
CurItem = 0;
QListWidgetItem *i = itemAt(e->pos());
if (i)
{
CurItem = i;
Mpos = e->pos();
Mpressed = true;
}
QListWidget::mousePressEvent(e);
}
 
QWidget* PagePalette::currentWidget()
void SeList::mouseMoveEvent(QMouseEvent* e)
{
QStackedWidget* sw = dynamic_cast<QStackedWidget*>(this->widget());
if (sw)
return sw->currentWidget();
return 0;
if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
{
Mpressed = false;
QListWidgetItem *i = itemAt(Mpos);
if (i)
{
QMimeData *mimeData = new QMimeData;
mimeData->setData("page/magic", "1"+i->text().toLocal8Bit());
mimeData->setText("1"+i->text());
QDrag *dr = new QDrag(this);
dr->setMimeData(mimeData);
const QPixmap& pm = loadIcon("doc.png");
dr->setPixmap(pm);
// dr->setDragCursor(pm, Qt::CopyAction);
// dr->setDragCursor(pm, Qt::MoveAction);
dr->exec(Qt::CopyAction | Qt::MoveAction);
QApplication::setOverrideCursor(Qt::ArrowCursor);
}
}
}
 
PagePalette_MasterPages* PagePalette::masterpageWidget() const
void SeList::keyPressEvent(QKeyEvent * e)
{
if (this->stackedWidget()->count() >= 2)
return dynamic_cast<PagePalette_MasterPages*>(this->stackedWidget()->widget(1));
return 0;
bool accepted = false;
int k = e->key();
if (k == Qt::Key_Delete)
{
if (currentItem())
{
e->accept();
if (!QMessageBox::question(this, tr("Delete Master Page?"),
"<qt>" + tr("Are you sure you want to delete this master page?") + "</qt>",
CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 ))
{
emit DelMaster(currentItem()->text());
}
accepted = true;
}
}
if (!accepted)
QListWidget::keyPressEvent(e);
}
 
PagePalette_Pages* PagePalette::pageWidget() const
 
/* QTable Subclass */
SeView::SeView(QWidget* parent) : QTableWidget(parent)
{
if (this->stackedWidget()->count() >= 1)
return dynamic_cast<PagePalette_Pages*>(this->stackedWidget()->widget(0));
return 0;
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
// viewport()->setAcceptDrops(true);
setShowGrid(false);
setWordWrap(true);
Mpressed = false;
Namen = true;
// setFocusPolicy(Qt::NoFocus);
}
 
QStackedWidget* PagePalette::stackedWidget() const
void SeView::mousePressEvent(QMouseEvent* e)
{
QStackedWidget* sw = dynamic_cast<QStackedWidget*>(this->widget());
return sw;
e->accept();
Mpos = e->pos();
Mpressed = true;
QTableWidget::mousePressEvent(e);
}
 
void PagePalette::enablePalette(const bool enabled)
void SeView::mouseReleaseEvent(QMouseEvent* e)
{
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->enablePalette(enabled);
e->accept();
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 PagePalette::rebuildMasters()
void SeView::ToggleNam()
{
if (m_scMW->scriptIsRunning())
return;
/* Namen = !Namen;
int val = 35;
if (Namen)
val = 100;
setColumnWidth(1, val);
setColumnWidth(3, val);
hide();
show(); */
}
 
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->rebuildMasters();
void SeView::mouseMoveEvent(QMouseEvent* e)
{
if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
{
Mpressed = false;
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
if ((a != -1) && (b != -1))
{
QTableWidgetItem* ite = item(a, b);
if (ite != 0)
{
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
QString str(it->pageName);
bool 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);
QDrag *dr = new QDrag(this);
dr->setMimeData(mimeData);
const QPixmap& pm = loadIcon("doc.png");
dr->setPixmap(pm);
// dr->setDragCursor(pm, Qt::CopyAction);
// dr->setDragCursor(pm, Qt::MoveAction);
dr->exec(Qt::CopyAction | Qt::MoveAction);
QApplication::setOverrideCursor(Qt::ArrowCursor);
}
}
}
}
QTableWidget::mouseMoveEvent(e);
}
 
void PagePalette::rebuildPages()
void SeView::dropEvent(QDropEvent * e)
{
if (m_scMW->scriptIsRunning())
return;
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->rebuildPages();
QString str, tmp;
bool lastPage = false;
if (e->mimeData()->hasFormat("page/magic"))
{
e->setDropAction(Qt::MoveAction);
e->accept();
// HACK to prevent strange Qt4 cursor behaviour after dropping. It's examined by Trolltech now - PV.
// It's the one and only reason why to include QApplication here.
// But sadly this destroys our normal Cursors
// Fixed at least in Qt-4.4.2
// QApplication::restoreOverrideCursor();
str = e->mimeData()->text();
ClearPix();
if (str.startsWith("1"))
{
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
int p;
tmp = str.remove(0,1);
if ((a == -1) || (b == -1))
return;
if (a == rowCount()-1)
{
emit NewPage(MaxC+1, tmp);
return;
}
p = GetPage(a, b, &lastPage);
if (columnCount() == 1)
{
if ((a % 2) == 0)
emit NewPage(p, tmp);
else
{
emit UseTemp(tmp, p);
QTableWidgetItem* ite = item(a, b);
if (ite == 0)
return;
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
}
return;
}
else
{
if ((b % 2) == 0)
{
if (lastPage)
emit NewPage(p+1, tmp);
else
emit NewPage(p, tmp);
}
else
{
emit UseTemp(tmp, p);
QTableWidgetItem* ite = item(a, b);
if (ite == 0)
return;
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
}
return;
}
}
if (str.startsWith("2"))
{
int st = str.indexOf(" ");
int en = str.indexOf(" ", st+1);
tmp = str.mid(en+1);
int dr = str.mid(st, en-st).toInt();
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
int p;
if ((a == -1) || (b == -1))
return;
QTableWidgetItem* ite = item(a, b);
p = GetPage(a, b, &lastPage);
if (a == rowCount()-1)
{
emit movePage(dr, p+1);
return;
}
if (columnCount() == 1)
{
if ((a % 2) == 0)
emit movePage(dr, p);
else
{
emit UseTemp(tmp, p);
if (ite == 0)
return;
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
return;
}
else
{
if ((b % 2) == 0)
emit movePage(dr, lastPage ? p+1 : p);
else
{
emit UseTemp(tmp, p);
if (ite == 0)
return;
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
}
return;
}
}
}
}
 
void PagePalette::Rebuild()
void SeView::dragEnterEvent(QDragEnterEvent *e)
{
rebuildMasters();
rebuildPages();
enablePalette(m_view != 0);
if (e->mimeData()->hasFormat("page/magic"))
e->acceptProposedAction();
}
 
void PagePalette::markPage(uint nr)
void SeView::dragLeaveEvent(QDragLeaveEvent *)
{
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->markPage(nr);
ClearPix();
}
 
void PagePalette::setView(ScribusView *view)
void SeView::dragMoveEvent(QDragMoveEvent *e)
{
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->setView(view);
PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
if (mpWidget)
mpWidget->setView(view);
m_view = view;
QString str, tmp;
if (e->mimeData()->hasFormat("page/magic"))
{
e->acceptProposedAction();
str = e->mimeData()->text();
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
ClearPix();
if ((a == -1) || (b == -1))
return;
if (columnCount() == 1)
{
if ((a % 2) == 0)
{
item(a, 0)->setBackground(Qt::darkBlue);
}
}
else
{
if (((b % 2) == 0) || (a == rowCount()-1))
{
item(a, b)->setBackground(Qt::darkBlue);
}
}
}
}
 
void PagePalette::updateMasterPageList()
void SeView::keyPressEvent(QKeyEvent * e)
{
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
if (pageWidget)
pageWidget->rebuildMasters();
bool accepted = false;
int k = e->key();
if (k == Qt::Key_Delete)
{
e->accept();
if (!QMessageBox::question(this, tr("Delete Page?"),
"<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 ))
{
bool dummy;
int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
emit DelPage(pageToDelete);
}
accepted = true;
}
if (!accepted)
QTableWidget::keyPressEvent(e);
}
 
void SeView::ClearPix()
{
int counter = 0;
int rowcounter = 0;
for (int a = 0; a < rowCount(); ++a)
{
counter = 0;
if (columnCount() == 1)
{
if ((a % 2) == 0)
{
item(rowcounter, 0)->setBackground(Qt::white);
rowcounter += 2;
}
}
else
{
for (int b = 0; b < columnCount(); ++b)
{
if ((b % 2) == 0)
{
item(rowcounter, counter)->setBackground(Qt::white);
counter += 2;
}
}
rowcounter++;
}
}
for (int c = 0; c < columnCount(); ++c)
{
item(rowCount()-1, c)->setBackground(Qt::white);
}
}
 
int SeView::GetPage(int r, int c, bool *last)
{
int counter = firstP;
int rowcounter = 0;
int ret = MaxC;
*last = false;
if (r == rowCount()-1)
{
*last = true;
return ret;
}
if ((r == 0) && (c < firstP*colmult+coladd))
return 0;
for (int a = 0; a < MaxC+1; ++a)
{
if ((rowcounter*rowmult+rowadd == r) && (counter*colmult+coladd == c))
{
ret = a;
return ret;
}
else
{
if (columnCount() == 1)
{
if ((rowcounter*rowmult) == r)
{
ret = a;
return ret;
}
}
else
{
if ((counter*colmult == c) && (rowcounter*rowmult+rowadd == r))
{
ret = a;
return ret;
}
}
}
counter++;
if (counter > cols-1)
{
counter = 0;
rowcounter++;
}
}
*last = true;
return ret;
}
 
/* Der Muelleimer */
TrashBin::TrashBin(QWidget * parent) : QLabel(parent)
{
Normal = loadIcon("trashcan.png");
Offen = loadIcon("trashcan2.png");
setPixmap(Normal);
setScaledContents(false);
setAcceptDrops(true);
}
 
void TrashBin::dragEnterEvent(QDragEnterEvent *e)
{
if (e->mimeData()->hasFormat("page/magic"))
{
e->accept();
setPixmap(Offen);
}
}
 
void TrashBin::dragLeaveEvent(QDragLeaveEvent *)
{
setPixmap(Normal);
}
 
void TrashBin::dropEvent(QDropEvent * e)
{
setPixmap(Normal);
QString str, tmp;
if (e->mimeData()->hasFormat("page/magic"))
{
e->accept();
str = e->mimeData()->text();
if (str.startsWith("2"))
{
int st = str.indexOf(" ");
int en = str.indexOf(" ", st+1);
emit DelPage(str.mid(st, en-st).toInt());
}
if (str.startsWith("1"))
{
tmp = str.remove(0,1);
emit DelMaster(tmp);
}
}
}
 
 
PagePalette::PagePalette(QWidget* parent) : ScDockPalette( parent, "Sp", 0)
{
m_scMW=(ScribusMainWindow*)parent;
setObjectName(QString::fromLocal8Bit("Sp"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
containerWidget = new QWidget(this);
PagePaletteLayout = new QVBoxLayout( containerWidget );
PagePaletteLayout->setSpacing( 5 );
PagePaletteLayout->setMargin( 5 );
Splitter1 = new QSplitter( this );
Splitter1->setOrientation( Qt::Vertical );
QWidget* privateLayoutWidget = new QWidget( Splitter1 );
Layout2 = new QVBoxLayout( privateLayoutWidget );
Layout2->setMargin(0);
Layout2->setSpacing(5);
TextLabel1 = new QLabel( privateLayoutWidget );
Layout2->addWidget( TextLabel1 );
masterPageList = new SeList(privateLayoutWidget);
masterPageList->setMinimumSize(QSize(130,70));
masterPageList->Thumb = false;
masterPageList->setIconSize(QSize(60, 60));
Layout2->addWidget( masterPageList );
QWidget* privateLayoutWidget_2 = new QWidget( Splitter1 );
Layout3 = new QVBoxLayout( privateLayoutWidget_2);
Layout3->setMargin(0);
Layout3->setSpacing(5);
TextLabel2 = new QLabel( privateLayoutWidget_2 );
Layout3->addWidget( TextLabel2 );
pageView = new SeView(privateLayoutWidget_2);
QHeaderView *Header = pageView->verticalHeader();
Header->setMovable(false);
Header->setResizeMode(QHeaderView::Fixed);
Header->hide();
Header = pageView->horizontalHeader();
Header->setMovable(false);
Header->setResizeMode(QHeaderView::Fixed);
Header->hide();
pageView->setSortingEnabled(false);
pageView->setSelectionMode( QAbstractItemView::NoSelection );
pageView->setRowCount(1);
pageView->setColumnCount(1);
pageView->setIconSize(QSize(60, 60));
pageView->setMinimumSize(QSize(130,120));
Layout3->addWidget( pageView );
PagePaletteLayout->addWidget( Splitter1 );
 
Layout1 = new QHBoxLayout;
Layout1->setSpacing( 5 );
Layout1->setMargin( 0 );
QList<PageSet> dummy;
dummy.clear();
struct PageSet pageS;
pageS.Name = CommonStrings::trPageSet2;
pageS.FirstPage = 0;
pageS.Rows = 1;
pageS.Columns = 1;
// pageS.GapHorizontal = 0.0;
// pageS.GapVertical = 0.0;
// pageS.GapBelow = 40.0;
pageS.pageNames.clear();
pageS.pageNames.append(CommonStrings::trPageLocMiddleRight);
dummy.append(pageS);
pageLayout = new PageLayouts(this, dummy, false);
Layout1->addWidget( pageLayout );
 
// QSpacerItem* spacer = new QSpacerItem( 15, 15, QSizePolicy::Expanding, QSizePolicy::Minimum );
// Layout1->addItem( spacer );
 
Trash = new TrashBin( this );
Trash->setMinimumSize(QSize(32,32));
Trash->setMaximumSize(QSize(32,32));
Layout1->addWidget( Trash );
PagePaletteLayout->addLayout( Layout1 );
setWidget( containerWidget );
pix = loadIcon("32/page-simple.png");
currView = 0;
Rebuild();
languageChange();
connect(masterPageList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(selMasterPage()));
connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
connect(masterPageList, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
connect(pageView, SIGNAL(Click(int, int, int)), this, SLOT(pageView_gotoPage(int, int, int)));
connect(pageView, SIGNAL(movePage(int, int)), this, SLOT(pageView_movePage(int, int)));
connect(Trash, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
connect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
connect(this, SIGNAL(EditTemp(QString)), m_scMW, SLOT(manageMasterPages(QString)));
connect(pageView, SIGNAL(UseTemp(QString, int)), m_scMW, SLOT(Apply_MasterPage(QString, int)));
connect(pageView, SIGNAL(NewPage(int, QString)), m_scMW, SLOT(slotNewPageP(int, QString)));
connect(Trash, SIGNAL(DelPage(int)), m_scMW, SLOT(deletePage2(int)));
connect(pageView, SIGNAL(DelPage(int)), m_scMW, SLOT(deletePage2(int)));
connect(this, SIGNAL(gotoPage(int)), m_scMW, SLOT(selectPagesFromOutlines(int)));
}
 
void PagePalette::deleteMasterPage(QString tmp)
{
if (tmp == CommonStrings::trMasterPageNormal)
return;
QString extraWarn = "";
for (int i=0; i < currView->Doc->DocPages.count(); ++i )
{
if (currView->Doc->DocPages[i]->MPageNam == tmp)
extraWarn = tr("This master page is used at least once in the document.");
}
int exit = QMessageBox::warning(this,
CommonStrings::trWarning,
tr("Do you really want to delete this master page?")+"\n"+extraWarn,
QMessageBox::Yes | QMessageBox::No);
if (exit == QMessageBox::Yes)
{
bool oldMPMode = currView->Doc->masterPageMode();
int storedPageNum = currView->Doc->currentPageNumber();
int storedViewXCoor = currView->horizontalScrollBar()->value();
int storedViewYCoor = currView->verticalScrollBar()->value();
 
currView->Doc->setMasterPageMode(true);
currView->Doc->scMW()->deletePage2(currView->Doc->MasterNames[tmp]);
//<<CB TODO Move back into ScribusDoc::deleteMasterPage();
//This must happen after the pages have been reformed (view/doc)
currView->Doc->rebuildMasterNames();
// Fix up any pages that refer to the deleted master page
currView->Doc->replaceMasterPage(tmp);
currView->Doc->setMasterPageMode(oldMPMode);
currView->Doc->setModified(true);
 
currView->Doc->setCurrentPage(currView->Doc->DocPages.at(storedPageNum));
currView->reformPages(false);
currView->setContentsPos(storedViewXCoor, storedViewYCoor);
currView->DrawNew();
}
}
 
void PagePalette::pageView_movePage(int r, int c)
{
if (r == c)
return;
if (c > pageView->MaxC)
currView->Doc->movePage(r, r + 1, c, 2);
else
currView->Doc->movePage(r, r + 1, c, 0);
currView->reformPages();
rebuildPages();
currView->DrawNew();
//CB done by doc::reformpages
// currView->Doc->setModified(true);
}
 
void PagePalette::pageView_gotoPage(int r, int c, int b)
{
int p;
bool dummy;
if ((b == Qt::LeftButton) && (r != -1) && (c != -1))
{
PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
if (mpWidget)
mpWidget->updateMasterPageList();
p = pageView->GetPage(r, c, &dummy);
emit gotoPage(p);
}
}
 
bool PagePalette::masterPageMode()
void PagePalette::enablePalette(const bool enabled)
{
PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
return (mpWidget != NULL);
pageView->setEnabled(enabled);
masterPageList->setEnabled(enabled);
pageLayout->setEnabled(enabled);
}
 
void PagePalette::startMasterPageMode(QString masterPage)
void PagePalette::handlePageLayout(int layout)
{
m_view->Deselect(true);
pageLayout->selectFirstP(currView->Doc->pageSets()[layout].FirstPage);
currView->Doc->resetPage(layout);
currView->reformPages();
currView->DrawNew();
currView->GotoPage(currView->Doc->currentPageNumber());
rebuildPages();
//CB done by doc::reformpages
// currView->Doc->setModified(true);
}
 
QStackedWidget* stackedWidget = this->stackedWidget();
if (stackedWidget->count() < 2)
void PagePalette::handleFirstPage(int fp)
{
// currView->Doc->pageSets()[currView->Doc->currentPageLayout].FirstPage = fp;
currView->Doc->setPageSetFirstPage(currView->Doc->pagePositioning(), fp);
currView->reformPages();
currView->DrawNew();
currView->GotoPage(currView->Doc->currentPageNumber());
rebuildPages();
//CB done by doc::reformpages
// currView->Doc->setModified(true);
}
 
void PagePalette::rebuildMasters()
{
if (m_scMW->scriptIsRunning())
return;
masterPageList->clear();
if (currView == 0)
return;
QPixmap pm;
QMap<QString,int>::Iterator it;
for (it = currView->Doc->MasterNames.begin(); it != currView->Doc->MasterNames.end(); ++it)
{
PagePalette_MasterPages* mpWidget = new PagePalette_MasterPages(stackedWidget, m_view, masterPage);
mpWidget->setObjectName(QString::fromLocal8Bit("PagePalette_MasterPages"));
stackedWidget->addWidget(mpWidget);
if (masterPageList->Thumb)
{
pm = QPixmap::fromImage(currView->MPageToPixmap(it.key(),60));
new QListWidgetItem(QIcon(pm), it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key(), masterPageList);
}
else
masterPageList->addItem(it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key());
}
}
 
connect(mpWidget, SIGNAL(removePage(int )), m_scMW, SLOT(deletePage2(int )));
connect(mpWidget, SIGNAL(finished()) , m_scMW, SLOT(manageMasterPagesEnd()));
void PagePalette::rebuildPages()
{
if (m_scMW->scriptIsRunning())
return;
QString str;
disconnect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
disconnect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
pageView->clearContents();
pageView->setRowCount(1);
pageView->setColumnCount(1);
if (currView == 0)
{
connect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
return;
}
pageLayout->updateLayoutSelector(currView->Doc->pageSets());
pageLayout->selectItem(currView->Doc->pagePositioning());
pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage);
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;
if (((currView->Doc->DocPages.count()+counter) % currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns) != 0)
rows++;
int rowcounter = 0;
int colmult, rowmult, coladd, rowadd;
if (cols == 1)
{
pageView->setColumnCount(cols);
pageView->setRowCount(rows*2+1);
colmult = 1;
coladd = 0;
rowmult = 2;
rowadd = 1;
}
else
{
ScribusDoc* doc = m_view->Doc;
PagePalette_MasterPages* mpWidget = this->masterpageWidget();
if (mpWidget->currentView != m_view)
mpWidget->setView(m_view, masterPage);
mpWidget->updateMasterPageList(masterPage);
if (doc->currentPage()->pageName() != masterPage)
mpWidget->selectMasterPage(masterPage);
pageView->setColumnCount(cols*2);
pageView->setRowCount(rows+1);
colmult = 2;
coladd = 1;
rowmult = 1;
rowadd = 0;
}
for (int rr = 0; rr < pageView->rowCount(); rr++)
{
for (int cc = 0; cc < pageView->columnCount(); cc++)
{
QTableWidgetItem *tW = new QTableWidgetItem(1001);
tW->setFlags(Qt::ItemIsEnabled);
pageView->setItem(rr, cc, tW);
}
}
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)
{
str = currView->Doc->DocPages.at(a)->MPageNam;
SeItem *it = new SeItem(str, a, CreateIcon(a, pix));
pageList.append(it);
pageView->setItem(rowcounter*rowmult+rowadd, counter*colmult+coladd, (QTableWidgetItem *)it);
pageView->setColumnWidth(counter*colmult+coladd, pix.width());
if (cols == 1)
{
pageView->setRowHeight(rowcounter*rowmult, 10);
pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height());
}
else
pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height()+5);
counter++;
if (counter > currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns-1)
{
counter = 0;
rowcounter++;
}
}
pageView->setRowHeight(pageView->rowCount()-1, 10);
counter = 0;
if (cols != 1)
{
for (int c = 0; c < pageView->columnCount(); ++c)
{
if ((counter % 2) == 0)
pageView->setColumnWidth(counter, 10);
else
pageView->setColumnWidth(counter, pix.width());
counter++;
}
}
pageView->repaint();
if (currView != 0)
markPage(currView->Doc->currentPageNumber());
connect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
}
 
// Set focus to page palette or focus may be set to wrong document window
this->setFocus();
stackedWidget->setCurrentIndex(1);
void PagePalette::Rebuild()
{
rebuildMasters();
rebuildPages();
enablePalette(currView != 0);
}
 
void PagePalette::endMasterPageMode()
void PagePalette::markPage(uint nr)
{
if (this->stackedWidget()->currentIndex() > 0)
if (currView != 0)
{
// Set focus to page palette or focus may be set to wrong document window
this->setFocus();
this->stackedWidget()->setCurrentIndex(0);
SeItem *it;
for (int a = 0; a < pageList.count(); a++)
{
it = pageList.at(a);
if (it->pageNumber == nr)
{
pageView->clearSelection();
pageView->item(it->row(), it->column())->setSelected(true);
pageView->scrollToItem(pageView->item(it->row(), it->column()), QAbstractItemView::EnsureVisible);
break;
}
}
}
}
 
PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
pageWidget->setView(m_view);
pageWidget->Rebuild();
void PagePalette::setView(ScribusView *view)
{
if (m_scMW->scriptIsRunning())
return;
currView = view;
}
 
void PagePalette::selMasterPage()
{
if (masterPageList->CurItem != 0)
emit EditTemp(masterPageList->CurItem->text());
}
 
QPixmap PagePalette::CreateIcon(int nr, QPixmap pixin)
{
QPainter p;
// Necessary on windows to ensure the pixmap is drawable
QPixmap ret(pixin.width(), pixin.height()); // Qt4, pixin.depth());
if (p.begin(&ret))
{
p.drawPixmap( 0, 0, pixin );
// if( !pixin.mask().isNull() )
// ret.setMask( pixin.mask() );
p.setBrush(Qt::white);
p.setBackground(Qt::white);
p.setBackgroundMode(Qt::OpaqueMode);
p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
p.setFont(QFont("Helvetica", 12, QFont::Bold));
//QString tmp = tmp.setNum(nr+1);
QString tmp(currView->Doc->getSectionPageNumberForPageIndex(nr));
if (tmp.isEmpty())
tmp = tmp.setNum(nr+1);
QRect b = p.fontMetrics().boundingRect(tmp);
QRect c = QRect((ret.width() / 2 - b.width() / 2)-2, (ret.height() / 2 - b.height() / 2)-2, b.width()+4, b.height()+4);
p.drawRect(c);
QRect d = QRect((ret.width() / 2 - b.width() / 2), (ret.height() / 2 - b.height() / 2), b.width(), b.height());
p.setFont(QFont("Helvetica", 10, QFont::Normal));
p.drawText(d, Qt::AlignCenter, tmp);
p.end();
if( !pixin.mask().isNull() )
ret.setMask( pixin.mask() );
}
return ret;
}
 
void PagePalette::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange)
{
languageChange();
return;
}
 
ScDockPalette::changeEvent(e);
else
ScDockPalette::changeEvent(e);
}
 
void PagePalette::languageChange()
{
setWindowTitle( tr( "Arrange Pages" ) );
TextLabel1->setText( tr( "Available Master Pages:" ) );
TextLabel2->setText( tr( "Document Pages:" ) );
masterPageList->setToolTip( "<qt>" + tr( "List of master pages in the document. Master page names may be dragged onto the page view below to apply master pages, or onto the empty space between pages to create new pages." ) + "</qt>");
pageView->setToolTip( "<qt>" + tr( "List of normal pages in the document, shown with the document layout. Pages may be dragged to rearrange or delete them.") + "</qt>");
Trash->setToolTip( "<qt>" + tr("Drag pages or master pages onto the trash to delete them") + "</qt>");
}
 
//CB Whats this variable returned for.. its always true... ?
//CB Clean up the interface and stick it behind this member for now
const bool PagePalette::getNamen()
{
return pageView->Namen;
}
 
//CB Whats this variable returned for.. its always true... ?
//CB Clean up the interface and stick it behind this member for now
const bool PagePalette::getThumb()
{
return masterPageList->Thumb;
}
 
 
/trunk/Scribus/scribus/ui/pagepalette.h
7,69 → 7,208
#ifndef SEITENPAL_H
#define SEITENPAL_H
 
#include <QCheckBox>
#include <QDialog>
#include <QDragEnterEvent>
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QHBoxLayout>
#include <QImage>
#include <QKeyEvent>
#include <QLabel>
#include <QLayout>
#include <QListWidget>
#include <QMouseEvent>
#include <QPixmap>
#include <QPushButton>
#include <QSplitter>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QToolTip>
#include <QVBoxLayout>
 
 
class QEvent;
class QStackedWidget;
class SeItem;
class SeList;
class SeView;
class TrashBin;
 
 
#include "scribusapi.h"
#include "scdockpalette.h"
 
class PagePalette_MasterPages;
class PagePalette_Pages;
class ScribusView;
class ScribusMainWindow;
class PageLayouts;
 
class SCRIBUS_API PagePalette : public ScDockPalette
class SCRIBUS_API SeItem : public QTableWidgetItem
{
 
friend class PagePalette;
friend class SeView;
 
 
public:
SeItem(QString text, uint pgnr, const QPixmap& Pix);
~SeItem() {};
 
const QString& getPageName();
uint pageNumber;
protected:
QString pageName;
};
 
class SCRIBUS_API SeList : public QListWidget
{
friend class PagePalette;
 
Q_OBJECT
 
public:
PagePalette(QWidget* parent);
~PagePalette() {};
SeList(QWidget* parent);
~SeList() {};
 
private slots:
void toggleThumbnail();
 
signals:
//! Emitted when user requests/disables the thumbnais for master pages.
void thumbnailChanged();
void DelMaster(QString);
 
protected:
void mouseReleaseEvent(QMouseEvent *m);
void mousePressEvent(QMouseEvent* e);
void mouseMoveEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
QWidget* currentWidget();
QStackedWidget* stackedWidget() const;
QPoint Mpos;
QListWidgetItem *CurItem;
bool Mpressed;
bool Thumb;
 
PagePalette_MasterPages* masterpageWidget() const;
PagePalette_Pages* pageWidget() const;
};
 
class SCRIBUS_API SeView : public QTableWidget
{
Q_OBJECT
friend class PagePalette;
 
public:
SeView(QWidget* parent);
~SeView() {};
void ClearPix();
int GetPage(int r, int c, bool *last);
 
public slots:
void ToggleNam();
 
signals:
void UseTemp(QString, int);
void NewPage(int, QString);
void movePage(int, int);
void Click(int, int, int);
void DelPage(int);
 
protected:
ScribusView *m_view;
ScribusMainWindow *m_scMW;
virtual void dropEvent(QDropEvent * e);
virtual void dragEnterEvent(QDragEnterEvent *e);
virtual void dragLeaveEvent(QDragLeaveEvent *e);
virtual void dragMoveEvent(QDragMoveEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *m);
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
QPoint Mpos;
bool Mpressed;
bool Doppel;
bool Links;
bool Namen;
int MaxC;
int colmult;
int rowmult;
int coladd;
int rowadd;
int cols;
int firstP;
};
 
class SCRIBUS_API TrashBin : public QLabel
{
Q_OBJECT
 
public:
TrashBin( QWidget * parent );
~TrashBin() {};
void dragEnterEvent( QDragEnterEvent *e );
void dragLeaveEvent( QDragLeaveEvent * );
void dropEvent( QDropEvent * e );
 
protected:
QPixmap Normal;
QPixmap Offen;
signals:
void DelPage(int);
void DelMaster(QString);
};
 
class SCRIBUS_API PagePalette : public ScDockPalette
{
Q_OBJECT
 
public:
PagePalette(QWidget* parent);
~PagePalette() {};
virtual void changeEvent(QEvent *e);
//CB FIXME Put these in for now and hide the rest. What are these indicating?
const bool getNamen();
const bool getThumb();
 
public slots:
void setView(ScribusView *view);
void deleteMasterPage(QString tmp);
void pageView_movePage(int r, int c);
void pageView_gotoPage(int r, int c, int b);
void enablePalette(const bool);
void handlePageLayout(int layout);
void handleFirstPage(int fp);
//! Recreate master pages thumbnails (if it's set on)
void rebuildMasters();
//! Recreate common pages arrangement
void rebuildPages();
//! Rebuild all lists
void Rebuild();
void markPage(uint nr);
void updateMasterPageList();
 
void selMasterPage();
QPixmap CreateIcon(int nr, QPixmap pixin);
void languageChange();
 
bool masterPageMode();
void startMasterPageMode(QString);
void endMasterPageMode();
 
signals:
void EditTemp(QString);
void gotoPage(int);
 
protected:
QWidget* containerWidget;
QVBoxLayout* PagePaletteLayout;
QHBoxLayout* Layout1;
QVBoxLayout* Layout2;
QVBoxLayout* Layout3;
PageLayouts* pageLayout;
QSplitter* Splitter1;
QLabel* TextLabel1;
QLabel* TextLabel2;
TrashBin* Trash;
QList<SeItem*> pageList;
SeList* masterPageList;
SeView* pageView;
ScribusView *currView;
ScribusMainWindow *m_scMW;
QPixmap pix;
// DynamicTip* dynTip;
};
 
#endif // SEITENPAL_H
/trunk/Scribus/scribus/ui/newfile.h
28,6 → 28,7
 
class PrefsManager;
class MarginWidget;
class PageLayouts;
class ScrSpinBox;
class ScComboBox;
#if QT_VERSION >= 0x040300
/trunk/Scribus/scribus/ui/pagelayout.cpp
59,38 → 59,8
}
}
 
PageLayouts::PageLayouts(QWidget* parent) : QGroupBox( parent )
PageLayouts::PageLayouts( QWidget* parent, QList<PageSet> pSets, bool mode ) : QGroupBox( parent )
{
struct PageSet pageS;
pageS.Name = CommonStrings::trPageSet2;
pageS.FirstPage = 0;
pageS.Rows = 1;
pageS.Columns = 1;
pageS.pageNames.clear();
pageS.pageNames.append(CommonStrings::trPageLocMiddleRight);
pageSets.append(pageS);
 
modus = false;
layoutGroupLayout = new QVBoxLayout(this);
layoutGroupLayout->setSpacing( 5 );
layoutGroupLayout->setMargin( 10 );
 
layoutsCombo = new ScComboBox( this );
layoutGroupLayout->addWidget( layoutsCombo );
 
layoutLabel1 = new QLabel( this );
layoutGroupLayout->addWidget( layoutLabel1 );
firstPage = new ScComboBox( this );
layoutGroupLayout->addWidget( firstPage );
 
languageChange();
 
connect(layoutsCombo, SIGNAL(activated(int)), this, SLOT(itemSelected(int)));
connect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
}
 
PageLayouts::PageLayouts(QWidget* parent, QList<PageSet> pSets, bool mode) : QGroupBox( parent )
{
pageSets = pSets;
modus = mode;
layoutGroupLayout = new QVBoxLayout(this);
/trunk/Scribus/scribus/ui/pagelayout.h
39,10 → 39,8
Q_OBJECT
 
public:
PageLayouts(QWidget* parent);
PageLayouts(QWidget* parent, QList<PageSet> pSets, bool mode = true);
PageLayouts( QWidget* parent, QList<PageSet> pSets, bool mode = true );
~PageLayouts() {};
 
void updateLayoutSelector(QList<PageSet> pSets);
void selectFirstP(int nr);
void selectItem(uint nr);
/trunk/Scribus/scribus/prefsmanager.cpp
1288,6 → 1288,8
 
 
QDomElement dcUI=docu.createElement("UI");
dcUI.setAttribute("PagePaletteShowThumbs", static_cast<int>(appPrefs.uiPrefs.SepalT));
dcUI.setAttribute("PagePaletteShowNames", static_cast<int>(appPrefs.uiPrefs.SepalN));
dcUI.setAttribute("ShowStartupDialog", static_cast<int>(appPrefs.uiPrefs.showStartupDialog));
dcUI.setAttribute("ShowSplashOnStartup", static_cast<int>(appPrefs.uiPrefs.showSplashOnStartup));
dcUI.setAttribute("UseSmallWidgets", static_cast<int>(appPrefs.uiPrefs.useSmallWidgets));
1902,6 → 1904,8
appPrefs.uiPrefs.useSmallWidgets = dc.attribute("UseSmallWidgets").toInt();
appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UseDocumentTabs", "0").toInt());
appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt());
appPrefs.uiPrefs.SepalT = static_cast<bool>(dc.attribute("PagePaletteShowThumbs").toInt());
appPrefs.uiPrefs.SepalN = static_cast<bool>(dc.attribute("PagePaletteShowNames").toInt());
appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",0).toInt());
}
 
/trunk/Scribus/scribus/scribus.cpp
163,6 → 163,7
#include "ui/loremipsum.h"
#include "ui/marginwidget.h"
#include "ui/margindialog.h"
#include "ui/masterpagepalette.h"
#include "ui/mergedoc.h"
#include "ui/movepage.h"
#include "ui/multipleduplicate.h"
526,6 → 527,7
scrapbookPalette->installEventFilter(this);
pagePalette = new PagePalette(this);
connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) );
connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) );
connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool)));
pagePalette->installEventFilter(this);
bookmarkPalette = new BookPalette(this);
5827,6 → 5829,7
bookmarkPalette->show();
if (palettesStatus[9])
docCheckerPalette->show();
setPagePalette(palettesStatus[5]);
setUndoPalette(palettesStatus[8]);
}
else
5846,6 → 5849,7
pagePalette->hide();
layerPalette->hide();
docCheckerPalette->hide();
setPagePalette(false);
setUndoPalette(false);
palettesStatus[0] = true;
}
5862,8 → 5866,18
scrActions["toolsActionHistory"]->setChecked(visible);
}
 
void ScribusMainWindow::setPagePalette(bool visible)
{
if (!visible)
{
prefsManager->appPrefs.uiPrefs.SepalT = pagePalette->getThumb();
prefsManager->appPrefs.uiPrefs.SepalN = pagePalette->getNamen();
}
}
 
void ScribusMainWindow::togglePagePalette()
{
setPagePalette(!pagePalette->isVisible());
palettesStatus[0] = false;
}
 
8591,46 → 8605,52
if (HaveDoc)
{
view->Deselect(true);
 
if (doc->masterPageMode())
{
pagePalette->startMasterPageMode(temp);
return;
ActWin->masterPagesPalette()->updateMasterPageList(temp);
ActWin->masterPagesPalette()->selectMasterPage(temp);
}
 
storedPageNum = doc->currentPageNumber();
storedViewXCoor = view->contentsX();
storedViewYCoor = view->contentsY();
storedViewScale = view->scale();
 
pagePalette->startMasterPageMode(temp);
 
scrActions["pageInsert"]->setEnabled(false);
scrActions["pageImport"]->setEnabled(false);
scrActions["pageDelete"]->setEnabled(false);
scrActions["pageCopy"]->setEnabled(false);
scrActions["pageMove"]->setEnabled(false);
scrActions["pageApplyMasterPage"]->setEnabled(false);
scrActions["pageCopyToMasterPage"]->setEnabled(false);
scrActions["editMasterPages"]->setEnabled(false);
scrActions["fileNew"]->setEnabled(false);
scrActions["fileNewFromTemplate"]->setEnabled(false);
scrActions["fileOpen"]->setEnabled(false);
scrActions["fileClose"]->setEnabled(false);
scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
scrActions["fileRevert"]->setEnabled(false);
scrActions["fileDocSetup150"]->setEnabled(false);
scrActions["filePrint"]->setEnabled(false);
scrActions["PrintPreview"]->setEnabled(false);
scrActions["toolsPDFPushButton"]->setEnabled(false);
scrActions["toolsPDFTextField"]->setEnabled(false);
scrActions["toolsPDFCheckBox"]->setEnabled(false);
scrActions["toolsPDFComboBox"]->setEnabled(false);
scrActions["toolsPDFListBox"]->setEnabled(false);
scrActions["toolsPDFAnnotText"]->setEnabled(false);
else
{
storedPageNum = doc->currentPageNumber();
storedViewXCoor = view->contentsX();
storedViewYCoor = view->contentsY();
storedViewScale = view->scale();
MasterPagesPalette *dia = new MasterPagesPalette(this, doc, view, temp);
//connect(dia, SIGNAL(createNew(int)), this, SLOT(slotNewMasterPage(int)));
connect(dia, SIGNAL(removePage(int )), this, SLOT(deletePage2(int )));
//connect(dia, SIGNAL(loadPage(QString, int, bool)), this, SLOT(loadPage(QString, int, bool)));
connect(dia, SIGNAL(finished()), this, SLOT(manageMasterPagesEnd()));
scrActions["pageInsert"]->setEnabled(false);
scrActions["pageImport"]->setEnabled(false);
scrActions["pageDelete"]->setEnabled(false);
scrActions["pageCopy"]->setEnabled(false);
scrActions["pageMove"]->setEnabled(false);
scrActions["pageApplyMasterPage"]->setEnabled(false);
scrActions["pageCopyToMasterPage"]->setEnabled(false);
scrActions["editMasterPages"]->setEnabled(false);
scrActions["fileNew"]->setEnabled(false);
scrActions["fileNewFromTemplate"]->setEnabled(false);
scrActions["fileOpen"]->setEnabled(false);
scrActions["fileClose"]->setEnabled(false);
scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
scrActions["fileRevert"]->setEnabled(false);
scrActions["fileDocSetup150"]->setEnabled(false);
scrActions["filePrint"]->setEnabled(false);
scrActions["PrintPreview"]->setEnabled(false);
scrActions["toolsPDFPushButton"]->setEnabled(false);
scrActions["toolsPDFTextField"]->setEnabled(false);
scrActions["toolsPDFCheckBox"]->setEnabled(false);
scrActions["toolsPDFComboBox"]->setEnabled(false);
scrActions["toolsPDFListBox"]->setEnabled(false);
scrActions["toolsPDFAnnotText"]->setEnabled(false);
#ifdef HAVE_OSG
scrActions["toolsPDFAnnot3D"]->setEnabled(false);
scrActions["toolsPDFAnnot3D"]->setEnabled(false);
#endif
pagePalette->enablePalette(false);
dia->show();
ActWin->setMasterPagesPalette(dia);
}
}
}
 
8672,13 → 8692,18
uint pageCount=doc->DocPages.count();
for (uint c=0; c<pageCount; ++c)
Apply_MasterPage(doc->DocPages.at(c)->MPageNam, c, false);
 
pagePalette->endMasterPageMode();
 
// doc->setMasterPageMode(false);
pagePalette->enablePalette(true);
pagePalette->rebuildMasters();
ActWin->setMasterPagesPalette(NULL);
doc->setCurrentPage(doc->DocPages.at(storedPageNum));
view->reformPages(false);
view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale));
view->DrawNew();
pagePalette->Rebuild();
// if (outlinePalette->isVisible())
// outlinePalette->BuildTree();
// slotDocCh();
}
 
void ScribusMainWindow::ApplyMasterPage()
8858,7 → 8883,7
pagePalette->rebuildMasters();
}
if (doc->masterPageMode() && !pageName.isEmpty())
pagePalette->updateMasterPageList();
ActWin->masterPagesPalette()->updateMasterPageList();
pagePalette->rebuildPages();
}
 
9648,7 → 9673,7
return;
if(doc->masterPageMode())
{
manageMasterPagesEnd();
ActWin->masterPagesPalette()->close();
qApp->processEvents();
}
}
/trunk/Scribus/scribus/scribus.h
405,6 → 405,7
void ToggleRulers();
void ToggleRulerMode();
void togglePagePalette();
void setPagePalette(bool visible);
void toggleUndoPalette();
void setUndoPalette(bool visible);
void toggleCheckPal();
/trunk/Scribus/scribus/CMakeLists.txt
91,8 → 91,6
ui/nftdialog.ui
ui/nftwidget.ui
ui/pageitemattributes.ui
ui/pagepalette_pagesbase.ui
ui/pagepalette_masterpagesbase.ui
ui/paintmanagerbase.ui
ui/picsearch.ui
ui/picsearchoptions.ui
317,6 → 315,7
ui/marginpresetlayout.h
ui/marginwidget.h
ui/newmarginwidget.h
ui/masterpagepalette.h
ui/measurements.h
ui/mergedoc.h
ui/missing.h
333,9 → 332,6
ui/pageitemattributes.h
ui/pagelayout.h
ui/pagepalette.h
ui/pagepalette_pages.h
ui/pagepalette_masterpages.h
ui/pagepalette_widgets.h
ui/pageselector.h
ui/paintmanager.h
ui/patternpropsdialog.h
745,6 → 741,7
ui/marginpresetlayout.cpp
ui/marginwidget.cpp
ui/newmarginwidget.cpp
ui/masterpagepalette.cpp
ui/mergedoc.cpp
ui/missing.cpp
ui/movepage.cpp
761,9 → 758,6
ui/pageitemattributes.cpp
ui/pagelayout.cpp
ui/pagepalette.cpp
ui/pagepalette_pages.cpp
ui/pagepalette_masterpages.cpp
ui/pagepalette_widgets.cpp
ui/pageselector.cpp
ui/paintmanager.cpp
ui/patternpropsdialog.cpp
/trunk/Scribus/scribus/prefsstructs.h
113,6 → 113,8
bool grayscaleIcons; //! Show icons in toolbars as grayscale
WindowPrefs mainWinSettings;
QByteArray mainWinState;
bool SepalT; //! Page Palette - show page thumbnails
bool SepalN; //! Page Palette - show names on pages
};
 
//Paths
/trunk/Scribus/scribus/scribuswin.cpp
25,7 → 25,7
#include "scribus.h"
#include "commonstrings.h"
#include "fileloader.h"
#include "ui/pagepalette.h"
#include "ui/masterpagepalette.h"
#include "ui/pageselector.h"
#include "ui/scrspinbox.h"
#include "ui/storyeditor.h"
44,6 → 44,7
setWindowIcon(loadIcon("AppIcon2.png"));
setAttribute(Qt::WA_DeleteOnClose);
m_Doc = doc;
m_masterPagesPalette = NULL;
currentDir = QDir::currentPath();
}
 
158,17 → 159,12
 
void ScribusWin::setMasterPagesPaletteShown(bool isShown) const
{
QString pageName;
PagePalette* pagePalette = m_MainWindow->pagePalette;
if (isShown && m_Doc->masterPageMode())
{
pageName = m_Doc->currentPage()->pageName();
pagePalette->startMasterPageMode(pageName);
}
else if (pagePalette->masterPageMode())
{
pagePalette->endMasterPageMode();
}
if (m_masterPagesPalette==NULL)
return;
if (isShown)
m_masterPagesPalette->show();
else
m_masterPagesPalette->hide();
}
 
void ScribusWin::windowActivationChange ( bool oldActive )
179,3 → 175,13
currentDir = QDir::currentPath();
QMainWindow::windowActivationChange( oldActive );
}
 
void ScribusWin::setMasterPagesPalette(MasterPagesPalette* newMPP)
{
m_masterPagesPalette=newMPP;
}
 
MasterPagesPalette* ScribusWin::masterPagesPalette() const
{
return m_masterPagesPalette;
}
/trunk/Scribus/scribus/scribuswin.h
56,6 → 56,8
ScribusDoc* doc() const { return m_Doc;}
QMdiSubWindow* getSubWin() { return subWindow; }
void setSubWin(QMdiSubWindow *win) { subWindow = win; }
void setMasterPagesPalette(MasterPagesPalette* newMPP);
MasterPagesPalette* masterPagesPalette() const;
void setMenuStatus(int index, bool value) { if (index>=0 && index <=6) MenuStat[index]=value;}
bool menuStatus(int index) const { if (index>=0 && index <=6) return MenuStat[index]; else return false; }
void setMasterPagesPaletteShown(bool isShown) const;
73,6 → 75,7
ScribusMainWindow* m_MainWindow;
ScribusView* m_View;
ScribusDoc* m_Doc;
MasterPagesPalette* m_masterPagesPalette;
QFrame *statusFrame;
QMdiSubWindow* subWindow;
bool MenuStat[7];
/trunk/Scribus/win32/vc9/scribus-main/Scribus.vcproj
1183,18 → 1183,6
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_masterpages.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_pages.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_widgets.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pageselector.cpp"
>
</File>
5096,60 → 5084,6
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_masterpages.h"
>
<FileConfiguration
Name="Debug-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_pages.h"
>
<FileConfiguration
Name="Debug-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_widgets.h"
>
<FileConfiguration
Name="Debug-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-cairo|Win32"
>
<Tool
Name="moc.exe"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\scribus\ui\pageselector.h"
>
<FileConfiguration
8543,10 → 8477,6
>
</File>
<File
RelativePath="..\..\..\scribus\ui\ui_pagepalette_masterpagesbase.h"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\ui_paintmanagerbase.h"
>
</File>
9392,18 → 9322,6
>
</File>
<File
RelativePath="..\..\..\scribus\ui\moc_pagepalette_masterpages.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\moc_pagepalette_pages.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\moc_pagepalette_widgets.cpp"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\moc_pageselector.cpp"
>
</File>
10137,14 → 10055,6
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_masterpagesbase.ui"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\pagepalette_pagesbase.ui"
>
</File>
<File
RelativePath="..\..\..\scribus\ui\paintmanagerbase.ui"
>
</File>