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 | |
parent | 67943e8bdf930f1155c84522ec05da4e783ce691 (diff) |
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r-- | res/main.xml | 144 | ||||
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/program.h | 4 | ||||
-rw-r--r-- | src/texture.c | 17 |
4 files changed, 136 insertions, 38 deletions
diff --git a/res/main.xml b/res/main.xml index 042a6ef..22e2e7e 100644 --- a/res/main.xml +++ b/res/main.xml @@ -2,18 +2,6 @@ <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy project-wide --> - <object class="GtkRadioAction" id="ra_ctx_fragment"> - <property name="draw_as_radio">True</property> - <property name="active">True</property> - </object> - <object class="GtkRadioAction" id="ra_ctx_color0"> - <property name="draw_as_radio">True</property> - <property name="group">ra_ctx_fragment</property> - </object> - <object class="GtkRadioAction" id="ra_ctx_color1"> - <property name="draw_as_radio">True</property> - <property name="group">ra_ctx_fragment</property> - </object> <object class="GtkRadioAction" id="ra_ctx_color2"> <property name="draw_as_radio">True</property> <property name="group">ra_ctx_fragment</property> @@ -38,6 +26,10 @@ <property name="draw_as_radio">True</property> <property name="group">ra_ctx_fragment</property> </object> + <object class="GtkRadioAction" id="ra_ctx_fragment"> + <property name="draw_as_radio">True</property> + <property name="active">True</property> + </object> <object class="GtkRadioAction" id="ra_ctx_geom"> <property name="draw_as_radio">True</property> <property name="group">ra_ctx_fragment</property> @@ -114,6 +106,19 @@ <property name="draw_as_radio">True</property> <property name="group">ra_ctx_fragment</property> </object> + <object class="GtkAdjustment" id="layer_adjustment"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkRadioAction" id="ra_ctx_color0"> + <property name="draw_as_radio">True</property> + <property name="group">ra_ctx_fragment</property> + </object> + <object class="GtkRadioAction" id="ra_ctx_color1"> + <property name="draw_as_radio">True</property> + <property name="group">ra_ctx_fragment</property> + </object> <object class="GtkTreeStore" id="treestore"> <columns> <!-- column-name id --> @@ -147,6 +152,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Refresh</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Rerfresh</property> <property name="stock_id">gtk-refresh</property> </object> @@ -168,6 +174,7 @@ <object class="GtkToggleToolButton" id="tool_break_before"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Break Before</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Break Before</property> <property name="use_underline">True</property> <property name="stock_id">gtk-stop</property> @@ -181,6 +188,7 @@ <object class="GtkToggleToolButton" id="tool_break_after"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Break After</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Break After</property> <property name="use_underline">True</property> <property name="stock_id">gtk-stop</property> @@ -194,6 +202,7 @@ <object class="GtkToolButton" id="tool_step"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Step</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Step</property> <property name="use_underline">True</property> <property name="stock_id">gtk-jump-to</property> @@ -207,6 +216,7 @@ <object class="GtkToolButton" id="tool_flush"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Flush</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Flush</property> <property name="use_underline">True</property> <property name="stock_id">gtk-convert</property> @@ -227,6 +237,7 @@ <child> <object class="GtkToolButton" id="tool_back"> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Back</property> <property name="use_underline">True</property> <property name="stock_id">gtk-go-back</property> @@ -239,6 +250,7 @@ <child> <object class="GtkToolButton" id="tool_forward"> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Forward</property> <property name="stock_id">gtk-go-forward</property> </object> @@ -251,6 +263,7 @@ <object class="GtkToolButton" id="tool_background"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Change Background</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Background</property> <property name="use_underline">True</property> <property name="stock_id">gtk-select-color</property> @@ -264,6 +277,7 @@ <object class="GtkToggleToolButton" id="tool_alpha"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Enable/Disable Alpha Blend</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Alpha Blend</property> <property name="use_underline">True</property> <property name="stock_id">gtk-bold</property> @@ -277,6 +291,7 @@ <object class="GtkToggleToolButton" id="tool_auto"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Automatically Update Texture</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Auto</property> <property name="use_underline">True</property> <property name="stock_id">gtk-execute</property> @@ -290,6 +305,7 @@ <object class="GtkToolButton" id="tool_disable"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Disable</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Disable</property> <property name="use_underline">True</property> <property name="stock_id">gtk-no</property> @@ -303,6 +319,7 @@ <object class="GtkToolButton" id="tool_enable"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Enable</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Enable</property> <property name="use_underline">True</property> <property name="stock_id">gtk-yes</property> @@ -316,6 +333,7 @@ <object class="GtkToolButton" id="tool_save"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Save Edited Shader</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Save</property> <property name="use_underline">True</property> <property name="stock_id">gtk-save</property> @@ -329,6 +347,7 @@ <object class="GtkToolButton" id="tool_revert"> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Restore Original Shader</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Revert</property> <property name="use_underline">True</property> <property name="stock_id">gtk-revert-to-saved</property> @@ -354,6 +373,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Exit</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Quit</property> <property name="use_underline">True</property> <property name="stock_id">gtk-quit</property> @@ -471,10 +491,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton1"> <property name="label" translatable="yes">Fragment</property> - <property name="related_action">ra_ctx_fragment</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_fragment</property> </object> <packing> <property name="expand">False</property> @@ -485,10 +505,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton2"> <property name="label" translatable="yes">Vertex</property> - <property name="related_action">ra_ctx_vertex</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_vertex</property> </object> <packing> <property name="expand">False</property> @@ -510,10 +530,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton4"> <property name="label" translatable="yes">Texture 1</property> - <property name="related_action">ra_ctx_texture0</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_texture0</property> </object> <packing> <property name="expand">False</property> @@ -524,10 +544,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton5"> <property name="label" translatable="yes">Texture 2</property> - <property name="related_action">ra_ctx_texture1</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_texture1</property> </object> <packing> <property name="expand">False</property> @@ -538,10 +558,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton6"> <property name="label" translatable="yes">Texture 3</property> - <property name="related_action">ra_ctx_texture2</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_texture2</property> </object> <packing> <property name="expand">False</property> @@ -552,10 +572,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton7"> <property name="label" translatable="yes">Texture 4</property> - <property name="related_action">ra_ctx_texture3</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_texture3</property> </object> <packing> <property name="expand">False</property> @@ -566,10 +586,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton8"> <property name="label" translatable="yes">Texture 5</property> - <property name="related_action">ra_ctx_texture4</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_texture4</property> </object> <packing> <property name="expand">False</property> @@ -594,10 +614,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton19"> <property name="label" translatable="yes">Color 1</property> - <property name="related_action">ra_ctx_color0</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_color0</property> </object> <packing> <property name="expand">False</property> @@ -608,10 +628,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton20"> <property name="label" translatable="yes">Color 2</property> - <property name="related_action">ra_ctx_color1</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_color1</property> </object> <packing> <property name="expand">False</property> @@ -622,10 +642,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton21"> <property name="label" translatable="yes">Color 3</property> - <property name="related_action">ra_ctx_color2</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_color2</property> </object> <packing> <property name="expand">False</property> @@ -636,10 +656,10 @@ <child> <object class="GtkToggleButton" id="_togglebutton22"> <property name="label" translatable="yes">ZS</property> - <property name="related_action">ra_ctx_zs</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="related_action">ra_ctx_zs</property> </object> <packing> <property name="expand">False</property> @@ -675,7 +695,74 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkVBox" id="texture_view"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkHBox" id="layer_hbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Layer:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="layer"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="max_length">5</property> + <property name="invisible_char">•</property> + <property name="invisible_char_set">True</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + <property name="adjustment">layer_adjustment</property> + <property name="snap_to_ticks">True</property> + <property name="numeric">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkDrawingArea" id="draw"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> <child> <object class="GtkScrolledWindow" id="textview_scrolled"> @@ -696,14 +783,7 @@ </packing> </child> <child> - <object class="GtkDrawingArea" id="draw"> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> + <placeholder/> </child> </object> <packing> @@ -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; |