Commit 26e6c075 by Sebastian Eichelbaum

[CHANGE] - moved global consts in network editor to extra header.

parent daa3e183
......@@ -35,7 +35,6 @@
const qreal Pi = 3.14;
WQtNetworkArrow::WQtNetworkArrow( WQtNetworkOutputPort *startPort, WQtNetworkInputPort *endPort )
: QGraphicsLineItem()
{
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTNETWORKEDITORGLOBALS_H
#define WQTNETWORKEDITORGLOBALS_H
// The size of in/out ports
#define WNETWORKPORT_SIZEX 10
#define WNETWORKPORT_SIZEY 10
// The minimum width and heigh of items inside the scene
#define WNETWORKITEM_MINIMUM_WIDTH 100
#define WNETWORKITEM_MINIMUM_HEIGHT 150
#endif // WQTNETWORKEDITORGLOBALS_H
......@@ -28,14 +28,13 @@
#include <QtGui/QGraphicsRectItem>
#include "WQtNetworkEditorGlobals.h"
#include "WQtNetworkInputPort.h"
const float WSIZE = 10.0;
WQtNetworkInputPort::WQtNetworkInputPort( boost::shared_ptr<WModuleInputConnector> connector )
: WQtNetworkPort()
{
setRect( 0.0, 0.0, WSIZE, WSIZE );
setRect( 0.0, 0.0, WNETWORKPORT_SIZEX, WNETWORKPORT_SIZEY );
setBrush( Qt::gray );
setPen( QPen( Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) );
......
......@@ -33,9 +33,7 @@
#include "WQtNetworkItem.h"
#include "WQtNetworkScene.h"
#include "WQtNetworkEditor.h"
const float MINWIDTH = 100;
const float MINHEIGHT = 50;
#include "WQtNetworkEditorGlobals.h"
WQtNetworkItem::WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WModule > module )
: QGraphicsRectItem()
......@@ -234,8 +232,14 @@ void WQtNetworkItem::fitLook()
{
m_width = m_text->boundingRect().width() + 10;
m_height = m_text->boundingRect().height() + 10;
if( m_width < MINWIDTH ) m_width = MINWIDTH;
if( m_height < MINHEIGHT ) m_height = MINHEIGHT;
if( m_width < WNETWORKITEM_MINIMUM_WIDTH )
{
m_width = WNETWORKITEM_MINIMUM_WIDTH;
}
if( m_height < WNETWORKITEM_MINIMUM_HEIGHT )
{
m_height = WNETWORKITEM_MINIMUM_HEIGHT;
}
QRectF rect( 0, 0, m_width, m_height );
m_rect = rect;
setRect( m_rect );
......
......@@ -28,14 +28,13 @@
#include <QtGui/QGraphicsRectItem>
#include "WQtNetworkEditorGlobals.h"
#include "WQtNetworkOutputPort.h"
const float WSIZE2 = 10.0;
WQtNetworkOutputPort::WQtNetworkOutputPort( boost::shared_ptr<WModuleOutputConnector> connector )
: WQtNetworkPort()
{
setRect( 0.0, 0.0, WSIZE2, WSIZE2 );
setRect( 0.0, 0.0, WNETWORKPORT_SIZEX, WNETWORKPORT_SIZEY );
setBrush( Qt::gray );
setPen( QPen( Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment