Changeset 535
- Timestamp:
- 07/14/08 17:03:01 (5 months ago)
- Files:
-
- trunk/demos/cairo/cairo_clock/clock.d (modified) (14 diffs)
- trunk/demos/cairo/cairo_clock/dsss.conf (modified) (1 diff)
- trunk/demos/cairo/text_image/dsss.conf (modified) (1 diff)
- trunk/demos/dsss.conf (modified) (2 diffs)
- trunk/demos/gda/dsss.conf (modified) (1 diff)
- trunk/demos/gl/dsss.conf (modified) (2 diffs)
- trunk/demos/glade/dsss.conf (modified) (1 diff)
- trunk/demos/glade/gladeTest.d (modified) (1 diff)
- trunk/demos/gstreamer/dsss.conf (modified) (1 diff)
- trunk/demos/gstreamer/gnonlin_encoding/dsss.conf (modified) (1 diff)
- trunk/demos/gstreamer/gnonlin_example/dsss.conf (modified) (1 diff)
- trunk/demos/gstreamer/helloworld/dsss.conf (modified) (1 diff)
- trunk/demos/gtk/dsss.conf (modified) (1 diff)
- trunk/demos/gtkD/DemoMultiCellRenderer.d (modified) (1 diff)
- trunk/demos/gtkD/TTextView.d (modified) (33 diffs)
- trunk/demos/gtkD/TestDrawingArea.d (modified) (26 diffs)
- trunk/demos/gtkD/TestEntries.d (modified) (5 diffs)
- trunk/demos/gtkD/TestIdle.d (modified) (14 diffs)
- trunk/demos/gtkD/TestImage.d (modified) (13 diffs)
- trunk/demos/gtkD/TestScales.d (modified) (17 diffs)
- trunk/demos/gtkD/TestStock.d (modified) (6 diffs)
- trunk/demos/gtkD/TestText.d (modified) (5 diffs)
- trunk/demos/gtkD/TestTreeView.d (modified) (20 diffs)
- trunk/demos/gtkD/TestTreeView1.d (modified) (20 diffs)
- trunk/demos/gtkD/dsss.conf (modified) (1 diff)
- trunk/demos/pango/dsss.conf (modified) (1 diff)
- trunk/demos/sourceView/dsss.conf (modified) (1 diff)
- trunk/dsss.conf (modified) (1 diff)
- trunk/srcgstreamer/dsss.conf (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demos/cairo/cairo_clock/clock.d
r506 r535 34 34 import cairo.Context; 35 35 import cairo.Surface; 36 import gtkc.cairotypes;37 36 38 37 import gtk.Widget; … … 51 50 addOnExpose(&exposeCallback); 52 51 } 53 52 54 53 protected: 55 54 //Override default signal handler: … … 61 60 m_timeout = new Timeout( 1000, &onSecondElapsed, false ); 62 61 } 63 62 64 63 // This is where we draw on the window 65 64 66 65 Drawable dr = getWindow(); 67 66 68 67 int width; 69 68 int height; 70 69 71 70 dr.getSize(&width, &height); 72 71 73 72 auto cr = new Context (dr); 74 73 75 74 if (event) 76 75 { … … 81 80 cr.clip(); 82 81 } 83 82 84 83 // scale to unit square and translate (0, 0) to be (0.5, 0.5), i.e. the 85 84 // center of the window … … 87 86 cr.translate(0.5, 0.5); 88 87 cr.setLineWidth(m_lineWidth); 89 88 90 89 cr.save(); 91 90 cr.setSourceRgba(0.3, 0.6, 0.2, 0.9); // brownish green 92 91 cr.paint(); 93 92 cr.restore(); 94 93 95 94 cr.arc(0, 0, m_radius, 0, 2 * PI); 96 95 97 96 cr.save(); 98 97 cr.setSourceRgba(0.0, 0.0, 0.0, 0.8); 99 98 cr.fillPreserve(); 100 99 cr.restore(); 101 100 102 101 cr.save(); 103 102 cr.setSourceRgba(1.0, 1.0, 1.0, 1.0); … … 106 105 cr.clip(); 107 106 cr.restore(); 108 109 107 108 110 109 //clock ticks 111 110 112 111 for (int i = 0; i < 12; i++) 113 112 { 114 113 double inset = 0.07; 115 114 116 115 cr.save(); 117 116 cr.setSourceRgba(1.0, 1.0, 1.0, 1.0); 118 117 cr.setLineWidth( m_lineWidth * 0.25); 119 118 cr.setLineCap(cairo_line_cap_t.ROUND); 120 119 121 120 if (i % 3 != 0) 122 121 { … … 124 123 cr.setLineWidth( m_lineWidth * 0.5 ); 125 124 } 126 125 127 126 cr.moveTo( 128 127 (m_radius - inset) * cos (i * PI / 6), … … 134 133 cr.restore(); // stack-pen-size 135 134 } 136 135 137 136 version(Tango) 138 137 { 139 138 auto time = tangoClock.WallClock.now.time; 140 139 141 140 double minutes = time.minutes * PI / 30; 142 141 double hours = time.hours * PI / 6; … … 147 146 d_time lNow; 148 147 string lNowString; 149 148 150 149 // Grab the date and time relative to UTC 151 150 lNow = std.date.getUTCtime(); 152 151 // Convert this into the local date and time for display. 153 152 lNowString = std.date.toString(lNow); 154 153 155 154 Date timeinfo; 156 155 timeinfo.parse(lNowString); 157 156 158 157 // compute the angles of the indicators of our clock 159 158 double minutes = timeinfo.minute * PI / 30; … … 161 160 double seconds= timeinfo.second * PI / 30; 162 161 } 163 162 164 163 //writefln(timeinfo.hour, ".", timeinfo.minute, ".", timeinfo.second); 165 164 166 165 cr.save(); 167 166 cr.setLineCap(cairo_line_cap_t.ROUND); 168 167 169 168 // draw the seconds hand 170 169 cr.save(); … … 176 175 cr.stroke(); 177 176 cr.restore(); 178 177 179 178 // draw the minutes hand 180 179 //cr.setSourceRgba(0.117, 0.337, 0.612, 0.9); // blue … … 184 183 -cos(minutes + seconds / 60) * (m_radius * 0.7)); 185 184 cr.stroke(); 186 185 187 186 // draw the hours hand 188 187 cr.setSourceRgba(0.337, 0.612, 0.117, 0.9); // green … … 192 191 cr.stroke(); 193 192 cr.restore(); 194 193 195 194 // draw a little dot in the middle 196 195 cr.arc(0, 0, m_lineWidth / 3.0, 0, 2 * PI); 197 196 cr.fill(); 198 197 199 198 delete cr; 200 199 201 200 return 1; 202 201 } 203 202 204 203 bool onSecondElapsed() 205 204 { 206 205 //force our program to redraw the entire clock once per every second. 207 206 208 207 Window win = getWindow(); 209 208 210 209 if(win) 211 210 { 212 211 213 212 int width; 214 213 int height; 215 214 216 215 win.getSize(&width, &height); 217 216 218 217 //I think this should be also made possible: 219 218 //width = win.getWidth(); 220 219 //height = win.getHeight(); 221 220 222 221 //And there should be a constructor like: Rectangle( int x, int y, int width, int height ); 223 222 //because at the moment we have to do this to use a Rectangle, and that it needed for … … 225 224 //that would do everything that we're doing here. And maybe also invalidateAll(); 226 225 GdkRectangle* grect = new GdkRectangle(); 227 226 228 227 grect.x = 0; 229 228 grect.y = 0; 230 229 grect.width = width; 231 230 grect.height = height; 232 231 233 232 //Rectangle r = new Rectangle(0, 0, width, height); 234 233 Rectangle r = new Rectangle(grect); 235 234 236 235 win.invalidateRect(r, false); 237 236 } 238 237 //else writefln("The Gdk.Window doesn't exist. Something went wrong in clock.d onSecondsElapsed()"); 239 238 240 239 return true; 241 240 242 241 } 243 242 244 243 double m_radius = 0.40; 245 244 double m_lineWidth = 0.065; 246 245 247 246 Timeout m_timeout; 248 247 } trunk/demos/cairo/cairo_clock/dsss.conf
r450 r535 2 2 version = 0.1 3 3 4 requires = gtkd 4 requires = gtkd 5 5 6 6 [main.d] 7 7 type = binary 8 8 target = cairo_clock 9 buildflags = -I../../ demos/-no-export-dynamic9 buildflags = -I../../../demos/ -I../../../src -no-export-dynamic 10 10 version(linux) { 11 11 buildflags +=-L-ldl trunk/demos/cairo/text_image/dsss.conf
r452 r535 2 2 version = 0.1 3 3 4 requires = gtkd 4 requires = gtkd 5 5 6 6 [text_image.d] 7 7 type = binary 8 8 target = text_image 9 buildflags = - no-export-dynamic9 buildflags = -I../../../src -no-export-dynamic 10 10 version(linux) { 11 11 buildflags +=-L-ldl trunk/demos/dsss.conf
r511 r535 1 1 name = gtkddemos 2 3 #Add section names to the follwing variable to get them built. 4 #Demos requiring external libs or files are not enabled by default. 5 defaulttargets = cairo gtk gtkD pango 2 6 3 7 requires = gtkd 4 8 5 9 [cairo] 6 type = subdir7 8 [glade]9 10 type = subdir 10 11 … … 18 19 type = subdir 19 20 20 #[gl]21 #type = subdir21 [glade] 22 type = subdir 22 23 23 #[sourceView]24 #type = subdir24 [gl] 25 type = subdir 25 26 26 #[gda]27 #type = subdir27 [sourceView] 28 type = subdir 28 29 30 [gda] 31 type = subdir 32 33 #Please note that the gstreamer demos require Tango 34 [gstreamer] 35 type = subdir trunk/demos/gda/dsss.conf
r340 r535 6 6 [TestGda.d] 7 7 type = binary 8 target = TestGda 9 buildflags = -I../../demos/ - no-export-dynamic8 target = TestGda 9 buildflags = -I../../demos/ -I../../src -I../../srcgda -no-export-dynamic 10 10 version(linux) { 11 11 buildflags += -L-ldl trunk/demos/gl/dsss.conf
r467 r535 6 6 type = binary 7 7 target = shapesGL 8 buildflags = -I../ - no-export-dynamic8 buildflags = -I../ -I../../src -I../../srcgl -no-export-dynamic 9 9 version(linux) { 10 10 buildflags += -L-lGL -L-lGLU -L-ldl … … 18 18 type = binary 19 19 target = simpleGL 20 buildflags = -I../ - no-export-dynamic20 buildflags = -I../ -I../../src -I../../srcgl -no-export-dynamic 21 21 version(linux) { 22 22 buildflags += -L-lGL -L-lGLU -L-ldl trunk/demos/glade/dsss.conf
r340 r535 1 1 name = gladeTest 2 2 3 requires = gtk D3 requires = gtkd 4 4 5 5 [gladeTest.d] 6 6 type = binary 7 7 target = gladeTest 8 buildflags = -I../ ../demos-no-export-dynamic8 buildflags = -I../ -I../../src -no-export-dynamic 9 9 version(linux) { 10 10 buildflags +=-L-ldl trunk/demos/glade/gladeTest.d
r496 r535 7 7 import gtk.Widget; 8 8 import gtk.Button; 9 import gtkc.gtktypes;10 9 11 10 version(Tango){ trunk/demos/gstreamer/dsss.conf
r322 r535 1 name = gstreamer DTests1 name = gstreamerdemos 2 2 3 requires = gtk D gstreamerD3 requires = gtkd 4 4 5 #[gnonlin_video_example.d] 6 #type = binary 7 #target = gnonlin_video_example 8 #buildflags = -I/usr/local/include/d -I/usr/local/include/d -L-ldl 5 [gnonlin_encoding] 6 type = subdir 9 7 10 [gnonlin_video_example_encoding.d] 11 type = binary 12 target = gnonlin_video_example_encoding 13 buildflags = -I/usr/local/include/d -I/usr/local/include/d -L-ldl 14 buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 8 [gnonlin_example] 9 type = subdir 15 10 16 #[gnonlin_video_example_tester2.d] 17 #type = binary 18 #target = gnonlin_video_example_tester2 19 #buildflags = -I/usr/local/include/d -I/usr/local/include/d -L-ldl 20 #buildflags += -version=myfiles 21 11 [helloworld] 12 type = subdir trunk/demos/gstreamer/gnonlin_encoding/dsss.conf
r322 r535 1 1 name = gnonlin_encoding 2 2 3 requires = gtk D gstreamerD3 requires = gtkd gstreamerd 4 4 5 5 [gnonlin_encoding.d] 6 6 type = binary 7 7 target = gnonlin_encoding 8 buildflags = -I/usr/local/include/d/src -I/usr/local/include/d/srcgstreamer -L-ldl 9 buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 10 8 buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 9 #buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 10 version(linux) { 11 buildflags +=-L-ldl 12 } 13 version(Windows){ 14 buildflags+=-lladvapi32 15 } trunk/demos/gstreamer/gnonlin_example/dsss.conf
r322 r535 1 1 name = gnonlin_example 2 2 3 requires = gtk D gstreamerD3 requires = gtkd gstreamerd 4 4 5 5 [gnonlin_example.d] 6 6 type = binary 7 7 target = gnonlin_example 8 buildflags = -I/usr/local/include/d/src -I/usr/local/include/d/srcgstreamer -L-ldl 9 8 buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 9 #buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 10 version(linux) { 11 buildflags +=-L-ldl 12 } 13 version(Windows){ 14 buildflags+=-lladvapi32 15 } trunk/demos/gstreamer/helloworld/dsss.conf
r322 r535 1 1 name = gstreamer_helloworld 2 2 3 requires = gtk D gstreamerD3 requires = gtkd gstreamerd 4 4 5 5 [gstreamer_helloworld.d] 6 6 type = binary 7 7 target = gstreamer_helloworld 8 buildflags = -I/usr/local/include/d/src -I/usr/local/include/d/srcgstreamer -L-ldl 8 buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 9 #buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 10 version(linux) { 11 buildflags +=-L-ldl 12 } 13 version(Windows){ 14 buildflags+=-lladvapi32 15 } trunk/demos/gtk/dsss.conf
r532 r535 1 1 [*] 2 buildflags = -I../ - no-export-dynamic2 buildflags = -I../ -I../../src -no-export-dynamic 3 3 version(linux) { 4 4 buildflags +=-L-ldl trunk/demos/gtkD/DemoMultiCellRenderer.d
r496 r535 45 45 import gtk.CellRendererToggle; 46 46 import gtk.ListStore; 47 import gtkc.gtktypes;48 47 49 48 enum { trunk/demos/gtkD/TTextView.d
r530 r535 1 1 /* 2 2 * This file is part of gtkD. 3 * 3 * 4 4 * gtkD is free software; you can redistribute it and/or modify 5 5 * it under the terms of the GNU Lesser General Public License as published by 6 6 * the Free Software Foundation; either version 2.1 of the License, or 7 7 * (at your option) any later version. 8 * 8 * 9 9 * gtkD is distributed in the hope that it will be useful, 10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 * GNU Lesser General Public License for more details. 13 * 13 * 14 14 * You should have received a copy of the GNU Lesser General Public License 15 15 * along with gtkD; if not, write to the Free Software … … 20 20 21 21 private import gtk.Window; 22 23 private import gtkc.gtktypes;24 private import gtkc.gdktypes;25 22 26 23 private import gtk.Widget; … … 55 52 public: 56 53 class TTextView : Window 57 { 54 { 58 55 TextView view1; 59 56 TextBuffer buffer; … … 70 67 71 68 createTextViews(); 72 69 73 70 setupWidgets(); 74 71 … … 78 75 attachWidgets(view1); 79 76 attachWidgets(view2); 80 77 81 78 showAll(); 82 79 } 83 80 84 81 // bit windowDeleteCallback(Window window, Event event) 85 82 // { 86 83 // return false; 87 84 // } 88 // 85 // 89 86 // bit windowDestroyCallback(Window window, Event event) 90 87 // { … … 102 99 view2 = new TextView(buffer); 103 100 } 104 101 105 102 /** 106 103 * sets up the widgets ot this test … … 111 108 vPaned.setBorderWidth(5); 112 109 add(vPaned); 113 110 114 111 ScrolledWindow sw = new ScrolledWindow(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); 115 112 sw.add(view1); … … 146 143 * gtk_text_tag_set_priority(). 147 144 */ 148 145 149 146 buffer.createTag("heading", 150 147 "weight", PangoWeight.BOLD, … … 154 151 155 152 buffer.createTag("bold", 156 "weight", cast(int)PangoWeight.BOLD); 157 153 "weight", cast(int)PangoWeight.BOLD); 154 158 155 buffer.createTag("big", 159 156 /* points times the PANGO_SCALE factor */ … … 165 162 buffer.createTag("x-large", 166 163 "scale", PANGO_SCALE_X_LARGE); 167 164 168 165 buffer.createTag("monospace", 169 166 "family", "monospace"); 170 167 171 168 buffer.createTag("blue_foreground", 172 "foreground", "blue"); 169 "foreground", "blue"); 173 170 174 171 buffer.createTag("red_background", … … 181 178 182 179 static string gray50_bits = [0x02, 0x01]; 183 180 184 181 stipple = Bitmap.createFromData(null, // drawablw 185 182 gray50_bits, gray50_width, 186 183 gray50_height); 187 184 188 185 buffer.createTag("background_stipple", 189 186 "background_stipple", stipple); … … 203 200 buffer.createTag("not_editable", 204 201 "editable", cast(int)false); 205 202 206 203 buffer.createTag("word_wrap", 207 204 "wrap_mode", cast(int)WrapMode.WORD); … … 212 209 buffer.createTag("no_wrap", 213 210 "wrap_mode", cast(int)WrapMode.NONE); 214 211 215 212 buffer.createTag("center", 216 213 "justification", cast(int)Justification.JUSTIFY_CENTER); … … 221 218 buffer.createTag("wide_margins", 222 219 "left_margin", 50, "right_margin", 50); 223 220 224 221 buffer.createTag("strikethrough", 225 222 "strikethrough", cast(int)true); 226 223 227 224 buffer.createTag("underline", 228 225 "underline", cast(int)PangoUnderline.SINGLE); … … 234 231 "rise", 10 * PANGO_SCALE, /* 10 pixels */ 235 232 "size", 8 * PANGO_SCALE); /* 8 points */ 236 233 237 234 buffer.createTag("subscript", 238 235 "rise", -10 * PANGO_SCALE, /* 10 pixels */ 239 236 "size", 8 * PANGO_SCALE); /* 8 points */ 240 237 241 238 242 239 buffer.createTag("rtl_quote", 243 240 "wrap_mode", WrapMode.WORD, … … 246 243 "left_margin", 20, 247 244 "right_margin", 20); 248 245 249 246 } 250 247 /** … … 263 260 TextChildAnchor anchor; 264 261 string filename; 265 262 266 263 /* demo_find_file() looks in the the current directory first, 267 264 * so you can run gtk-demo without installing GTK, then looks … … 277 274 } 278 275 catch (Exception) 279 { 276 { 280 277 version(Tango) Stdout("Failed to load image file gtk-logo-rgb.gif").newline; 281 278 else printf("Failed to load image file gtk-logo-rgb.gif\n"); 282 279 } 283 280 284 281 /* get start of buffer; each insertion will revalidate the 285 282 * iterator to point to just after the inserted text. 286 283 */ 287 284 288 285 buffer.getIterAtOffset(iter, 0); 289 286 … … 291 288 292 289 buffer.insertWithTagsByName(iter, "Font styles. ","heading"); 293 290 294 291 buffer.insert(iter, "For example, you can have "); 295 292 buffer.insertWithTagsByName(iter, "italic", "italic"); 296 buffer.insert(iter, ", "); 293 buffer.insert(iter, ", "); 297 294 buffer.insertWithTagsByName(iter, "bold", "bold"); 298 295 buffer.insert(iter, ", or "); … … 306 303 buffer.insertWithTagsByName(iter, "x-large", "x-large"); 307 304 buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n"); 308 305 309 306 buffer.insertWithTagsByName(iter, "Colors. ", "heading"); 310 311 buffer.insert(iter, "Colors such as "); 307 308 buffer.insert(iter, "Colors such as "); 312 309 buffer.insertWithTagsByName(iter, "a blue foreground", "blue_foreground"); 313 buffer.insert(iter, " or "); 310 buffer.insert(iter, " or "); 314 311 buffer.insertWithTagsByName(iter, "a red background", "red_background"); 315 buffer.insert(iter, " or even "); 312 buffer.insert(iter, " or even "); 316 313 buffer.insertWithTagsByName(iter, "a stippled red background", 317 314 "red_background", "background_stipple"); 318 315 319 buffer.insert(iter, " or "); 316 buffer.insert(iter, " or "); 320 317 buffer.insertWithTagsByName(iter, 321 318 "a stippled blue foreground on solid red background", … … 323 320 "red_background", 324 321 "foreground_stipple"); 325 buffer.insert(iter, " (select that to read it) can be used.\n\n"); 322 buffer.insert(iter, " (select that to read it) can be used.\n\n"); 326 323 327 324 buffer.insertWithTagsByName(iter, "Underline, strikethrough, and rise. ", "heading"); 328 325 329 326 buffer.insertWithTagsByName(iter, "Strikethrough", "strikethrough"); 330 327 buffer.insert(iter, ", "); … … 339 336 340 337 buffer.insertWithTagsByName(iter, "Images. ", "heading"); 341 338 342 339 buffer.insert(iter, "The buffer can have images in it: "); 343 340 if ( pixbuf !is null ) … … 356 353 357 354 buffer.insert(iter, "You can adjust the amount of space before each line.\n"); 358 355 359 356 buffer.insertWithTagsByName(iter, "This line has a whole lot of space before it.\n", 360 357 "big_gap_before_line", "wide_margins"); … … 362 359 "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", 363 360 "big_gap_after_line", "wide_margins"); 364 361 365 362 buffer.insertWithTagsByName(iter, 366 363 "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", … … 370 367 371 368 buffer.insertWithTagsByName(iter, "Editability. ", "heading"); 372 369 373 370 buffer.insertWithTagsByName(iter, 374 371 "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", … … 378 375 379 376 buffer.insert(iter, 380 "This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n"); 381 377 "This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n"); 378 382 379 buffer.insertWithTagsByName(iter, 383 380 "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", 384 381 "char_wrap"); 385 382 386 383 buffer.insertWithTagsByName(iter, 387 384 "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", 388 385 "no_wrap"); 389 386 390 buffer.insertWithTagsByName(iter, "Justification. ", "heading"); 391 387 buffer.insertWithTagsByName(iter, "Justification. ", "heading"); 388 392 389 buffer.insertWithTagsByName(iter, 393 390 "\nThis line has center justification.\n", "center"); … … 398 395 buffer.insertWithTagsByName(iter, 399 396 "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", 400 "wide_margins"); 397 "wide_margins"); 401 398 402 399 buffer.insertWithTagsByName(iter, "Internationalization. ", "heading"); 403 400 404 401 buffer.insert(iter, 405 "You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek (\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) \316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew \327\251\327\234\327\225\327\235\nJapanese (\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n"); 402 "You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek (\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) \316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew \327\251\327\234\327\225\327\235\nJapanese (\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n"); 406 403 407 404 buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n"); 408 405 buffer.insertWithTagsByName(iter, "\331\210\331\202\330\257 \330\250\330\257\330\243 \330\253\331\204\330\247\330\253 \331\205\331\206 \330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \330\252\331\202\330\257\331\205\330\247 \331\201\331\212 \330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 \330\250\330\261\330\247\331\205\330\254\331\207\330\247 \331\203\331\205\331\206\330\270\331\205\330\247\330\252 \331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 \330\253\331\205 \330\252\330\255\331\210\331\204\330\252 \331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 \330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 \330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 \331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 \331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 \331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 \330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 \330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 \331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 \331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 \330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 \330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 \330\243\331\203\330\253\330\261 \331\207\330\260\331\207 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \331\206\330\254\330\247\330\255\330\247 \331\207\331\210 \302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 \331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", 409 406 "rtl_quote"); 410 407 411 408 buffer.insert(iter, "You can put widgets in the buffer: Here's a button: "); 412 409 anchor = buffer.createChildAnchor(iter); … … 420 417 anchor = buffer.createChildAnchor(iter); 421 418 buffer.insert(iter, ".\n"); 422 419 423 420 buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text (doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such..."); 424 421 … … 438 435 TextBuffer buffer; 439 436 int i; 440 437 441 438 buffer = view.getBuffer(); 442 439 … … 450 447 Widget widget; 451 448 anchor = iter.getChildAnchor(); 452 449 453 450 if (i == 0) 454 451 { … … 458 455 else if (i == 1) 459 456 { 460 457 461 458 ComboBox comboBox = new ComboBox(); 462 459 comboBox.appendText("Option 1"); … … 485 482 //g_assert_not_reached (); 486 483 } 487 484 488 485 if ( widget !is null ) 489 486 { 490 487 view.addChildAtAnchor(widget,anchor); 491 488 } 492 489 493 490 ++i; 494 491 } 495 492 } 496 493 497 494 bool findAnchor (TextIter iter) 498 495 { … … 506 503 return false; 507 504 } 508 505 509 506 } trunk/demos/gtkD/TestDrawingArea.d
r480 r535 1 1 /* 2 2 * This file is part of gtkD. 3 * 3 * 4 4 * gtkD is free software; you can redistribute it and/or modify 5 5 * it under the terms of the GNU Lesser General Public License as published by 6 6 * the Free Software Foundation; either version 2.1 of the License, or 7 7 * (at your option) any later version. 8 * 8 * 9 9 * gtkD is distributed in the hope that it will be useful, 10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 * GNU Lesser General Public License for more details. 13 * 13 * 14 14 * You should have received a copy of the GNU Lesser General Public License 15 15 * along with gtkD; if not, write to the Free Software … … 26 26 private import pango.PgLayout; 27 27 private import gdk.ImageGdk; 28 28 29 29 version(Tango) private import tango.io.Stdout; 30 30 version(Tango) private import tango.stdc.stdio; 31 31 else private import std.stdio; 32 32 33 version(Tango) private import tango.math.Math; 33 version(Tango) private import tango.math.Math; 34 34 else private import std.math; 35 35 … … 45 45 private import gdk.Drawable; 46 46 private import gdk.GC; 47 private import pango.PgFontDescription; 47 private import pango.PgFontDescription; 48 48 49 49 private import gtk.DrawingArea; … … 51 51 private import gtk.SpinButton; 52 52 53 private import gtkc.gtktypes;54 53 private import gdk.Event; 55 54 … … 58 57 //private import event.Event; 59 58 60 59 61 60 /** 62 61 * This tests the gtkD drawing area widget … … 72 71 debug(Tango) Stdout("TestDrawingArea.this() 2").newline; 73 72 TestDrawing drawingArea = new TestDrawing(); 74 73 75 74 debug(Tango) Stdout("TestDrawingArea.this() 3").newline; 76 75 77 76 ComboBox gcOptions = new ComboBox(); 78 77 gcOptions.appendText("GC COPY"); … … 114 113 115 114 packStart(drawingArea,true,true,0); 116 115 117 116
