X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fbrushmodule.cpp;h=2ab573e514601c7d8b451eca7a8caa448b1e1ae3;hb=ae556acad3c7afe9fe35ba94deb6e1d88c146ad4;hp=bc9c18ef67671262fa6cf553bd90cec4b1e54c9b;hpb=7fc621fc78d0e040dc2c12f38dc53dd9048215dc;p=xonotic%2Fnetradiant.git diff --git a/radiant/brushmodule.cpp b/radiant/brushmodule.cpp index bc9c18ef..2ab573e5 100644 --- a/radiant/brushmodule.cpp +++ b/radiant/brushmodule.cpp @@ -34,7 +34,7 @@ #include "mainframe.h" #include "preferences.h" -LatchedBool g_useAlternativeTextureProjection( false, "Use alternative texture-projection (\"brush primitives\")" ); +LatchedValue g_useAlternativeTextureProjection( false, "Use alternative texture-projection (\"brush primitives\")" ); bool g_showAlternativeTextureProjectionOption = false; bool g_brush_always_caulk; @@ -42,21 +42,20 @@ bool getTextureLockEnabled(){ return g_brush_texturelock_enabled; } -void Face_importSnapPlanes( bool value ){ - Face::m_quantise = value ? quantiseInteger : quantiseFloating; -} -typedef FreeCaller1 FaceImportSnapPlanesCaller; +struct Face_SnapPlanes { + static void Export(const QuantiseFunc &self, const Callback &returnz) { + returnz(self == quantiseInteger); + } -void Face_exportSnapPlanes( const BoolImportCallback& importer ){ - importer( Face::m_quantise == quantiseInteger ); -} -typedef FreeCaller1 FaceExportSnapPlanesCaller; + static void Import(QuantiseFunc &self, bool value) { + self = value ? quantiseInteger : quantiseFloating; + } +}; void Brush_constructPreferences( PreferencesPage& page ){ page.appendCheckBox( "", "Snap planes to integer grid", - FaceImportSnapPlanesCaller(), - FaceExportSnapPlanesCaller() + make_property(Face::m_quantise) ); page.appendEntry( "Default texture scale", @@ -65,8 +64,7 @@ void Brush_constructPreferences( PreferencesPage& page ){ if ( g_showAlternativeTextureProjectionOption ) { page.appendCheckBox( "", "Use alternative texture-projection (\"brush primitives\")", - LatchedBoolImportCaller( g_useAlternativeTextureProjection ), - BoolExportCaller( g_useAlternativeTextureProjection.m_latched ) + make_property(g_useAlternativeTextureProjection) ); } // d1223m @@ -80,7 +78,7 @@ void Brush_constructPage( PreferenceGroup& group ){ Brush_constructPreferences( page ); } void Brush_registerPreferencesPage(){ - PreferencesDialog_addSettingsPage( FreeCaller1() ); + PreferencesDialog_addSettingsPage( makeCallbackF(Brush_constructPage) ); } void Brush_unlatchPreferences(){ @@ -113,8 +111,7 @@ void Brush_Construct( EBrushType type ){ GlobalPreferenceSystem().registerPreference( "AlternativeTextureProjection", - BoolImportStringCaller( g_useAlternativeTextureProjection.m_latched ), - BoolExportStringCaller( g_useAlternativeTextureProjection.m_latched ) + make_property_string( g_useAlternativeTextureProjection.m_latched ) ); g_useAlternativeTextureProjection.useLatched(); @@ -125,8 +122,8 @@ void Brush_Construct( EBrushType type ){ // d1223m GlobalPreferenceSystem().registerPreference( "BrushAlwaysCaulk", - BoolImportStringCaller( g_brush_always_caulk ), - BoolExportStringCaller( g_brush_always_caulk ) ); + make_property_string( g_brush_always_caulk ) + ); } Brush_registerCommands(); @@ -154,12 +151,12 @@ void Brush_Construct( EBrushType type ){ } } - GlobalPreferenceSystem().registerPreference( "TextureLock", BoolImportStringCaller( g_brush_texturelock_enabled ), BoolExportStringCaller( g_brush_texturelock_enabled ) ); - GlobalPreferenceSystem().registerPreference( "BrushSnapPlanes", makeBoolStringImportCallback( FaceImportSnapPlanesCaller() ), makeBoolStringExportCallback( FaceExportSnapPlanesCaller() ) ); - GlobalPreferenceSystem().registerPreference( "TexdefDefaultScale", FloatImportStringCaller( g_texdef_default_scale ), FloatExportStringCaller( g_texdef_default_scale ) ); + GlobalPreferenceSystem().registerPreference( "TextureLock", make_property_string( g_brush_texturelock_enabled ) ); + GlobalPreferenceSystem().registerPreference("BrushSnapPlanes", make_property_string(Face::m_quantise)); + GlobalPreferenceSystem().registerPreference( "TexdefDefaultScale", make_property_string( g_texdef_default_scale ) ); GridStatus_getTextureLockEnabled = getTextureLockEnabled; - g_texture_lock_status_changed = FreeCaller(); + g_texture_lock_status_changed = makeCallbackF(GridStatus_onTextureLockEnabledChanged); } void Brush_Destroy(){ @@ -188,8 +185,8 @@ void BrushFaceData_fromFace( const BrushFaceDataCallback& callback, Face& face ) faceData.value = face.getShader().m_flags.m_value; callback( faceData ); } -typedef ConstReferenceCaller1 BrushFaceDataFromFaceCaller; -typedef Callback1 FaceCallback; +typedef ConstReferenceCaller BrushFaceDataFromFaceCaller; +typedef Callback FaceCallback; class Quake3BrushCreator : public BrushCreator {