Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / demos / widget_lib / mkStyles.pl
CommitLineData
86530b38
AT
1
2
3sub mkStyles {
4
5 # Create a top-level window with a text widget that demonstrates the various display styles that are available in texts.
6
7 $mkStyles->destroy if Exists($mkStyles);
8 $mkStyles = $top->Toplevel();
9 my $w = $mkStyles;
10 dpos $w;
11 $w->title('Text Demonstration - Display Styles');
12 $w->iconname('Text Styles');
13
14 my $w_ok = $w->Button(-text => 'OK', -width => 8, -command => ['destroy', $w]);
15 my $w_t = $w->Text(-setgrid => 'true', -width => 70, -height => 28, -wrap => 'word');
16 my $w_s = $w->Scrollbar(-command => ['yview', $w_t]);
17 $w_t->configure(-yscrollcommand => ['set', $w_s]);
18 $w_ok->pack(-side => 'bottom');
19 $w_s->pack(-side => 'right', -fill => 'y');
20 $w_t->pack(-expand => 'yes', -fill => 'both');
21
22 # Set up display styles.
23
24 $w_t->tag('configure', 'bold', -font => '-Adobe-Courier-Bold-O-Normal--*-120-*-*-*-*-*-*');
25 $w_t->tag('configure', 'big', -font => '-Adobe-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*');
26 $w_t->tag('configure', 'verybig', -font => '-Adobe-Helvetica-Bold-R-Normal--*-240-*-*-*-*-*-*');
27 if ($mkStyles->depth > 1) {
28 $w_t->tag('configure', 'color1', -background => '#eed5b7');
29 $w_t->tag('configure', 'color2', -foreground => 'red');
30 $w_t->tag('configure', 'raised', -background => '#eed5b7', -relief => 'raised', -borderwidth => 1);
31 $w_t->tag('configure', 'sunken', -background => '#eed5b7', -relief => 'sunken', -borderwidth => 1);
32 } else {
33 $w_t->tag('configure', 'color1', -background => 'black', -foreground => 'white');
34 $w_t->tag('configure', 'color2', -background => 'black', -foreground => 'white');
35 $w_t->tag('configure', 'raised', -background => 'white', -relief => 'raised', -borderwidth => 1);
36 $w_t->tag('configure', 'sunken', -background => 'white', -relief => 'sunken', -borderwidth => 1);
37 }
38 $w_t->tag('configure', 'bgstipple', -background => 'black', -borderwidth => 0, -bgstipple => 'gray25');
39 $w_t->tag('configure', 'fgstipple', -fgstipple => 'gray50');
40 $w_t->tag('configure', 'underline', -underline => 'on');
41 $w_t->tag('configure', 'overstrike', -overstrike => 'on');
42 $w_t->tag('configure', 'right', -justify => 'right');
43 $w_t->tag('configure', 'center', -justify => 'center');
44 $w_t->tag('configure', 'super', -offset => '4p', -font => '-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*');
45 $w_t->tag('configure', 'sub', -offset => '-2p', -font => '-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*');
46 $w_t->tag('configure', 'margins', -lmargin1 => '12m', -lmargin2 => '6m', -rmargin => '10m');
47 $w_t->tag('configure', 'spacing', -spacing1 => '10p', -spacing2 => '2p',-lmargin1 => '12m', -lmargin2 => '6m', -rmargin => '10m');
48
49 $w_t->insert('0.0', 'Text widgets like this one allow you to display information in a
50variety of styles. Display styles are controlled using a mechanism
51called ');
52 insert_with_tags($w_t, 'tags', qw(bold));
53 insert_with_tags($w_t, '. Tags are just textual names that you can apply to one
54or more ranges of characters within a text widget. You can configure
55tags with various display styles. If you do this, then the tagged
56characters will be displayed with the styles you chose. The
57available display styles are: ');
58 insert_with_tags($w_t, "\n\n1. Font.", qw(big));
59 insert_with_tags($w_t, ' You can choose any X font, ');
60 insert_with_tags($w_t, 'large', qw(verybig));
61 insert_with_tags($w_t, ' or small.');
62 insert_with_tags($w_t, "\n\n2. Color.", qw(big));
63 insert_with_tags($w_t, ' You can change either the ');
64 insert_with_tags($w_t, 'background', qw(color1));
65 insert_with_tags($w_t, ' or ');
66 insert_with_tags($w_t, 'foreground', qw(color2));
67 insert_with_tags($w_t, "\ncolor, or ");
68 insert_with_tags($w_t, 'both', qw(color1 color2));
69 insert_with_tags($w_t, '.');
70 insert_with_tags($w_t, "\n\n3. Stippling.", qw(big));
71 insert_with_tags($w_t, ' You can cause either the ');
72 insert_with_tags($w_t, 'background', qw(bgstipple));
73 insert_with_tags($w_t, ' or ');
74 insert_with_tags($w_t, 'foreground', qw(fgstipple));
75 insert_with_tags($w_t, "\ninformation to be drawn with a stipple fill instead of a solid fill.");
76 insert_with_tags($w_t, "\n\n4. Underlining.", qw(big));
77 insert_with_tags($w_t, ' You can ');
78 insert_with_tags($w_t, 'underline', qw(underline));
79 insert_with_tags($w_t, ' ranges of text.');
80 insert_with_tags($w_t, "\n\n5. Overstrikes.", 'big');
81 insert_with_tags($w_t, " You can ");
82 insert_with_tags($w_t, "draw lines through", 'overstrike');
83 insert_with_tags($w_t, " ranges of text.");
84 insert_with_tags($w_t, "\n\n6. 3-D effects.", qw( big));
85 insert_with_tags($w_t, " You can arrange for the background to be drawn\n");
86 insert_with_tags($w_t, 'with a border that makes characters appear either ');
87 insert_with_tags($w_t, 'raised', qw(raised));
88 insert_with_tags($w_t, ' or ');
89 insert_with_tags($w_t, 'sunken', qw(sunken));
90 insert_with_tags($w_t, '.');
91 insert_with_tags($w_t, "\n\n7. Justification.", 'big');
92 insert_with_tags($w_t, " You can arrange for lines to be displayed\n");
93 insert_with_tags($w_t, "left-justified,\n");
94 insert_with_tags($w_t, "right-justified, or\n", 'right');
95 insert_with_tags($w_t, "centered.", 'center');
96 insert_with_tags($w_t, "\n\n8. Superscripts and subscripts." , 'big');
97 insert_with_tags($w_t, " You can control the vertical\n");
98 insert_with_tags($w_t, "position of text to generate superscript effects like 10");
99 insert_with_tags($w_t, "n", 'super');
100 insert_with_tags($w_t, " or\nsubscript effects like X");
101 insert_with_tags($w_t, "i", 'sub');
102 insert_with_tags($w_t, ".");
103 insert_with_tags($w_t, "\n\n9. Margins.", 'big');
104 insert_with_tags($w_t, " You can control the amount of extra space left");
105 insert_with_tags($w_t, " on\neach side of the text:\n");
106 insert_with_tags($w_t, "This paragraph is an example of the use of ", 'margins');
107 insert_with_tags($w_t, "margins. It consists of a single line of text ", 'margins');
108 insert_with_tags($w_t, "that wraps around on the screen. There are two ", 'margins');
109 insert_with_tags($w_t, "separate left margin values, one for the first ", 'margins');
110 insert_with_tags($w_t, "display line associated with the text line, ", 'margins');
111 insert_with_tags($w_t, "and one for the subsequent display lines, which ", 'margins');
112 insert_with_tags($w_t, "occur because of wrapping. There is also a ", 'margins');
113 insert_with_tags($w_t, "separate specification for the right margin, ", 'margins');
114 insert_with_tags($w_t, "which is used to choose wrap points for lines.", 'margins');
115 insert_with_tags($w_t, "\n\n10. Spacing.", 'big');
116 insert_with_tags($w_t, " You can control the spacing of lines with three\n");
117 insert_with_tags($w_t, "separate parameters. \"Spacing1\" tells how much ");
118 insert_with_tags($w_t, "extra space to leave\nabove a line, \"spacing3\" ");
119 insert_with_tags($w_t, "tells how much space to leave below a line,\nand ");
120 insert_with_tags($w_t, "if a text line wraps, \"spacing2\" tells how much ");
121 insert_with_tags($w_t, "space to leave\nbetween the display lines that ");
122 insert_with_tags($w_t, "make up the text line.\n");
123 insert_with_tags($w_t, "These indented paragraphs illustrate how spacing ", 'spacing');
124 insert_with_tags($w_t, "can be used. Each paragraph is actually a ", 'spacing');
125 insert_with_tags($w_t, "single line in the text widget, which is ", 'spacing');
126 insert_with_tags($w_t, "word-wrapped by the widget.\n", 'spacing');
127 insert_with_tags($w_t, "Spacing1 is set to 10 points for this text, ", 'spacing');
128 insert_with_tags($w_t, "which results in relatively large gaps between ", 'spacing');
129 insert_with_tags($w_t, "the paragraphs. Spacing2 is set to 2 points, ", 'spacing');
130 insert_with_tags($w_t, "which results in just a bit of extra space ", 'spacing');
131 insert_with_tags($w_t, "within a pararaph. Spacing3 isn't used ", 'spacing');
132 insert_with_tags($w_t, "in this example.\n", 'spacing');
133 insert_with_tags($w_t, "To see where the space is, select ranges of ", 'spacing');
134 insert_with_tags($w_t, "text within these paragraphs. The selection ", 'spacing');
135 insert_with_tags($w_t, "highlight will cover the extra space.", 'spacing');
136
137 $w_t->mark('set', 'insert', '0.0');
138
139} # end mkStyles
140
141
1421;