From: <bor...@us...> - 2020-08-04 17:46:59
|
Revision: 3757 http://sourceforge.net/p/ftm/code/3757 Author: borghesi Date: 2020-08-04 17:46:57 +0000 (Tue, 04 Aug 2020) Log Message: ----------- ftm.editor: added missing methods in fmat_gui_wave Modified Paths: -------------- trunk/ftm/ftmlib/classes/ftmdatagui.c Modified: trunk/ftm/ftmlib/classes/ftmdatagui.c =================================================================== --- trunk/ftm/ftmlib/classes/ftmdatagui.c 2020-07-30 07:53:50 UTC (rev 3756) +++ trunk/ftm/ftmlib/classes/ftmdatagui.c 2020-08-04 17:46:57 UTC (rev 3757) @@ -2315,8 +2315,10 @@ fmat_t *self = (fmat_t *)obj; float *ptr = fmat_lock(self) + onset; int stride = fmat_get_n(self); + int size = self->m; - ptr[index*stride] = value; + if(index < size) + ptr[index*stride] = value; fmat_unlock(self); @@ -2323,6 +2325,23 @@ fts_object_changed((fts_object_t *)obj); } +static float +fmat_gui_wave_get(void *obj, void *context, int onset, int index) +{ + fmat_t *self = (fmat_t *)obj; + float *ptr = fmat_lock(self) + onset; + int stride = fmat_get_n(self); + int size = self->m; + float value = 0.0; + + if(index < size) + value = ptr[index*stride]; + + fmat_unlock(self); + + return value; +} + static void fmat_gui_wave_shift_data(void *obj, void *context, int onset, int index, int shiftSize) { @@ -2361,6 +2380,20 @@ } static void +fmat_gui_wave_append(void *obj, void *context, int onset, int num, double startValue, double endValue) +{ + fmat_t *self = (fmat_t *)obj; + int oldSize = self->m; + + fmat_lock_capacity(self, (self->m + num) * self->n); + fmat_insert_rows_nogrow(self, oldSize, num); + fmat_unlock(self); + fmat_gui_wave_interpolate(obj, context, onset, oldSize, oldSize+num, startValue, endValue); + + fts_object_changed((fts_object_t *)obj); +} + +static void fmat_gui_fvec_install(void) { static imtr_guiInterfaceWave fmat_gui_interface_fvec; @@ -2385,8 +2418,10 @@ fmat_gui_interface_fvec.interpolate = fmat_gui_wave_interpolate; fmat_gui_interface_fvec.increment = fmat_gui_wave_increment; fmat_gui_interface_fvec.set = fmat_gui_wave_set; + fmat_gui_interface_fvec.get = fmat_gui_wave_get; fmat_gui_interface_fvec.shiftData = fmat_gui_wave_shift_data; fmat_gui_interface_fvec.deleteInterval = fmat_gui_wave_delete_interval; + fmat_gui_interface_fvec.append = fmat_gui_wave_append; fts_class_instantiate(fmat_class); fts_class_gui_interface(fmat_class, fts_s_fvec, &fmat_gui_interface_fvec); @@ -2417,8 +2452,10 @@ fmat_gui_interface_wave.interpolate = fmat_gui_wave_interpolate; fmat_gui_interface_wave.increment = fmat_gui_wave_increment; fmat_gui_interface_wave.set = fmat_gui_wave_set; + fmat_gui_interface_wave.get = fmat_gui_wave_get; fmat_gui_interface_wave.shiftData = fmat_gui_wave_shift_data; fmat_gui_interface_wave.deleteInterval = fmat_gui_wave_delete_interval; + fmat_gui_interface_wave.append = fmat_gui_wave_append; fts_class_instantiate(fmat_class); fts_class_gui_interface(fmat_class, fts_s_wave, &fmat_gui_interface_wave); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |