]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/texwindow.cpp
refresh DPK VFS before refreshing textures
[xonotic/netradiant.git] / radiant / texwindow.cpp
index 0d8f52b638e31a1f39a63b093a1738d09365f4dc..e30f1035112e8eaa1122c0fd4483fda619177509 100644 (file)
@@ -132,9 +132,9 @@ typedef ReferenceCaller1<TextureGroups, const char*, TextureGroups_addDirectory>
 namespace
 {
 bool g_TextureBrowser_shaderlistOnly = false;
-bool g_TextureBrowser_fixedSize = false;
+bool g_TextureBrowser_fixedSize = true;
 bool g_TextureBrowser_filterNotex = false;
-bool g_TextureBrowser_enableAlpha = false;
+bool g_TextureBrowser_enableAlpha = true;
 }
 
 class DeferredAdjustment
@@ -326,7 +326,7 @@ TextureBrowser() :
        m_rmbSelected( false ),
        m_searchedTags( false ),
        m_tags( false ),
-       m_uniformTextureSize( 128 ){
+       m_uniformTextureSize( 96 ){
 }
 };
 
@@ -587,12 +587,15 @@ void TextureBrowser_addActiveShadersChangedCallback( const SignalHandler& handle
        g_activeShadersChangedCallbacks.connectLast( handler );
 }
 
+void TextureBrowser_constructTreeStore();
+
 class ShadersObserver : public ModuleObserver
 {
 Signal0 m_realiseCallbacks;
 public:
 void realise(){
        m_realiseCallbacks();
+       TextureBrowser_constructTreeStore();
 }
 void unrealise(){
 }
@@ -1208,6 +1211,12 @@ void TextureBrowser_setScale( TextureBrowser& textureBrowser, std::size_t scale
        TextureBrowser_queueDraw( textureBrowser );
 }
 
+void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t scale ){
+       textureBrowser.m_uniformTextureSize = scale;
+
+       TextureBrowser_queueDraw( textureBrowser );
+}
+
 
 void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){
        int originy = TextureBrowser_getOriginY( textureBrowser );
@@ -1624,7 +1633,9 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
                create_menu_item_with_mnemonic( menu, "Show Untagged", "ShowUntagged" );
        }
 
+       menu_separator( menu );
        create_check_menu_item_with_mnemonic( menu, "Fixed Size", "FixedSize" );
+       create_check_menu_item_with_mnemonic( menu, "Transparency", "EnableAlpha" );
 
        if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
                menu_separator( menu );
@@ -1632,8 +1643,6 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
                gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE );
        }
 
-       menu_separator( menu );
-       create_check_menu_item_with_mnemonic( menu, "Show Transparency", "EnableAlpha" );
 
        return textures_menu_item;
 }
@@ -1921,11 +1930,11 @@ void TextureBrowser_checkTagFile(){
 
 void TextureBrowser_SetNotex(){
        StringOutputStream name( 256 );
-       name << GlobalRadiant().getAppPath() << "bitmaps/notex.bmp";
+       name << GlobalRadiant().getAppPath() << "bitmaps/notex.png";
        g_notex = name.c_str();
 
        name = NULL;
-       name << GlobalRadiant().getAppPath() << "bitmaps/shadernotex.bmp";
+       name << GlobalRadiant().getAppPath() << "bitmaps/shadernotex.png";
        g_shadernotex = name.c_str();
 }
 
@@ -2352,6 +2361,7 @@ void TextureBrowser_pasteTag(){
 
 void RefreshShaders(){
        ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+       VFS_Refresh();
        GlobalShaderSystem().refresh();
        UpdateAllWindows();
        GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);
@@ -2496,6 +2506,14 @@ void TextureScaleExport( TextureBrowser& textureBrowser, const IntImportCallback
 }
 typedef ReferenceCaller1<TextureBrowser, const IntImportCallback&, TextureScaleExport> TextureScaleExportCaller;
 
+
+void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){
+
+       if ( value > 16 )
+               TextureBrowser_setUniformSize( textureBrowser, value );
+}
+typedef ReferenceCaller1<TextureBrowser, int, UniformTextureSizeImport> UniformTextureSizeImportCaller;
+
 void TextureBrowser_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox(
                "", "Texture scrollbar",
@@ -2511,6 +2529,12 @@ void TextureBrowser_constructPreferences( PreferencesPage& page ){
                        IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) )
                        );
        }
+       page.appendSpinner(
+               "Texture Thumbnail Size",
+               GlobalTextureBrowser().m_uniformTextureSize,
+               GlobalTextureBrowser().m_uniformTextureSize,
+               16, 8192
+       );
        page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement );
        {
                const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() };
@@ -2557,6 +2581,9 @@ void TextureBrowser_Construct(){
                                                                                                 makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ),
                                                                                                 SizeExportStringCaller( g_TextureBrowser.m_textureScale )
                                                                                                 );
+       GlobalPreferenceSystem().registerPreference( "UniformTextureSize",
+                                                                                                makeIntStringImportCallback(UniformTextureSizeImportCaller(g_TextureBrowser)),
+                                                                                                IntExportStringCaller(g_TextureBrowser.m_uniformTextureSize) );
        GlobalPreferenceSystem().registerPreference( "TextureScrollbar",
                                                                                                 makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ),
                                                                                                 BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar )