Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacroOld.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacroOld.groovy	(revision 3433)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacroOld.groovy	(revision 3434)
@@ -1,384 +0,0 @@
-package org.txm.macro.transcription
-
-import java.nio.charset.Charset
-
-import java.time.LocalTime
-import java.time.format.DateTimeFormatter
-import org.txm.utils.*
-import org.txm.utils.logger.*
-
-@Field @Option(name="metadataFile", usage="Tableau des metadonnées de sections", widget="FileOpen", required=true, def="")
-		File metadataFile;
-
-@Field @Option(name="trsDirectory", usage="Dossier qui contient les fichiers TRS", widget="Folder", required=true, def="")
-		File trsDirectory;
-
-@Field @Option(name="joinTRSColumn", usage="Colonne de jointure de transcription", widget="String", required=true, def="Lien notice principale")
-		def joinTRSColumn
-
-@Field @Option(name="startTimeColumn", usage="Colonne de timing de début de section", widget="String", required=true, def="antract_debut")
-		def startTimeColumn = "antract_debut"
-
-@Field @Option(name="endTimeColumn", usage="Colonne de timing de fin de section", widget="String", required=true, def="antract_fin")
-		def endTimeColumn = "antract_fin"
-
-@Field @Option(name="typeColumns", usage="Colonnes des métadonnées de type de section", widget="String", required=true, def="Titre propre")
-		def typeColumns
-
-@Field @Option(name="topicColumns", usage="Colonnes des métadonnées de topic de section", widget="String", required=true, def="Date de diffusion")
-		def topicColumns
-
-@Field @Option(name="metadataColumns", usage="Colonnes de metadonnées de section", widget="String", required=true, def="Titre propre;Date de diffusion;Identifiant de la notice;Notes du titre;Type de date;Durée;Genre;Langue VO / VE;Nature de production;Producteurs (Aff.);Thématique;Nom fichier segmenté (info);antract_video;antract_debut;antract_fin;antract_duree;antract_tc_type;antract_tc_date;Résumé;Séquences;Descripteurs (Aff. Lig.);Générique (Aff. Lig.)")
-		def metadataColumns
-
-@Field @Option(name="metadataColumnsGroups", usage="Colonnes des gruopes de metadonnées de section", widget="String", required=true, def="metadata;metadata;metadata;metadata;metadata;metadata;metadata;metadata;metadata;metadata;metadata;secondary;secondary;secondary;secondary;secondary;secondary;secondary;text;text;text;text")
-		def metadataColumnsGroups
-
-@Field @Option(name="fixSectionsLimits", usage="Correction des limites de sections du tableau de metadonnees", widget="Boolean", required=true, def="true")
-		def fixSectionsLimits
-
-@Field @Option(name="sectionsMergeActivationThreashold", usage="marge d'erreur de corrections des limites de sections", widget="Float", required=true, def="1.0")
-		def sectionsMergeActivationThreashold
-
-@Field @Option(name="fixTurnsLimits", usage="Correction des limites de sections du tableau de metadonnees", widget="Boolean", required=true, def="true")
-		def fixTurnsLimits
-
-@Field @Option(name="turnsCutActivationThreashold", usage="marge d'erreur de corrections des limites de tours", widget="Float", required=true, def="0.1")
-		def turnsCutActivationThreashold
-
-@Field @Option(name="debug", usage="show debug messages", widget="String", required=true, def="false")
-		def debug
-
-if (!ParametersDialog.open(this)) return;
-
-typeColumns = typeColumns.split(";")
-topicColumns = topicColumns.split(";")
-metadataColumns = metadataColumns.split(";")
-metadataColumnsGroups = metadataColumnsGroups.split(";")
-
-if (metadataColumns.size() != metadataColumnsGroups.size()) {
-	println "ERROR in metadata declarations&groups:"
-	println "COLUMNS: "+metadataColumns
-	println "GROUPS : "+metadataColumnsGroups
-	return
-}
-
-if (!trsDirectory.exists()) {
-	println "$trsDirectory not found"
-	return
-}
-
-println "Loading data from $metadataFile..."
-TableReader reader = new TableReader(metadataFile)//, "\t".charAt(0), Charset.forName("UTF-8")
-reader.readHeaders()
-def header = reader.getHeaders()
-if (!header.contains(joinTRSColumn)) {
-	println "No TRS ID $joinTRSColumn column found"
-	return
-}
-if (!header.contains(startTimeColumn)) {
-	println "No start time $startTimeColumn column found"
-	return
-}
-if (!header.contains(endTimeColumn)) {
-	println "No end time $endTimeColumn column found"
-	return
-}
-for (def col : metadataColumns) {
-	if (!header.contains(endTimeColumn)) {
-		println "No $col column found"
-		return
-	}
-}
-for (def col : typeColumns) {
-	if (!header.contains(endTimeColumn)) {
-		println "No type $col column found"
-		return
-	}
-}
-for (def col : topicColumns) {
-	if (!header.contains(endTimeColumn)) {
-		println "No topic $col column found"
-		return
-	}
-}
-
-File outputDirectory = new File(trsDirectory, "out")
-println "Writing result to $outputDirectory..."
-
-dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_TIME
-def strTotime(def str) {
-	if (str.lastIndexOf(":") == -1) {
-		return null
-	}
-	
-	bonusFrame = Integer.parseInt(str.substring(str.lastIndexOf(":")+1))
-	//if (str.contains("135475")) println "ERROR $str in $infos -> $bonusFrame"
-	if (bonusFrame > 25) {
-		bonusFrame=0;
-	}
-	totalFrame = str.substring(0, str.lastIndexOf(":"))
-	
-	LocalTime time1 = LocalTime.parse(totalFrame, dateTimeFormatter)
-	totalFrame = (time1.getHour()*60*60) + (time1.getMinute()*60) + time1.getSecond()
-	
-	def ret = totalFrame + (bonusFrame/25)
-	return ret
-}
-
-try {
-	def sectionGroupsToInsert = [:]
-	println "Reading data..."
-	while (reader.readRecord()) { // loading & sorting sections
-		String id = reader.get(joinTRSColumn).trim()
-		if (id.endsWith(".mp4")) id = id.substring(0, id.length()-4)
-		if (id.length() == 0) continue;
-		
-		if (!sectionGroupsToInsert.containsKey(id)) {
-			sectionGroupsToInsert[id] = []
-		}
-		def section = sectionGroupsToInsert[id]
-		
-		if (reader.get(startTimeColumn) != null && reader.get(startTimeColumn).length() > 0) { // ignore non timed sections
-			
-			def m = [:]
-			
-			for (def todo : ["topic":topicColumns, "type":typeColumns]) {
-				def data = []
-				for (def col : todo.value) {
-					if (reader.get(col).trim().length() > 0) {
-						data << reader.get(col).trim().replace("\n", "")
-					}
-				}
-				m[todo.key] = data.join("\t")
-			}
-			def metadataList = []
-			def metadataGroupList = []
-			for (int i = 0 ;  i < metadataColumns.size() ; i++) {
-				def col = metadataColumns[i]
-				String c = AsciiUtils.buildAttributeId(col)
-				m[c] = reader.get(col)
-				metadataList << c
-				metadataGroupList << metadataColumnsGroups[i]
-			}
-			m["metadata"] = metadataList.join("|")
-			m["metadata_groups"] = metadataGroupList.join("|")
-			
-			m["startTime"] = strTotime(reader.get(startTimeColumn))
-			m["endTime"] = strTotime(reader.get(endTimeColumn))
-			m["synchronized"] = "true"
-			
-			section << [m["startTime"], m["endTime"], m]
-		}
-	}
-	
-	println "Inserting sections... "+sectionGroupsToInsert.size()
-	
-	ConsoleProgressBar cpb = new ConsoleProgressBar(sectionGroupsToInsert.keySet().size())
-	for (String id : sectionGroupsToInsert.keySet()) {
-		
-		File trsFile = new File(trsDirectory, id+".trs")
-		if (!trsFile.exists()) {
-			cpb.tick()
-			continue
-		}
-		
-		if (debug) println "== $id =="
-		else cpb.tick()
-		
-		//println "Processing $id..."
-		def sections = sectionGroupsToInsert[id]
-		sections = sections.sort() { a, b -> a[0] <=> b[0] ?: a[1] <=> -b[1] } // negative second test for sections inclusion
-		
-		if (fixSectionsLimits) {
-			if (debug) println "Fixing sections of $id"
-			for (int iSection = 1 ; iSection < sections.size() ; iSection++) {
-				//println sections[iSection]
-				if (Math.abs(sections[iSection][0] - sections[iSection - 1][1]) < sectionsMergeActivationThreashold) {
-					if (debug) println "s=$iSection start <- end : "+sections[iSection][0]+ " <- "+sections[iSection - 1][1]
-					sections[iSection][0] = sections[iSection - 1][1] // fix the start time with the previous section end time
-				}
-			}
-		}
-		
-		// Open input file
-		def slurper = new groovy.util.XmlParser(false, true, true);
-		slurper.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false) // allow DTD declaration
-		slurper.setProperty("http://javax.xml.XMLConstants/property/accessExternalDTD", "all"); // allow to read DTD from local file
-		def trs = slurper.parse(trsFile.toURI().toString())
-		def trsEpisodes = trs.Episode // 1
-		if (trsEpisodes.size() > 1) {
-			println "Error: multiple Episode node in $trsFile"
-			continue
-		}
-		def trsEpisode = trsEpisodes[0]
-		def trsSections =  trs.Episode.Section // 1
-		if (trsSections.size() > 1) {
-			println "Error: multiple Section node in $trsFile"
-			continue
-		}
-		def trsSection = trsSections[0]
-		
-		def turns = trsSection.Turn
-		def newSections = []
-		def iSection = 0;
-		def currentSection = null
-		def currentNode = null
-		
-		for (int iTurn = 0 ; iTurn < turns.size() ; iTurn++) {
-			
-			def turn = turns[iTurn]
-			def start = Float.parseFloat(turn.@startTime)
-			def end = Float.parseFloat(turn.@endTime)
-			//println "Turn: $iTurn ($start, $end)"
-			
-			def foundSection = null;
-			for (int i = iSection ; i < sections.size() ; i++) {
-				if (end < sections[i][0]) { // the Turn is before the section
-					
-				} else if (sections[i][1] < start) { // the Turn is after the section
-					
-				} else {
-					foundSection = sections[i]
-					iSection = i
-					break; // stop searching and set iSection to accelerate next search
-				}
-			}
-			
-			if (foundSection == null) {
-				if (currentSection != null || currentNode == null) {
-					currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":turn.@startTime, "endTime":"", "synchronized":"false"] )
-					currentSection = null;
-				}
-			} else {
-				if (foundSection != currentSection) {
-					if (currentNode != null && currentNode.@synchronized == "false") { // set the un-synchronized section endTime using its last Turn endTime
-						def tmp = currentNode.Turn
-						currentNode.@endTime = tmp[-1].@endTime
-					}
-					
-					currentSection = foundSection
-					currentNode = new Node(trsEpisode, "Section", currentSection[2])
-				}
-			}
-			
-			trsSection.remove(turn)
-			currentNode.append(turn)
-		}
-		
-		//remove the initial section which is empty now
-		trsEpisode.remove(trsSection)
-		
-		if (fixTurnsLimits) {
-			if (debug) println "Fixing Turn limits..."
-			def partOfTurnToInsertInthePreviousSection = null;
-			def partOfTurnToInsertIntheNextSection = null;
-			sections = trs.Episode.Section
-			for (int i = 0 ; i < sections.size() ; i++) { // browse created sections but stop before the last one (whichc can not be fixed)
-				
-				def section = sections[i]
-				if (partOfTurnToInsertIntheNextSection != null) {
-					if (debug) println "Moving part-of turn: "+partOfTurnToInsertIntheNextSection+" in section ("+section.@startTime+", "+section.@endTime+")"
-					section.children().add(0, partOfTurnToInsertIntheNextSection) // insert the slited part of the turn in the section
-				}
-				
-				def startSection = section.@startTime // Float.parseFloat(section.@startTime)
-				def endSection = section.@endTime //  Float.parseFloat(section.@endTime)
-				if (startSection instanceof String) startSection = Float.parseFloat(section.@startTime)
-				if (endSection instanceof String) endSection = Float.parseFloat(section.@endTime)
-				
-				partOfTurnToInsertInthePreviousSection = null
-				partOfTurnToInsertIntheNextSection = null
-				
-				turns = section.Turn
-				if (turns.size() == 0) continue;
-				
-				// Fix the first Turn
-				def turn = turns[0]
-				start = turn.@startTime // Float.parseFloat(section.@startTime)
-				end = turn.@endTime //  Float.parseFloat(section.@endTime)
-				if (start instanceof String) start = Float.parseFloat(turn.@startTime)
-				if (end instanceof String) end = Float.parseFloat(turn.@endTime)
-				
-				if (start < startSection) { // the start of the Turn is outside of its current section
-					
-				}
-				
-				// Fix the last Turn
-				turn = turns[-1]
-				start = turn.@startTime // Float.parseFloat(section.@startTime)
-				end = turn.@endTime //  Float.parseFloat(section.@endTime)
-				if (start instanceof String) start = Float.parseFloat(turn.@startTime)
-				if (end instanceof String) end = Float.parseFloat(turn.@endTime)
-				if (end > endSection) { // the end of the Turn is outside of its current section
-					
-					def children = turn.children()
-					Node newTurnKaNode = null;//new Node(trsEpisode, "Turn", currentSection[2])
-					//println "Cut the last turn if necessary"
-					for (int iChildren = 0 ; iChildren < children.size() ; iChildren++) {
-						
-						def c = children[iChildren]
-						if (c instanceof String) continue;
-						
-						if (newTurnKaNode != null) {
-							turn.remove(c)
-							newTurnKaNode.append(c)
-							if (debug) c.@moved="yes"
-							iChildren--
-						} else {
-							if ("w".equals(c.name())) {
-								def start2 = Float.parseFloat(c.@startTime)
-								def end2 = Float.parseFloat(c.@endTime)
-								
-								if (start2 > endSection && Math.abs(start2 - endSection) > turnsCutActivationThreashold) {
-									if (debug) println "cut with a w at [$start2, $end2] for section ("+startSection+", "+endSection+")"
-									newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
-									if (debug) newTurnKaNode.@created = "yes"
-									turn.@endTime = ""+start2;
-									turn.remove(c)
-									newTurnKaNode.append(c)
-									if (debug) c.@moved="yes"
-									iChildren--
-								}
-							} else if ("Sync".equals(c.name())) {
-								def start2 = Float.parseFloat(c.@time)
-								def end2 = Float.parseFloat(c.@time)
-								
-								if (start2 > endSection && Math.abs(start2 - endSection) > turnsCutActivationThreashold) {
-									if (debug) println "cut with a Sync at [$start2, $end2] for section "+endSection
-									newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
-									if (debug) newTurnKaNode.@created = "yes"
-									turn.@endTime = ""+start2;
-									turn.remove(c)
-									if (debug) c.@moved="yes"
-									newTurnKaNode.append(c)
-									iChildren--
-								}
-							} else {
-								// no time to check
-							}
-						}
-					}
-					
-				}
-				partOfTurnToInsertIntheNextSection = newTurnKaNode
-			}
-		}
-		
-		outputDirectory.mkdir()
-		File outfile = new File(outputDirectory, trsFile.getName())
-		outfile.withWriter("UTF-8") { writer ->
-			writer.write('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE Trans SYSTEM "trans-14.dtd">\n')
-			def printer = new groovy.util.XmlNodePrinter(new PrintWriter(writer))
-			printer.setPreserveWhitespace(true)
-			printer.print(trs)
-		}
-	}
-	cpb.done()
-	reader.close()
-	println "Done."
-	
-} catch(Exception e) {
-	println "Error: "+e
-	Log.printStackTrace(e)
-}
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacro.groovy	(revision 3433)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacro.groovy	(revision 3434)
@@ -1,3 +1,7 @@
+// Copyright © 2022 ENS de Lyon, CNRS, University of Franche-Comté
+// Licensed under the terms of the GNU General Public License (http://www.gnu.org/licenses)
+// @author bpincemin mdecorde
+
 package org.txm.macro.transcription
 
 import java.nio.charset.Charset
@@ -42,7 +46,7 @@
 @Field @Option(name="sectionsMergeActivationThreashold", usage="marge d'erreur de corrections des limites de sections", widget="Float", required=true, def="1.0")
 		def sectionsMergeActivationThreashold
 
-@Field @Option(name="fixTurnsLimits", usage="Correction des limites de sections du tableau de metadonnees", widget="Boolean", required=true, def="true")
+@Field @Option(name="fixTurnsLimits", usage="Découpage des tours à cheval sur plusieurs sujets", widget="Boolean", required=true, def="true") // description màj
 		def fixTurnsLimits
 
 @Field @Option(name="turnsCutActivationThreashold", usage="marge d'erreur de corrections des limites de tours", widget="Float", required=true, def="0.1")
@@ -129,17 +133,20 @@
 }
 
 try {
+	debugMore=false
 	def sectionGroupsToInsert = [:]
 	println "Reading data..."
+	//BP boucle de préparation qui constitue les listes de sections, avec sectionGroupsToInsert[identifiant-émission][section][start,end,contenu]
+	//BP l'indice de section commence à zéro dans chaque émission
 	while (reader.readRecord()) { // loading & sorting sections
 		String id = reader.get(joinTRSColumn).trim()
 		if (id.endsWith(".mp4")) id = id.substring(0, id.length()-4)
 		if (id.length() == 0) continue;
 		
-		if (!sectionGroupsToInsert.containsKey(id)) {
+		if (!sectionGroupsToInsert.containsKey(id)) { //BP initialisation du contenu pour chaque émission
 			sectionGroupsToInsert[id] = []
 		}
-		def section = sectionGroupsToInsert[id]
+//		def section = sectionGroupsToInsert[id] // plus homogène si sections  ; utilisée une seule fois (30 lignes après)
 		
 		if (reader.get(startTimeColumn) != null && reader.get(startTimeColumn).length() > 0) { // ignore non timed sections
 			
@@ -170,15 +177,18 @@
 			m["endTime"] = strTotime(reader.get(endTimeColumn))
 			m["synchronized"] = "true"
 			
-			section << [m["startTime"], m["endTime"], m]
+//			section << [m["startTime"], m["endTime"], m]
+			sectionGroupsToInsert[id] << [m["startTime"], m["endTime"], m]
 		}
 	}
 	
 	println "Inserting sections... "+sectionGroupsToInsert.size()
 	
 	ConsoleProgressBar cpb = new ConsoleProgressBar(sectionGroupsToInsert.keySet().size())
+	//BP boucle générale sur les émissions, avec id=identifiant de l'émission
 	for (String id : sectionGroupsToInsert.keySet()) {
 		
+		//BP on crée le fichier .trs
 		File trsFile = new File(trsDirectory, id+".trs")
 		if (!trsFile.exists()) {
 			cpb.tick()
@@ -189,19 +199,60 @@
 		else cpb.tick()
 		
 		//println "Processing $id..."
+		
+		//BP liste des sections de l'émission : sections[indice][start,end,contenu]
 		sections = sectionGroupsToInsert[id]
-		sections = sections.sort() { a, b -> a[0] <=> b[0] ?: a[1] <=> -b[1] } // negative second test for sections inclusion
 		
+		//BP on résoud les faibles chevauchements
 		if (fixSectionsLimits) {
-			if (debug) println "Fixing sections of $id"
+			if (debug && debugMore) println "Fixing sections of $id"
+			//BP on unifie les start entre eux
+			sections = sections.sort() { a, b -> a[0] <=> b[0] }
 			for (int iSection = 1 ; iSection < sections.size() ; iSection++) {
 				//println sections[iSection]
-				if (Math.abs(sections[iSection][0] - sections[iSection - 1][1]) < sectionsMergeActivationThreashold) {
-					if (debug) println "s=$iSection start <- end : "+sections[iSection][0]+ " <- "+sections[iSection - 1][1]
-					sections[iSection][0] = sections[iSection - 1][1] // fix the start time with the previous section end time
+				if ((sections[iSection][0] - sections[iSection - 1][0] < sectionsMergeActivationThreashold) && (sections[iSection][0] != sections[iSection - 1][0])) {
+					if (debug && debugMore) println "s=$iSection start <- start : "+sections[iSection][0]+ " <- "+sections[iSection - 1][0]
+					sections[iSection][0] = sections[iSection - 1][0] // fix the start time with a close preceeding start time
 				}
 			}
+			//BP on unifie les end entre eux
+			sections = sections.sort() { a, b -> a[1] <=> b[1] }
+			for (int iSection = 1 ; iSection < sections.size() ; iSection++) {
+				//println sections[iSection]
+				if ((sections[iSection][1] - sections[iSection - 1][1] < sectionsMergeActivationThreashold) && (sections[iSection][1] != sections[iSection - 1][1])) {
+					if (debug && debugMore) println "s=$iSection end <- end : "+sections[iSection][1]+ " <- "+sections[iSection - 1][1]
+					sections[iSection][1] = sections[iSection - 1][1] // fix the end time with a close preceeding end time
+				}
+			}
+			//BP on unifie les start avec les end
+//			sections = sections.sort() { a, b -> a[0] <=> b[0] }
+			for (int iSection = 1 ; iSection < sections.size() ; iSection++) { // pour chaque start...
+				//println sections[iSection]
+				int j = 1
+				boolean continuer = true
+				while (continuer && (j < (iSection + 1))) { // ...on regarde les end avant son propre end
+					if ((Math.abs(sections[iSection][0] - sections[iSection - j][1]) < sectionsMergeActivationThreashold) && (sections[iSection][0] != sections[iSection - j][1])) { // on a trouvé des valeurs à unifier
+						if (sections[iSection][0] < sections[iSection - j][1]) { // on cherche lequel est avant pour unifier vers sa valeur
+							if (debug && debugMore) println "s=$iSection end <- start : "+sections[iSection - j][1]+ " <- "+sections[iSection][0]
+							sections[iSection - j][1] = sections[iSection][0]
+						} else {
+							if (debug && debugMore) println "s=$iSection start <- end : "+sections[iSection][0]+ " <- "+sections[iSection - j][1]
+							sections[iSection][0] = sections[iSection - j][1]
+						}
+						continuer = false
+					} else {
+						if (sections[iSection][0] < sections[iSection - j][1]) { // l'écart ne peut plus que grandir
+							continuer = false
+						} else { // le end est au-dessus, le prochain sera plus bas, il peut se rapprocher
+							j++
+						}
+					}
+				}
+			}	
 		}
+
+		//BP les sections sont triées
+		sections = sections.sort() { a, b -> a[0] <=> b[0] ?: a[1] <=> -b[1] } // negative second test for sections inclusion
 		
 		// Open input file
 		slurper = new groovy.util.XmlParser(false, true, true);
@@ -227,95 +278,224 @@
 		currentSection = null
 		currentNode = null
 		
-		foundSection=null
-		isTurnSynchronized=false
-		cutCheck=false
+		def startSection = 0;
+		def endSection = 0;
+		def endPreviousSection = 0;
 		
+//		foundSection=null
+//		isTurnSynchronized=false
+//		cutCheck=false
+//		=> ces initialisations ont été déplacées dans la boucle des tours (la 1ère y était déjà)
+		
 		// boucle sur les tours dans l'ordre
+//		for (iTurn = 0 ; iTurn < turns.size() ; iTurn++) {
 		for (iTurn = 0 ; iTurn < turns.size() ; iTurn++) {
-			if (debug) println "iTurn=$iTurn turn="+turns[iTurn].attributes()+" iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
+			if (debug && debugMore) println "iTurn=$iTurn turn="+turns[iTurn].attributes()+" iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
+			//if (debug && iTurn == 199) println "WARNING: boucle probable sur iTurn dans cette transcription (ou bien plus de 200 tours dans la transcription)"
 			turn = turns[iTurn]
-			start = Float.parseFloat(turn.@startTime)
+			start = Float.parseFloat(turn.@startTime) // Float sera utile pour les tests ?
 			end = Float.parseFloat(turn.@endTime)
 			//println "Turn: $iTurn ($start, $end)"
-			
-			// Etape 1 : y aura-t-il besoin de couper le tour, et dans quelle section est le tour (ou sa première partie)
+
+			// Etape 1 : dans quelle section est le (début du) tour et doit-il être coupé
+
 			foundSection = null;
+			isTurnSynchronized=false
+			cutCheck=false
+
 			for (int i = iSection ; i < sections.size() ; i++) {
-				// if section_end < turn_start OU |turn_start - section_end| < turn_threshold
-				if (sections[i][1] < start || Math.abs(start - sections[i][1]) < turnsCutActivationThreashold) { // Turn is after section
-					// Cas 1 : la section est complètement avant (modulo la marge)
+				// if section_end < turn_start OU (|turn_start - section_end| < turn_threshold ET (turn_end - section_end) >= turn_threshold)
+				if ((sections[i][1] < start) || ((Math.abs(start - sections[i][1]) < turnsCutActivationThreashold) && (end - sections[i][1] >= turnsCutActivationThreashold))) { // Section is before Turn
+				// Cas 1 : la section est complètement avant (modulo la marge)
 				} else {
-					// Cas 2 : on est arrivés à la section à considérer
+				// Cas 2 : on est arrivés à la section à considérer
 					iSection = i
-					// if section_start > turn_end OU |section_start - turn_end| < turn_threshold
-					if (sections[i][0] > end || Math.abs(sections[i][0] - end) < turnsCutActivationThreashold) { // Turn is before section
-						// Cas 2.1 : la section est complètement après (modulo la marge) (et les suivantes le seront aussi)
-						foundSection = null
+					// if turn_end < section_start OU (|section_start - turn_end| < turn_threshold ET (section_start - turn_start) >= turn_threshold)
+					if ((end < sections[i][0]) || ((Math.abs(sections[i][0] - end) < turnsCutActivationThreashold) && (sections[i][0] - start >= turnsCutActivationThreashold))) { // Section is after Turn
+					// Cas 2.1 : la section est complètement après (modulo la marge) (et les suivantes le seront aussi)
+						if (debug && debugMore) println "Etape 1, Cas 2.1"
+						foundSection = sections[i] // (c'est la prochaine section, qui mettra fin à la section non-synchronisée)
 						isTurnSynchronized = false
 						cutCheck = false
 					} else {
-						// if |section_start - turn_start| > turn_threshold
-						if (start - sections[i][0] < 0) { // Turn begins before section does
-							// Cas 2.2 : la section commence significativement après le début du tour (le début est non synchronisé)
-							foundSection = sections[i] // (c'est la première section rencontrée, mais elle sera pour le tour suivant)
+						// if (section_start - turn_start) >= turn_threshold
+						if (sections[i][0] - start >= turnsCutActivationThreashold) { // Turn begins before section does
+						// Cas 2.2 : la section commence significativement après le début du tour (le début est non synchronisé)
+							if (debug && debugMore) println "Etape 1, Cas 2.2"
+							foundSection = sections[i] // (c'est la première section rencontrée, mais elle sera pour le tour suivant, elle va servir à savoir où couper)
 							isTurnSynchronized = false
 							cutCheck = true
 						} else {
-							// Cas 2.3 : le début du tour est dans la section (on n'a pas besoin de chercher d'autres sections car si ce n'est pas la seule on coupera le tour et ce sera un autre tour).
-							foundSection = sections[i]  // (c'est la section qui commence le tour, au moins)
-							isTurnSynchronized = true
-							cutCheck = true
+							// if turn_end < section_end OU |section_end - turn_end| < turn_threshold
+							if (end < sections[i][1] || Math.abs(sections[i][1] - end) < turnsCutActivationThreashold) {
+							// Cas 2.3 : le début du tour est dans la section et la fin aussi.
+								if (debug && debugMore) println "Etape 1, Cas 2.3"
+								foundSection = sections[i]  // (c'est la section qui contient le tour)
+								isTurnSynchronized = true
+								cutCheck = false
+							} else {
+							// Cas 2.4 : le début du tour est dans la section mais il dépasse.
+								if (debug && debugMore) println "Etape 1, Cas 2.4"
+								foundSection = sections[i]  // (c'est la section qui contient le début du tour)
+								isTurnSynchronized = true
+								cutCheck = true							
+							}
 						}
 					}
 					break; // stop searching and set iSection to accelerate next search
 				}
 			}
+
 			
-			// Etape 2 : positionne *le* tour dans *le* noeud
+			// Etape 2 : on met à jour currentSection et currentNode,
+			// ainsi que des variables startSection, endSection, endPreviousSection
 			// (on ne gère qu'un seul tour et un seul noeud à chaque itération de la boucle tour,
-			// puisqu'on a retaillé le tour pour qu'il ne concerne pas plusieurs noeuds)
-			if (foundSection != null) { // on complète ou on ajoute une div.
-				if (debug) println "found iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
-				if (foundSection != currentSection || currentSection == null) {
-					if (currentNode != null && currentNode.@synchronized == "false") {
-						def tmp = currentNode.Turn
-						currentNode.@endTime = tmp[-1].@endTime
+			// puisqu'on retaille le tour pour qu'il ne concerne pas plusieurs noeuds)
+			// currentSection == null au début et quand c'est une section non synchronisée
+			// currentNode == null au début
+			
+			if (isTurnSynchronized) { // on sait que foundSection != null
+				if (debug && debugMore) println "iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+") will be used"
+				if (foundSection != currentSection) { // le tour ouvre une nouvelle section (au lieu de compléter une section existante)
+					if (currentSection != null) {
+						endPreviousSection = endSection // faut-il préciser float ?
 					}
-					
+					startSection = sections[iSection][0] // currentNode.@startTime
+					if (startSection instanceof String) startSection = Float.parseFloat(sections[iSection][0]) //currentNode.@startTime)
+					endSection = sections[iSection][1] // currentNode.@endTime
+					if (endSection instanceof String) endSection = Float.parseFloat(sections[iSection][1]) //currentNode.@endTime)
+
 					currentSection = foundSection
 					currentNode = new Node(trsEpisode, "Section", currentSection[2])
-					if (debug) println " create synchronized turn at start="+foundSection[0]
+					if (debug && debugMore) println " create synchronized turn at start="+foundSection[0]
 				} 
-			} else { // on complète ou on ajoute un noeud (div) non synchronisé.
-				if (debug) println "not synchronized with current iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
-				if (currentSection != null || currentNode == null) { // create a new unsynchronized section if there is no opened synchronized section or no un-synchronized section
-				    currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":turn.@startTime, "endTime":"", "synchronized":"false"] )
-				    currentSection = null;
-					if (debug) println " create un-synchronized turn at "+turn.@startTime
+			} else {
+				if (debug && debugMore) println "not synchronized with current iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
+				if (currentNode == null) { // il n'y a pas de section avant, et il faut créer un noeud puisqu'il n'y en a pas
+					if (foundSection == null) { // il n'y a pas de section après
+						currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":trsSection.@startTime, "endTime":trsSection.@endTime, "synchronized":"false"] )
+						//BP pas besoin de Float ici ? Dans le code originel on avait un ex. de "startTime":turn.@startTime
+					} else {
+//						if (currentSection != null) { // a priori ce cas n'est jamais réalisé : quand currentNode == null, currentSection aussi
+//							endPreviousSection = endSection // faut-il préciser float ?
+//						}
+						startSection = sections[iSection][0] // currentNode.@startTime
+						if (startSection instanceof String) startSection = Float.parseFloat(sections[iSection][0]) //currentNode.@startTime)
+						endSection = sections[iSection][1] // currentNode.@endTime
+						if (endSection instanceof String) endSection = Float.parseFloat(sections[iSection][1]) //currentNode.@endTime)
+
+						currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":trsSection.@startTime, "endTime":startSection, "synchronized":"false"] )					
+					}	
+//					currentSection = null;
+					if (debug && debugMore) println " create un-synchronized turn at "+trsSection.@startTime
+                } else {
+                	if (currentSection != null) { // il y a un noeud et il correspond à une section synchronisée, donc il faut créer un noeud non-synchronisé
+                		if (foundSection == null) { // il n'y a pas de section après
+                			currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":endSection, "endTime":trsSection.@endTime, "synchronized":"false"] )					
+                		} else {
+                			endPreviousSection = endSection // faut-il préciser float ?
+                			startSection = sections[iSection][0] // currentNode.@startTime
+                			if (startSection instanceof String) startSection = Float.parseFloat(sections[iSection][0]) //currentNode.@startTime)
+							endSection = sections[iSection][1] // currentNode.@endTime
+							if (endSection instanceof String) endSection = Float.parseFloat(sections[iSection][1]) //currentNode.@endTime)
+							
+							currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":endPreviousSection, "endTime":startSection, "synchronized":"false"] )					
+                		}
+                		currentSection = null;                			
+						if (debug && debugMore) println " create un-synchronized turn at $endPreviousSection"
+                	}
                 }
 			}
 			
 			// Etape 3 : on coupe le tour s'il y a besoin
 			if (cutCheck && fixTurnsLimits) {
-				if (debug) println " fixing current turn iTurn=$iTurn ($start, $end) )in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
-				if (isTurnSynchronized) {
-					cutTurn(true) // iSection++  et test avec le **end** de la section quand on coupe
-				} else {
-					if (foundSection != null) {
-						cutTurn(false) // test avec le **start** de la iSection quand on coupe
+				if (debug && debugMore) println " fixing current turn iTurn=$iTurn ($start, $end) )in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
+				
+				def children = turn.children()
+				Node newTurnKaNode = null;//new Node(trsEpisode, "Turn", currentSection[2])
+	
+				//println "Cut the last turn if necessary"
+		
+				if (debug && debugMore) println " cut turn and test with end ? $isTurnSynchronized of iSection=$iSection ($startSection, $endSection) at iTurn=$iTurn (${turn.@startTime}, ${turn.@endTime}) children="+turn.children().size()
+				for (int iChildren = 0 ; iChildren < children.size() ; iChildren++) {
+				//BP boucle gérée comme un genre de pile. iChildren vaut 0 ou est incrémenté à 0
+				//BP (modulo des string qui vont rester dans le tour initial, à la queue leu leu pour la partie coupée :
+				//BP je propose de déplacer la ligne pour que les chaînes suivent le reste,
+				//BP sous réserves que remove et append peuvent s'appliquer aux enfants chaîne.
+		
+					def c = children[iChildren]
+//					if (c instanceof String) continue; // a Turn contains Sync or w tags
+		
+					if (newTurnKaNode != null) { // append the remaining children to the new turn
+						turn.remove(c)
+						newTurnKaNode.append(c)
+						if (debug && debugMore) c.@moved="yes"
+						iChildren--
+					} else {
+						if (c instanceof String) continue; // a Turn contains Sync or w tags
+						if ("w".equals(c.name())) {
+							def start2 = Float.parseFloat(c.@startTime)
+							def end2 = Float.parseFloat(c.@endTime)
+							
+							boolean test = null
+							if (isTurnSynchronized) {
+								test = start2 > endSection
+							} else {
+								test = start2 >= startSection
+							}
+				
+							if (test) { // && Math.abs(start2 - endSection) > turnsCutActivationThreashold // no more needed
+								if (debug && debugMore) println " cut with a w at ($start2, $end2) for section ("+startSection+", "+endSection+")"
+								newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
+								new Node(newTurnKaNode, "Sync", ["time":""+start2]) // TRS
+								turns.add(iTurn+1, newTurnKaNode) // set as next turn to process
+//								iTurn-- //BP doute sur pertinence -> test sans
+								if (debug && debugMore) newTurnKaNode.@created = "yes"
+								turn.@endTime = ""+start2;
+								turn.remove(c)
+								newTurnKaNode.append(c)
+								if (debug && debugMore) c.@moved="yes"
+								iChildren--
+							}
+						} else if ("Sync".equals(c.name())) {
+							def start2 = c.@time
+							if (start2 instanceof String) start2 = Float.parseFloat(c.@time)
+							def end2 = start2
+							
+							boolean test = null
+							if (isTurnSynchronized) {
+								test = start2 > endSection
+							} else {
+								test = start2 >= startSection
+							}
+				
+							if (test) { //  && Math.abs(start2 - endSection) > turnsCutActivationThreashold
+								if (debug && debugMore) println " cut with a Sync at ($start2, $end2) for section ("+startSection+", "+endSection+")"
+								newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
+								turns.add(iTurn+1, newTurnKaNode)
+//								iTurn-- //BP doute sur pertinence -> test sans
+								if (debug && debugMore) newTurnKaNode.@created = "yes"
+								turn.@endTime = ""+start2;
+								turn.remove(c)
+								newTurnKaNode.append(c)
+								if (debug && debugMore) c.@moved="yes"
+								iChildren--
+							}
+						} else {
+				// no time to check
+						}
 					}
 				}
-			}
+			} // fin étape 3
 			
-			if (debug) println " remove turn in initial section ("+trsSection.children().size()+" remaining turns before removing this one)"
+			if (debug && debugMore) println " remove turn in initial section ("+trsSection.children().size()+" remaining turns before removing this one)"
 			//turns.remove(turn)
 			trsSection.remove(turn)
 			currentNode.append(turn)
-			//if (debug) println " removed turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
+			//if (debug && debugMore) println " removed turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
 		}
 		
-		trsEpisode.remove(trsSection)
+		trsEpisode.remove(trsSection) //BP on pourrait éventuellement vérifier que trsSection est bien vide.
 		
 		outputDirectory.mkdir()
 		File outfile = new File(outputDirectory, trsFile.getName())
@@ -335,82 +515,3 @@
 	Log.printStackTrace(e)
 }
 
-def cutTurn(def testWithSectionEndTime) {
-	
-	def children = turn.children()
-	Node newTurnKaNode = null;//new Node(trsEpisode, "Turn", currentSection[2])
-	
-	def startSection = sections[iSection][0] // currentNode.@startTime
-	if (startSection instanceof String) startSection = Float.parseFloat(sections[iSection][0]) //currentNode.@startTime)
-	def endSection = sections[iSection][1] // currentNode.@endTime
-	if (endSection instanceof String) endSection = Float.parseFloat(sections[iSection][1]) //currentNode.@endTime)
-	//println "Cut the last turn if necessary"
-		
-	if (debug) println " cut turn and test with end ? $testWithSectionEndTime of iSection=$iSection ($startSection, $endSection) at iTurn=$iTurn (${turn.@startTime}, ${turn.@endTime}) children="+turn.children().size()
-	for (int iChildren = 0 ; iChildren < children.size() ; iChildren++) {
-		
-		def c = children[iChildren]
-		if (c instanceof String) continue; // a Turn contains Sync or w tags
-		
-		if (newTurnKaNode != null) { // append the remaining children to the new turn
-			turn.remove(c)
-			newTurnKaNode.append(c)
-			if (debug) c.@moved="yes"
-			iChildren--
-		} else {
-			if ("w".equals(c.name())) {
-				def start2 = Float.parseFloat(c.@startTime)
-				def end2 = Float.parseFloat(c.@endTime)
-                    
-                boolean test = null
-                if (testWithSectionEndTime) {
-                   test = start2 > endSection
-                } else {
-                   test = start2 >= startSection
-                }
-				
-				if (test) { // && Math.abs(start2 - endSection) > turnsCutActivationThreashold // no more needed
-					if (debug) println " cut with a w at ($start2, $end2) for section ("+startSection+", "+endSection+")"
-					newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
-                    new Node(newTurnKaNode, "Sync", ["time":""+start2]) // TRS
-					
-					turns.add(iTurn+1, newTurnKaNode) // set as next turn to process
-					iTurn--
-					if (debug) newTurnKaNode.@created = "yes"
-					turn.@endTime = ""+start2;
-					turn.remove(c)
-					newTurnKaNode.append(c)
-					
-					if (debug) c.@moved="yes"
-					iChildren--
-				}
-			} else if ("Sync".equals(c.name())) {
-				def start2 = c.@time
-				if (start2 instanceof String) start2 = Float.parseFloat(c.@time)
-				def end2 = start2
-                    
-                boolean test = null
-                if (testWithSectionEndTime) {
-                   test = start2 > endSection
-                } else {
-                   test = start2 >= startSection
-                }
-				
-				if (test) { //  && Math.abs(start2 - endSection) > turnsCutActivationThreashold
-					if (debug) println " cut with a Sync at ($start2, $end2) for section ("+startSection+", "+endSection+")"
-					newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker])
-					turns.add(iTurn+1, newTurnKaNode)
-					iTurn--
-					if (debug) newTurnKaNode.@created = "yes"
-					turn.@endTime = ""+start2;
-					turn.remove(c)
-					if (debug) c.@moved="yes"
-					newTurnKaNode.append(c)
-					iChildren--
-				}
-			} else {
-				// no time to check
-			}
-		}
-	}
-}
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 3433)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 3434)
@@ -193,8 +193,8 @@
 			for (TXMResult result : altered) {
 				mess.append("\n- "+result.getName()+ " ("+result.getResultType()+") : "+result.getSimpleDetails());
 			}
-			mess.append("\n\nYou're going to lost those modifications. Continue?");
-			return MessageDialog.openConfirm(this.getWindowConfigurer().getWindow().getShell(), "Some result are modified", mess.toString());
+			mess.append("\n\n"+"You're going to lost those modifications if not already exported. Continue?"); //$NON-NLS-1$
+			return MessageDialog.openConfirm(this.getWindowConfigurer().getWindow().getShell(), "Some result have been manually modified", mess.toString());
 		}
 		
 		AnnotationEnginesManager aem = (AnnotationEnginesManager) Toolbox.getEngineManager(EngineType.ANNOTATION);
Index: TXM/trunk/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java
===================================================================
--- TXM/trunk/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java	(revision 3433)
+++ TXM/trunk/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java	(revision 3434)
@@ -32,7 +32,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -58,7 +57,6 @@
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
 import org.txm.searchengine.cqp.corpus.CQPCorpus;
-import org.txm.searchengine.cqp.corpus.CorpusManager;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.QueryResult;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -1392,8 +1390,8 @@
 				continue;
 			}
 
-			if (debug) System.out.println("n="+n);
-			if (debug) System.out.println("o="+o);
+//			if (debug) System.out.println("n="+n);
+//			if (debug) System.out.println("o="+o);
 			int start = n.getStart();
 			int size = n.getEnd() - start + 1;
 			// if (size > 0)
@@ -1412,9 +1410,9 @@
 					continue;
 				}
 
-				if (allsignaturesstr.get(position).equals("[1308]")) {
-					int a = 1+1;
-				}
+//				if (allsignaturesstr.get(position).equals("[1304]") || position == 13313) {
+//					int a = 1+1;
+//				}
 				
 				int dist;
 				if (position < m.getStart()) {
@@ -1424,17 +1422,17 @@
 					dist = position - m.getEnd() - 1;
 				}
 				else { // the n match is in the m match !?
-					System.out.println("Warning: the n match is in the m match ? " + n + " " + m);
+					Log.warning("Warning: the n match is in the m match ? " + n + " " + m);
 					dist = 0;
 				}
 				
 				if (debug) System.out.println(" p="+position+" sign="+allsignaturesstr.get(position)+" dist="+dist);
-				if (positionsDistances.containsKey(position) && positionsDistances.get(position) < dist) {
+				if (positionsDistances.containsKey(position) && positionsDistances.get(position) > dist) {
 					positionsDistances.put(position, dist);
-					if (debug) System.out.println(" using the higher distance");
-				} else {
+//					if (debug) System.out.println(" using the higher distance");
+				} else if (!positionsDistances.containsKey(position)){
 					positionsDistances.put(position, dist);
-					if (debug) System.out.println(" add");
+//					if (debug) System.out.println(" add");
 				}
 				
 			}
@@ -1465,9 +1463,9 @@
 				counts.put(signaturestr, 1);
 			}
 			
-			if (allsignaturesstr.get(position).equals("[1308]")) {
-				System.out.println("dist= "+dist+" distances="+distances.get(signaturestr)+" counts="+counts.get(signaturestr));
-			}
+//			if (allsignaturesstr.get(position).equals("[1304]")) {
+//				System.out.println("dist= "+dist+" distances="+distances.get(signaturestr)+" counts="+counts.get(signaturestr));
+//			}
 
 			// if ("[1599]".equals(signaturestr)) {
 			//	System.out.println("sign="+allsignaturesstr.get(position)+" p=" + position + " c=" + counts.get(signaturestr) + " d=" + dist + " total(d)=" + distances.get(signaturestr)); 
@@ -1590,7 +1588,7 @@
 						indexfreqs.get(specifrownames[ii]), scores[ii][1], // freq
 						((float) (distances.get(signaturestr) / counts.get(signaturestr))), // mean distance
 						-1);
-				cline.debug = "";//" "+signaturestr;
+				cline.debug = " "+signaturestr;
 				// System.out.println("Line: "+specifrownames[ii]+" dists="+distances.get(signaturestr)+" counts="+counts.get(signaturestr)+" mean="+((float) (distances.get(signaturestr) / counts.get(signaturestr))));
 				// select the line
 				if (cline.freq >= this.pFminFilter && cline.nbocc >= this.pFCoocFilter && cline.score >= this.pScoreMinFilter) {
Index: TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java
===================================================================
--- TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 3433)
+++ TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 3434)
@@ -2318,6 +2318,8 @@
 //		System.out.println("REFSIZE="+s);
 	}
 	
+	
+	
 	/**
 	 * @return the number of lines in the table
 	 */
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 3433)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 3434)
@@ -240,6 +240,7 @@
 		
 		annotationArea = new GLComposite(parent, SWT.NONE, KRAnnotationUIMessages.concordanceAnnotationArea);
 		annotationArea.getLayout().numColumns = 12;
+		annotationArea.getLayout().horizontalSpacing = 2;
 		annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
 		
 		addRemoveCombo = new Combo(annotationArea, SWT.READ_ONLY);
@@ -275,7 +276,7 @@
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
 		GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-		gdata.widthHint = 90;
+		//gdata.widthHint = 90;
 		addRemoveCombo.setLayoutData(gdata);
 		
 		withLabel = new Label(annotationArea, SWT.NONE);
@@ -545,7 +546,7 @@
 		affectCombo.setItems(items2);
 		affectCombo.select(0);
 		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-		gdata.widthHint = 140;
+		//gdata.widthHint = 140;
 		affectCombo.setLayoutData(gdata);
 		
 		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 3433)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 3434)
@@ -852,6 +852,7 @@
 		}
 		
 		annotationColumn.setText(type.getName());
+		
 		annotations.setViewAnnotation(type);
 		annotations.setAnnotationOverlap(true);
 		try {
@@ -1002,7 +1003,7 @@
 		
 		// update annotation column width
 		if (annotationArea != null) {
-			annotationColumn.pack();
+			//annotationColumn.pack();
 			
 			annotationColumn.setResizable(true);
 		}
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 3433)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 3434)
@@ -216,6 +216,7 @@
 		
 		annotationArea = new GLComposite(parent, SWT.NONE, KRAnnotationUIMessages.concordanceAnnotationArea);
 		annotationArea.getLayout().numColumns = 12;
+		annotationArea.getLayout().horizontalSpacing = 2;
 		annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
 		
 		addRemoveCombo = new Combo(annotationArea, SWT.READ_ONLY);
@@ -249,7 +250,7 @@
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
 		GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-		gdata.widthHint = 90;
+		//gdata.widthHint = 100;
 		addRemoveCombo.setLayoutData(gdata);
 		
 		withLabel = new Label(annotationArea, SWT.NONE);
@@ -338,7 +339,7 @@
 		affectCombo.setItems(items2);
 		affectCombo.select(0);
 		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-		gdata.widthHint = 140;
+		//gdata.widthHint = 200;
 		affectCombo.setLayoutData(gdata);
 		
 		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
