aboutsummaryrefslogtreecommitdiff
path: root/composer
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2009-09-27 08:15:17 +0000
committermescalinum <mescalinum@users.sourceforge.net>2009-09-27 08:15:17 +0000
commit1051b45076fc05ee8e7b50c6d0a3ef3ceb6fd1bc (patch)
treebfbb0b8d056cf9e65565069ba2fb93606ddb5696 /composer
parentb5d0c13836806cc9cff64ccbc5599b36e6135b83 (diff)
make cut/copy/paste or any other data write work properly
svn path=/trunk/externals/ffext/; revision=12468
Diffstat (limited to 'composer')
-rw-r--r--composer/editor.tk53
1 files changed, 28 insertions, 25 deletions
diff --git a/composer/editor.tk b/composer/editor.tk
index eca176a..95c5731 100644
--- a/composer/editor.tk
+++ b/composer/editor.tk
@@ -224,12 +224,23 @@ namespace eval pd::composer {
$w($id).t configure -padx [$w($id).t cget -padx]
}
- proc edit {id r c bwrite value} {
- # NOT USED
- #if {$bwrite} {
- # sendGui [editCommand setcell $currentpattern($id) $r $c $value]
- #} else {
- #}
+ proc dw {id n k op} {
+ if {$op != {write}} {return}
+ if {$n != [getDataVar $id]} {return}
+ if {$k == {active}} {return}
+ if {$k == {#TEST KEY#}} {return}
+ variable currentpattern
+ variable symbolmap
+
+ lassign [split $k ,] row col
+ upvar [getDataVar $id] data
+ set newVal $data($k)
+
+ debugPrint "BEFORE: newVal = '$newVal'"
+ set newVal [dict get [dict merge [list $newVal $newVal] [lreverse $symbolmap]] $newVal]
+ debugPrint "AFTER: newVal = '$newVal'"
+
+ sendGui [editCommand setcell $currentpattern($id) $row $col $newVal]
}
proc getDataVar {id {P {}}} {
@@ -238,7 +249,11 @@ namespace eval pd::composer {
variable trackname
if {$P == ""} {set P $currentpattern($id)}
set n "[namespace current]::data_$songname($id)_$trackname($id)_$P"
- if {![info exists $n]} {array set $n {}}
+ if {![info exists $n]} {
+ array set $n {}
+ trace add variable $n write [list [namespace current]::dw $id]
+ # TODO: when to remove the above variable trace?
+ }
return $n
}
@@ -293,14 +308,15 @@ namespace eval pd::composer {
-browsecmd "[namespace current]::activeCellChanges $id %r %c" \
-cols 0 -rows 0 \
-cache 0 \
- -usecommand 0 -command "[namespace current]::edit $id %r %c %i %s" \
-colstretchmode none -rowstretchmode none \
-flashmode 1 -flashtime 2 -autoclear 1 \
-justify left -multiline 0 -resizeborders col \
-selectmode extended -selecttype cell \
- -titlecols 1 -titlerows 0 -validate 1 \
- -validatecommand "[namespace current]::validateCommand $id %r %c %s %S" \
- -variable [getDataVar $id] -exportselection 1 \
+ -titlecols 1 -titlerows 0 \
+ -validate 0 \
+ -variable [getDataVar $id] \
+ -sparsearray 0 \
+ -exportselection 1 \
-xscrollcommand "$w($id).hscroll set" \
-yscrollcommand "$w($id).vscroll set" \
-rowtagcommand "[namespace current]::rowTag $id"
@@ -386,20 +402,6 @@ namespace eval pd::composer {
if {$col < 0} {$w($id).t activate $row,[incr col]}
}
- proc validateCommand {id row col curVal newVal} {
- debugPrint [info level 0]
- variable currentpattern
- variable symbolmap
-
- debugPrint "BEFORE: newVal = '$newVal'"
- set newVal [dict get [dict merge [list $newVal $newVal] [lreverse $symbolmap]] $newVal]
- debugPrint "AFTER: newVal = '$newVal'"
-
- sendGui [editCommand setcell $currentpattern($id) $row $col $newVal]
-
- return 1
- }
-
proc patternPropertiesDialog_common {id options} {
debugPrint [info level 0]
variable currentpattern
@@ -537,6 +539,7 @@ namespace eval pd::composer {
proc openWindow {id} {
debugPrint [info level 0]
createMainWindow $id
+ updateTitle $id
}
proc closeWindow {id} {