r16029 by fschmid - Enabled editing of Symbols and Patterns.
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 28 23:58:05 CET 2010
Author: fschmid
Date: Sun Nov 28 22:58:04 2010
New Revision: 16029
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16029
Log:
Enabled editing of Symbols and Patterns.
Edit a Symbol by:
- double-click it in the Symbol Palette
or
- double-click on a placed instance of the Symbol.
Leave symbol edit mode by clicking on the "Close" Button on the toolbar.
Modified:
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode.h
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/scribusview.h
trunk/Scribus/scribus/scribuswin.cpp
trunk/Scribus/scribus/ui/about.cpp
trunk/Scribus/scribus/ui/paintmanager.cpp
trunk/Scribus/scribus/ui/symbolpalette.cpp
trunk/Scribus/scribus/ui/symbolpalette.h
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sun Nov 28 22:58:04 2010
@@ -791,7 +791,7 @@
return;
break;
case Qt::Key_PageUp:
- if (m_doc->masterPageMode())
+ if (m_doc->masterPageMode() || m_doc->symbolEditMode())
m_view->scrollBy(0, -prefsManager->mouseWheelJump());
else
{
@@ -807,7 +807,7 @@
return;
break;
case Qt::Key_PageDown:
- if (m_doc->masterPageMode())
+ if (m_doc->masterPageMode() || m_doc->symbolEditMode())
m_view->scrollBy(0, prefsManager->mouseWheelJump());
else
{
Modified: trunk/Scribus/scribus/canvasmode.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/canvasmode.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode.h (original)
+++ trunk/Scribus/scribus/canvasmode.h Sun Nov 28 22:58:04 2010
@@ -54,6 +54,7 @@
submodeStatusPic, // open ManageImages dialog
submodeEditExternal, // open external image editor
submodeAnnotProps, // open properties dialog
+ submodeEditSymbol, // open Symbol editor
submodeLastSubmode
};
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sun Nov 28 22:58:04 2010
@@ -233,6 +233,10 @@
//double click select until now.
// mousePressEvent(m);
}
+ }
+ else if (currItem->asSymbolFrame())
+ {
+ m_view->requestMode(submodeEditSymbol);
}
}
}
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Nov 28 22:58:04 2010
@@ -559,8 +559,10 @@
symbolPalette = new SymbolPalette(this);
symbolPalette->setMainWindow(this);
- connect( scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool)));
- connect( symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool)));
+ connect(scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool)));
+ connect(symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool)));
+ connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString)));
+ connect(symbolPalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd()));
symbolPalette->installEventFilter(this);
symbolPalette->hide();
@@ -1419,7 +1421,7 @@
return;
break;
case Qt::Key_PageUp:
- if (doc->masterPageMode())
+ if (doc->masterPageMode() || doc->symbolEditMode())
view->scrollBy(0, -prefsManager->mouseWheelJump());
else
{
@@ -1435,7 +1437,7 @@
return;
break;
case Qt::Key_PageDown:
- if (doc->masterPageMode())
+ if (doc->masterPageMode() || doc->symbolEditMode())
view->scrollBy(0, prefsManager->mouseWheelJump());
else
{
@@ -2305,7 +2307,7 @@
view->requestMode(submodeEndNodeEdit);
} */
scrActions["fileClose"]->setEnabled(true);
- if (doc->masterPageMode())
+ if (doc->masterPageMode() || doc->symbolEditMode())
{
scrActions["pageInsert"]->setEnabled(false);
scrActions["pageDelete"]->setEnabled(false);
@@ -2316,9 +2318,18 @@
scrActions["editMasterPages"]->setEnabled(false);
scrActions["fileNew"]->setEnabled(false);
scrActions["fileNewFromTemplate"]->setEnabled(false);
- scrActions["fileSave"]->setEnabled(true);
+ if (doc->symbolEditMode())
+ {
+ scrActions["fileCollect"]->setEnabled(false);
+ scrActions["fileSaveAs"]->setEnabled(false);
+ scrMenuMgr->setMenuEnabled("FileExport", false);
+ scrActions["fileExportAsEPS"]->setEnabled(false);
+ scrActions["fileExportAsPDF"]->setEnabled(false);
+ scrActions["fileSave"]->setEnabled(false);
+ }
+ else
+ scrActions["fileSave"]->setEnabled(true);
scrActions["fileOpen"]->setEnabled(false);
- scrActions["fileClose"]->setEnabled(false);
scrActions["fileRevert"]->setEnabled(false);
scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
pagePalette->enablePalette(false);
@@ -3172,8 +3183,9 @@
updateActiveWindowCaption(doc->DocName + "*");
// scrActions["fileSave"]->setEnabled(true);
// scrActions["fileSaveAs"]->setEnabled(true);
- scrActions["fileCollect"]->setEnabled(true);
- if (!doc->masterPageMode())
+ if (!doc->symbolEditMode())
+ scrActions["fileCollect"]->setEnabled(true);
+ else if (!doc->masterPageMode())
{
scrActions["fileClose"]->setEnabled(true);
if (doc->hasName)
@@ -4458,6 +4470,11 @@
bool ScribusMainWindow::slotFileClose()
{
+ if (doc->symbolEditMode())
+ {
+ editSymbolEnd();
+ return true;
+ }
ScribusWin* tw = ActWin;
// ActWin->close();
mdiArea->closeActiveSubWindow();
@@ -8500,6 +8517,111 @@
delete dia;
}
+void ScribusMainWindow::editSelectedSymbolStart()
+{
+ if (doc->m_Selection->count() > 0)
+ editSymbolStart(doc->m_Selection->itemAt(0)->pattern());
+}
+
+void ScribusMainWindow::editSymbolStart(QString temp)
+{
+ if (HaveDoc)
+ {
+ view->Deselect(true);
+ storedPageNum = doc->currentPageNumber();
+ storedViewXCoor = view->contentsX();
+ storedViewYCoor = view->contentsY();
+ storedViewScale = view->scale();
+ view->showSymbolPage(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["fileSave"]->setEnabled(false);
+ scrActions["fileClose"]->setToolTip( tr("Click here to leave symbol edit mode."));
+ scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
+ scrActions["fileRevert"]->setEnabled(false);
+ scrActions["fileDocSetup150"]->setEnabled(false);
+ scrActions["filePrint"]->setEnabled(false);
+ scrActions["fileCollect"]->setEnabled(false);
+ scrActions["fileSaveAs"]->setEnabled(false);
+ scrMenuMgr->setMenuEnabled("FileExport", false);
+ scrActions["fileExportAsEPS"]->setEnabled(false);
+ scrActions["fileExportAsPDF"]->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);
+#endif
+ pagePalette->enablePalette(false);
+ symbolPalette->editingStart(temp);
+ updateActiveWindowCaption( tr("Editing Symbol: %1").arg(temp));
+ }
+}
+
+void ScribusMainWindow::editSymbolEnd()
+{
+ view->setScale(storedViewScale);
+ view->hideSymbolPage();
+ slotSelect();
+ scrActions["editMasterPages"]->setEnabled(true);
+ scrActions["fileNew"]->setEnabled(true);
+ scrActions["fileNewFromTemplate"]->setEnabled(true);
+ scrActions["fileOpen"]->setEnabled(true);
+ scrActions["fileClose"]->setEnabled(true);
+ scrActions["fileClose"]->setToolTip( tr("Close"));
+ scrActions["fileSave"]->setEnabled(true);
+ scrMenuMgr->setMenuEnabled("FileOpenRecent", true);
+ scrActions["fileRevert"]->setEnabled(true);
+ scrActions["fileDocSetup150"]->setEnabled(true);
+ scrActions["filePrint"]->setEnabled(true);
+ scrActions["fileCollect"]->setEnabled(true);
+ scrActions["fileSaveAs"]->setEnabled(true);
+ scrMenuMgr->setMenuEnabled("FileExport", true);
+ scrActions["fileExportAsEPS"]->setEnabled(true);
+ scrActions["fileExportAsPDF"]->setEnabled(true);
+ if ( ScCore->haveGS() || ScCore->isWinGUI() )
+ scrActions["PrintPreview"]->setEnabled(true);
+ scrActions["pageInsert"]->setEnabled(true);
+ scrActions["pageCopy"]->setEnabled(true);
+ scrActions["pageImport"]->setEnabled(true);
+ scrActions["pageApplyMasterPage"]->setEnabled(true);
+ scrActions["pageCopyToMasterPage"]->setEnabled(true);
+ bool setter = doc->Pages->count() > 1 ? true : false;
+ scrActions["pageDelete"]->setEnabled(setter);
+ scrActions["pageMove"]->setEnabled(setter);
+ scrActions["toolsPDFPushButton"]->setEnabled(true);
+ scrActions["toolsPDFTextField"]->setEnabled(true);
+ scrActions["toolsPDFCheckBox"]->setEnabled(true);
+ scrActions["toolsPDFComboBox"]->setEnabled(true);
+ scrActions["toolsPDFListBox"]->setEnabled(true);
+ scrActions["toolsPDFAnnotText"]->setEnabled(true);
+#ifdef HAVE_OSG
+ scrActions["toolsPDFAnnot3D"]->setEnabled(true);
+#endif
+ pagePalette->enablePalette(true);
+ pagePalette->rebuildMasters();
+ doc->setCurrentPage(doc->DocPages.at(storedPageNum));
+ view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale));
+ view->DrawNew();
+ pagePalette->Rebuild();
+ propertiesPalette->updateColorList();
+ symbolPalette->editingFinished();
+ updateActiveWindowCaption(doc->DocName);
+}
+
void ScribusMainWindow::manageMasterPages(QString temp)
{
if (HaveDoc)
@@ -8535,7 +8657,6 @@
scrActions["fileClose"]->setEnabled(false);
scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
scrActions["fileRevert"]->setEnabled(false);
-// scrActions["fileDocSetup"]->setEnabled(false);
scrActions["fileDocSetup150"]->setEnabled(false);
scrActions["filePrint"]->setEnabled(false);
scrActions["PrintPreview"]->setEnabled(false);
@@ -9307,7 +9428,6 @@
}
CurrStED = storyEditor;
connect(storyEditor, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
-// connect(storyEditor, SIGNAL(EditSt()), this, SLOT(slotEditStyles()));
storyEditor->show();
storyEditor->raise();
}
@@ -9978,54 +10098,12 @@
outlinePalette->BuildTree();
doc->TotalItems = oldNum;
view->Deselect(true);
-// doc->m_Selection->delaySignalsOn();
doc->m_Selection->copy(itemSelection, false);
doc->m_Selection->delaySignalsOff();
view->DrawNew();
undoManager->setUndoEnabled(wasUndo);
}
-/*
-void ScribusMainWindow::managePatterns()
-{
- if (HaveDoc)
- {
- undoManager->setUndoEnabled(false);
- QMap<QString, ScPattern> docPatterns(doc->docPatterns);
- PatternDialog *dia = new PatternDialog(this, &docPatterns, doc, this);
- if (dia->exec())
- {
- doc->setPatterns(dia->dialogPatterns);
- if (!dia->replaceMap.isEmpty())
- {
- ResourceCollection colorrsc;
- colorrsc.mapPatterns(dia->replaceMap);
- doc->replaceNamedResources(colorrsc);
- }
- propertiesPalette->updateColorList();
- symbolPalette->updateSymbolList();
- view->DrawNew();
- }
- delete dia;
- undoManager->setUndoEnabled(true);
- }
- else
- {
- QMap<QString, ScPattern> docPatterns(prefsManager->appPrefs.defaultPatterns);
- m_doc->PageColors = prefsManager->colorSet();
- m_doc->docGradients = prefsManager->appPrefs.defaultGradients;
- doc = m_doc;
- PatternDialog *dia = new PatternDialog(this, &docPatterns, m_doc, this);
- if (dia->exec())
- {
- prefsManager->appPrefs.defaultPatterns = dia->dialogPatterns;
- prefsManager->setColorSet(m_doc->PageColors);
- prefsManager->appPrefs.defaultGradients = m_doc->docGradients;
- }
- doc = NULL;
- delete dia;
- }
-}
-*/
+
void ScribusMainWindow::managePaints()
{
ColorList edc;
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sun Nov 28 22:58:04 2010
@@ -295,6 +295,9 @@
void showLayer();
//void LayerRemove(int l, bool dl = false);
void ManageJava();
+ void editSelectedSymbolStart();
+ void editSymbolStart(QString temp);
+ void editSymbolEnd();
void manageMasterPages(QString temp = "");
void manageMasterPagesEnd();
/** \brief generate a new document in the current view */
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Nov 28 22:58:04 2010
@@ -171,6 +171,7 @@
rotMode(0),
automaticTextFrames(0),
m_masterPageMode(false),
+ m_symbolEditMode(false),
m_ScMW(0),
m_View(0),
m_guardedObject(this),
@@ -256,6 +257,7 @@
rotMode(0),
automaticTextFrames(pagesSetup.autoTextFrames),
m_masterPageMode(false),
+ m_symbolEditMode(false),
m_ScMW(0),
m_View(0),
m_guardedObject(this),
@@ -5380,21 +5382,139 @@
void ScribusDoc::setMasterPageMode(bool changeToMasterPageMode)
{
- if (changeToMasterPageMode==m_masterPageMode)
+ if (changeToMasterPageMode == m_masterPageMode)
return;
if (changeToMasterPageMode)
{
- Pages=&MasterPages;
- Items=&MasterItems;
+ Pages = &MasterPages;
+ Items = &MasterItems;
}
else
{
- Pages=&DocPages;
- Items=&DocItems;
- }
- m_masterPageMode=changeToMasterPageMode;
-}
-
+ Pages = &DocPages;
+ Items = &DocItems;
+ }
+ m_masterPageMode = changeToMasterPageMode;
+}
+
+void ScribusDoc::setSymbolEditMode(bool mode, QString symbolName)
+{
+ if (mode == m_symbolEditMode)
+ return;
+ m_symbolEditMode = mode;
+ if (mode)
+ {
+ ScPattern pa = docPatterns[symbolName];
+ currentEditedSymbol = symbolName;
+ Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, pa.width, pa.height);
+ addedPage->setDocument(this);
+ addedPage->Margins.Top = 0;
+ addedPage->Margins.Bottom = 0;
+ addedPage->Margins.Left = 0;
+ addedPage->Margins.Right = 0;
+ addedPage->initialMargins.Top = 0;
+ addedPage->initialMargins.Bottom = 0;
+ addedPage->initialMargins.Left = 0;
+ addedPage->initialMargins.Right = 0;
+ addedPage->setPageNr(0);
+ addedPage->MPageNam = "";
+ addedPage->setPageName("");
+ TempPages.clear();
+ TempPages.append(addedPage);
+ Pages = &TempPages;
+ Items = &docPatterns[symbolName].items;
+ renumberItemsInListOrder();
+ m_Selection->delaySignalsOn();
+ for (int as = 0; as < Items->count(); ++as)
+ {
+ m_Selection->addItem(Items->at(as));
+ }
+ QRectF sR = m_Selection->getGroupRect();
+ moveGroup(-sR.x() + addedPage->xOffset(), -sR.y() + addedPage->yOffset());
+ m_Selection->clear();
+ m_Selection->delaySignalsOff();
+ changed();
+ }
+ else
+ {
+ PageItem* currItem = Items->at(0);
+ Page* addedPage = TempPages.at(0);
+ if (Items->count() > 1)
+ {
+ bool isGroup = true;
+ int firstElem = -1;
+ if (currItem->Groups.count() != 0)
+ firstElem = currItem->Groups.top();
+ for (int bx = 0; bx < Items->count(); ++bx)
+ {
+ PageItem* bxi = Items->at(bx);
+ if (bxi->Groups.count() != 0)
+ {
+ if (bxi->Groups.top() != firstElem)
+ {
+ isGroup = false;
+ break;
+ }
+ }
+ else
+ {
+ isGroup = false;
+ break;
+ }
+ }
+ if (!isGroup)
+ {
+ itemAdd(PageItem::Polygon, PageItem::Rectangle, addedPage->xOffset(), addedPage->yOffset(), 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ PageItem *groupItem = Items->takeLast();
+ Items->insert(0, groupItem);
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ for (int as = 0; as < Items->count(); ++as)
+ {
+ PageItem* currItem = Items->at(as);
+ currItem->Groups.push(GroupCounter);
+ double x1, x2, y1, y2;
+ currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+ minx = qMin(minx, x1);
+ miny = qMin(miny, y1);
+ maxx = qMax(maxx, x2);
+ maxy = qMax(maxy, y2);
+ }
+ groupItem->setXYPos(minx, miny, true);
+ groupItem->setWidthHeight(maxx - minx, maxy - miny, true);
+ groupItem->SetRectFrame();
+ groupItem->ClipEdited = true;
+ groupItem->FrameType = 3;
+ groupItem->setTextFlowMode(PageItem::TextFlowDisabled);
+ groupItem->AutoName = false;
+ groupItem->isGroupControl = true;
+ groupItem->setFillTransparency(0);
+ groupItem->setLineTransparency(0);
+ groupItem->groupsLastItem = Items->at(Items->count()-1);
+ groupItem->Groups.push(GroupCounter);
+ GroupCounter++;
+ renumberItemsInListOrder();
+ }
+ }
+ currItem = Items->at(0);
+ docPatterns[currentEditedSymbol].pattern = currItem->DrawObj_toImage();
+ docPatterns[currentEditedSymbol].width = currItem->gWidth;
+ docPatterns[currentEditedSymbol].height = currItem->gHeight;
+ if (masterPageMode())
+ {
+ Pages = &MasterPages;
+ Items = &MasterItems;
+ }
+ else
+ {
+ Pages = &DocPages;
+ Items = &DocItems;
+ }
+ delete addedPage;
+ }
+}
void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const DocumentSectionType type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth)
{
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sun Nov 28 22:58:04 2010
@@ -825,6 +825,13 @@
/*** Is the document in master page mode? */
bool masterPageMode() const { return m_masterPageMode; }
+ /**
+ * @brief Set the doc into symbol edit mode
+ */
+ void setSymbolEditMode(bool mode, QString symbolName = "");
+
+ /*** Is the document in symbol edit mode? */
+ bool symbolEditMode() const { return m_symbolEditMode; }
/**
* @brief Add a section to the document sections list
@@ -1037,11 +1044,13 @@
int rotMode;
bool automaticTextFrames; // Flag for automatic Textframes
bool m_masterPageMode;
+ bool m_symbolEditMode;
QMap<QString, double> m_constants;
ScribusMainWindow* m_ScMW;
ScribusView* m_View;
ScGuardedObject<ScribusDoc> m_guardedObject;
Serializer *m_serializer;
+ QString currentEditedSymbol;
public: // Public attributes
bool is12doc; //public for now, it will be removed later
@@ -1063,6 +1072,8 @@
QList<Page*> MasterPages;
/** \brief List of Document Pages */
QList<Page*> DocPages;
+ /** \brief List for temporary Pages */
+ QList<Page*> TempPages;
/** \brief Mapping Master Page Name to Master Page numbers */
QMap<QString,int> MasterNames;
/** \brief List of Objects */
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Nov 28 22:58:04 2010
@@ -594,6 +594,11 @@
appMode = Doc->appMode;
m_previousMode = appMode;
m_ScMW->ModifyAnnot();
+ break;
+ case submodeEditSymbol:
+ appMode = Doc->appMode;
+ m_previousMode = appMode;
+ m_ScMW->editSelectedSymbolStart();
break;
default:
if (appMode < 0 || appMode > submodeFirstSubmode)
@@ -2860,7 +2865,6 @@
Doc->setCurrentPage(Doc->Pages->at(nr));
pageSelector->setEnabled(false);
updateOn = false;
-// reformPages();
zoom();
oldX = qRound(Doc->currentPage()->xOffset()- 10);
oldY = qRound(Doc->currentPage()->yOffset()- 10);
@@ -2875,18 +2879,37 @@
if (Doc->masterPageMode())
this->requestMode(modeNormal);
Doc->setMasterPageMode(false);
-// Doc->currentPage = Doc->Pages->at(0);
pageSelector->setEnabled(true);
resizeContents(qRound((Doc->maxCanvasCoordinate.x() - Doc->minCanvasCoordinate.x()) * m_canvas->scale()), qRound((Doc->maxCanvasCoordinate.y() - Doc->minCanvasCoordinate.y()) * m_canvas->scale()));
-// setScale(OldScale);
-// updateOn = false;
-// GotoPage(0);
-// slotDoZoom();
-// oldX = qRound(Doc->currentPage->xOffset()- 10);
-// oldY = qRound(Doc->currentPage->yOffset()- 10);
-// SetCPo(oldX, oldY);
-// updateOn = true;
-// DrawNew();
+}
+
+void ScribusView::showSymbolPage(QString symbolName)
+{
+ Deselect(false);
+ OldScale = m_canvas->scale();
+ if (!Doc->symbolEditMode())
+ this->requestMode(modeNormal);
+ Doc->setSymbolEditMode(true, symbolName);
+ Doc->setCurrentPage(Doc->Pages->at(0));
+ pageSelector->setEnabled(false);
+ updateOn = false;
+ zoom();
+ oldX = qRound(Doc->currentPage()->xOffset()- 10);
+ oldY = qRound(Doc->currentPage()->yOffset()- 10);
+ SetCPo(Doc->currentPage()->xOffset() - 10, Doc->currentPage()->yOffset() - 10);
+ updateOn = true;
+ DrawNew();
+}
+
+void ScribusView::hideSymbolPage()
+{
+ Deselect(true);
+ if (Doc->symbolEditMode())
+ this->requestMode(modeNormal);
+ Doc->setSymbolEditMode(false);
+ Doc->setCurrentPage(Doc->Pages->at(0));
+ pageSelector->setEnabled(true);
+ resizeContents(qRound((Doc->maxCanvasCoordinate.x() - Doc->minCanvasCoordinate.x()) * m_canvas->scale()), qRound((Doc->maxCanvasCoordinate.y() - Doc->minCanvasCoordinate.y()) * m_canvas->scale()));
}
QImage ScribusView::MPageToPixmap(QString name, int maxGr, bool drawFrame)
Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Sun Nov 28 22:58:04 2010
@@ -174,6 +174,8 @@
void updateLayerMenu();
void showMasterPage(int nr);
void hideMasterPage();
+ void showSymbolPage(QString symbolName);
+ void hideSymbolPage();
QImage PageToPixmap(int Nr, int maxGr, bool drawFrame = true);
QImage MPageToPixmap(QString name, int maxGr, bool drawFrame = true);
void RecalcPicturesRes();
Modified: trunk/Scribus/scribus/scribuswin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/scribuswin.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuswin.cpp (original)
+++ trunk/Scribus/scribus/scribuswin.cpp Sun Nov 28 22:58:04 2010
@@ -111,34 +111,43 @@
void ScribusWin::closeEvent(QCloseEvent *ce)
{
- if (m_Doc->isModified() && (m_Doc->viewCount == 1))
+ if (m_Doc->symbolEditMode())
{
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- int exit = QMessageBox::information(m_MainWindow, CommonStrings::trWarning, tr("Document:")+" "+
- QDir::convertSeparators(m_Doc->DocName)+"\n"+
- tr("has been changed since the last save."),
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
- QMessageBox::Cancel);
- if (exit == QMessageBox::Cancel)
+ m_MainWindow->editSymbolEnd();
+ ce->ignore();
+ return;
+ }
+ else
+ {
+ if (m_Doc->isModified() && (m_Doc->viewCount == 1))
{
- ce->ignore();
- return;
- }
- if (exit == QMessageBox::Save)
- {
- if (m_MainWindow->slotFileSave())
- {
- if (m_Doc==m_MainWindow->storyEditor->currentDocument())
- m_MainWindow->storyEditor->close();
- }
- else
+ qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+ int exit = QMessageBox::information(m_MainWindow, CommonStrings::trWarning, tr("Document:")+" "+
+ QDir::convertSeparators(m_Doc->DocName)+"\n"+
+ tr("has been changed since the last save."),
+ QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
+ QMessageBox::Cancel);
+ if (exit == QMessageBox::Cancel)
{
ce->ignore();
return;
}
+ if (exit == QMessageBox::Save)
+ {
+ if (m_MainWindow->slotFileSave())
+ {
+ if (m_Doc==m_MainWindow->storyEditor->currentDocument())
+ m_MainWindow->storyEditor->close();
+ }
+ else
+ {
+ ce->ignore();
+ return;
+ }
+ }
}
+ m_MainWindow->DoFileClose();
}
- m_MainWindow->DoFileClose();
ce->accept();
}
Modified: trunk/Scribus/scribus/ui/about.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/ui/about.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/about.cpp (original)
+++ trunk/Scribus/scribus/ui/about.cpp Sun Nov 28 22:58:04 2010
@@ -114,7 +114,7 @@
buildID = new QLabel( tab );
buildID->setAlignment(Qt::AlignCenter);
buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
- QString BUILD_DAY = "27";
+ QString BUILD_DAY = "28";
QString BUILD_MONTH = CommonStrings::november;
QString BUILD_YEAR = "2010";
QString BUILD_TIME = "";
Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Sun Nov 28 22:58:04 2010
@@ -1135,6 +1135,7 @@
return;
if (!fileName.isEmpty())
{
+ qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance()->prefsFile->getContext("dirs")->set("patterns", fileName.left(fileName.lastIndexOf("/")));
QFileInfo fi(fileName);
if ((fi.suffix().toLower() == "sml") || (fi.suffix().toLower() == "shape") || (fi.suffix().toLower() == "sce") || (!imgFormats.contains(fi.suffix().toLower())))
@@ -1157,6 +1158,7 @@
updateGradientList();
updatePatternList();
itemSelected(0);
+ qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
}
Modified: trunk/Scribus/scribus/ui/symbolpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/ui/symbolpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/symbolpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/symbolpalette.cpp Sun Nov 28 22:58:04 2010
@@ -79,7 +79,6 @@
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(currentItem()->icon().pixmap(48, 48));
-// drag->setDragCursor(currentItem()->icon().pixmap(48, 48), Qt::CopyAction);
drag->exec(Qt::CopyAction);
clearSelection();
}
@@ -97,7 +96,53 @@
unsetDoc();
m_scMW = NULL;
+ editItemName = "";
+ editItem = NULL;
languageChange();
+ connect(SymbolViewWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+}
+
+void SymbolPalette::handleDoubleClick(QListWidgetItem *item)
+{
+ if (item)
+ emit startEdit(item->text());
+}
+
+void SymbolPalette::editingStart(QString name)
+{
+ editItemName = name;
+ QList<QListWidgetItem *> items = SymbolViewWidget->findItems(name, Qt::MatchExactly);
+ if (items.count() > 0)
+ {
+ editItem = items[0];
+ editItem->setFlags(0);
+ }
+}
+
+void SymbolPalette::editingFinished()
+{
+ if (!editItemName.isEmpty())
+ {
+ QPixmap pm;
+ ScPattern pa = currDoc->docPatterns[editItemName];
+ if (pa.getPattern()->width() >= pa.getPattern()->height())
+ pm = QPixmap::fromImage(pa.getPattern()->scaledToWidth(48, Qt::SmoothTransformation));
+ else
+ pm = QPixmap::fromImage(pa.getPattern()->scaledToHeight(48, Qt::SmoothTransformation));
+ QPixmap pm2(48, 48);
+ pm2.fill(palette().color(QPalette::Base));
+ QPainter p;
+ p.begin(&pm2);
+ p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm);
+ p.end();
+ if (editItem != NULL)
+ {
+ editItem->setIcon(pm2);
+ editItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
+ }
+ }
+ editItemName = "";
+ editItem = NULL;
}
void SymbolPalette::setMainWindow(ScribusMainWindow *mw)
@@ -142,7 +187,14 @@
p.begin(&pm2);
p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm);
p.end();
- new QListWidgetItem(pm2, it.key(), SymbolViewWidget);
+ QListWidgetItem *item = new QListWidgetItem(pm2, it.key(), SymbolViewWidget);
+ if (it.key() == editItemName)
+ {
+ item->setFlags(0);
+ editItem = item;
+ }
+ else
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
}
Modified: trunk/Scribus/scribus/ui/symbolpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16029&path=/trunk/Scribus/scribus/ui/symbolpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/symbolpalette.h (original)
+++ trunk/Scribus/scribus/ui/symbolpalette.h Sun Nov 28 22:58:04 2010
@@ -67,18 +67,27 @@
void setMainWindow(ScribusMainWindow *mw);
void setDoc(ScribusDoc *);
void unsetDoc();
+ void editingStart(QString name);
+ void editingFinished();
void updateSymbolList();
virtual void changeEvent(QEvent *e);
public slots:
+ void handleDoubleClick(QListWidgetItem *item);
void languageChange();
+
+signals:
+ void startEdit(QString);
+ void endEdit();
protected:
SymbolView *SymbolViewWidget;
QVBoxLayout* PaletteLayout;
ScribusDoc *currDoc;
ScribusMainWindow *m_scMW;
+ QListWidgetItem *editItem;
+ QString editItemName;
};
#endif
More information about the scribus-commit
mailing list