IUP

Check-in [29b6ecd883]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Racket bindings for IUP configuration file support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 29b6ecd883fb976fcd32b994dcc2361bd545d588
User & Date: murphy 2015-05-03 22:28:58
Context
2015-05-03
22:42
Documentation updates check-in: c17663e4bf user: murphy tags: trunk, v1.6.0
22:28
Racket bindings for IUP configuration file support check-in: 29b6ecd883 user: murphy tags: trunk
22:28
Corrected native menu constructor call in Racket binding check-in: b9de6e58fe user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added racket/config.rkt.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#lang racket
(require
 srfi/26
 ffi/unsafe
 "base.rkt")

(define libiup
  (case (system-type 'os)
    [(windows)
     (ffi-lib "iup")]
    [else
     (ffi-lib "libiup")]))

;; Configuration component

(define config
  (make-constructor-procedure
   (get-ffi-obj
    "IupConfig" libiup
    (_fun -> [handle : _ihandle]))))

(struct exn:fail:filesystem:config exn:fail:filesystem (status)
  #:transparent)

(define (make-exn:fail:filesystem:config status continuation-marks)
  (exn:fail:filesystem:config
   (case status
     [(-1) "Error opening configuration file"]
     [(-2) "Error accessing configuration file"]
     [(-3) "Error locating configuration file"]
     [else "Error concerning configuration file"])
   continuation-marks status))

(define config-load!
  (get-ffi-obj
   "IupConfigLoad" libiup
   (_fun [handle : _ihandle] -> [status : _int]
         -> (unless (zero? status)
              (raise (make-exn:fail:filesystem:config status (current-continuation-marks)))))))

(define config-save!
  (get-ffi-obj
   "IupConfigSave" libiup
   (_fun [handle : _ihandle] -> [status : _int]
         -> (unless (zero? status)
              (raise (make-exn:fail:filesystem:config status (current-continuation-marks)))))))

;; Configured dialog positions

(define config-dialog-show
  (get-ffi-obj
   "IupConfigDialogShow" libiup
   (_fun [handle : _ihandle] [dialog : _ihandle] [section : _string/utf-8] -> _void)))

(define config-dialog-update!
  (get-ffi-obj
   "IupConfigDialogClosed" libiup
   (_fun [handle : _ihandle] [handle : _ihandle] [section : _string/utf-8] -> _void)))

;; Configured recent files

(define (recent-action-entry handle)
  (let ([action (cond [(and handle (parent handle)) => (cut callback <> 'action)])])
    (if action
        (action handle)
        'continue)))

(define config-recent-menu
  (letrec ([make-menu
            (get-ffi-obj
             "IupMenu" libiup
             (_fun [child : _ihandle/null = #f] -> [handle : _ihandle]))]
           [recent-init!
            (get-ffi-obj
             "IupConfigRecentInit" libiup
             (_fun [handle : _ihandle] [menu : _ihandle]
                   [action : (_fun [handle : _ihandle/null] -> [status : _istatus])]
                   [max-recent : _int]
                   -> _void))])
    (make-constructor-procedure
     (λ (handle max-recent)
       (let ([menu (make-menu)])
         (recent-init! handle menu recent-action-entry max-recent)
         menu)))))

(define config-recent-update!
  (get-ffi-obj
   "IupConfigRecentUpdate" libiup
   (_fun [handle : _ihandle] [path : _string/utf-8] -> _void)))

(provide
 config
 (struct-out exn:fail:filesystem:config) make-exn:fail:filesystem:config
 config-load! config-save!
 config-dialog-show config-dialog-update!
 config-recent-menu config-recent-update!)

Changes to racket/info.rkt.

4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
(define blurb
  '("Bindings to the IUP GUI library"))
(define categories
  '(ui))
(define repositories
  '("4.x"))
(define version
  "1.5.0")
(define release-notes
  '((dl

     (dt "1.5.0") (dd "Windows OLE control")
     (dt "1.4.0") (dd "Various dialogs, controls and extensions")
     (dt "1.3.0") (dd "Additional complex controls")
     (dt "1.2.0") (dd "Additional default dialogs")
     (dt "1.0.1") (dd "Windows linkage tweaks")
     (dt "1.0.0") (dd "Initial release"))))
(define primary-file
  "main.rkt")
(define homepage
  "http://www.chust.org/fossils/iup")







|


>










4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(define blurb
  '("Bindings to the IUP GUI library"))
(define categories
  '(ui))
(define repositories
  '("4.x"))
(define version
  "1.6.0")
(define release-notes
  '((dl
     (dt "1.6.0") (dd "Configuration file support")
     (dt "1.5.0") (dd "Windows OLE control")
     (dt "1.4.0") (dd "Various dialogs, controls and extensions")
     (dt "1.3.0") (dd "Additional complex controls")
     (dt "1.2.0") (dd "Additional default dialogs")
     (dt "1.0.1") (dd "Windows linkage tweaks")
     (dt "1.0.0") (dd "Initial release"))))
(define primary-file
  "main.rkt")
(define homepage
  "http://www.chust.org/fossils/iup")