void KStars::defaultZoom() { map()->slotZoomDefault(); }
void OpenPSTD::GUI::DGResults::UpdateScene(const std::shared_ptr<OpenPSTD::GUI::Model> &m, std::unique_ptr<QOpenGLFunctions, void (*)(void *)> const &f) { program->bind(); if(m->view->IsChanged()) { program->setUniformValue("u_view", m->view->viewMatrix); } auto doc = m->documentAccess->GetDocument(); if(m->interactive->visibleFrame >= 0 && m->interactive->visibleFrame < doc->GetResultsDGFrameCount()) { if (m->documentAccess->IsChanged()) { auto conf = doc->GetResultsSceneConf(); std::vector<QVector2D> positions; positions.reserve(conf->DGIndices.size() * 3); MinMaxValue minMaxPos; for (int i = 0; i < conf->DGIndices.size(); ++i) { //create the 3 points QVector2D p1(conf->DGVertices[conf->DGIndices[i][0]](0), conf->DGVertices[conf->DGIndices[i][0]](1)); QVector2D p2(conf->DGVertices[conf->DGIndices[i][1]](0), conf->DGVertices[conf->DGIndices[i][1]](1)); QVector2D p3(conf->DGVertices[conf->DGIndices[i][2]](0), conf->DGVertices[conf->DGIndices[i][2]](1)); //update min max values minMaxPos = MinMaxValue::Combine(minMaxPos, MinMaxValue(p1, p2)); //add to vector positions.push_back(p1); positions.push_back(p2); positions.push_back(p3); } triangles = conf->DGIndices.size(); this->minMaxPos = minMaxPos; f->glBindBuffer(GL_ARRAY_BUFFER, this->positionsBuffer); f->glBufferData(GL_ARRAY_BUFFER, positions.size() * sizeof(QVector2D), positions.data(), GL_STATIC_DRAW); } if (m->interactive->IsChanged()) { Kernel::DG_FRAME_PTR frame = doc->GetResultsDGFrameCorner(m->interactive->visibleFrame); std::vector<float> values(frame->rows() * frame->cols()); Eigen::Map<Kernel::DG_FRAME> map(values.data(), frame->rows(), frame->cols()); map = *frame; f->glBindBuffer(GL_ARRAY_BUFFER, this->valuesBuffer); f->glBufferData(GL_ARRAY_BUFFER, values.size() * sizeof(float), values.data(), GL_DYNAMIC_DRAW); valuesInitialized = true; } } }
/* * Get a line into genbuf after gcursor. * Cnt limits the number of input characters * accepted and is used for handling the replace * single character command. Aescaped is the location * where we stick a termination indicator (whether we * ended with an ESCAPE or a newline/return. * * We do erase-kill type processing here and also * are careful about the way we do this so that it is * repeatable. (I.e. so that your kill doesn't happen, * when you repeat an insert if it was escaped with \ the * first time you did it. commch is the command character * involved, including the prompt for readline. */ char * vgetline(int cnt, char *gcursor, bool *aescaped, int commch) { register int c, ch; register char *cp; int x, y, iwhite, backsl=0; char *iglobp; char cstr[2]; void (*OO)() = Outchar; /* * Clear the output state and counters * for autoindent backwards motion (counts of ^D, etc.) * Remember how much white space at beginning of line so * as not to allow backspace over autoindent. */ *aescaped = 0; ogcursor = gcursor; flusho(); CDCNT = 0; HADUP = 0; HADZERO = 0; gobbled = 0; iwhite = whitecnt(genbuf); iglobp = vglobp; /* * Carefully avoid using vinschar in the echo area. */ if (splitw) Outchar = vputchar; else { Outchar = vinschar; vprepins(); } for (;;) { backsl = 0; if (gobblebl) gobblebl--; if (cnt != 0) { cnt--; if (cnt == 0) goto vadone; } c = getkey(); if (c != ATTN) c &= (QUOTE|TRIM); ch = c; maphopcnt = 0; if (vglobp == 0 && Peekkey == 0 && commch != 'r') while ((ch = map(c, immacs)) != c) { c = ch; if (!value(REMAP)) break; if (++maphopcnt > 256) error("Infinite macro loop"); } if (!iglobp) { /* * Erase-kill type processing. * Only happens if we were not reading * from untyped input when we started. * Map users erase to ^H, kill to -1 for switch. */ #ifndef USG3TTY if (c == tty.sg_erase) c = CTRL('h'); else if (c == tty.sg_kill) c = -1; #else if (c == tty.c_cc[VERASE]) c = CTRL('h'); else if (c == tty.c_cc[VKILL]) c = -1; #endif switch (c) { /* * ^? Interrupt drops you back to visual * command mode with an unread interrupt * still in the input buffer. * * ^\ Quit does the same as interrupt. * If you are a ex command rather than * a vi command this will drop you * back to command mode for sure. */ case ATTN: case QUIT: ungetkey(c); goto vadone; /* * ^H Backs up a character in the input. * * BUG: Can't back around line boundaries. * This is hard because stuff has * already been saved for repeat. */ case CTRL('h'): bakchar: cp = gcursor - 1; if (cp < ogcursor) { if (splitw) { /* * Backspacing over readecho * prompt. Pretend delete but * don't beep. */ ungetkey(c); goto vadone; } beep(); continue; } goto vbackup; /* * ^W Back up a white/non-white word. */ case CTRL('w'): wdkind = 1; for (cp = gcursor; cp > ogcursor && isspace((int)cp[-1]); cp--) continue; for (c = wordch(cp - 1); cp > ogcursor && wordof(c, cp - 1); cp--) continue; goto vbackup; /* * users kill Kill input on this line, back to * the autoindent. */ case -1: cp = ogcursor; vbackup: if (cp == gcursor) { beep(); continue; } endim(); *cp = 0; c = cindent(); vgotoCL(qcolumn(cursor - 1, genbuf)); if (doomed >= 0) doomed += c - cindent(); gcursor = cp; continue; /* * \ Followed by erase or kill * maps to just the erase or kill. */ case '\\': x = destcol, y = destline; ex_putchar('\\'); vcsync(); c = getkey(); #ifndef USG3TTY if (c == tty.sg_erase || c == tty.sg_kill) #else if (c == tty.c_cc[VERASE] || c == tty.c_cc[VKILL]) #endif { vgoto(y, x); if (doomed >= 0) doomed++; goto def; } ungetkey(c), c = '\\'; backsl = 1; break; /* * ^Q Super quote following character * Only ^@ is verboten (trapped at * a lower level) and \n forces a line * split so doesn't really go in. * * ^V Synonym for ^Q */ case CTRL('q'): case CTRL('v'): x = destcol, y = destline; ex_putchar('^'); vgoto(y, x); c = getkey(); #if 0 /*def TIOCSETC*/ if (c == ATTN) c = nttyc.t_intrc; #endif if (c != NL) { if (doomed >= 0) doomed++; goto def; } break; } } /* * If we get a blank not in the echo area * consider splitting the window in the wrapmargin. */ if (c != NL && !splitw) { if (c == ' ' && gobblebl) { gobbled = 1; continue; } if (value(WRAPMARGIN) && (outcol >= OCOLUMNS - value(WRAPMARGIN) || (backsl && outcol==0)) && commch != 'r') { /* * At end of word and hit wrapmargin. * Move the word to next line and keep going. */ wdkind = 1; *gcursor++ = c; if (backsl) *gcursor++ = getkey(); *gcursor = 0; /* * Find end of previous word if we are past it. */ for (cp=gcursor; cp>ogcursor && isspace((int)cp[-1]); cp--) ; if (outcol+(backsl?OCOLUMNS:0) - (gcursor-cp) >= OCOLUMNS - value(WRAPMARGIN)) { /* * Find beginning of previous word. */ for (; cp>ogcursor && !isspace((int)cp[-1]); cp--) ; if (cp <= ogcursor) { /* * There is a single word that * is too long to fit. Just * let it pass, but beep for * each new letter to warn * the luser. */ c = *--gcursor; *gcursor = 0; beep(); goto dontbreak; } /* * Save it for next line. */ macpush(cp, 0); cp--; } macpush("\n", 0); /* * Erase white space before the word. */ while (cp > ogcursor && isspace((int)cp[-1])) cp--; /* skip blank */ gobblebl = 3; goto vbackup; } dontbreak:; } /* * Word abbreviation mode. */ cstr[0] = c; if (anyabbrs && gcursor > ogcursor && !wordch(cstr) && wordch(gcursor-1)) { int wdtype, abno; cstr[1] = 0; wdkind = 1; cp = gcursor - 1; for (wdtype = wordch(cp - 1); cp > ogcursor && wordof(wdtype, cp - 1); cp--) ; *gcursor = 0; for (abno=0; abbrevs[abno].mapto; abno++) { if (eq(cp, abbrevs[abno].cap)) { macpush(cstr, 0); macpush(abbrevs[abno].mapto, 0); goto vbackup; } } } switch (c) { /* * ^M Except in repeat maps to \n. */ case CR: if (vglobp) goto def; c = '\n'; /* presto chango ... */ /* * \n Start new line. */ case NL: *aescaped = c; goto vadone; /* * escape End insert unless repeat and more to repeat. */ case ESCAPE: if (lastvgk) goto def; goto vadone; /* * ^D Backtab. * ^T Software forward tab. * * Unless in repeat where this means these * were superquoted in. */ case CTRL('d'): case CTRL('t'): if (vglobp) goto def; /* fall into ... */ /* * ^D|QUOTE Is a backtab (in a repeated command). */ case CTRL('d') | QUOTE: *gcursor = 0; cp = vpastwh(genbuf); c = whitecnt(genbuf); if (ch == CTRL('t')) { /* * ^t just generates new indent replacing * current white space rounded up to soft * tab stop increment. */ if (cp != gcursor) /* * BUG: Don't hack ^T except * right after initial * white space. */ continue; cp = genindent(iwhite = backtab(c + value(SHIFTWIDTH) + 1)); ogcursor = cp; goto vbackup; } /* * ^D works only if we are at the (end of) the * generated autoindent. We count the ^D for repeat * purposes. */ if (c == iwhite && c != 0) { if (cp == gcursor) { iwhite = backtab(c); CDCNT++; ogcursor = cp = genindent(iwhite); goto vbackup; } else if (&cp[1] == gcursor && (*cp == '^' || *cp == '0')) { /* * ^^D moves to margin, then back * to current indent on next line. * * 0^D moves to margin and then * stays there. */ HADZERO = *cp == '0'; ogcursor = cp = genbuf; HADUP = 1 - HADZERO; CDCNT = 1; endim(); back1(); vputchar(' '); goto vbackup; } } if (vglobp && vglobp - iglobp >= 2 && (vglobp[-2] == '^' || vglobp[-2] == '0') && gcursor == ogcursor + 1) goto bakchar; continue; default: /* * Possibly discard control inputs. */ if (!vglobp && junk(c)) { beep(); continue; } def: if (!backsl) { ex_putchar(c); flush(); } if (gcursor > &genbuf[LBSIZE - 2]) error("Line too long"); *gcursor++ = c & TRIM; vcsync(); if (value(SHOWMATCH) && !iglobp) if (c == ')' || c == '}') lsmatch(gcursor); continue; } } vadone: *gcursor = 0; if (Outchar != termchar) Outchar = OO; endim(); return (gcursor); }
void Vbo::resizeVbo(size_t newCapacity) { VboState oldState = m_state; unsigned char* temp = NULL; MemBlock::List memBlocks; if (m_vboId != 0 && m_freeCapacity < m_totalCapacity) { VboBlock* currentBlock = m_first; size_t totalLength = 0; while (currentBlock != NULL) { while (currentBlock != NULL && currentBlock->free()) currentBlock = currentBlock->m_next; if (currentBlock != NULL) { size_t start = currentBlock->address(); size_t length = 0; while (currentBlock != NULL && !currentBlock->free()) { length += currentBlock->capacity(); currentBlock = currentBlock->m_next; } memBlocks.push_back(MemBlock(start, length)); totalLength += length; } } if (m_state < VboActive) activate(); if (m_state < VboMapped) map(); temp = new unsigned char[totalLength]; size_t offset = 0; MemBlock::List::const_iterator it, end; for (it = memBlocks.begin(), end = memBlocks.end(); it != end; ++it) { const MemBlock& memBlock = *it; memcpy(temp + offset, m_buffer + memBlock.start, memBlock.length); offset += memBlock.length; } } size_t addedCapacity = newCapacity - m_totalCapacity; m_freeCapacity = newCapacity - (m_totalCapacity - m_freeCapacity); m_totalCapacity = newCapacity; if (m_last->free()) { resizeBlock(*m_last, m_last->capacity() + addedCapacity); } else { VboBlock* block = new VboBlock(*this, m_last->address() + m_last->capacity(), addedCapacity); block->insertBetween(m_last, NULL); insertFreeBlock(*block); } if (m_vboId != 0) { if (m_state == VboMapped) unmap(); if (m_state == VboActive) deactivate(); glDeleteBuffers(1, &m_vboId); m_vboId = 0; } if (temp != NULL) { assert(!memBlocks.empty()); if (m_state < VboActive) activate(); if (m_state < VboMapped) map(); size_t offset = 0; MemBlock::List::const_iterator it, end; for (it = memBlocks.begin(), end = memBlocks.end(); it != end; ++it) { const MemBlock& memBlock = *it; memcpy(m_buffer + memBlock.start, temp + offset, memBlock.length); } delete [] temp; temp = NULL; memBlocks.clear(); if (oldState < VboMapped) unmap(); if (oldState < VboActive) deactivate(); } else { if (oldState > VboInactive && m_state < VboActive) activate(); if (oldState > VboActive && m_state < VboMapped) map(); } #ifdef _DEBUG_VBO checkBlockChain(); checkFreeBlocks(); #endif }
// as in the Java version, we show simple recursive solutions because // the loop-based ones require mutation and previous pointers. // But the more important point is the explicit env field passed to the // function pointer list_t * map(void* (*f)(void*,void*), void* env, list_t * xs) { if(xs==NULL) return NULL; return makelist(f(env,xs->head), map(f,env,xs->tail)); }
void gameDialog::render() { static bool first = true; // Only true first time function is called // Clear list of special effects. It will be added again automatically every frame gShadows.Clear(); gFogs.Clear(); gPlayer.UpdatePositionSmooth(); // Can't select objects that are dead if (fSelectedObject && (fSelectedObject->IsDead() || !fSelectedObject->InGame())) ClearSelection(); glm::vec3 playerOffset = gPlayer.GetOffsetToChunk(); gViewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -fCameraDistance)); gViewMatrix = glm::rotate(gViewMatrix, _angleVert, glm::vec3(1.0f, 0.0f, 0.0f)); gViewMatrix = glm::rotate(gViewMatrix, _angleHor, glm::vec3(0.0f, 1.0f, 0.0f)); gViewMatrix = glm::translate(gViewMatrix, -playerOffset); glm::mat4 T1 = glm::translate(glm::mat4(1), playerOffset); glm::mat4 R1 = glm::rotate(glm::mat4(1), _angleVert, glm::vec3(-1.0f, 0.0f, 0.0f)); glm::mat4 R2 = glm::rotate(glm::mat4(1), _angleHor, glm::vec3(0.0f, -1.0f, 0.0f)); glm::mat4 T2 = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, fCameraDistance)); glm::vec4 camera = T1 * R2 * R1 * T2 * glm::vec4(0,0,0,1); gUniformBuffer.Camera(camera); gDrawnQuads = 0; gNumDraw = 0; gUniformBuffer.Update(); if (first) { gBillboard.InitializeTextures(fShader); } fRenderControl->Draw(fSelectedObject, fUnderWater, this->ThirdPersonView(), fSelectedObject, fDrawMap && !gDebugOpenGL, fMapWidth); //========================================================================= // Various effects drawn after the deferred shader //========================================================================= if (!fDrawMap) { this->DrawPlayerStats(); if (fShowWeapon && gMode.Get() != GameMode::CONSTRUCT && !fShowInventory && !this->ThirdPersonView()) this->DrawWeapon(); static bool wasDead = false; if (gPlayer.IsDead() && !wasDead) { wasDead = true; fShowMainDialog = true; fHideDialog = false; dialog::DispatchDraw(fDrawTexture, 1.0f, new MessageDialog("Oops", "You are dead.\n\nYou will be revived, and transported back to your starting place.\n\nThe place can be changed with a scroll of resurrection point.", revive)); this->ClearForDialog(); } else if (fShowInventory) gInventory.DrawInventory(fDrawTexture); else if (fShowMainDialog) dialog::DispatchDraw(fDrawTexture, fHideDialog ? 0.5f : 1.0f); else if (sgPopup.length() > 0) { // There are some messages that shall be shown in a popup dialog. fShowMainDialog = true; fHideDialog = false; dialog::DispatchDraw(fDrawTexture, 1.0f, new MessageDialog(sgPopupTitle, sgPopup, 0)); sgPopupTitle = "Ephenation"; // Reset to default. sgPopup.clear(); this->ClearForDialog(); } if (!gPlayer.IsDead()) wasDead = false; DrawCompassRose(); } if (fDrawMap && gDebugOpenGL) { // Very inefficient algorithm, computing the map every frame. std::unique_ptr<Map> map(new Map); float alpha = 1.0f; if (!sShowAlternateBitmap) sTextureIterator = gDebugTextures.begin(); glBindTexture(GL_TEXTURE_2D, *sTextureIterator); // Override map->Draw(alpha); } if (fSelectedObject) { fSelectedObject->RenderHealthBar(fHealthBar, _angleHor); } gOtherPlayers.RenderPlayerStats(fHealthBar, _angleHor); bool newHealing = false; if (gPlayer.fFlags & UserFlagHealed) { newHealing = true; gPlayer.fFlags &= ~UserFlagHealed; } this->DrawHealingAnimation(newHealing); char buff[1000]; // TODO: Ugly way to create dynamic strings static double slAverageFps = 0.0; double tm = gCurrentFrameTime; static double prevTime = 0.0; double deltaTime = tm - prevTime; // Use a decay filter on the FPS slAverageFps = 0.97*slAverageFps + 0.03/deltaTime; prevTime = tm; if (gMode.Get() == GameMode::TELEPORT) { TeleportClick(fHealthBar, _angleHor, renderViewAngle, 0, 0, false); } //========================================================================= // Various text messages //========================================================================= { // A big chunk with text drawing. But first some background to improve contrast. int yOffset = Options::fgOptions.fFontSize*2; float totalWinHeight = gViewport[3]; // Measured in pixels glm::mat4 model = glm::translate(glm::mat4(1.0f), glm::vec3(-1.0f, 1.0f - yOffset*2/totalWinHeight, 0.0f)); float yScale = yOffset*2/totalWinHeight; model = glm::scale(model, glm::vec3(2.0f, yScale, 1.0f)); this->fHealthBar->DrawSquare(model, 0.0f, 0.0f, 0.0f, 0.3f); // Draw a black square, almost transparent, as a background gDrawFont.Enable(); gDrawFont.UpdateProjection(); sprintf(buff, "Level %ld, Hp %d%%, Exp %d%%", gPlayer.fLevel, (int)(gPlayer.fHp * 100), (int)(gPlayer.fExp * 100)); gDrawFont.vsfl.prepareSentence(fPlayerStatusSentence, buff); int w = int(strlen(buff)*Options::fgOptions.fFontSize*0.8f); // An approximation gDrawFont.SetOffset(gViewport[2]-w, 0); gDrawFont.vsfl.renderSentence(fPlayerStatusSentence); if (gCurrentPing == 0.0) sprintf(buff, "Triangles %7d, draw calls %d. Fps %03d", gDrawnQuads, gNumDraw, int(slAverageFps)); else sprintf(buff, "Triangles %7d, draw calls %d. Fps %03d, ping %.1f ms", gDrawnQuads, gNumDraw, int(slAverageFps), gCurrentPing*1000.0); gDrawFont.SetOffset(0,0); gDrawFont.vsfl.prepareSentence(fFPSsentence, buff); gDrawFont.vsfl.renderSentence(fFPSsentence); if (gMode.Get() == GameMode::CONSTRUCT) { ChunkCoord cc; gPlayer.GetChunkCoord(&cc); const chunk *cp = ChunkFind(&cc, false); unsigned int uid = 1000000; shared_ptr<ChunkBlocks> cb; if (cp) cb = cp->fChunkBlocks; if (cb) uid = cb->fOwner; gDrawFont.SetOffset(0,float(yOffset)); sprintf(buff, "Construction mode, Chunk (%d,%d,%d) offset: %.1f,%.1f,%.1f, coord(%.1f,%.1f,%.1f) owner %d", cc.x, cc.y, cc.z, playerOffset.x, playerOffset.y, playerOffset.z, gPlayer.x/100.0, gPlayer.y/100.0, gPlayer.z/100.0, uid); gDrawFont.vsfl.renderAndDiscard(buff); } if (fEnterDebugText) { int bottomLine = gViewport[3]-25; gDrawFont.SetOffset(0, float(bottomLine)); gDrawFont.vsfl.renderSentence(fInputPromptSentence); } gDrawFont.Disable(); gScrollingMessages.Update(); } if (!fDrawMap && !fShowInventory && (!fShowMainDialog || fHideDialog)) { if (gShowMsgWindow) gMsgWindow.Render(); if (gMode.Get() == GameMode::CONSTRUCT) fBuildingBlocks->Draw(gProjectionMatrix); } if (gDebugOpenGL) { checkError("gameDialog::render debug", false); static double prevPrint = 0.0; if (gCurrentFrameTime > prevPrint + 5.0) { if (gToggleTesting) WorstTime::Report(); else TimeMeasure::Report(); prevPrint = gCurrentFrameTime; } } chunk::DegradeBusyList_gl(); first = false; }
void MainWindow::setlabel() { int count = 0; for(int row = 0 ; row<10 ; row++) { for(int col = 0 ; col<10 ; col++) { buttons.append(new QPushButton); ui->gridLayout->addWidget(buttons[count],row,col); setImage(gobj.arr[row][col] , buttons[count]); signalMapper = new QSignalMapper(this); connect(buttons[count], SIGNAL(clicked()) , signalMapper , SLOT(map())); signalMapper->setMapping(buttons[count],count); connect(signalMapper, SIGNAL(mapped(int)),this, SLOT(on_pushButton_clicked(int))); count++; } } ui->gridLayoutWidget->setLayout(ui->gridLayout); }
ArrangerView::ArrangerView(QWidget* parent) : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window) { setWindowTitle(tr("MusE: Arranger")); setFocusPolicy(Qt::NoFocus); arranger = new Arranger(this, "arranger"); setCentralWidget(arranger); //setFocusProxy(arranger); scoreOneStaffPerTrackMapper = new QSignalMapper(this); scoreAllInOneMapper = new QSignalMapper(this); editSignalMapper = new QSignalMapper(this); // Toolbars --------------------------------------------------------- editTools = new EditToolBar(this, arrangerTools); addToolBar(editTools); editTools->setObjectName("arrangerTools"); visTracks = new VisibleTracks(this); addToolBar(visTracks); connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); connect(visTracks, SIGNAL(visibilityChanged()), MusEGlobal::song, SLOT(update()) ); connect(arranger, SIGNAL(editPart(MusECore::Track*)), MusEGlobal::muse, SLOT(startEditor(MusECore::Track*))); connect(arranger, SIGNAL(dropSongFile(const QString&)), MusEGlobal::muse, SLOT(loadProjectFile(const QString&))); connect(arranger, SIGNAL(dropMidiFile(const QString&)), MusEGlobal::muse, SLOT(importMidi(const QString&))); connect(arranger, SIGNAL(startEditor(MusECore::PartList*,int)), MusEGlobal::muse, SLOT(startEditor(MusECore::PartList*,int))); connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), arranger, SLOT(configChanged())); connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int))); connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t))); //-------- Edit Actions editDeleteAction = new QAction(QIcon(*deleteIcon), tr("D&elete"), this); editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this); editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("Copy in range"), this); editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); editPasteToTrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to selected &track"), this); editPasteCloneToTrackAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to selected trac&k"), this); editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialo&g)"), this); editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this); editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); editDuplicateSelTrackAction = new QAction(QIcon(*edit_track_addIcon), tr("Duplicate Selected Tracks"), this); editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); editExpandPartsAction = new QAction(tr("Expand selected parts"), this); editCleanPartsAction = new QAction(tr("Purge hidden events from selected parts"), this); addTrack = new QMenu(tr("Add Track"), this); addTrack->setIcon(QIcon(*edit_track_addIcon)); select = new QMenu(tr("Select"), this); select->setIcon(QIcon(*selectIcon)); editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this); editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this); editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this); editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this); editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this); editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this); scoreSubmenu = new QMenu(tr("Score"), this); scoreSubmenu->setIcon(QIcon(*scoreIconSet)); scoreAllInOneSubsubmenu = new QMenu(tr("all tracks in one staff"), this); scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per track"), this); scoreSubmenu->addMenu(scoreAllInOneSubsubmenu); scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu); updateScoreMenus(); startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this); startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this); startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this); startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this); startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this); master = new QMenu(tr("Mastertrack"), this); master->setIcon(QIcon(*edit_mastertrackIcon)); masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this); masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this); midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); //-------- Structure Actions strGlobalCutAction = new QAction(tr("Global Cut"), this); strGlobalInsertAction = new QAction(tr("Global Insert"), this); strGlobalSplitAction = new QAction(tr("Global Split"), this); strGlobalCutSelAction = new QAction(tr("Global Cut - selected tracks"), this); strGlobalInsertSelAction = new QAction(tr("Global Insert - selected tracks"), this); strGlobalSplitSelAction = new QAction(tr("Global Split - selected tracks"), this); //------------------------------------------------------------- // popup Edit //------------------------------------------------------------- QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); menuEdit->addAction(editDeleteAction); menuEdit->addAction(editCutAction); menuEdit->addAction(editCopyAction); menuEdit->addAction(editCopyRangeAction); menuEdit->addAction(editPasteAction); menuEdit->addAction(editPasteToTrackAction); menuEdit->addAction(editPasteCloneAction); menuEdit->addAction(editPasteCloneToTrackAction); menuEdit->addAction(editPasteDialogAction); menuEdit->addAction(editInsertEMAction); menuEdit->addSeparator(); menuEdit->addAction(editShrinkPartsAction); menuEdit->addAction(editExpandPartsAction); menuEdit->addAction(editCleanPartsAction); menuEdit->addSeparator(); menuEdit->addAction(editDeleteSelectedAction); menuEdit->addMenu(addTrack); menuEdit->addAction(editDuplicateSelTrackAction); menuEdit->addMenu(select); select->addAction(editSelectAllAction); select->addAction(editDeselectAllAction); select->addAction(editInvertSelectionAction); select->addAction(editInsideLoopAction); select->addAction(editOutsideLoopAction); select->addAction(editAllPartsAction); menuEdit->addSeparator(); menuEdit->addAction(startPianoEditAction); menuEdit->addMenu(scoreSubmenu); menuEdit->addAction(startScoreEditAction); menuEdit->addAction(startDrumEditAction); menuEdit->addAction(startListEditAction); menuEdit->addAction(startWaveEditAction); menuEdit->addMenu(master); master->addAction(masterGraphicAction); master->addAction(masterListAction); menuEdit->addSeparator(); menuEdit->addAction(midiTransformerAction); QMenu* menuStructure = menuEdit->addMenu(tr("&Structure")); menuStructure->addAction(strGlobalCutAction); menuStructure->addAction(strGlobalInsertAction); menuStructure->addAction(strGlobalSplitAction); menuStructure->addSeparator(); menuStructure->addAction(strGlobalCutSelAction); menuStructure->addAction(strGlobalInsertSelAction); menuStructure->addAction(strGlobalSplitSelAction); QMenu* functions_menu = menuBar()->addMenu(tr("Functions")); QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize Notes"), editSignalMapper, SLOT(map())); QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), editSignalMapper, SLOT(map())); QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), editSignalMapper, SLOT(map())); QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), editSignalMapper, SLOT(map())); QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), editSignalMapper, SLOT(map())); QAction* func_erase_action = functions_menu->addAction(tr("Erase Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_move_action = functions_menu->addAction(tr("Move Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Note Length"), editSignalMapper, SLOT(map())); QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlapping Notes"), editSignalMapper, SLOT(map())); QAction* func_legato_action = functions_menu->addAction(tr("Legato"), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(func_quantize_action, CMD_QUANTIZE); editSignalMapper->setMapping(func_notelen_action, CMD_NOTELEN); editSignalMapper->setMapping(func_velocity_action, CMD_VELOCITY); editSignalMapper->setMapping(func_cresc_action, CMD_CRESCENDO); editSignalMapper->setMapping(func_transpose_action, CMD_TRANSPOSE); editSignalMapper->setMapping(func_erase_action, CMD_ERASE); editSignalMapper->setMapping(func_move_action, CMD_MOVE); editSignalMapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); editSignalMapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); editSignalMapper->setMapping(func_legato_action, CMD_LEGATO); QMenu* menuSettings = menuBar()->addMenu(tr("Window &Config")); menuSettings->addAction(tr("Configure &custom columns"), this, SLOT(configCustomColumns())); menuSettings->addSeparator(); menuSettings->addAction(subwinAction); menuSettings->addAction(shareAction); menuSettings->addAction(fullscreenAction); //-------- Edit connections connect(editDeleteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyRangeAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDuplicateSelTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(editDeleteAction, CMD_DELETE); editSignalMapper->setMapping(editCutAction, CMD_CUT); editSignalMapper->setMapping(editCopyAction, CMD_COPY); editSignalMapper->setMapping(editCopyRangeAction, CMD_COPY_RANGE); editSignalMapper->setMapping(editPasteAction, CMD_PASTE); editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); editSignalMapper->setMapping(editPasteToTrackAction, CMD_PASTE_TO_TRACK); editSignalMapper->setMapping(editPasteCloneToTrackAction, CMD_PASTE_CLONE_TO_TRACK); editSignalMapper->setMapping(editPasteDialogAction, CMD_PASTE_DIALOG); editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); editSignalMapper->setMapping(editDuplicateSelTrackAction, CMD_DUPLICATE_TRACK); editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP); editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP); editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS); connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); connect(startPianoEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startPianoroll())); connect(startScoreEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startScoreQuickly())); connect(startDrumEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startDrumEditor())); connect(startListEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startListEditor())); connect(startWaveEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startWaveEditor())); connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_allInOne(QWidget*))); connect(masterGraphicAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startMasterEditor())); connect(masterListAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startLMasterEditor())); connect(midiTransformerAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startMidiTransformer())); //-------- Structure connections connect(strGlobalCutAction, SIGNAL(triggered()), SLOT(globalCut())); connect(strGlobalInsertAction, SIGNAL(triggered()), SLOT(globalInsert())); connect(strGlobalSplitAction, SIGNAL(triggered()), SLOT(globalSplit())); connect(strGlobalCutSelAction, SIGNAL(triggered()), SLOT(globalCutSel())); connect(strGlobalInsertSelAction, SIGNAL(triggered()), SLOT(globalInsertSel())); connect(strGlobalSplitSelAction, SIGNAL(triggered()), SLOT(globalSplitSel())); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(updateShortcuts())); QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged())); finalizeInit(); // work around for probable QT/WM interaction bug. // for certain window managers, e.g xfce, this window is // is displayed although not specifically set to show(); // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) // Nov 21, 2012 Hey this causes the thing not to open at all, EVER, on Lubuntu and some others! // And we had a request to remove this from a knowledgable tester. REMOVE Tim. ///show(); ///hide(); }
void render(BeagleRTContext *context, void *userData) { /* Step 2: use gReadPointer to play a drum sound */ if (gStartup > 0) { gXCalibrate = 0.42; gYCalibrate = 0.42; gZCalibrate = 0.42; gStartup--; gShouldPlayFill = 0; rt_printf("Callibration: X: %f\tY: %f\tZ: %f\n", gXCalibrate, gYCalibrate, gZCalibrate); } for (int n = 0; n < context->digitalFrames; n++) { // initialize output float output = 0.0; // check button state and change gIsPlaying if just pressed int button1State = digitalReadFrame(context, n, buttonPin1); if (button1State == 0 && previousButton1State == 1) { if (gIsPlaying == 0) { gIsPlaying = 1; gSampleCount = 0; } else { gIsPlaying = 0; } } previousButton1State = button1State; float gEventIntervalMilliseconds = map(analogReadFrame(context, n/gNumAudioFramesPerAnalog, potPin), 0, 0.829, 50, 1000); gCountForSensor++; float x = analogReadFrame(context, n/gNumAudioFramesPerAnalog, xPin) - gXCalibrate; float y = analogReadFrame(context, n/gNumAudioFramesPerAnalog, yPin) - gYCalibrate; float z = analogReadFrame(context, n/gNumAudioFramesPerAnalog, zPin) - gZCalibrate; float accelerationMagnitude = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)); // Filter out gravity float filteredAcceleration = gB0 * accelerationMagnitude + gB1 * gX1 + gB2 * gX2 - gA1 * gY1 - gA2 * gY2; gX2 = gX1; gX1 = accelerationMagnitude; gY2 = gY1; gY1 = filteredAcceleration; if (filteredAcceleration > 0.2 && gShouldPlayFill == 0) { rt_printf("Filtered acceleration: %f\n", filteredAcceleration); gShouldPlayFill = 1; if (gCurrentPattern != gFillPattern) gPreviousPattern = gCurrentPattern; gCurrentIndexInPattern = 0; } if (gCountForSensor == 128) { gCountForSensor = 0; updateOrientation(x, y, z); if(gShouldPlayFill == 0) gCurrentPattern = gOrientation; else if (gShouldPlayFill == 1) gCurrentPattern = gFillPattern; gCurrentIndexInPattern = gCurrentIndexInPattern % gPatternLengths[gCurrentPattern]; // rt_printf("X: %d\tY: %d\tZ: %d Pattern: %d\n", gXState, gYState, gZState, gCurrentPattern); } // count samples and trigger event if running if (gIsPlaying) { if (gSampleCount >= gEventIntervalMilliseconds * 0.001 * context->audioSampleRate) { startNextEvent(); gSampleCount = 0; if(gLedState == 0) { gLedState = 1; } else { gLedState = 0; } } gSampleCount++; } digitalWriteFrame(context, n, ledPin, gLedState); // If drum triggered read through samples and add to output buffer for (int i = 0; i < NUMBER_OF_READPOINTERS; i++) { int buffer = gDrumBufferForReadPointer[i]; // rt_printf("Buffer %d: %d\n", i, buffer); if (buffer != -1) { output += gDrumSampleBuffers[buffer][gReadPointers[i]]; if (gPlaysBackwards == 0) { gReadPointers[i]++; if (gReadPointers[i] >= gDrumSampleBufferLengths[buffer]) { gDrumBufferForReadPointer[i] = -1; } } else if (gPlaysBackwards == 1) { gReadPointers[i]--; if (gReadPointers[i] == 0 ) { gDrumBufferForReadPointer[i] = -1; } } } } // Write to output buffers output *= 0.25; audioWriteFrame(context, n, 0, output); audioWriteFrame(context, n, 1, output); } }
void KStars::lookTowards ( const QString &direction ) { QString dir = direction.toLower(); if (dir == "zenith" || dir=="z") { actionCollection()->action("zenith")->trigger(); } else if (dir == "north" || dir=="n") { actionCollection()->action("north")->trigger(); } else if (dir == "east" || dir=="e") { actionCollection()->action("east")->trigger(); } else if (dir == "south" || dir=="s") { actionCollection()->action("south")->trigger(); } else if (dir == "west" || dir=="w") { actionCollection()->action("west")->trigger(); } else if (dir == "northeast" || dir=="ne") { map()->stopTracking(); map()->clickedPoint()->setAlt( 15.0 ); map()->clickedPoint()->setAz( 45.0 ); map()->clickedPoint()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() ); map()->slotCenter(); } else if (dir == "southeast" || dir=="se") { map()->stopTracking(); map()->clickedPoint()->setAlt( 15.0 ); map()->clickedPoint()->setAz( 135.0 ); map()->clickedPoint()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() ); map()->slotCenter(); } else if (dir == "southwest" || dir=="sw") { map()->stopTracking(); map()->clickedPoint()->setAlt( 15.0 ); map()->clickedPoint()->setAz( 225.0 ); map()->clickedPoint()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() ); map()->slotCenter(); } else if (dir == "northwest" || dir=="nw") { map()->stopTracking(); map()->clickedPoint()->setAlt( 15.0 ); map()->clickedPoint()->setAz( 315.0 ); map()->clickedPoint()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() ); map()->slotCenter(); } else { SkyObject *target = data()->objectNamed( direction ); if ( target != NULL ) { map()->setClickedObject( target ); map()->setClickedPoint( target ); map()->slotCenter(); } } }
void start() { ACPI_STATUS status = AE_OK; printf("acpica: starting...\n"); // NB! Must be at least as large as physical memory - the ACPI tables could // be anywhere. (Could be handled by AcpiOsMapMemory though.) map(0, MAP_PHYS | PROT_READ | PROT_WRITE | PROT_NO_CACHE, (void*)ACPI_PHYS_BASE, 0, USER_MAP_MAX - ACPI_PHYS_BASE); __default_section_init(); AcpiDbgLayer = 0; AcpiDbgLevel = ACPI_LV_REPAIR | ACPI_LV_INTERRUPTS; status = InitializeFullAcpi (); CHECK_STATUS("InitializeFullAcpi"); int pic_mode = 0; // Default is PIC mode if something fails status = PrintAPICTable(); CHECK_STATUS("PrintAPICTable"); status = FindIOAPICs(&pic_mode); CHECK_STATUS("Find IOAPIC"); status = ExecuteOSI(pic_mode); CHECK_STATUS("ExecuteOSI"); // Tables we get in Bochs: // * DSDT: All the AML code // * FACS // * FACP // * APIC (= MADT) // * SSDT: Secondary System Description Table // Contains more AML code loaded automatically by ACPICA // More tables on qemu: // * Another SSDT (Loaded by ACPICA) // * HPET table // PrintFACSTable(); // PrintFACPTable(); // TODO Iterate through and disable all pci interrupt link devices (call // _DIS). Then we'll enable the ones we actually intend to use. EnumeratePCI(); AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, 1); //AcpiWriteBitRegister(ACPI_BITREG_POWER_BUTTON_ENABLE, 1); AcpiInstallGlobalEventHandler(GlobalEventHandler, NULL); AcpiEnableEvent(ACPI_EVENT_POWER_BUTTON, 0); for (;;) { ipc_dest_t rcpt = 0x100; ipc_arg_t arg = 0; ipc_arg_t arg2 = 0; ipc_msg_t msg = recv2(&rcpt, &arg, &arg2); //printf("acpica: Received %#lx from %#lx: %#lx %#lx\n", msg, rcpt, arg, arg2); if (msg == MSG_PULSE) { if (AcpiOsCheckInterrupt(rcpt, arg)) { continue; } else { printf("acpica: Unhandled pulse: %#x from %#lx\n", arg, rcpt); } } switch (msg & 0xff) { case MSG_ACPI_FIND_PCI: MsgFindPci(rcpt, arg); break; case MSG_ACPI_CLAIM_PCI: MsgClaimPci(rcpt, arg, arg2); break; // This feels a bit wrong, but as long as we use PIO access to PCI // configuration space, we need to serialize all accesses. case MSG_ACPI_READ_PCI: arg = PciReadWord((arg & 0x7ffffffc) | 0x80000000); send1(MSG_ACPI_READ_PCI, rcpt, arg); break; case MSG_ACPI_DEBUGGER_INIT: debugger_pre_cmd(); send0(MSG_ACPI_DEBUGGER_INIT, rcpt); break; case MSG_ACPI_DEBUGGER_BUFFER: assert(debugger_buffer_pos < ACPI_DB_LINE_BUFFER_SIZE); AcpiGbl_DbLineBuf[debugger_buffer_pos++] = arg; send0(MSG_ACPI_DEBUGGER_BUFFER, rcpt); break; case MSG_ACPI_DEBUGGER_CMD: assert(debugger_buffer_pos < ACPI_DB_LINE_BUFFER_SIZE); AcpiGbl_DbLineBuf[debugger_buffer_pos++] = 0; putchar('\n'); AcpiDbCommandDispatch(AcpiGbl_DbLineBuf, NULL, NULL); debugger_pre_cmd(); send0(MSG_ACPI_DEBUGGER_CMD, rcpt); break; case MSG_ACPI_DEBUGGER_CLR_BUFFER: debugger_pre_cmd(); send0(MSG_ACPI_DEBUGGER_CLR_BUFFER, rcpt); break; case MSG_REG_IRQ: RegIRQ(rcpt, arg); continue; case MSG_IRQ_ACK: AckIRQ(rcpt); continue; } // TODO Handle other stuff. if (rcpt == 0x100) { hmod(rcpt, 0, 0); } } __builtin_unreachable(); failed: printf("ACPI failed :( (status %x)\n", status); abort(); }
void KStars::setAltAz( double alt, double az ) { map()->setDestinationAltAz( dms(alt), dms(az) ); }
void KStars::setRaDec( double ra, double dec ) { SkyPoint p( ra, dec ); map()->setDestination( p ); }
void KStars::changeViewOption( const QString &op, const QString &val ) { bool bOk(false), nOk(false), dOk(false); //parse bool value bool bVal(false); if ( val.toLower() == "true" ) { bOk = true; bVal = true; } if ( val.toLower() == "false" ) { bOk = true; bVal = false; } if ( val == "1" ) { bOk = true; bVal = true; } if ( val == "0" ) { bOk = true; bVal = false; } //parse double value double dVal = val.toDouble( &dOk ); //[GUI] if ( op == "ShowInfoBoxes" && bOk ) Options::setShowInfoBoxes( bVal ); if ( op == "ShowTimeBox" && bOk ) Options::setShowTimeBox( bVal ); if ( op == "ShowGeoBox" && bOk ) Options::setShowGeoBox( bVal ); if ( op == "ShowFocusBox" && bOk ) Options::setShowFocusBox( bVal ); if ( op == "ShadeTimeBox" && bOk ) Options::setShadeTimeBox( bVal ); if ( op == "ShadeGeoBox" && bOk ) Options::setShadeGeoBox( bVal ); if ( op == "ShadeFocusBox" && bOk ) Options::setShadeFocusBox( bVal ); //[View] // FIXME: REGRESSION // if ( op == "FOVName" ) Options::setFOVName( val ); // if ( op == "FOVSizeX" && dOk ) Options::setFOVSizeX( (float)dVal ); // if ( op == "FOVSizeY" && dOk ) Options::setFOVSizeY( (float)dVal ); // if ( op == "FOVShape" && nOk ) Options::setFOVShape( nVal ); // if ( op == "FOVColor" ) Options::setFOVColor( val ); if ( op == "ShowStars" && bOk ) Options::setShowStars( bVal ); if ( op == "ShowMessier" && bOk ) Options::setShowMessier( bVal ); if ( op == "ShowMessierImages" && bOk ) Options::setShowMessierImages( bVal ); if ( op == "ShowNGC" && bOk ) Options::setShowNGC( bVal ); if ( op == "ShowIC" && bOk ) Options::setShowIC( bVal ); if ( op == "ShowCLines" && bOk ) Options::setShowCLines( bVal ); if ( op == "ShowCBounds" && bOk ) Options::setShowCBounds( bVal ); if ( op == "ShowCNames" && bOk ) Options::setShowCNames( bVal ); if ( op == "ShowMilkyWay" && bOk ) Options::setShowMilkyWay( bVal ); if ( op == "AutoSelectGrid" && bOk ) Options::setAutoSelectGrid( bVal ); if ( op == "ShowEquatorialGrid" && bOk ) Options::setShowEquatorialGrid( bVal ); if ( op == "ShowHorizontalGrid" && bOk ) Options::setShowHorizontalGrid( bVal ); if ( op == "ShowEquator" && bOk ) Options::setShowEquator( bVal ); if ( op == "ShowEcliptic" && bOk ) Options::setShowEcliptic( bVal ); if ( op == "ShowHorizon" && bOk ) Options::setShowHorizon( bVal ); if ( op == "ShowGround" && bOk ) Options::setShowGround( bVal ); if ( op == "ShowSun" && bOk ) Options::setShowSun( bVal ); if ( op == "ShowMoon" && bOk ) Options::setShowMoon( bVal ); if ( op == "ShowMercury" && bOk ) Options::setShowMercury( bVal ); if ( op == "ShowVenus" && bOk ) Options::setShowVenus( bVal ); if ( op == "ShowMars" && bOk ) Options::setShowMars( bVal ); if ( op == "ShowJupiter" && bOk ) Options::setShowJupiter( bVal ); if ( op == "ShowSaturn" && bOk ) Options::setShowSaturn( bVal ); if ( op == "ShowUranus" && bOk ) Options::setShowUranus( bVal ); if ( op == "ShowNeptune" && bOk ) Options::setShowNeptune( bVal ); if ( op == "ShowPluto" && bOk ) Options::setShowPluto( bVal ); if ( op == "ShowAsteroids" && bOk ) Options::setShowAsteroids( bVal ); if ( op == "ShowComets" && bOk ) Options::setShowComets( bVal ); if ( op == "ShowSolarSystem" && bOk ) Options::setShowSolarSystem( bVal ); if ( op == "ShowDeepSky" && bOk ) Options::setShowDeepSky( bVal ); if ( op == "ShowSupernovae" && bOk ) Options::setShowSupernovae( bVal ); if ( op == "ShowStarNames" && bOk ) Options::setShowStarNames( bVal ); if ( op == "ShowStarMagnitudes" && bOk ) Options::setShowStarMagnitudes( bVal ); if ( op == "ShowAsteroidNames" && bOk ) Options::setShowAsteroidNames( bVal ); if ( op == "ShowCometNames" && bOk ) Options::setShowCometNames( bVal ); if ( op == "ShowPlanetNames" && bOk ) Options::setShowPlanetNames( bVal ); if ( op == "ShowPlanetImages" && bOk ) Options::setShowPlanetImages( bVal ); if ( op == "HideOnSlew" && bOk ) Options::setHideOnSlew( bVal ); if ( op == "ObsListSaveImage" && bOk ) Options::setObsListSaveImage( bVal ); if ( op == "HideStars" && bOk ) Options::setHideStars( bVal ); if ( op == "HidePlanets" && bOk ) Options::setHidePlanets( bVal ); if ( op == "HideMessier" && bOk ) Options::setHideMessier( bVal ); if ( op == "HideNGC" && bOk ) Options::setHideNGC( bVal ); if ( op == "HideIC" && bOk ) Options::setHideIC( bVal ); if ( op == "HideMilkyWay" && bOk ) Options::setHideMilkyWay( bVal ); if ( op == "HideCNames" && bOk ) Options::setHideCNames( bVal ); if ( op == "HideCLines" && bOk ) Options::setHideCLines( bVal ); if ( op == "HideCBounds" && bOk ) Options::setHideCBounds( bVal ); if ( op == "HideGrids" && bOk ) Options::setHideGrids( bVal ); if ( op == "HideLabels" && bOk ) Options::setHideLabels( bVal ); if ( op == "UseAltAz" && bOk ) Options::setUseAltAz( bVal ); if ( op == "UseRefraction" && bOk ) Options::setUseRefraction( bVal ); if ( op == "UseAutoLabel" && bOk ) Options::setUseAutoLabel( bVal ); if ( op == "UseHoverLabel" && bOk ) Options::setUseHoverLabel( bVal ); if ( op == "UseAutoTrail" && bOk ) Options::setUseAutoTrail( bVal ); if ( op == "UseAnimatedSlewing" && bOk ) Options::setUseAnimatedSlewing( bVal ); if ( op == "FadePlanetTrails" && bOk ) Options::setFadePlanetTrails( bVal ); if ( op == "SlewTimeScale" && dOk ) Options::setSlewTimeScale( dVal ); if ( op == "ZoomFactor" && dOk ) Options::setZoomFactor( dVal ); // if ( op == "MagLimitDrawStar" && dOk ) Options::setMagLimitDrawStar( dVal ); if ( op == "MagLimitDrawDeepSky" && dOk ) Options::setMagLimitDrawDeepSky( dVal ); if ( op == "StarDensity" && dOk ) Options::setStarDensity( dVal ); // if ( op == "MagLimitDrawStarZoomOut" && dOk ) Options::setMagLimitDrawStarZoomOut( dVal ); if ( op == "MagLimitDrawDeepSkyZoomOut" && dOk ) Options::setMagLimitDrawDeepSkyZoomOut( dVal ); if ( op == "StarLabelDensity" && dOk ) Options::setStarLabelDensity( dVal ); if ( op == "MagLimitHideStar" && dOk ) Options::setMagLimitHideStar( dVal ); if ( op == "MagLimitAsteroid" && dOk ) Options::setMagLimitAsteroid( dVal ); if ( op == "AsteroidLabelDensity" && dOk ) Options::setAsteroidLabelDensity( dVal ); if ( op == "MaxRadCometName" && dOk ) Options::setMaxRadCometName( dVal ); //these three are a "radio group" if ( op == "UseLatinConstellationNames" && bOk ) { Options::setUseLatinConstellNames( true ); Options::setUseLocalConstellNames( false ); Options::setUseAbbrevConstellNames( false ); } if ( op == "UseLocalConstellationNames" && bOk ) { Options::setUseLatinConstellNames( false ); Options::setUseLocalConstellNames( true ); Options::setUseAbbrevConstellNames( false ); } if ( op == "UseAbbrevConstellationNames" && bOk ) { Options::setUseLatinConstellNames( false ); Options::setUseLocalConstellNames( false ); Options::setUseAbbrevConstellNames( true ); } map()->forceUpdate(); }
/** Hilfsfunktion fuer das Skalieren der Farben. */ byte LedDriverDotStar::_brightnessScaleColor(byte brightness, byte colorPart) { return map(brightness, 0, 100, 0, colorPart); }
LibraryFilterWidget::LibraryFilterWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_LibraryFilterWidget), model_(nullptr), group_by_dialog_(new GroupByDialog), filter_delay_(new QTimer(this)), filter_applies_to_model_(true), delay_behaviour_(DelayedOnLargeLibraries) { ui_->setupUi(this); // Add the available fields to the tooltip here instead of the ui // file to prevent that they get translated by mistake. QString available_fields = Song::kFtsColumns.join(", ").replace(QRegExp("\\bfts"), ""); ui_->filter->setToolTip(ui_->filter->toolTip().arg(available_fields)); connect(ui_->filter, SIGNAL(returnPressed()), SIGNAL(ReturnPressed())); connect(filter_delay_, SIGNAL(timeout()), SLOT(FilterDelayTimeout())); filter_delay_->setInterval(kFilterDelay); filter_delay_->setSingleShot(true); // Icons ui_->options->setIcon(IconLoader::Load("configure")); // Filter by age QActionGroup* filter_age_group = new QActionGroup(this); filter_age_group->addAction(ui_->filter_age_all); filter_age_group->addAction(ui_->filter_age_today); filter_age_group->addAction(ui_->filter_age_week); filter_age_group->addAction(ui_->filter_age_month); filter_age_group->addAction(ui_->filter_age_three_months); filter_age_group->addAction(ui_->filter_age_year); filter_age_menu_ = new QMenu(tr("Show"), this); filter_age_menu_->addActions(filter_age_group->actions()); filter_age_mapper_ = new QSignalMapper(this); filter_age_mapper_->setMapping(ui_->filter_age_all, -1); filter_age_mapper_->setMapping(ui_->filter_age_today, 60 * 60 * 24); filter_age_mapper_->setMapping(ui_->filter_age_week, 60 * 60 * 24 * 7); filter_age_mapper_->setMapping(ui_->filter_age_month, 60 * 60 * 24 * 30); filter_age_mapper_->setMapping(ui_->filter_age_three_months, 60 * 60 * 24 * 30 * 3); filter_age_mapper_->setMapping(ui_->filter_age_year, 60 * 60 * 24 * 365); connect(ui_->filter_age_all, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); connect(ui_->filter_age_today, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); connect(ui_->filter_age_week, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); connect(ui_->filter_age_month, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); connect(ui_->filter_age_three_months, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); connect(ui_->filter_age_year, SIGNAL(triggered()), filter_age_mapper_, SLOT(map())); // "Group by ..." group_by_group_ = CreateGroupByActions(this); group_by_menu_ = new QMenu(tr("Group by"), this); group_by_menu_->addActions(group_by_group_->actions()); connect(group_by_group_, SIGNAL(triggered(QAction*)), SLOT(GroupByClicked(QAction*))); // Library config menu library_menu_ = new QMenu(tr("Display options"), this); library_menu_->setIcon(ui_->options->icon()); library_menu_->addMenu(filter_age_menu_); library_menu_->addMenu(group_by_menu_); library_menu_->addSeparator(); ui_->options->setMenu(library_menu_); connect(ui_->filter, SIGNAL(textChanged(QString)), SLOT(FilterTextChanged(QString))); }
/** Den Bildschirm-Puffer auf die LED-Matrix schreiben. @param onChange: TRUE, wenn es Aenderungen in dem Bildschirm-Puffer gab, FALSE, wenn es ein Refresh-Aufruf war. */ void LedDriverDotStar::writeScreenBufferToMatrix(word matrix[16], boolean onChange, eColors a_color) { boolean updateWheelColor = false; if (((settings.getColor() == color_rgb_continuous) || (a_color == color_rgb_continuous)) && _transitionCompleted) { if ((millis() - _lastColorUpdate) > 300) { updateWheelColor = true; _lastColorUpdate = millis(); } } if (!_transitionCompleted && (_transitionCounter > 0)) { _transitionCounter--; } else { _transitionCounter = 0; } if (onChange || _dirty || _demoTransition || updateWheelColor || (((_transitionCounter == 0) || (Settings::TRANSITION_MODE_FADE == settings.getTransitionMode())) && !_transitionCompleted)) { uint32_t color = 0; uint32_t colorNew = 0; uint32_t colorOld = 0; uint32_t colorOverlay1 = 0; uint32_t colorOverlay2 = 0; byte brightnessOld = 0; byte brightnessNew = 0; _dirty = false; if (mode != STD_MODE_NORMAL) { _transitionCompleted = true; _demoTransition = false; } /************* MATRIX **************/ if (onChange || _demoTransition) { if (((helperSeconds == 0) || _demoTransition) && (mode == STD_MODE_NORMAL) && _transitionCompleted && !evtActive) { switch (settings.getTransitionMode()) { case Settings::TRANSITION_MODE_FADE: for (byte i = 0; i < 11; i++) { _matrixOld[i] = _matrixNew[i]; if (_demoTransition) { _matrixNew[i] = 0; } else { _matrixNew[i] = matrix[i]; } _matrixOverlay[i] = 0; } _transitionCompleted = false; _transitionCounter = FADINGCOUNTERLOAD; break; case Settings::TRANSITION_MODE_MATRIX: case Settings::TRANSITION_MODE_SLIDE: if (((rtc.getMinutes() % 5) == 0) || _demoTransition) { Transitions::resetTransition(); for (byte i = 0; i < 11; i++) { _matrixOld[i] = 0; _matrixOverlay[i] = 0; } _transitionCompleted = false; } break; case Settings::TRANSITION_MODE_NORMAL: if (_demoTransition) { for (byte i = 0; i < 11; i++) { _matrixNew[i] = 0; } _transitionCompleted = false; _transitionCounter = NORMALCOUNTERLOAD; } break; default: ; } } if (_transitionCompleted) { for (byte i = 0; i < 11; i++) { _matrixOld[i] = 0; _matrixNew[i] = matrix[i]; _matrixOverlay[i] = 0; } } } _demoTransition = false; if ((_transitionCounter == 0) && !_transitionCompleted) { switch (settings.getTransitionMode()) { case Settings::TRANSITION_MODE_MATRIX: _transitionCounter = MATRIXCOUNTERLOAD; _transitionCompleted = Transitions::nextMatrixStep(_matrixOld, _matrixNew, _matrixOverlay, matrix); break; case Settings::TRANSITION_MODE_SLIDE: _transitionCounter = SLIDINGCOUNTERLOAD; _transitionCompleted = Transitions::nextSlideStep(_matrixNew, matrix); break; case Settings::TRANSITION_MODE_NORMAL: _transitionCompleted = true; break; default: ; } } /************* BRIGHTNESS **************/ if ((Settings::TRANSITION_MODE_FADE == settings.getTransitionMode()) && !_transitionCompleted) { brightnessOld = map(_transitionCounter, 0, FADINGCOUNTERLOAD, 0, _brightnessInPercent); brightnessNew = map(_transitionCounter, FADINGCOUNTERLOAD, 0 , 0 , _brightnessInPercent); if (_transitionCounter == 0) { _transitionCompleted = true; } } else { brightnessNew = _brightnessInPercent; } /************* COLOR **************/ if ((a_color != color_none) && (a_color <= color_single_max)) { colorNew = _strip->Color(_brightnessScaleColor(brightnessNew, pgm_read_byte_near(&defaultColors[a_color].red)), _brightnessScaleColor(brightnessNew, pgm_read_byte_near(&defaultColors[a_color].blue)), _brightnessScaleColor(brightnessNew, pgm_read_byte_near(&defaultColors[a_color].green))); } else if ((settings.getColor() == color_rgb_continuous) || (a_color == color_rgb_continuous) ) { if (updateWheelColor) { if (_wheelPos >= 254) { _wheelPos = 0; } else { _wheelPos += 2; } } color = _wheel(_brightnessInPercent, _wheelPos); colorNew = _wheel(brightnessNew, _wheelPos); colorOld = _wheel(brightnessOld, _wheelPos); } else { color = _strip->Color(_brightnessScaleColor(_brightnessInPercent, defaultColors[settings.getColor()].red), _brightnessScaleColor(_brightnessInPercent, defaultColors[settings.getColor()].blue), _brightnessScaleColor(_brightnessInPercent, defaultColors[settings.getColor()].green)); colorNew = _strip->Color(_brightnessScaleColor(brightnessNew, defaultColors[settings.getColor()].red), _brightnessScaleColor(brightnessNew, defaultColors[settings.getColor()].blue), _brightnessScaleColor(brightnessNew, defaultColors[settings.getColor()].green)); colorOld = _strip->Color(_brightnessScaleColor(brightnessOld, defaultColors[settings.getColor()].red), _brightnessScaleColor(brightnessOld, defaultColors[settings.getColor()].blue), _brightnessScaleColor(brightnessOld, defaultColors[settings.getColor()].green)); } if ( (settings.getTransitionMode() == Settings::TRANSITION_MODE_MATRIX) && !_transitionCompleted ) { colorOverlay1 = _strip->Color(_brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 255)); colorOverlay2 = _strip->Color(_brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 255 * 0.5)); colorOld = _strip->Color(_brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 0), _brightnessScaleColor(_brightnessInPercent, 255 * 0.1)); } /************* WRITE OUT **************/ _clear(); for (byte y = 0; y < 10; y++) { for (byte x = 5; x < 16; x++) { word t = 1 << x; if ((settings.getTransitionMode() == Settings::TRANSITION_MODE_FADE) && ((_matrixOld[y] & t) == t) && ((_matrixNew[y] & t) == t) ) { _setPixel(15 - x, y, color); } else { if ((_matrixOverlay[y] & t) == t) { _setPixel(15 - x, y, colorOverlay1); } else if ((_matrixOverlay[y + 1] & t) == t) { _setPixel(15 - x, y, colorOverlay2); } else if ((_matrixOld[y] & t) == t) { _setPixel(15 - x, y, colorOld); } else if ((_matrixNew[y] & t) == t) { _setPixel(15 - x, y, colorNew); } } } } // wir muessen die Eck-LEDs und die Alarm-LED umsetzen... byte cornerLedCount[] = {1, 0, 3, 2, 4}; for ( byte i = 0; i < 5; i++) { if ((settings.getTransitionMode() == Settings::TRANSITION_MODE_FADE) && ((_matrixOld[cornerLedCount[i]] & _matrixNew[cornerLedCount[i]] & 0b0000000000011111) > 0) ) { _setPixel(110 + i, color); } else { if (((_matrixOld[cornerLedCount[i]] & 0b0000000000011111) > 0) ) { _setPixel(110 + i, colorOld); } else if (((_matrixNew[cornerLedCount[i]] & 0b0000000000011111) > 0) ) { _setPixel(110 + i, colorNew); } } } _strip->show(); } }
string dynamicEMTraining(string theNet, string trainingSet){ // open the data set: DSL_dataset ds; if (ds.ReadFile(trainingSet.c_str()) != DSL_OKAY) { cout << "Cannot read data file... exiting." << endl; exit(1); } // open the network: DSL_network net; if (net.ReadFile(theNet.c_str(), DSL_XDSL_FORMAT) != DSL_OKAY) { cout << "Cannot read network... exiting." << endl; exit(1); } // match the data set and the network (variables): vector<DSL_datasetMatch> dsMap(ds.GetNumberOfVariables()); int varCnt = 0; // the number of variables occuring both in the data set and the network for (int i = 0; i < ds.GetNumberOfVariables(); i++) { string id = ds.GetId(i); const char* idc = id.c_str(); bool done = false; for (int j = 0; j < (int) strlen(idc) && !done; j++) { if (idc[j] == '_') { char* nodeId = (char*) malloc((j+1) * sizeof(char)); strncpy(nodeId, idc, j); nodeId[j] = '\0'; int nodeHdl = net.FindNode(nodeId); if (nodeHdl >= 0) { DSL_intArray orders; net.GetTemporalOrders(nodeHdl, orders); dsMap[varCnt].node = nodeHdl; dsMap[varCnt].slice = atoi(idc + j + 1); dsMap[varCnt].column = i; varCnt++; free(nodeId); done = true; } } } if (!done) { int nodeHdl = net.FindNode(idc); if (nodeHdl >= 0) { dsMap[varCnt].node = nodeHdl; dsMap[varCnt].slice = 0; dsMap[varCnt].column = i; varCnt++; } } } dsMap.resize(varCnt); // match the data set and the network (states): for (int i = 0; i < dsMap.size(); i++) { DSL_datasetMatch &m = dsMap[i]; int nodeHdl = m.node; int colIdx = m.column; DSL_idArray* ids = net.GetNode(nodeHdl)->Definition()->GetOutcomesNames(); const DSL_datasetVarInfo &varInfo = ds.GetVariableInfo(colIdx); const vector<string> &stateNames = varInfo.stateNames; vector<int> map(stateNames.size(), -1); for (int j = 0; j < (int) stateNames.size(); j++) { const char* id = stateNames[j].c_str(); for (int k = 0; k < ids->NumItems(); k++) { char* tmpid = (*ids)[k]; if (!strcmp(id, tmpid)) { map[j] = k; } } } for (int k = 0; k < ds.GetNumberOfRecords(); k++) { if (ds.GetInt(colIdx, k) >= 0) { ds.SetInt(colIdx, k, map[ds.GetInt(colIdx, k)]); } } } // learn parameters: DSL_em em; if (em.Learn(ds, net, dsMap) != DSL_OKAY) { cout << "Cannot learn parameters... exiting." << endl; exit(1); } net.WriteFile((theNet.insert(theNet.find_last_of("/") + 1, "res_")).c_str(), DSL_XDSL_FORMAT); return theNet; }
static int decode(FILE *in, FILE *out) { struct hexfile_decoder *hfd = NULL; struct decoder decoder = { .base = 0, .file = out, .eof = 0, .position = 0, }; char buffer[4096]; int ret; size_t nbytes; ret = hexfile_decoder_new(hfd_callback, &decoder, &hfd); if (ret < 0) { fprintf(stderr, "failed to create hexfile decoder\n"); _exit(2); } while ((nbytes = fread(buffer, 1, sizeof(buffer), in)) > 0) { ret = hexfile_decoder_feed(hfd, buffer, nbytes); if (ret < 0) { fprintf(stderr, "failed to decode hexfile\n"); _exit(2); } } ret = hexfile_decoder_close(&hfd); if (ret < 0) { fprintf(stderr, "failed to close hexfile decoder\n"); _exit(2); } if (!decoder.eof) { fprintf(stderr, "no EOF record\n"); _exit(1); } return 0; } struct mapper { unsigned base, start, end; FILE *file; int eof; }; static void map_print(const struct mapper *mapper) { if (mapper->end > mapper->start) fprintf(mapper->file, "0x%08x-0x%08x\n", mapper->start, mapper->end); } static int map_callback(void *ctx, unsigned char type, unsigned offset, unsigned char *data, size_t length) { struct mapper *mapper = (struct mapper*)ctx; (void)data; if (mapper->eof) { errno = EINVAL; return -1; } if (type == 0x00) { /* data record */ unsigned new_position, new_end; new_position = (mapper->base + offset) & ~0xf; new_end = (new_position + length) | 0xf; if (new_position < mapper->start || new_position > mapper->end + 1) { map_print(mapper); mapper->start = new_position; mapper->end = new_end; } else if (new_end > mapper->end) { mapper->end = new_end; } return 0; } else if (type == 0x01) { /* EOF record */ mapper->eof = 1; return 0; } else if (type >= 0x10) { /* switch memory bank */ unsigned new_base = (type - 0x10) * BANK_SIZE; if (mapper->end != new_base) { map_print(mapper); mapper->start = mapper->end = new_base; } mapper->base = new_base; return 0; } else { errno = ENOSYS; return -1; } } static int map(FILE *in, FILE *out) { struct hexfile_decoder *hfd = NULL; struct mapper mapper = { .base = 0, .start = 0, .end = 0, .file = out, .eof = 0, }; char buffer[4096]; int ret; size_t nbytes; ret = hexfile_decoder_new(map_callback, &mapper, &hfd); if (ret < 0) { fprintf(stderr, "failed to create hexfile decoder\n"); _exit(2); } while ((nbytes = fread(buffer, 1, sizeof(buffer), in)) > 0) { ret = hexfile_decoder_feed(hfd, buffer, nbytes); if (ret < 0) { fprintf(stderr, "failed to decode hexfile\n"); _exit(2); } } ret = hexfile_decoder_close(&hfd); if (ret < 0) { fprintf(stderr, "failed to close hexfile decoder\n"); _exit(2); } if (!mapper.eof) { fprintf(stderr, "no EOF record\n"); _exit(1); } return 0; } int main(int argc, char **argv) { struct config config; FILE *in, *out; parse_cmdline(&config, argc, argv); if (config.input_path == NULL) { in = stdin; } else { in = fopen(argv[optind], "r"); if (in == NULL) { fprintf(stderr, "failed to open '%s': %s", argv[optind], strerror(errno)); _exit(1); } } if (config.output_path == NULL) { out = stdout; } else { out = fopen(config.output_path, "w"); if (out == NULL) { fprintf(stderr, "failed to create '%s': %s\n", config.output_path, strerror(errno)); _exit(1); } } /* do it */ if (config.decode) { return decode(in, out); } else if (config.map) { return map(in, out); } else { return encode(in, out); } }
void TestIt(long p, long r, long c, long _k, long w, long L, Vec<long>& mvec, Vec<long>& gens, Vec<long>& ords, long useCache) { if (lsize(mvec)<1) { // use default values mvec.SetLength(3); gens.SetLength(3); ords.SetLength(3); mvec[0] = 7; mvec[1] = 3; mvec[2] = 221; gens[0] = 3979; gens[1] = 3095; gens[2] = 3760; ords[0] = 6; ords[1] = 2; ords[2] = -8; } if (!noPrint) cout << "*** TestIt" << (dry? " (dry run):" : ":") << " p=" << p << ", r=" << r << ", c=" << c << ", k=" << _k << ", w=" << w << ", L=" << L << ", mvec=" << mvec << ", " << ", useCache = " << useCache << endl; setTimersOn(); setDryRun(false); // Need to get a "real context" to test ThinEvalMap // mvec is supposed to include the prime-power factorization of m long nfactors = mvec.length(); for (long i = 0; i < nfactors; i++) for (long j = i+1; j < nfactors; j++) assert(GCD(mvec[i], mvec[j]) == 1); // multiply all the prime powers to get m itself long m = computeProd(mvec); assert(GCD(p, m) == 1); // build a context with these generators and orders vector<long> gens1, ords1; convert(gens1, gens); convert(ords1, ords); FHEcontext context(m, p, r, gens1, ords1); buildModChain(context, L, c); if (!noPrint) { context.zMStar.printout(); // print structure of Zm* /(p) to cout cout << endl; } long d = context.zMStar.getOrdP(); long phim = context.zMStar.getPhiM(); long nslots = phim/d; setDryRun(dry); // Now we can set the dry-run flag if desired FHESecKey secretKey(context); const FHEPubKey& publicKey = secretKey; secretKey.GenSecKey(w); // A Hamming-weight-w secret key addSome1DMatrices(secretKey); // compute key-switching matrices that we need addFrbMatrices(secretKey); // compute key-switching matrices that we need // GG defines the plaintext space Z_p[X]/GG(X) ZZX GG; GG = context.alMod.getFactorsOverZZ()[0]; EncryptedArray ea(context, GG); zz_p::init(context.alMod.getPPowR()); Vec<zz_p> val0(INIT_SIZE, nslots); for (auto& x: val0) random(x); vector<ZZX> val1; val1.resize(nslots); for (long i = 0; i < nslots; i++) { val1[i] = conv<ZZX>(conv<ZZ>(rep(val0[i]))); } Ctxt ctxt(publicKey); ea.encrypt(ctxt, publicKey, val1); resetAllTimers(); FHE_NTIMER_START(ALL); // Compute homomorphically the transformation that takes the // coefficients packed in the slots and produces the polynomial // corresponding to cube if (!noPrint) CheckCtxt(ctxt, "init"); if (!noPrint) cout << "build ThinEvalMap\n"; ThinEvalMap map(ea, /*minimal=*/false, mvec, /*invert=*/false, /*build_cache=*/false); // compute the transformation to apply if (!noPrint) cout << "apply ThinEvalMap\n"; if (useCache) map.upgrade(); map.apply(ctxt); // apply the transformation to ctxt if (!noPrint) CheckCtxt(ctxt, "ThinEvalMap"); if (!noPrint) cout << "check results\n"; if (!noPrint) cout << "build ThinEvalMap\n"; ThinEvalMap imap(ea, /*minimal=*/false, mvec, /*invert=*/true, /*build_cache=*/false); // compute the transformation to apply if (!noPrint) cout << "apply ThinEvalMap\n"; if (useCache) imap.upgrade(); imap.apply(ctxt); // apply the transformation to ctxt if (!noPrint) { CheckCtxt(ctxt, "ThinEvalMap"); cout << "check results\n"; } #if 1 /* create dirty version of ctxt */ Vec<zz_pX> dirty_val0; dirty_val0.SetLength(nslots); for (long i = 0; i < nslots; i++) { random(dirty_val0[i], d); SetCoeff(dirty_val0[i], 0, val0[i]); } vector<ZZX> dirty_val1; dirty_val1.resize(nslots); for (long i = 0; i < nslots; i++) { dirty_val1[i] = conv<ZZX>(dirty_val0[i]); } Ctxt dirty_ctxt(publicKey); ea.encrypt(dirty_ctxt, publicKey, dirty_val1); EvalMap dirty_map(ea, /*minimal=*/false, mvec, /*invert=*/false, /*build_cache=*/false); dirty_map.apply(dirty_ctxt); imap.apply(dirty_ctxt); #endif vector<ZZX> val2; ea.decrypt(ctxt, secretKey, val2); if (val1 == val2) cout << "ThinEvalMap: GOOD\n"; else cout << "ThinEvalMap: BAD\n"; #if 1 vector<ZZX> dirty_val2; ea.decrypt(dirty_ctxt, secretKey, dirty_val2); if (val1 == dirty_val2) cout << "ThinEvalMap: GOOD\n"; else cout << "ThinEvalMap: BAD\n"; #endif FHE_NTIMER_STOP(ALL); if (!noPrint) { cout << "\n*********\n"; printAllTimers(); cout << endl; } }
void TransactionView::setModel(WalletModel *model) { this->model = model; if(model) { transactionProxyModel = new TransactionFilterProxy(this); transactionProxyModel->setSourceModel(model->getTransactionTableModel()); transactionProxyModel->setDynamicSortFilter(true); transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); transactionProxyModel->setSortRole(Qt::EditRole); transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); transactionView->setModel(transactionProxyModel); transactionView->setAlternatingRowColors(true); transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection); transactionView->setSortingEnabled(true); transactionView->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder); transactionView->verticalHeader()->hide(); transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH); if (model->getOptionsModel()) { // Add third party transaction URLs to context menu QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); for (int i = 0; i < listUrls.size(); ++i) { QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); if (!host.isEmpty()) { QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label if (i == 0) contextMenu->addSeparator(); contextMenu->addAction(thirdPartyTxUrlAction); connect(thirdPartyTxUrlAction, SIGNAL(triggered()), mapperThirdPartyTxUrls, SLOT(map())); mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed()); } } } // show/hide column Watch-only updateWatchOnlyColumn(model->haveWatchOnly()); // Watch-only signal connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool))); } }
void* MemoryMappedFile::map(const char *filename) { boost::uintmax_t l = boost::filesystem::file_size( filename ); assert( l <= 0x7fffffff ); long i = (long)l; return map( filename , i ); }
ButtonLog::ButtonLog(LogPlay *log,RDCae *cae,int id,RDAirPlayConf *conf, bool allow_pause,QWidget *parent) : QWidget(parent) { log_id=id; log_log=log; log_cae=cae; log_action_mode=RDAirPlayConf::Normal; log_op_mode=RDAirPlayConf::LiveAssist; log_time_mode=RDAirPlayConf::TwentyFourHour; log_pause_enabled=allow_pause; QFont font=QFont("Helvetica",14,QFont::Bold); font.setPixelSize(14); // // Set Mappings // connect(log_log,SIGNAL(transportChanged()), this,SLOT(transportChangedData())); connect(log_log,SIGNAL(modified(int)),this,SLOT(modifiedData(int))); connect(log_log,SIGNAL(played(int)),this,SLOT(playedData(int))); connect(log_log,SIGNAL(stopped(int)),this,SLOT(stoppedData(int))); connect(log_log,SIGNAL(paused(int)),this,SLOT(pausedData(int))); connect(log_log,SIGNAL(position(int,int)),this,SLOT(positionData(int,int))); // // Edit Event Dialog // log_event_edit=new EditEvent(log_log,log_cae,this); // // Line Boxes / Start Buttons // QSignalMapper *mapper=new QSignalMapper(this); connect(mapper,SIGNAL(mapped(int)), this,SLOT(startButton(int))); for(int i=0;i<BUTTON_PLAY_BUTTONS;i++) { log_line_box[i]=new LogLineBox(conf,this); log_line_box[i]->setMode(LogLineBox::Full); log_line_box[i]->setAcceptDrops(rda->station()->enableDragdrop()); log_line_box[i]->setAllowDrags(rda->station()->enableDragdrop()); log_line_box[i]->setGeometry(10+log_line_box[i]->sizeHint().height(), (log_line_box[i]->sizeHint().height()+12)*i, log_line_box[i]->sizeHint().width(), log_line_box[i]->sizeHint().height()); connect(log_line_box[i],SIGNAL(doubleClicked(int)), this,SLOT(boxDoubleClickedData(int))); connect(log_line_box[i],SIGNAL(cartDropped(int,RDLogLine *)), this,SLOT(cartDroppedData(int,RDLogLine *))); log_start_button[i]=new StartButton(allow_pause,this); log_start_button[i]->setGeometry(5, (log_line_box[i]->sizeHint().height()+12)*i, log_line_box[i]->sizeHint().height(), log_line_box[i]->sizeHint().height()); mapper->setMapping(log_start_button[i],i); connect(log_start_button[i],SIGNAL(clicked()), mapper,SLOT(map())); } for(int i=BUTTON_PLAY_BUTTONS;i<BUTTON_TOTAL_BUTTONS;i++) { log_line_box[i]=new LogLineBox(conf,this); log_line_box[i]->setMode(LogLineBox::Half); log_line_box[i]->setAcceptDrops(rda->station()->enableDragdrop()); log_line_box[i]->setAllowDrags(rda->station()->enableDragdrop()); log_line_box[i]->setGeometry(10+log_line_box[0]->sizeHint().height(), (log_line_box[0]->sizeHint().height()+12)*3+ (log_line_box[i]->sizeHint().height()+12)*(i-3), log_line_box[i]->sizeHint().width(), log_line_box[i]->sizeHint().height()); connect(log_line_box[i],SIGNAL(doubleClicked(int)), this,SLOT(boxDoubleClickedData(int))); connect(log_line_box[i],SIGNAL(cartDropped(int,RDLogLine *)), this,SLOT(cartDroppedData(int,RDLogLine *))); log_start_button[i]=new StartButton(allow_pause,this); log_start_button[i]->setGeometry(5, (log_line_box[0]->sizeHint().height()+12)*3+ (log_line_box[i]->sizeHint().height()+12)*(i-3), log_line_box[0]->sizeHint().height(), log_line_box[i]->sizeHint().height()); mapper->setMapping(log_start_button[i],i); connect(log_start_button[i],SIGNAL(clicked()), mapper,SLOT(map())); } }
constraint mk_class_instance_root_cnstr(std::shared_ptr<class_instance_context> const & C, local_context const & _ctx, expr const & m, bool is_strict, unifier_config const & cfg, delay_factor const & factor) { environment const & env = C->env(); justification j = mk_failed_to_synthesize_jst(env, m); auto choice_fn = [=](expr const & meta, expr const & meta_type, substitution const & s, name_generator const & ngen) { environment const & env = C->env(); auto cls_name_it = is_ext_class(C->tc(), meta_type); if (!cls_name_it) { // do nothing, since type is not a class. return lazy_list<constraints>(constraints()); } local_context ctx = _ctx.instantiate(substitution(s)); pair<expr, justification> mj = update_meta(meta, s); expr new_meta = mj.first; justification new_j = mj.second; unsigned depth = 0; constraint c = mk_class_instance_cnstr(C, ctx, new_meta, depth); unifier_config new_cfg(cfg); new_cfg.m_discard = false; new_cfg.m_use_exceptions = false; new_cfg.m_pattern = true; new_cfg.m_kind = C->m_conservative ? unifier_kind::VeryConservative : unifier_kind::Liberal; auto to_cnstrs_fn = [=](substitution const & subst, constraints const & cnstrs) -> constraints { substitution new_s = subst; // some constraints may have been postponed (example: universe level constraints) constraints postponed = map(cnstrs, [&](constraint const & c) { // we erase internal justifications return update_justification(c, mk_composite1(j, new_j)); }); metavar_closure cls(new_meta); cls.add(meta_type); bool relax = C->m_relax; constraints cs = cls.mk_constraints(new_s, new_j, relax); return append(cs, postponed); }; auto no_solution_fn = [=]() { if (is_strict) return lazy_list<constraints>(); else return lazy_list<constraints>(constraints()); }; unify_result_seq seq1 = unify(env, 1, &c, ngen, substitution(), new_cfg); unify_result_seq seq2 = filter(seq1, [=](pair<substitution, constraints> const & p) { substitution new_s = p.first; expr result = new_s.instantiate(new_meta); // We only keep complete solutions (modulo universe metavariables) return !has_expr_metavar_relaxed(result); }); if (get_class_unique_class_instances(C->m_ios.get_options())) { optional<expr> solution; substitution subst; constraints cnstrs; for_each(seq2, [&](pair<substitution, constraints> const & p) { subst = p.first; cnstrs = p.second; expr next_solution = subst.instantiate(new_meta); if (solution) { throw_class_exception(m, [=](formatter const & fmt) { format r = format("ambiguous class-instance resolution, " "there is more than one solution"); r += pp_indent_expr(fmt, *solution); r += compose(line(), format("and")); r += pp_indent_expr(fmt, next_solution); return r; }); } else { solution = next_solution; } }); if (!solution) { return no_solution_fn(); } else { // some constraints may have been postponed (example: universe level constraints) return lazy_list<constraints>(to_cnstrs_fn(subst, cnstrs)); } } else { if (try_multiple_instances(env, *cls_name_it)) { lazy_list<constraints> seq3 = map2<constraints>(seq2, [=](pair<substitution, constraints> const & p) { return to_cnstrs_fn(p.first, p.second); }); if (is_strict) { return seq3; } else { // make sure it does not fail by appending empty set of constraints return append(seq3, lazy_list<constraints>(constraints())); } } else { auto p = seq2.pull(); if (!p) return no_solution_fn(); else return lazy_list<constraints>(to_cnstrs_fn(p->first.first, p->first.second)); } } }; bool owner = false; bool relax = C->m_relax; return mk_choice_cnstr(m, choice_fn, factor, owner, j, relax); }
// assumes list holds intptr_t fields list_t * doubleAll(list_t * xs) { return map(doubleInt, NULL, xs); }
void setPWMSignal(int channel, float period, float duty){ int ticks = calcTicks(map(duty,MIN_DUTY,MAX_DUTY), 1/period); pwmWrite(PIN_BASE+channel, ticks); //delay(period*1000); }
int main(int argc, char **argv) { int c; extern char *optarg; extern int optind; int long_index = 0; struct option long_opts[] = { { "output", 1, 0, 'o' }, { "version", 0, 0, 'v' }, { "help", 0, 0, 'h' }, { 0, 0, 0, 0 } }; egg_token *t; char *input_file; char *output_file = NULL; FILE *of = NULL; while ((c = getopt_long(argc, argv, "o:vh", long_opts, &long_index)) != -1) { switch (c) { case 'o': output_file = strdup(optarg); break; case 'v': version(); return 0; case 'h': default: version(); usage(); return 1; } } input_file = NULL; if (optind < argc) if (strcmp(argv[optind], "-")) input_file = strdup(argv[optind]); if (!input_initialize(input_file)) return 1; t = grammar(); if (!t) fprintf(stderr, "Failed to parse grammar.\n"); input_cleanup(); if (!t) return 1; if (output_file) { of = fopen(output_file, "w"); if (!of) { fprintf(stderr, "Failed to open '%s'\n", output_file); return 1; } } else of = stdout; map(of, t); if (output_file) { if (of) fclose(of); free(output_file); } return 0; }
int main(void){ const size_t nThreads = 10; BarrierCounter bc(nThreads); Barrier b(nThreads); timer(); #pragma omp parallel num_threads(nThreads) { size_t threadId = omp_get_thread_num(); for(int i=0; i<10; ++i){ printf("%d", i); #pragma omp barrier if(threadId == 0){ printf("\n"); } #pragma omp barrier } } printf("OpenMP = %e s\n", timer()); #pragma omp parallel num_threads(nThreads) { size_t threadId = omp_get_thread_num(); for(int i=0; i<10; ++i){ printf("%d", i); bc.barrier(threadId); if(threadId == nThreads-1){ printf("\n"); } bc.barrier(threadId); } } printf("barrier counter = %e s\n", timer()); #pragma omp parallel num_threads(nThreads) { size_t threadId = omp_get_thread_num(); for(int i=0; i<10; ++i){ printf("%d", i); b.barrier(threadId); if(threadId == nThreads-1){ printf("\n"); } b.barrier(threadId); } } printf("barrier messages = %e s\n", timer()); return EXIT_SUCCESS; const size_t N = 256; const size_t M = 256; Map map(N, M); generate(map, M*N); map.toHTML("map.html"); map.clearMarks(); find(map, 4*(M+N)); map.toHTML("map_waves.html"); printf("Press enter to exit... "); getchar(); return EXIT_SUCCESS; }
void ApplicationWindow::addCtrl(QGridLayout *grid, const v4l2_queryctrl &qctrl) { QWidget *p = grid->parentWidget(); QIntValidator *val; QLineEdit *edit; QString name((char *)qctrl.name); QComboBox *combo; QSpinBox *spin; QSlider *slider; struct v4l2_querymenu qmenu; switch (qctrl.type) { case V4L2_CTRL_TYPE_INTEGER: addLabel(grid, name); if (qctrl.flags & V4L2_CTRL_FLAG_SLIDER) { m_widgetMap[qctrl.id] = slider = new QSlider(Qt::Horizontal, p); slider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); slider->setMinimum(qctrl.minimum); slider->setMaximum(qctrl.maximum); slider->setSingleStep(qctrl.step); slider->setSliderPosition(qctrl.default_value); addWidget(grid, m_widgetMap[qctrl.id]); connect(m_widgetMap[qctrl.id], SIGNAL(valueChanged(int)), m_sigMapper, SLOT(map())); break; } if (qctrl.maximum - qctrl.minimum <= 255) { m_widgetMap[qctrl.id] = spin = new QSpinBox(p); spin->setMinimum(qctrl.minimum); spin->setMaximum(qctrl.maximum); addWidget(grid, m_widgetMap[qctrl.id]); connect(m_widgetMap[qctrl.id], SIGNAL(valueChanged(int)), m_sigMapper, SLOT(map())); break; } val = new QIntValidator(qctrl.minimum, qctrl.maximum, p); edit = new QLineEdit(p); edit->setValidator(val); addWidget(grid, edit); m_widgetMap[qctrl.id] = edit; connect(m_widgetMap[qctrl.id], SIGNAL(lostFocus()), m_sigMapper, SLOT(map())); connect(m_widgetMap[qctrl.id], SIGNAL(returnPressed()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_INTEGER64: addLabel(grid, name); edit = new QLineEdit(p); m_widgetMap[qctrl.id] = edit; addWidget(grid, edit); connect(m_widgetMap[qctrl.id], SIGNAL(lostFocus()), m_sigMapper, SLOT(map())); connect(m_widgetMap[qctrl.id], SIGNAL(returnPressed()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_BITMASK: addLabel(grid, name); edit = new QLineEdit(p); edit->setInputMask("HHHHHHHH"); addWidget(grid, edit); m_widgetMap[qctrl.id] = edit; connect(m_widgetMap[qctrl.id], SIGNAL(lostFocus()), m_sigMapper, SLOT(map())); connect(m_widgetMap[qctrl.id], SIGNAL(returnPressed()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_STRING: addLabel(grid, name); edit = new QLineEdit(p); m_widgetMap[qctrl.id] = edit; edit->setMaxLength(qctrl.maximum); addWidget(grid, edit); connect(m_widgetMap[qctrl.id], SIGNAL(lostFocus()), m_sigMapper, SLOT(map())); connect(m_widgetMap[qctrl.id], SIGNAL(returnPressed()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_BOOLEAN: addLabel(grid, name); m_widgetMap[qctrl.id] = new QCheckBox(p); addWidget(grid, m_widgetMap[qctrl.id]); connect(m_widgetMap[qctrl.id], SIGNAL(clicked()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_BUTTON: addLabel(grid, ""); m_widgetMap[qctrl.id] = new QPushButton((char *)qctrl.name, p); addWidget(grid, m_widgetMap[qctrl.id]); connect(m_widgetMap[qctrl.id], SIGNAL(clicked()), m_sigMapper, SLOT(map())); break; case V4L2_CTRL_TYPE_MENU: addLabel(grid, name); combo = new QComboBox(p); m_widgetMap[qctrl.id] = combo; for (int i = qctrl.minimum; i <= qctrl.maximum; i++) { qmenu.id = qctrl.id; qmenu.index = i; if (!querymenu(qmenu)) continue; combo->addItem((char *)qmenu.name); } addWidget(grid, m_widgetMap[qctrl.id]); connect(m_widgetMap[qctrl.id], SIGNAL(activated(int)), m_sigMapper, SLOT(map())); break; default: return; } m_sigMapper->setMapping(m_widgetMap[qctrl.id], qctrl.id); if (qctrl.flags & CTRL_FLAG_DISABLED) m_widgetMap[qctrl.id]->setDisabled(true); }
void KStars::zoomOut() { map()->slotZoomOut(); }