diff options
author | Marek Olšák <marek.olsak@amd.com> | 2014-08-17 02:24:52 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2014-09-01 21:10:41 +0200 |
commit | c041f74a49a917362572c1070a2a4ec310eaba48 (patch) | |
tree | 3d8ffe9830c41bf3a0b442a0d49dd0bd4afa283c /src | |
parent | 67943e8bdf930f1155c84522ec05da4e783ce691 (diff) |
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/program.h | 4 | ||||
-rw-r--r-- | src/texture.c | 17 |
3 files changed, 24 insertions, 6 deletions
@@ -437,11 +437,13 @@ void main_window_create(struct program *p) GObject *selection; GtkDrawingArea *draw; GtkTextView *textview; + GtkWidget *texture_view; GtkWidget *context_view; GtkWidget *textview_scrolled; GtkTreeView *treeview; GtkTreeStore *treestore; GtkStatusbar *statusbar; + GtkSpinButton *layer; GObject *tool_quit; GObject *tool_refresh; @@ -475,9 +477,10 @@ void main_window_create(struct program *p) treestore = GTK_TREE_STORE(gtk_builder_get_object(builder, "treestore")); selection = G_OBJECT(gtk_tree_view_get_selection(treeview)); statusbar = GTK_STATUSBAR(gtk_builder_get_object(builder, "statusbar")); + texture_view = GTK_WIDGET(gtk_builder_get_object(builder, "texture_view")); context_view = GTK_WIDGET(gtk_builder_get_object(builder, "context_view")); textview_scrolled = GTK_WIDGET(gtk_builder_get_object(builder, "textview_scrolled")); - + layer = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "layer")); tool_quit = gtk_builder_get_object(builder, "tool_quit"); tool_refresh = gtk_builder_get_object(builder, "tool_refresh"); @@ -548,8 +551,10 @@ void main_window_create(struct program *p) p->main.treeview = treeview; p->main.treestore = treestore; p->main.statusbar = statusbar; + p->main.texture_view = texture_view; p->main.context_view = context_view; p->main.textview_scrolled = textview_scrolled; + p->main.layer = layer; p->tool.break_before = GTK_WIDGET(tool_break_before); p->tool.break_after = GTK_WIDGET(tool_break_after); @@ -582,7 +587,7 @@ void main_window_create(struct program *p) gtk_widget_hide(p->main.textview_scrolled); gtk_widget_hide(GTK_WIDGET(p->main.textview)); - gtk_widget_hide(GTK_WIDGET(p->main.draw)); + gtk_widget_hide(p->main.texture_view); gtk_widget_show(window); diff --git a/src/program.h b/src/program.h index a04b456..7245c83 100644 --- a/src/program.h +++ b/src/program.h @@ -108,11 +108,13 @@ struct program struct { GtkWidget *window; + GtkWidget *texture_view; GtkWidget *context_view; GtkTextView *textview; GtkWidget *textview_scrolled; GtkTreeView *treeview; GtkTreeStore *treestore; + GtkSpinButton *layer; GtkDrawingArea *draw; GtkStatusbar *statusbar; @@ -181,7 +183,7 @@ struct program unsigned width; unsigned height; - gulong tid[3]; + gulong tid[4]; gboolean automatic; int back; diff --git a/src/texture.c b/src/texture.c index 40e6f29..f867c10 100644 --- a/src/texture.c +++ b/src/texture.c @@ -100,6 +100,12 @@ static void background(GtkWidget *widget, struct program *p) gtk_widget_queue_draw(GTK_WIDGET(p->main.draw)); } +static void layer_changed(GtkWidget *widget, struct program *p) +{ + (void)widget; + + texture_start_if_new_read_action(p->viewed.id, &p->viewed.iter, p); +} /* * Exported @@ -176,7 +182,7 @@ void texture_unviewed(struct program *p) gtk_widget_hide(p->tool.alpha); gtk_widget_hide(p->tool.automatic); gtk_widget_hide(p->tool.background); - gtk_widget_hide(GTK_WIDGET(p->main.draw)); + gtk_widget_hide(p->main.texture_view); p->texture.automatic = FALSE; p->texture.back = BACK_CHECKER; @@ -184,6 +190,7 @@ void texture_unviewed(struct program *p) g_signal_handler_disconnect(p->tool.alpha, p->texture.tid[0]); g_signal_handler_disconnect(p->tool.automatic, p->texture.tid[1]); g_signal_handler_disconnect(p->tool.background, p->texture.tid[2]); + g_signal_handler_disconnect(p->main.layer, p->texture.tid[3]); } void texture_viewed(struct program *p) @@ -195,7 +202,7 @@ void texture_viewed(struct program *p) gtk_widget_show(p->tool.alpha); gtk_widget_show(p->tool.automatic); gtk_widget_show(p->tool.background); - gtk_widget_show(GTK_WIDGET(p->main.draw)); + gtk_widget_show(p->main.texture_view); p->texture.automatic = FALSE; p->texture.back = BACK_CHECKER; @@ -205,6 +212,7 @@ void texture_viewed(struct program *p) p->texture.tid[0] = g_signal_connect(p->tool.alpha, "clicked", G_CALLBACK(alpha), p); p->texture.tid[1] = g_signal_connect(p->tool.automatic, "clicked", G_CALLBACK(automatic), p); p->texture.tid[2] = g_signal_connect(p->tool.background, "clicked", G_CALLBACK(background), p); + p->texture.tid[3] = g_signal_connect(p->main.layer, "value-changed", G_CALLBACK(layer_changed), p); } void texture_unselected(struct program *p) @@ -226,6 +234,7 @@ struct texture_action_read struct rbug_event e; rbug_texture_t id; + unsigned layer; GtkTreeIter iter; @@ -607,6 +616,7 @@ static gboolean texture_action_read_info(struct rbug_event *e, util_format_name(info->format)+12); snprintf(info_long_string, 128, "%s (%ux%ux%u) %u", util_format_name(info->format), info->width[0], info->height[0], info->depth[0], info->last_level); + gtk_spin_button_set_range(p->main.layer, 0, info->depth[0]-1); gtk_tree_store_set(p->main.treestore, &action->iter, COLUMN_PIXBUF, buf, COLUMN_INFO_SHORT, info_short_string, @@ -621,7 +631,7 @@ static gboolean texture_action_read_info(struct rbug_event *e, action->format = info->format; rbug_send_texture_read(con, action->id, - 0, 0, 0, + 0, 0, action->layer, 0, 0, action->width, action->height, &serial); /* new message pending */ @@ -683,6 +693,7 @@ texture_start_read_action(rbug_texture_t t, GtkTreeIter *iter, struct program *p action->e.func = texture_action_read_info; action->id = t; + action->layer = gtk_spin_button_get_value_as_int(p->main.layer); action->iter = *iter; action->pending = TRUE; action->running = TRUE; |