@@ -293,6 +293,8 @@ namespace lsp
293293
294294 // Add slots
295295 handler_id_t id = sSlots .add (SLOT_CHANGE, slot_on_change, self ());
296+ if (id >= 0 ) id = sSlots .add (SLOT_BEGIN_EDIT, slot_begin_edit, self ());
297+ if (id >= 0 ) id = sSlots .add (SLOT_END_EDIT, slot_end_edit, self ());
296298
297299 return (id >= 0 ) ? STATUS_OK : -id;
298300 }
@@ -681,6 +683,16 @@ namespace lsp
681683 return STATUS_OK;
682684 }
683685
686+ status_t AudioEnvelope::on_begin_edit ()
687+ {
688+ return STATUS_OK;
689+ }
690+
691+ status_t AudioEnvelope::on_end_edit ()
692+ {
693+ return STATUS_OK;
694+ }
695+
684696 void AudioEnvelope::sync_handler (const ws::event_t *e)
685697 {
686698 point_t *point = find_point (e->nLeft , e->nTop );
@@ -717,6 +729,9 @@ namespace lsp
717729
718730 nLastX = e->nLeft ;
719731 nLastY = e->nTop ;
732+
733+ if (pHandler != NULL )
734+ sSlots .execute (SLOT_BEGIN_EDIT, this );
720735 }
721736
722737 nBMask |= size_t (1 ) << e->nCode ;
@@ -727,6 +742,11 @@ namespace lsp
727742 status_t AudioEnvelope::on_mouse_up (const ws::event_t *e)
728743 {
729744 nBMask &= ~(size_t (1 ) << e->nCode );
745+ if (nBMask == 0 )
746+ {
747+ if (pHandler != NULL )
748+ sSlots .execute (SLOT_END_EDIT, this );
749+ }
730750
731751 return STATUS_OK;
732752 }
@@ -816,7 +836,11 @@ namespace lsp
816836 const float old = pHandler->pZ ->get ();
817837 pHandler->pZ ->add (delta);
818838 if (old != pHandler->pZ ->get ())
839+ {
840+ sSlots .execute (SLOT_BEGIN_EDIT, this );
819841 sSlots .execute (SLOT_CHANGE, this );
842+ sSlots .execute (SLOT_END_EDIT, this );
843+ }
820844
821845 return STATUS_OK;
822846 }
@@ -827,6 +851,18 @@ namespace lsp
827851 return (self != NULL ) ? self->on_change () : STATUS_BAD_ARGUMENTS;
828852 }
829853
854+ status_t AudioEnvelope::slot_begin_edit (Widget *sender, void *ptr, void *data)
855+ {
856+ AudioEnvelope *self = widget_ptrcast<AudioEnvelope>(ptr);
857+ return (self != NULL ) ? self->on_begin_edit () : STATUS_BAD_ARGUMENTS;
858+ }
859+
860+ status_t AudioEnvelope::slot_end_edit (Widget *sender, void *ptr, void *data)
861+ {
862+ AudioEnvelope *self = widget_ptrcast<AudioEnvelope>(ptr);
863+ return (self != NULL ) ? self->on_end_edit () : STATUS_BAD_ARGUMENTS;
864+ }
865+
830866 void AudioEnvelope::set_curve_function (curve_function_t function, void *data)
831867 {
832868 pFunction = function;
0 commit comments