]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/entity.cpp
Group import/export callbacks
[xonotic/netradiant.git] / radiant / entity.cpp
index cf726aca2243293b42d489e9c261b0e5ef92eca6..1c02828e728aef0fda60f8fffa5f6e6f0ade3126 100644 (file)
@@ -289,7 +289,7 @@ int g_iLastLightIntensity;
 void Entity_createFromSelection( const char* name, const Vector3& origin ){
 #if 0
        if ( string_equal_nocase( name, "worldspawn" ) ) {
-               ui::alert( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
+               ui::alert( MainFrame_getWindow( ), "Can't create an entity with worldspawn.", "info" );
                return;
        }
 #endif
@@ -392,7 +392,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
 
 #if 0
 bool DoNormalisedColor( Vector3& color ){
-       if ( !color_dialog( GTK_WIDGET( MainFrame_getWindow() ), color ) ) {
+       if ( !color_dialog( MainFrame_getWindow( ), color ) ) {
                return false;
        }
        /*
@@ -545,18 +545,18 @@ const char* misc_model_dialog( ui::Widget parent ){
 void LightRadiiImport( EntityCreator& self, bool value ){
        self.setLightRadii( value );
 }
-typedef ReferenceCaller1<EntityCreator, bool, LightRadiiImport> LightRadiiImportCaller;
+typedef ReferenceCaller<EntityCreator, void(bool), LightRadiiImport> LightRadiiImportCaller;
 
-void LightRadiiExport( EntityCreator& self, const BoolImportCallback& importer ){
+void LightRadiiExport( EntityCreator& self, const ImportExportCallback<bool>::Import_t& importer ){
        importer( self.getLightRadii() );
 }
-typedef ReferenceCaller1<EntityCreator, const BoolImportCallback&, LightRadiiExport> LightRadiiExportCaller;
+typedef ReferenceCaller<EntityCreator, void(const ImportExportCallback<bool>::Import_t&), LightRadiiExport> LightRadiiExportCaller;
 
 void Entity_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox(
                "Show", "Light Radii",
-               LightRadiiImportCaller( GlobalEntityCreator() ),
-               LightRadiiExportCaller( GlobalEntityCreator() )
+               {LightRadiiImportCaller( GlobalEntityCreator() ),
+               LightRadiiExportCaller( GlobalEntityCreator() )}
                );
 }
 void Entity_constructPage( PreferenceGroup& group ){
@@ -564,7 +564,7 @@ void Entity_constructPage( PreferenceGroup& group ){
        Entity_constructPreferences( page );
 }
 void Entity_registerPreferencesPage(){
-       PreferencesDialog_addDisplayPage( FreeCaller1<PreferenceGroup&, Entity_constructPage>() );
+       PreferencesDialog_addDisplayPage( makeCallbackF(Entity_constructPage) );
 }
 
 
@@ -584,12 +584,12 @@ void Entity_constructMenu( ui::Menu menu ){
 #include "stringio.h"
 
 void Entity_Construct(){
-       GlobalCommands_insert( "EntityColor", FreeCaller<Entity_setColour>(), Accelerator( 'K' ) );
-       GlobalCommands_insert( "NormalizeColor", FreeCaller<Entity_normalizeColor>() );
-       GlobalCommands_insert( "ConnectSelection", FreeCaller<Entity_connectSelected>(), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "KillConnectSelection", FreeCaller<Entity_killconnectSelected>(), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
-       GlobalCommands_insert( "GroupSelection", FreeCaller<Entity_groupSelected>() );
-       GlobalCommands_insert( "UngroupSelection", FreeCaller<Entity_ungroupSelected>() );
+       GlobalCommands_insert( "EntityColor", makeCallbackF(Entity_setColour), Accelerator( 'K' ) );
+       GlobalCommands_insert( "NormalizeColor", makeCallbackF(Entity_normalizeColor) );
+       GlobalCommands_insert( "ConnectSelection", makeCallbackF(Entity_connectSelected), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "KillConnectSelection", makeCallbackF(Entity_killconnectSelected), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
+       GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) );
+       GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) );
 
        GlobalPreferenceSystem().registerPreference( "SI_Colors5", Vector3ImportStringCaller( g_entity_globals.color_entity ), Vector3ExportStringCaller( g_entity_globals.color_entity ) );
        GlobalPreferenceSystem().registerPreference( "LastLightIntensity", IntImportStringCaller( g_iLastLightIntensity ), IntExportStringCaller( g_iLastLightIntensity ) );