#include "mainframe.h"
#include "preferences.h"
-LatchedBool g_useAlternativeTextureProjection( false, "Use alternative texture-projection (\"brush primitives\")" );
+LatchedValue<bool> g_useAlternativeTextureProjection( false, "Use alternative texture-projection (\"brush primitives\")" );
bool g_showAlternativeTextureProjectionOption = false;
bool g_brush_always_caulk;
return g_brush_texturelock_enabled;
}
-void Face_importSnapPlanes( bool value ){
- Face::m_quantise = value ? quantiseInteger : quantiseFloating;
-}
-typedef FreeCaller1<bool, Face_importSnapPlanes> FaceImportSnapPlanesCaller;
+struct Face_SnapPlanes {
+ static void Export(const QuantiseFunc &self, const Callback<void(bool)> &returnz) {
+ returnz(self == quantiseInteger);
+ }
-void Face_exportSnapPlanes( const BoolImportCallback& importer ){
- importer( Face::m_quantise == quantiseInteger );
-}
-typedef FreeCaller1<const BoolImportCallback&, Face_exportSnapPlanes> 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_SnapPlanes>(Face::m_quantise)
);
page.appendEntry(
"Default texture scale",
if ( g_showAlternativeTextureProjectionOption ) {
page.appendCheckBox(
"", "Use alternative texture-projection (\"brush primitives\")",
- LatchedBoolImportCaller( g_useAlternativeTextureProjection ),
- BoolExportCaller( g_useAlternativeTextureProjection.m_latched )
+ make_property(g_useAlternativeTextureProjection)
);
}
// d1223m
Brush_constructPreferences( page );
}
void Brush_registerPreferencesPage(){
- PreferencesDialog_addSettingsPage( FreeCaller1<PreferenceGroup&, Brush_constructPage>() );
+ PreferencesDialog_addSettingsPage( makeCallbackF(Brush_constructPage) );
}
void Brush_unlatchPreferences(){
GlobalPreferenceSystem().registerPreference(
"AlternativeTextureProjection",
- BoolImportStringCaller( g_useAlternativeTextureProjection.m_latched ),
- BoolExportStringCaller( g_useAlternativeTextureProjection.m_latched )
+ make_property_string( g_useAlternativeTextureProjection.m_latched )
);
g_useAlternativeTextureProjection.useLatched();
// d1223m
GlobalPreferenceSystem().registerPreference(
"BrushAlwaysCaulk",
- BoolImportStringCaller( g_brush_always_caulk ),
- BoolExportStringCaller( g_brush_always_caulk ) );
+ make_property_string( g_brush_always_caulk )
+ );
}
Brush_registerCommands();
}
}
- 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_SnapPlanes>(Face::m_quantise));
+ GlobalPreferenceSystem().registerPreference( "TexdefDefaultScale", make_property_string( g_texdef_default_scale ) );
GridStatus_getTextureLockEnabled = getTextureLockEnabled;
- g_texture_lock_status_changed = FreeCaller<GridStatus_onTextureLockEnabledChanged>();
+ g_texture_lock_status_changed = makeCallbackF(GridStatus_onTextureLockEnabledChanged);
}
void Brush_Destroy(){
faceData.value = face.getShader().m_flags.m_value;
callback( faceData );
}
-typedef ConstReferenceCaller1<BrushFaceDataCallback, Face&, BrushFaceData_fromFace> BrushFaceDataFromFaceCaller;
-typedef Callback1<Face&> FaceCallback;
+typedef ConstReferenceCaller<BrushFaceDataCallback, void(Face&), BrushFaceData_fromFace> BrushFaceDataFromFaceCaller;
+typedef Callback<void(Face&)> FaceCallback;
class Quake3BrushCreator : public BrushCreator
{