void SharedContext::select(int id) { sync(); toolBar->clear(); propertiesMenu.select(-1); auto itOld = nodes.find(currentNodeID); if (itOld != nodes.end() && itOld->second.props) { itOld->second.props->detach(); propertiesMenu.remove(currentNodeID); } currentNodeID = id; auto it = nodes.find(id); if (it == nodes.end() || !it->second.props) { propertiesMenuArea.update(); return; } if (!propertiesMenu.has(id)) { Layout layout = loadObj<Layout>("ui\\PropertiesLayout.json"); const auto& props = nodes[id].props; nodes[id].props->attach(makeRaw(layout)); propertiesMenu.insert(props->id, layout); } propertiesMenu.select(id); for (const auto& keyAndButton : it->second.callbacks) toolBar->addButton(keyAndButton.first, keyAndButton.second); propertiesMenuArea.update(); }
void termInit(int numTerms) { int master, slave; char ptyName[100]; char ptyTitle[100]; struct termios termios; int i; numTerminals = numTerms; for (i = 0; i < numTerminals; i++) { /* open pseudo terminal */ if (openPty(&master, &slave, ptyName) < 0) { error("cannot open pseudo terminal %d", i); } if (debug) { cPrintf("pseudo terminal '%s': master fd = %d, slave fd = %d\n", ptyName, master, slave); } /* set mode to raw */ tcgetattr(slave, &termios); makeRaw(&termios); tcsetattr(slave, TCSANOW, &termios); /* fork and exec a new xterm */ terminals[i].pid = fork(); if (terminals[i].pid < 0) { error("cannot fork xterm process %d", i); } if (terminals[i].pid == 0) { char geo[20]; /* terminal process */ setpgid(0, 0); close(2); close(master); /* it's annoying to have to adjust the window-position every time eco-sim starts :) */ sprintf(geo, "+%d+%d", 1600 + (i % 2) * 500,(i / 2) * 400); sprintf(ptyName, "-Sab%d", slave); sprintf(ptyTitle, "ECO32 Terminal %d", i); execlp("xterm", "xterm", "-geo", geo, "-title", ptyTitle, ptyName, NULL); error("cannot exec xterm process %d", i); } terminals[i].in = fdopen(master, "r"); setvbuf(terminals[i].in, NULL, _IONBF, 0); terminals[i].out = fdopen(master, "w"); setvbuf(terminals[i].out, NULL, _IONBF, 0); /* skip the window id written by xterm */ while (fgetc(terminals[i].in) != '\n') ; } termReset(); }
wyTexture2D* wyTexture2D::makeRaw(const char* data, int width, int height) { return makeRaw(data, width, height, wyTextureManager::getInstance()->getTexturePixelFormat()); }