void GDBOutputWidget::setShowInternalCommands(bool show) { if (show != showInternalCommands_) { showInternalCommands_ = show; // Set of strings to show changes, text edit still has old // set. Refresh. m_gdbView->clear(); QStringList& newList = showInternalCommands_ ? allCommands_ : userCommands_; QStringList::iterator i = newList.begin(), e = newList.end(); for(; i != e; ++i) { // Note that color formatting is already applied to '*i'. showLine(*i); } } }
int coVR1DTransInteractor::hit(pfVec3 &hitPoint,pfHit *hit) { if (debugLevel>0) { if (justHit) fprintf(stderr,"\ncoVR1DTransInteractor::justhit [%s]\n", interactorName); } else if (debugLevel>1) fprintf(stderr,"\ncoVR1DTransInteractor::hit [%s]\n", interactorName); if (!cover->isPointerLocked() && !cover->isNavigating()) { isI = true; if (showConstraints == SHOW_CONSTRAINTS_ONTOUCH) showLine(); // get pointer state coPointerButton *pb = cover->getButton(); if (pb->wasPressed() && (pb->getButtonStatus() /*== ACTION_BUTTON*/) ) { if (debugLevel>0) fprintf(stderr,"\tchanging state to selected\n"); isS = true; sphereGeoset->setHlight(selectedHl); } else { if (!isS) sphereGeoset->setHlight(isectedHl); } } justHit = false; return ACTION_CALL_ON_MISS; }
void Semester::show(wxDC& dc, wxPoint dragpos){ this->dragpos = dragpos; dragging = true; showLine(dc, root, NULL); dragging = false; }//show
void Semester::show(wxDC& dc){ showLine(dc, root, NULL); }//show
void updateHD44780lcd(Engine *engine) { MenuItem *p = tree.topVisible; int screenY = 0; for (; screenY < tree.linesCount && p != NULL; screenY++) { lcd_HD44780_set_position(screenY, 0); char firstChar; if (p == tree.current) { if (p->callback != NULL) { firstChar = '!'; } else { firstChar = p->firstChild == NULL ? '*' : '>'; } } else { firstChar = ' '; } lcd_HD44780_print_char(firstChar); if (p->lcdLine == LL_STRING) { lcd_HD44780_print_string(p->text); } else { showLine(p->lcdLine, screenY); } fillWithSpaces(); p = p->next; } for (; screenY < tree.linesCount; screenY++) { lcd_HD44780_set_position(screenY, 0); fillWithSpaces(); } memcpy(buffer, getWarninig(), engineConfiguration->HD44780width); buffer[engineConfiguration->HD44780width] = 0; lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0); lcd_HD44780_print_string(buffer); fillWithSpaces(); // // lcd_HD44780_set_position(0, 9); // /** // * this would blink so that we know the LCD is alive // */ // if (isEven) { // lcd_HD44780_print_char('R'); // } else { // lcd_HD44780_print_char(' '); // } // lcd_HD44780_set_position(0, 10); // // char * ptr = itoa10(buffer, getRpmE(engine)); // ptr[0] = 0; // int len = ptr - buffer; // for (int i = 0; i < 6 - len; i++) { // lcd_HD44780_print_char(' '); // } // lcd_HD44780_print_string(buffer); // // if (hasFirmwareError()) { // memcpy(buffer, getFirmwareError(), LCD_WIDTH); // buffer[LCD_WIDTH] = 0; // lcd_HD44780_set_position(1, 0); // lcd_HD44780_print_string(buffer); // return; // } // // lcd_HD44780_set_position(1, 0); // memset(buffer, ' ', LCD_WIDTH); // memcpy(buffer, getWarninig(), LCD_WIDTH); // buffer[LCD_WIDTH] = 0; // lcd_HD44780_print_string(buffer); // // if (engineConfiguration->HD44780height < 3) { // return; // } // // int index = (getTimeNowSeconds() / 2) % (NUMBER_OF_DIFFERENT_LINES / 2); // // prepareCurrentSecondLine(engine, index); // buffer[LCD_WIDTH] = 0; // lcd_HD44780_set_position(2, 0); // lcd_HD44780_print_string(buffer); // // prepareCurrentSecondLine(engine, index + NUMBER_OF_DIFFERENT_LINES / 2); // buffer[LCD_WIDTH] = 0; // lcd_HD44780_set_position(3, 0); // lcd_HD44780_print_string(buffer); // //#if EFI_PROD_CODE // dateToString(dateBuffer); // lcd_HD44780_set_position(1, 0); // lcd_HD44780_print_string(dateBuffer); //#endif /* EFI_PROD_CODE */ }
coVR1DTransInteractor::coVR1DTransInteractor(pfVec3 o, pfVec3 d, float min, float max, float val, float size, int showConstr, char *name) { pfMatrix wm, tm, sm; pfVec3 zaxis(0,0,1); origin = o; dir = d; dir.normalize(); minVal = min; maxVal = max; currVal = val; interSize = size; interactorName= new char[strlen(name)+1]; strcpy(interactorName, name); if ((showConstr == SHOW_CONSTRAINTS_ALWAYS) || (showConstr == SHOW_CONSTRAINTS_ONTOUCH) || (showConstr == SHOW_CONSTRAINTS_ONSELECT)) showConstraints = showConstr; else { fprintf(stderr,"\nERROR in coVR1DTransInteractor::coVR1DTransInteractor\n"); fprintf(stderr,"\tillegal value [%d] for showConstraints\n", showConstr); showConstraints = SHOW_CONSTRAINTS_ALWAYS; } float interScale = size/cover->getScale(); fprintf(stderr,"interactor size=%f cover scale = %f\n", interSize, cover->getScale()); // initialize flags interactionOngoing = false; isI = false; isS = false; isE = false; justHit = true; // get debug level const char *line = CoviseConfig::getEntry("COVERConfig.DEBUG_LEVEL"); if (line) sscanf(line,"%d", &debugLevel); else debugLevel = 0; // debugprint if (debugLevel>0) { fprintf(stderr,"\ncoVR1DTransInteractor:coVR1DTransInteractor [%s]\n", interactorName); fprintf(stderr,"\tshowConstraints=[%d]\n", showConstraints); fprintf(stderr,"\torigin=[%f %f %f]\n", origin[0], origin[1], origin[2]); fprintf(stderr,"\tdir=[%f %f %f]\n", dir[0], dir[1], dir[2]); fprintf(stderr,"\tminVal=[%f] maxVal=[%f] currVal=[%f]\n", minVal, maxVal, currVal); } // check and adjust the ranges checkRange(); // load geostates only once geostate = loadDefaultGeostate(); unlightedGeostate = loadUnlightedGeostate(); // objectsRoot // | // worldDCS // | // interactorRoot // | | // lineGeode sphereTransDCS // | // sphereScaleDCS // | // sphereGeode if(debugLevel>1) fprintf(stderr,"\tcreating the scenegraph\n"); objectsRoot = cover->getObjectsRoot(); worldDCS = new pfDCS(); wm.makeVecRotVec(zaxis, dir); wm[3][0] = origin[0]; wm[3][1] = origin[1]; wm[3][2] = origin[2]; worldDCS->setMat(wm); interactorRoot = new pfGroup(); sphereTransDCS = new pfDCS(); tm.makeTrans(0, 0, currVal); sphereTransDCS->setMat(tm); sphereScaleDCS = new pfDCS(); sm.makeScale(interScale, interScale, interScale); sphereScaleDCS->setMat(sm); sphereGeode = createSphere(); lineGeode = createLine(); objectsRoot->addChild(worldDCS); worldDCS->addChild(interactorRoot); interactorRoot->addChild(lineGeode); interactorRoot->addChild(sphereTransDCS); sphereTransDCS->addChild(sphereScaleDCS); sphereScaleDCS->addChild(sphereGeode); if (showConstraints == SHOW_CONSTRAINTS_ALWAYS) showLine(); else hideLine(); if(debugLevel>1) fprintf(stderr,"\tcreating the highlights\n"); // highlights isectedHl = new pfHighlight(); isectedHl->setMode(PFHL_FILL); isectedHl->setColor(PFHL_FGCOLOR, 0.6, 0.6, 0.0); isectedHl->setLineWidth(3.0); selectedHl = new pfHighlight(); selectedHl->setMode(PFHL_FILL); selectedHl->setColor(PFHL_FGCOLOR, 0.0, 0.6, 0.0); selectedHl->setLineWidth(3.0); }
int Gui::drawPage( LGraphicsView *view, QGraphicsScene *scene, Steps *steps, int stepNum, QString const &addLine, Where ¤t, QStringList &csiParts, QStringList &pliParts, bool isMirrored, QHash<QString, QStringList> &bfx, bool printing, bool bfxStore2, QStringList &bfxParts, bool calledOut) { bool global = true; QString line; Callout *callout = NULL; Range *range = NULL; Step *step = NULL; bool pliIgnore = false; bool partIgnore = false; bool synthBegin = false; bool multiStep = false; bool partsAdded = false; bool coverPage = false; bool bfxStore1 = false; bool bfxLoad = false; int numLines = ldrawFile.size(current.modelName); bool firstStep = true; steps->isMirrored = isMirrored; QList<InsertMeta> inserts; Where topOfStep = current; Rc gprc = OkRc; Rc rc; statusBar()->showMessage("Processing " + current.modelName); page.coverPage = false; QStringList calloutParts; /* * do until end of page */ for ( ; current <= numLines; current++) { Meta &curMeta = callout ? callout->meta : steps->meta; QStringList tokens; // If we hit end of file we've got to note end of step if (current >= numLines) { line.clear(); gprc = EndOfFileRc; tokens << "0"; // not end of file, so get the next LDraw line } else { line = ldrawFile.readLine(current.modelName,current.lineNumber); split(line,tokens); } if (tokens.size() == 15 && tokens[0] == "1") { QString color = tokens[1]; QString type = tokens[tokens.size()-1]; csiParts << line; partsAdded = true; /* since we have a part usage, we have a valid step */ if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } /* addition of ldraw parts */ if (curMeta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { QString colorType = color+type; if (! isSubmodel(type) || curMeta.LPub.pli.includeSubs.value()) { if (bfxStore2 && bfxLoad) { bool removed = false; for (int i = 0; i < bfxParts.size(); i++) { if (bfxParts[i] == colorType) { bfxParts.removeAt(i); removed = true; break; } } if ( ! removed) { pliParts << Pli::partLine(line,current,steps->meta); } } else { pliParts << Pli::partLine(line,current,steps->meta); } } if (bfxStore1) { bfxParts << colorType; } } /* if it is a sub-model, then process it */ if (ldrawFile.contains(type) && callout) { /* we are a callout, so gather all the steps within the callout */ /* start with new meta, but no rotation step */ if (callout->bottom.modelName != type) { Where current2(type,0); skipHeader(current2); callout->meta.rotStep.clear(); SubmodelStack tos(current.modelName,current.lineNumber,stepNum); callout->meta.submodelStack << tos; Meta saveMeta = callout->meta; callout->meta.LPub.pli.constrain.resetToDefault(); step->append(callout); calloutParts.clear(); QStringList csiParts2; QHash<QString, QStringList> calloutBfx; int rc; rc = drawPage( view, scene, callout, 1, line, current2, csiParts2, calloutParts, ldrawFile.mirrored(tokens), calloutBfx, printing, bfxStore2, bfxParts, true); callout->meta = saveMeta; if (callout->meta.LPub.pli.show.value() && ! callout->meta.LPub.callout.pli.perStep.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { pliParts += calloutParts; } if (rc != 0) { steps->placement = steps->meta.LPub.assem.placement; return rc; } } else { callout->instances++; pliParts += calloutParts; } /* remind user what file we're working on */ statusBar()->showMessage("Processing " + current.modelName); } } else if (tokens.size() > 0 && (tokens[0] == "2" || tokens[0] == "3" || tokens[0] == "4" || tokens[0] == "5")) { csiParts << line; partsAdded = true; /* we've got a line, triangle or polygon, so add it to the list */ /* and make sure we know we have a step */ if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, steps->meta, calledOut, multiStep); range->append(step); } } else if (tokens.size() > 0 && tokens[0] == "0" || gprc == EndOfFileRc) { /* must be meta-command (or comment) */ if (global && tokens.contains("!LPUB") && tokens.contains("GLOBAL")) { topOfStep = current; } else { global = false; } QString part; if (gprc == EndOfFileRc) { rc = gprc; } else { rc = curMeta.parse(line,current,true); } /* handle specific meta-commands */ switch (rc) { /* toss it all out the window, per James' original plan */ case ClearRc: pliParts.clear(); csiParts.clear(); steps->freeSteps(); break; /* Buffer exchange */ case BufferStoreRc: bfx[curMeta.bfx.value()] = csiParts; bfxStore1 = true; bfxParts.clear(); break; case BufferLoadRc: csiParts = bfx[curMeta.bfx.value()]; bfxLoad = true; break; case MLCadGroupRc: csiParts << line; break; case IncludeRc: include(curMeta); break; /* substitute part/parts with this */ case PliBeginSub1Rc: if (pliIgnore) { parseError("Nested PLI BEGIN/ENDS not allowed\n",current); } if (steps->meta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { SubData subData = curMeta.LPub.pli.begin.sub.value(); QString addPart = QString("1 0 0 0 0 0 0 0 0 0 0 0 0 0 %1") .arg(subData.part); pliParts << Pli::partLine(addPart,current,curMeta); } if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } pliIgnore = true; break; /* substitute part/parts with this */ case PliBeginSub2Rc: if (pliIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } if (steps->meta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { SubData subData = curMeta.LPub.pli.begin.sub.value(); QString addPart = QString("1 %1 0 0 0 0 0 0 0 0 0 0 0 0 %2") .arg(subData.color) .arg(subData.part); pliParts << Pli::partLine(addPart,current,curMeta); } if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } pliIgnore = true; break; /* do not put subsequent parts into PLI */ case PliBeginIgnRc: if (pliIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } pliIgnore = true; break; case PliEndRc: if ( ! pliIgnore) { parseError("PLI END with no PLI BEGIN",current); } pliIgnore = false; break; /* discard subsequent parts, and don't create CSI's for them */ case PartBeginIgnRc: case MLCadSkipBeginRc: if (partIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } partIgnore = true; break; case PartEndRc: case MLCadSkipEndRc: if (partIgnore) { parseError("Ignore ending with no ignore begin",current); } partIgnore = false; break; case SynthBeginRc: if (synthBegin) { parseError("Nested BEGIN/ENDS not allowed\n",current); } synthBegin = true; break; case SynthEndRc: if ( ! synthBegin) { parseError("Ignore ending with no ignore begin",current); } synthBegin = false; break; /* remove a group or all instances of a part type */ case GroupRemoveRc: case RemoveGroupRc: case RemovePartRc: case RemoveNameRc: { QStringList newCSIParts; if (rc == RemoveGroupRc) { remove_group(csiParts,steps->meta.LPub.remove.group.value(),newCSIParts); } else if (rc == RemovePartRc) { remove_parttype(csiParts, steps->meta.LPub.remove.parttype.value(),newCSIParts); } else { remove_partname(csiParts, steps->meta.LPub.remove.partname.value(),newCSIParts); } csiParts = newCSIParts; if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } } break; case ReserveSpaceRc: /* since we have a part usage, we have a valid step */ if (calledOut || multiStep) { step = NULL; Reserve *reserve = new Reserve(current,steps->meta.LPub); if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } range->append(reserve); } break; case InsertCoverPageRc: coverPage = true; page.coverPage = true; case InsertPageRc: partsAdded = true; break; case InsertRc: inserts.append(curMeta.LPub.insert); // these are always placed before any parts in step break; case CalloutBeginRc: if (callout) { parseError("Nested CALLOUT not allowed within the same file",current); } else { callout = new Callout(curMeta,view); callout->setTopOfCallout(current); } break; case CalloutDividerRc: if (range) { range->sepMeta = curMeta.LPub.callout.sep; range = NULL; step = NULL; } break; case CalloutPointerRc: if (callout) { callout->appendPointer(current,curMeta.LPub.callout); } break; case CalloutEndRc: if ( ! callout) { parseError("CALLOUT END without a CALLOUT BEGIN",current); } else { callout->parentStep = step; callout->parentRelativeType = step->relativeType; callout->pli.clear(); callout->placement = curMeta.LPub.callout.placement; callout->setBottomOfCallout(current); callout = NULL; } break; case StepGroupBeginRc: if (calledOut) { parseError("MULTI_STEP not allowed inside callout models",current); } else { if (multiStep) { parseError("Nested MULTI_STEP not allowed",current); } multiStep = true; } steps->relativeType = StepGroupType; break; case StepGroupDividerRc: if (range) { range->sepMeta = steps->meta.LPub.multiStep.sep; range = NULL; step = NULL; } break; /* finished off a multiStep */ case StepGroupEndRc: if (multiStep) { // save the current meta as the meta for step group // PLI for non-pli-per-step if (partsAdded) { parseError("Expected STEP before MULTI_STEP END", current); } multiStep = false; if (pliParts.size() && steps->meta.LPub.multiStep.pli.perStep.value() == false) { steps->pli.bom = false; steps->pli.setParts(pliParts,steps->stepGroupMeta); steps->pli.sizePli(&steps->stepGroupMeta, StepGroupType, false); } pliParts.clear(); /* this is a page we're supposed to process */ steps->placement = steps->meta.LPub.multiStep.placement; showLine(steps->topOfSteps()); bool endOfSubmodel = stepNum == ldrawFile.numSteps(current.modelName); int instances = ldrawFile.instances(current.modelName,isMirrored); addGraphicsPageItems(steps, coverPage, endOfSubmodel,instances, view, scene,printing); return HitEndOfPage; } break; /* we're hit some kind of step, or implied step and end of file */ case EndOfFileRc: case RotStepRc: case StepRc: if ( ! partsAdded && bfxLoad) { // special case of no parts added, but BFX load if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } int rc = step->createCsi( isMirrored ? addLine : "1 color 0 0 0 1 0 0 0 1 0 0 0 1 foo.ldr", csiParts, &step->csiPixmap, steps->meta); partsAdded = true; // OK, so this is a lie, but it works } if (partsAdded) { if (firstStep) { steps->stepGroupMeta = curMeta; firstStep = false; } if (pliIgnore) { parseError("PLI BEGIN then STEP. Expected PLI END",current); pliIgnore = false; } if (partIgnore) { parseError("PART BEGIN then STEP. Expected PART END",current); partIgnore = false; } if (synthBegin) { parseError("SYNTH BEGIN then STEP. Expected SYNTH_END",current); synthBegin = false; } bool pliPerStep; if (multiStep && steps->meta.LPub.multiStep.pli.perStep.value()) { pliPerStep = true; } else if (calledOut && steps->meta.LPub.callout.pli.perStep.value()) { pliPerStep = true; } else if ( ! multiStep && ! calledOut) { pliPerStep = true; } else { pliPerStep = false; } if (step) { Page *page = dynamic_cast<Page *>(steps); if (page) { page->inserts = inserts; } if (pliPerStep) { PlacementType relativeType; if (multiStep) { relativeType = StepGroupType; } else if (calledOut) { relativeType = CalloutType; } else { relativeType = SingleStepType; } step->pli.setParts(pliParts,steps->meta); pliParts.clear(); step->pli.sizePli(&steps->meta,relativeType,pliPerStep); } int rc = step->createCsi( isMirrored ? addLine : "1 color 0 0 0 1 0 0 0 1 0 0 0 1 foo.ldr", csiParts, &step->csiPixmap, steps->meta); statusBar()->showMessage("Processing " + current.modelName); if (rc) { return rc; } } else { if (pliPerStep) { pliParts.clear(); } /* * Only pages or step can have inserts.... no callouts */ if ( ! multiStep && ! calledOut) { Page *page = dynamic_cast<Page *>(steps); if (page) { page->inserts = inserts; } } } if ( ! multiStep && ! calledOut) { /* * Simple step */ if (steps->list.size() == 0) { steps->relativeType = PageType; } steps->placement = steps->meta.LPub.assem.placement; showLine(topOfStep); int numSteps = ldrawFile.numSteps(current.modelName); bool endOfSubmodel = numSteps == 0 || stepNum == numSteps; int instances = ldrawFile.instances(current.modelName,isMirrored); addGraphicsPageItems(steps,coverPage,endOfSubmodel,instances,view,scene,printing); stepPageNum += ! coverPage; steps->setBottomOfSteps(current); return HitEndOfPage; } steps->meta.pop(); stepNum += partsAdded; topOfStep = current; partsAdded = false; coverPage = false; step = NULL; bfxStore2 = bfxStore1; bfxStore1 = false; bfxLoad = false; } inserts.clear(); steps->setBottomOfSteps(current); break; case RangeErrorRc: showLine(current); QMessageBox::critical(NULL, QMessageBox::tr("LPub"), QMessageBox::tr("Parameter(s) out of range: %1:%2\n%3") .arg(current.modelName) .arg(current.lineNumber) .arg(line)); return RangeErrorRc; break; default: break; } } else if (line != "") { showLine(current); QMessageBox::critical(NULL, QMessageBox::tr("LPub"), QMessageBox::tr("Invalid LDraw Line Type: %1:%2\n %3") .arg(current.modelName) .arg(current.lineNumber) .arg(line)); return InvalidLDrawLineRc; } } steps->meta.rotStep.clear(); return 0; }