Example #1
0
/**
 * @return The parent block or insert in which this entity is stored
 * or the parent's parent block or insert or NULL if none of the parents
 * are stored in a block or insert.
 */
RS_Entity* RS_Entity::getBlockOrInsert() {
    if (rtti()==RS2::EntityBlock || rtti()==RS2::EntityInsert) {
        return this;
    } else if (parent==NULL) {
        return NULL;
    } else {
        return parent->getBlockOrInsert();
    }
}
Example #2
0
void TaoArithBase::checkArithType(TaoBase *pbase)
{
	if( !pbase ){
		myValue=0;
		myChars.erase();
		arithType=1;
		return;
	}
	short rt=pbase->rtti();
	if( rt == TAO_Number ){
		//TaoNumber *num = (TaoNumber*)pbase;
		myValue=((TaoNumber*)pbase)->value;
		arithType=1;
	}else if( rt == TAO_String ){
		TaoString *str = (TaoString*)pbase;
		myChars = str->chars;
		myValue = atof( myChars.c_str() );
		arithType=0;
	}else if( rt == TAO_Complex ){
		TaoComplex *com=(TaoComplex*)pbase;
		cmplx=com->cmplx;
		arithType=2;
	}else if( rt == TAO_CompArray ){
		comArray = (TaoCompArray<double>*)pbase;
		if( rtti()==TAO_ArithVariable ) comArray->resetSubIndex();
		arithType=3;
	}else if( rt == TAO_RealArray ){
		short rt2=((TaoArrayBase*)pbase)->rttiNumeric();
		if( rtti()==TAO_ArithVariable )
			((TaoArrayBase*)pbase)->resetSubIndex();
			
		if( rt2==TAO_ByteArray ){
			byteArray=(TaoByteArray*)pbase;
			arithType=4;
		}else if( rt2==TAO_ShortArray ){
			shortArray=(TaoShortArray*)pbase;
			arithType=5;
		}else if( rt2==TAO_IntArray ){
			intArray=(TaoIntArray*)pbase;
			arithType=6;
		}else if( rt2==TAO_FloatArray ){
			floatArray=(TaoFloatArray*)pbase;
			arithType=7;
		}else{
			doubleArray = (TaoDoubleArray*)pbase;
			arithType=8;
		}
	}else{
		arithType=1;
	}
}
/**
 * Finishes this action.
 */
void RS_ActionInterface::finish(bool updateTB) {
    RS_DEBUG->print("RS_ActionInterface::finish");
    //    if(rtti() != RS2::ActionDefault) {//refuse to quit the default action
    if(!(rtti() == RS2::ActionDefault || rtti()==RS2::ActionFilePrintPreview) ) {//refuse to quit the default action
        status = -1;
        finished = true;
        hideOptions();
        if(updateTB) {
            updateToolBar();
        }
        RS_Snapper::finish();
    }
    graphicView->setMouseCursor(RS2::ArrowCursor);

    RS_DEBUG->print("RS_ActionInterface::finish: OK");
}
Example #4
0
void HierarchyItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
    QColorGroup g( cg );
    g.setColor( QColorGroup::Base, backgroundColor() );
    g.setColor( QColorGroup::Foreground, Qt::black );
    g.setColor( QColorGroup::Text, Qt::black );
    QString txt = text( 0 );
    if ( rtti() == Slot &&
   ( txt == "init()" || txt == "destroy()" ) ) {
  listView()->setUpdatesEnabled( false );
  if ( txt == "init()" )
      setText( 0, txt + " " + i18n( "(Constructor)" ) );
  else
      setText( 0, txt + " " + i18n( "(Destructor)" ) );
  QListViewItem::paintCell( p, g, column, width, align );
  setText( 0, txt );
  listView()->setUpdatesEnabled( true );
    } else {
  QListViewItem::paintCell( p, g, column, width, align );
    }
    p->save();
    p->setPen( QPen( cg.dark(), 1 ) );
    if ( column == 0 )
  p->drawLine( 0, 0, 0, height() - 1 );
    if ( listView()->firstChild() != this ) {
  if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) {
      int d = depth() - itemBelow()->depth();
      p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 );
  }
    }
    p->drawLine( 0, height() - 1, width, height() - 1 );
    p->drawLine( width - 1, 0, width - 1, height() );
    p->restore();
}
Example #5
0
void KGameIO::Debug()
{
  qCDebug(GAMES_PRIVATE_KGAME) << "------------------- KGAMEINPUT --------------------";
  qCDebug(GAMES_PRIVATE_KGAME) << "this:    " << this;
  qCDebug(GAMES_PRIVATE_KGAME) << "rtti :   " << rtti();
  qCDebug(GAMES_PRIVATE_KGAME) << "Player:  " << player();
  qCDebug(GAMES_PRIVATE_KGAME) << "---------------------------------------------------";
}
Example #6
0
/**
 * @return The parent graphic in which this entity is stored
 * or the parent's parent graphic or NULL if none of the parents
 * are stored in a graphic.
 */
RS_Graphic* RS_Entity::getGraphic() {
    if (rtti()==RS2::EntityGraphic) {
        return (RS_Graphic*)this;
    } else if (parent==NULL) {
        return NULL;
    } else {
        return parent->getGraphic();
    }
}
Example #7
0
/**
 * @return The parent insert in which this entity is stored
 * or the parent's parent block or NULL if none of the parents
 * are stored in a block.
 */
RS_Insert* RS_Entity::getInsert() {
    if (rtti()==RS2::EntityInsert) {
        return (RS_Insert*)this;
    } else if (parent==NULL) {
        return NULL;
    } else {
        return parent->getInsert();
    }
}
bool RS_ActionDrawLineAngle::hasFixedAngle() const{
	switch(rtti()){
	case RS2::ActionDrawLineHorizontal:
	case RS2::ActionDrawLineVertical:
		return true;
	default:
		return false;
	}
}
Example #9
0
/**
 * @return The parent block in which this entity is stored
 * or the parent's parent block or nullptr if none of the parents
 * are stored in a block.
 */
RS_Block* RS_Entity::getBlock() const{
    if (rtti()==RS2::EntityBlock) {
		RS_Block const* ret=static_cast<RS_Block const*>(this);
		return const_cast<RS_Block*>(ret);
	} else if (!parent) {
		return nullptr;
	}
	return parent->getBlock();
}
Example #10
0
/**
 * @return The parent graphic in which this entity is stored
 * or the parent's parent graphic or nullptr if none of the parents
 * are stored in a graphic.
 */
RS_Graphic* RS_Entity::getGraphic() const{
    if (rtti()==RS2::EntityGraphic) {
		RS_Graphic const* ret=static_cast<RS_Graphic const*>(this);
		return const_cast<RS_Graphic*>(ret);
	} else if (!parent) {
		return nullptr;
	}
	return parent->getGraphic();
}
Example #11
0
/**
 * @return The parent block in which this entity is stored
 * or the parent's parent block or NULL if none of the parents
 * are stored in a block.
 */
RS_Block* RS_Entity::getBlock() {
    if (rtti()==RS2::EntityBlock) {
        return (RS_Block*)this;
    } else if (parent==NULL) {
        return NULL;
    } else {
        return parent->getBlock();
    }
}
/**
 * Should be overwritten to set the toolbar for this action.
 */
void RS_ActionInterface::updateToolBar() {
    if (RS_DIALOGFACTORY!=NULL) {
        if (isFinished()) {
            RS_DIALOGFACTORY->resetToolBar();
        }else{
            RS_DIALOGFACTORY->showCadToolBar(rtti());
        }
    }
}
Example #13
0
//! constructionLayer contains entities of infinite length, constructionLayer doesn't show up in print
bool RS_Entity::isConstruction(bool typeCheck) const{
	if(typeCheck
		&&  getParent()
		&&  rtti() != RS2::EntityLine){
            // do not expand entities on construction layers, except lines
            return false;
    }
	if (layer) return layer->isConstruction();
    return false;
}
Example #14
0
//! constructionLayer contains entities of infinite length, constructionLayer doesn't show up in print
bool RS_Entity::isConstructionLayer(bool typeCheck) const  {
    if(     typeCheck
        &&  getParent() != NULL
        &&  RS2::EntityLine != rtti() ){
            // do not expand entities on construction layers, except lines
            return false;
    }
    if(layer != NULL) return layer->isConstructionLayer();
    return false;
}
Example #15
0
/**
 * @return The parent insert in which this entity is stored
 * or the parent's parent block or nullptr if none of the parents
 * are stored in a block.
 */
RS_Insert* RS_Entity::getInsert() const
{
    if (rtti()==RS2::EntityInsert) {
		RS_Insert const* ret=static_cast<RS_Insert const*>(this);
		return const_cast<RS_Insert*>(ret);
	} else if (!parent) {
		return nullptr;
    } else {
        return parent->getInsert();
    }
}
Example #16
0
 bool RS_Entity::isArcCircleLine() const
 {
	 switch (rtti()) {
	 case RS2::EntityArc:
	 case RS2::EntityCircle:
	 case RS2::EntityLine:
		 return true;
	 default:
		 return false;
	 }
 }
Example #17
0
bool RS_Entity::isArc() const
{
	switch (rtti()) {
	case RS2::EntityArc:
	case RS2::EntityCircle:
		//ellipse implements its own test
	case RS2::EntityEllipse:
		return true;
	default:
		return false;
	}
}
Example #18
0
bool RS_Entity::trimmable() const
{
    switch(rtti()){
    case RS2::EntityArc:
    case RS2::EntityCircle:
    case RS2::EntityEllipse:
    case RS2::EntityLine:
    case RS2::EntitySplinePoints:
        return true;
    default:
        return false;
    }
}
// To show up whether its open or not.
void qsamplerInstrumentGroup::setOpen ( bool bOpen )
{
	// Set the proper pixmap of this...
	if (rtti() == qsamplerInstrumentList::Group) {
		QListViewItem::setPixmap(0, QPixmap::fromMimeSource(
			bOpen ? "itemGroupOpen.png" : "itemGroup.png"));
	}
	// Open it up...
	QListViewItem::setOpen(bOpen);

	// All ancestors should be also visible.
	if (bOpen && QListViewItem::parent())
		QListViewItem::parent()->setOpen(true);
}
Example #20
0
void RS_ActionDrawArc3P::commandEvent(RS_CommandEvent* e) {
    RS_String c = e->getCommand().lower();

    if (checkCommand("help", c)) {
        RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
                                         + getAvailableCommands().join(", "));
        return;
    }

    if (RS_COMMANDS->checkCommand("center", c, rtti())) {
        finish();
        graphicView->setCurrentAction(
            new RS_ActionDrawArc(*container, *graphicView));
    }
}
Example #21
0
/**
 * @return The parent block or insert in which this entity is stored
 * or the parent's parent block or insert or nullptr if none of the parents
 * are stored in a block or insert.
 */
RS_Entity* RS_Entity::getBlockOrInsert() const
{
	RS_Entity* ret{nullptr};
	switch(rtti()){
	case RS2::EntityBlock:
	case RS2::EntityInsert:
		ret=const_cast<RS_Entity*>(this);
		break;
	default:
		if(parent) {
			return parent->getBlockOrInsert();
		}
	}
	return ret;
}
bool RS_EntityContainer::ignoredOnModification() const
{
    switch(rtti()){
    case RS2::EntityInsert:         /**Insert*/
    case RS2::EntitySpline:
    case RS2::EntityMText:        /**< Text 15*/
    case RS2::EntityText:         /**< Text 15*/
    case RS2::EntityDimAligned:   /**< Aligned Dimension */
    case RS2::EntityDimLinear:    /**< Linear Dimension */
    case RS2::EntityDimRadial:    /**< Radial Dimension */
    case RS2::EntityDimDiametric: /**< Diametric Dimension */
    case RS2::EntityDimAngular:   /**< Angular Dimension */
    case RS2::EntityDimLeader:    /**< Leader Dimension */
        return true;
    default:
        return false;
    }
}
Example #23
0
/**
 * Called from the application.
 */
void QG_CadToolBar::forceNext() {
    if(activeToolbars.size()==0) return;
	auto p=activeToolbars.back();
	if (p && p->rtti() == RS2::ToolBarSelect)
		p->runNextAction();
}
Example #24
0
void Record::writeData(XlsRecordOutputStream &out) const
{
    Q_UNUSED(out);
    fprintf(stderr, "ERROR! writeData not implemented for record type %u\n", rtti());
}
Example #25
0
std::vector < PolynomialFunction < double > > MeshEntity::createShapeFunctions() const{
    std::cerr << "need shape function implementation for meshEntity " << rtti() << std::endl;
    THROW_TO_IMPL
    return std::vector < PolynomialFunction < double > > ();
}
Example #26
0
/**
 * Is this entity visible?
 *
 * @return true Only if the entity and the layer it is on are visible.
 * The Layer might also be nullptr. In that case the layer visiblity
* is ignored.
 */
bool RS_Entity::isVisible() const{

    if (!getFlag(RS2::FlagVisible)) {
        return false;
    }

    if (isUndone()) {
        return false;
    }

        /*RS_EntityCotnainer* parent = getParent();
        if (parent && parent->isUndone()) {
                return false;
        }*/

	if (!getLayer()) {
        return true;
    }

    // inserts are usually visible - the entities in them have their own
    //   layers which might be frozen
    // upd: i'm not sure if that is the best behaviour
    //if (rtti()==RS2::EntityInsert) {
    //	return true;
    //}
    // blocks are visible in editting window, issue#253
    if( isDocument() && (rtti()==RS2::EntityBlock || rtti()==RS2::EntityInsert)) {
        return true;
    }

    if (layer /*&& layer->getName()!="ByBlock"*/) {

        if (!layer->isFrozen()) {
            return true;
        } else {
            return false;
        }
    }

	if (!layer /*&& getLayer()->getName()!="ByBlock"*/) {
		if (!getLayer()) {
            return true;
        } else {
            if (!getLayer()->isFrozen()) {
                return true;
            } else {
                return false;
            }
        }
    }

	if (!getBlockOrInsert()) {
        return true;
    }

    if (getBlockOrInsert()->rtti()==RS2::EntityBlock) {
		return !(getLayer(false) && getLayer(false)->isFrozen());
    }


	if (!getBlockOrInsert()->getLayer()) {
        return true;
    }

	if (!getBlockOrInsert()->getLayer()->isFrozen()) {
        return true;
    }

    return false;
}