#endif
}
-class PatchSetFixedSubdivisions
-{
-const PatchFixedSubdivisions& m_subdivisions;
-public:
-PatchSetFixedSubdivisions( const PatchFixedSubdivisions& subdivisions ) : m_subdivisions( subdivisions ){
-}
-void operator()( Patch& patch ) const {
- Patch_setFixedSubdivisions( patch, m_subdivisions );
-}
-};
-
void Scene_PatchSetFixedSubdivisions( const PatchFixedSubdivisions& subdivisions ){
UndoableCommand command( "patchSetFixedSubdivisions" );
- Scene_forEachVisibleSelectedPatch( PatchSetFixedSubdivisions( subdivisions ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ Patch_setFixedSubdivisions(patch, subdivisions);
+ });
}
void cancel(){
update();
}
-typedef MemberCaller<Subdivisions, &Subdivisions::cancel> CancelCaller;
+typedef MemberCaller<Subdivisions, void(), &Subdivisions::cancel> CancelCaller;
void apply(){
Scene_PatchSetFixedSubdivisions(
PatchFixedSubdivisions(
)
);
}
-typedef MemberCaller<Subdivisions, &Subdivisions::apply> ApplyCaller;
-static void applyGtk( GtkToggleButton* toggle, Subdivisions* self ){
+typedef MemberCaller<Subdivisions, void(), &Subdivisions::apply> ApplyCaller;
+static void applyGtk( ui::ToggleButton toggle, Subdivisions* self ){
self->apply();
}
};
PatchInspector() :
m_horizontalSubdivisionsEntry( Subdivisions::ApplyCaller( m_subdivisions ), Subdivisions::CancelCaller( m_subdivisions ) ),
m_verticalSubdivisionsEntry( Subdivisions::ApplyCaller( m_subdivisions ), Subdivisions::CancelCaller( m_subdivisions ) ),
- m_idleDraw( MemberCaller<PatchInspector, &PatchInspector::GetPatchInfo>( *this ) ){
+ m_idleDraw( MemberCaller<PatchInspector, void(), &PatchInspector::GetPatchInfo>( *this ) ){
m_fS = 0.0f;
m_fT = 0.0f;
m_fX = 0.0f;
g_PatchInspector.importData();
}
-class PatchSetTextureRepeat
-{
-float m_s, m_t;
-public:
-PatchSetTextureRepeat( float s, float t ) : m_s( s ), m_t( t ){
-}
-void operator()( Patch& patch ) const {
- patch.SetTextureRepeat( m_s, m_t );
-}
-};
-
void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){
- Scene_forEachVisibleSelectedPatch( PatchSetTextureRepeat( s, t ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.SetTextureRepeat(s, t);
+ });
SceneChangeNotify();
}
Patch_FlipTextureY();
}
-struct PatchRotateTexture
-{
- float m_angle;
-public:
- PatchRotateTexture( float angle ) : m_angle( angle ){
- }
- void operator()( Patch& patch ) const {
- patch.RotateTexture( m_angle );
- }
-};
-
void Scene_PatchRotateTexture_Selected( scene::Graph& graph, float angle ){
- Scene_forEachVisibleSelectedPatch( PatchRotateTexture( angle ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.RotateTexture(angle);
+ });
}
-class PatchScaleTexture
-{
-float m_s, m_t;
-public:
-PatchScaleTexture( float s, float t ) : m_s( s ), m_t( t ){
-}
-void operator()( Patch& patch ) const {
- patch.ScaleTexture( m_s, m_t );
-}
-};
-
float Patch_convertScale( float scale ){
if ( scale > 0 ) {
return scale;
}
void Scene_PatchScaleTexture_Selected( scene::Graph& graph, float s, float t ){
- Scene_forEachVisibleSelectedPatch( PatchScaleTexture( Patch_convertScale( s ), Patch_convertScale( t ) ) );
+ s = Patch_convertScale(s);
+ t = Patch_convertScale(t);
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.ScaleTexture(s, t);
+ });
}
-class PatchTranslateTexture
-{
-float m_s, m_t;
-public:
-PatchTranslateTexture( float s, float t )
- : m_s( s ), m_t( t ){
-}
-void operator()( Patch& patch ) const {
- patch.TranslateTexture( m_s, m_t );
-}
-};
-
void Scene_PatchTranslateTexture_Selected( scene::Graph& graph, float s, float t ){
- Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.TranslateTexture(s, t);
+ });
}
static void OnBtnPatchAutoCap( ui::Widget widget, gpointer data ){
void PatchInspector_Construct(){
- GlobalCommands_insert( "PatchInspector", FreeCaller<PatchInspector_toggleShown>(), Accelerator( 'S', (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "PatchInspector", makeCallbackF(PatchInspector_toggleShown), Accelerator( 'S', (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalPreferenceSystem().registerPreference( "PatchWnd", WindowPositionTrackerImportStringCaller( g_PatchInspector.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_PatchInspector.m_position_tracker ) );
GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Scale1", FloatImportStringCaller( g_pi_globals.scale[0] ), FloatExportStringCaller( g_pi_globals.scale[0] ) );
GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Shift2", FloatImportStringCaller( g_pi_globals.shift[1] ), FloatExportStringCaller( g_pi_globals.shift[1] ) );
GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Rotate", FloatImportStringCaller( g_pi_globals.rotate ), FloatExportStringCaller( g_pi_globals.rotate ) );
- typedef FreeCaller1<const Selectable&, PatchInspector_SelectionChanged> PatchInspectorSelectionChangedCaller;
+ typedef FreeCaller<void(const Selectable&), PatchInspector_SelectionChanged> PatchInspectorSelectionChangedCaller;
GlobalSelectionSystem().addSelectionChangeCallback( PatchInspectorSelectionChangedCaller() );
- typedef FreeCaller<PatchInspector_queueDraw> PatchInspectorQueueDrawCaller;
+ typedef FreeCaller<void(), PatchInspector_queueDraw> PatchInspectorQueueDrawCaller;
Patch_addTextureChangedCallback( PatchInspectorQueueDrawCaller() );
}
void PatchInspector_Destroy(){