Ejemplo n.º 1
0
gboolean
clone_obj_cb (GtkWidget *widget, gpointer data)
{
    tbo_object *obj = selector_tool_get_selected_obj ();
    Frame *frame = selector_tool_get_selected_frame ();
    Page *page = tbo_comic_get_current_page (((TboWindow*)data)->comic);

    if (!get_frame_view () && frame)
    {
        Frame *cloned_frame = tbo_frame_clone (frame);
        cloned_frame->x += 10;
        cloned_frame->y -= 10;
        tbo_page_add_frame (page, cloned_frame);
        set_selected (cloned_frame, (TboWindow*)data);
    }
    else if (obj && get_frame_view ())
    {
        tbo_object *cloned_obj = obj->clone (obj);
        cloned_obj->x += 10;
        cloned_obj->y -= 10;
        tbo_frame_add_obj (frame, cloned_obj);
        set_selected_obj (cloned_obj, (TboWindow*)data);
    }
    update_drawing ((TboWindow *)data);
    return FALSE;
}
Ejemplo n.º 2
0
gboolean
on_doodle_click_cb (GtkWidget      *widget,
                    GdkEventButton *event,
                    gpointer       *data)
{
    Frame *frame = get_frame_view ();
    SVGImage *svgimage = tbo_svgimage_new_with_params (0, 0, 0, 0, (char*)data);
    update_drawing (TBO);
    tbo_frame_add_obj (frame, svgimage);
}
Ejemplo n.º 3
0
static void
on_click (TboToolBase *tool, GtkWidget *widget, GdkEventButton *event)
{
    int x = (int)event->x;
    int y = (int)event->y;
    gboolean found = FALSE;
    GList *obj_list;
    TboObjectBase *obj;
    TboObjectText *text;
    GdkColor color;
    TboToolText *self = TBO_TOOL_TEXT (tool);
    Frame *frame = tbo_drawing_get_current_frame (TBO_DRAWING (tool->tbo->drawing));

    for (obj_list = g_list_first (frame->objects); obj_list; obj_list = obj_list->next)
    {
        obj = TBO_OBJECT_BASE (obj_list->data);
        if (TBO_IS_OBJECT_TEXT (obj) && tbo_frame_point_inside_obj (obj, x, y))
        {
            text = TBO_OBJECT_TEXT (obj);
            found = TRUE;
        }
    }
    if (!found)
    {
        x = tbo_frame_get_base_x (x);
        y = tbo_frame_get_base_y (y);
        gtk_color_button_get_color (GTK_COLOR_BUTTON (self->font_color), &color);
        text = TBO_OBJECT_TEXT (tbo_object_text_new_with_params (x, y, 100, 0,
                                _("Text"),
                                tbo_tool_text_get_pango_font (self),
                                &color));
        tbo_frame_add_obj (frame, TBO_OBJECT_BASE (text));
    }
    tbo_tool_text_set_selected (self, text);
    tbo_drawing_update (TBO_DRAWING (tool->tbo->drawing));
}