[beast: 1/8] BSE: move Track.remove_link() to bseapi.idl



commit b46161e281d5eafb99fc5b70f834982546c31997
Author: Tim Janik <timj gnu org>
Date:   Wed Sep 16 23:49:31 2015 +0200

    BSE: move Track.remove_link() to bseapi.idl

 bse/bseapi.idl    |    2 +-
 bse/bsetrack.cc   |    9 +++++++++
 bse/bsetrack.hh   |    1 +
 bse/bsetrack.proc |   30 ------------------------------
 4 files changed, 11 insertions(+), 31 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 31805a4..5098da4 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -471,10 +471,10 @@ interface Track : ContextMerger {
   SongTiming get_timing  (int32 tick);            ///< Retrieve song timing information at a specific tick.
   int32      insert_part (int32 tick, Part part); ///< Insert Part into Track at @a tick, returns the 
corresponding link id.
   void       remove_tick (int32 tick);            ///< Remove Part at specified @a tick from a track.
+  void       remove_link (int32 id);              ///< Remove a specific part link by ID from a track.
 
   // ItemSeq      list_parts_uniq ();              ///< List all parts contained in a track.
   // TrackPartSeq list_parts ();                   ///< List parts scheduled in a track, sorted by tick.
-  // void  remove_link (int32 id);                 ///< Remove a specific part link by ID from a track.
   Part         get_part (int32 tick);           ///< Get the part starting at a specific tick position.
   int32        get_last_tick ();                ///< Retrieve the last tick for this track.
   ErrorType    ensure_output ();                ///< Ensure the track has an output connection to a bus.
diff --git a/bse/bsetrack.cc b/bse/bsetrack.cc
index cf93a3d..fdbbabd 100644
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@ -1115,6 +1115,15 @@ TrackImpl::remove_tick (int tick)
     }
 }
 
+void
+TrackImpl::remove_link (int link_id)
+{
+  BseTrack *self = as<BseTrack*>();
+  BseTrackEntry *entry = bse_track_find_link (self, link_id);
+  if (entry)
+    remove_tick (entry->tick);
+}
+
 PartIfaceP
 TrackImpl::get_part (int tick)
 {
diff --git a/bse/bsetrack.hh b/bse/bsetrack.hh
index 60fac20..ae8d222 100644
--- a/bse/bsetrack.hh
+++ b/bse/bsetrack.hh
@@ -89,6 +89,7 @@ public:
   virtual SongTiming   get_timing        (int tick) override;
   virtual int          insert_part       (int tick, PartIface &part) override;
   virtual void         remove_tick       (int tick) override;
+  virtual void         remove_link       (int id) override;
   virtual PartIfaceP   get_part          (int tick) override;
   virtual int          get_last_tick     () override;
   virtual ErrorType    ensure_output     () override;
diff --git a/bse/bsetrack.proc b/bse/bsetrack.proc
index 85e15bd..a88c498 100644
--- a/bse/bsetrack.proc
+++ b/bse/bsetrack.proc
@@ -13,36 +13,6 @@ AUTHORS      = "Tim Janik <timj gtk org>";
 LICENSE = "Copyright (C) 2003 Tim Janik";
 
 
-METHOD (BseTrack, remove-link) {
-  HELP  = "Remove a specific part link by ID from a track.";
-  IN    = bse_param_spec_object ("track", "Track", NULL,
-                                BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_int ("id", "Link ID", NULL,
-                        0, 0, SFI_MAXINT, 384, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseTrack *self = (BseTrack*) bse_value_get_object (in_values++);
-  guint     id   = sfi_value_get_int (in_values++);
-  BseTrackEntry *entry;
-
-  /* check parameters */
-  if (!BSE_IS_TRACK (self))
-    return Bse::ERROR_PROC_PARAM_INVAL;
-  entry = bse_track_find_link (self, id);
-  if (!entry)
-    return Bse::ERROR_PROC_PARAM_INVAL;
-
-  /* action */
-  bse_item_push_undo_proc (self, "insert-part", entry->tick, entry->part);
-  bse_track_remove_tick (self, entry->tick);
-
-  return Bse::ERROR_NONE;
-}
-
 METHOD (BseTrack, list-parts) {
   HELP  = "List parts scheduled in a track, sorted by tick.";
   IN    = bse_param_spec_object ("track", "Track", NULL,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]