void
OSBGenericElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBGenericElement::read [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh = editRoot()->getReadHandler();

    UInt8  ptrTypeTag;
    UInt16 version;

    rh->getValue(ptrTypeTag);
    rh->getValue(version   );

    OSG_OSB_LOG(("OSBGenericElement::read: version: [%u] ptrTypeTag [%u]\n",
                 version, ptrTypeTag));

    setContainer(FieldContainerUnrecPtr(
        FieldContainerFactory::the()->createContainer(typeName.c_str())));

    if(getContainer() == NULL)
    {
        FWARNING(("OSBGenericElement::read: Skipping unknown "
                  "FieldContainer [%s].\n", typeName.c_str()));

        skipFields();

        setContainer(FieldContainerUnrecPtr(createReplacementFC(ptrTypeTag)));
        return;
    }

    readFields("", "");
}
Ejemplo n.º 2
0
QVariantTree::QVariantTree() :
    m_containers()
{
    setContainer(QVariant::List, new QVariantTreeListContainer);
    setContainer(QVariant::StringList, new QVariantTreeListContainer);
    setContainer(QVariant::Hash, new QVariantTreeHashContainer);
    setContainer(QVariant::Map, new QVariantTreeMapContainer);

    clear();
}
void
OSBNodeElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBNodeElement::read [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh        = editRoot()->getReadHandler();
    UInt8              fcPtrType;
    UInt16             version;

    rh->getValue(fcPtrType);
    rh->getValue(version  );

    OSG_OSB_LOG(("OSBNodeElement::read: version: [%u]\n", version));

    if(fcPtrType != OSBCommonElement::FCPtrNode)
    {
        FFATAL(("OSBNodeElement::read: fcPtrType has unexpected value.\n"));

        skipFields();
        return;
    }

    NodeUnrecPtr node = Node::create();

    setContainer(node);
    readFields("'volume'", "");
}
/*!\fn void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID, UInt32 Index)
 *
 * \brief Attach to the Index of a MultiField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL, or there is no MultiField with the
 * given FieldID on the container, or the Index is out of bounds, then no
 * changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldID The ID of the field on the given container to attach
 * to.
 * \param Index The index of the MultiField to attach to.
 */
void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID, UInt32 Index)
{
    setFieldId( FieldID );
    setContainer( TheContainer );
    setIndex( Index );
    commitChanges();
}
Ejemplo n.º 5
0
bool CCCGameScrollView::createContainer(CCNewScrollViewDelegate* pDele, int nCount,const cocos2d::CCSize & oSize )
{
	m_nPageCount=nCount;
	m_CellSize=oSize;
	setDelegate(pDele);
    
	CCLayer* pContainer=CCLayer::create();
	pContainer->setAnchorPoint(CCPointZero);
	pContainer->setPosition(CCPointZero);
    
	CCSize winSize=CCDirector::sharedDirector()->getVisibleSize();
    
	for (int i=0;i<nCount;++i)
	{
		CCNode* pNode=CCNode::create();
		pDele->scrollViewInitPage(pNode,i);
		pNode->setPosition(ccp(winSize.width/2+i*oSize.width,winSize.height/2));
		pNode->setTag(i);
		pContainer->addChild(pNode);
	}
    
	setContainer(pContainer);
	setContentSize(CCSizeMake(oSize.width*nCount,oSize.height));
    
	return true;
}
Ejemplo n.º 6
0
void
OSBGeometryElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBGeometryElement::read: [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh = editRoot()->getReadHandler();

    rh->getValue(_version);
    OSG_OSB_LOG(("OSBGeometryElement::read: version: [%u]\n", _version));

    if(_version >= OSGOSBHeaderVersion200)
    {
        if(_version > OSGOSBHeaderVersion200)
        {
            FINFO(("OSBGeometryElement::read: "
                   "Unknown version, trying to read as latest.\n"));
        }

        setContainer(GeometryUnrecPtr(Geometry::create()));
        readFields("", "");
    }
    else if(_version >= OSGOSBHeaderVersion100)
    {
        readV100();
    }
}
Ejemplo n.º 7
0
/**
 * Constructor.
 */
QG_GraphicView::QG_GraphicView(QWidget* parent, Qt::WindowFlags f, RS_Document* doc)
    :RS_GraphicView(parent, f)
    ,device("Mouse")
    ,curCad(new QCursor(QPixmap(":ui/cur_cad_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
    ,curDel(new QCursor(QPixmap(":ui/cur_del_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
    ,curSelect(new QCursor(QPixmap(":ui/cur_select_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
    ,curMagnifier(new QCursor(QPixmap(":ui/cur_glass_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
    ,curHand(new QCursor(QPixmap(":ui/cur_hand_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
    ,redrawMethod(RS2::RedrawAll)
    ,isSmoothScrolling(false)
{
    RS_DEBUG->print("QG_GraphicView::QG_GraphicView()..");

    if (doc)
    {
        setContainer(doc);
        doc->setGraphicView(this);
        setDefaultAction(new RS_ActionDefault(*doc, *this));
    }

    setFactorX(4.0);
    setFactorY(4.0);
    setBorders(10, 10, 10, 10);

    setMouseTracking(true);
    setFocusPolicy(Qt::NoFocus);

    // SourceForge issue 45 (Left-mouse drag shrinks window)
    setAttribute(Qt::WA_NoMousePropagation);

    view_rect = LC_Rect(toGraph(0, 0), toGraph(getWidth(), getHeight()));
}
NativeScrollViewContentObject::NativeScrollViewContentObject(TiObject* tiObject, NativeScrollViewObject* scrollView)
	: NativeControlObject(tiObject, N_TYPE_VIEW)
{
 	setContainer(bb::cascades::Container::create());
 	scrollView_ = scrollView;

}
Ejemplo n.º 9
0
bool ScrollView::initWithContainer(ScrollViewDelegate* pDele, int nCount, const Size& oSize)
{
    _pageCount = nCount;
    _cellSize = oSize;
    _pageEnabled = true;
    _delegate = NULL;
    _bounceable = true;
    _clippingToBounds = true;
    
    setDelegate(pDele);
    
    Layer* pContainer= Layer::create();
    pContainer->setAnchorPoint(Vec2::ZERO);
    pContainer->setPosition(Vec2::ZERO);
    
    for (int i=0 ; i<nCount ; ++i)
    {
        Node* pNode = Node::create();
        pDele->scrollViewInitPage(pNode, i);
        pNode->setPosition(Vec2(i*oSize.width, 0));
        pNode->setTag(i);
        pContainer->addChild(pNode);
    }
    
    setContainer(pContainer);
    setContentSize(Size(oSize.width*nCount, oSize.height));
    
    setTouchEnabled(true);
    
    return true;
}
Ejemplo n.º 10
0
/*!\fn void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, const std::string& FieldName, UInt32 Index)
 *
 * \brief Attach to the Index of a MultiField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL, or there is no MultiField by the
 * given name on the container, or the Index is out of bounds, then no
 * changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldName The name of the field on the given container to attach
 * to.
 * \param Index The index of the MultiField to attach to.
 */
void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, const std::string& FieldName, UInt32 Index)
{
    setFieldName( FieldName );
    setContainer( TheContainer );
    setIndex( Index );
    commitChanges();
}
void HorAutoScrollWidget::setTouchPriorityFinished()
{
    m_widgetContainer->setTouchPriority(this->touchPriority());
    m_widgetContainer->exec();
    m_widgetContainer->layout(true);
    CCSize size;
    m_widgetContainer->getContainerFixedSize(size);
    setContainer(m_widgetContainer,size,false);
    setDirection(kCCScrollViewDirectionHorizontal);
}
void VerAutoScrollWidget::setTouchPriorityFinished()
{
    m_widgetContainer->setTouchPriority(this->touchPriority());
    m_widgetContainer->exec();
    m_widgetContainer->layout(true);
    CCSize size;
    m_widgetContainer->getContainerFixedSize(size);
    setContainer(m_widgetContainer,size,true);
    setDirection(kCCScrollViewDirectionVertical);
    m_widgetContainer->getAnchorSize(size.width,size.height);
}
Ejemplo n.º 13
0
Notify::UserInfoDialog::UserInfoDialog(const char *title)
: SplitDialog(title)
{
  setColorScheme("generalwindow");

  treeview = new CppConsUI::TreeView(AUTOSIZE, AUTOSIZE);
  setContainer(*treeview);

  buttons->appendItem(_("Done"), sigc::hide(sigc::mem_fun(this,
          &UserInfoDialog::close)));
}
void VerAutoScrollWidget::delFixedSizeWidget(BasFixedSizeWidget *widget)
{
    m_widgetContainer->delFSizeWidget(widget);
    m_widgetContainer->setTouchPriority(this->touchPriority());
    m_widgetContainer->exec();
    m_widgetContainer->layout(true);
    CCSize size;
    m_widgetContainer->getContainerFixedSize(size);
    setContainer(m_widgetContainer,size,true);
    setDirection(kCCScrollViewDirectionVertical);
}
void HorAutoScrollWidget::delAllFixedSizeWidget()
{
    if(m_widgetContainer->fsizeChildCount() == 0)
        return;
    m_widgetContainer->delAllChild();
    m_widgetContainer->setTouchPriority(this->touchPriority());
    m_widgetContainer->exec();
    m_widgetContainer->layout(true);
    CCSize size;
    m_widgetContainer->getContainerFixedSize(size);
    setContainer(m_widgetContainer,size,false);
    setDirection(kCCScrollViewDirectionHorizontal);
}
NativeScrollViewContentObject::NativeScrollViewContentObject(TiObject* tiObject, NativeScrollViewObject* scrollView)
	: NativeControlObject(tiObject, N_TYPE_VIEW)
{
 	setContainer(bb::cascades::Container::create());
 	scrollView_ = scrollView;

 	TiObject height;
	height.setValue(String::New("UI.SIZE"));
 	setHeight(&height);

	TiObject width;
	width.setValue(String::New("UI.SIZE"));
 	setWidth(&height);
}
/*!
  Destruct container
  \note The Containers in vector of the container are not
        destructed. They are owned by the logical hierarchy (i.e.,
		the fl_Container classes like fl_BlockLayout), not the physical
        hierarchy.
 */
fp_TOCContainer::~fp_TOCContainer()
{
	clearCons();
	deleteBrokenTOCs(false);
	UT_DEBUGMSG(("SEVIOR: deleting TOC %p \n",this));
//
// For debugging...
//
	setContainer(NULL);
	setPrev(NULL);
	setNext(NULL);
	m_pMasterTOC = NULL;

}
Ejemplo n.º 18
0
/*
Ham xay dung noi dung cua dialog
*/
void SkillDetailDialog::createDisplaySkillInfo(Sprite* parent)
{
	// Create skill image
	auto skillImage = Sprite::create(_skillInfo.imagePath);
	skillImage->setPosition(Vec2(skillImage->getContentSize().width + 40, parent->getContentSize().height / 2));
	skillImage->setScale(2.0f);
	parent->addChild(skillImage);

	std::stringstream info;
	info << "Name : " << _skillInfo.name << "\nId: " << _skillInfo.id << "\nMP: " << _skillInfo.mp_cost;
	_statusLabel = LabelTTF::create(info.str().c_str(), "fonts/arial.ttf", 30);
	_statusLabel->setColor(Color3B::RED);
	_statusLabel->setHorizontalAlignment(TextHAlignment::LEFT);

	// create scroll view info
	if (_statusLabel->getContentSize().height > (parent->getContentSize().height - 200))
	{
		// Create scroll
		auto scrollInfo = extension::ScrollView::create();
		scrollInfo->setDirection(extension::ScrollView::Direction::VERTICAL); // cho scroll di chuyen theo chieu doc
		scrollInfo->setViewSize(Size(parent->getContentSize().width / 2, 300));
		scrollInfo->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
		scrollInfo->setPosition(Vec2(parent->getContentSize().width / 2 - 70, 30));
		scrollInfo->updateInset();
		scrollInfo->setVisible(true);
		parent->addChild(scrollInfo);

		// Add layer to scroll
		auto layer = Layer::create();
		layer->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
		layer->setContentSize(Size(parent->getContentSize().width / 2, _statusLabel->getContentSize().height + 50));
		layer->setPosition(Vec2(0, -(layer->getContentSize().height / 2)));

		scrollInfo->setContainer(layer);

		// Add _statusLabel to layer
		auto height = layer->getContentSize().height;
		scrollInfo->setContentOffset(scrollInfo->minContainerOffset());
		_statusLabel->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
		_statusLabel->setPosition(Vec2(0, height - 20));
		layer->addChild(_statusLabel);
	}
	else
	{
		_statusLabel->setPosition(Vec2(parent->getContentSize().width / 2 - 70, parent->getContentSize().height - 100));
		_statusLabel->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);

		parent->addChild(_statusLabel);
	}
}
void
OSBNameElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBNameElement::read [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh        = editRoot()->getReadHandler();
    UInt8              fcPtrType;
    UInt16             version;

    rh->getValue(fcPtrType);
    rh->getValue(version  );

    setContainer(NameUnrecPtr(Name::create()));
    readFields("", "");
}
Ejemplo n.º 20
0
bool MDragDownView::init(float fViewWith, float fViewMinHeight, float fViewMaxHeight, CCNode *pContainer)
{
    if(!CCLayer::init())
    {
        return false;
    }
    
    setTouchMode(kCCTouchesOneByOne);
    setTouchEnabled(true);
    
    setViewSize(fViewWith, fViewMinHeight, fViewMaxHeight);
    setContainer(pContainer);
    
    schedule(schedule_selector(MDragDownView::step));
    
    return true;
}
Ejemplo n.º 21
0
/**
Calls constructors of all menus used in GUI.
*/
void UserFace::createMenus(){
        container = new CustomContainer();

        mMain = new MenuMain();
        mCreateGame = new MenuCreateGame();
        mGameLobby = new MenuGameLobby();
        mConnect = new MenuConnect();
        mSettings = new MenuSettings();
        mNetGames = new MenuNetGames();
        mPlayers = new MenuPlayers();
        mCredits = new MenuCredits();

        msgBox = new MsgBox();
        setContainer();
		
		container->initWidgets();
}
Ejemplo n.º 22
0
AccountWindow::AccountWindow()
: SplitDialog(0, 0, 80, 24, _("Accounts"))
{
  setColorScheme("generalwindow");

  treeview = new CppConsUI::TreeView(AUTOSIZE, AUTOSIZE);
  setContainer(*treeview);

  // populate all defined accounts
  for (GList *i = purple_accounts_get_all(); i; i = i->next)
    populateAccount(reinterpret_cast<PurpleAccount*>(i->data));

  buttons->appendItem(_("Add"), sigc::mem_fun(this,
        &AccountWindow::addAccount));
  buttons->appendSeparator();
  buttons->appendItem(_("Done"), sigc::hide(sigc::mem_fun(this,
          &AccountWindow::close)));
}
Ejemplo n.º 23
0
void OSBChunkBlockElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBChunkBlockElement::read [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh = editRoot()->getReadHandler();

    UInt8  ptrTypeId;
    UInt16 version;

    rh->getValue(ptrTypeId);
    rh->getValue(version  );

    OSG_OSB_LOG(("OSBChunkBlockElement::read: version: [%u]\n", version));

    std::string    fieldName;
    std::string    fieldTypeName;
    UInt32         fieldSize;
    PtrFieldListIt ptrFieldIt;

    ChunkBlockUnrecPtr pMat = dynamic_pointer_cast<ChunkBlock>(
        FieldContainerFactory::the()->createContainer(typeName.c_str()));

    setContainer(pMat);

    while(readFieldHeader("", fieldName, fieldTypeName, fieldSize))
    {
        if(fieldName == "chunks")
        {
            // keep an interator to the _mfChunks field contents
            readFieldContent(fieldName, fieldTypeName, fieldSize, "",
                             _chunksPtrFieldIt);

            _chunksPtrFieldItValid = true;
        }
        else
        {
            readFieldContent(fieldName, fieldTypeName, fieldSize, "",
                             ptrFieldIt);
        }
    }
}
Ejemplo n.º 24
0
bool CCCGameScrollView::createContainer(CCCGameScrollViewDelegate *pDele, int nCount, const cocos2d::CCSize &oSize )
{
	CCAssert(m_bSetDirection, "must call setDirection first!!!");
	m_nPageCount = nCount;
	m_CellSize = oSize;
	setDelegate(pDele);
    if (nCount==1) {
        
    }
	CCLayer *pContainer = CCLayer::create();

	CCSize winSize =CCSizeZero ; //CCDirector::sharedDirector()->getVisibleSize();
	for (int i = 0; i < nCount; ++i)
	{
		CCNode *pNode = CCNode::create();
        pNode->setAnchorPoint(ccp(0, 0));
		pDele->scrollViewInitPage(this, pNode, i);

		if (m_eDirection == kCCScrollViewDirectionHorizontal)
		{
			pNode->setPosition(ccp( i * oSize.width, 0));
		}
		else
		{
			pNode->setPosition(ccp(0,i * oSize.height));
		}

		pNode->setContentSize(m_CellSize);
		pNode->setTag(i);
		pContainer->addChild(pNode);
	}
    
    setViewSize(m_CellSize);
	setContainer(pContainer);
     
	return true;
}
/*! Reads from the stream set by a preceding call to initialiseRead. Since the
    root element is the first one created it reads the file header and
    creates the elements to read the data following the header.

    \param[in] typeName The argument is ignored.
 */
void
OSBRootElement::read(const std::string &/*typeName*/)
{
    OSG_OSB_LOG(("OSBRootElement::read\n"));

    BinaryReadHandler *rh           = getReadHandler();
    std::string        headerMarker;

    rh->getValue(headerMarker);

    if(headerMarker == OSGOSB_HEADER_ID_1)
    {
        OSG_OSB_LOG(("OSBRootElement::read: Header version: [%u]\n",
                OSGOSBHeaderVersion100));
        setHeaderVersion(OSGOSBHeaderVersion100);
    }
    else if(headerMarker == OSGOSB_HEADER_ID_2)
    {
        OSG_OSB_LOG(("OSBRootElement::read: Header version: [%u]\n",
                OSGOSBHeaderVersion200));
        setHeaderVersion(OSGOSBHeaderVersion200);
    }
//     else if(headerMarker == OSGOSB_HEADER_ID_201)
//     {
//         OSG_OSB_LOG(("OSBRootElement::read: Header version: [%u]\n",
//                 OSGOSBHeaderVersion201));
//         setHeaderVersion(OSGOSBHeaderVersion201);
//     }
    else
    {
        FWARNING(("OSBRootElement::read: Unrecognized file header, could not "
                  "load file.\n"));
        return;
    }

    std::string headerName;
    rh->getValue(headerName);
    std::string headerOptions;
    rh->getValue(headerOptions);
    UInt64 fileSize;
    rh->getValue(fileSize);

    OSG_OSB_LOG(("OSBRootElement::read: headerName: [%s]\n",
            headerName.c_str()));
    OSG_OSB_LOG(("OSBRootElement::read: headerOptions: [%s]\n",
            headerOptions.c_str()));
    OSG_OSB_LOG(("OSBRootElement::read: fileSize: [%" PRISize "]\n",
            fileSize));

    std::string     fcTypeName;
    UInt32          fcIdFile;    // id used in the file
    UInt32          fcIdSystem;  // id used in the system
    OSBElementBase *elem;

    while(true)
    {
        if(!readFieldContainerHeader(fcTypeName, fcIdFile))
            break;

        OSG_OSB_LOG(("OSBRootElement::read: fcTypeName [%s] fcIdFile: [%u]\n",
                fcTypeName.c_str(), fcIdFile));

        elem = OSBElementFactory::the()->acquire(fcTypeName, this);
        elem->setFCIdFile(fcIdFile  );
        elem->read       (fcTypeName);

        if(elem->getContainer() != NULL)
        {
            fcIdSystem = elem->getContainer()->getId();

            OSG_OSB_LOG(("OSBRootElement::read: fcIdFile: [%u] fcIdSystem: [%u]\n",
                    fcIdFile, fcIdSystem));

            editIdMap().insert(
                FieldContainerIdMap::value_type(fcIdFile, fcIdSystem));

            if(getContainer() == NULL)
            {
                setContainer(elem->getContainer());
            }

            editElementList().push_back(elem                          );
            editIdElemMap  ().insert   (std::make_pair(fcIdFile, elem));
        }
    }
}
Ejemplo n.º 26
0
/**
 * Constructor.
 */
QG_GraphicView::QG_GraphicView(QWidget* parent, Qt::WindowFlags f, RS_Document* doc)
        :RS_GraphicView(parent, f)
        ,hScrollBar(new QG_ScrollBar(Qt::Horizontal, this))
        ,vScrollBar(new QG_ScrollBar(Qt::Vertical, this))
        ,layout(new QGridLayout(this))
        ,gridStatus(new QLabel("-", this))
        ,curCad(new QCursor(QPixmap(":ui/cur_cad_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
        ,curDel(new QCursor(QPixmap(":ui/cur_del_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
        ,curSelect(new QCursor(QPixmap(":ui/cur_select_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
        ,curMagnifier(new QCursor(QPixmap(":ui/cur_glass_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
        ,curHand(new QCursor(QPixmap(":ui/cur_hand_bmp.png"), CURSOR_SIZE, CURSOR_SIZE))
        ,redrawMethod(RS2::RedrawAll)
        ,isSmoothScrolling(false)
{
    RS_DEBUG->print("QG_GraphicView::QG_GraphicView()..");

    RS_DEBUG->print("  Setting Container..");
    if (doc) {
        setContainer(doc);
        doc->setGraphicView(this);
    }
    RS_DEBUG->print("  container set.");
    setFactorX(4.0);
    setFactorY(4.0);
    setOffset(50, 50);
    setBorders(10, 10, 10, 10);

	if (doc) {
		setDefaultAction(new RS_ActionDefault(*doc, *this));
	}

    layout->setMargin(0);
    layout->setSpacing(0);
    layout->setColumnStretch(0, 1);
    layout->setColumnStretch(1, 0);
    layout->setColumnStretch(2, 0);
    layout->setRowStretch(0, 1);
    layout->setRowStretch(1, 0);

    hScrollBar->setSingleStep(50);
    hScrollBar->setCursor(Qt::ArrowCursor);
    layout->addWidget(hScrollBar, 1, 0);
    layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
    connect(hScrollBar, SIGNAL(valueChanged(int)),
            this, SLOT(slotHScrolled(int)));

    vScrollBar->setSingleStep(50);
    vScrollBar->setCursor(Qt::ArrowCursor);
    layout->addWidget(vScrollBar, 0, 2);
    layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2);
    connect(vScrollBar, SIGNAL(valueChanged(int)),
            this, SLOT(slotVScrolled(int)));

    // Dummy widgets for scrollbar corners:
    //layout->addWidget(new QWidget(this), 1, 1);
    //QWidget* w = new QWidget(this);
    //w->setEraseColor(QColor(255,0,0));

    gridStatus->setAlignment(Qt::AlignRight);
    layout->addWidget(gridStatus, 1, 1, 1, 2);
    layout->addItem(new QSpacerItem(50, 0), 0, 1);

    setMouseTracking(true);
        // flickering under win:
    //setFocusPolicy(WheelFocus);

    setFocusPolicy(Qt::NoFocus);

    // See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window)
    setAttribute(Qt::WA_NoMousePropagation);

	int aa = RS_SETTINGS->readNumEntry("/Appearance/Antialiasing");
	set_antialiasing(aa?true:false);
}
void
OSBTextureChunkElement::read(const std::string &typeName)
{
    OSG_OSB_LOG(("OSBTextureChunkElement::read: [%s]\n", typeName.c_str()));

    BinaryReadHandler *rh = editRoot()->getReadHandler();
    
    UInt8  ptrTypeId;
    UInt16 version;

    rh->getValue(ptrTypeId);
    rh->getValue(version  );

    OSG_OSB_LOG(("OSBTextureChunkElement::read: version: [%u]\n", version));
    
    // create the two replacement chunks
    _pTexObj = TextureObjChunk::create();
    _pTexEnv = TextureEnvChunk::create();
        
    std::string    fieldName;
    std::string    fieldTypeName;
    UInt32         fieldSize;
    PtrFieldListIt ptrFieldIt;
    
    while(readFieldHeader("", fieldName, fieldTypeName, fieldSize))
    {
        // some fields need to be duplicated for the two replacement chunks
        if(fieldName == "parents")
        {
            // parent fields are ignored
            rh->skip(fieldSize);
        }    
        else if(fieldName == "internal")
        {
            bool fieldValue;
            rh->getValue(fieldValue);
            
            _pTexObj->setInternal(fieldValue);
            _pTexEnv->setInternal(fieldValue);
        }
        else if(fieldName == "ignore")
        {
            bool fieldValue;
            rh->getValue(fieldValue);
            
            _pTexObj->setIgnore(fieldValue);
            _pTexEnv->setIgnore(fieldValue);
        }        
        else if(isTexObjField(fieldName))
        {
            // set TexObj as container for reading the field
            setContainer(_pTexObj);
            readFieldContent(fieldName, fieldTypeName, fieldSize, "", ptrFieldIt);
        }
        else if(isTexEnvField(fieldName))
        {
            // set TexEnv as container for reading the field
            setContainer(_pTexEnv);
            readFieldContent(fieldName, fieldTypeName, fieldSize, "", ptrFieldIt);
        }
        else
        {
            FWARNING(("OSBTextureChunkElement::read: Skipping unrecognized "
                      "field [%s].\n", fieldName.c_str()));
                      
            rh->skip(fieldSize);
        }
    }
    
    // set TexObj as "the" container
    setContainer(_pTexObj);
}
Ejemplo n.º 28
0
void
OSBGeometryElement::readV100(void)
{
    OSG_OSB_LOG(("OSBGeometryElement::readV100:\n"));

    OSBRootElement    *root = editRoot();
    BinaryReadHandler *rh   = editRoot()->getReadHandler();
    OSBGeometryHelper  gh;

    GeometryUnrecPtr geo = Geometry::create();
    setContainer(geo);

    // The "properties" mfield can be thought of the unification of the
    // "positions", "normals", etc sfields of the 1.x Geometry.
    // For the conversion the PtrFieldInfo structure for the "properties"
    // mfield is filled with the corresponding ids of the sfields from the
    // file. The remapping after postRead will fill in the right pointers.

    FieldDescriptionBase *propFieldDesc =
        geo->getFieldDescription("properties");
    UInt32                propFieldId   = propFieldDesc->getFieldId();

    root->editPtrFieldList().push_back(PtrFieldInfo(geo, propFieldId));
    PtrFieldInfo &propFieldPFI = root->editPtrFieldList().back();

    propFieldPFI.editIdStore().resize(Geometry::MaxAttribs);

    while(true)
    {
        std::string    fieldName;
        std::string    fieldTypeName;
        UInt32         fieldSize;
        PtrFieldListIt ptrFieldIt;

        if(!readFieldHeader("", fieldName, fieldTypeName, fieldSize))
        {
            OSG_OSB_LOG(("OSBGeometryElement::readV100: "
                    "Reading stopped at field: [%s].\n", fieldName.c_str()));
            break;
        }

        if(fieldName == "indexMapping")
        {
            // read into temporary field
            MField<UInt16> indexMappingField;
            indexMappingField.copyFromBin(*rh);

            // copy to member for use in postRead
            indexMappingField.getValues().swap(_indexMapping);
        }
        else if(fieldName == "indices")
        {
            // read container id of indices property
            // postRead will handle the conversion of multi indices
            rh->getValue(_indicesId);
        }
        else if(fieldName == "positions")
        {
            UInt32 positionsId;
            rh->getValue(positionsId);
            propFieldPFI.editIdStore()[Geometry::PositionsIndex] = positionsId;
        }
        else if(fieldName == "normals")
        {
            UInt32 normalsId;
            rh->getValue(normalsId);
            propFieldPFI.editIdStore()[Geometry::NormalsIndex] = normalsId;
        }
        else if(fieldName == "colors")
        {
            UInt32 colorsId;
            rh->getValue(colorsId);
            propFieldPFI.editIdStore()[Geometry::ColorsIndex] = colorsId;
        }
        else if(fieldName == "secondaryColors")
        {
            UInt32 secondaryColorsId;
            rh->getValue(secondaryColorsId);
            propFieldPFI.editIdStore()[Geometry::SecondaryColorsIndex] =
                secondaryColorsId;
        }
        else if(fieldName == "texCoords")
        {
            UInt32 texCoordsId;
            rh->getValue(texCoordsId);
            propFieldPFI.editIdStore()[Geometry::TexCoordsIndex] =
                texCoordsId;
        }
        else if(fieldName == "texCoords1")
        {
            UInt32 texCoordsId1;
            rh->getValue(texCoordsId1);
            propFieldPFI.editIdStore()[Geometry::TexCoords1Index] =
                texCoordsId1;
        }
        else if(fieldName == "texCoords2")
        {
            UInt32 texCoordsId2;
            rh->getValue(texCoordsId2);
            propFieldPFI.editIdStore()[Geometry::TexCoords2Index] =
                texCoordsId2;
        }
        else if(fieldName == "texCoords3")
        {
            UInt32 texCoordsId3;
            rh->getValue(texCoordsId3);
            propFieldPFI.editIdStore()[Geometry::TexCoords3Index] =
                texCoordsId3;
        }
        else if(fieldName == "texCoords4")
        {
            UInt32 texCoordsId4;
            rh->getValue(texCoordsId4);
            propFieldPFI.editIdStore()[Geometry::TexCoords4Index] =
                texCoordsId4;
        }
        else if(fieldName == "texCoords5")
        {
            UInt32 texCoordsId5;
            rh->getValue(texCoordsId5);
            propFieldPFI.editIdStore()[Geometry::TexCoords5Index] =
                texCoordsId5;
        }
        else if(fieldName == "texCoords6")
        {
            UInt32 texCoordsId6;
            rh->getValue(texCoordsId6);
            propFieldPFI.editIdStore()[Geometry::TexCoords6Index] =
                texCoordsId6;
        }
        else if(fieldName == "texCoords7")
        {
            UInt32 texCoordsId7;
            rh->getValue(texCoordsId7);
            propFieldPFI.editIdStore()[Geometry::TexCoords7Index] =
                texCoordsId7;
        }
        else if(fieldName == "pindices")
        {
            UInt32 maxValue;
            UInt32 propSize;
            UInt32 byteSize;

            _indicesPacked = true;

            gh.readPackedIntegralPropertyHeader(rh, maxValue,
                                                propSize, byteSize);

            if(root->getOptions().unpack16BitIndices())
            {
                if(maxValue > TypeTraits<UInt16>::getMax())
                {
                    GeoUInt32PropertyUnrecPtr ui32Indices =
                        GeoUInt32Property::create();
                    gh.readPackedIntegralProperty(rh, ui32Indices, maxValue,
                                                  propSize, byteSize        );

                    _indices16Bit = false;
                    _indices      = ui32Indices;
                }
                else
                {
                    GeoUInt16PropertyUnrecPtr ui16Indices =
                        GeoUInt16Property::create();
                    gh.readPackedIntegralProperty(rh, ui16Indices, maxValue,
                                                  propSize, byteSize        );

                    _indices16Bit = true;
                    _indices      = ui16Indices;
                }
            }
            else
            {
                GeoUInt32PropertyUnrecPtr ui32Indices =
                    GeoUInt32Property::create();
                gh.readPackedIntegralProperty(rh, ui32Indices, maxValue,
                                              propSize, byteSize        );

                _indices16Bit = false;
                _indices      = ui32Indices;
            }
        }
        else if(fieldName == "qpositions")
        {
            // Quantized positions are stored inside the geometry object, not
            // in the geo-property. They are always of type Pnt3f.
            GeoPnt3fPropertyUnrecPtr propPos    = GeoPnt3fProperty::create();
            UInt8                    resolution;
            Real32                   minValue;
            Real32                   maxValue;
            UInt32                   propSize;

            gh.readQuantizedVectorPropertyHeader(rh, resolution, minValue,
                                                 maxValue, propSize       );
            gh.readQuantizedVectorProperty(rh, propPos, fieldSize, resolution,
                                           minValue, maxValue, propSize       );

            geo->setProperty(propPos, Geometry::PositionsIndex);
        }
        else if(fieldName == "qnormals")
        {
            // Quantized normals are stored inside the geometry object, not
            // in the geo-property. They are always of type Vec3f.
            GeoVec3fPropertyUnrecPtr propNorm   = GeoVec3fProperty::create();
            UInt8                    resolution;
            Real32                   minValue;
            Real32                   maxValue;
            UInt32                   propSize;

            gh.readQuantizedVectorPropertyHeader(
                rh, resolution, minValue, maxValue, propSize);
            gh.readQuantizedVectorProperty(
                rh, propNorm, fieldSize, resolution,
                minValue, maxValue, propSize        );

            geo->setProperty(propNorm, Geometry::NormalsIndex);
        }
        else if(fieldName == "qtexCoords")
        {
            // Quantized texCoords are stored inside the geometry object, not
            // in the geo-property. They are always of type Vec2f.
            GeoVec2fPropertyUnrecPtr propTexCoords = GeoVec2fProperty::create();
            UInt8                    resolution;
            Real32                   minValue;
            Real32                   maxValue;
            UInt32                   propSize;

            gh.readQuantizedVectorPropertyHeader(
                rh, resolution, minValue, maxValue, propSize);
            gh.readQuantizedVectorProperty(
                rh, propTexCoords, fieldSize, resolution,
                minValue, maxValue, propSize             );

            geo->setProperty(propTexCoords, Geometry::NormalsIndex);
        }
        else
        {
            // 1.x Geometry has _sfVbo, it can be skipped

            readFieldContent(fieldName, fieldTypeName, fieldSize,
                             "'vbo'", ptrFieldIt                      );
        }
    }
}
Ejemplo n.º 29
0
/*!\fn void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, const std::string& FieldName)
 *
 * \brief Attach to the SingleField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL or there is no SingleField by the
 * given name on the container, then no changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldName The name of the field on the given container to attach
 * to.
 */
void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, const std::string& FieldName)
{
    setFieldName( FieldName );
    setContainer( TheContainer );
    commitChanges();
}
Ejemplo n.º 30
0
/*!\fn void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID)
 *
 * \brief Attach to the SingleField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL or there is no SingleField with the
 * given FieldID on the container, then no changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldID The ID of the field on the given container to attach
 * to.
 */
void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID)
{
    setFieldId( FieldID );
    setContainer( TheContainer );
    commitChanges();
}