From kde-commits Sat Mar 31 20:36:49 2012 From: Ralf Habacker Date: Sat, 31 Mar 2012 20:36:49 +0000 To: kde-commits Subject: branches/work/soc-umbrello/umbrello Message-Id: <20120331203649.DAB2EAC89A () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133322629613031 SVN commit 1287775 by habacker: Reduced differences to trunk. M +156 -154 umlscene.cpp M +9 -9 umlscene.h --- branches/work/soc-umbrello/umbrello/umlscene.cpp #1287774:1287775 @@ -150,7 +150,7 @@ } /** - * Destructor. + * Destructor */ UMLScene::~UMLScene() { @@ -190,6 +190,21 @@ } /** + * Returns the active view(the view with focus) associated with this scene. + * \note This currently simply returns the first view in the views() list as + * multiple views are yet to be implemented. + * \todo Implement this appropriately later. + */ +UMLView* UMLScene::activeView() const +{ + UMLView *view = 0; + if(!views().isEmpty()) { + view = dynamic_cast(views().first()); + } + return view; +} + +/** * Return the documentation of the diagram. */ QString UMLScene::documentation() const @@ -254,51 +269,111 @@ } /** - * Returns the open state. - * @return when true diagram is shown to the user + * Returns the position of the diagram. */ -bool UMLScene::isOpen() const +QPointF UMLScene::pos() const { - return m_isOpen; + return m_Pos; } /** - * Sets the flag 'isOpen'. - * @param isOpen flag indicating that the diagram is shown to the user + * Sets the position of the diagram. */ -void UMLScene::setIsOpen(bool isOpen) +void UMLScene::setPos(const QPointF &pos) { - m_isOpen = isOpen; + m_Pos = pos; } /** - * Returns the position of the diagram. + * Returns the default brush for diagram widgets. + * :TODO: return value has to be QBrush */ -QPointF UMLScene::pos() const +const QColor& UMLScene::brush() const { - return m_Pos; + return m_Options.uiState.fillColor; } /** - * Sets the position of the diagram. + * Defines the color or pattern that is used for filling shapes. + * @param color The color to use. */ -void UMLScene::setPos(const QPointF &pos) +void UMLScene::setBrush(const QColor &color) { - m_Pos = pos; + m_Options.uiState.fillColor = color; + emit sigColorChanged(getID()); } /** - * Get the color of the grid dots. - * @return the color of the dots + * Returns the line color to use. */ +const QColor& UMLScene::lineColor() const +{ + return m_Options.uiState.lineColor; +} + +/** + * Sets the line color. + * + * @param color The color to use. + */ +void UMLScene::setLineColor(const QColor &color) +{ + m_Options.uiState.lineColor = color; + emit sigColorChanged(getID()); +} + +/** + * Returns the line width to use. + */ +uint UMLScene::lineWidth() const +{ + return m_Options.uiState.lineWidth; +} + +/** + * Sets the line width. + * + * @param width The width to use. + */ +void UMLScene::setLineWidth(uint width) +{ + m_Options.uiState.lineWidth = width; + emit sigLineWidthChanged(getID()); +} + +/** + * Returns the text color to use. + */ +const QColor& UMLScene::textColor() const +{ + return m_Options.uiState.textColor; +} + +/** + * Sets the text color. + * + * @param color The color to use. + */ +void UMLScene::setTextColor(const QColor& color) +{ + m_Options.uiState.textColor = color; + emit sigTextColorChanged(getID()); +} + +/** + * return grid dot color + * + * @return Color + */ const QColor& UMLScene::gridDotColor() const { return m_layoutGrid->gridDotColor(); } /** - * Set the color of the grid dots. - * @param gridColor the color of the dots + * set grid dot color + * + * @param color grid dot color */ void UMLScene::setGridDotColor(const QColor &gridColor) { @@ -308,19 +383,19 @@ } /** - * Return whether we are currently creating an object. + * Returns the options being used. */ -bool UMLScene::getCreateObject() const +const Settings::OptionState& UMLScene::optionState() const { - return m_bCreateObject; + return m_Options; } /** - * Set whether we are currently creating an object. + * Sets the options to be used. */ -void UMLScene::setCreateObject(bool bCreate) +void UMLScene::setOptionState(const Settings::OptionState& options) { - m_bCreateObject = bCreate; + m_Options = options; } /** @@ -356,6 +431,24 @@ } /** + * Returns the open state. + * @return when true diagram is shown to the user + */ +bool UMLScene::isOpen() const +{ + return m_isOpen; +} + +/** + * Sets the flag 'isOpen'. + * @param isOpen flag indicating that the diagram is shown to the user + */ +void UMLScene::setIsOpen(bool isOpen) +{ + m_isOpen = isOpen; +} + +/** * Contains the implementation for printing functionality. */ void UMLScene::print(QPrinter *pPrinter, QPainter & pPainter) @@ -548,6 +641,22 @@ } /** + * Return whether we are currently creating an object. + */ +bool UMLScene::getCreateObject() const +{ + return m_bCreateObject; +} + +/** + * Set whether we are currently creating an object. + */ +void UMLScene::setCreateObject(bool bCreate) +{ + m_bCreateObject = bCreate; +} + +/** * Overrides the standard operation. * Calls the same method in the current tool bar state. */ @@ -1087,82 +1196,16 @@ } /** - * Returns the default brush for diagram widgets. - * :TODO: return value has to be QBrush - */ -const QColor& UMLScene::brush() const -{ - return m_Options.uiState.fillColor; -} - -/** - * Defines the color or pattern that is used for filling shapes. - * @param color The color to use. - */ -void UMLScene::setBrush(const QColor &color) -{ - m_Options.uiState.fillColor = color; - emit sigColorChanged(getID()); -} - -/** - * Returns the line color to use. - */ -const QColor& UMLScene::lineColor() const -{ - return m_Options.uiState.lineColor; -} - -/** - * Sets the line color. + * Gets the smallest area to print. * - * @param color The color to use. + * @return Returns the smallest area to print. */ -void UMLScene::setLineColor(const QColor &color) +QRectF UMLScene::diagramRect() { - m_Options.uiState.lineColor = color; - emit sigColorChanged(getID()); + return itemsBoundingRect(); } /** - * Returns the line width to use. - */ -uint UMLScene::lineWidth() const -{ - return m_Options.uiState.lineWidth; -} - -/** - * Sets the line width. - * - * @param width The width to use. - */ -void UMLScene::setLineWidth(uint width) -{ - m_Options.uiState.lineWidth = width; - emit sigLineWidthChanged(getID()); -} - -/** - * Returns the text color to use. - */ -const QColor& UMLScene::textColor() const -{ - return m_Options.uiState.textColor; -} - -/** - * Sets the text color. - * - * @param color The color to use. - */ -void UMLScene::setTextColor(const QColor& color) -{ - m_Options.uiState.textColor = color; - emit sigTextColorChanged(getID()); -} - -/** * Check if at the given point is a widget or an association widget. * This is rather an ugly hack, because of the usage of metaobject. * @param atPos the mouse position on the scene @@ -1210,16 +1253,6 @@ } /** - * Gets the smallest area to print. - * - * @return Returns the smallest area to print. - */ -QRectF UMLScene::diagramRect() -{ - return itemsBoundingRect(); -} - -/** * Sets a widget to a selected state and adds it to a list of selected widgets. * * @param w The widget to set to selected. @@ -2933,21 +2966,6 @@ } /** - * Returns the active view(the view with focus) associated with this scene. - * \note This currently simply returns the first view in the views() list as - * multiple views are yet to be implemented. - * \todo Implement this appropriately later. - */ -UMLView* UMLScene::activeView() const -{ - UMLView *view = 0; - if(!views().isEmpty()) { - view = dynamic_cast(views().first()); - } - return view; -} - -/** * Reset the toolbar. */ void UMLScene::resetToolbar() @@ -2956,24 +2974,6 @@ } /** - * Returns the status on whether in a paste state. - * - * @return Returns the status on whether in a paste state. - */ -bool UMLScene::getPaste() const -{ - return m_bPaste; -} - -/** - * Sets the status on whether in a paste state. - */ -void UMLScene::setPaste(bool paste) -{ - m_bPaste = paste; -} - -/** * Event handler for context menu events. */ void UMLScene::contextMenuEvent(UMLSceneContextMenuEvent * event) @@ -3054,6 +3054,24 @@ } /** + * Returns the status on whether in a paste state. + * + * @return Returns the status on whether in a paste state. + */ +bool UMLScene::getPaste() const +{ + return m_bPaste; +} + +/** + * Sets the status on whether in a paste state. + */ +void UMLScene::setPaste(bool paste) +{ + m_bPaste = paste; +} + +/** * This slot is entered when an event has occurred on the views display, * most likely a mouse event. Before it sends out that mouse event everyone * that displays a menu on the views surface (widgets and this) thould remove any @@ -3720,22 +3738,6 @@ } /** - * Returns the options being used. - */ -const Settings::OptionState& UMLScene::optionState() const -{ - return m_Options; -} - -/** - * Sets the options to be used. - */ -void UMLScene::setOptionState(const Settings::OptionState& options) -{ - m_Options = options; -} - -/** * Changes the zoom to the currently set level (now loaded from file) * Called from UMLApp::slotUpdateViews() */ --- branches/work/soc-umbrello/umbrello/umlscene.h #1287774:1287775 @@ -90,6 +90,8 @@ UMLScene(UMLFolder *parentFolder); virtual ~UMLScene(); + UMLView* activeView() const; + // Accessors and other methods dealing with loaded/saved data UMLFolder* folder() const; @@ -110,9 +112,6 @@ QPointF pos() const; void setPos(const QPointF &pos); - const QColor& gridDotColor() const; - void setGridDotColor(const QColor &gridColor); - void setBrush(const QColor &color); const QColor& brush() const; @@ -125,6 +124,9 @@ const QColor& textColor() const; void setTextColor(const QColor& color); + const QColor& gridDotColor() const; + void setGridDotColor(const QColor &gridColor); + bool getSnapToGrid() const; void setSnapToGrid(bool bSnap); @@ -206,8 +208,6 @@ bool isSavedInSeparateFile(); - UMLView* activeView() const; - void setMenu(const QPoint& pos); void resetToolbar(); @@ -368,8 +368,6 @@ void dragMoveEvent(UMLSceneDragDropEvent *moveEvent); void dropEvent(UMLSceneDragDropEvent *dropEvent); - QRectF diagramRect(); - void mouseReleaseEvent(UMLSceneMouseEvent* mouseEvent); void mouseMoveEvent(UMLSceneMouseEvent* mouseEvent); void mouseDoubleClickEvent(UMLSceneMouseEvent* mouseEvent); @@ -384,6 +382,8 @@ void selectWidgetsOfAssoc (AssociationWidget * a); + QRectF diagramRect(); + void makeSelected (UMLWidget * uw); void updateComponentSizes(); @@ -457,10 +457,10 @@ signals: void sigResetToolBar(); void sigColorChanged(Uml::IDType); + void sigTextColorChanged(Uml::IDType); + void sigLineWidthChanged(Uml::IDType); void sigRemovePopupMenu(); void sigClearAllSelected(); - void sigLineWidthChanged(Uml::IDType); - void sigTextColorChanged(Uml::IDType); void sigSnapToGridToggled(bool); void sigSnapComponentSizeToGridToggled(bool); void sigShowGridToggled(bool);