Exemplo n.º 1
0
static void
lmplayer_lyric_widget_da_set_color(LmplayerLyricWidget *lyric, const GdkColor *bg,
									   const GdkColor *text,
									   const GdkColor *hilight)
{
	g_return_if_fail(LMPLAYER_IS_LYRIC_WIDGET_DA(lyric));

	LmplayerLyricWidgetDaPrivate *priv = LMPLAYER_LYRIC_WIDGET_DA(lyric)->priv;

	if(bg)
	{
		priv->bg.red = bg->red;
		priv->bg.green = bg->green;
		priv->bg.blue = bg->blue;
		priv->bg.pixel = bg->pixel;
	}

	if(text)
	{
		priv->fg.red = text->red;
		priv->fg.green = text->green;
		priv->fg.blue = text->blue;
		priv->fg.pixel = text->pixel;
	}

	if(hilight)
	{
		priv->current.red = hilight->red;
		priv->current.green = hilight->green;
		priv->current.blue = hilight->blue;
		priv->current.pixel = hilight->pixel;
	}

	update_pixmap(LMPLAYER_LYRIC_WIDGET_DA(lyric));
}
Exemplo n.º 2
0
void Window::gaussian_blur()
{
    pic::Image *output = pic::FilterGaussian2D::execute(image, NULL, 4.0f);
    delete image;
    image = output;
    update_pixmap();
}
Exemplo n.º 3
0
static gboolean
lmplayer_lyric_widget_da_add_file(LmplayerLyricWidget *lyric, const gchar *file)
{
	g_return_val_if_fail(LMPLAYER_IS_LYRIC_WIDGET_DA(lyric), FALSE);
	g_return_val_if_fail(file != NULL, FALSE);

	LmplayerLyricWidgetDaPrivate *priv = LMPLAYER_LYRIC_WIDGET_DA(lyric)->priv;

	if(g_access(file, R_OK) != 0) return FALSE;

	if(priv->lines != NULL) 
	{
		g_list_free(priv->lines);
		priv->lines = NULL;
		priv->da_height = 0;
	}

	priv->loaded = parse_lyric_file_without_check(LMPLAYER_LYRIC_WIDGET_DA(lyric), file);
	if(priv->loaded)
	{
		gtk_layout_move(GTK_LAYOUT(lyric), priv->alignment, 0, 0);
		
		gdk_window_invalidate_rect(priv->da->window, NULL, FALSE);
	}

	priv->changed = TRUE;
	priv->current_second = -1;

	update_pixmap(LMPLAYER_LYRIC_WIDGET_DA(lyric));

	return priv->loaded;
}
Exemplo n.º 4
0
void
seqdata::change_horz ()
{
    m_scroll_offset_ticks = int(m_hadjust.get_value());
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;
    update_pixmap();
    force_draw();
}
Exemplo n.º 5
0
void
seqtime::redraw ()
{
    m_scroll_offset_ticks = int(m_hadjust.get_value());
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;
    update_pixmap();
    draw_pixmap_on_window();
}
Exemplo n.º 6
0
void
seqtime::change_horz( )
{
    m_scroll_offset_ticks = (int) m_hadjust->get_value();
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;

    update_pixmap();
    force_draw();    
}
Exemplo n.º 7
0
void
seqkeys::draw_area()
{
    update_pixmap();
    m_window->draw_drawable
    (
        m_gc, m_pixmap, 0, m_scroll_offset_y, 0, 0, c_keyarea_x, c_keyarea_y
    );
}
Exemplo n.º 8
0
static gboolean
da_configure_cb(GtkWidget *widget, GdkEventExpose *event, LmplayerLyricWidgetDa *lyric)
{
	GtkAllocation allocation;
	gtk_widget_get_allocation(widget, &allocation);
	g_print("da configure cbw: %d h: %d\n", allocation.width, allocation.height);
	update_pixmap(lyric);
	g_print("da configure cb done\n");
}
Exemplo n.º 9
0
void
seqroll::redraw_events ()
{
    if (m_ignore_redraw)
        return;

    update_pixmap();
    force_draw();
}
Exemplo n.º 10
0
void 
seqtime::reset()
{
    m_scroll_offset_ticks = (int) m_hadjust->get_value();
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;

    update_sizes();
    update_pixmap();
    draw_pixmap_on_window();
}
Exemplo n.º 11
0
void
seqtime::update_sizes ()
{
    if (is_realized())                                  /* set this for later */
    {
        m_pixmap = Gdk::Pixmap::create(m_window, m_window_x, m_window_y, -1);
        update_pixmap();
        queue_draw();
    }
}
Exemplo n.º 12
0
void DrawArea::on_reset_ca(sca::ca::input_ca *new_ca)
{
	ca = new_ca;

	update_pixmap(); // TODO: useless?
	state_machine.trigger_throw();
	if(state_machine.get() != StateMachine::STATE_INSTABLE)
	{
		next_fire_timer.start();
	}
}
Exemplo n.º 13
0
void
seqroll::redraw ()
{
    if (m_ignore_redraw)
        return;

    m_scroll_offset_ticks = (int) m_hadjust->get_value();
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;
    update_background();
    update_pixmap();
    force_draw();
}
Exemplo n.º 14
0
void
seqroll::change_vert ()
{
    m_scroll_offset_key = (int) m_vadjust->get_value();
    m_scroll_offset_y = m_scroll_offset_key * c_key_y;
    if (m_ignore_redraw)
        return;

    update_background();
    update_pixmap();
    force_draw();
}
Exemplo n.º 15
0
void
seqroll::set_background_sequence (bool a_state, int a_seq)
{
    m_drawing_background_seq = a_state;
    m_background_sequence = a_seq;
    if (m_ignore_redraw)
        return;

    update_background();
    update_pixmap();
    queue_draw();
}
Exemplo n.º 16
0
void
seqkeys::on_realize ()
{
    Gtk::DrawingArea::on_realize();
    m_window = get_window();
    m_gc = Gdk::GC::create(m_window);
    m_window->clear();
    m_pixmap = Gdk::Pixmap::create(m_window, c_keyarea_x, c_keyarea_y, -1);
    update_pixmap();
    m_vadjust->signal_value_changed().connect
    (
        mem_fun(*this, &seqkeys::change_vert)
    );
    change_vert();
}
Exemplo n.º 17
0
bool
seqdata::on_scroll_event (GdkEventScroll * ev)
{
    if (! is_no_modifier(ev))
        return false;

    if (CAST_EQUIVALENT(ev->direction, SEQ64_SCROLL_UP))
        m_seq.increment_selected(m_status, m_cc);

    if (CAST_EQUIVALENT(ev->direction, SEQ64_SCROLL_DOWN))
        m_seq.decrement_selected(m_status, m_cc);

    update_pixmap();
    queue_draw();
    return true;
}
Exemplo n.º 18
0
void Window::open()
{
    QString fileName = QFileDialog::getOpenFileName(this,
                                                    tr("Open File"),
                                                    QDir::currentPath());
    if(fileName.isEmpty()) {
        return;
    }

    pic::Image *pic_im = new pic::Image;
    ImageRead(fileName.toStdString(), pic_im);

    if(!pic_im->isValid()) {
        QMessageBox::information(this, tr("Simple QT"),
                                 tr("Cannot load %1.").arg(fileName));
        delete pic_im;
        save_as_action->setEnabled(false);
        zoom_fit_action->setEnabled(false);
        zoom_in_action->setEnabled(false);
        zoom_out_action->setEnabled(false);
        zoom_original_action->setEnabled(false);
        gaussian_blur_action->setEnabled(false);
        scale_factor = 1.0;
        return;
    }

    if(last_filename != NULL) {
        delete last_filename;
    }

    last_filename = new QString(fileName);
    if(image != NULL) {
        delete image;
    }
    image = pic_im;

    update_pixmap();

    save_as_action->setEnabled(true);
    zoom_fit_action->setEnabled(true);
    gaussian_blur_action->setEnabled(true);
    scale_factor = 1.0;
    update_actions();

    if (!zoom_fit_action->isChecked())
        image_label->adjustSize();
}
Exemplo n.º 19
0
bool
seqdata::on_button_release_event (GdkEventButton * ev)
{
    bool result = false;
    m_current_x = int(ev->x) + m_scroll_offset_x;
    m_current_y = int(ev->y);
    if (m_dragging)
    {
        midipulse tick_s, tick_f;
        if (m_current_x < m_drop_x)
        {
            std::swap(m_current_x, m_drop_x);
            std::swap(m_current_y, m_drop_y);
        }
        convert_x(m_drop_x, tick_s);
        convert_x(m_current_x, tick_f);
        result = m_seq.change_event_data_range
        (
            tick_s, tick_f, m_status, m_cc,
            c_dataarea_y - m_drop_y - 1, c_dataarea_y - m_current_y - 1
        );
        m_dragging = false;     /* convert x,y to ticks, set events in range */

        /*
         * \change ca 2016-06-19
         *  Why do we modify here?
         *
         *  if (result)
         *      perf().modify();
         */
    }

#ifdef USE_STAZED_SEQDATA_EXTENSIONS
    if (m_drag_handle)
    {
        m_drag_handle = false;
        m_seq.unselect();
        m_seq.set_dirty();
    }
#endif

    update_pixmap();
    queue_draw();
    return result;
}
Exemplo n.º 20
0
static void
lmplayer_lyric_widget_da_set_size(LmplayerLyricWidget *lyric, gint width, gint height)
{
	g_return_if_fail(LMPLAYER_IS_LYRIC_WIDGET_DA(lyric));
	LmplayerLyricWidgetDaPrivate *priv = LMPLAYER_LYRIC_WIDGET_DA(lyric)->priv;

	if(priv->da_width != width || priv->da_height != height)
	{
		gtk_widget_set_size_request(GTK_WIDGET(lyric), width, height);
		gtk_widget_set_size_request(priv->da, width, height);

		priv->da_width = width;
		priv->da_height = height;

		priv->da_size_changed = TRUE;
		update_pixmap(LMPLAYER_LYRIC_WIDGET_DA(lyric));
	}
}
static void
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
{
  MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
  MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
  MetaDisplay *display = priv->display;
  Display *xdisplay = meta_display_get_xdisplay (display);

  if (priv->received_damage)
    {
      meta_error_trap_push (display);
      XDamageSubtract (xdisplay, priv->damage, None, None);
      meta_error_trap_pop (display);

      priv->received_damage = FALSE;
    }

  update_pixmap (self);
}
Exemplo n.º 22
0
void
seqkeys::on_realize()
{
    // we need to do the default realize
    Gtk::DrawingArea::on_realize();

    // Now we can allocate any additional resources we need
    m_window = get_window();
    m_gc = Gdk::GC::create( m_window );
    m_window->clear();

    m_pixmap = Gdk::Pixmap::create(m_window,
                                   c_keyarea_x,
                                   c_keyarea_y,
                                   -1 );

    update_pixmap();

    m_vadjust->signal_value_changed().connect( mem_fun( *this, &seqkeys::change_vert ));

    change_vert();
}
Exemplo n.º 23
0
void
seqdata::reset ()
{
    /*
     * Stazed fix; same code found in change_horz().
     */

    m_scroll_offset_ticks = int(m_hadjust.get_value());
    m_scroll_offset_x = m_scroll_offset_ticks / m_zoom;

    update_sizes();

    /*
     * Instead of this, try forcing the redraw, to eliminate the bug of not
     * redrawing on changing zoom.
     *
     * redraw();
     */

    update_pixmap();
    force_draw();
}
Exemplo n.º 24
0
void DrawArea::fill_grid(std::istream &inf)
{
	ca->grid() = grid_t(inf, ca->border_width());
	ca->finalize();

	labels.resize(ca->grid().human_dim().area());
	for(const point& p : ca->grid().points())
	{
		int idx = p.y * ca->grid().human_dim().width() + p.x;
		labels[idx] = new ImgContainer(parentWidget(), p);
		grid_layout.addWidget(labels[idx], p.y, p.x);
		QObject::connect(labels[idx], SIGNAL(clicked(point)),
			this, SLOT(onMousePressed(point)));
	}

	// TODO: redundant -> see reset_ca()
	update_pixmap();
	state_machine.trigger_throw();
	/*if(state_machine.get() != StateMachine::STATE_INSTABLE)
	{
		next_fire_timer.start();
	}*/
}
Exemplo n.º 25
0
void DrawArea::set_pixel_size(int pixel_size) {
	pixel_factor = pixel_size;
	update_pixmap();
}
Exemplo n.º 26
0
bool
seqdata::on_motion_notify_event (GdkEventMotion * ev)
{
    bool result = false;
#ifdef USE_STAZED_SEQDATA_EXTENSIONS
    if (m_drag_handle)
    {
        m_current_y = int(ev->y = 3);
        m_current_y = c_dataarea_y - m_current_y;
        if (m_current_y < 0)
            m_current_y = 0;

        if (m_current_y > SEQ64_MAX_DATA_VALUE)             /* 127 */
            m_current_y = SEQ64_MAX_DATA_VALUE;

        m_seq.adjust_data_handle(m_status, m_current_y);
        update_pixmap();
        draw_events_on(m_window);
    }
#endif
    if (m_dragging)
    {
        int adj_x_min, adj_x_max, adj_y_min, adj_y_max;
        m_current_x = int(ev->x) + m_scroll_offset_x;
        m_current_y = int(ev->y);
        if (m_current_x < m_drop_x)
        {
            adj_x_min = m_current_x;
            adj_y_min = m_current_y;
            adj_x_max = m_drop_x;
            adj_y_max = m_drop_y;
        }
        else
        {
            adj_x_max = m_current_x;
            adj_y_max = m_current_y;
            adj_x_min = m_drop_x;
            adj_y_min = m_drop_y;
        }

        midipulse tick_s, tick_f;
        convert_x(adj_x_min, tick_s);
        convert_x(adj_x_max, tick_f);
        result = m_seq.change_event_data_range
        (
            tick_s, tick_f, m_status, m_cc,
            c_dataarea_y - adj_y_min - 1, c_dataarea_y - adj_y_max - 1
        );
        update_pixmap();                /* calls draw_events_on_pixmap()    */
        draw_events_on(m_window);
        draw_line_on_window();

        /*
         * \change ca 2016-06-19
         *  Why do we modify here?
         *
         *  if (result)
         *      perf().modify();
         */
    }
    return result;
}
Exemplo n.º 27
0
 void redraw ()
 {
     update_pixmap();
     queue_draw();
 }
Exemplo n.º 28
0
void
seqkeys::reset ()
{
    update_pixmap();
    queue_draw();
}