예제 #1
0
파일: uitextedit.c 프로젝트: Fluray/OrzOs
static void textEditPaint(struct OzUIWidget *widget)
{
    struct Rect rect, cursorRect;
    struct OzUITextEdit *textEdit;
    struct Point p1, p2;
    int dx, dy;

    textEdit = (struct OzUITextEdit*)widget->d;
    initRect(&rect, 0, 0, widget->rect.w, widget->rect.h);
    //initRect(&tlc.rect, 0, 0, 100000, 100000);
    OzUIWidgetDrawRectangle(widget, &rect, &blackLS, &whiteFS);
    if (textEdit && textEdit->layout) {
        copyRect(&cursorRect, &textEdit->layout->charLayout[textEdit->cursorPos].rect);
        cursorRect.w = textEdit->fontSize/2;

        dx = dy = 0;
        if (rectLeft(&cursorRect) < rectLeft(&rect))
            dx =  rectLeft(&rect) - rectLeft(&cursorRect);
        if (rectRight(&cursorRect) > rectRight(&rect))
            dx =  rectRight(&rect) - rectRight(&cursorRect);
        if (rectTop(&cursorRect) < rectTop(&rect))
            dy =  rectTop(&rect) - rectTop(&cursorRect);
        if (rectBottom(&cursorRect) > rectBottom(&rect))
            dy =  rectBottom(&rect) - rectBottom(&cursorRect);

        OzUITextLayoutTransform(textEdit->layout, dx, dy);
        translateRect(&cursorRect, dx, dy);
        OzUIWidgetDrawTextLayout(widget, &tlc, &blackLS, textEdit->layout);
        if (widget->window->focusWidget == widget) {
            p1.x = rectLeft(&cursorRect);
            p1.y = rectBottom(&cursorRect);
            p2.x = rectRight(&cursorRect);
            p2.y = rectBottom(&cursorRect);
            OzUIWidgetDrawLine(widget, &p1, &p2, &blackLS);
        }
    }
}
예제 #2
0
//--------------------------------------------------------------
void ofApp::draw(){

    // split the screen into two rectangles, top and bottom.
    // these rectangle objects will be used to draw the audio samples
    // for the left and right channels.
    
    ofRectangle rectTop(0, 0, ofGetWidth(), ofGetHeight() * 0.5);
    ofRectangle rectBot(0, ofGetHeight() * 0.5, ofGetWidth(), ofGetHeight() * 0.5);
    
    ofPushStyle();
    
    ofSetColor(ofColor::paleGreen);
    ofRect(rectTop);
    
    ofSetColor(ofColor::paleVioletRed);
    ofRect(rectBot);
    
    ofNoFill();
    ofSetLineWidth(4);
    ofSetColor(ofColor::white);
    
    ofRect(rectTop);
    ofRect(rectBot);
    
    ofSetColor(ofColor::black);
    ofDrawBitmapString("LEFT CHANNEL", 10, 20);
    ofDrawBitmapString("RIGHT CHANNEL", 10, ofGetHeight() * 0.5 + 20);
    
    ofPopStyle();
    
    //----------------------------------------------------------
    ofPushMatrix();
    ofTranslate(0, ofGetHeight() * 0.5);
    drawSamples(fftChannelL.getFftNormData());
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(0, ofGetHeight() * 1.0);
    drawSamples(fftChannelR.getFftNormData());
    ofPopMatrix();
}