bool BinOArchive::operator()(u64& value, const char* name, const char* label) { openNode(name); stream_.write(value); closeNode(name); return true; }
bool BinOArchive::operator()(const Serializer& ser, const char* name, const char* label) { openNode(name, false); ser(*this); closeNode(name, false); return true; }
bool BinOArchive::operator()(WStringInterface& value, const char* name, const char* label) { bool size8 = (wcslen(value.get()) + 1)*sizeof(wchar_t) < SIZE16; openNode(name, size8); stream_ << value.get(); stream_.write(wchar_t(0)); closeNode(name, size8); return true; }
bool BinOArchive::operator()(StringInterface& value, const char* name, const char* label) { bool size8 = strlen(value.get()) + 1 < SIZE16; openNode(name, size8); stream_ << value.get(); stream_.write(char(0)); closeNode(name, size8); return true; }
void CzpEditorView::OnEditOpen() { CListCtrl& listCtrl = GetListCtrl(); if (listCtrl.GetSelectedCount() > 1) { return; } ZpNode* node = getSelectedNode(); openNode(node); }
/* copy: * Create new object of type AGTYPE(obj) with all of its * attributes. * If obj is an edge, only create end nodes if necessary. * If obj is a graph, if g is null, create a top-level * graph. Otherwise, create a subgraph of g. * Assume obj != NULL. */ Agobj_t *copy(Agraph_t * g, Agobj_t * obj) { Agobj_t *nobj = 0; Agedge_t *e; Agnode_t *h; Agnode_t *t; int kind = AGTYPE(obj); char *name; if ((kind != AGRAPH) && !g) { exerror("NULL graph with non-graph object in copy()"); return 0; } switch (kind) { case AGNODE: name = agnameof(obj); nobj = (Agobj_t *) openNode(g, name); break; case AGRAPH: name = agnameof(obj); if (g) nobj = (Agobj_t *) openSubg(g, name); else nobj = (Agobj_t *) openG(name, ((Agraph_t *) obj)->desc); break; case AGINEDGE: case AGOUTEDGE: e = (Agedge_t *) obj; t = openNode(g, agnameof(agtail(e))); h = openNode(g, agnameof(aghead(e))); name = agnameof (AGMKOUT(e)); nobj = (Agobj_t *) openEdge(g, t, h, name); break; } if (nobj) copyAttr(obj, nobj); return nobj; }
void MapState::openNode(NodeData* node) { if(!node->complete){ node->complete = true; return; } for(auto item : node->adjacent) { openNode(item); } }
bool BinIArchive::operator()(char& value, const char* name, const char* label) { if(!strlen(name)){ read(value); return true; } if(!openNode(name)) return false; read(value); closeNode(name); return true; }
void CzpEditorView::OnDbClick(NMHDR *pNMHDR, LRESULT *pResult) { CListCtrl& listCtrl = GetListCtrl(); LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) pNMHDR; int selected = item->iItem; if (selected < 0 && selected >= listCtrl.GetItemCount()) { return; } ZpNode* node = (ZpNode*)listCtrl.GetItemData(selected); openNode(node); }
bool BinIArchive::operator()(const Serializer& ser, const char* name, const char* label) { if(!strlen(name)){ ser(*this); return true; } if(!openNode(name)) return false; ser(*this); closeNode(name, false); return true; }
bool BinIArchive::operator()(WStringInterface& value, const char* name, const char* label) { if(!strlen(name)){ wstringBuffer_.clear(); read(wstringBuffer_); value.set(wstringBuffer_.c_str()); return true; } if(!openNode(name)) return false; wstringBuffer_.clear(); read(wstringBuffer_); value.set(wstringBuffer_.c_str()); closeNode(name); return true; }
bool BinIArchive::operator()(PointerInterface& ptr, const char* name, const char* label) { if(strlen(name) && !openNode(name)) return false; string typeName; read(typeName); if(ptr.get() && (typeName.empty() || strcmp(typeName.c_str(), ptr.registeredTypeName()) != 0)) ptr.create(""); // 0 if(!typeName.empty() && !ptr.get()) ptr.create(typeName.c_str()); if(Serializer ser = ptr.serializer()) ser(*this); if(strlen(name)) closeNode(name); return true; }
/* clone: * Create new object of type AGTYPE(obj) with all of its * attributes and substructure. * If obj is an edge, end nodes are cloned if necessary. * If obj is a graph, if g is null, create a clone top-level * graph. Otherwise, create a clone subgraph of g. * Assume obj != NULL. */ Agobj_t *clone(Agraph_t * g, Agobj_t * obj) { Agobj_t *nobj = 0; Agedge_t *e; Agnode_t *h; Agnode_t *t; int kind = AGTYPE(obj); char *name = agnameof(obj); if ((kind != AGRAPH) && !g) { error(ERROR_FATAL, "NULL graph with non-graph object in clone()"); return 0; } switch (kind) { case AGNODE: /* same as copy node */ nobj = (Agobj_t *) openNode(g, name); if (nobj) copyAttr(obj, nobj); break; case AGRAPH: if (g) nobj = (Agobj_t *) openSubg(g, name); else nobj = (Agobj_t *) openG(name, ((Agraph_t *) obj)->desc); if (nobj) copyAttr(obj, nobj); cloneGraph((Agraph_t *) nobj, (Agraph_t *) obj); break; case AGEDGE: e = (Agedge_t *) obj; t = (Agnode_t *) clone(g, OBJ(agtail(e))); h = (Agnode_t *) clone(g, OBJ(aghead(e))); nobj = (Agobj_t *) openEdge(t, h, name); if (nobj) copyAttr(obj, nobj); break; } return nobj; }
bool BinOArchive::operator()(ContainerInterface& ser, const char* name, const char* label) { openNode(name, false); unsigned int size = (unsigned int)ser.size(); if(size < SIZE16) stream_.write((unsigned char)size); else if(size < 0x10000){ stream_.write(SIZE16); stream_.write((unsigned short)size); } else{ stream_.write(SIZE32); stream_.write(size); } if(strlen(name)){ if(size > 0){ int i = 0; do { char buffer[16]; #ifdef _MSC_VER _itoa(i++, buffer, 10); #else sprintf(buffer, "%d", i++); #endif ser(*this, buffer, ""); } while (ser.next()); } closeNode(name, false); } else{ if(size > 0) do ser(*this, "", ""); while (ser.next()); } return true; }
void MapState::events(sf::Event& event) { if(event.type == sf::Event::KeyPressed) { if(event.key.code == sf::Keyboard::Q){ auto node = nodes[0]; openNode(node); } if(event.key.code == sf::Keyboard::Escape) { mStado = GST_MENU; } } else if(event.type == sf::Event::MouseButtonPressed) { if(event.mouseButton.button == sf::Mouse::Left) { bool found = false; for(NodeData* item : nodes) { if( item->over ) { item->selected = true; found = true; break; } } if(found) for(NodeData* item : nodes) if(! item->over) item->selected = false; } } }
bool BinIArchive::operator()(ContainerInterface& ser, const char* name, const char* label) { if(strlen(name)){ if(!openNode(name)) return false; size_t size = currentBlock().readPackedSize(); ser.resize(size); if(size > 0){ int i = 0; do{ char buffer[16]; #ifdef _MSC_VER _itoa(i++, buffer, 10); #else sprintf(buffer, "%d", i++); #endif ser(*this, buffer, ""); } while(ser.next()); } closeNode(name); return true; } else{ size_t size = currentBlock().readPackedSize(); ser.resize(size); if(size > 0){ do ser(*this, "", ""); while(ser.next()); } return true; } }
bool BinOArchive::operator()(PointerInterface& ptr, const char* name, const char* label) { openNode(name, false); const char* typeName = ptr.registeredTypeName(); if (!typeName) typeName = ""; if (typeName[0] == '\0' && ptr.get()) { YASLI_ASSERT(0 && "Writing unregistered class. Use YASLI_CLASS_NAME macro for registration."); } TypeID baseType = ptr.baseType(); if(ptr.get()){ stream_ << typeName; stream_.write(char(0)); ptr.serializer()(*this); } else stream_.write(char(0)); closeNode(name, false); return true; }
/* VaultShopMain */ VaultShopMain::VaultShopMain() { // Basic Form Settings setWindowTitle("VaultShop " PLASMASHOP_VERSION); //setWindowIcon(QIcon(":/res/VaultShop.png")); // Set up actions fActions[kFileOpenVault] = new QAction(qStdIcon("document-open"), tr("&Load Vault..."), this); fActions[kFileSaveVault] = new QAction(qStdIcon("document-save"), tr("&Save Vault"), this); fActions[kFileExit] = new QAction(tr("E&xit"), this); fActions[kVaultOpenNode] = new QAction(tr("Subscribe to &Node..."), this); fActions[kNodeUnLink] = new QAction(tr("Remove"), this); fActions[kNodeLink] = new QAction(tr("Add Node..."), this); fActions[kNodeCreate] = new QAction(tr("Create Node"), this); fActions[kNodeUnsubscribe] = new QAction(tr("Un-subscribe"), this); //fActions[kNodeRenameVault] = new QAction(tr("Rename Vault..."), this); fActions[kFileOpenVault]->setShortcut(Qt::CTRL + Qt::Key_O); fActions[kFileSaveVault]->setShortcut(Qt::CTRL + Qt::Key_S); fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4); fActions[kVaultOpenNode]->setShortcut(Qt::Key_F2); // Main Menus QMenu* fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(fActions[kFileOpenVault]); fileMenu->addAction(fActions[kFileSaveVault]); fileMenu->addSeparator(); fileMenu->addAction(fActions[kFileExit]); QMenu* vaultMenu = menuBar()->addMenu(tr("&Vault")); vaultMenu->addAction(fActions[kVaultOpenNode]); // Toolbars QToolBar* fileTbar = addToolBar(tr("File Toolbar")); fileTbar->setObjectName("FileToolBar"); fileTbar->addAction(fActions[kFileOpenVault]); fileTbar->addAction(fActions[kFileSaveVault]); statusBar(); // Main Splitter QSplitter* splitter = new QSplitter(Qt::Horizontal, this); splitter->setObjectName("Splitter"); // Node Browser fVaultTree = new QTreeWidget(splitter); fVaultTree->setUniformRowHeights(true); fVaultTree->setHeaderHidden(true); fVaultTree->setContextMenuPolicy(Qt::CustomContextMenu); // Property Editor fNodeTab = new QTabWidget(splitter); fGenericEditor = new QVaultNode(fNodeTab); fNodeTab->addTab(fGenericEditor, tr("Node Properties")); fCustomEditor = NULL; fSavEditor = NULL; fEditorTabPreference = 0; // Layout splitter->addWidget(fVaultTree); splitter->addWidget(fNodeTab); setCentralWidget(splitter); splitter->setSizes(QList<int>() << 160 << 320); // Global UI Signals connect(fActions[kFileExit], SIGNAL(triggered()), this, SLOT(close())); connect(fActions[kFileOpenVault], SIGNAL(triggered()), this, SLOT(openGame())); connect(fActions[kFileSaveVault], SIGNAL(triggered()), this, SLOT(performSave())); connect(fActions[kVaultOpenNode], SIGNAL(triggered()), this, SLOT(openNode())); connect(fActions[kNodeUnLink], SIGNAL(triggered()), this, SLOT(unlinkNode())); connect(fActions[kNodeLink], SIGNAL(triggered()), this, SLOT(linkNode())); connect(fActions[kNodeCreate], SIGNAL(triggered()), this, SLOT(createNode())); connect(fActions[kNodeUnsubscribe], SIGNAL(triggered()), this, SLOT(closeNode())); //connect(fActions[kNodeRenameVault], SIGNAL(triggered()), this, SLOT(renameVault())); connect(fVaultTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(treeItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(fVaultTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(treeContextMenu(const QPoint&))); connect(fNodeTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); connect(fGenericEditor, SIGNAL(typeModified()), this, SLOT(typeModified())); connect(this, SIGNAL(nodeChanged(unsigned int)), this, SLOT(refreshNode(unsigned int))); // Load UI Settings QSettings settings("PlasmaShop", "VaultShop"); resize(settings.value("WinSize", QSize(480, 600)).toSize()); if (settings.contains("WinPos")) move(settings.value("WinPos").toPoint()); if (settings.value("WinMaximized", false).toBool()) showMaximized(); if (settings.contains("WinState")) restoreState(settings.value("WinState").toByteArray()); fLastDir = settings.value("LastDir").toString(); if (!fLastDir.isEmpty()) loadGame(fLastDir); }