2 #include <gtk/gtktoolbar.h>
4 #include "gtkutil/widget.h"
5 #include "stream/stringstream.h"
8 #include "preferences.h"
11 #include "gtkutil/accelerator.h"
12 #include "generic/callback.h"
17 int ToggleActions = 0;
20 gboolean ToggleActions0( GtkWidget *widget, GdkEvent *event, gpointer user_data ){
23 //globalOutputStream() << "ToggleActions\n";
26 void SetCommonShader( const char* key, const char* shader ){
27 const char* gotShader = g_pGameDescription->getKeyValue( key );
28 UndoableCommand undo( "textureNameSetSelected" );
29 if ( gotShader && *gotShader ){
30 Select_SetShader( gotShader );
33 Select_SetShader( shader );
38 gboolean Areaportals_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
39 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
40 if ( ButtonNum == 1 ){
47 if( ToggleActions == 0 ){
48 SetCommonShader( "shader_nodraw", "textures/common/nodraw" );
50 else if( ToggleActions == 1 ){
51 SetCommonShader( "shader_nodrawnonsolid", "textures/common/nodrawnonsolid" );
53 //SetCommonShader( "shader_caulk", "textures/common/caulk" );
54 //globalOutputStream() << "Found '" << "fullname" << "'\n";
62 gboolean Caulk_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
63 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
64 SetCommonShader( "shader_caulk", "textures/common/caulk" );
71 gboolean Clip_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
72 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
73 if ( ButtonNum == 3 ){
80 if( ToggleActions == 0 ){
81 SetCommonShader( "shader_clip", "textures/common/clip" );
83 else if( ToggleActions == 1 ){
84 SetCommonShader( "shader_weapclip", "textures/common/weapclip" );
92 gboolean Liquids_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
93 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
94 if ( ButtonNum == 4 ){
101 if( ToggleActions == 0 ){
102 SetCommonShader( "shader_watercaulk", "textures/common/watercaulk" );
104 else if( ToggleActions == 1 ){
105 SetCommonShader( "shader_lavacaulk", "textures/common/lavacaulk" );
107 else if( ToggleActions == 2 ){
108 SetCommonShader( "shader_slimecaulk", "textures/common/slimecaulk" );
117 gboolean Hint_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
118 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
119 if ( ButtonNum == 5 ){
126 if( ToggleActions == 0 ){
127 SetCommonShader( "shader_hint", "textures/common/hint" );
129 else if( ToggleActions == 1 ){
130 SetCommonShader( "shader_hintlocal", "textures/common/hintlocal" );
132 else if( ToggleActions == 2 ){
133 SetCommonShader( "shader_hintskip", "textures/common/hintskip" );
141 gboolean Trigger_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
142 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
143 SetCommonShader( "shader_trigger", "textures/common/trigger" );
150 gboolean Detail_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
151 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
152 GlobalCommands_find( "MakeDetail" ).m_callback();
159 gboolean Structural_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
160 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
161 GlobalCommands_find( "MakeStructural" ).m_callback();
169 GtkToolbar* create_filter_toolbar(){
170 GtkToolbar* filter_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
171 gtk_widget_show( GTK_WIDGET( filter_toolbar ) );
172 g_signal_connect( G_OBJECT( filter_toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 );
174 GtkToggleButton* button;
176 toolbar_append_toggle_button( filter_toolbar, "World (ALT + 1)", "f-world.png", "FilterWorldBrushes" );
178 button = toolbar_append_toggle_button( filter_toolbar, "Structural (CTRL + SHIFT + D)\nRightClick: MakeStructural", "f-structural.png", "FilterStructural" );
179 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Structural_button_press ), 0 );
181 button = toolbar_append_toggle_button( filter_toolbar, "Details (CTRL + D)\nRightClick: MakeDetail", "f-details.png", "FilterDetails" );
182 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Detail_button_press ), 0 );
185 toolbar_append_toggle_button( filter_toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" );
186 gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
188 button = toolbar_append_toggle_button( filter_toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterAreaportals" );
189 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Areaportals_button_press ), 0 );
193 toolbar_append_toggle_button( filter_toolbar, "Translucent (ALT + 4)", "f-translucent.png", "FilterTranslucent" );
195 button = toolbar_append_toggle_button( filter_toolbar, "Liquids (ALT + 5)\nRightClick: toggle tex\n\twaterCaulk\n\tlavaCaulk\n\tslimeCaulk", "f-liquids.png", "FilterLiquids" );
196 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Liquids_button_press ), 0 );
198 button = toolbar_append_toggle_button( filter_toolbar, "Caulk (ALT + 6)\nRightClick: tex Caulk", "f-caulk.png", "FilterCaulk" );
199 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Caulk_button_press ), 0 );
201 button = toolbar_append_toggle_button( filter_toolbar, "Clips (ALT + 7)\nRightClick: toggle tex\n\tplayerClip\n\tweapClip", "f-clip.png", "FilterClips" );
202 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Clip_button_press ), 0 );
204 button = toolbar_append_toggle_button( filter_toolbar, "HintsSkips (CTRL + H)\nRightClick: toggle tex\n\thint\n\thintLocal\n\thintSkip", "f-hint.png", "FilterHintsSkips" );
205 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Hint_button_press ), 0 );
207 //toolbar_append_toggle_button( filter_toolbar, "Paths (ALT + 8)", "texture_lock.png", "FilterPaths" );
208 gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
209 toolbar_append_toggle_button( filter_toolbar, "Entities (ALT + 2)", "f-entities.png", "FilterEntities" );
210 toolbar_append_toggle_button( filter_toolbar, "Lights (ALT + 0)", "f-lights.png", "FilterLights" );
211 toolbar_append_toggle_button( filter_toolbar, "Models (SHIFT + M)", "f-models.png", "FilterModels" );
213 button = toolbar_append_toggle_button( filter_toolbar, "Triggers (CTRL + SHIFT + T)\nRightClick: tex Trigger", "f-triggers.png", "FilterTriggers" );
214 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Trigger_button_press ), 0 );
216 //toolbar_append_toggle_button( filter_toolbar, "Decals (SHIFT + D)", "f-decals.png", "FilterDecals" );
217 gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
218 toolbar_append_button( filter_toolbar, "InvertFilters", "f-invert.png", "InvertFilters" );
219 toolbar_append_button( filter_toolbar, "ResetFilters", "f-reset.png", "ResetFilters" );
220 return filter_toolbar;