r17324 by fschmid - Tables: made column and row resizing working like people are used from other applications.

scribus-commit scribus-commit at lists.scribus.net
Wed Feb 22 22:39:41 UTC 2012


Author: fschmid
Date: Wed Feb 22 22:39:41 2012
New Revision: 17324

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17324
Log:
Tables: made column and row resizing working like people are used from other applications.

Modified:
    trunk/Scribus/scribus/canvasgesture_columnresize.cpp
    trunk/Scribus/scribus/canvasgesture_rowresize.cpp
    trunk/Scribus/scribus/canvasmode_create.cpp

Modified: trunk/Scribus/scribus/canvasgesture_columnresize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17324&path=/trunk/Scribus/scribus/canvasgesture_columnresize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_columnresize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_columnresize.cpp Wed Feb 22 22:39:41 2012
@@ -55,11 +55,19 @@
 	// Perform the actual resize of the row.
 	PageItem_Table::ResizeStrategy strategy;
 	if (event->modifiers() & Qt::ShiftModifier)
-		 strategy = PageItem_Table::ResizeFollowing;
+		strategy = PageItem_Table::MoveFollowing;
 	else
-		 strategy = PageItem_Table::MoveFollowing;
+		strategy = PageItem_Table::ResizeFollowing;
 
+	table()->doc()->dontResize = true;
 	table()->resizeColumn(m_column, gridPoint.x() - table()->columnPosition(m_column), strategy);
+	if (strategy == PageItem_Table::MoveFollowing)
+	{
+		table()->adjustTableToFrame();
+		table()->adjustFrameToTable();
+	}
+	table()->doc()->dontResize = false;
+	table()->doc()->setRedrawBounding(table());
 	table()->update();
 
 	m_view->stopGesture();
@@ -75,9 +83,9 @@
 	double actualWidth = 0.0;
 
 	if (event->modifiers() & Qt::ShiftModifier)
+		actualWidth = resizeColumnMoveFollowing(requestedWidth);
+	else
 		actualWidth = resizeColumnResizeFollowing(requestedWidth);
-	else
-		actualWidth = resizeColumnMoveFollowing(requestedWidth);
 
 	// Display width tooltip.
 	m_canvas->displayDoubleHUD(event->globalPos(), tr("Width"), actualWidth);

Modified: trunk/Scribus/scribus/canvasgesture_rowresize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17324&path=/trunk/Scribus/scribus/canvasgesture_rowresize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rowresize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_rowresize.cpp Wed Feb 22 22:39:41 2012
@@ -55,11 +55,19 @@
 	// Perform the actual resize of the row.
 	PageItem_Table::ResizeStrategy strategy;
 	if (event->modifiers() & Qt::ShiftModifier)
-		 strategy = PageItem_Table::ResizeFollowing;
+		strategy = PageItem_Table::MoveFollowing;
 	else
-		 strategy = PageItem_Table::MoveFollowing;
+		strategy = PageItem_Table::ResizeFollowing;
 
+	table()->doc()->dontResize = true;
 	table()->resizeRow(m_row, gridPoint.y() - table()->rowPosition(m_row), strategy);
+	if (strategy == PageItem_Table::MoveFollowing)
+	{
+		table()->adjustTableToFrame();
+		table()->adjustFrameToTable();
+	}
+	table()->doc()->dontResize = false;
+	table()->doc()->setRedrawBounding(table());
 	table()->update();
 
 	m_view->stopGesture();
@@ -75,9 +83,9 @@
 	double actualHeight = 0.0;
 
 	if (event->modifiers() & Qt::ShiftModifier)
+		actualHeight = resizeRowMoveFollowing(requestedHeight);
+	else
 		actualHeight = resizeRowResizeFollowing(requestedHeight);
-	else
-		actualHeight = resizeRowMoveFollowing(requestedHeight);
 
 	// Display height tooltip.
 	m_canvas->displayDoubleHUD(event->globalPos(), tr("Height"), actualHeight);

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17324&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Wed Feb 22 22:39:41 2012
@@ -758,6 +758,7 @@
 			dia = 0;
 			// Add the table item.
 			// TODO: This should be done in an undo transaction.
+			m_doc->dontResize = true;
 			z = m_doc->itemAdd(PageItem::Table, PageItem::Unspecified,
 						   tableRect.x(),
 						   tableRect.y(),
@@ -772,6 +773,8 @@
 			table->insertColumns(0, numColumns - 1);
 			table->adjustTableToFrame();
 			table->adjustFrameToTable();
+			m_doc->dontResize = false;
+			m_doc->setRedrawBounding(table);
 		}
 		break;
 	case modeInsertPDF3DAnnotation:




More information about the scribus-commit mailing list