From: Mattia Basaglia Date: Sun, 19 Jul 2015 15:13:53 +0000 (+0200) Subject: Add an option for the fixed size texture thumbnails X-Git-Tag: xonotic-v0.8.1~1^2~4^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fb845827edfb59f83514db3b7649391a510af760;p=xonotic%2Fnetradiant.git Add an option for the fixed size texture thumbnails --- diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 30834869..e306015f 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -326,7 +326,7 @@ TextureBrowser() : m_rmbSelected( false ), m_searchedTags( false ), m_tags( false ), - m_uniformTextureSize( 128 ){ + m_uniformTextureSize( 96 ){ } }; @@ -1208,6 +1208,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 ); @@ -2496,6 +2502,14 @@ void TextureScaleExport( TextureBrowser& textureBrowser, const IntImportCallback } typedef ReferenceCaller1 TextureScaleExportCaller; + +void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){ + + if ( value > 16 ) + TextureBrowser_setUniformSize( textureBrowser, value ); +} +typedef ReferenceCaller1 UniformTextureSizeImportCaller; + void TextureBrowser_constructPreferences( PreferencesPage& page ){ page.appendCheckBox( "", "Texture scrollbar", @@ -2511,6 +2525,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 +2577,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 )