6 #include "gtkutil/widget.h"
7 #include "stream/stringstream.h"
10 #include "preferences.h"
13 #include "gtkutil/accelerator.h"
14 #include "generic/callback.h"
17 int ToggleActions = 0;
21 gboolean ToggleActions0( ui::Widget widget, GdkEvent *event, gpointer user_data ){
24 //globalOutputStream() << "ToggleActions\n";
28 void SetCommonShader( const char* key, const char* shader ){
29 const char* gotShader = g_pGameDescription->getKeyValue( key );
30 UndoableCommand undo( "textureNameSetSelected" );
31 if ( gotShader && *gotShader ){
32 Select_SetShader( gotShader );
35 Select_SetShader( shader );
40 gboolean Areaportals_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
41 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
42 if ( ButtonNum == 1 ){
49 if( ToggleActions == 0 ){
50 SetCommonShader( "shader_nodraw", "textures/common/nodraw" );
52 else if( ToggleActions == 1 ){
53 SetCommonShader( "shader_nodrawnonsolid", "textures/common/nodrawnonsolid" );
55 //SetCommonShader( "shader_caulk", "textures/common/caulk" );
56 //globalOutputStream() << "Found '" << "fullname" << "'\n";
64 gboolean Caulk_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
65 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
66 SetCommonShader( "shader_caulk", "textures/common/caulk" );
74 gboolean Clip_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
75 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
76 if ( ButtonNum == 3 ){
83 if( ToggleActions == 0 ){
84 SetCommonShader( "shader_clip", "textures/common/clip" );
86 else if( ToggleActions == 1 ){
87 SetCommonShader( "shader_weapclip", "textures/common/weapclip" );
96 gboolean Liquids_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
97 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
98 if ( ButtonNum == 4 ){
105 if( ToggleActions == 0 ){
106 SetCommonShader( "shader_watercaulk", "textures/common/watercaulk" );
108 else if( ToggleActions == 1 ){
109 SetCommonShader( "shader_lavacaulk", "textures/common/lavacaulk" );
111 else if( ToggleActions == 2 ){
112 SetCommonShader( "shader_slimecaulk", "textures/common/slimecaulk" );
121 gboolean Hint_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
122 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
123 if ( ButtonNum == 5 ){
130 if( ToggleActions == 0 ){
131 SetCommonShader( "shader_hint", "textures/common/hint" );
133 else if( ToggleActions == 1 ){
134 SetCommonShader( "shader_hintlocal", "textures/common/hintlocal" );
136 else if( ToggleActions == 2 ){
137 SetCommonShader( "shader_hintskip", "textures/common/hintskip" );
146 gboolean Trigger_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
147 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
148 SetCommonShader( "shader_trigger", "textures/common/trigger" );
155 gboolean Func_Groups_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
156 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
157 UndoableCommand undo( "create func_group" );
158 Entity_createFromSelection( "func_group", g_vector3_identity );
166 gboolean Detail_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
167 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
168 GlobalCommands_find( "MakeDetail" ).m_callback();
176 gboolean Structural_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
177 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
178 GlobalCommands_find( "MakeStructural" ).m_callback();
185 gboolean Region_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
186 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
187 GlobalCommands_find( "RegionOff" ).m_callback();
194 gboolean Hide_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
195 if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
196 GlobalCommands_find( "ShowHidden" ).m_callback();
203 ui::Toolbar create_filter_toolbar(){
204 auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
205 gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
206 gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
207 // gtk_toolbar_set_show_arrow( toolbar, TRUE );
212 auto btn = ui::ToolItem::from(gtk_separator_tool_item_new());
217 g_signal_connect( G_OBJECT( toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 );
219 toolbar_append_toggle_button( toolbar, "World (ALT + 1)", "f-world.png", "FilterWorldBrushes" );
222 auto button = toolbar_append_toggle_button( toolbar, "Structural (CTRL + SHIFT + D)\nRightClick: MakeStructural", "f-structural.png", "FilterStructural" );
223 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Structural_button_press ), 0 );
227 auto button = toolbar_append_toggle_button( toolbar, "Details (CTRL + D)\nRightClick: MakeDetail", "f-details.png", "FilterDetails" );
228 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Detail_button_press ), 0 );
232 auto button = toolbar_append_toggle_button( toolbar, "Func_Groups\nRightClick: create func_group", "f-funcgroups.png", "FilterFuncGroups" );
233 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Func_Groups_button_press ), 0 );
235 toolbar_append_toggle_button( toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" );
241 if ( g_pGameDescription->mGameType == "doom3" ) {
242 auto button = toolbar_append_toggle_button( toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterVisportals" );
243 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Areaportals_button_press ), 0 );
246 auto button = toolbar_append_toggle_button( toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterAreaportals" );
247 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Areaportals_button_press ), 0 );
251 toolbar_append_toggle_button( toolbar, "Translucent (ALT + 4)", "f-translucent.png", "FilterTranslucent" );
254 auto button = toolbar_append_toggle_button( toolbar, "Liquids (ALT + 5)\nRightClick: toggle tex\n\twaterCaulk\n\tlavaCaulk\n\tslimeCaulk", "f-liquids.png", "FilterLiquids" );
255 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Liquids_button_press ), 0 );
259 auto button = toolbar_append_toggle_button( toolbar, "Caulk (ALT + 6)\nRightClick: tex Caulk", "f-caulk.png", "FilterCaulk" );
260 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Caulk_button_press ), 0 );
264 auto button = toolbar_append_toggle_button( toolbar, "Clips (ALT + 7)\nRightClick: toggle tex\n\tplayerClip\n\tweapClip", "f-clip.png", "FilterClips" );
265 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Clip_button_press ), 0 );
269 auto button = toolbar_append_toggle_button( toolbar, "HintsSkips (CTRL + H)\nRightClick: toggle tex\n\thint\n\thintLocal\n\thintSkip", "f-hint.png", "FilterHintsSkips" );
270 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Hint_button_press ), 0 );
273 //toolbar_append_toggle_button( toolbar, "Paths (ALT + 8)", "texture_lock.png", "FilterPaths" );
277 toolbar_append_toggle_button( toolbar, "Entities (ALT + 2)", "f-entities.png", "FilterEntities" );
278 toolbar_append_toggle_button( toolbar, "Lights (ALT + 0)", "f-lights.png", "FilterLights" );
279 toolbar_append_toggle_button( toolbar, "Models (SHIFT + M)", "f-models.png", "FilterModels" );
282 auto button = toolbar_append_toggle_button( toolbar, "Triggers (CTRL + SHIFT + T)\nRightClick: tex Trigger", "f-triggers.png", "FilterTriggers" );
283 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Trigger_button_press ), 0 );
286 //toolbar_append_toggle_button( toolbar, "Decals (SHIFT + D)", "f-decals.png", "FilterDecals" );
290 toolbar_append_button( toolbar, "InvertFilters", "f-invert.png", "InvertFilters" );
292 toolbar_append_button( toolbar, "ResetFilters", "f-reset.png", "ResetFilters" );
297 auto button = toolbar_append_toggle_button( toolbar, "Region Set Selection (CTRL + SHIFT + R)\nRightClick: Region Off", "f-region.png", "RegionSetSelection" );
298 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Region_button_press ), 0 );
302 auto button = toolbar_append_toggle_button( toolbar, "Hide Selected (H)\nRightClick: Show Hidden (SHIFT + H)", "f-hide.png", "HideSelected" );
303 g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Hide_button_press ), 0 );