Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10941 → Rev 10940

/trunk/Scribus/scribus/canvasmode_legacy.cpp
4523,7 → 4523,7
 
void LegacyMode::createContextMenu(PageItem* currItem)
{
#if 0
#if 1
QMenu *pmen = new QMenu();
QMenu *menuConvertTo = new QMenu();
QMenu *menuLayer = new QMenu();
/trunk/Scribus/scribus/pageitem_pathtext.cpp
444,8 → 444,3
actionList << "toolsEditWithStoryEditor";
actionList << "itemConvertToOutlines";
}
 
QString PageItem_PathText::infoDescription()
{
return QString();
}
/trunk/Scribus/scribus/pageitem_textframe.cpp
3445,8 → 3445,3
if (itemText.lines() != 0)
actionList << "editClearContents";
}
 
QString PageItem_TextFrame::infoDescription()
{
return QString();
}
/trunk/Scribus/scribus/pageitem_latexframe.cpp
698,8 → 698,3
actionList << "itemUpdateImage";
actionList << "editEditWithLatexEditor";
}
 
QString PageItem_LatexFrame::infoDescription()
{
return QString();
}
/trunk/Scribus/scribus/pageitem_imageframe.cpp
394,31 → 394,3
actionList << "editPasteContentsAbs";
}
}
 
QString PageItem_ImageFrame::infoDescription()
{
QString htmlText;
htmlText.append(tr("Picture") + "<br/>");
if (PicAvail)
{
QFileInfo fi = QFileInfo(Pfile);
htmlText.append(ScribusView::tr("File: ") + fi.fileName() + "<br/>");
htmlText.append(ScribusView::tr("Original PPI: ") + QString::number(qRound(pixm.imgInfo.xres))+" x "+QString::number(qRound(pixm.imgInfo.yres)) + "<br/>");
htmlText.append(ScribusView::tr("Actual PPI: ") + QString::number(qRound(72.0 / imageXScale()))+" x "+ QString::number(qRound(72.0 / imageYScale())) + "<br/>");
htmlText.append(ScribusView::tr("Colorspace: "));
QString cSpace;
QString ext = fi.suffix().toLower();
if ((extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext)) && (pixm.imgInfo.type != 7))
htmlText.append(ScribusView::tr("Unknown"));
else
htmlText.append(colorSpaceText(pixm.imgInfo.colorspace));
htmlText.append("<br/>");
}
else
{
htmlText.append(ScribusView::tr("No Image Loaded") + "<br/>");
}
htmlText.append(PageItem::infoDescription());
return htmlText;
}
/trunk/Scribus/scribus/pageitem_polygon.cpp
81,8 → 81,3
actionList << "itemConvertToImageFrame";
actionList << "itemConvertToTextFrame";
}
 
QString PageItem_Polygon::infoDescription()
{
return QString();
}
/trunk/Scribus/scribus/contextmenu.cpp
16,7 → 16,6
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QTextEdit>
#include <QWidget>
#include <QWidgetAction>
 
76,55 → 75,38
QMenu *menuResolution = new QMenu(this);
//<-- Add Info
//Test new method with image frames first
if (selectedItemCount==1 && currItem->asImageFrame())
QFrame *infoGroup = new QFrame( m_doc->view() );
infoGroup->setFrameShape( QFrame::NoFrame );
QGridLayout *infoGroupLayout = new QGridLayout( infoGroup );
infoGroupLayout->setAlignment( Qt::AlignTop );
infoGroupLayout->setSpacing( 2 );
infoGroupLayout->setMargin( 0 );
if (currItem->createInfoGroup(infoGroup, infoGroupLayout))
{
int row = infoGroupLayout->rowCount(); // <a.l.e>
 
QLabel *printCT = new QLabel(infoGroup);
QLabel *printT = new QLabel(infoGroup);
printCT->setText( ScribusView::tr("Print: "));
infoGroupLayout->addWidget( printCT, row, 0, Qt::AlignRight );
if (currItem->printEnabled())
printT->setText( ScribusView::tr("Enabled"));
else
printT->setText( ScribusView::tr("Disabled"));
infoGroupLayout->addWidget( printT, row, 1 ); // </a.l.e>
QWidgetAction* MenAct = new QWidgetAction(m_doc->view());
MenAct->setDefaultWidget(infoGroup);
menuInfo->addAction(MenAct);
 
// Qt4 menuInfo->insertItem(infoGroup);
currItem->createContextMenu(menuInfo, 5);
QAction *act = addMenu(menuInfo);
act->setText( ScribusView::tr("In&fo"));
if (currItem->asImageFrame())
{
QTextEdit* menuTextEdit= new QTextEdit("<html>" + currItem->infoDescription() + "</html>", this);
menuTextEdit->setReadOnly(true);
QWidgetAction* menuTextWidget = new QWidgetAction(this);
menuTextWidget->setDefaultWidget(menuTextEdit);
menuInfo->addAction(menuTextWidget);
}
} else {
delete infoGroupLayout;
delete infoGroup;
}
else
{
QFrame *infoGroup = new QFrame( m_doc->view() );
infoGroup->setFrameShape( QFrame::NoFrame );
QGridLayout *infoGroupLayout = new QGridLayout( infoGroup );
infoGroupLayout->setAlignment( Qt::AlignTop );
infoGroupLayout->setSpacing( 2 );
infoGroupLayout->setMargin( 0 );
if (currItem->createInfoGroup(infoGroup, infoGroupLayout))
{
int row = infoGroupLayout->rowCount(); // <a.l.e>
QLabel *printCT = new QLabel(infoGroup);
QLabel *printT = new QLabel(infoGroup);
printCT->setText( ScribusView::tr("Print: "));
infoGroupLayout->addWidget( printCT, row, 0, Qt::AlignRight );
if (currItem->printEnabled())
printT->setText( ScribusView::tr("Enabled"));
else
printT->setText( ScribusView::tr("Disabled"));
infoGroupLayout->addWidget( printT, row, 1 ); // </a.l.e>
QWidgetAction* MenAct = new QWidgetAction(this);
MenAct->setDefaultWidget(infoGroup);
menuInfo->addAction(MenAct);
// Qt4 menuInfo->insertItem(infoGroup);
currItem->createContextMenu(menuInfo, 5);
QAction *act = addMenu(menuInfo);
act->setText( ScribusView::tr("In&fo"));
} else {
delete infoGroupLayout;
delete infoGroup;
}
}
//-->
//<-- Add undo
322,3 → 304,157
//-->
}
 
#if 0
QMenu *pmen = new QMenu();
QMenu *menuConvertTo = new QMenu();
QMenu *menuLayer = new QMenu();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QMenu *menuInfo = new QMenu();
QMenu *menuEditContents = new QMenu();
QMenu *menuLevel = new QMenu();
m_view->setObjectUndoMode();
QFrame *infoGroup = new QFrame( m_view );
infoGroup->setFrameShape( QFrame::NoFrame );
QGridLayout *infoGroupLayout = new QGridLayout( infoGroup );
infoGroupLayout->setAlignment( Qt::AlignTop );
infoGroupLayout->setSpacing( 2 );
infoGroupLayout->setMargin( 0 );
if (currItem->createInfoGroup(infoGroup, infoGroupLayout)) {
int row = infoGroupLayout->rowCount(); // <a.l.e>
 
QLabel *printCT = new QLabel(infoGroup);
QLabel *printT = new QLabel(infoGroup);
printCT->setText( ScribusView::tr("Print: "));
infoGroupLayout->addWidget( printCT, row, 0, Qt::AlignRight );
if (currItem->printEnabled())
printT->setText( ScribusView::tr("Enabled"));
else
printT->setText( ScribusView::tr("Disabled"));
infoGroupLayout->addWidget( printT, row, 1 ); // </a.l.e>
QWidgetAction* MenAct = new QWidgetAction(m_view);
MenAct->setDefaultWidget(infoGroup);
menuInfo->addAction(MenAct);
 
// Qt4 menuInfo->insertItem(infoGroup);
currItem->createContextMenu(menuInfo, 5);
QAction *act = pmen->addMenu(menuInfo);
act->setText( ScribusView::tr("In&fo"));
} else {
delete infoGroupLayout;
delete infoGroup;
}
pmen->addSeparator();
pmen->addAction(m_AP->scrActions["editUndoAction"]);
pmen->addAction(m_AP->scrActions["editRedoAction"]);
currItem->createContextMenu(pmen, 10);
if (m_doc->m_Selection->count() == 1)
{
pmen->addSeparator();
pmen->addAction(m_AP->scrActions["itemAttributes"]);
}
currItem->createContextMenu(pmen, 20);
pmen->addSeparator();
pmen->addAction(m_AP->scrActions["itemLock"]);
pmen->addAction(m_AP->scrActions["itemLockSize"]);
if (!currItem->isSingleSel)
{
pmen->addAction(m_AP->scrActions["itemSendToScrapbook"]);
pmen->addAction(m_AP->scrActions["itemSendToPattern"]);
if (m_doc->layerCount() > 1)
{
QMap<int,int> layerMap;
for (ScLayers::iterator it = m_doc->Layers.begin(); it != m_doc->Layers.end(); ++it)
layerMap.insert((*it).Level, (*it).LNr);
int i=layerMap.count()-1;
while (i>=0)
{
if (m_doc->layerLocked(layerMap[i]))
m_AP->scrLayersActions[QString::number(layerMap[i])]->setEnabled(false);
else
m_AP->scrLayersActions[QString::number(layerMap[i])]->setEnabled(true);
menuLayer->addAction(m_AP->scrLayersActions[QString::number(layerMap[i--])]);
}
QAction *act = pmen->addMenu(menuLayer);
act->setText( ScribusView::tr("Send to La&yer"));
}
}
if (m_doc->m_Selection->count() > 1)
{
bool isGroup = true;
int firstElem = -1;
if (currItem->Groups.count() != 0)
firstElem = currItem->Groups.top();
for (int bx = 0; bx < m_doc->m_Selection->count(); ++bx)
{
if (m_doc->m_Selection->itemAt(bx)->Groups.count() != 0)
{
if (m_doc->m_Selection->itemAt(bx)->Groups.top() != firstElem)
isGroup = false;
}
else
isGroup = false;
}
if (!isGroup)
pmen->addAction(m_AP->scrActions["itemGroup"]);
}
if (currItem->Groups.count() != 0)
pmen->addAction(m_AP->scrActions["itemUngroup"]);
if (!currItem->locked())
{
if ((!currItem->isTableItem) && (!currItem->isSingleSel))
{
QAction *act = pmen->addMenu(menuLevel);
act->setText( ScribusView::tr("Le&vel"));
menuLevel->addAction(m_AP->scrActions["itemRaiseToTop"]);
menuLevel->addAction(m_AP->scrActions["itemRaise"]);
menuLevel->addAction(m_AP->scrActions["itemLower"]);
menuLevel->addAction(m_AP->scrActions["itemLowerToBottom"]);
}
}
if (m_doc->appMode != modeEdit && (m_doc->m_Selection->itemsAreSameType() || currItem->isSingleSel)) //Create convertTo Menu
{
bool insertConvertToMenu = currItem->createContextMenu(menuConvertTo, 30);
bool insertedMenusEnabled = false;
QList<QAction*> actList = menuConvertTo->actions();
for (int pc = 0; pc < actList.count(); pc++)
{
if (actList[pc]->isEnabled())
insertedMenusEnabled = true;
}
if ((insertConvertToMenu) && (insertedMenusEnabled))
{
QAction *act = pmen->addMenu(menuConvertTo);
act->setText( ScribusView::tr("Conve&rt to"));
}
}
pmen->addSeparator();
if (!currItem->locked() && !(currItem->isSingleSel))
pmen->addAction(m_AP->scrActions["editCut"]);
if (!(currItem->isSingleSel))
pmen->addAction(m_AP->scrActions["editCopy"]);
if ((m_doc->appMode == modeEdit) && (m_AP->Buffer2.startsWith("<SCRIBUSTEXT")) && (currItem->itemType() == PageItem::TextFrame))
pmen->addAction(m_AP->scrActions["editPaste"]);
if (!currItem->locked() && (m_doc->appMode != modeEdit) && (!(currItem->isSingleSel)))
pmen->addAction( ScribusView::tr("&Delete"), m_doc, SLOT(itemSelection_DeleteItem()));
if (currItem->createContextMenu(menuEditContents, 40))
{
QAction *act = pmen->addMenu(menuEditContents);
act->setText( ScribusView::tr("Contents"));
}
pmen->addSeparator();
pmen->addAction(m_AP->scrActions["toolsProperties"]);
 
pmen->exec(QCursor::pos());
m_view->setGlobalUndoMode();
delete pmen;
delete menuConvertTo;
delete menuLayer;
delete menuInfo;
delete menuEditContents;
delete menuLevel;
currItem->createContextMenu(0, 0); //Free memory
#endif
/trunk/Scribus/scribus/pageitem_polyline.h
42,7 → 42,6
virtual PageItem_PolyLine * asPolyLine() { return this; }
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
 
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
/trunk/Scribus/scribus/pageitem_polyline.cpp
176,8 → 176,3
{
}
 
QString PageItem_PolyLine::infoDescription()
{
return QString();
}
 
/trunk/Scribus/scribus/pageitem_imageframe.h
47,7 → 47,6
virtual bool createInfoGroup(QFrame *, QGridLayout *);
virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
/trunk/Scribus/scribus/pageitem_line.cpp
118,8 → 118,3
void PageItem_Line::applicableActions(QStringList & actionList)
{
}
 
QString PageItem_Line::infoDescription()
{
return QString();
}
/trunk/Scribus/scribus/pageitem_line.h
42,7 → 42,6
virtual PageItem_Line * asLine() { return this; }
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
/trunk/Scribus/scribus/pageitem_pathtext.h
44,7 → 44,6
virtual bool createInfoGroup(QFrame *, QGridLayout *);
virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
 
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
/trunk/Scribus/scribus/pageitem.h
247,7 → 247,6
QImage DrawObj_toImage(QList<PageItem*> &emG);
virtual void applicableActions(QStringList& actionList) = 0;
virtual QString infoDescription();
protected:
void DrawObj_ImageFrame(ScPainter *p, double sc);
/trunk/Scribus/scribus/pageitem_latexframe.h
82,7 → 82,6
virtual bool createInfoGroup(QFrame *, QGridLayout *);
virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
protected:
/* DrawObj_Item is defined in ImageFrame and should be usable for
/trunk/Scribus/scribus/pageitem_textframe.h
95,7 → 95,6
virtual bool createInfoGroup(QFrame *, QGridLayout *);
virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
private:
bool cursorBiasBackward;
/trunk/Scribus/scribus/pageitem_polygon.h
43,7 → 43,6
virtual PageItem_Polygon * asPolygon() { return this; }
virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
/trunk/Scribus/scribus/pageitem.cpp
4551,15 → 4551,3
}
updateGradientVectors();
}
 
QString PageItem::infoDescription()
{
QString htmlText;
htmlText.append(ScribusView::tr("Print: "));
if (printEnabled())
htmlText.append(ScribusView::tr("Enabled"));
else
htmlText.append(ScribusView::tr("Disabled"));
htmlText.append("<br/>");
return htmlText;
}