* "Entity Names = Targetnames" option:

also affects Entity List
		moved from View->Show menu to prefs->display->entities
		prompt about restart on change
This commit is contained in:
Garux 2017-08-20 16:42:18 +03:00
parent 56997e1c66
commit caf093f827
5 changed files with 27 additions and 17 deletions

View File

@ -415,6 +415,10 @@ void Entity_Construct( EGameType gameType ){
GlobalPreferenceSystem().registerPreference( "SI_ShowAngles", BoolImportStringCaller( g_showAngles ), BoolExportStringCaller( g_showAngles ) );
GlobalPreferenceSystem().registerPreference( "LightRadiuses", BoolImportStringCaller( g_lightRadii ), BoolExportStringCaller( g_lightRadii ) );
if( !g_showTargetNames ){
Static<KeyIsName>::instance().m_nameKey = "classname";
}
Entity_InitFilters();
LightType lightType = LIGHTTYPE_DEFAULT;
if ( g_gameType == eGameTypeRTCW ) {

View File

@ -26,7 +26,7 @@
#include "eclasslib.h"
#include "generic/callback.h"
#include "nameable.h"
#include "entity.h" //g_showTargetNames
#include "entity.h"
#include <set>
@ -117,7 +117,8 @@ public:
}
RenderableNamedEntity( NamedEntity& named, const Vector3& position, const char* exclude = 0 )
: m_named( named ), m_position( position ), m_tex( 0 ), m_exclude( exclude ) {
construct_textures( g_showTargetNames ? m_named.name() : m_named.classname() );
// construct_textures( g_showTargetNames ? m_named.name() : m_named.classname() );
construct_textures( m_named.name() );
m_named.attach( IdentifierChangedCaller( *this ) );
}
bool excluded_not() const {
@ -261,7 +262,8 @@ public:
}
void identifierChanged( const char* value ){
delete_textures();
construct_textures( g_showTargetNames ? value : m_named.classname() );
// construct_textures( g_showTargetNames ? value : m_named.classname() );
construct_textures( value );
}
typedef MemberCaller1<RenderableNamedEntity, const char*, &RenderableNamedEntity::identifierChanged> IdentifierChangedCaller;
};

View File

@ -668,6 +668,21 @@ void ShowNamesRatioExport( EntityCreator& self, const IntImportCallback& importe
typedef ReferenceCaller1<EntityCreator, const IntImportCallback&, ShowNamesRatioExport> ShowNamesRatioExportCaller;
void ShowTargetNamesImport( EntityCreator& self, bool value ){
const bool oldvalue = self.getShowTargetNames();
self.setShowTargetNames( value );
if( oldvalue != value ){
PreferencesDialog_restartRequired( "Entity Names = Targetnames" );
}
}
typedef ReferenceCaller1<EntityCreator, bool, ShowTargetNamesImport> ShowTargetNamesImportCaller;
void ShowTargetNamesExport( EntityCreator& self, const BoolImportCallback& importer ){
importer( self.getShowTargetNames() );
}
typedef ReferenceCaller1<EntityCreator, const BoolImportCallback&, ShowTargetNamesExport> ShowTargetNamesExportCaller;
void Entity_constructPreferences( PreferencesPage& page ){
page.appendSpinner( "Names Display Distance (3D)", 512.0, 0.0, 200500.0,
IntImportCallback( ShowNamesDistImportCaller( GlobalEntityCreator() ) ),
@ -677,6 +692,9 @@ void Entity_constructPreferences( PreferencesPage& page ){
IntImportCallback( ShowNamesRatioImportCaller( GlobalEntityCreator() ) ),
IntExportCallback( ShowNamesRatioExportCaller( GlobalEntityCreator() ) )
);
page.appendCheckBox( "Entity Names", "= Targetnames",
BoolImportCallback( ShowTargetNamesImportCaller( GlobalEntityCreator() ) ),
BoolExportCallback( ShowTargetNamesExportCaller( GlobalEntityCreator() ) ) );
}
void Entity_constructPage( PreferenceGroup& group ){
PreferencesPage page( group.createPage( "Entities", "Entity Display Preferences" ) );

View File

@ -2079,7 +2079,6 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
}
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Angles", "ShowAngles" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Names", "ShowNames" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Entity Names = Targetnames", "ShowTargetNames" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Light Radiuses", "ShowLightRadiuses" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity Boxes", "ShowBboxes" );

View File

@ -3184,18 +3184,6 @@ void ShowBboxesToggle(){
UpdateAllWindows();
}
void ShowTargetNamesExport( const BoolImportCallback& importer ){
importer( GlobalEntityCreator().getShowTargetNames() );
}
typedef FreeCaller1<const BoolImportCallback&, ShowTargetNamesExport> ShowTargetNamesExportCaller;
ShowTargetNamesExportCaller g_show_targetnames_caller;
ToggleItem g_show_targetnames( g_show_targetnames_caller );
void ShowTargetNamesToggle(){
GlobalEntityCreator().setShowTargetNames( !GlobalEntityCreator().getShowTargetNames() );
g_show_targetnames.update();
XY_UpdateAllWindows();
}
void ShowAnglesExport( const BoolImportCallback& importer ){
importer( GlobalEntityCreator().getShowAngles() );
}
@ -3336,7 +3324,6 @@ void XYShow_registerCommands(){
GlobalToggles_insert( "ShowAngles", FreeCaller<ShowAnglesToggle>(), ToggleItem::AddCallbackCaller( g_show_angles ) );
GlobalToggles_insert( "ShowNames", FreeCaller<ShowNamesToggle>(), ToggleItem::AddCallbackCaller( g_show_names ) );
GlobalToggles_insert( "ShowBboxes", FreeCaller<ShowBboxesToggle>(), ToggleItem::AddCallbackCaller( g_show_bboxes ) );
GlobalToggles_insert( "ShowTargetNames", FreeCaller<ShowTargetNamesToggle>(), ToggleItem::AddCallbackCaller( g_show_targetnames ) );
GlobalToggles_insert( "ShowBlocks", FreeCaller<ShowBlocksToggle>(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
GlobalToggles_insert( "ShowCoordinates", FreeCaller<ShowCoordinatesToggle>(), ToggleItem::AddCallbackCaller( g_show_coordinates ) );
GlobalToggles_insert( "ShowWindowOutline", FreeCaller<ShowOutlineToggle>(), ToggleItem::AddCallbackCaller( g_show_outline ) );