]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
menus...
authorGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:17:58 +0000 (09:17 +0300)
committerGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:17:58 +0000 (09:17 +0300)
* view->show: +Entity Names = Targetnames (option to draw targetnames, not classnames; def = no)

include/ientity.h
plugins/entity/entity.cpp
plugins/entity/entity.h
plugins/entity/namedentity.h
radiant/mainframe.cpp
radiant/xywindow.cpp

index c315b3abb2708a527c355ee7759efe44ef5d5363..5c09d2c41a1b5e5cd0c4895b4fe61f897a1947c6 100644 (file)
@@ -126,6 +126,8 @@ virtual void setLightRadii( bool lightRadii ) = 0;
 virtual bool getLightRadii() = 0;
 virtual void setShowNames( bool showNames ) = 0;
 virtual bool getShowNames() = 0;
+virtual void setShowTargetNames( bool showNames ) = 0;
+virtual bool getShowTargetNames() = 0;
 virtual void setShowAngles( bool showAngles ) = 0;
 virtual bool getShowAngles() = 0;
 
index c862459e94ac43d9dec87c59cd3eece5e496f2dc..0dd32115533783a8e921a767b2e3f8113b4ff263 100644 (file)
@@ -111,6 +111,7 @@ EntityCreator::KeyValueChangedFunc KeyValue::m_entityKeyValueChanged = 0;
 Counter* EntityKeyValues::m_counter = 0;
 
 bool g_showNames = true;
+bool g_showTargetNames = false;
 bool g_showAngles = true;
 bool g_newLightDraw = true;
 bool g_lightRadii = true;
@@ -264,6 +265,12 @@ void setShowNames( bool showNames ){
 bool getShowNames(){
        return g_showNames;
 }
+void setShowTargetNames( bool showNames ){
+       g_showTargetNames = showNames;
+}
+bool getShowTargetNames(){
+       return g_showTargetNames;
+}
 void setShowAngles( bool showAngles ){
        g_showAngles = showAngles;
 }
@@ -368,6 +375,7 @@ void Entity_Construct( EGameType gameType ){
        }
 
        GlobalPreferenceSystem().registerPreference( "SI_ShowNames", BoolImportStringCaller( g_showNames ), BoolExportStringCaller( g_showNames ) );
+       GlobalPreferenceSystem().registerPreference( "SI_ShowTargetNames", BoolImportStringCaller( g_showTargetNames ), BoolExportStringCaller( g_showTargetNames ) );
        GlobalPreferenceSystem().registerPreference( "SI_ShowAngles", BoolImportStringCaller( g_showAngles ), BoolExportStringCaller( g_showAngles ) );
        GlobalPreferenceSystem().registerPreference( "NewLightStyle", BoolImportStringCaller( g_newLightDraw ), BoolExportStringCaller( g_newLightDraw ) );
        GlobalPreferenceSystem().registerPreference( "LightRadiuses", BoolImportStringCaller( g_lightRadii ), BoolExportStringCaller( g_lightRadii ) );
index ae294ab7c262004fc1058b92eef25d7297977327..ba5f991fcf0288c16d4b383badf97513980d78c0 100644 (file)
@@ -39,6 +39,7 @@ void Entity_Construct( EGameType gameType = eGameTypeQuake3 );
 void Entity_Destroy();
 
 extern bool g_showNames;
+extern bool g_showTargetNames;
 extern bool g_showAngles;
 extern bool g_newLightDraw;
 extern bool g_lightRadii;
index 29170d9e795bd112c78e4bc6d461191f6f90c8b5..e29aa52498fed934373ebd621e357089862359b9 100644 (file)
@@ -26,6 +26,7 @@
 #include "eclasslib.h"
 #include "generic/callback.h"
 #include "nameable.h"
+#include "entity.h" //g_showTargetNames
 
 #include <set>
 
@@ -62,6 +63,9 @@ const char* name() const {
        }
        return m_name.c_str();
 }
+const char* classname() const {
+       return m_entity.getEntityClass().name();
+}
 void attach( const NameCallback& callback ){
        m_changed.insert( callback );
 }
@@ -92,7 +96,7 @@ RenderableNamedEntity( const NamedEntity& named, const Vector3& position )
 }
 void render( RenderStateFlags state ) const {
        glRasterPos3fv( vector3_to_array( m_position ) );
-       GlobalOpenGL().drawString( m_named.name() );
+       GlobalOpenGL().drawString( g_showTargetNames ? m_named.name() : m_named.classname() );
 }
 };
 
index b93e1e268d54b34c50209a2971720d6090d50210..04e7b000d09313eb5079e59c587ce4e74a90dec7 100644 (file)
@@ -1994,6 +1994,7 @@ 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" );
 
                menu_separator( menu_in_menu );
index f82ab0d2b7ec962c17700889e153d8950b2eceed..ee957abe7a67c2e780821803d246232d1374fcb6 100644 (file)
@@ -2840,6 +2840,18 @@ void ShowNamesToggle(){
        XY_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() );
 }
@@ -2951,6 +2963,7 @@ 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( "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 ) );