]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '23d2497f12fe91a5eb0e14b71095cbb1c2ec80cb' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 12 Feb 2019 00:43:30 +0000 (01:43 +0100)
committerThomas Debesse <dev@illwieckz.net>
Tue, 12 Feb 2019 00:43:47 +0000 (01:43 +0100)
radiant/mainframe.cpp
radiant/plugintoolbar.cpp
radiant/plugintoolbar.h
radiant/texwindow.cpp

index 23632f4c061af653f54b1594ee4e204ea5a174f2..93edac9ae9e6f9d95112a37bbd80a0e48d77cfac 100644 (file)
@@ -2928,42 +2928,54 @@ void MainFrame::Create(){
     auto main_toolbar = create_main_toolbar( CurrentStyle() );
        vbox.pack_start( main_toolbar, FALSE, FALSE, 0 );
 
-       auto plugin_toolbar = create_plugin_toolbar();
-       if ( !g_Layout_enablePluginToolbar.m_value ) {
-               plugin_toolbar.hide();
-       }
-
-       if ( g_Layout_enableFilterToolbar.m_value ) {
-               auto space = [&]() {
-                       auto btn = gtk_separator_tool_item_new();
-                               gtk_widget_show(GTK_WIDGET(btn));
-                               gtk_container_add(GTK_CONTAINER(plugin_toolbar), GTK_WIDGET(btn));
-               };
-
-               space();
-               toolbar_append_toggle_button( plugin_toolbar, "World (ALT + 1)", "f-world.bmp", "FilterWorldBrushes" );
-               toolbar_append_toggle_button( plugin_toolbar, "Details (CTRL + D)", "f-details.bmp", "FilterDetails" );
-               toolbar_append_toggle_button( plugin_toolbar, "Structural (CTRL + SHIFT + D)", "f-structural.bmp", "FilterStructural" );
-               toolbar_append_toggle_button( plugin_toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" );
-               space();
-               toolbar_append_toggle_button( plugin_toolbar, "Areaportals (ALT + 3)", "f-areaportal.bmp", "FilterAreaportals" );
-               toolbar_append_toggle_button( plugin_toolbar, "Translucent (ALT + 4)", "f-translucent.bmp", "FilterTranslucent" );
-               toolbar_append_toggle_button( plugin_toolbar, "Liquids (ALT + 5)", "f-liquids.bmp", "FilterLiquids" );
-               toolbar_append_toggle_button( plugin_toolbar, "Caulk (ALT + 6)", "f-caulk.bmp", "FilterCaulk" );
-               toolbar_append_toggle_button( plugin_toolbar, "Clips (ALT + 7)", "f-clip.bmp", "FilterClips" );
-               toolbar_append_toggle_button( plugin_toolbar, "HintsSkips (CTRL + H)", "f-hint.bmp", "FilterHintsSkips" );
-               //toolbar_append_toggle_button( plugin_toolbar, "Paths (ALT + 8)", "texture_lock.bmp", "FilterPaths" );
-               space();
-               toolbar_append_toggle_button( plugin_toolbar, "Entities (ALT + 2)", "f-entities.bmp", "FilterEntities" );
-               toolbar_append_toggle_button( plugin_toolbar, "Lights (ALT + 0)", "lightinspector.png", "FilterLights" );
-               toolbar_append_toggle_button( plugin_toolbar, "Models (SHIFT + M)", "f-models.bmp", "FilterModels" );
-               toolbar_append_toggle_button( plugin_toolbar, "Triggers (CTRL + SHIFT + T)", "f-triggers.bmp", "FilterTriggers" );
-//             toolbar_append_toggle_button( plugin_toolbar, "Decals (SHIFT + D)", "f-decals.bmp", "FilterDecals" );
-               space();
-               toolbar_append_button( plugin_toolbar, "InvertFilters", "f-invert.bmp", "InvertFilters" );
-               toolbar_append_button( plugin_toolbar, "ResetFilters", "f-reset.bmp", "ResetFilters" );
+       if ( g_Layout_enablePluginToolbar.m_value || g_Layout_enableFilterToolbar.m_value ){
+               auto PFbox = ui::HBox( FALSE, 3 );
+               vbox.pack_start( PFbox, FALSE, FALSE, 0 );
+               PFbox.show();
+               if ( g_Layout_enablePluginToolbar.m_value ){
+                       auto plugin_toolbar = create_plugin_toolbar();
+                       if ( g_Layout_enableFilterToolbar.m_value ){
+                               PFbox.pack_start( plugin_toolbar, FALSE, FALSE, 0 );
+                       }
+                       else{
+                               PFbox.pack_start( plugin_toolbar, TRUE, TRUE, 0 );
+                       }
+               }
+               if ( g_Layout_enableFilterToolbar.m_value ){
+                       auto filter_toolbar = create_filter_toolbar();
+                       filter_toolbar.show();
+
+                       auto space = [&]() {
+                               auto btn = gtk_separator_tool_item_new();
+                                       gtk_widget_show(GTK_WIDGET(btn));
+                                       gtk_container_add(GTK_CONTAINER(filter_toolbar), GTK_WIDGET(btn));
+                       };
+
+                       toolbar_append_toggle_button( filter_toolbar, "World (ALT + 1)", "f-world.bmp", "FilterWorldBrushes" );
+                       toolbar_append_toggle_button( filter_toolbar, "Details (CTRL + D)", "f-details.bmp", "FilterDetails" );
+                       toolbar_append_toggle_button( filter_toolbar, "Structural (CTRL + SHIFT + D)", "f-structural.bmp", "FilterStructural" );
+                       toolbar_append_toggle_button( filter_toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" );
+                       space();
+                       toolbar_append_toggle_button( filter_toolbar, "Areaportals (ALT + 3)", "f-areaportal.bmp", "FilterAreaportals" );
+                       toolbar_append_toggle_button( filter_toolbar, "Translucent (ALT + 4)", "f-translucent.bmp", "FilterTranslucent" );
+                       toolbar_append_toggle_button( filter_toolbar, "Liquids (ALT + 5)", "f-liquids.bmp", "FilterLiquids" );
+                       toolbar_append_toggle_button( filter_toolbar, "Caulk (ALT + 6)", "f-caulk.bmp", "FilterCaulk" );
+                       toolbar_append_toggle_button( filter_toolbar, "Clips (ALT + 7)", "f-clip.bmp", "FilterClips" );
+                       toolbar_append_toggle_button( filter_toolbar, "HintsSkips (CTRL + H)", "f-hint.bmp", "FilterHintsSkips" );
+                       //toolbar_append_toggle_button( filter_toolbar, "Paths (ALT + 8)", "texture_lock.bmp", "FilterPaths" );
+                       space();
+                       toolbar_append_toggle_button( filter_toolbar, "Entities (ALT + 2)", "f-entities.bmp", "FilterEntities" );
+                       toolbar_append_toggle_button( filter_toolbar, "Lights (ALT + 0)", "lightinspector.png", "FilterLights" );
+                       toolbar_append_toggle_button( filter_toolbar, "Models (SHIFT + M)", "f-models.bmp", "FilterModels" );
+                       toolbar_append_toggle_button( filter_toolbar, "Triggers (CTRL + SHIFT + T)", "f-triggers.bmp", "FilterTriggers" );
+                       //toolbar_append_toggle_button( filter_toolbar, "Decals (SHIFT + D)", "f-decals.bmp", "FilterDecals" );
+                       space();
+                       toolbar_append_button( filter_toolbar, "InvertFilters", "f-invert.bmp", "InvertFilters" );
+                       toolbar_append_button( filter_toolbar, "ResetFilters", "f-reset.bmp", "ResetFilters" );
+
+                       PFbox.pack_start( filter_toolbar, FALSE, FALSE, 0 );
+               }
        }
-       vbox.pack_start( plugin_toolbar, FALSE, FALSE, 0 );
 
        ui::Widget main_statusbar = create_main_statusbar(reinterpret_cast<ui::Widget *>(m_pStatusLabel));
        vbox.pack_end(main_statusbar, FALSE, TRUE, 2);
index aea1b321b837528586c445ff417f1724b8afde58..61f2f4a45e2a0da3d39f3f3ff6c96ee474d70623 100644 (file)
@@ -131,3 +131,17 @@ ui::Toolbar create_plugin_toolbar(){
 
        return toolbar;
 }
+
+ui::Toolbar create_filter_toolbar(){
+
+       auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
+       gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
+       gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
+       toolbar.show();
+
+       g_plugin_toolbar = toolbar;
+
+       PluginToolbar_populate();
+
+       return toolbar;
+}
index ca35b1bc4266b2fb700429a6a07f0d20b244cebc..97c637f274980950eec8e0a34535bf60b05508c8 100644 (file)
@@ -25,6 +25,8 @@
 #define INCLUDED_PLUGINTOOLBAR_H
 
 ui::Toolbar create_plugin_toolbar();
+ui::Toolbar create_filter_toolbar();
+
 void PluginToolbar_populate();
 void PluginToolbar_clear();
 
index 2b4ad1843dce5bd505e1653fe074a85936775a9e..ef0fc6f900b029be6dd48f7e127d63d4f2791d66 100644 (file)
@@ -242,6 +242,10 @@ void TextureBrowser_showShadersExport( const Callback<void(bool)> & importer );
 
 typedef FreeCaller<void(const Callback<void(bool)> &), TextureBrowser_showShadersExport> TextureBrowserShowShadersExport;
 
+void TextureBrowser_showTexturesExport( const Callback<void(bool)> & importer );
+
+typedef FreeCaller<void(const Callback<void(bool)> &), TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport;
+
 void TextureBrowser_showShaderlistOnly( const Callback<void(bool)> & importer );
 
 typedef FreeCaller<void(const Callback<void(bool)> &), TextureBrowser_showShaderlistOnly> TextureBrowserShowShaderlistOnlyExport;
@@ -295,6 +299,7 @@ std::set<CopiedString> m_found_shaders;
 ToggleItem m_hideunused_item;
 ToggleItem m_hidenotex_item;
 ToggleItem m_showshaders_item;
+ToggleItem m_showtextures_item;
 ToggleItem m_showshaderlistonly_item;
 ToggleItem m_fixedsize_item;
 ToggleItem m_filternotex_item;
@@ -315,6 +320,7 @@ std::size_t m_mouseWheelScrollIncrement;
 std::size_t m_textureScale;
 // make the texture increments match the grid changes
 bool m_showShaders;
+bool m_showTextures;
 bool m_showTextureScrollbar;
 StartupShaders m_startupShaders;
 // if true, the texture window will only display in-use shaders
@@ -404,6 +410,7 @@ TextureBrowser() :
        m_hideunused_item( TextureBrowserHideUnusedExport() ),
        m_hidenotex_item( TextureBrowserFilterFallbackExport() ),
        m_showshaders_item( TextureBrowserShowShadersExport() ),
+       m_showtextures_item( TextureBrowserShowTexturesExport() ),
        m_showshaderlistonly_item( TextureBrowserShowShaderlistOnlyExport() ),
        m_fixedsize_item( TextureBrowserFixedSizeExport() ),
        m_filternotex_item( TextureBrowserFilterMissingExport() ),
@@ -415,6 +422,7 @@ TextureBrowser() :
        m_mouseWheelScrollIncrement( 64 ),
        m_textureScale( 50 ),
        m_showShaders( true ),
+       m_showTextures( true ),
        m_showTextureScrollbar( true ),
        m_startupShaders( STARTUPSHADERS_NONE ),
        m_hideUnused( false ),
@@ -560,7 +568,7 @@ bool TextureSearch_IsShown( const char* name ){
 }
 
 // if texture_showinuse jump over non in-use textures
-bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){
+bool Texture_IsShown( IShader* shader, bool show_shaders, bool show_textures, bool hideUnused ){
        // filter missing shaders
        // ugly: filter on built-in fallback name after substitution
        if ( g_TextureBrowser_filterMissing ) {
@@ -599,6 +607,10 @@ bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){
                return false;
        }
 
+       if ( !show_textures && shader->IsDefault() ) {
+               return false;
+       }
+
        if ( hideUnused && !shader->IsInUse() ) {
                return false;
        }
@@ -639,7 +651,7 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
                {
                        IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-                       if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+                       if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                                continue;
                        }
 
@@ -702,6 +714,7 @@ Signal0 m_realiseCallbacks;
 public:
 void realise(){
        m_realiseCallbacks();
+       /* texturebrowser tree update on vfs restart */
        TextureBrowser_constructTreeStore();
 }
 
@@ -953,6 +966,12 @@ void TextureBrowser_showShadersExport( const Callback<void(bool)> & importer ){
 
 typedef FreeCaller<void(const Callback<void(bool)> &), TextureBrowser_showShadersExport> TextureBrowserShowShadersExport;
 
+void TextureBrowser_showTexturesExport( const Callback<void(bool)> & importer ){
+       importer( GlobalTextureBrowser().m_showTextures );
+}
+
+typedef FreeCaller<void(const Callback<void(bool)> &), TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport;
+
 void TextureBrowser_showShaderlistOnly( const Callback<void(bool)> & importer ){
        importer( g_TextureBrowser_shaderlistOnly );
 }
@@ -1018,7 +1037,7 @@ void TextureBrowser_Focus( TextureBrowser& textureBrowser, const char* name ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -1059,7 +1078,7 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -1176,6 +1195,8 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
 
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        glDisable( GL_DEPTH_TEST );
+
+       //glDisable( GL_BLEND );
        if ( g_TextureBrowser_enableAlpha ) {
                glEnable( GL_BLEND );
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1183,6 +1204,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
        else {
                glDisable( GL_BLEND );
        }
+
        glOrtho( 0, textureBrowser.width, originy - textureBrowser.height, originy, -100, 100 );
        glEnable( GL_TEXTURE_2D );
 
@@ -1196,7 +1218,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -1224,8 +1246,41 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                        // shaders have a white border, simple textures don't
                        // if !texture_showinuse: (some textures displayed may not be in use)
                        // draw an additional square around with 0.5 1 0.5 color
+                       glLineWidth( 1 );
+                       // shader border:
+                       if ( !shader->IsDefault() ) {
+                       //real 1px white/black stipple
+                               glColor3f( 0, 0, 0 );
+                               glDisable( GL_TEXTURE_2D );
+
+                               float xf = (float)x;
+                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
+                               glBegin( GL_LINE_LOOP );
+                               glVertex2f( xf - 1.5,yf + 1.5 );
+                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
+
+                               glEnd();
+
+                               glEnable( GL_LINE_STIPPLE );
+                               glLineStipple( 1, 0x0FFF );
+
+                               glBegin( GL_LINE_LOOP );
+                               glColor3f( 1, 1, 1 );
+
+                               glVertex2f( xf - 1.5,yf + 1.5 );
+                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
+
+                               glEnd();
+                               glDisable( GL_LINE_STIPPLE );
+                               glEnable( GL_TEXTURE_2D );
+
+                       }
                        if ( shader_equal( TextureBrowser_GetSelectedShader( textureBrowser ), shader->getName() ) ) {
-                               glLineWidth( 3 );
+                               glLineWidth( 2 );
                                if ( textureBrowser.m_rmbSelected ) {
                                        glColor3f( 0,0,1 );
                                }
@@ -1244,45 +1299,29 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                                glEnable( GL_TEXTURE_2D );
                                glLineWidth( 1 );
                        }
-                       else
-                       {
-                               glLineWidth( 1 );
-                               // shader border:
-                               if ( !shader->IsDefault() ) {
-                                       glColor3f( 1,1,1 );
-                                       glDisable( GL_TEXTURE_2D );
-
-                                       glBegin( GL_LINE_LOOP );
-                                       glVertex2i( x - 1,y + 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x - 1,y - nHeight - 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 1 + nWidth,y - nHeight - 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 1 + nWidth,y + 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glEnd();
-                                       glEnable( GL_TEXTURE_2D );
-                               }
-
-                               // highlight in-use textures
-                               if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
-                                       glColor3f( 0.5,1,0.5 );
-                                       glDisable( GL_TEXTURE_2D );
-                                       glBegin( GL_LINE_LOOP );
-                                       glVertex2i( x - 3,y + 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x - 3,y - nHeight - 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 3 + nWidth,y - nHeight - 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 3 + nWidth,y + 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glEnd();
-                                       glEnable( GL_TEXTURE_2D );
-                               }
+                       // highlight in-use textures
+                       else if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
+                       //1px with float
+                               float xf = (float)x;
+                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
+                               glColor3f( 0.5,1,0.5 );
+                               glDisable( GL_TEXTURE_2D );
+                               glBegin( GL_LINE_LOOP );
+                               glVertex2f( xf - 3.5,yf + 3.5 );
+                               glVertex2f( xf - 3.5,yf - nHeight - 3.5 );
+                               glVertex2f( xf + 3.5 + nWidth,yf - nHeight - 3.5 );
+                               glVertex2f( xf + 3.5 + nWidth,yf + 3.5 );
+                               glEnd();
+                               glEnable( GL_TEXTURE_2D );
                        }
 
                        // draw checkerboard for transparent textures
-                       if ( g_TextureBrowser_enableAlpha )
+                       if ( g_TextureBrowser_enableAlpha )
                        {
                                glDisable( GL_TEXTURE_2D );
                                glBegin( GL_QUADS );
                                int font_height = TextureBrowser_fontHeight( textureBrowser );
                                for ( int i = 0; i < nHeight; i += 8 )
-                               {
                                        for ( int j = 0; j < nWidth; j += 8 )
                                        {
                                                unsigned char color = (i + j) / 8 % 2 ? 0x66 : 0x99;
@@ -1296,7 +1335,6 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                                                glVertex2i(x + left,  y - nHeight - font_height + bottom);
                                                glVertex2i(x + right, y - nHeight - font_height + bottom);
                                        }
-                               }
                                glEnd();
                                glEnable( GL_TEXTURE_2D );
                        }
@@ -1351,18 +1389,30 @@ void TextureBrowser_queueDraw( TextureBrowser& textureBrowser ){
 void TextureBrowser_setScale( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_textureScale = scale;
 
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
 void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_uniformTextureSize = scale;
 
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
 void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_uniformTextureMinSize = scale;
 
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
@@ -1475,6 +1525,27 @@ gboolean TextureBrowser_button_press( ui::Widget widget, GdkEventButton* event,
                        }
                }
        }
+       else if ( event->type == GDK_2BUTTON_PRESS ) {
+               const char* sh = textureBrowser->shader.c_str();
+               char* dir = strrchr( sh, '/' );
+               if( dir != NULL ){
+                       *(dir + 1) = '\0';
+                       dir = strchr( sh, '/' );
+                       if( dir != NULL ){
+                               dir++;
+                               if( *dir != '\0'){
+                                       ScopeDisableScreenUpdates disableScreenUpdates( dir, "Loading Textures" );
+                                       TextureBrowser_ShowDirectory( *textureBrowser, dir );
+                                       TextureBrowser_queueDraw( *textureBrowser );
+                               }
+                       }
+               }
+       }
+       else if ( event->type == GDK_3BUTTON_PRESS ) {
+               ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getComonShadersDir(), "Loading Textures" );
+               TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() );
+               TextureBrowser_queueDraw( *textureBrowser );
+       }
        return FALSE;
 }
 
@@ -1762,7 +1833,6 @@ ui::MenuItem TextureBrowser_constructViewMenu( ui::Menu menu ){
 
        menu_separator( menu );
 
-       create_menu_item_with_mnemonic( menu, "Show All", "ShowAllTextures" );
 
        // we always want to show shaders but don't want a "Show Shaders" menu for doom3 and .wad file games
        if ( g_pGameDescription->mGameType == "doom3" || !string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
@@ -1771,14 +1841,16 @@ ui::MenuItem TextureBrowser_constructViewMenu( ui::Menu menu ){
        else
        {
                create_check_menu_item_with_mnemonic( menu, "Show shaders", "ToggleShowShaders" );
+               create_check_menu_item_with_mnemonic( menu, "Show textures", "ToggleShowTextures" );
+               menu_separator( menu );
        }
 
-       if ( g_pGameDescription->mGameType != "doom3" && string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
-               create_check_menu_item_with_mnemonic( menu, "Shaders Only", "ToggleShowShaderlistOnly" );
-       }
        if ( g_TextureBrowser.m_tags ) {
                create_menu_item_with_mnemonic( menu, "Show Untagged", "ShowUntagged" );
        }
+       if ( g_pGameDescription->mGameType != "doom3" && string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
+               create_check_menu_item_with_mnemonic( menu, "ShaderList Only", "ToggleShowShaderlistOnly" );
+       }
 
        menu_separator( menu );
        create_check_menu_item_with_mnemonic( menu, "Fixed Size", "FixedSize" );
@@ -2501,9 +2573,10 @@ void TextureBrowser_pasteTag(){
 }
 
 void TextureBrowser_RefreshShaders(){
-       ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
-       GlobalShaderSystem().refresh();
-       UpdateAllWindows();
+
+       /* When shaders are refreshed, forces reloading the textures as well.
+       Previously it would at best only display shaders, at worst mess up some textured objects. */
+
     auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree);
        GtkTreeModel* model = NULL;
        GtkTreeIter iter;
@@ -2518,14 +2591,41 @@ void TextureBrowser_RefreshShaders(){
                if ( !TextureBrowser_showWads() ) {
                        strcat( dirName, "/" );
                }
+
+               ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+               GlobalShaderSystem().refresh();
+               UpdateAllWindows();
+
                TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
                TextureBrowser_queueDraw( GlobalTextureBrowser() );
        }
+
+       else{
+               ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+               GlobalShaderSystem().refresh();
+               UpdateAllWindows();
+       }
 }
 
 void TextureBrowser_ToggleShowShaders(){
        g_TextureBrowser.m_showShaders ^= 1;
        g_TextureBrowser.m_showshaders_item.update();
+
+       g_TextureBrowser.m_heightChanged = true;
+       g_TextureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
+       TextureBrowser_queueDraw( g_TextureBrowser );
+}
+
+void TextureBrowser_ToggleShowTextures(){
+       g_TextureBrowser.m_showTextures ^= 1;
+       g_TextureBrowser.m_showtextures_item.update();
+
+       g_TextureBrowser.m_heightChanged = true;
+       g_TextureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( g_TextureBrowser );
 }
 
@@ -2539,7 +2639,9 @@ void TextureBrowser_ToggleShowShaderListOnly(){
 void TextureBrowser_showAll(){
        g_TextureBrowser_currentDirectory = "";
        g_TextureBrowser.m_searchedTags = false;
-       TextureBrowser_heightChanged( g_TextureBrowser );
+//     TextureBrowser_SetHideUnused( g_TextureBrowser, false );
+       TextureBrowser_ToggleHideUnused();
+       //TextureBrowser_heightChanged( g_TextureBrowser );
        TextureBrowser_updateTitle();
 }
 
@@ -2724,7 +2826,9 @@ void TextureBrowser_Construct(){
        GlobalCommands_insert( "ShowAllTextures", makeCallbackF(TextureBrowser_showAll), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator( 'T' ) );
        GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
-       GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
+       GlobalToggles_insert( "ToggleShowTextures", makeCallbackF(TextureBrowser_ToggleShowTextures), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showtextures_item ) );
+       GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly),
+ ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
        GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
        GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
        GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) );
@@ -2735,6 +2839,7 @@ void TextureBrowser_Construct(){
        GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(g_TextureBrowser) );
        GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(GlobalTextureBrowser()));
        GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( GlobalTextureBrowser().m_showShaders ) );
+       GlobalPreferenceSystem().registerPreference( "ShowTextures", make_property_string( GlobalTextureBrowser().m_showTextures ) );
        GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", make_property_string( g_TextureBrowser_shaderlistOnly ) );
        GlobalPreferenceSystem().registerPreference( "FixedSize", make_property_string( g_TextureBrowser_fixedSize ) );
        GlobalPreferenceSystem().registerPreference( "FilterMissing", make_property_string( g_TextureBrowser_filterMissing ) );