mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 12:01:10 +00:00
make “hide empty directories” an option
This commit is contained in:
parent
e9e095b4c6
commit
b1c4fb1304
5 changed files with 28 additions and 2 deletions
|
@ -552,6 +552,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){
|
||||||
case ID_TEXTURES_LOAD: g_pParentWnd->OnTexturesLoad(); break;
|
case ID_TEXTURES_LOAD: g_pParentWnd->OnTexturesLoad(); break;
|
||||||
case ID_TEXTURES_RELOADSHADERS: g_pParentWnd->OnTexturesReloadshaders(); break;
|
case ID_TEXTURES_RELOADSHADERS: g_pParentWnd->OnTexturesReloadshaders(); break;
|
||||||
case ID_TEXTURES_SHADERS_SHOW: g_pParentWnd->OnTexturesShadersShow(); break;
|
case ID_TEXTURES_SHADERS_SHOW: g_pParentWnd->OnTexturesShadersShow(); break;
|
||||||
|
case ID_TEXTURES_EMPTYDIRS_HIDE: g_pParentWnd->OnTexturesEmptyDirsHide(); break;
|
||||||
case ID_TEXTURES_TEXTUREWINDOWSCALE_200:
|
case ID_TEXTURES_TEXTUREWINDOWSCALE_200:
|
||||||
case ID_TEXTURES_TEXTUREWINDOWSCALE_100:
|
case ID_TEXTURES_TEXTUREWINDOWSCALE_100:
|
||||||
case ID_TEXTURES_TEXTUREWINDOWSCALE_50:
|
case ID_TEXTURES_TEXTUREWINDOWSCALE_50:
|
||||||
|
@ -1401,6 +1402,9 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){
|
||||||
item = create_check_menu_item_with_mnemonic( menu, _( "shaderlist.txt only" ),
|
item = create_check_menu_item_with_mnemonic( menu, _( "shaderlist.txt only" ),
|
||||||
G_CALLBACK( HandleCommand ), ID_TEXTURES_SHADERLISTONLY, FALSE );
|
G_CALLBACK( HandleCommand ), ID_TEXTURES_SHADERLISTONLY, FALSE );
|
||||||
g_object_set_data( G_OBJECT( window ), "menu_textures_shaderlistonly", item );
|
g_object_set_data( G_OBJECT( window ), "menu_textures_shaderlistonly", item );
|
||||||
|
item = create_check_menu_item_with_mnemonic( menu, _( "Hide empty directories" ),
|
||||||
|
G_CALLBACK( HandleCommand ), ID_TEXTURES_EMPTYDIRS_HIDE, FALSE );
|
||||||
|
g_object_set_data( G_OBJECT( window ), "menu_textures_emptydirs_hide", item );
|
||||||
item = menu_separator( menu );
|
item = menu_separator( menu );
|
||||||
|
|
||||||
menu_in_menu = create_menu_in_menu_with_mnemonic( menu, _( "Texture Directories" ) );
|
menu_in_menu = create_menu_in_menu_with_mnemonic( menu, _( "Texture Directories" ) );
|
||||||
|
@ -3107,6 +3111,8 @@ void MainFrame::Create(){
|
||||||
g_bIgnoreCommands++;
|
g_bIgnoreCommands++;
|
||||||
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaders_show" ) );
|
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaders_show" ) );
|
||||||
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bShowShaders ? TRUE : FALSE );
|
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bShowShaders ? TRUE : FALSE );
|
||||||
|
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_emptydirs_hide" ) );
|
||||||
|
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bHideEmptyDirs ? TRUE : FALSE );
|
||||||
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaderlistonly" ) );
|
item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaderlistonly" ) );
|
||||||
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bTexturesShaderlistOnly ? TRUE : FALSE );
|
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bTexturesShaderlistOnly ? TRUE : FALSE );
|
||||||
g_bIgnoreCommands--;
|
g_bIgnoreCommands--;
|
||||||
|
@ -5950,6 +5956,20 @@ void MainFrame::OnTexturesReloadshaders(){
|
||||||
ClearGSList( texdirs );
|
ClearGSList( texdirs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnTexturesEmptyDirsHide(){
|
||||||
|
g_PrefsDlg.m_bHideEmptyDirs ^= 1;
|
||||||
|
GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_emptydirs_hide" ) );
|
||||||
|
g_bIgnoreCommands++;
|
||||||
|
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bHideEmptyDirs ? TRUE : FALSE );
|
||||||
|
g_bIgnoreCommands--;
|
||||||
|
|
||||||
|
GSList *texdirs = NULL;
|
||||||
|
FillTextureList( &texdirs );
|
||||||
|
FillTextureMenu( texdirs );
|
||||||
|
FillTextureDirListWidget( texdirs );
|
||||||
|
ClearGSList( texdirs );
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::OnTexturesShadersShow(){
|
void MainFrame::OnTexturesShadersShow(){
|
||||||
g_PrefsDlg.m_bShowShaders ^= 1;
|
g_PrefsDlg.m_bShowShaders ^= 1;
|
||||||
GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaders_show" ) );
|
GtkWidget *item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_textures_shaders_show" ) );
|
||||||
|
|
|
@ -216,6 +216,7 @@ struct SKeyInfo
|
||||||
#define ID_VIEW_HIDESHOW_SHOWHIDDEN 33007
|
#define ID_VIEW_HIDESHOW_SHOWHIDDEN 33007
|
||||||
#define ID_TEXTURES_SHADERS_SHOW 33008
|
#define ID_TEXTURES_SHADERS_SHOW 33008
|
||||||
//#define ID_SELECTION_CSGADD 33009
|
//#define ID_SELECTION_CSGADD 33009
|
||||||
|
#define ID_TEXTURES_EMPTYDIRS_HIDE 33010
|
||||||
#define ID_SELECTION_CSGMERGE 33011
|
#define ID_SELECTION_CSGMERGE 33011
|
||||||
#define ID_TEXTURES_FLUSH_UNUSED 33014
|
#define ID_TEXTURES_FLUSH_UNUSED 33014
|
||||||
#define ID_DROP_GROUP_REMOVE 33016
|
#define ID_DROP_GROUP_REMOVE 33016
|
||||||
|
@ -863,6 +864,7 @@ void OnViewCrosshair();
|
||||||
void OnViewHideshowHideselected();
|
void OnViewHideshowHideselected();
|
||||||
void OnViewHideshowShowhidden();
|
void OnViewHideshowShowhidden();
|
||||||
void OnTexturesShadersShow();
|
void OnTexturesShadersShow();
|
||||||
|
void OnTexturesEmptyDirsHide();
|
||||||
void OnViewGroups();
|
void OnViewGroups();
|
||||||
void OnDropGroupAddtoWorld();
|
void OnDropGroupAddtoWorld();
|
||||||
void OnDropGroupName();
|
void OnDropGroupName();
|
||||||
|
|
|
@ -119,6 +119,7 @@
|
||||||
#define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
|
#define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
|
||||||
#define TEXTUREQUALITY_KEY "TextureQuality"
|
#define TEXTUREQUALITY_KEY "TextureQuality"
|
||||||
#define SHOWSHADERS_KEY "ShowShaders"
|
#define SHOWSHADERS_KEY "ShowShaders"
|
||||||
|
#define HIDEEMPTYDIRS_KEY "HideEmptyDirs"
|
||||||
#define SHADERTEST_KEY "ShaderTest"
|
#define SHADERTEST_KEY "ShaderTest"
|
||||||
#define GLLIGHTING_KEY "UseGLLighting"
|
#define GLLIGHTING_KEY "UseGLLighting"
|
||||||
#define LOADSHADERS_KEY "LoadShaders"
|
#define LOADSHADERS_KEY "LoadShaders"
|
||||||
|
@ -644,6 +645,7 @@ PrefsDlg::PrefsDlg (){
|
||||||
m_bSelectWholeEntities = TRUE;
|
m_bSelectWholeEntities = TRUE;
|
||||||
m_nTextureQuality = 3;
|
m_nTextureQuality = 3;
|
||||||
m_bShowShaders = TRUE;
|
m_bShowShaders = TRUE;
|
||||||
|
m_bHideEmptyDirs = FALSE;
|
||||||
m_bGLLighting = FALSE;
|
m_bGLLighting = FALSE;
|
||||||
m_nShader = 0;
|
m_nShader = 0;
|
||||||
m_nUndoLevels = 30;
|
m_nUndoLevels = 30;
|
||||||
|
@ -3076,6 +3078,7 @@ void PrefsDlg::LoadPrefs(){
|
||||||
mLocalPrefs.GetPref( SWITCHCLIP_KEY, &m_bSwitchClip, TRUE );
|
mLocalPrefs.GetPref( SWITCHCLIP_KEY, &m_bSwitchClip, TRUE );
|
||||||
mLocalPrefs.GetPref( SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE );
|
mLocalPrefs.GetPref( SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE );
|
||||||
mLocalPrefs.GetPref( SHOWSHADERS_KEY, &m_bShowShaders, TRUE );
|
mLocalPrefs.GetPref( SHOWSHADERS_KEY, &m_bShowShaders, TRUE );
|
||||||
|
mLocalPrefs.GetPref( HIDEEMPTYDIRS_KEY, &m_bHideEmptyDirs, FALSE );
|
||||||
mLocalPrefs.GetPref( GLLIGHTING_KEY, &m_bGLLighting, FALSE );
|
mLocalPrefs.GetPref( GLLIGHTING_KEY, &m_bGLLighting, FALSE );
|
||||||
mLocalPrefs.GetPref( NOSTIPPLE_KEY, &m_bNoStipple, FALSE );
|
mLocalPrefs.GetPref( NOSTIPPLE_KEY, &m_bNoStipple, FALSE );
|
||||||
mLocalPrefs.GetPref( UNDOLEVELS_KEY, &m_nUndoLevels, 30 );
|
mLocalPrefs.GetPref( UNDOLEVELS_KEY, &m_nUndoLevels, 30 );
|
||||||
|
|
|
@ -636,6 +636,7 @@ bool m_bTextureScrollbar;
|
||||||
bool m_bDisplayLists;
|
bool m_bDisplayLists;
|
||||||
bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00
|
bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00
|
||||||
bool m_bShowShaders;
|
bool m_bShowShaders;
|
||||||
|
bool m_bHideEmptyDirs;
|
||||||
int m_nShader;
|
int m_nShader;
|
||||||
bool m_bNoStipple;
|
bool m_bNoStipple;
|
||||||
int m_nUndoLevels;
|
int m_nUndoLevels;
|
||||||
|
|
|
@ -681,7 +681,7 @@ void FillTextureList( GSList** pArray )
|
||||||
// Hydra: erm, this didn't used to do anything except leak memory...
|
// Hydra: erm, this didn't used to do anything except leak memory...
|
||||||
// For Halflife support this is required to work however.
|
// For Halflife support this is required to work however.
|
||||||
// g_slist_append(texdirs, p->data);
|
// g_slist_append(texdirs, p->data);
|
||||||
if ( IsDirContainingTextures( (char*)p->data ) )
|
if ( !g_PrefsDlg.m_bHideEmptyDirs || IsDirContainingTextures( (char*)p->data ) )
|
||||||
{
|
{
|
||||||
texdirs = g_slist_append( texdirs, g_strdup( (char *)p->data ) );
|
texdirs = g_slist_append( texdirs, g_strdup( (char *)p->data ) );
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ void FillTextureList( GSList** pArray )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !found ) {
|
if ( !found ) {
|
||||||
if( QERApp_IsDirContainingShaders( shaderfile ) )
|
if( !g_PrefsDlg.m_bHideEmptyDirs || QERApp_IsDirContainingShaders( shaderfile ) )
|
||||||
{
|
{
|
||||||
texdirs = g_slist_prepend( texdirs, g_strdup( shaderfile ) );
|
texdirs = g_slist_prepend( texdirs, g_strdup( shaderfile ) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue