From: Han-Wen Nienhuys Date: Sun, 14 Nov 2004 16:06:31 +0000 (+0000) Subject: (save-tweaks): use new key mechanism for X-Git-Tag: release/2.5.14~560 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3cec7262ac857e25dcc6e8007392fb2231024aed;p=lilypond.git (save-tweaks): use new key mechanism for saving tweaks. --- diff --git a/lily/grob.cc b/lily/grob.cc index 66a0caf8cd..fe43a6218c 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -602,7 +602,7 @@ Grob::mark_smob (SCM ses) { Grob *s = (Grob*) SCM_CELL_WORD_1 (ses); scm_gc_mark (s->immutable_property_alist_); - + scm_gc_mark (s->key_->self_scm ()); for (int a = 0 ; a < 2; a++) { scm_gc_mark (s->dim_cache_[a].offset_callbacks_); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index d83528ccc5..566d789e07 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -104,10 +104,11 @@ Lily_parser::parse_file (String init, String name, String out_name) set_yydebug (0); lexer_->new_input (init, sources_); + #ifdef TWEAK File_name f (name); String s = global_path.find (f.base_ + ".twy"); - if (s == "") + if (1 || s == "") Grob_selector::set_tweaks (SCM_EOL); else { diff --git a/lily/lilypond-key.cc b/lily/lilypond-key.cc index 21d3f6ed61..08b12298dc 100644 --- a/lily/lilypond-key.cc +++ b/lily/lilypond-key.cc @@ -212,7 +212,6 @@ Lilypond_general_key::do_compare (Object_key const* key)const if (c) return c; -v c = sign (disambiguation_count_ - other->disambiguation_count_); if (c) return c; diff --git a/lily/object-key-dumper.cc b/lily/object-key-dumper.cc index 6fc4c78261..7fcbfcdc90 100644 --- a/lily/object-key-dumper.cc +++ b/lily/object-key-dumper.cc @@ -108,7 +108,7 @@ Object_key_dumper::get_file_contents () const } LY_DEFINE(ly_make_dumper, "ly:make-dumper", - 1,0,0, + 0,0,0, (), "Create a key dumper. " ) diff --git a/scm/framework-gnome.scm b/scm/framework-gnome.scm index 3c2636e62d..2165013652 100644 --- a/scm/framework-gnome.scm +++ b/scm/framework-gnome.scm @@ -293,22 +293,35 @@ (origin (if (null? extra-offset) '(0 . 0) (cons (car extra-offset) (- 0 (cdr extra-offset)))))) - (if grob (hashq-set! (grob-tweaks go) grob - (cons - 'extra-offset - (list - (cons (+ (car origin) (car offset)) - (- 0 (+ (cdr origin) (cdr offset)))))))))) + + (if grob + (hashq-set! (grob-tweaks go) grob + (cons + 'extra-offset + (list + (cons (+ (car origin) (car offset)) + (- 0 (+ (cdr origin) (cdr offset)))))))))) ;; FIXME: this only saves new tweaks, old tweaks are lost. (define-method (save-tweaks (go )) - (let ((tweaks (hash-fold - (lambda (key value seed) - (cons (cons (ly:grob-id key) value) seed)) - '() (grob-tweaks go)))) + (let* + ((dumper (ly:make-dumper)) + (tweaks (hash-fold + (lambda (grob value seed) + (cons + (list 'set-property + (list + 'key + (ly:dumper-key-serial dumper (ly:grob-key grob))) + value) + seed)) + '() (grob-tweaks go)))) + (if (not (null? tweaks)) (let ((file (open-file (string-append (name go) ".twy") "w"))) - (format file ";;; TWEAKS \n'~S\n" tweaks))))) + (format file ";;; KEYS\n`~S\n;;; TWEAKS \n`~S\n" + (ly:dumper-definitions dumper) + tweaks))))) ;;;(define (item-event go grob item event) (define (item-event go item event)