xcode project rewrite
[openjpeg.git] / jp3d / tcltk / LPI_JP3D_VM.tcl
1 #!/bin/sh
2 # The next line is executed by /bin/sh, but not tcl \
3 exec wish "$0" ${1+"$@"}
4
5 namespace eval jp3dVM {
6
7     variable _progress 0
8     variable _afterid  ""
9     variable _status "Compute in progress..."
10     variable notebook
11     variable mainframe
12     variable dataout "Process execution information"
13     variable status
14     variable prgtext
15     variable prgindic
16
17     set pwd [pwd]
18     cd [file dirname [info script]]
19     variable VMDIR [pwd]
20     cd $pwd
21
22     foreach script {encoder.tcl decoder.tcl} {
23         namespace inscope :: source $VMDIR/$script
24     }
25 }
26
27
28 proc jp3dVM::create { } {
29     variable notebook
30     variable mainframe
31     variable dataout
32
33     bind all <F12> { catch {console show} }
34
35     # Menu description
36     set descmenu {
37         "&File" {} {} 0 {
38             {command "E&xit" {} "Exit BWidget jp3dVM" {} -command exit}
39         }
40         "&Options" {} {} 0 {
41             {command "&Encode" {} "Show encoder" {}
42                 -command  {$jp3dVM::notebook raise [$jp3dVM::notebook page 0]}
43             }
44             {command "&Decode" {} "Show decoder" {}
45                 -command  {$jp3dVM::notebook raise [$jp3dVM::notebook page 1]}
46             }
47         }
48         "&Help" {} {} 0 {
49             {command "&About authors..." {} "Show info about authors" {} 
50                 -command {MessageDlg .msgdlg -parent . -title "About authors" -message " Copyright @ LPI-UVA 2006 " -type ok -icon info}}
51         }
52     }
53
54     set mainframe [MainFrame .mainframe \
55                        -menu         $descmenu \
56                        -textvariable jp3dVM::status \
57                        -progressvar  jp3dVM::prgindic]
58
59     $mainframe addindicator -text "JP3D Verification Model 1.0.0"
60
61     # NoteBook creation
62     set frame    [$mainframe getframe]
63     set notebook [NoteBook $frame.nb]
64
65     set logo [frame $frame.logo]
66     #creo imagen logo
67     image create photo LPIimg -file logoLPI.gif
68     set logoimg [Label $logo.logoimg -image LPIimg]
69     
70     set f0  [VMEncoder::create $notebook]
71     set f1  [VMDecoder::create $notebook]
72
73         set tfinfo [TitleFrame $frame.codinfo -text "Program Execution"]
74         set codinfo [$tfinfo getframe]
75         set sw [ScrolledWindow $codinfo.sw -relief sunken -borderwidth 2 -scrollbar both]
76         set sf [ScrollableFrame $codinfo.sf ]
77         $sw setwidget $sf
78         set subf [$sf getframe]
79         set labinfo [label $subf.labinfo -textvariable jp3dVM::dataout -justify left]
80
81         pack $labinfo -side left 
82         pack $sw 
83
84     $notebook compute_size
85     $notebook raise [$notebook page 0]
86
87     pack $logoimg -side left -fill x -expand yes 
88     pack $notebook -expand yes 
89     pack $logo $tfinfo -side left -expand yes 
90     pack $mainframe -fill both -expand yes
91     update idletasks
92 }
93
94
95 proc jp3dVM::main {} {
96     variable VMDIR
97
98     lappend ::auto_path [file dirname $VMDIR]
99     namespace inscope :: package require BWidget
100
101     option add *TitleFrame.l.font {helvetica 11 bold italic}
102
103     wm withdraw .
104     wm title . "JP3D Verification Model @ LPI"
105
106     jp3dVM::create
107     BWidget::place . 0 0 center
108     wm deiconify .
109     raise .
110     focus -force .
111 }
112
113 jp3dVM::main
114 wm geom . [wm geom .]