示例#1
0
bool Liveplay::on_keyboard_arrows(GtkAccelGroup *accel_group, GObject *acceleratable,
                                  guint keyval, GdkModifierType modifier, Liveplay& self) {
    if (keyval == GDK_KEY_Left || keyval == GDK_KEY_Right) {
        Gtk::Adjustment *a = self.brightness_slider->get_adjustment();
        double val = a->get_value();
        double step = a->get_step_increment();
        if (keyval == GDK_KEY_Left) {
            val -= step;
        } else {
            val += step;
        }
        a->set_value(val);
    } else {
        Gtk::Adjustment *a = self.background_slider->get_adjustment();
        double val = a->get_value();
        double step = a->get_step_increment();
        if (keyval == GDK_KEY_Down) {
            val -= step;
        } else {
            val += step;
        }
        a->set_value(val);
    }
    return true;
}
示例#2
0
    void HDRPage::OnShutterScroll( int image )
    {
        Gtk::Adjustment* pAdjustment = m_hdrImageArray[image].pAdjustmentShutter;
        
        double value = pAdjustment->get_value();

        SetShutter( image, static_cast<unsigned int>(value) );
    }
示例#3
0
//
// 左スクロール
//
void ImageViewMain::scroll_left()
{
#ifdef _DEBUG
    std::cout << "ImageViewMain::scroll_left\n";
#endif

    Gtk::Adjustment*  hadjust = m_scrwin->get_hadjustment();
    if( !hadjust ) return;
    hadjust->set_value( MAX( 0,  hadjust->get_value() - hadjust->get_step_increment() ) );
}
示例#4
0
//
// 上スクロール
//
void ImageViewMain::scroll_up()
{
#ifdef _DEBUG
    std::cout << "ImageViewMain::scroll_up\n";
#endif

    Gtk::Adjustment*  vadjust = m_scrwin->get_vadjustment();
    if( !vadjust ) return;
    vadjust->set_value( MAX( 0,  vadjust->get_value() - vadjust->get_step_increment() ) );
}
示例#5
0
bool MyPaintBox::on_expose_event(GdkEventExpose *event) {
    call_paint_func(event);
    Cairo::RefPtr<Cairo::Context> cr = Glib::wrap(event->window, true)->create_cairo_context();
    gdk_cairo_region(cr->cobj(), event->region);
    cr->clip();
    cr->set_source_rgba(0.0, 0.0, 0.0, 1-background_adj->get_value());
    cr->paint();
    foreach(sigc::bind(sigc::mem_fun(this, &MyPaintBox::propagate_expose), event));
    return true;
}
示例#6
0
//
// 右スクロール
//
void ImageViewMain::scroll_right()
{
#ifdef _DEBUG
    std::cout << "ImageViewMain::scroll_right\n";
#endif

    Gtk::Adjustment*  hadjust = m_scrwin->get_hadjustment();
    if( !hadjust ) return;
    hadjust->set_value(  MIN( hadjust->get_upper() - hadjust->get_page_size(),
                              hadjust->get_value() + hadjust->get_step_increment() ) );
}
示例#7
0
//
// 下スクロール
//
void ImageViewMain::scroll_down()
{
#ifdef _DEBUG
    std::cout << "ImageViewMain::scroll_down\n";
#endif

    Gtk::Adjustment*  vadjust = m_scrwin->get_vadjustment();
    if( !vadjust ) return;
    vadjust->set_value(  MIN( vadjust->get_upper() - vadjust->get_page_size(),
                              vadjust->get_value() + vadjust->get_step_increment() ) );
}
示例#8
0
void
gui_window_gtk2::scroll_adjust (Gtk::Adjustment & hadjust, double step)
{
    double val = hadjust.get_value();
    double upper = hadjust.get_upper();
    double nextval = val + step;
    bool forward = step >= 0.0;
    if (forward)
    {
        if (nextval > upper)
            nextval = upper;
    }
    else
    {
        if (nextval < 0.0)
            nextval = 0.0;
    }
    hadjust.set_value(nextval);
}
示例#9
0
int CodeView::scroll_to_line_internal(size_t line)
{
    Gtk::Adjustment* adj = get_vadjustment();
    assert(adj);

    assert(line_count());
    const double pointsPerLine = adj->get_upper() / line_count();
    // compute the top-most visible line
    const size_t top = static_cast<size_t>(rint(adj->get_value() / pointsPerLine));
    const size_t linesInView = static_cast<size_t>(floor(height() / pointsPerLine));

    if ((line < top) || (line >= top + linesInView))
    {
        if (line)
        {
            --line;
        }
        const double a = floor(line * pointsPerLine);
        adj->set_value(a);
    }
    return 0;
}
示例#10
0
	float get_radius()const { return adj_radius.get_value(); }
示例#11
0
	Real get_feather() const { return adj_feather.get_value(); }
示例#12
0
//
// マウスモーション
//
bool ImageViewMain::slot_motion_notify( GdkEventMotion* event )
{
    ImageViewBase::slot_motion_notify( event );

    // スクロールバー移動
    if( m_scrwin ){

        GdkEventButton event_button;
        get_control().get_eventbutton( CONTROL::ScrollImageButton, event_button );

#ifdef _DEBUG
//        std::cout << "state = " << event->state << " / " << GDK_BUTTON1_MASK << " button = " << event_button.button << std::endl;
#endif

        if( ( ( event->state & GDK_BUTTON1_MASK ) && event_button.button == 1 )
            || ( ( event->state & GDK_BUTTON2_MASK ) && event_button.button == 2 )
            || ( ( event->state & GDK_BUTTON3_MASK ) && event_button.button == 3 )
            ){

            Gtk::Adjustment* hadj = m_scrwin->get_hadjustment();
            Gtk::Adjustment* vadj = m_scrwin->get_vadjustment();

            gdouble dx = event->x_root - m_x_motion;
            gdouble dy = event->y_root - m_y_motion;

#ifdef _DEBUG
//            std::cout << "dx = " << dx << " dy = " << dy << std::endl;
#endif

            m_x_motion = event->x_root;
            m_y_motion = event->y_root;

            if( hadj ) hadj->set_value(
                MAX( hadj->get_lower(), MIN( hadj->get_upper() - hadj->get_page_size(), hadj->get_value() - dx ) ) );

            if( vadj ) vadj->set_value(
                MAX( vadj->get_lower(), MIN( vadj->get_upper() - vadj->get_page_size(), vadj->get_value() - dy ) ) );

            m_scrolled = true;
        }
    }

    return true;
}
示例#13
0
	Real get_delta()const { return adj_delta.get_value(); }