Пример #1
0
void
RouteWindow::Zoom(BPoint origin, float width, float height)
{
	D_HOOK(("RouteWindow::Zoom()\n"));

	m_zooming = true;

	BScreen screen(this);
	if (!screen.Frame().Contains(Frame())) {
		m_zoomed = false;
	}

	if (!m_zoomed) {
		// resize to the ideal size
		m_manualSize = Bounds();
		float width, height;
		m_routingView->GetPreferredSize(&width, &height);
		width += B_V_SCROLL_BAR_WIDTH;
		height += B_H_SCROLL_BAR_HEIGHT;
		if (KeyMenuBar()) {
			height += KeyMenuBar()->Frame().Height();
		}
		ResizeTo(width, height);
		_constrainToScreen();
		m_zoomed = true;
	}
	else {
		// resize to the most recent manual size
		ResizeTo(m_manualSize.Width(), m_manualSize.Height());
		m_zoomed = false;
	}
}
Пример #2
0
void ParameterWindow::Zoom(
    BPoint origin,
    float width,
    float height) {
    D_HOOK(("ParameterWindow::Zoom()\n"));

    m_zooming = true;

    BScreen screen(this);
    if (!screen.Frame().Contains(Frame())) {
        m_zoomed = false;
    }

    if (!m_zoomed) {
        // resize to the ideal size
        m_manualSize = Bounds();
        ResizeTo(m_idealSize.Width(), m_idealSize.Height());
        _constrainToScreen();
        m_zoomed = true;
    }
    else {
        // resize to the most recent manual size
        ResizeTo(m_manualSize.Width(), m_manualSize.Height());
        m_zoomed = false;
    }
}
Пример #3
0
void ParameterWindow::_init() {
    D_INTERNAL(("ParameterWindow::_init()\n"));

    // offset to a new position
    _constrainToScreen();
    m_manualSize = Bounds().OffsetToCopy(0.0, 0.0);

    // add the hidden option to close this window when the
    // control panel has been started successfully
    BMessage *message = new BMessage(M_START_CONTROL_PANEL);
    message->AddBool("replace", true);
    AddShortcut('P', B_COMMAND_KEY | B_SHIFT_KEY | B_OPTION_KEY,
                message);
}
Пример #4
0
void ParameterWindow::MessageReceived(
    BMessage *message) {
    D_MESSAGE(("ParameterWindow::MessageReceived()\n"));

    switch (message->what) {
    case M_START_CONTROL_PANEL: {
        D_MESSAGE((" -> M_START_CONTROL_PANEL\n"));
        status_t error = _startControlPanel();
        if (error) {
            BString s = "Could not start control panel";
            s << " (" << strerror(error) << ")";
            BAlert *alert = new BAlert("", s.String(), "OK", 0, 0,
                                       B_WIDTH_AS_USUAL, B_WARNING_ALERT);
            alert->Go(0);
        }
        bool replace = false;
        if ((message->FindBool("replace", &replace) == B_OK)
                && (replace == true)) {
            PostMessage(B_QUIT_REQUESTED);
        }
        break;
    }
    case M_THEME_SELECTED: {
        D_MESSAGE((" -> M_THEME_SELECTED\n"));
        int32 themeID;
        if (message->FindInt32("themeID", &themeID) != B_OK) {
            return;
        }
        // not yet implemented
        break;
    }
    case B_MEDIA_WEB_CHANGED: {
        D_MESSAGE((" -> B_MEDIA_WEB_CHANGED\n"));
        _updateParameterView();
        _constrainToScreen();
        break;
    }
    default: {
        BWindow::MessageReceived(message);
    }
    }
}
Пример #5
0
void
RouteWindow::constrainToScreen()
{
	BScreen screen(this);

	const BRect sr = screen.Frame();

	// [c.lenz 1mar2000] this should be handled by every window
	// itself. will probably change soon ;-)
	_constrainToScreen();
/*	// main window
	BRect r = Frame();
	BPoint offset(0.0, 0.0);
	if(r.left < 0.0)
		offset.x = -r.left;
	if(r.top < 0.0)
		offset.y = -r.top;
	if(r.left >= (sr.right - 20.0))
		offset.x -= (r.left - (sr.Width()/2));
	if(r.top >= (sr.bottom - 20.0))
		offset.y -= (r.top - (sr.Height()/2));
	if(offset.x != 0.0 || offset.y != 0.0) {
		setPullPalettes(false);
		MoveBy(offset.x, offset.y);
	}*/

	// transport window
	BPoint offset = BPoint(0.0, 0.0);
	BRect r = (m_transportWindow) ?
			   m_transportWindow->Frame() :
			   m_transportWindowFrame;
	if(r.left < 0.0)
		offset.x = (sr.Width()*.75) - r.left;
	if(r.top < 0.0)
		offset.y = (sr.Height()*.25) - r.top;
	if(r.left >= (sr.right - 20.0))
		offset.x -= (r.left - (sr.Width()/2));
	if(r.top >= (sr.bottom - 20.0))
		offset.y -= (r.top - (sr.Height()/2));

	if(offset.x != 0.0 || offset.y != 0.0) {
		if(m_transportWindow)
			m_transportWindow->MoveBy(offset.x, offset.y);
		else
			m_transportWindowFrame.OffsetBy(offset.x, offset.y);
	}

	// addon palette
	offset = BPoint(0.0, 0.0);
	r = (m_dormantNodeWindow) ?
		m_dormantNodeWindow->Frame() :
		m_dormantNodeWindowFrame;
	if(r.left < 0.0)
		offset.x = (sr.Width()*.25) - r.left;
	if(r.top < 0.0)
		offset.y = (sr.Height()*.125) - r.top;
	if(r.left >= (sr.right - 20.0))
		offset.x -= (r.left - (sr.Width()/2));
	if(r.top >= (sr.bottom - 20.0))
		offset.y -= (r.top - (sr.Height()/2));

	if(offset.x != 0.0 || offset.y != 0.0) {
		if(m_dormantNodeWindow)
			m_dormantNodeWindow->MoveBy(offset.x, offset.y);
		else
			m_dormantNodeWindowFrame.OffsetBy(offset.x, offset.y);
	}

}