r18794 by jghali - #11874, first part: fix display of quite a few properties in PP when in table edit mode
scribus-commit
scribus-commit at lists.scribus.net
Sun Feb 2 22:24:24 UTC 2014
Author: jghali
Date: Sun Feb 2 22:24:24 2014
New Revision: 18794
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18794
Log:
#11874, first part: fix display of quite a few properties in PP when in table edit mode
Modified:
trunk/Scribus/scribus/canvasgesture_resize.cpp
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/tablecell.cpp
trunk/Scribus/scribus/ui/outlinepalette.cpp
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/propertiespalette_text.cpp
Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Sun Feb 2 22:24:24 2014
@@ -313,7 +313,7 @@
QPointF itPos = mm.map(QPointF(0, 0));
double dx = ((newBounds.x() + m_extraX) - itPos.x());
double dy = ((newBounds.y() + m_extraY) - itPos.y());
- if (currItem->Parent != 0)
+ if (currItem->isGroupChild())
{
double sx, sy;
getScaleFromMatrix(mm, sx, sy);
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sun Feb 2 22:24:24 2014
@@ -361,7 +361,7 @@
psx->setBrush(m_brush["selection"]);
double lineAdjust(psx->pen().width()/m_canvas->scale());
double x, y, w, h;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
{
QTransform t = currItem->getCombinedTransform();
double sx, sy;
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sun Feb 2 22:24:24 2014
@@ -1348,7 +1348,7 @@
void CanvasMode_Normal::handleRadioButtonPress(PageItem* currItem)
{
m_view->m_AnnotChanged = true;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
{
PageItem *group = currItem->Parent->asGroupFrame();
for (int a = 0; a < group->groupItemList.count(); a++)
@@ -1426,7 +1426,7 @@
void CanvasMode_Normal::handleRadioButtonRelease(PageItem* currItem)
{
m_view->m_AnnotChanged = true;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
{
PageItem *group = currItem->Parent->asGroupFrame();
for (int a = 0; a < group->groupItemList.count(); a++)
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sun Feb 2 22:24:24 2014
@@ -45,13 +45,14 @@
#include "desaxe/saxXML.h"
#include "marks.h"
+#include "pageitem_arc.h"
#include "pageitem_group.h"
-#include "pageitem_regularpolygon.h"
-#include "pageitem_arc.h"
-#include "pageitem_spiral.h"
-#include "pageitem_textframe.h"
#include "pageitem_noteframe.h"
#include "pageitem_latexframe.h"
+#include "pageitem_regularpolygon.h"
+#include "pageitem_textframe.h"
+#include "pageitem_spiral.h"
+#include "pageitem_table.h"
#include "prefsmanager.h"
#include "resourcecollection.h"
@@ -872,6 +873,16 @@
// unWeldChild();
}
+bool PageItem::isGroupChild() const
+{
+ return (dynamic_cast<PageItem_Group*>(Parent) != NULL);
+}
+
+bool PageItem::isTableCell() const
+{
+ return (dynamic_cast<PageItem_Table*>(Parent) != NULL);
+}
+
void PageItem::setXPos(const double newXPos, bool drawingOnly)
{
m_xPos = newXPos;
@@ -900,7 +911,7 @@
int PageItem::level() const
{
PageItem* thisItem = const_cast<PageItem*>(this);
- if (Parent == NULL)
+ if (!isGroupChild())
{
if (m_Doc)
{
@@ -4710,23 +4721,23 @@
{
SimpleState *ss = new SimpleState(Um::Resize,
QString(Um::ResizeFromTo).arg(oldWidth).arg(oldHeight).arg(m_width).arg(m_height),
- Um::IResize);
+ Um::IResize);
if (!isNoteFrame() || !asNoteFrame()->isAutoWidth())
{
- ss->set("OLD_WIDTH", oldWidth);
- ss->set("NEW_WIDTH", m_width);
+ ss->set("OLD_WIDTH", oldWidth);
+ ss->set("NEW_WIDTH", m_width);
}
if (!isNoteFrame() || !asNoteFrame()->isAutoHeight())
{
ss->set("OLD_HEIGHT", oldHeight);
- ss->set("NEW_HEIGHT", m_height);
+ ss->set("NEW_HEIGHT", m_height);
}
if (!isNoteFrame() || !asNoteFrame()->isAutoWelded())
{
- ss->set("OLD_RXPOS", oldXpos);
- ss->set("OLD_RYPOS", oldYpos);
- ss->set("NEW_RXPOS", m_xPos);
- ss->set("NEW_RYPOS", m_yPos);
+ ss->set("OLD_RXPOS", oldXpos);
+ ss->set("OLD_RYPOS", oldYpos);
+ ss->set("NEW_RXPOS", m_xPos);
+ ss->set("NEW_RYPOS", m_yPos);
}
ss->set("OLD_RROT", oldRot);
ss->set("NEW_RROT", m_rotation);
@@ -4753,20 +4764,20 @@
{
SimpleState *ss = new SimpleState(Um::Rotate,
QString(Um::FromTo).arg(oldRot).arg(m_rotation),
- Um::IRotate);
+ Um::IRotate);
ss->set("OLD_ROT", oldRot);
ss->set("NEW_ROT", m_rotation);
if (!isNoteFrame() || !asNoteFrame()->isAutoWelded())
{
- ss->set("OLD_RXPOS", oldXpos);
- ss->set("OLD_RYPOS", oldYpos);
- ss->set("NEW_RXPOS", m_xPos);
- ss->set("NEW_RYPOS", m_yPos);
+ ss->set("OLD_RXPOS", oldXpos);
+ ss->set("OLD_RYPOS", oldYpos);
+ ss->set("NEW_RXPOS", m_xPos);
+ ss->set("NEW_RYPOS", m_yPos);
}
if (!isNoteFrame() || !asNoteFrame()->isAutoHeight())
{
- ss->set("OLD_RHEIGHT", oldHeight);
- ss->set("NEW_RHEIGHT", m_height);
+ ss->set("OLD_RHEIGHT", oldHeight);
+ ss->set("NEW_RHEIGHT", m_height);
}
if (!isNoteFrame() || !asNoteFrame()->isAutoWidth())
{
@@ -8416,11 +8427,11 @@
QTransform PageItem::getCombinedTransform() const
{
QTransform result;
- if (Parent != NULL)
+ if (isGroupChild())
{
QList<const PageItem*> itList;
const PageItem* ite = this;
- while (ite->Parent != NULL)
+ while (ite->isGroupChild())
{
itList.prepend(ite);
ite = ite->Parent;
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sun Feb 2 22:24:24 2014
@@ -243,12 +243,15 @@
virtual bool isTable() const { return false; } ///< Return true if Table item, otherwise false
virtual bool isTextFrame() const { return false; } ///< Return true if Text item, otherwise false
+ virtual bool isGroupChild() const;
+ virtual bool isTableCell() const;
+
+ PageItem_Group* parentGroup() const { return (Parent ? Parent->asGroupFrame() : NULL); }
+ PageItem_Table* parentTable() const { return (Parent ? Parent->asTable() : NULL); }
virtual void applicableActions(QStringList& actionList) = 0;
virtual QString infoDescription();
virtual bool createInfoGroup(QFrame *, QGridLayout *) {return false;}
-
-
//<< ********* Functions related to drawing the item *********
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Feb 2 22:24:24 2014
@@ -93,7 +93,7 @@
{
QRegion res;
QTransform pp;
- if (docItem->Parent != NULL)
+ if (docItem->isGroupChild())
pp.translate(docItem->gXpos, docItem->gYpos);
else
pp.translate(docItem->xPos() - xOffset, docItem->yPos() - yOffset);
@@ -101,7 +101,7 @@
if (docItem->textFlowUsesBoundingBox())
{
QRectF bb = docItem->getVisualBoundingRect();
- if (docItem->Parent != 0)
+ if (docItem->isGroupChild())
{
bb.translate(-docItem->xPos(), -docItem->yPos());
bb.translate(docItem->gXpos, docItem->gYpos);
@@ -183,11 +183,11 @@
QRegion PageItem_TextFrame::calcAvailableRegion()
{
QRegion result(this->Clip);
- if ((!isEmbedded) || (Parent != NULL))
+ if ((!isEmbedded) || (isGroupChild()))
{
bool invertible(false);
QTransform canvasToLocalMat;
- if (Parent != NULL)
+ if (isGroupChild())
canvasToLocalMat.translate(gXpos, gYpos);
else
canvasToLocalMat.translate(m_xPos, m_yPos);
@@ -209,7 +209,7 @@
return result;
Mp = m_Doc->MasterPages.at(m_Doc->MasterNames[OnMasterPage]);
Dp = m_Doc->Pages->at(savedOwnPage);
- if (Parent != NULL)
+ if (isGroupChild())
thisList = Parent->asGroupFrame()->groupItemList;
else
thisList = m_Doc->MasterItems;
@@ -250,7 +250,7 @@
else
{
int thisid = 0;
- if (Parent != NULL)
+ if (isGroupChild())
{
thisid = Parent->asGroupFrame()->groupItemList.indexOf(this);
docItemsCount = Parent->asGroupFrame()->groupItemList.count();
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sun Feb 2 22:24:24 2014
@@ -1322,15 +1322,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
{
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
}
}
allItems.clear();
@@ -1346,15 +1343,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
{
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
}
}
allItems.clear();
@@ -2129,15 +2123,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
{
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
}
}
allItems.clear();
@@ -2153,15 +2144,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
{
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
}
}
allItems.clear();
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sun Feb 2 22:24:24 2014
@@ -1140,15 +1140,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
- {
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
+ {
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
}
}
allItems.clear();
@@ -1164,15 +1161,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
- {
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
+ {
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
}
}
allItems.clear();
@@ -2455,15 +2449,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
- {
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
+ {
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->DocItems);
}
}
allItems.clear();
@@ -2479,15 +2470,12 @@
for (int ii = 0; ii < allItems.count(); ii++)
{
PageItem* gItem = allItems[ii];
- if (gItem->isGroup())
- {
- if (gItem->groupItemList[0]->isTableItem)
- {
- if (gItem->Parent == NULL)
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
- else
- convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
- }
+ if (gItem->isGroup() && gItem->groupItemList[0]->isTableItem)
+ {
+ if (gItem->isGroupChild())
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &(gItem->asGroupFrame()->groupItemList));
+ else
+ convertOldTable(m_Doc, gItem, gItem->groupItemList, NULL, &m_Doc->MasterItems);
}
}
allItems.clear();
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Feb 2 22:24:24 2014
@@ -1238,32 +1238,40 @@
void ScribusMainWindow::setTBvals(PageItem *currItem)
{
scrActions["editMark"]->setEnabled(false);
- if (currItem->itemText.length() != 0)
- {
-// int ChPos = qMin(currItem->CPos, static_cast<int>(currItem->itemText.length()-1));
- const ParagraphStyle& currPStyle( (doc->appMode == modeEdit) ? currItem->currentStyle() : currItem->itemText.defaultStyle());
- setAlignmentValue(currPStyle.alignment());
- propertiesPalette->textPal->displayParStyle(currPStyle.parent());
- propertiesPalette->textPal->displayCharStyle(currItem->currentCharStyle().parent());
- doc->currentStyle = currItem->currentStyle();
- // #8112 : do not use operator= here as it does not update style features
- doc->currentStyle.charStyle().setStyle( currItem->currentCharStyle() );
- emit TextStyle(doc->currentStyle);
- // to go: (av)
- propertiesPalette->textPal->updateStyle(doc->currentStyle);
- //check if mark in cursor place and enable editMark action
- if (doc->appMode == modeEdit && currItem->itemText.cursorPosition() < currItem->itemText.length())
- {
- if (currItem->itemText.hasMark(currItem->itemText.cursorPosition()))
- {
- Mark* mark = currItem->itemText.mark(currItem->itemText.cursorPosition());
- scrActions["editMark"]->setEnabled(true);
- if ((mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)) && (mark->getNotePtr() != NULL))
- nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle());
- }
- else
- scrActions["editMark"]->setEnabled(false);
- }
+
+ PageItem* item = currItem;
+ bool inEditMode = (doc->appMode == modeEdit);
+ if (doc->appMode == modeEditTable)
+ {
+ if (currItem->isTable())
+ item = currItem->asTable()->activeCell().textFrame();
+ inEditMode = item->isTextFrame();
+ }
+ if (!item || item->itemText.length() <= 0)
+ return;
+
+ const ParagraphStyle& currPStyle( inEditMode ? item->currentStyle() : item->itemText.defaultStyle());
+ setAlignmentValue(currPStyle.alignment());
+ propertiesPalette->textPal->displayParStyle(currPStyle.parent());
+ propertiesPalette->textPal->displayCharStyle(item->currentCharStyle().parent());
+ doc->currentStyle = item->currentStyle();
+ // #8112 : do not use operator= here as it does not update style features
+ doc->currentStyle.charStyle().setStyle(item->currentCharStyle());
+ emit TextStyle(doc->currentStyle);
+ // to go: (av)
+ propertiesPalette->textPal->updateStyle(doc->currentStyle);
+ //check if mark in cursor place and enable editMark action
+ if (doc->appMode == modeEdit && item->itemText.cursorPosition() < item->itemText.length())
+ {
+ if (item->itemText.hasMark(item->itemText.cursorPosition()))
+ {
+ Mark* mark = item->itemText.mark(item->itemText.cursorPosition());
+ scrActions["editMark"]->setEnabled(true);
+ if ((mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)) && (mark->getNotePtr() != NULL))
+ nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle());
+ }
+ else
+ scrActions["editMark"]->setEnabled(false);
}
}
@@ -10785,14 +10793,14 @@
int d = -1;
double sx = minx;
double sy = miny;
- if (currItem->Parent == NULL)
- d = doc->Items->indexOf(currItem);
- else
+ if (currItem->isGroupChild())
{
sx = currItem->gXpos;
sy = currItem->gYpos;
- d = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
- }
+ d = currItem->parentGroup()->groupItemList.indexOf(currItem);
+ }
+ else
+ d = doc->Items->indexOf(currItem);
currItem->gXpos = currItem->xPos() - minx;
currItem->gYpos = currItem->yPos() - miny;
currItem->setXYPos(currItem->gXpos, currItem->gYpos, true);
@@ -10800,10 +10808,10 @@
PageItem* groupItem = doc->Items->takeAt(z);
groupItem->setPattern(patternName);
groupItem->Parent = currItem->Parent;
- if (currItem->Parent == NULL)
+ if (currItem->isGroupChild())
+ currItem->parentGroup()->groupItemList.replace(d, groupItem);
+ else
doc->Items->replace(d, groupItem);
- else
- currItem->Parent->asGroupFrame()->groupItemList.replace(d, groupItem);
doc->m_Selection->delaySignalsOff();
propertiesPalette->updateColorList();
symbolPalette->updateSymbolList();
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Feb 2 22:24:24 2014
@@ -6343,7 +6343,7 @@
// wtf ?? why not simply
PageItem *oldItem = currItem;
uint oldItemNr;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
oldItemNr = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
else
oldItemNr = Items->indexOf(currItem);
@@ -6489,7 +6489,7 @@
// Items->at(a)->ItemNr = a;
// Items->insert(oldItem->ItemNr, newItem);
newItem->uniqueNr = oldItem->uniqueNr;
- if (oldItem->Parent != NULL)
+ if (oldItem->isGroupChild())
{
oldItem->Parent->asGroupFrame()->groupItemList.replace(oldItemNr, newItem);
newItem->Parent = oldItem->Parent;
@@ -7501,7 +7501,7 @@
objOrdHelper oHlp;
currItem = m_Selection->itemAt(c);
oHlp.objNrSel = c;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
{
if (currItem->Parent->asGroupFrame()->groupItemList.count() > 1)
{
@@ -7567,7 +7567,7 @@
objOrdHelper oHlp;
currItem = m_Selection->itemAt(c);
oHlp.objNrSel = c;
- if (currItem->Parent != NULL)
+ if (currItem->isGroupChild())
{
if (currItem->Parent->asGroupFrame()->groupItemList.count() > 1)
{
@@ -7626,10 +7626,10 @@
}
}
QList<PageItem*> *itemList;
- if (m_Selection->itemAt(0)->Parent == NULL)
+ if (m_Selection->itemAt(0)->isGroupChild())
+ itemList = &(m_Selection->itemAt(0)->parentGroup()->groupItemList);
+ else
itemList = Items;
- else
- itemList = &(m_Selection->itemAt(0)->Parent->asGroupFrame()->groupItemList);
int low = itemList->count();
int high = 0;
int d;
@@ -7698,10 +7698,10 @@
}
}
QList<PageItem*> *itemList;
- if (m_Selection->itemAt(0)->Parent == NULL)
+ if (m_Selection->itemAt(0)->isGroupChild())
+ itemList = &(m_Selection->itemAt(0)->parentGroup()->groupItemList);
+ else
itemList = Items;
- else
- itemList = &(m_Selection->itemAt(0)->Parent->asGroupFrame()->groupItemList);
int low = itemList->count();
int high = 0;
int d;
@@ -15242,15 +15242,15 @@
{
PageItem* gItem = currItem->groupItemList.last();
removeFromGroup(gItem);
- if (currItem->Parent == NULL)
+ if (currItem->isGroupChild())
+ {
+ addToGroup(currItem->Parent, gItem);
+ list->insert(d, gItem);
+ }
+ else
{
Items->insert(d, gItem);
gItem->OwnPage = OnPage(gItem);
- }
- else
- {
- addToGroup(currItem->Parent, gItem);
- list->insert(d, gItem);
}
itemSelection->addItem(gItem);
}
@@ -15321,7 +15321,7 @@
item->gXpos = d.p2().x();
item->gYpos = d.p2().y();
SizeItem(item->width() * (1.0 / grScXi), item->height() * (1.0 / grScYi), item, false, true, false);
- if (item->Parent != NULL)
+ if (item->isGroupChild())
item->Parent->groupItemList.removeAll(item);
else
Items->removeAll(item);
@@ -15362,7 +15362,7 @@
void ScribusDoc::removeFromGroup(PageItem* item)
{
- if (item->Parent == NULL)
+ if (!item->isGroupChild())
return;
PageItem* group = item->Parent;
QTransform itemTrans = item->getTransform();
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Feb 2 22:24:24 2014
@@ -4116,12 +4116,10 @@
}
tmpSelection.clear();
int ind = -1;
- if (currItem->Parent == NULL)
+ if (currItem->isGroupChild())
+ ind = currItem->parentGroup()->groupItemList.indexOf(currItem);
+ else
ind = Doc->Items->indexOf(currItem);
- else
- {
- ind = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
- }
if (newGroupedItems.count() > 1)
{
double minx = std::numeric_limits<double>::max();
@@ -4147,18 +4145,18 @@
gItem->Parent = currItem->Parent;
gItem->gXpos = currItem->gXpos;
gItem->gYpos = currItem->gYpos;
- if (currItem->Parent == NULL)
+ if (currItem->isGroupChild())
+ currItem->parentGroup()->groupItemList.insert(ind+1, gItem);
+ else
Doc->Items->insert(ind+1, gItem);
+ }
+ else if (newGroupedItems.count() > 0)
+ {
+ newGroupedItems.at(0)->Parent = currItem->Parent;
+ if (currItem->isGroupChild())
+ currItem->parentGroup()->groupItemList.insert(ind+1, newGroupedItems.at(0));
else
- currItem->Parent->asGroupFrame()->groupItemList.insert(ind+1, gItem);
- }
- else if (newGroupedItems.count() > 0)
- {
- newGroupedItems.at(0)->Parent = currItem->Parent;
- if (currItem->Parent == NULL)
Doc->Items->insert(ind+1, newGroupedItems.at(0));
- else
- currItem->Parent->asGroupFrame()->groupItemList.insert(ind+1, newGroupedItems.at(0));
}
int toDeleteItemCount=delItems.count();
if (toDeleteItemCount != 0)
Modified: trunk/Scribus/scribus/tablecell.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/tablecell.cpp
==============================================================================
--- trunk/Scribus/scribus/tablecell.cpp (original)
+++ trunk/Scribus/scribus/tablecell.cpp Sun Feb 2 22:24:24 2014
@@ -33,6 +33,7 @@
// Create a text frame for the cell.
d->textFrame = new PageItem_TextFrame(d->table->m_Doc,
0, 0, 0, 0, 0, CommonStrings::None, CommonStrings::None);
+ d->textFrame->Parent = table;
setValid(true);
setRow(row);
Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Sun Feb 2 22:24:24 2014
@@ -130,21 +130,11 @@
OutlineTreeItem *itemBe = (OutlineTreeItem*)itemPl->child(itemPl->indexOfChild(it) + 1);
if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4))
{
- if (item->PageItemObject->Parent == NULL)
- item->DocObject->Items->takeAt(item->DocObject->Items->indexOf(item->PageItemObject));
+ if (item->PageItemObject->isGroupChild())
+ item->DocObject->removeFromGroup(item->PageItemObject);
else
- item->DocObject->removeFromGroup(item->PageItemObject);
- if (itemBe->PageItemObject->Parent == NULL)
- {
- int d = item->DocObject->Items->indexOf(itemBe->PageItemObject);
- item->DocObject->Items->insert(d+1, item->PageItemObject);
- if (itemPl->type == 5)
- item->PageItemObject->setLayer(itemPl->LayerID);
- double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
- double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
- item->PageItemObject->setXYPos(xx, yy);
- }
- else
+ item->DocObject->Items->removeOne(item->PageItemObject);
+ if (itemBe->PageItemObject->isGroupChild())
{
PageItem* group = itemBe->PageItemObject->Parent;
int d = group->groupItemList.indexOf(itemBe->PageItemObject);
@@ -155,6 +145,16 @@
group->groupItemList.insert(d, item->PageItemObject);
item->PageItemObject->setLayer(group->LayerID);
}
+ else
+ {
+ int d = item->DocObject->Items->indexOf(itemBe->PageItemObject);
+ item->DocObject->Items->insert(d+1, item->PageItemObject);
+ if (itemPl->type == 5)
+ item->PageItemObject->setLayer(itemPl->LayerID);
+ double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
+ double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
+ item->PageItemObject->setXYPos(xx, yy);
+ }
item->PageItemObject->setRedrawBounding();
item->DocObject->setModified(true);
item->DocObject->scMW()->showLayer();
@@ -179,7 +179,7 @@
// itemPl->insertChild(0, itemPl->takeChild(itemPl->indexOfChild(it)));
if ((itemPl->type == 2) || (itemPl->type == 5))
{
- if (item->PageItemObject->Parent != NULL)
+ if (item->PageItemObject->isGroupChild())
{
item->DocObject->removeFromGroup(item->PageItemObject);
item->DocObject->Items->append(item->PageItemObject);
@@ -195,10 +195,10 @@
OutlineTreeItem *itemBe = (OutlineTreeItem*)it->parent();
if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4))
{
- if (item->PageItemObject->Parent == NULL)
- item->DocObject->Items->takeAt(item->DocObject->Items->indexOf(item->PageItemObject));
+ if (item->PageItemObject->isGroupChild())
+ item->DocObject->removeFromGroup(item->PageItemObject);
else
- item->DocObject->removeFromGroup(item->PageItemObject);
+ item->DocObject->Items->removeOne(item->PageItemObject);
PageItem* group = itemBe->PageItemObject;
double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Sun Feb 2 22:24:24 2014
@@ -419,7 +419,7 @@
SelTab(TabStack->currentIndex());
}
- if (!sender())
+ if (!sender() || (m_doc->appMode == modeEditTable))
{
xyzPal->handleSelectionChanged();
shadowPal->handleSelectionChanged();
Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18794&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Sun Feb 2 22:24:24 2014
@@ -213,13 +213,11 @@
if (m_doc)
{
if (m_doc->m_Selection->count() > 1)
- {
currentItem = m_doc->m_Selection->itemAt(0);
- }
else if (m_doc->m_Selection->count() == 1)
- {
currentItem = m_doc->m_Selection->itemAt(0);
- }
+ if (currentItem && currentItem->isTable() && m_doc->appMode == modeEditTable)
+ currentItem = currentItem->asTable()->activeCell().textFrame();
}
return currentItem;
@@ -343,16 +341,15 @@
if (!sender())
{
+ colorWidgets->handleSelectionChanged();
+ distanceWidgets->handleSelectionChanged();
parEffectWidgets->handleSelectionChanged();
}
if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
{
ParagraphStyle parStyle = m_item->itemText.defaultStyle();
- if (m_doc->appMode == modeEdit)
- m_item->currentTextProps(parStyle);
- else if (m_doc->appMode == modeEditTable)
- m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
+ m_item->currentTextProps(parStyle);
updateStyle(parStyle);
}
if (m_item->asOSGFrame())
@@ -387,17 +384,11 @@
{
if ((m_haveDoc) && (m_haveItem))
{
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_SetLineSpacingMode(id, &tempSelection);
- updateStyle(((m_doc->appMode == modeEdit) || (m_doc->appMode == modeEditTable)) ? i2->currentStyle() : i2->itemText.defaultStyle());
- m_doc->regionsChanged()->update(QRect());
- }
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_SetLineSpacingMode(id, &tempSelection);
+ updateStyle(((m_doc->appMode == modeEdit) || (m_doc->appMode == modeEditTable)) ? m_item->currentStyle() : m_item->itemText.defaultStyle());
+ m_doc->regionsChanged()->update(QRect());
}
}
@@ -405,20 +396,15 @@
{
if (!m_ScMW || m_ScMW->scriptIsRunning())
return;
+ bool inEditMode = (m_doc->appMode == modeEdit || m_doc->appMode == modeEditTable);
bool tmp = m_haveItem;
m_haveItem = false;
- lineSpacing->setValue(r);
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- const ParagraphStyle& curStyle(tmp && m_doc->appMode == modeEdit? i2->currentStyle() : i2->itemText.defaultStyle());
- if (tmp)
- {
- setupLineSpacingSpinbox(curStyle.lineSpacingMode(), r);
- lineSpacingModeCombo->setCurrentIndex(curStyle.lineSpacingMode());
- }
+ lineSpacing->showValue(r);
+ const ParagraphStyle& curStyle(m_haveItem && inEditMode ? m_item->currentStyle() : m_item->itemText.defaultStyle());
+ if (tmp)
+ {
+ setupLineSpacingSpinbox(curStyle.lineSpacingMode(), r);
+ lineSpacingModeCombo->setCurrentIndex(curStyle.lineSpacingMode());
}
m_haveItem = tmp;
}
@@ -567,45 +553,27 @@
{
if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
return;
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_SetLineSpacing(lineSpacing->value(), &tempSelection);
- }
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_SetLineSpacing(lineSpacing->value(), &tempSelection);
}
void PropertiesPalette_Text::handleFontSize()
{
if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
return;
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_SetFontSize(qRound(fontSize->value()*10.0), &tempSelection);
- }
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_SetFontSize(qRound(fontSize->value()*10.0), &tempSelection);
}
void PropertiesPalette_Text::handleAlignement(int a)
{
if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
return;
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_SetAlignment(a, &tempSelection);
- }
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_SetAlignment(a, &tempSelection);
}
void PropertiesPalette_Text::handleTextFont(QString c)
@@ -617,42 +585,24 @@
void PropertiesPalette_Text::doClearCStyle()
{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- if (m_haveDoc)
- {
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_EraseCharStyle(&tempSelection);
- }
- }
+ if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem)
+ return;
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_EraseCharStyle(&tempSelection);
}
void PropertiesPalette_Text::doClearPStyle()
{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- if (m_haveDoc)
- {
- PageItem *i2 = m_item;
- if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- Selection tempSelection(this, false);
- tempSelection.addItem(i2, true);
- m_doc->itemSelection_ClearBulNumStrings(&tempSelection);
- m_doc->itemSelection_EraseParagraphStyle(&tempSelection);
- CharStyle emptyCStyle;
- m_doc->itemSelection_SetCharStyle(emptyCStyle, &tempSelection);
- }
- }
+ if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem)
+ return;
+ Selection tempSelection(this, false);
+ tempSelection.addItem(m_item, true);
+ m_doc->itemSelection_ClearBulNumStrings(&tempSelection);
+ m_doc->itemSelection_EraseParagraphStyle(&tempSelection);
+ CharStyle emptyCStyle;
+ m_doc->itemSelection_SetCharStyle(emptyCStyle, &tempSelection);
}
void PropertiesPalette_Text::updateColorList()
@@ -721,24 +671,18 @@
{
if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem)
return;
- PageItem *i2 = m_item;
+ if( radioFlop == PropertyWidget_Flop::RealHeightID)
+ m_item->setFirstLineOffset(FLOPRealGlyphHeight);
+ else if( radioFlop == PropertyWidget_Flop::FontAscentID)
+ m_item->setFirstLineOffset(FLOPFontAscent);
+ else if( radioFlop == PropertyWidget_Flop::LineSpacingID)
+ m_item->setFirstLineOffset(FLOPLineSpacing);
+ else if( radioFlop == PropertyWidget_Flop::BaselineGridID)
+ m_item->setFirstLineOffset(FLOPBaselineGrid);
+ m_item->update();
if (m_doc->appMode == modeEditTable)
- i2 = m_item->asTable()->activeCell().textFrame();
- if (i2 != NULL)
- {
- if( radioFlop == PropertyWidget_Flop::RealHeightID)
- i2->setFirstLineOffset(FLOPRealGlyphHeight);
- else if( radioFlop == PropertyWidget_Flop::FontAscentID)
- i2->setFirstLineOffset(FLOPFontAscent);
- else if( radioFlop == PropertyWidget_Flop::LineSpacingID)
- i2->setFirstLineOffset(FLOPLineSpacing);
- else if( radioFlop == PropertyWidget_Flop::BaselineGridID)
- i2->setFirstLineOffset(FLOPBaselineGrid);
- i2->update();
- if (m_doc->appMode == modeEditTable)
- m_item->asTable()->update();
- else
- m_item->update();
- m_doc->regionsChanged()->update(QRect());
- }
-}
+ m_item->parentTable()->update();
+ else
+ m_item->update();
+ m_doc->regionsChanged()->update(QRect());
+}
More information about the scribus-commit
mailing list