]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/tags.c
Update cfg_kludge_flash for Flash 10
[ion3.git] / ioncore / tags.c
index 383af0c116a0a3a67c2454dd644acfa7757d1b92..aeaadd62981054643fed46d3cdbdee16ccf5029b 100644 (file)
@@ -1,12 +1,9 @@
 /*
  * ion/ioncore/tags.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2007
+ * Copyright (c) Tuomo Valkonen 1999-2009
  *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
  */
 
 #include <libtu/objlist.h>
@@ -46,7 +43,8 @@ bool region_set_tagged(WRegion *reg, int sp)
 
 /*EXTL_DOC
  * Change tagging state of \var{reg} as defined by \var{how}
- * (set/unset/toggle). Resulting state is returned.
+ * (one of \codestr{set}, \codestr{unset}, or \codestr{toggle}).
+ * The resulting state is returned.
  */
 EXTL_EXPORT_AS(WRegion, set_tagged)
 bool region_set_tagged_extl(WRegion *reg, const char *how)
@@ -70,9 +68,9 @@ bool region_is_tagged(WRegion *reg)
  * Untag all regions.
  */
 EXTL_EXPORT
-void ioncore_clear_tags()
+void ioncore_tagged_clear()
 {
-    while(ioncore_tagged_take_first()!=NULL)
+    while(ioncore_tagged_first(TRUE)!=NULL)
         /* nothing */;
 }
 
@@ -84,31 +82,33 @@ void ioncore_clear_tags()
 
 
 /*EXTL_DOC
- * Returns first tagged object.
+ * Returns first tagged object, untagging it as well if \var{untag} is set.
  */
 EXTL_SAFE
 EXTL_EXPORT
-WRegion *ioncore_tagged_first()
+WRegion *ioncore_tagged_first(bool untag)
 {
-    return (WRegion*)OBJLIST_FIRST(WRegion*, taglist);
-}
-
-
-WRegion *ioncore_tagged_take_first()
-{
-    WRegion *reg=(WRegion*)objlist_take_first(&taglist);
+    WRegion *reg;
     
-    if(reg!=NULL){
-        reg->flags&=~REGION_TAGGED;
-        region_notify_change(reg, ioncore_g.notifies.tag);
+    if(!untag){
+        reg=(WRegion*)OBJLIST_FIRST(WRegion*, taglist);
+    }else{
+        reg=(WRegion*)objlist_take_first(&taglist);
+    
+        if(reg!=NULL){
+            reg->flags&=~REGION_TAGGED;
+            region_notify_change(reg, ioncore_g.notifies.tag);
+        }
     }
     
     return reg;
 }
 
+
 /*EXTL_DOC
  * Iterate over tagged regions until \var{iterfn} returns \code{false}.
- * The function itself returns \code{true} if it reaches the end of list
+ * The function is called in protected mode.
+ * This routine returns \code{true} if it reaches the end of list
  * without this happening.
  */
 EXTL_SAFE