File: _monitor.tcl

package info (click to toggle)
openmsx 0.10.1-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,628 kB
  • ctags: 19,723
  • sloc: cpp: 131,938; xml: 25,418; tcl: 15,394; python: 4,012; sh: 365; makefile: 26
file content (57 lines) | stat: -rw-r--r-- 1,795 bytes parent folder | download | duplicates (5)
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
namespace eval monitor {

variable monitors

set_help_text monitor_type \
{Select a monitor color profile.

Usage:
  monitor_type          Shows the current profile
  monitor_type -list    Show all possible types
  monitor_type <type>   Select new type
}

set_tabcompletion_proc monitor_type [namespace code tab_monitor_type]
proc tab_monitor_type {args} {
	variable monitors
	set result [dict keys $monitors]
	lappend result "-list"
}

dict set monitors normal {{ 1 0 0 } { 0 1 0 } { 0 0 1 }}
dict set monitors red    {{ 1 0 0 } { 0 0 0 } { 0 0 0 }}
dict set monitors green  {{ 0 0 0 } { 0 1 0 } { 0 0 0 }}
dict set monitors blue   {{ 0 0 0 } { 0 0 0 } { 0 0 1 }}
dict set monitors monochrome_amber        {{ .257 .504 .098 } { .193 .378 .073 } { 0 0 0 }}
dict set monitors monochrome_amber_bright {{ .333 .333 .333 } { .249 .249 .249 } { 0 0 0 }}
dict set monitors monochrome_green        {{ .129 .252 .049 } { .257 .504 .098 } { .129 .252 .049 }}
dict set monitors monochrome_green_bright {{ .167 .167 .167 } { .333 .333 .333 } { .167 .167 .167 }}
dict set monitors monochrome_white        {{ .257 .504 .098 } { .257 .504 .098 } { .257 .504 .098 }}
dict set monitors monochrome_white_bright {{ .333 .333 .333 } { .333 .333 .333 } { .333 .333 .333 }}

proc monitor_type {{monitor ""}} {
	variable monitors

	if {$monitor eq ""} {
		dict for {type matrix} $monitors {
			if {$matrix eq $::color_matrix} {
				return $type
			}
		}
		return "Custom monitor type: $::color_matrix"
	} elseif {$monitor eq "-list"} {
		return [dict keys $monitors]
	} else {
		if {[dict exists $monitors $monitor]} {
			set ::color_matrix [dict get $monitors $monitor]
		} else {
			error "No such monitor type: $monitor"
		}
	}
}

namespace export monitor_type

} ;# namespace monitor

namespace import monitor::*