jbclements / RSound

A cross-platform sound library for DrRacket
http://www.brinckerhoff.org/clements
Other
45 stars 11 forks source link

cursor on the text #41

Open madatao opened 5 years ago

madatao commented 5 years ago

(define CHAR-CANVAS%
(class canvas% (define/override (on-char evt) (let ((c (send evt get-key-code)) (dc(send this get-dc))) (send dc clear) (print c) (cond ((equal? c 'release)(void))
((member c '( #\a #\i #\u #\e #\o #\q #\é #\x)) (begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30) (send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '()))) ((equal? c #\;)(begin(send R-k-text insert "。") (set! tampon-key '()))) ((equal? c #\,)(begin(send R-k-text insert "、") (set! tampon-key '()))) ((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '()))) ((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '()))) ((equal? c #\&)(begin(send R-k-text insert "々") (set! tampon-key '()))) ((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p #\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))
((begin (set! tampon-key (cons c tampon-key))(print tampon-key)))) ))

(super-new)))

It works very well (it is for writing in hiragana katakana and other characters) I want to add to this same canvas a feature which tells me the position of the cursor on a text

is it possible? if yes what is the code to add?

(define/override (on-char evt)......

Or do I need a another canvas? in this case what will be my code?

 (define/override (on-char evt)......

this in order to do something similar to a "RIKAICHAN"

jbclements commented 5 years ago

Hmm… I’m not completely sure what you’re asking, but I’m pretty confident that it has nothing to do with the “rsound” package for generating sound. Would you like me to forward your message to the racket users mailing list?

John Clements

On Jul 13, 2019, at 06:00, madatao notifications@github.com wrote:

(define CHAR-CANVAS% (class canvas% (define/override (on-char evt) (let ((c (send evt get-key-code)) (dc(send this get-dc))) (send dc clear) (print c) (cond ((equal? c 'release)(void)) ((member c '( #\a #\i #\u #\e #\o #\q #\é #\x)) (begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30) (send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '()))) ((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '()))) ((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '()))) ((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '()))) ((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '()))) ((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '()))) ((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p #\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void)) ((begin (set! tampon-key (cons c tampon-key))(print tampon-key)))) ))

(super-new)))

It works very well (it is for writing in hiragana katakana and other characters) I want to add to this same canvas a feature which tells me the position of the cursor on a text

is it possible? if yes what is the code to add?

(define/override (on-char evt)......

Or do I need a another canvas? in this case what will be my code?

(define/override (on-char evt)......

this in order to do something similar to a "RIKAICHAN"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jbclements commented 5 years ago

Hmm… I’m not completely sure what you’re asking, but I’m pretty confident that it has nothing to do with the “rsound” package for generating sound. Would you like me to forward your message to the racket users mailing list?John ClementsOn Jul 13, 2019, at 06:00, madatao notifications@github.com wrote:(define CHAR-CANVAS%(class canvas%(define/override (on-char evt)(let ((c (send evt get-key-code)) (dc(send this get-dc)))(send dc clear)(print c)(cond((equal? c 'release)(void))((member c '( #\a #\i #\u #\e #\o #\q #\é #\x))(begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30)(send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '())))((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '())))((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '())))((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '())))((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '())))((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '())))((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p #\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))((begin (set! tampon-key (cons c tampon-key))(print tampon-key))))))(super-new)))It works very well (it is for writing in hiragana katakana and other characters)I want to add to this same canvasa feature which tells me the position of the cursor on a textis it possible? if yeswhat is the code to add?(define/override (on-char evt)......Or do I need a another canvas?in this case what will be my code? (define/override (on-char evt)......this in order to do something similar to a "RIKAICHAN"—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

madatao commented 5 years ago

thank you very much for your answer this is not directly relating to the rsound package (at the moment) is my problem difficult? i am find à solution with a copy pass from a text-field to a another but that is not so elegant as a direct detecting of the word when the carret (cursor) over this

Le mar. 16 juil. 2019 à 17:37, John Clements notifications@github.com a écrit :

Hmm… I’m not completely sure what you’re asking, but I’m pretty confident that it has nothing to do with the “rsound” package for generating sound. Would you like me to forward your message to the racket users mailing list?John ClementsOn Jul 13, 2019, at 06:00, madatao < notifications@github.com> wrote:(define CHAR-CANVAS%(class canvas%(define/override (on-char evt)(let ((c (send evt get-key-code)) (dc(send this get-dc)))(send dc clear)(print c)(cond((equal? c 'release)(void))((member c '( #\a #\i #\u #\e #\o #\q #\é #\x))(begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30)(send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '())))((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '())))((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '())))((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '())))((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '())))((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '())))((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p

\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))((begin (set!

tampon-key (cons c tampon-key))(print tampon-key))))))(super-new)))It works very well (it is for writing in hiragana katakana and other characters)I want to add to this same canvasa feature which tells me the position of the cursor on a textis it possible? if yeswhat is the code to add?(define/override (on-char evt)......Or do I need a another canvas?in this case what will be my code? (define/override (on-char evt)......this in order to do something similar to a "RIKAICHAN"—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jbclements/RSound/issues/41?email_source=notifications&email_token=AJAFCKH3ETNVZIZSYIHQOYLP7XTKFA5CNFSM4IC2GWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BIG5A#issuecomment-511869812, or mute the thread https://github.com/notifications/unsubscribe-auth/AJAFCKHXRKONF34UI75OZALP7XTKFANCNFSM4IC2GWGQ .

madatao commented 5 years ago

(define b '(あ い う え お か き く け こ さ し す せ そ た ち つ て と な に ぬ ね の は ひ ふ へ ほ ま み む め も や ゆ よ わ を ん ら り る れ ろ にょ びゃ びゅ びょ みゃ みゅ みょ )

(define (foo-play l) (while (not(null? l) (play (car l)) (set! l (cdr l)))))

(foo play b)

;play: expects to be at the top level in: (play (car l))

what should I do to be able to listen to this list?

あ (rsound # 0 48971 44100) ................... みょ (rsound # 0 31675 44100)

best regards

Le mar. 16 juil. 2019 à 18:15, claude talarmin madatao71@gmail.com a écrit :

thank you very much for your answer this is not directly relating to the rsound package (at the moment) is my problem difficult? i am find à solution with a copy pass from a text-field to a another but that is not so elegant as a direct detecting of the word when the carret (cursor) over this

Le mar. 16 juil. 2019 à 17:37, John Clements notifications@github.com a écrit :

Hmm… I’m not completely sure what you’re asking, but I’m pretty confident that it has nothing to do with the “rsound” package for generating sound. Would you like me to forward your message to the racket users mailing list?John ClementsOn Jul 13, 2019, at 06:00, madatao < notifications@github.com> wrote:(define CHAR-CANVAS%(class canvas%(define/override (on-char evt)(let ((c (send evt get-key-code)) (dc(send this get-dc)))(send dc clear)(print c)(cond((equal? c 'release)(void))((member c '( #\a #\i #\u #\e #\o #\q #\é #\x))(begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30)(send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '())))((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '())))((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '())))((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '())))((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '())))((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '())))((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p

\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))((begin (set!

tampon-key (cons c tampon-key))(print tampon-key))))))(super-new)))It works very well (it is for writing in hiragana katakana and other characters)I want to add to this same canvasa feature which tells me the position of the cursor on a textis it possible? if yeswhat is the code to add?(define/override (on-char evt)......Or do I need a another canvas?in this case what will be my code? (define/override (on-char evt)......this in order to do something similar to a "RIKAICHAN"—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jbclements/RSound/issues/41?email_source=notifications&email_token=AJAFCKH3ETNVZIZSYIHQOYLP7XTKFA5CNFSM4IC2GWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BIG5A#issuecomment-511869812, or mute the thread https://github.com/notifications/unsubscribe-auth/AJAFCKHXRKONF34UI75OZALP7XTKFANCNFSM4IC2GWGQ .

madatao commented 5 years ago

(define (transform-syll->mot L-romanji L-hiragana) (let ((a '())(b'())) (set! a (map list->string (reverse L-romanji))) (set! b (map char->string (string->list "たべます"))) (list a b)))

(define (foo-w1 tw) ;transforme syllabe en fichier wav (if exist) (let ((l '())) (while (not (null? tw)) (set! l(cons (string-append (car tw )".wav")l)) (set! tw (cdr tw))) (reverse l)))

(define (transform-mot->son L-romanji L-hiragana) (let ((x (transform-syll->mot L-romanji L-hiragana)) (a (car x))) (current-directory "/Users/izuko/Desktop/japonais-new/jap-syll") (rs-append (map rs-read (foo-w1 a)))))

(define syllabe-R '()) (define syllabe-H '()) (define clip "")

(define Bt-dir (new button% (parent GP-1 ) (label "Direct") (callback (lambda (obj evt) (begin (set! alphabet hiragana) (set! lecture-feld (send R-k-tex-rech get-text)) (set! LECT-HI (cons lecture-feld LECT-HI)) (set! LECT-ID (cons lecture-feld LECT-ID)) (send R-k-text insert lecture-feld) (set! syllabe-R (transform-syll->mot tampon-wort lecture-feld)) (set! clip (transform-mot->son tampon-wort lecture-feld)) (play clip))))))

Le jeu. 18 juil. 2019 à 15:38, claude talarmin madatao71@gmail.com a écrit :

(define b '(あ い う え お か き く け こ さ し す せ そ た ち つ て と な に ぬ ね の は ひ ふ へ ほ ま み む め も や ゆ よ わ を ん ら り る れ ろ にょ びゃ びゅ びょ みゃ みゅ みょ )

(define (foo-play l) (while (not(null? l) (play (car l)) (set! l (cdr l)))))

(foo play b)

;play: expects to be at the top level in: (play (car l))

what should I do to be able to listen to this list?

あ (rsound # 0 48971 44100) ................... みょ (rsound # 0 31675 44100)

best regards

Le mar. 16 juil. 2019 à 18:15, claude talarmin madatao71@gmail.com a écrit :

thank you very much for your answer this is not directly relating to the rsound package (at the moment) is my problem difficult? i am find à solution with a copy pass from a text-field to a another but that is not so elegant as a direct detecting of the word when the carret (cursor) over this

Le mar. 16 juil. 2019 à 17:37, John Clements notifications@github.com a écrit :

Hmm… I’m not completely sure what you’re asking, but I’m pretty confident that it has nothing to do with the “rsound” package for generating sound. Would you like me to forward your message to the racket users mailing list?John ClementsOn Jul 13, 2019, at 06:00, madatao < notifications@github.com> wrote:(define CHAR-CANVAS%(class canvas%(define/override (on-char evt)(let ((c (send evt get-key-code)) (dc(send this get-dc)))(send dc clear)(print c)(cond((equal? c 'release)(void))((member c '( #\a #\i #\u #\e #\o #\q #\é #\x))(begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30)(send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '())))((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '())))((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '())))((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '())))((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '())))((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '())))((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p

\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))((begin (set!

tampon-key (cons c tampon-key))(print tampon-key))))))(super-new)))It works very well (it is for writing in hiragana katakana and other characters)I want to add to this same canvasa feature which tells me the position of the cursor on a textis it possible? if yeswhat is the code to add?(define/override (on-char evt)......Or do I need a another canvas?in this case what will be my code? (define/override (on-char evt)......this in order to do something similar to a "RIKAICHAN"—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jbclements/RSound/issues/41?email_source=notifications&email_token=AJAFCKH3ETNVZIZSYIHQOYLP7XTKFA5CNFSM4IC2GWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BIG5A#issuecomment-511869812, or mute the thread https://github.com/notifications/unsubscribe-auth/AJAFCKHXRKONF34UI75OZALP7XTKFANCNFSM4IC2GWGQ .