diff options
Diffstat (limited to 'src/gui/panels')
-rw-r--r-- | src/gui/panels/glance.c | 47 | ||||
-rw-r--r-- | src/gui/panels/panel.c | 4 | ||||
-rw-r--r-- | src/gui/panels/welcome.c | 2 |
3 files changed, 30 insertions, 23 deletions
diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c index d6a744e..b344e69 100644 --- a/src/gui/panels/glance.c +++ b/src/gui/panels/glance.c @@ -97,7 +97,7 @@ static void compute_glance_scale(GGlancePanel *); static void update_glance_panel_for_view_content(GGlancePanel *, GtkViewPanel *); /* Met à jour l'affichage de l'aperçu rapide à présenter. */ -static gboolean redraw_glance_area(GtkWidget *, GdkEventExpose *, GGlancePanel *); +static gboolean redraw_glance_area(GtkWidget *, cairo_t *, GGlancePanel *); /* Assure la gestion des clics de souris sur l'aperçu. */ static gboolean on_button_press_over_glance(GtkWidget *, GdkEventButton *, GGlancePanel *); @@ -166,7 +166,7 @@ static void g_glance_panel_init(GGlancePanel *panel) gtk_widget_set_size_request(base->widget, 300, 300); - g_signal_connect(G_OBJECT(area), "expose_event", + g_signal_connect(G_OBJECT(area), "draw", G_CALLBACK(redraw_glance_area), panel); g_signal_connect(G_OBJECT(area), "size-allocate", G_CALLBACK(on_glance_resize), panel); @@ -221,13 +221,14 @@ GEditorItem *g_glance_panel_new(GObject *ref) static void define_glance_bg(GtkWidget *widget, GGlancePanel *panel) { + /* gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &widget->style->mid[GTK_STATE_NORMAL]); panel->red = widget->style->mid[GTK_STATE_NORMAL].red / USHRT_MAX; panel->green = widget->style->mid[GTK_STATE_NORMAL].green / USHRT_MAX; panel->blue = widget->style->mid[GTK_STATE_NORMAL].blue / USHRT_MAX; - + */ } @@ -332,7 +333,7 @@ static void on_view_scroll_setup(GtkAdjustment *adj, GGlancePanel *panel) hadj = gtk_scrolled_window_get_hadjustment(panel->support); vadj = gtk_scrolled_window_get_vadjustment(panel->support); - if (hadj->page_size == 0 || vadj->page_size == 0) + if (gtk_adjustment_get_page_size(hadj) == 0 || gtk_adjustment_get_page_size(vadj) == 0) return; compute_glance_scale(panel); @@ -367,13 +368,13 @@ static void on_view_scrolled(GtkAdjustment *adj, GGlancePanel *panel) hadj = gtk_scrolled_window_get_hadjustment(panel->support); vadj = gtk_scrolled_window_get_vadjustment(panel->support); - if (hadj->page_size == 0 || vadj->page_size == 0) + if (gtk_adjustment_get_page_size(hadj) == 0 || gtk_adjustment_get_page_size(vadj) == 0) return; - panel->visible.x = panel->painting.x + hadj->value * panel->scale; - panel->visible.y = panel->painting.y + vadj->value * panel->scale; - panel->visible.width = hadj->page_size * panel->scale; - panel->visible.height = vadj->page_size * panel->scale; + panel->visible.x = panel->painting.x + gtk_adjustment_get_value(hadj) * panel->scale; + panel->visible.y = panel->painting.y + gtk_adjustment_get_value(vadj) * panel->scale; + panel->visible.width = gtk_adjustment_get_page_size(hadj) * panel->scale; + panel->visible.height = gtk_adjustment_get_page_size(vadj) * panel->scale; gtk_widget_queue_draw(G_EDITOR_ITEM(panel)->widget); @@ -427,7 +428,7 @@ static void compute_glance_scale(GGlancePanel *panel) /* Superficies niveau GTK... */ gtk_widget_get_allocation(G_EDITOR_ITEM(panel)->widget, &available); - + /* border = MIN(2, G_EDITOR_ITEM(panel)->widget->style->xthickness); if (border > 0) { @@ -441,7 +442,7 @@ static void compute_glance_scale(GGlancePanel *panel) available.y = border; available.height -= 2 * border; } - + */ /* Calcul des ratios et emplacements */ sx = (1.0 * available.width) / panel->req.width; @@ -514,7 +515,7 @@ static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkViewPan /****************************************************************************** * * * Paramètres : widget = composant GTK à redessiner. * -* event = informations liées à l'événement. * +* cr = contexte graphique liées à l'événement. * * panel = informations liées au panneau associé. * * * * Description : Met à jour l'affichage de l'aperçu rapide à présenter. * @@ -525,11 +526,11 @@ static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkViewPan * * ******************************************************************************/ -static gboolean redraw_glance_area(GtkWidget *widget, GdkEventExpose *event, GGlancePanel *panel) +static gboolean redraw_glance_area(GtkWidget *widget, cairo_t *cr, GGlancePanel *panel) { GtkAllocation available; /* Surface disponible totale */ cairo_t *cairo; /* Gestionnaire de rendu */ - +#if 0 /* Dessin de la bordure */ gtk_widget_get_allocation(widget, &available); @@ -564,7 +565,7 @@ static gboolean redraw_glance_area(GtkWidget *widget, GdkEventExpose *event, GGl cairo_destroy(cairo); } - +#endif return TRUE; } @@ -598,8 +599,8 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e hadj = gtk_scrolled_window_get_hadjustment(panel->support); vadj = gtk_scrolled_window_get_vadjustment(panel->support); - panel->ref_h = hadj->value; - panel->ref_v = vadj->value; + panel->ref_h = gtk_adjustment_get_value(hadj); + panel->ref_v = gtk_adjustment_get_value(vadj); panel->valid = (panel->visible.x <= panel->start_x && panel->start_x < (panel->visible.x + panel->visible.width) @@ -609,8 +610,8 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e if (panel->valid) { cursor = gdk_cursor_new(GDK_FLEUR); - gdk_window_set_cursor(widget->window, cursor); - gdk_cursor_unref(cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); + g_object_unref(G_OBJECT(cursor)); } } @@ -639,7 +640,7 @@ static gboolean on_button_release_over_glance(GtkWidget *widget, GdkEventButton if (panel->view != NULL && event->button == 1) { if (panel->valid) - gdk_window_set_cursor(widget->window, NULL); + gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); } @@ -678,10 +679,12 @@ static gboolean on_mouse_motion_over_glance(GtkWidget *widget, GdkEventMotion *e hadj = gtk_scrolled_window_get_hadjustment(panel->support); vadj = gtk_scrolled_window_get_vadjustment(panel->support); - value = CLAMP(panel->ref_h + diff_x, hadj->lower, hadj->upper - hadj->page_size); + value = CLAMP(panel->ref_h + diff_x, gtk_adjustment_get_lower(hadj), + gtk_adjustment_get_upper(hadj) - gtk_adjustment_get_page_size(hadj)); gtk_adjustment_set_value(hadj, value); - value = CLAMP(panel->ref_v + diff_y, vadj->lower, vadj->upper - vadj->page_size); + value = CLAMP(panel->ref_v + diff_y, gtk_adjustment_get_lower(vadj), + gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj)); gtk_adjustment_set_value(vadj, value); } diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c index b178443..a883bfa 100644 --- a/src/gui/panels/panel.c +++ b/src/gui/panels/panel.c @@ -41,6 +41,10 @@ +/* Transition vers GTK-3.x claire */ +#define GTK_IS_HPANED(p) gtk_orientable_get_orientation(GTK_ORIENTABLE(p)) == GTK_ORIENTATION_HORIZONTAL + + /* Support de fond pour les composants. */ static GtkWidget *_support; static panel_node *_nodes = NULL; diff --git a/src/gui/panels/welcome.c b/src/gui/panels/welcome.c index 018f12a..8825c52 100644 --- a/src/gui/panels/welcome.c +++ b/src/gui/panels/welcome.c @@ -110,7 +110,7 @@ static void g_welcome_panel_init(GWelcomePanel *panel) GEditorItem *base; /* Version basique d'instance */ support = gtk_handle_box_new(); - gtk_widget_modify_bg(support, GTK_STATE_NORMAL, &support->style->bg[GTK_STATE_NORMAL]); + //gtk_widget_modify_bg(support, GTK_STATE_NORMAL, &support->style->bg[GTK_STATE_NORMAL]); gtk_widget_show(support); align = gtk_alignment_new(0.5f, 0.5f, 0.0f, 0.0f); |