void ColorStepView::_InitView() { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BRect sliderFrame(Bounds()); fSlider = new BSlider(sliderFrame, "StepSlider", B_TRANSLATE("Step up by CPU usage"), new BMessage(kSteppingChanged), 0, 100); fSlider->SetModificationMessage(new BMessage(kMSGSliderChanged)); fSliderPosition = 0.25 - fNSteps * 0.05; fSlider->SetPosition(fSliderPosition); fSlider->SetLimitLabels("0%", "100%"); fSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fSlider->SetHashMarkCount(5); AddChild(fSlider); }
//-------------------------------------------------------------- void testApp::draw() { #ifdef USE_FIDUCIAL_TRACKER ofPoint drawVideoSize(fiducials.width,fiducials.height); ofPoint scale = drawVideoSize / videoSize; #endif glPushMatrix(); glPixelZoom(scale.x, -scale.y); glRasterPos2f(10 + 0*(drawVideoSize.x+10), 10 + 0*(drawVideoSize.y+10)); glDrawPixels(imRGB); #ifdef USE_FIDUCIAL_TRACKER glRasterPos2f(10 + 1*(drawVideoSize.x+10), 10 + 0*(drawVideoSize.y+10)); glDrawPixels(fiducials.imBW); glRasterPos2f(10 + 2*(drawVideoSize.x+10), 10 + 0*(drawVideoSize.y+10)); glDrawPixels(fiducials.imThreshold); #endif #ifdef USE_SKIN_DETECTOR glRasterPos2f(10 + 0*(drawVideoSize.x+10), 10 + 1*(drawVideoSize.y+10)); glDrawPixels(skin.imBlur); glRasterPos2f(10 + 1*(drawVideoSize.x+10), 10 + 1*(drawVideoSize.y+10)); glDrawPixels(skin.imSkin); glRasterPos2f(10 + 2*(drawVideoSize.x+10), 10 + 1*(drawVideoSize.y+10)); glDrawPixels(skin.imMedian); glRasterPos2f(10 + 3*(drawVideoSize.x+10), 10 + 1*(drawVideoSize.y+10)); glDrawPixels(skin.imEroded); #endif glRasterPos2f(0.,0.); glPopMatrix(); #ifdef USE_FIDUCIAL_TRACKER if (mixer.fiducials==NULL) return; list<ofxFiducial>& fiducials = *mixer.fiducials; list<ofxFiducial>::iterator fiducial; Marsyas::MarSystem* channel; string query; ofRectangle channelFrame(10,drawVideoSize.y+20, 100,100); ofRectangle sliderFrame(0,0, 100,12); string fiducialStr, channelNameStr; ofPoint textOffset; double pitch, gain; /* string pitchStr = ofToString(net.pitch, 2); float w = font.stringWidth(pitchStr); float h = font.stringHeight(pitchStr); font.drawString(pitchStr, ((float)ofGetWidth() - w) / 2, ((float)ofGetHeight()/2) + (h/2) + drawVideoSize.y + 20); */ cameraImage.draw(ofGetWidth() - (640/1.5) - 10, ofGetHeight() - (480/1.5) - 10, (640/1.5), (480/1.5)); for (fiducial = fiducials.begin(); fiducial != fiducials.end(); fiducial++) { if (fiducial->getId() == 1) continue; // Start searching for SoundFileChannel query = "SoundFileChannel/"+ofToString(fiducial->getId()); channel = mixer.channels->getChildMarSystem(query); // Try searching for MicrophoneChannel if (channel == NULL) { query = "MicrophoneChannel/"+ofToString(fiducial->getId()); channel = mixer.channels->getChildMarSystem(query); channelNameStr = "Microphone"; } else { channelNameStr = channel->getctrl("mrs_string/filename")->to<Marsyas::mrs_string>(); } if (channel!=NULL) { textOffset.set(0,10); fiducialStr = "fiducial " + ofToString(fiducial->getId()); gain = channel->getctrl("mrs_real/gain")->to<Marsyas::mrs_real>(); pitch = channel->getctrl("mrs_real/pitch")->to<Marsyas::mrs_real>(); fiducialImages[fiducial->getId()].draw(channelFrame.x, channelFrame.y, channelFrame.height, channelFrame.height); font_sm.drawString(fiducialStr, channelFrame.x, channelFrame.y + channelFrame.height + 10); textOffset.x = channelFrame.x + channelFrame.height + 10; textOffset.y += 6; sliderFrame.x = textOffset.x; sliderFrame.y = channelFrame.y + textOffset.y + font.stringHeight(fiducialStr) - 10; ofSetColor(0x555555); ofRect(sliderFrame.x-1, sliderFrame.y-1, sliderFrame.width+2, sliderFrame.height+2); ofFill(); ofSetColor(0x222222); ofRect(sliderFrame.x, sliderFrame.y, sliderFrame.width, sliderFrame.height); ofSetColor(0xdddddd); ofRect(sliderFrame.x, sliderFrame.y, sliderFrame.width * gain, sliderFrame.height); ofSetColor(0xffffff); font.drawString(channelNameStr, textOffset.x, channelFrame.y + textOffset.y); textOffset.y += font.stringHeight(channelNameStr); textOffset.x += sliderFrame.width; font.drawString(", " + ofToString(pitch, 3) + "x", textOffset.x, channelFrame.y + textOffset.y); channelFrame.y += channelFrame.height + 20; } } #endif }
BView* PrefsWindow::constructColourBox(BRect frame) { BBox* colourBox = new BBox(frame); colourBox->SetLabel("TexView"); float offset = 30.0f, texViewWidth = 280.0f, texHeight = 200.0f, adjust = 5.0f, cbheight = 14.0f, cbspacing = 10.0f, bwidth = 80.0f, bheight = 30.0f, bspacing = 10.0f ; BRect bounds = colourBox->Bounds(); float texViewX1 = bounds.right - texViewWidth - (offset * 2.0f / 3.0f); float texViewX2 = bounds.right - (offset * 2.0f / 3.0f) - B_V_SCROLL_BAR_WIDTH; BRect texViewRect(texViewX1, offset - adjust, texViewX2, offset + texHeight - adjust); BRect texViewTextRect(texViewRect); /*TexView *texView = new TexView(texViewRect, texViewTextRect, prefs); BString sampleText = "Welcome to \\betex!\\\\\n%This is a Comment\n$Phe\\alpha r the Calculus$\n\\subsection{About \\betex}\n\\betex is \\textbf{cool}!\\\\\n``To Be Or Not To Be\'\'\n"; texView->SetText(sampleText.String(),sampleText.Length()); texView->MakeEditable(false); texView->MakeSelectable(false); BScrollView *texViewScroll = new BScrollView("textViewScroll", texView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE, false, true, B_FANCY_BORDER); texViewScroll->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); colourBox->AddChild(texViewScroll); texView->SetTextRect(texView->Bounds());*/ //fg colour button BRect ccRect((offset*2/3),offset-adjust,offset+150,offset+cbheight-adjust); rgb_color fgColour; ColourButton *fgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_FG_COLOUR), fgColour," Text"); colourBox->AddChild(fgColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color bgColour; ColourButton *bgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_BG_COLOUR), bgColour, "Background"); colourBox->AddChild(bgColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color genericCmdColour; ColourButton *genericCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_GEN_CMD_COLOUR), genericCmdColour, "Generic Commands"); colourBox->AddChild(genericCmdColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color formatCmdColour; ColourButton *formatCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_FORMAT_CMD_COLOUR), formatCmdColour, "Formatting Commands"); colourBox->AddChild(formatCmdColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color specialCmdColour; ColourButton *specialCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_SPECIAL_CMD_COLOUR), specialCmdColour, "Special Commands"); colourBox->AddChild(specialCmdColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color mathModeColour; ColourButton *mathModeColourButton = new ColourButton(ccRect, GetPrefsMessage(K_MATH_MODE_COLOUR), mathModeColour, "Math Mode"); colourBox->AddChild(mathModeColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color commaColour; ColourButton *commaColourButton = new ColourButton(ccRect, GetPrefsMessage(K_COMMA_COLOUR), commaColour, "Quotation Marks"); colourBox->AddChild(commaColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color commentColour; ColourButton *commentColourButton = new ColourButton(ccRect,GetPrefsMessage(K_COMMENT_COLOUR),commentColour,"Comments"); colourBox->AddChild(commentColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); rgb_color puncSymbolColour; ColourButton *puncSymbolColourButton = new ColourButton(ccRect,GetPrefsMessage(K_PUNC_SYMBOL_COLOUR),puncSymbolColour,"Punctuation / Symbols"); colourBox->AddChild(puncSymbolColourButton); ccRect.OffsetBy(0,cbheight+cbspacing); //rgb_color htmlColour; //ColourButton *htmlColourButton = new ColourButton(ccRect,GetPrefsMessage(K_HTML_COLOUR), htmlColour,"Urls"); //colourBox->AddChild(htmlColourButton); BRect cbRect = colourBox->Bounds(); BRect cbbtnRect(cbRect.right - bspacing - bwidth, cbRect.bottom - bspacing - bheight, cbRect.right - bspacing, cbRect.bottom - bspacing); BButton *resetColourDefaults = new BButton(cbbtnRect,"fResetColorDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_COLOUR_DEFAULTS)); colourBox->AddChild(resetColourDefaults); float sliderWidth = 300.0f, vertOffset = 50.0f, minVal = 5.0f, maxVal = 30.0f ; BRect sliderFrame(ccRect.left, ccRect.top + vertOffset, ccRect.left + sliderWidth, ccRect.top + vertOffset + 100.0f); BSlider *fontSizeSlider = new BSlider(sliderFrame, K_FONT_SIZE, "Font Size", GetPrefsMessage(K_FONT_SIZE), minVal, maxVal); colourBox->AddChild(fontSizeSlider); fontSizeSlider->SetBarColor(ui_color(B_WINDOW_TAB_COLOR)); fontSizeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fontSizeSlider->SetHashMarkCount(26); float fontSize = 12.0f; fontSizeSlider->SetValue(fontSize); fontSizeSlider->SetLimitLabels("Small","Large"); fontSizeSlider->SetModificationMessage(GetPrefsMessage(K_FONT_SIZE)); rgb_color fire_r = {223,0,50}; const rgb_color* fillcolor = &fire_r; fontSizeSlider->UseFillColor(true,fillcolor); return colourBox; }