public:
ui::SpinButton m_spin;
ui::Entry m_entry;
-Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( ui::null ){
+Increment( float& f ) : m_f( f ), m_spin( ui::null ), m_entry( ui::null ){
}
void cancel(){
entry_set_float( m_entry, m_f );
}
-typedef MemberCaller<Increment, &Increment::cancel> CancelCaller;
+typedef MemberCaller<Increment, void(), &Increment::cancel> CancelCaller;
void apply(){
m_f = static_cast<float>( entry_get_float( m_entry ) );
spin_button_set_step( m_spin, m_f );
}
-typedef MemberCaller<Increment, &Increment::apply> ApplyCaller;
+typedef MemberCaller<Increment, void(), &Increment::apply> ApplyCaller;
};
void SurfaceInspector_GridChange();
ui::Entry m_valueEntryWidget{ui::null};
public:
WindowPositionTracker m_positionTracker;
-WindowPositionTrackerImportStringCaller m_importPosition;
-WindowPositionTrackerExportStringCaller m_exportPosition;
// Dialog Data
float m_fitHorizontal;
m_rotateEntry( Increment::ApplyCaller( m_rotateIncrement ), Increment::CancelCaller( m_rotateIncrement ) ),
m_idleDraw( UpdateCaller( *this ) ),
m_valueEntry( ApplyFlagsCaller( *this ), UpdateCaller( *this ) ),
- m_importPosition( m_positionTracker ),
- m_exportPosition( m_positionTracker ),
m_hshiftIncrement( g_si_globals.shift[0] ),
m_vshiftIncrement( g_si_globals.shift[1] ),
m_hscaleIncrement( g_si_globals.scale[0] ),
void constructWindow( ui::Window main_window ){
m_parent = main_window;
Create();
- AddGridChangeCallback( FreeCaller<SurfaceInspector_GridChange>() );
+ AddGridChangeCallback( FreeCaller<void(), SurfaceInspector_GridChange>() );
}
void destroyWindow(){
Destroy();
}
void Update();
-typedef MemberCaller<SurfaceInspector, &SurfaceInspector::Update> UpdateCaller;
+typedef MemberCaller<SurfaceInspector, void(), &SurfaceInspector::Update> UpdateCaller;
void ApplyShader();
-typedef MemberCaller<SurfaceInspector, &SurfaceInspector::ApplyShader> ApplyShaderCaller;
+typedef MemberCaller<SurfaceInspector, void(), &SurfaceInspector::ApplyShader> ApplyShaderCaller;
void ApplyTexdef();
-typedef MemberCaller<SurfaceInspector, &SurfaceInspector::ApplyTexdef> ApplyTexdefCaller;
+typedef MemberCaller<SurfaceInspector, void(), &SurfaceInspector::ApplyTexdef> ApplyTexdefCaller;
void ApplyFlags();
-typedef MemberCaller<SurfaceInspector, &SurfaceInspector::ApplyFlags> ApplyFlagsCaller;
+typedef MemberCaller<SurfaceInspector, void(), &SurfaceInspector::ApplyFlags> ApplyFlagsCaller;
};
namespace
// =============================================================================
// SurfaceInspector class
-guint togglebutton_connect_toggled( ui::ToggleButton button, const Callback& callback ){
+guint togglebutton_connect_toggled( ui::ToggleButton button, const Callback<void()>& callback ){
return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
}
spin.show();
table.attach(spin, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
spin.dimensions(60, -1);
- AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
+ AddDialogData( spin, m_fitHorizontal );
}
{
auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
spin.show();
table.attach(spin, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
spin.dimensions(60, -1);
- AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitVertical );
+ AddDialogData( spin, m_fitVertical );
}
}
}
}
// not allowed to modify detail flag using Surface Inspector
- gtk_widget_set_sensitive( ui::CheckButton(m_contentFlags[BRUSH_DETAIL_FLAG]), FALSE );
+ gtk_widget_set_sensitive( ui::CheckButton::from(m_contentFlags[BRUSH_DETAIL_FLAG]), FALSE );
}
}
}
for ( GtkCheckButton** p = m_surfaceFlags; p != m_surfaceFlags + 32; ++p )
{
- toggle_button_set_active_no_signal( ui::CheckButton( *p ), flags.m_surfaceFlags & ( 1 << ( p - m_surfaceFlags ) ) );
+ toggle_button_set_active_no_signal( ui::CheckButton::from( *p ), flags.m_surfaceFlags & ( 1 << ( p - m_surfaceFlags ) ) );
}
for ( GtkCheckButton** p = m_contentFlags; p != m_contentFlags + 32; ++p )
{
- toggle_button_set_active_no_signal( ui::CheckButton( *p ), flags.m_contentFlags & ( 1 << ( p - m_contentFlags ) ) );
+ toggle_button_set_active_no_signal( ui::CheckButton::from( *p ), flags.m_contentFlags & ( 1 << ( p - m_contentFlags ) ) );
}
}
}
face.GetTexdef( projection );
flags = face.getShader().m_flags;
}
-typedef Function4<Face&, CopiedString&, TextureProjection&, ContentsFlagsValue&, void, Face_getTexture> FaceGetTexture;
+typedef Function<void(Face&, CopiedString&, TextureProjection&, ContentsFlagsValue&), Face_getTexture> FaceGetTexture;
void Face_setTexture( Face& face, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){
face.SetShader( shader );
face.SetTexdef( projection );
face.SetFlags( flags );
}
-typedef Function4<Face&, const char*, const TextureProjection&, const ContentsFlagsValue&, void, Face_setTexture> FaceSetTexture;
+typedef Function<void(Face&, const char*, const TextureProjection&, const ContentsFlagsValue&), Face_setTexture> FaceSetTexture;
void Patch_getTexture( Patch& patch, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
projection = TextureProjection( texdef_t(), brushprimit_texdef_t(), Vector3( 0, 0, 0 ), Vector3( 0, 0, 0 ) );
flags = ContentsFlagsValue( 0, 0, 0, false );
}
-typedef Function4<Patch&, CopiedString&, TextureProjection&, ContentsFlagsValue&, void, Patch_getTexture> PatchGetTexture;
+typedef Function<void(Patch&, CopiedString&, TextureProjection&, ContentsFlagsValue&), Patch_getTexture> PatchGetTexture;
void Patch_setTexture( Patch& patch, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){
patch.SetShader( shader );
}
-typedef Function4<Patch&, const char*, const TextureProjection&, const ContentsFlagsValue&, void, Patch_setTexture> PatchSetTexture;
+typedef Function<void(Patch&, const char*, const TextureProjection&, const ContentsFlagsValue&), Patch_setTexture> PatchSetTexture;
-typedef Callback3<CopiedString&, TextureProjection&, ContentsFlagsValue&> GetTextureCallback;
-typedef Callback3<const char*, const TextureProjection&, const ContentsFlagsValue&> SetTextureCallback;
+typedef Callback<void(CopiedString&, TextureProjection&, ContentsFlagsValue&)> GetTextureCallback;
+typedef Callback<void(const char*, const TextureProjection&, const ContentsFlagsValue&)> SetTextureCallback;
struct Texturable
{
if ( intersection.valid()
&& SelectionIntersection_closer( intersection, bestIntersection ) ) {
bestIntersection = intersection;
- texturable.setTexture = makeCallback3( FaceSetTexture(), face );
- texturable.getTexture = makeCallback3( FaceGetTexture(), face );
+ texturable.setTexture = makeCallback( FaceSetTexture(), face );
+ texturable.getTexture = makeCallback( FaceGetTexture(), face );
}
}
if ( occluded ) {
Patch* patch = Node_getPatch( path.top() );
if ( patch != 0 ) {
- m_texturable.setTexture = makeCallback3( PatchSetTexture(), *patch );
- m_texturable.getTexture = makeCallback3( PatchGetTexture(), *patch );
+ m_texturable.setTexture = makeCallback( PatchSetTexture(), *patch );
+ m_texturable.getTexture = makeCallback( PatchGetTexture(), *patch );
}
else
{
SurfaceInspector_constructPreferences( page );
}
void SurfaceInspector_registerPreferencesPage(){
- PreferencesDialog_addSettingsPage( FreeCaller1<PreferenceGroup&, SurfaceInspector_constructPage>() );
+ PreferencesDialog_addSettingsPage( makeCallbackF(SurfaceInspector_constructPage) );
}
void SurfaceInspector_registerCommands(){
- GlobalCommands_insert( "FitTexture", FreeCaller<SurfaceInspector_FitTexture>(), Accelerator( 'B', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "SurfaceInspector", FreeCaller<SurfaceInspector_toggleShown>(), Accelerator( 'S' ) );
+ GlobalCommands_insert( "FitTexture", makeCallbackF(SurfaceInspector_FitTexture), Accelerator( 'B', (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "SurfaceInspector", makeCallbackF(SurfaceInspector_toggleShown), Accelerator( 'S' ) );
- GlobalCommands_insert( "FaceCopyTexture", FreeCaller<SelectedFaces_copyTexture>() );
- GlobalCommands_insert( "FacePasteTexture", FreeCaller<SelectedFaces_pasteTexture>() );
+ GlobalCommands_insert( "FaceCopyTexture", makeCallbackF(SelectedFaces_copyTexture) );
+ GlobalCommands_insert( "FacePasteTexture", makeCallbackF(SelectedFaces_pasteTexture) );
}
FaceTextureClipboard_setDefault();
- GlobalPreferenceSystem().registerPreference( "SurfaceWnd", getSurfaceInspector().m_importPosition, getSurfaceInspector().m_exportPosition );
- GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Scale1", FloatImportStringCaller( g_si_globals.scale[0] ), FloatExportStringCaller( g_si_globals.scale[0] ) );
- GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Scale2", FloatImportStringCaller( g_si_globals.scale[1] ), FloatExportStringCaller( g_si_globals.scale[1] ) );
- GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Shift1", FloatImportStringCaller( g_si_globals.shift[0] ), FloatExportStringCaller( g_si_globals.shift[0] ) );
- GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Shift2", FloatImportStringCaller( g_si_globals.shift[1] ), FloatExportStringCaller( g_si_globals.shift[1] ) );
- GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Rotate", FloatImportStringCaller( g_si_globals.rotate ), FloatExportStringCaller( g_si_globals.rotate ) );
- GlobalPreferenceSystem().registerPreference( "SnapTToGrid", BoolImportStringCaller( g_si_globals.m_bSnapTToGrid ), BoolExportStringCaller( g_si_globals.m_bSnapTToGrid ) );
+ GlobalPreferenceSystem().registerPreference( "SurfaceWnd", make_property<WindowPositionTracker_String>( getSurfaceInspector().m_positionTracker) );
+ GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Scale1", make_property_string( g_si_globals.scale[0] ) );
+ GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Scale2", make_property_string( g_si_globals.scale[1] ) );
+ GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Shift1", make_property_string( g_si_globals.shift[0] ) );
+ GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Shift2", make_property_string( g_si_globals.shift[1] ) );
+ GlobalPreferenceSystem().registerPreference( "SI_SurfaceTexdef_Rotate", make_property_string( g_si_globals.rotate ) );
+ GlobalPreferenceSystem().registerPreference( "SnapTToGrid", make_property_string( g_si_globals.m_bSnapTToGrid ) );
- typedef FreeCaller1<const Selectable&, SurfaceInspector_SelectionChanged> SurfaceInspectorSelectionChangedCaller;
+ typedef FreeCaller<void(const Selectable&), SurfaceInspector_SelectionChanged> SurfaceInspectorSelectionChangedCaller;
GlobalSelectionSystem().addSelectionChangeCallback( SurfaceInspectorSelectionChangedCaller() );
- typedef FreeCaller<SurfaceInspector_updateSelection> SurfaceInspectorUpdateSelectionCaller;
+ typedef FreeCaller<void(), SurfaceInspector_updateSelection> SurfaceInspectorUpdateSelectionCaller;
Brush_addTextureChangedCallback( SurfaceInspectorUpdateSelectionCaller() );
Patch_addTextureChangedCallback( SurfaceInspectorUpdateSelectionCaller() );