X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fundo.cpp;h=fb741abdd9db93059102f34a1ced0a595a78d531;hb=66044ddab695842249eb61a4b395165d2a5d4ec8;hp=9910fb98a1b68ac2bc7495b8af64eb0a492058a8;hpb=e4287c28bb2dafedc81c66e63951d947cfbeb225;p=xonotic%2Fnetradiant.git diff --git a/radiant/undo.cpp b/radiant/undo.cpp index 9910fb98..fb741abd 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -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::Import( levels, value ); undo.setLevels( levels ); } -typedef ReferenceCaller1 UndoLevelsImportStringCaller; -void UndoLevels_exportString( const RadiantUndoSystem& undo, const StringImportCallback& importer ){ - Int_exportString( static_cast( undo.getLevels() ), importer ); +typedef ReferenceCaller UndoLevelsImportStringCaller; +void UndoLevels_exportString( const RadiantUndoSystem& undo, const Callback & importer ){ + PropertyImpl::Export( static_cast( undo.getLevels() ), importer ); } -typedef ConstReferenceCaller1 UndoLevelsExportStringCaller; +typedef ConstReferenceCaller &), UndoLevels_exportString> UndoLevelsExportStringCaller; #include "generic/callback.h" -void UndoLevelsImport( RadiantUndoSystem& self, int value ){ - self.setLevels( value ); -} -typedef ReferenceCaller1 UndoLevelsImportCaller; -void UndoLevelsExport( const RadiantUndoSystem& self, const IntImportCallback& importCallback ){ - importCallback( static_cast( self.getLevels() ) ); -} -typedef ConstReferenceCaller1 UndoLevelsExportCaller; +struct UndoLevels { + static void Export(const RadiantUndoSystem &self, const Callback &returnz) { + returnz(static_cast(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(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( undo ) ); + PreferencesDialog_addSettingsPage( ReferenceCaller( 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(m_undosystem)); Undo_registerPreferencesPage( m_undosystem ); }