[Uml-devel] KDE/kdesdk/umbrello/umbrello
Ralf Habacker
ralf.habacker at gmail.com
Sun Apr 1 09:53:38 UTC 2012
SVN commit 1287811 by habacker:
Removed obsolate class members for holding canvas size; use Q3Canvas class members instead.
This reduces also the differences to soc-umbrello branch.
M +4 -4 uml.cpp
M +15 -17 umlscene.cpp
M +1 -32 umlscene.h
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #1287810:1287811
@@ -553,12 +553,12 @@
void UMLApp::slotZoomFit()
{
currentView()->setZoom(100); // bring it first to the original values
- DEBUG(DBG_SRC) << "canvas width=" << currentView()->umlScene()->getCanvasWidth()
- << ", height=" << currentView()->umlScene()->getCanvasHeight();
+ DEBUG(DBG_SRC) << "canvas width=" << currentView()->umlScene()->width()
+ << ", height=" << currentView()->umlScene()->height();
DEBUG(DBG_SRC) << "visible width=" << currentView()->visibleWidth()
<< ", height=" << currentView()->visibleHeight();
- int scaleW = ceil(100.0 * currentView()->visibleWidth() / currentView()->umlScene()->getCanvasWidth());
- int scaleH = ceil(100.0 * currentView()->visibleHeight() / currentView()->umlScene()->getCanvasHeight());
+ int scaleW = ceil(100.0 * currentView()->visibleWidth() / currentView()->umlScene()->width());
+ int scaleH = ceil(100.0 * currentView()->visibleHeight() / currentView()->umlScene()->height());
DEBUG(DBG_SRC) << "scale width: " << scaleW << ", height: " << scaleH;
int scale = 100;
if (scaleW < scaleH) {
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.cpp #1287810:1287811
@@ -127,8 +127,7 @@
m_isOpen = true;
m_nSnapX = 10;
m_nSnapY = 10;
- m_nCanvasWidth = UMLScene::defaultCanvasSize;
- m_nCanvasHeight = UMLScene::defaultCanvasSize;
+ setSize(UMLScene::defaultCanvasSize, UMLScene::defaultCanvasSize);
m_nCollaborationId = 0;
// Initialize other data
@@ -408,6 +407,14 @@
}
/**
+ * Sets the diagram width and height in pixels
+ */
+void UMLScene::setSize(int width, int height)
+{
+ resize(width, height);
+}
+
+/**
* Returns the options being used.
*/
const Settings::OptionState& UMLScene::optionState() const
@@ -3735,16 +3742,6 @@
}
/**
- * Sets the diagram width and height in pixels
- */
-void UMLScene::setCanvasSize(int width, int height)
-{
- setCanvasWidth(width);
- setCanvasHeight(height);
- resize(width, height);
-}
-
-/**
* Sets the size of the canvas to just fit on all the items
*/
void UMLScene::resizeCanvasToItems()
@@ -3767,7 +3764,7 @@
canvasHeight = contentsWMY;
}
- setCanvasSize(canvasWidth, canvasHeight);
+ setSize(canvasWidth, canvasHeight);
}
/**
@@ -3863,8 +3860,8 @@
viewElement.setAttribute("snapy", m_nSnapY);
// FIXME: move to UMLView
viewElement.setAttribute("zoom", view()->zoom());
- viewElement.setAttribute("canvasheight", m_nCanvasHeight);
- viewElement.setAttribute("canvaswidth", m_nCanvasWidth);
+ viewElement.setAttribute("canvasheight", height());
+ viewElement.setAttribute("canvaswidth", width());
viewElement.setAttribute("isopen", isOpen());
//now save all the widgets
@@ -3975,10 +3972,11 @@
view()->setZoom(zoom.toInt());
QString height = qElement.attribute("canvasheight", QString("%1").arg(UMLScene::defaultCanvasSize));
- m_nCanvasHeight = height.toInt();
+ int h = height.toInt();
QString width = qElement.attribute("canvaswidth", QString("%1").arg(UMLScene::defaultCanvasSize));
- m_nCanvasWidth = width.toInt();
+ int w= width.toInt();
+ setSize(w, h);
QString isOpen = qElement.attribute("isopen", "1");
m_isOpen = (bool)isOpen.toInt();
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.h #1287810:1287811
@@ -128,27 +128,8 @@
const QColor& gridDotColor() const;
void setGridDotColor(const QColor &gridColor);
- /**
- * Returns the height of the diagram.
- */
- int getCanvasHeight() const {
- return m_nCanvasHeight;
- }
+ void setSize(int width, int height);
- /**
- * Sets the height of the diagram.
- */
- void setCanvasHeight(int height) {
- m_nCanvasHeight = height;
- }
-
- /**
- * Returns the width of the diagram.
- */
- int getCanvasWidth() const {
- return m_nCanvasWidth;
- }
-
bool snapToGrid() const;
void setSnapToGrid(bool bSnap);
@@ -299,8 +280,6 @@
void fileLoaded();
- void setCanvasSize(int width, int height);
-
void resizeCanvasToItems();
/**
@@ -429,16 +408,6 @@
*/
bool m_isOpen;
- /**
- * Width of canvas in pixels
- */
- int m_nCanvasWidth;
-
- /**
- * Height of canvas in pixels
- */
- int m_nCanvasHeight;
-
// End of methods and members related to loading/saving
////////////////////////////////////////////////////////////////////////
More information about the umbrello-devel
mailing list