Revision Log
Revision: 1.1.1.1 - (view) (download)
| 1 : | ktanaka | 1.1 | ;; ----------------------------------------- ;; |
| 2 : | ;; skeledit.l kanji-skelton-editor ver 0.2 ;; | ||
| 3 : | ;; ;; | ||
| 4 : | ;; You need load `ulx' (UtiLisp X interface) ;; | ||
| 5 : | ;; ;; | ||
| 6 : | ;; You need (reload-skelton) ;; | ||
| 7 : | ;; ----------------------------------------- ;; | ||
| 8 : | (comment | ||
| 9 : | $Revision: 1.4 $ | ||
| 10 : | ) | ||
| 11 : | |||
| 12 : | ;; ----------------- ;; | ||
| 13 : | ;; for compiler bug? ;; | ||
| 14 : | ;; ----------------- ;; | ||
| 15 : | (defun ulx-magic () | ||
| 16 : | ) | ||
| 17 : | |||
| 18 : | ;; ----------------------------- ;; | ||
| 19 : | ;; get window properties (macro) ;; | ||
| 20 : | ;; ----------------------------- ;; | ||
| 21 : | (defmacro width-win (win) | ||
| 22 : | `(get-winprop ,win 'width)) | ||
| 23 : | |||
| 24 : | (defmacro height-win (win) | ||
| 25 : | `(get-winprop ,win 'height)) | ||
| 26 : | |||
| 27 : | ;; --------------- ;; | ||
| 28 : | ;; make menu macro ;; | ||
| 29 : | ;; --------------- ;; | ||
| 30 : | (defmacro create-menu (parent x y black white fnt cursor . item-list) | ||
| 31 : | (let ((mw (gensym)) | ||
| 32 : | (height (gensym)) | ||
| 33 : | (width (gensym))) | ||
| 34 : | (append | ||
| 35 : | `(let ((,mw (create-win ,parent ,x ,y 10 10 | ||
| 36 : | ,black ,white ,fnt)) | ||
| 37 : | (,height *menu-margin*) | ||
| 38 : | (,width 0))) | ||
| 39 : | (mapcar item-list | ||
| 40 : | (function | ||
| 41 : | (lambda (x) | ||
| 42 : | `(progn | ||
| 43 : | (setq ,(first x) | ||
| 44 : | (create-menu-item-win | ||
| 45 : | ,mw | ||
| 46 : | ,(second x) | ||
| 47 : | *menu-margin* | ||
| 48 : | ,height | ||
| 49 : | ,black | ||
| 50 : | ,white | ||
| 51 : | ,fnt | ||
| 52 : | ,cursor)) | ||
| 53 : | (setq ,height | ||
| 54 : | (+ ,height (height-win ,(first x)))) | ||
| 55 : | (setq ,width | ||
| 56 : | (max ,width (width-win ,(first x)))) | ||
| 57 : | (princ (quote ,(first x))) | ||
| 58 : | (princ " "))))) | ||
| 59 : | `((resize-win ,mw | ||
| 60 : | (+ ,width (* 4 *menu-margin*)) | ||
| 61 : | (+ ,height (* 2 *menu-margin*)))) | ||
| 62 : | (mapcar item-list | ||
| 63 : | (function (lambda (x) | ||
| 64 : | `(resize-win ,(first x) ,width)))) | ||
| 65 : | `(,mw)))) | ||
| 66 : | |||
| 67 : | ;; ------------------------------------ ;; | ||
| 68 : | ;; window-handler of addition primitive ;; | ||
| 69 : | ;; ------------------------------------ ;; | ||
| 70 : | (defmacro connect-element-win (window editor prim eleme) | ||
| 71 : | `(put-winprop ,window 'button-press-handler | ||
| 72 : | (function | ||
| 73 : | (lambda (win code x y) | ||
| 74 : | (select-window win code x y) | ||
| 75 : | (put-winprop | ||
| 76 : | ,editor | ||
| 77 : | 'button-press-handler | ||
| 78 : | (function | ||
| 79 : | (lambda (win code x y) | ||
| 80 : | (setq ,prim | ||
| 81 : | (add-skelton-element win | ||
| 82 : | code x y | ||
| 83 : | ,prim ',eleme))))))))) | ||
| 84 : | |||
| 85 : | ;; ----------- ;; | ||
| 86 : | ;; initializer ;; | ||
| 87 : | ;; ----------- ;; | ||
| 88 : | (defun initialize-skelton-edit-sub () | ||
| 89 : | (comment | ||
| 90 : | (unless (boundp '*near-cos-see-angle*) | ||
| 91 : | (setq *near-cos-see-angle* (cos (//$ (*$ 160.0 (arccos 0.0)) 90.0))))) | ||
| 92 : | |||
| 93 : | (unless (boundp '*near-range*) | ||
| 94 : | (setq *near-range* 400)) | ||
| 95 : | (unless (boundp '*menu-margin*) | ||
| 96 : | (setq *menu-margin* 2)) | ||
| 97 : | |||
| 98 : | (unless (boundp '*end-mode*) | ||
| 99 : | (setq *end-mode* 3)) | ||
| 100 : | (unless (boundp '*select-nearest*) | ||
| 101 : | (setq *select-nearest* 2)) | ||
| 102 : | (when (or (eq *end-mode* *select-nearest*) | ||
| 103 : | (<= *end-mode* 0) | ||
| 104 : | (<= *select-nearest* 0) | ||
| 105 : | (> *end-mode* 3) | ||
| 106 : | (> *select-nearest* 3)) | ||
| 107 : | (princ "*end-mode* or *select-nearest* out of range... set default") | ||
| 108 : | (terpri) | ||
| 109 : | (setq *select-nearest* 2) | ||
| 110 : | (setq *end-mode* 3)) | ||
| 111 : | |||
| 112 : | (unless (boundp '*link-near-range*) | ||
| 113 : | (setq *link-near-range* 16)) | ||
| 114 : | (unless (boundp '*default-hirawidth*) | ||
| 115 : | (setq *default-hirawidth* 8)) | ||
| 116 : | |||
| 117 : | (unless (boundp '*default-slider-length*) | ||
| 118 : | (setq *default-slider-length* 200)) | ||
| 119 : | |||
| 120 : | (if (or (not (boundp '*range-too-large*)) | ||
| 121 : | (> *near-range* *range-too-large*)) | ||
| 122 : | (setq *range-too-large* (* 10 *near-range*))) | ||
| 123 : | |||
| 124 : | (if (boundp 'editor) | ||
| 125 : | (put-winprop editor 'button-press-handler nil)) | ||
| 126 : | |||
| 127 : | ;; init-status is move-point-selected | ||
| 128 : | (if (and (boundp '*selected-window*) *selected-window*) | ||
| 129 : | (normal-win *selected-window*)) | ||
| 130 : | (setq *selected-window* nil) | ||
| 131 : | ) | ||
| 132 : | |||
| 133 : | ;; ---------------- ;; | ||
| 134 : | ;; window selection ;; | ||
| 135 : | ;; ---------------- ;; | ||
| 136 : | (defun select-window (win code x y) | ||
| 137 : | (cond ((neq win *selected-window*) | ||
| 138 : | (if *selected-window* (normal-win *selected-window*)) | ||
| 139 : | (setq *selected-window* win) | ||
| 140 : | (highlight-win *selected-window*))) | ||
| 141 : | (display-force-output (window-display win)) | ||
| 142 : | |||
| 143 : | (setf (window-event-mask editor) '(:exposure | ||
| 144 : | :pointer-motion | ||
| 145 : | :button-release | ||
| 146 : | :button-press)) | ||
| 147 : | (put-winprop editor 'button-press-handler nil) | ||
| 148 : | (put-winprop editor 'button-release-handler nil) | ||
| 149 : | (put-winprop editor 'motion-notify-handler nil) | ||
| 150 : | (redraw-win editor)) | ||
| 151 : | |||
| 152 : | ;; -------------- ;; | ||
| 153 : | ;; motion-handler ;; | ||
| 154 : | ;; -------------- ;; | ||
| 155 : | (defun print-pointer-position (win x y) | ||
| 156 : | (print (list win x y))) | ||
| 157 : | |||
| 158 : | ;; -------------- ;; | ||
| 159 : | ;; window example ;; | ||
| 160 : | ;; -------------- ;; | ||
| 161 : | (defun initialize-skelton-editor () | ||
| 162 : | (ulx-magic) | ||
| 163 : | (setup-display) | ||
| 164 : | (print 'setup-display) | ||
| 165 : | |||
| 166 : | (initialize-skelton-edit-sub) | ||
| 167 : | (print 'initialize) | ||
| 168 : | |||
| 169 : | (make-skeledit-windows) | ||
| 170 : | |||
| 171 : | (map-subwindows base) | ||
| 172 : | (map-subwindows base2) | ||
| 173 : | (map-subwindows width-sliders) | ||
| 174 : | (map-subwindows skeleditor) | ||
| 175 : | (map-window skeleditor)) | ||
| 176 : | |||
| 177 : | (defun joint-primitive-? (prim) | ||
| 178 : | (and (listp prim) (eq (car prim) 'joint))) | ||
| 179 : | |||
| 180 : | (defun initialize-edittee (name) | ||
| 181 : | (setf (window-cursor editor) please-wait-cursor) | ||
| 182 : | (put-winprop editor 'motion-notify-handler #'(lambda (win x y))) | ||
| 183 : | (display-force-output display) | ||
| 184 : | |||
| 185 : | (cond ((and (symbolp name) (not (null name))) | ||
| 186 : | (setq joint-prim-symbol name) | ||
| 187 : | (setq joint-prim-def (recursive-copy (expandkanji joint-prim-symbol))) | ||
| 188 : | (setq niti joint-prim-def) | ||
| 189 : | |||
| 190 : | (unless (joint-primitive-? niti) | ||
| 191 : | (setq edittee-name name) | ||
| 192 : | (if (boundp 'edittee-name) | ||
| 193 : | (push edittee-name edittee-history)) | ||
| 194 : | (setq niti (make-link-ok-from-old-version | ||
| 195 : | (zahyou-flonum->fixnum (applykanji name)))) | ||
| 196 : | (if (not (pure-primitive-name? name)) | ||
| 197 : | (setq edittee-sub-primitives | ||
| 198 : | (get-affine-of-kumiawased-primitive (eval name))) | ||
| 199 : | (setq edittee-sub-primitives nil)))) | ||
| 200 : | (t | ||
| 201 : | (setq edittee-name 'unknown-primitive) | ||
| 202 : | (setq niti name) | ||
| 203 : | (setq joint-prim-def name) | ||
| 204 : | (setq edittee-sub-primitives nil))) | ||
| 205 : | |||
| 206 : | (print (list 'niti niti)) | ||
| 207 : | (print (list 'joint-prim-def joint-prim-def)) | ||
| 208 : | |||
| 209 : | (setf (window-cursor editor) hair-cross-cursor) | ||
| 210 : | (handle-button-press move-point 1 0 0) | ||
| 211 : | |||
| 212 : | (comment (prind niti) | ||
| 213 : | (prind joint-prim-def)) | ||
| 214 : | (clear-win editor) | ||
| 215 : | (draw-skelton-win editor | ||
| 216 : | (if (and (listp joint-prim-def) | ||
| 217 : | (eq (car joint-prim-def) 'joint)) | ||
| 218 : | joint-prim-def | ||
| 219 : | niti)) | ||
| 220 : | (redraw-win editor) | ||
| 221 : | |||
| 222 : | (display-force-output display)) | ||
| 223 : | |||
| 224 : | (defun save-edittee-to-file (output-file-name message) | ||
| 225 : | (call (string-append "touch " output-file-name)) | ||
| 226 : | (call (string-append "chmod og+w " output-file-name)) | ||
| 227 : | (let* ((standard-output | ||
| 228 : | (appendopen (stream output-file-name)))) | ||
| 229 : | (prind (list 'comment edittee-name | ||
| 230 : | (getenv "USER") (date-time) | ||
| 231 : | (cond ((pure-primitive-name? edittee-name) | ||
| 232 : | 'pure-primitive) | ||
| 233 : | ((eq (car niti) 'joint) | ||
| 234 : | 'jointed-primitives) | ||
| 235 : | (t 'composite-primitive)))) | ||
| 236 : | |||
| 237 : | (if (neq (car niti) 'joint) | ||
| 238 : | (prind (list (if (pure-primitive-name? edittee-name) | ||
| 239 : | 'setq | ||
| 240 : | 'comment) | ||
| 241 : | edittee-name (list 'quote niti))) | ||
| 242 : | (print-in-detail (list (if (pure-primitive-name? edittee-name) | ||
| 243 : | 'setq | ||
| 244 : | 'comment) | ||
| 245 : | edittee-name (list 'quote niti))) | ||
| 246 : | (terpri)) | ||
| 247 : | |||
| 248 : | (terpri) | ||
| 249 : | (close standard-output)) | ||
| 250 : | (print-message-win | ||
| 251 : | message | ||
| 252 : | (zenkaku-string | ||
| 253 : | (string-append "「" (string edittee-name) | ||
| 254 : | "」を" output-file-name "に出力しました"))) | ||
| 255 : | (redraw-win message) | ||
| 256 : | (display-force-output display))) | ||
| 257 : | |||
| 258 : | (defun skelton-edit ((niti '(nil nil)) (opname "/tmp/prim.out")) | ||
| 259 : | (initialize-skelton-edit-sub) | ||
| 260 : | |||
| 261 : | (clear-win message) | ||
| 262 : | |||
| 263 : | (setq edittee-history nil) | ||
| 264 : | (initialize-edittee niti) | ||
| 265 : | |||
| 266 : | (setq output-file-name opname) | ||
| 267 : | |||
| 268 : | (print 'initialize) | ||
| 269 : | |||
| 270 : | (main-loop display | ||
| 271 : | #'(lambda () (eq *selected-window* syuuryou)) | ||
| 272 : | editor) | ||
| 273 : | |||
| 274 : | (setq niti (shapeup-skelton niti)) | ||
| 275 : | (display-force-output display) | ||
| 276 : | niti) | ||
| 277 : | |||
| 278 : | (defun connect-window-handlers () | ||
| 279 : | |||
| 280 : | (put-winprop move-point 'button-press-handler | ||
| 281 : | #'(lambda (win code x y) | ||
| 282 : | (select-window win code x y) | ||
| 283 : | (put-winprop | ||
| 284 : | editor | ||
| 285 : | 'button-press-handler | ||
| 286 : | (function | ||
| 287 : | (lambda (win code x y) | ||
| 288 : | (setq niti | ||
| 289 : | (move-skelton-point win code x y niti))))))) | ||
| 290 : | |||
| 291 : | (put-winprop toggle-link 'button-press-handler | ||
| 292 : | #'(lambda (win code x y) | ||
| 293 : | (select-window win code x y) | ||
| 294 : | (put-winprop | ||
| 295 : | editor | ||
| 296 : | 'button-press-handler | ||
| 297 : | (function | ||
| 298 : | (lambda (win code x y) | ||
| 299 : | (setq niti | ||
| 300 : | (toggle-skelton-link win | ||
| 301 : | code x y niti))))))) | ||
| 302 : | |||
| 303 : | |||
| 304 : | (put-winprop delete-element 'button-press-handler | ||
| 305 : | #'(lambda (win code x y) | ||
| 306 : | (select-window win code x y) | ||
| 307 : | (put-winprop | ||
| 308 : | editor | ||
| 309 : | 'motion-notify-handler | ||
| 310 : | #'(lambda (win x y) | ||
| 311 : | (nearest-line-dotted win x y niti))) | ||
| 312 : | (put-winprop | ||
| 313 : | editor | ||
| 314 : | 'button-press-handler | ||
| 315 : | (function | ||
| 316 : | (lambda (win code x y) | ||
| 317 : | (setq niti | ||
| 318 : | (delete-skelton-element win | ||
| 319 : | code x y niti))))) | ||
| 320 : | (setf (window-event-mask editor) '(:exposure | ||
| 321 : | :button-press | ||
| 322 : | :pointer-motion)))) | ||
| 323 : | |||
| 324 : | (put-winprop nikuduke-min 'button-press-handler | ||
| 325 : | #'(lambda (win code x y) | ||
| 326 : | (select-window win code x y) | ||
| 327 : | (setf (window-cursor editor) please-wait-cursor) | ||
| 328 : | (setf (window-cursor win) please-wait-cursor) | ||
| 329 : | (display-force-output (window-display editor)) | ||
| 330 : | (setq niti (shapeup-skelton niti)) | ||
| 331 : | (draw-nikuduked-skelton editor niti 'mincho) | ||
| 332 : | (setf (window-cursor editor) hair-cross-cursor) | ||
| 333 : | (setf (window-cursor win) roupe-cursor) | ||
| 334 : | (display-force-output (window-display editor)))) | ||
| 335 : | |||
| 336 : | |||
| 337 : | (put-winprop nikuduke-got 'button-press-handler | ||
| 338 : | #'(lambda (win code x y) | ||
| 339 : | (select-window win code x y) | ||
| 340 : | (setf (window-cursor editor) please-wait-cursor) | ||
| 341 : | (setf (window-cursor win) please-wait-cursor) | ||
| 342 : | (display-force-output (window-display editor)) | ||
| 343 : | (setq niti (shapeup-skelton niti)) | ||
| 344 : | (draw-nikuduked-skelton editor niti 'gothic) | ||
| 345 : | (setf (window-cursor editor) hair-cross-cursor) | ||
| 346 : | (setf (window-cursor win) roupe-cursor) | ||
| 347 : | (display-force-output (window-display editor)))) | ||
| 348 : | |||
| 349 : | (put-winprop hira-width 'button-press-handler | ||
| 350 : | #'(lambda (win code x y) | ||
| 351 : | (select-window win code x y) | ||
| 352 : | (put-winprop | ||
| 353 : | editor | ||
| 354 : | 'button-press-handler | ||
| 355 : | #'(lambda (win code x y) | ||
| 356 : | (setq niti | ||
| 357 : | (change-hira-width win code x y niti)))))) | ||
| 358 : | |||
| 359 : | (put-winprop hira-lengthen 'button-press-handler | ||
| 360 : | #'(lambda (win code x y) | ||
| 361 : | (select-window win code x y) | ||
| 362 : | (put-winprop | ||
| 363 : | editor | ||
| 364 : | 'motion-notify-handler | ||
| 365 : | #'(lambda (win x y) | ||
| 366 : | (nearest-line-dotted win x y niti))) | ||
| 367 : | (put-winprop | ||
| 368 : | editor | ||
| 369 : | 'button-press-handler | ||
| 370 : | #'(lambda (win code x y) | ||
| 371 : | (setq niti | ||
| 372 : | (make-hira-element-long win code x y niti)))) | ||
| 373 : | (setf (window-event-mask editor) '(:exposure | ||
| 374 : | :button-release | ||
| 375 : | :button-press | ||
| 376 : | :pointer-motion)))) | ||
| 377 : | |||
| 378 : | (put-winprop nop-nop-nop 'enter-notify-handler nil) | ||
| 379 : | (put-winprop nop-nop-nop 'leave-notify-handler nil) | ||
| 380 : | |||
| 381 : | (put-winprop part-move 'button-press-handler | ||
| 382 : | #'(lambda (win code x y) | ||
| 383 : | (select-window win code x y) | ||
| 384 : | (put-winprop | ||
| 385 : | editor | ||
| 386 : | 'button-press-handler | ||
| 387 : | #'(lambda (win code x y) | ||
| 388 : | (setq niti | ||
| 389 : | (move-some-points win code x y niti)))))) | ||
| 390 : | |||
| 391 : | (put-winprop part-resize 'button-press-handler | ||
| 392 : | #'(lambda (win code x y) | ||
| 393 : | (select-window win code x y) | ||
| 394 : | (put-winprop | ||
| 395 : | editor | ||
| 396 : | 'button-press-handler | ||
| 397 : | #'(lambda (win code x y) | ||
| 398 : | (setq niti | ||
| 399 : | (resize-some-points win code x y niti)))))) | ||
| 400 : | |||
| 401 : | (put-winprop kumiawase 'button-press-handler | ||
| 402 : | #'(lambda (win code x y) | ||
| 403 : | (select-window win code x y) | ||
| 404 : | (let ((name (read-string-from-kinput skeleditor))) | ||
| 405 : | (if (> (string-length name) 2) | ||
| 406 : | (setq name (substring name 0 2))) | ||
| 407 : | (setq name (intern name)) | ||
| 408 : | (print name) | ||
| 409 : | (cond ((boundp name) | ||
| 410 : | (setf (window-cursor editor) please-wait-cursor) | ||
| 411 : | (setf (window-cursor win) please-wait-cursor) | ||
| 412 : | (display-force-output (window-display editor)) | ||
| 413 : | (draw-nikuduked-skelton editor | ||
| 414 : | (applykanji name) | ||
| 415 : | 'mincho) | ||
| 416 : | (setf (window-cursor editor) hair-cross-cursor) | ||
| 417 : | (setf (window-cursor win) roupe-cursor)) | ||
| 418 : | (t | ||
| 419 : | (beep editor)))))) | ||
| 420 : | |||
| 421 : | (put-winprop next-edittee 'button-press-handler | ||
| 422 : | #'(lambda (win code x y) | ||
| 423 : | (select-window win code x y) | ||
| 424 : | (save-edittee-to-file output-file-name message) | ||
| 425 : | |||
| 426 : | (let ((name (read-string-from-kinput skeleditor))) | ||
| 427 : | (loop | ||
| 428 : | (if (boundp (intern name)) | ||
| 429 : | (exit)) | ||
| 430 : | (setq name (read-string-from-kinput skeleditor))) | ||
| 431 : | (initialize-edittee (intern name))))) | ||
| 432 : | |||
| 433 : | (put-winprop syuuryou 'button-press-handler | ||
| 434 : | #'(lambda (win code x y) | ||
| 435 : | (select-window win code x y) | ||
| 436 : | (save-edittee-to-file output-file-name message) | ||
| 437 : | )) | ||
| 438 : | |||
| 439 : | (put-winprop sub-prim-edit 'button-press-handler | ||
| 440 : | #'(lambda (win code x y) | ||
| 441 : | (when edittee-sub-primitives | ||
| 442 : | (select-window win code x y) | ||
| 443 : | (setq %sub-primitive-name% nil) | ||
| 444 : | (put-winprop editor 'motion-notify-handler | ||
| 445 : | #'(lambda (win x y) | ||
| 446 : | (nearest-sub-primitive-boxed win x y))) | ||
| 447 : | (put-winprop | ||
| 448 : | editor 'button-press-handler | ||
| 449 : | #'(lambda (win code x y) | ||
| 450 : | (let ((next (sub-primitive-info-current-xy x y))) | ||
| 451 : | (save-edittee-to-file output-file-name | ||
| 452 : | message) | ||
| 453 : | (initialize-edittee (car next))))) | ||
| 454 : | |||
| 455 : | (setf (window-event-mask editor) | ||
| 456 : | '(:exposure | ||
| 457 : | :button-press | ||
| 458 : | :pointer-motion))))) | ||
| 459 : | |||
| 460 : | (put-winprop motohe-modoru 'button-press-handler | ||
| 461 : | #'(lambda (win code x y) | ||
| 462 : | (print edittee-history) | ||
| 463 : | (cond ((>= (length edittee-history) 2) | ||
| 464 : | (select-window win code x y) | ||
| 465 : | (save-edittee-to-file output-file-name message) | ||
| 466 : | (pop edittee-history) | ||
| 467 : | (comment print edittee-history) | ||
| 468 : | (let ((next (pop edittee-history))) | ||
| 469 : | (comment print (list 'next next)) | ||
| 470 : | (initialize-edittee next)))))) | ||
| 471 : | |||
| 472 : | (put-winprop hira-long-pnt-add 'button-press-handler | ||
| 473 : | #'(lambda (win code x y) | ||
| 474 : | (select-window win code x y) | ||
| 475 : | (setup-add-hira-point) | ||
| 476 : | (put-winprop editor 'button-press-handler | ||
| 477 : | #'(lambda (win code x y) | ||
| 478 : | (setq niti | ||
| 479 : | (add-hira-point win x y niti)))))) | ||
| 480 : | |||
| 481 : | (put-winprop | ||
| 482 : | set-joint-prim-name 'button-press-handler | ||
| 483 : | #'(lambda (win code x y) | ||
| 484 : | (select-window win code x y) | ||
| 485 : | (save-edittee-to-file output-file-name message) | ||
| 486 : | (setq joint-prim-name | ||
| 487 : | (do ((newname (read-string-from-kinput skeleditor) | ||
| 488 : | (read-string-from-kinput skeleditor)) | ||
| 489 : | (shortname "") | ||
| 490 : | (ret nil)) | ||
| 491 : | ((progn | ||
| 492 : | (if (<= 2 (string-length newname)) | ||
| 493 : | (setq shortname (substring newname 0 2)) | ||
| 494 : | (setq shortname "")) | ||
| 495 : | (cond ((boundp (intern newname)) | ||
| 496 : | (setq ret newname)) | ||
| 497 : | ((boundp (intern shortname)) | ||
| 498 : | (setq ret shortname))) | ||
| 499 : | ret) | ||
| 500 : | ret) | ||
| 501 : | (beep win))) | ||
| 502 : | (initialize-edittee (intern joint-prim-name)) | ||
| 503 : | (comment progn | ||
| 504 : | (print-message-win | ||
| 505 : | message | ||
| 506 : | (zenkaku-string (string-append "組合せの名前を「" joint-prim-name | ||
| 507 : | "」に設定しました"))) | ||
| 508 : | (setq joint-prim-symbol (intern joint-prim-name)) | ||
| 509 : | (setq edittee-name joint-prim-symbol) | ||
| 510 : | (cond ((eq (car (eval joint-prim-symbol)) 'joint) | ||
| 511 : | (setq joint-prim-def (eval joint-prim-symbol))) | ||
| 512 : | (t | ||
| 513 : | (setq joint-prim-def (expandkanji joint-prim-symbol)))) | ||
| 514 : | (prind joint-prim-def) | ||
| 515 : | (setq niti joint-prim-def)) | ||
| 516 : | |||
| 517 : | (clear-win editor) | ||
| 518 : | (draw-jointed-primitive-win editor joint-prim-def) | ||
| 519 : | (redisplay-win editor))) | ||
| 520 : | |||
| 521 : | (put-winprop | ||
| 522 : | move-joint-prim 'button-press-handler | ||
| 523 : | #'(lambda (win code x y) | ||
| 524 : | (select-window win code x y) | ||
| 525 : | (put-winprop editor 'button-press-handler | ||
| 526 : | #'(lambda (win code x y) | ||
| 527 : | (setq joint-prim-def | ||
| 528 : | (move-primitive-of-jointed-primitive | ||
| 529 : | win code x y)) | ||
| 530 : | (setq niti joint-prim-def))))) | ||
| 531 : | |||
| 532 : | (put-winprop | ||
| 533 : | resize-joint-prim 'button-press-handler | ||
| 534 : | #'(lambda (win code x y) | ||
| 535 : | (select-window win code x y) | ||
| 536 : | (put-winprop editor 'button-press-handler | ||
| 537 : | #'(lambda (win code x y) | ||
| 538 : | (setq joint-prim-def | ||
| 539 : | (resize-primitive-of-jointed-primitive | ||
| 540 : | win code x y)) | ||
| 541 : | (setq niti joint-prim-def))))) | ||
| 542 : | |||
| 543 : | (put-winprop | ||
| 544 : | nikuduke-joint-prim 'button-press-handler | ||
| 545 : | #'(lambda (win code x y) | ||
| 546 : | (select-window win code x y) | ||
| 547 : | (draw-nikuduked-skelton-win! editor | ||
| 548 : | joint-prim-def | ||
| 549 : | 'mincho))) | ||
| 550 : | |||
| 551 : | (put-winprop hira-shorten 'button-press-handler | ||
| 552 : | #'(lambda (win code x y) | ||
| 553 : | (select-window win code x y) | ||
| 554 : | (setup-del-hira-point) | ||
| 555 : | (put-winprop editor 'button-press-handler | ||
| 556 : | #'(lambda (win code x y) | ||
| 557 : | (setq niti | ||
| 558 : | (del-hira-point editor x y niti)))))) | ||
| 559 : | |||
| 560 : | (put-winprop etc-2 'button-press-handler | ||
| 561 : | #'(lambda (win code x y) | ||
| 562 : | (select-window win code x y))) | ||
| 563 : | |||
| 564 : | (connect-element-win add-ten editor niti ten) | ||
| 565 : | (connect-element-win add-tate editor niti tate) | ||
| 566 : | (connect-element-win add-yoko editor niti yoko) | ||
| 567 : | (connect-element-win add-migiue editor niti migiue) | ||
| 568 : | (connect-element-win add-hidari editor niti hidari) | ||
| 569 : | |||
| 570 : | (connect-element-win add-tatehidari editor niti tatehidari) | ||
| 571 : | (connect-element-win add-migi editor niti migi) | ||
| 572 : | (connect-element-win add-kozato editor niti kozato) | ||
| 573 : | (connect-element-win add-tatehane editor niti tatehane) | ||
| 574 : | (connect-element-win add-tsukurihane editor niti tsukurihane) | ||
| 575 : | |||
| 576 : | (connect-element-win add-sanzui editor niti sanzui) | ||
| 577 : | (connect-element-win add-kokoro editor niti kokoro) | ||
| 578 : | (connect-element-win add-tasuki editor niti tasuki) | ||
| 579 : | (connect-element-win add-magaritate editor niti magaritate) | ||
| 580 : | (connect-element-win add-kagi editor niti kagi) | ||
| 581 : | |||
| 582 : | (connect-element-win add-shinnyuu editor niti shin-nyuu) | ||
| 583 : | |||
| 584 : | (connect-element-win add-hira-long editor niti hira-long) | ||
| 585 : | (connect-element-win add-hira-short editor niti hira-short) | ||
| 586 : | (connect-element-win add-hira-maru editor niti hira-circle) | ||
| 587 : | |||
| 588 : | (put-winprop editor 'button-press-handler nil) | ||
| 589 : | nil) | ||
| 590 : | |||
| 591 : | (defun make-skeledit-windows () | ||
| 592 : | (setq skeleditor (create-win root 0 0 10 10 black white kanji-font)) | ||
| 593 : | (setf (window-event-mask skeleditor) '(:exposure :property-change)) | ||
| 594 : | (setf (wm-name skeleditor) "skelton editor") | ||
| 595 : | (print 'skeleditor) | ||
| 596 : | |||
| 597 : | (progn | ||
| 598 : | (setq base (create-menu skeleditor 0 0 black white | ||
| 599 : | kanji-font roupe-cursor | ||
| 600 : | (move-point "点の移動") | ||
| 601 : | (toggle-link "点の接続/非接続") | ||
| 602 : | (delete-element "線の削除") | ||
| 603 : | (nikuduke-min "肉付(明朝)") | ||
| 604 : | (nikuduke-got "肉付(ゴシック)") | ||
| 605 : | (add-ten "・点") | ||
| 606 : | (add-tate "・縦棒") | ||
| 607 : | (add-yoko "・横棒") | ||
| 608 : | (add-migiue "・右上はね") | ||
| 609 : | (add-hidari "・左はらい") | ||
| 610 : | (add-tatehidari "・縦棒左はらい") | ||
| 611 : | (add-migi "・右はらい") | ||
| 612 : | (add-kozato "・こざとの一部") | ||
| 613 : | (add-tatehane "・たてはね") | ||
| 614 : | (add-tsukurihane "・つくりはね") | ||
| 615 : | (add-sanzui "・さんずいの一部") | ||
| 616 : | (add-kokoro "・心の一部") | ||
| 617 : | (add-tasuki "・たすき") | ||
| 618 : | (add-magaritate "・曲がり縦棒") | ||
| 619 : | (add-kagi "・かぎ") | ||
| 620 : | (add-shinnyuu "・しんにゅう"))) | ||
| 621 : | |||
| 622 : | (setq base2 (create-menu skeleditor | ||
| 623 : | (+ *menu-margin* (width-win base)) 0 | ||
| 624 : | black white kanji-font roupe-cursor | ||
| 625 : | (hira-width "平仮名の太さ") | ||
| 626 : | (add-hira-long "・長い平仮名") | ||
| 627 : | (add-hira-short "・短い平仮名") | ||
| 628 : | (add-hira-maru "・ぱぴぷぺぽの丸") | ||
| 629 : | (hira-lengthen "平仮名を長くする") | ||
| 630 : | (hira-long-pnt-add "平仮名の点を追加") | ||
| 631 : | (hira-shorten "平仮名の点を削除") | ||
| 632 : | |||
| 633 : | (part-move "一部を平行移動") | ||
| 634 : | (part-resize "一部を拡大縮小") | ||
| 635 : | |||
| 636 : | (kumiawase "?組合せ表示?") | ||
| 637 : | (next-edittee "新しい漢字の編集") | ||
| 638 : | (sub-prim-edit "プリミティブ編集") | ||
| 639 : | (motohe-modoru "一つ前の漢字編集") | ||
| 640 : | |||
| 641 : | (nop-nop-nop "一一一一一一一一") | ||
| 642 : | (set-joint-prim-name "組合せの名前設定") | ||
| 643 : | (move-joint-prim "組合せ内の移動") | ||
| 644 : | (resize-joint-prim "組合せ内の拡縮") | ||
| 645 : | (nikuduke-joint-prim "組合せの肉付け") | ||
| 646 : | |||
| 647 : | (etc-1 "テスト用1") | ||
| 648 : | (etc-2 "テスト用2") | ||
| 649 : | (syuuryou "終わり"))) | ||
| 650 : | ) | ||
| 651 : | |||
| 652 : | (setf (window-event-mask base) '(:exposure)) | ||
| 653 : | (setf (window-event-mask base2) '(:exposure)) | ||
| 654 : | (print 'base) | ||
| 655 : | |||
| 656 : | (setq editor (create-win skeleditor | ||
| 657 : | (+ (width-win base) *menu-margin* | ||
| 658 : | (width-win base2) *menu-margin*) | ||
| 659 : | 0 | ||
| 660 : | 400 400 black white kanji-font)) | ||
| 661 : | (setf (window-event-mask editor) '(:exposure :button-press)) | ||
| 662 : | (setf (window-cursor editor) hair-cross-cursor) | ||
| 663 : | (print 'editor) | ||
| 664 : | |||
| 665 : | (setq width-sliders | ||
| 666 : | (create-slider-menu skeleditor | ||
| 667 : | 0 | ||
| 668 : | (+ (max (height-win base) | ||
| 669 : | (height-win base2) | ||
| 670 : | (height-win editor)) | ||
| 671 : | *menu-margin*) | ||
| 672 : | black white kanji-font | ||
| 673 : | (min-wid "明朝基準太さ " | ||
| 674 : | 5.0 30.0 'minchowidth 20.0) | ||
| 675 : | (got-wid "ゴシック基準太さ" | ||
| 676 : | 5.0 30.0 'gothicwidth 13.0) | ||
| 677 : | (hir-wid "平仮名基準太さ " | ||
| 678 : | 0.0 1.5 'hirawidth 0.6))) | ||
| 679 : | (print 'sliders) | ||
| 680 : | |||
| 681 : | (setq message (create-win skeleditor | ||
| 682 : | 0 | ||
| 683 : | (+ (drawable-y width-sliders) *menu-margin* | ||
| 684 : | (height-win width-sliders)) | ||
| 685 : | 600 50 black white kanji-font)) | ||
| 686 : | (print 'message) | ||
| 687 : | |||
| 688 : | (resize-win skeleditor | ||
| 689 : | (max (+ (width-win base) (width-win base2) | ||
| 690 : | (width-win editor) (* *menu-margin* 4)) | ||
| 691 : | (width-win message)) | ||
| 692 : | (max (+ (max (height-win base) (height-win base2) | ||
| 693 : | (height-win editor)) | ||
| 694 : | (height-win width-sliders) | ||
| 695 : | (height-win message) | ||
| 696 : | (* *menu-margin* 4)) | ||
| 697 : | (height-win skeleditor))) | ||
| 698 : | |||
| 699 : | (connect-window-handlers)) | ||
| 700 : | |||
| 701 : | (defun print-in-detail (p) | ||
| 702 : | (cond ((stringp p) (prind p) (princ " ")) | ||
| 703 : | ((vectorp p) | ||
| 704 : | (princ "#(") | ||
| 705 : | (do ((len (vector-length p)) | ||
| 706 : | (i 0 (1+ i))) | ||
| 707 : | ((>= i len)) | ||
| 708 : | (print-in-detail (vref p i)) | ||
| 709 : | (princ " ")) | ||
| 710 : | (princ ") ")) | ||
| 711 : | ((listp p) | ||
| 712 : | (princ "(") | ||
| 713 : | (let ((last (do ((rest p (cdr rest))) | ||
| 714 : | ((endp rest) rest) | ||
| 715 : | (print-in-detail (car rest))))) | ||
| 716 : | (if (null last) | ||
| 717 : | (princ ") ") | ||
| 718 : | (princ " . ") | ||
| 719 : | (princ last) | ||
| 720 : | (princ " ) ")))) | ||
| 721 : | ((atom p) (princ p) (princ " ")) | ||
| 722 : | (t (prind p))) | ||
| 723 : | nil) | ||
| 724 : | |||
| 725 : | (defun main-test () | ||
| 726 : | (initialize-skelton-editor) | ||
| 727 : | (skelton-edit kanoji)) | ||
| 728 : | |||
| 729 : | ;; | ||
| 730 : | ;; (defun takobeya () | ||
| 731 : | ;; (initialize-skelton-editor) | ||
| 732 : | ;; (setq boo (skelton-edit boo)) | ||
| 733 : | ;; (setq foo (skelton-edit foo)) | ||
| 734 : | ;; (setq woo (skelton-edit woo)) | ||
| 735 : | ;; ... | ||
| 736 : | ;; | ||
| 737 : |
|
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |