]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/undo.cpp
macos: add ssasc to deps, it's required to build the GTK theme
[xonotic/netradiant.git] / radiant / undo.cpp
index 9910fb98a1b68ac2bc7495b8af64eb0a492058a8..fb741abdd9db93059102f34a1ced0a595a78d531 100644 (file)
@@ -57,7 +57,7 @@ DebugScopeTimer( const char* operation )
 
 class RadiantUndoSystem : public UndoSystem
 {
-INTEGER_CONSTANT( MAX_UNDO_LEVELS, 1024 );
+UINT_CONSTANT( MAX_UNDO_LEVELS, 1024 );
 
 class Snapshot
 {
@@ -377,36 +377,36 @@ void trackersRedo() const {
 
 void UndoLevels_importString( RadiantUndoSystem& undo, const char* value ){
        int levels;
-       Int_importString( levels, value );
+       PropertyImpl<int, const char *>::Import( levels, value );
        undo.setLevels( levels );
 }
-typedef ReferenceCaller1<RadiantUndoSystem, const char*, UndoLevels_importString> UndoLevelsImportStringCaller;
-void UndoLevels_exportString( const RadiantUndoSystem& undo, const StringImportCallback& importer ){
-       Int_exportString( static_cast<int>( undo.getLevels() ), importer );
+typedef ReferenceCaller<RadiantUndoSystem, void(const char*), UndoLevels_importString> UndoLevelsImportStringCaller;
+void UndoLevels_exportString( const RadiantUndoSystem& undo, const Callback<void(const char *)> & importer ){
+       PropertyImpl<int, const char *>::Export( static_cast<int>( undo.getLevels() ), importer );
 }
-typedef ConstReferenceCaller1<RadiantUndoSystem, const StringImportCallback&, UndoLevels_exportString> UndoLevelsExportStringCaller;
+typedef ConstReferenceCaller<RadiantUndoSystem, void(const Callback<void(const char *)> &), UndoLevels_exportString> UndoLevelsExportStringCaller;
 
 #include "generic/callback.h"
 
-void UndoLevelsImport( RadiantUndoSystem& self, int value ){
-       self.setLevels( value );
-}
-typedef ReferenceCaller1<RadiantUndoSystem, int, UndoLevelsImport> UndoLevelsImportCaller;
-void UndoLevelsExport( const RadiantUndoSystem& self, const IntImportCallback& importCallback ){
-       importCallback( static_cast<int>( self.getLevels() ) );
-}
-typedef ConstReferenceCaller1<RadiantUndoSystem, const IntImportCallback&, UndoLevelsExport> UndoLevelsExportCaller;
+struct UndoLevels {
+    static void Export(const RadiantUndoSystem &self, const Callback<void(int)> &returnz) {
+        returnz(static_cast<int>(self.getLevels()));
+    }
 
+    static void Import(RadiantUndoSystem &self, int value) {
+        self.setLevels(value);
+    }
+};
 
 void Undo_constructPreferences( RadiantUndoSystem& undo, PreferencesPage& page ){
-       page.appendSpinner( "Undo Queue Size", 64, 0, 1024, IntImportCallback( UndoLevelsImportCaller( undo ) ), IntExportCallback( UndoLevelsExportCaller( undo ) ) );
+    page.appendSpinner("Undo Queue Size", 64, 0, 1024, make_property<UndoLevels>(undo));
 }
 void Undo_constructPage( RadiantUndoSystem& undo, PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Undo", "Undo Queue Settings" ) );
        Undo_constructPreferences( undo, page );
 }
 void Undo_registerPreferencesPage( RadiantUndoSystem& undo ){
-       PreferencesDialog_addSettingsPage( ReferenceCaller1<RadiantUndoSystem, PreferenceGroup&, Undo_constructPage>( undo ) );
+       PreferencesDialog_addSettingsPage( ReferenceCaller<RadiantUndoSystem, void(PreferenceGroup&), Undo_constructPage>( undo ) );
 }
 
 class UndoSystemDependencies : public GlobalPreferenceSystemModuleRef
@@ -421,7 +421,7 @@ typedef UndoSystem Type;
 STRING_CONSTANT( Name, "*" );
 
 UndoSystemAPI(){
-       GlobalPreferenceSystem().registerPreference( "UndoLevels", makeIntStringImportCallback( UndoLevelsImportCaller( m_undosystem ) ), makeIntStringExportCallback( UndoLevelsExportCaller( m_undosystem ) ) );
+    GlobalPreferenceSystem().registerPreference("UndoLevels", make_property_string<UndoLevels>(m_undosystem));
 
        Undo_registerPreferencesPage( m_undosystem );
 }