示例#1
0
void Plotter::Keyboard(View&, unsigned char key, int /*x*/, int /*y*/, bool pressed)
{
    const float mvfactor = 1.0f / 10.0f;

    const float c[2] = {
        track || trigger_edge ? target.x.max : rview.x.Mid(),
        rview.y.Mid()
    };

    if(pressed) {
        if(key == ' ') {
            if( selection.Area() <= 0.0f) {
                // Work out Auto zoom selection bounds
                selection = ComputeAutoSelection();
            }

            if( selection.Area() > 0.0f) {
                // Set view to equal selection
                SetViewSmooth(selection);

                // Reset selection
                selection.x.max = selection.x.min;
                selection.y.max = selection.y.min;
            }
        }else if(key == PANGO_SPECIAL + PANGO_KEY_LEFT) {
            const float w = rview.x.Size();
            const float dx = mvfactor*w;
            ScrollViewSmooth(-dx, 0);
        }else if(key == PANGO_SPECIAL + PANGO_KEY_RIGHT) {
            const float w = rview.x.Size();
            const float dx = mvfactor*w;
            ScrollViewSmooth(+dx, 0);
        }else if(key == PANGO_SPECIAL + PANGO_KEY_DOWN) {
            const float h = target.y.Size();
            const float dy = mvfactor*h;
            ScrollViewSmooth(0, -dy);
        }else if(key == PANGO_SPECIAL + PANGO_KEY_UP) {
            const float h = target.y.Size();
            const float dy = mvfactor*h;
            ScrollViewSmooth(0, +dy);
        }else if(key == '=') {
            ScaleViewSmooth(0.5, 0.5, c[0], c[1]);
        }else if(key == '-') {
            ScaleViewSmooth(2.0, 2.0, c[0], c[1]);
        }else if(key == 'r') {
            ResetView();
        }else if(key == 't') {
            ToggleTracking();
        }else if(key == 'e') {
            ToggleTrigger();
        }
    }
}
/** Toggles tracking. */
void FStackTracker::ToggleTracking()
{
	ToggleTracking(!bIsEnabled, false);
}