Changeset 535

Show
Ignore:
Timestamp:
07/14/08 17:03:01 (5 months ago)
Author:
okibi
Message:

updating demos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demos/cairo/cairo_clock/clock.d

    r506 r535  
    3434import cairo.Context; 
    3535import cairo.Surface; 
    36 import gtkc.cairotypes; 
    3736 
    3837import gtk.Widget; 
     
    5150        addOnExpose(&exposeCallback); 
    5251    } 
    53      
     52 
    5453protected: 
    5554    //Override default signal handler: 
     
    6160            m_timeout = new Timeout( 1000, &onSecondElapsed, false ); 
    6261        } 
    63          
     62 
    6463        // This is where we draw on the window 
    65          
     64 
    6665        Drawable dr = getWindow(); 
    67          
     66 
    6867        int width; 
    6968        int height; 
    70          
     69 
    7170        dr.getSize(&width, &height); 
    72          
     71 
    7372        auto cr = new Context (dr); 
    74          
     73 
    7574        if (event) 
    7675        { 
     
    8180            cr.clip(); 
    8281        } 
    83          
     82 
    8483        // scale to unit square and translate (0, 0) to be (0.5, 0.5), i.e. the 
    8584        // center of the window 
     
    8786        cr.translate(0.5, 0.5); 
    8887        cr.setLineWidth(m_lineWidth); 
    89          
     88 
    9089        cr.save(); 
    9190            cr.setSourceRgba(0.3, 0.6, 0.2, 0.9);   // brownish green 
    9291            cr.paint(); 
    9392        cr.restore(); 
    94          
     93 
    9594        cr.arc(0, 0, m_radius, 0, 2 * PI); 
    96          
     95 
    9796        cr.save(); 
    9897            cr.setSourceRgba(0.0, 0.0, 0.0, 0.8); 
    9998            cr.fillPreserve(); 
    10099        cr.restore(); 
    101          
     100 
    102101        cr.save(); 
    103102            cr.setSourceRgba(1.0, 1.0, 1.0, 1.0); 
     
    106105            cr.clip(); 
    107106        cr.restore(); 
    108          
    109          
     107 
     108 
    110109        //clock ticks 
    111          
     110 
    112111        for (int i = 0; i < 12; i++) 
    113112        { 
    114113            double inset = 0.07; 
    115              
     114 
    116115            cr.save(); 
    117116                cr.setSourceRgba(1.0, 1.0, 1.0, 1.0); 
    118117                cr.setLineWidth( m_lineWidth * 0.25); 
    119118                cr.setLineCap(cairo_line_cap_t.ROUND); 
    120                  
     119 
    121120                if (i % 3 != 0) 
    122121                { 
     
    124123                    cr.setLineWidth( m_lineWidth * 0.5 ); 
    125124                } 
    126                  
     125 
    127126                cr.moveTo( 
    128127                    (m_radius - inset) * cos (i * PI / 6), 
     
    134133            cr.restore(); // stack-pen-size 
    135134        } 
    136          
     135 
    137136        version(Tango) 
    138137        { 
    139138            auto time = tangoClock.WallClock.now.time; 
    140          
     139 
    141140            double minutes = time.minutes * PI / 30; 
    142141            double hours = time.hours * PI / 6; 
     
    147146            d_time lNow; 
    148147            string lNowString; 
    149              
     148 
    150149            // Grab the date and time relative to UTC 
    151150            lNow = std.date.getUTCtime(); 
    152151            // Convert this into the local date and time for display. 
    153152            lNowString = std.date.toString(lNow); 
    154              
     153 
    155154            Date timeinfo; 
    156155            timeinfo.parse(lNowString); 
    157              
     156 
    158157            // compute the angles of the indicators of our clock 
    159158            double minutes = timeinfo.minute * PI / 30; 
     
    161160            double seconds= timeinfo.second * PI / 30; 
    162161        } 
    163          
     162 
    164163        //writefln(timeinfo.hour, ".", timeinfo.minute, ".", timeinfo.second); 
    165          
     164 
    166165        cr.save(); 
    167166            cr.setLineCap(cairo_line_cap_t.ROUND); 
    168              
     167 
    169168            // draw the seconds hand 
    170169            cr.save(); 
     
    176175                cr.stroke(); 
    177176            cr.restore(); 
    178              
     177 
    179178            // draw the minutes hand 
    180179            //cr.setSourceRgba(0.117, 0.337, 0.612, 0.9);   // blue 
     
    184183                -cos(minutes + seconds / 60) * (m_radius * 0.7)); 
    185184            cr.stroke(); 
    186              
     185 
    187186            // draw the hours hand 
    188187            cr.setSourceRgba(0.337, 0.612, 0.117, 0.9);   // green 
     
    192191            cr.stroke(); 
    193192        cr.restore(); 
    194          
     193 
    195194        // draw a little dot in the middle 
    196195        cr.arc(0, 0, m_lineWidth / 3.0, 0, 2 * PI); 
    197196        cr.fill(); 
    198          
     197 
    199198        delete cr; 
    200          
     199 
    201200        return 1; 
    202201    } 
    203      
     202 
    204203    bool onSecondElapsed() 
    205204    { 
    206205        //force our program to redraw the entire clock once per every second. 
    207          
     206 
    208207        Window win = getWindow(); 
    209          
     208 
    210209        if(win) 
    211210        { 
    212              
     211 
    213212            int width; 
    214213            int height; 
    215              
     214 
    216215            win.getSize(&width, &height); 
    217              
     216 
    218217            //I think this should be also made possible: 
    219218            //width = win.getWidth(); 
    220219            //height = win.getHeight(); 
    221              
     220 
    222221            //And there should be a constructor like: Rectangle( int x, int y, int width, int height ); 
    223222            //because at the moment we have to do this to use a Rectangle, and that it needed for 
     
    225224            //that would do everything that we're doing here. And maybe also invalidateAll(); 
    226225            GdkRectangle* grect = new GdkRectangle(); 
    227              
     226 
    228227            grect.x = 0; 
    229228            grect.y = 0; 
    230229            grect.width = width; 
    231230            grect.height = height; 
    232              
     231 
    233232            //Rectangle r = new Rectangle(0, 0, width, height); 
    234233            Rectangle r = new Rectangle(grect); 
    235              
     234 
    236235            win.invalidateRect(r, false); 
    237236        } 
    238237        //else writefln("The Gdk.Window doesn't exist. Something went wrong in clock.d onSecondsElapsed()"); 
    239          
     238 
    240239        return true; 
    241          
     240 
    242241    } 
    243      
     242 
    244243    double m_radius = 0.40; 
    245244    double m_lineWidth = 0.065; 
    246      
     245 
    247246    Timeout m_timeout; 
    248247} 
  • trunk/demos/cairo/cairo_clock/dsss.conf

    r450 r535  
    22version = 0.1 
    33 
    4 requires = gtkd  
     4requires = gtkd 
    55 
    66[main.d] 
    77type = binary 
    88target = cairo_clock 
    9 buildflags = -I../../demos/ -no-export-dynamic 
     9buildflags = -I../../../demos/ -I../../../src -no-export-dynamic 
    1010version(linux) { 
    1111    buildflags +=-L-ldl 
  • trunk/demos/cairo/text_image/dsss.conf

    r452 r535  
    22version = 0.1 
    33 
    4 requires = gtkd  
     4requires = gtkd 
    55 
    66[text_image.d] 
    77type = binary 
    88target = text_image 
    9 buildflags = -no-export-dynamic 
     9buildflags = -I../../../src -no-export-dynamic 
    1010version(linux) { 
    1111    buildflags +=-L-ldl 
  • trunk/demos/dsss.conf

    r511 r535  
    11name = 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. 
     5defaulttargets = cairo gtk gtkD pango 
    26 
    37requires = gtkd 
    48 
    59[cairo] 
    6 type = subdir 
    7  
    8 [glade] 
    910type = subdir 
    1011 
     
    1819type = subdir 
    1920 
    20 #[gl
    21 #type = subdir 
     21[glade
     22type = subdir 
    2223 
    23 #[sourceView
    24 #type = subdir 
     24[gl
     25type = subdir 
    2526 
    26 #[gda
    27 #type = subdir 
     27[sourceView
     28type = subdir 
    2829 
     30[gda] 
     31type = subdir 
     32 
     33#Please note that the gstreamer demos require Tango 
     34[gstreamer] 
     35type = subdir 
  • trunk/demos/gda/dsss.conf

    r340 r535  
    66[TestGda.d] 
    77type = binary 
    8 target = TestGda  
    9 buildflags = -I../../demos/ -no-export-dynamic 
     8target = TestGda 
     9buildflags = -I../../demos/ -I../../src -I../../srcgda -no-export-dynamic 
    1010version(linux) { 
    1111buildflags += -L-ldl 
  • trunk/demos/gl/dsss.conf

    r467 r535  
    66type = binary 
    77target = shapesGL 
    8 buildflags = -I../ -no-export-dynamic 
     8buildflags = -I../ -I../../src -I../../srcgl -no-export-dynamic 
    99version(linux) { 
    1010buildflags += -L-lGL -L-lGLU -L-ldl 
     
    1818type = binary 
    1919target = simpleGL 
    20 buildflags = -I../ -no-export-dynamic 
     20buildflags = -I../ -I../../src -I../../srcgl -no-export-dynamic 
    2121version(linux) { 
    2222buildflags += -L-lGL -L-lGLU -L-ldl 
  • trunk/demos/glade/dsss.conf

    r340 r535  
    11name = gladeTest 
    22 
    3 requires = gtkD 
     3requires = gtkd 
    44 
    55[gladeTest.d] 
    66type = binary 
    77target = gladeTest 
    8 buildflags = -I../../demos -no-export-dynamic 
     8buildflags = -I../ -I../../src -no-export-dynamic 
    99version(linux) { 
    1010buildflags +=-L-ldl 
  • trunk/demos/glade/gladeTest.d

    r496 r535  
    77import gtk.Widget; 
    88import gtk.Button; 
    9 import gtkc.gtktypes; 
    109 
    1110version(Tango){ 
  • trunk/demos/gstreamer/dsss.conf

    r322 r535  
    1 name = gstreamerDTest
     1name = gstreamerdemo
    22 
    3 requires = gtkD gstreamerD 
     3requires = gtkd 
    44 
    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] 
     6type = subdir 
    97 
    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] 
     9type = subdir 
    1510 
    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] 
     12type = subdir 
  • trunk/demos/gstreamer/gnonlin_encoding/dsss.conf

    r322 r535  
    11name = gnonlin_encoding 
    22 
    3 requires = gtkD gstreamerD 
     3requires = gtkd gstreamerd 
    44 
    55[gnonlin_encoding.d] 
    66type = binary 
    77target = 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  
     8buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 
     9#buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 
     10version(linux) { 
     11    buildflags +=-L-ldl 
     12
     13version(Windows){ 
     14    buildflags+=-lladvapi32 
     15
  • trunk/demos/gstreamer/gnonlin_example/dsss.conf

    r322 r535  
    11name = gnonlin_example 
    22 
    3 requires = gtkD gstreamerD 
     3requires = gtkd gstreamerd 
    44 
    55[gnonlin_example.d] 
    66type = binary 
    77target = gnonlin_example 
    8 buildflags = -I/usr/local/include/d/src -I/usr/local/include/d/srcgstreamer -L-ldl 
    9  
     8buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 
     9#buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 
     10version(linux) { 
     11    buildflags +=-L-ldl 
     12
     13version(Windows){ 
     14    buildflags+=-lladvapi32 
     15
  • trunk/demos/gstreamer/helloworld/dsss.conf

    r322 r535  
    11name = gstreamer_helloworld 
    22 
    3 requires = gtkD gstreamerD 
     3requires = gtkd gstreamerd 
    44 
    55[gstreamer_helloworld.d] 
    66type = binary 
    77target = gstreamer_helloworld 
    8 buildflags = -I/usr/local/include/d/src -I/usr/local/include/d/srcgstreamer -L-ldl 
     8buildflags = -I../ -I../../../src -I../../../srcgstreamer -no-export-dynamic 
     9#buildflags += -debug=GnonlinHello -debug=gstreamer -debug=gstreamerbus 
     10version(linux) { 
     11    buildflags +=-L-ldl 
     12
     13version(Windows){ 
     14    buildflags+=-lladvapi32 
     15
  • trunk/demos/gtk/dsss.conf

    r532 r535  
    11[*] 
    2 buildflags =  -I../ -no-export-dynamic 
     2buildflags =  -I../ -I../../src -no-export-dynamic 
    33version(linux) { 
    44    buildflags +=-L-ldl 
  • trunk/demos/gtkD/DemoMultiCellRenderer.d

    r496 r535  
    4545import gtk.CellRendererToggle; 
    4646import gtk.ListStore; 
    47 import gtkc.gtktypes; 
    4847 
    4948enum { 
  • trunk/demos/gtkD/TTextView.d

    r530 r535  
    11/* 
    22 * This file is part of gtkD. 
    3  *  
     3 * 
    44 * gtkD is free software; you can redistribute it and/or modify 
    55 * it under the terms of the GNU Lesser General Public License as published by 
    66 * the Free Software Foundation; either version 2.1 of the License, or 
    77 * (at your option) any later version. 
    8  *  
     8 * 
    99 * gtkD is distributed in the hope that it will be useful, 
    1010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1111 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1212 * GNU Lesser General Public License for more details. 
    13  *  
     13 * 
    1414 * You should have received a copy of the GNU Lesser General Public License 
    1515 * along with gtkD; if not, write to the Free Software 
     
    2020 
    2121private import gtk.Window; 
    22  
    23 private import gtkc.gtktypes; 
    24 private import gtkc.gdktypes; 
    2522 
    2623private import gtk.Widget; 
     
    5552public: 
    5653class TTextView : Window 
    57 {   
     54{ 
    5855    TextView view1; 
    5956    TextBuffer buffer; 
     
    7067 
    7168        createTextViews(); 
    72          
     69 
    7370        setupWidgets(); 
    7471 
     
    7875        attachWidgets(view1); 
    7976        attachWidgets(view2); 
    80        
     77 
    8178        showAll(); 
    8279    } 
    83      
     80 
    8481//  bit windowDeleteCallback(Window window, Event event) 
    8582//  { 
    8683//      return false; 
    8784//  } 
    88 //  
     85// 
    8986//  bit windowDestroyCallback(Window window, Event event) 
    9087//  { 
     
    10299        view2 = new TextView(buffer); 
    103100    } 
    104      
     101 
    105102    /** 
    106103     * sets up the widgets ot this test 
     
    111108        vPaned.setBorderWidth(5); 
    112109        add(vPaned); 
    113          
     110 
    114111        ScrolledWindow sw = new ScrolledWindow(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); 
    115112        sw.add(view1); 
     
    146143        * gtk_text_tag_set_priority(). 
    147144        */ 
    148          
     145 
    149146        buffer.createTag("heading", 
    150147                        "weight", PangoWeight.BOLD, 
     
    154151 
    155152        buffer.createTag("bold", 
    156                   "weight", cast(int)PangoWeight.BOLD);   
    157    
     153                  "weight", cast(int)PangoWeight.BOLD); 
     154 
    158155        buffer.createTag("big", 
    159156                  /* points times the PANGO_SCALE factor */ 
     
    165162        buffer.createTag("x-large", 
    166163                  "scale", PANGO_SCALE_X_LARGE); 
    167    
     164 
    168165        buffer.createTag("monospace", 
    169166                  "family", "monospace"); 
    170    
     167 
    171168        buffer.createTag("blue_foreground", 
    172                   "foreground", "blue");   
     169                  "foreground", "blue"); 
    173170 
    174171        buffer.createTag("red_background", 
     
    181178 
    182179static string gray50_bits = [0x02, 0x01]; 
    183                    
     180 
    184181        stipple = Bitmap.createFromData(null,   // drawablw 
    185182                     gray50_bits, gray50_width, 
    186183                     gray50_height); 
    187    
     184 
    188185        buffer.createTag("background_stipple", 
    189186                  "background_stipple", stipple); 
     
    203200        buffer.createTag("not_editable", 
    204201                  "editable", cast(int)false); 
    205    
     202 
    206203        buffer.createTag("word_wrap", 
    207204                  "wrap_mode", cast(int)WrapMode.WORD); 
     
    212209        buffer.createTag("no_wrap", 
    213210                  "wrap_mode", cast(int)WrapMode.NONE); 
    214    
     211 
    215212        buffer.createTag("center", 
    216213                  "justification", cast(int)Justification.JUSTIFY_CENTER); 
     
    221218        buffer.createTag("wide_margins", 
    222219                  "left_margin", 50, "right_margin", 50); 
    223    
     220 
    224221        buffer.createTag("strikethrough", 
    225222                  "strikethrough", cast(int)true); 
    226    
     223 
    227224        buffer.createTag("underline", 
    228225                  "underline", cast(int)PangoUnderline.SINGLE); 
     
    234231                  "rise", 10 * PANGO_SCALE,   /* 10 pixels */ 
    235232                  "size", 8 * PANGO_SCALE);   /* 8 points */ 
    236    
     233 
    237234        buffer.createTag("subscript", 
    238235                  "rise", -10 * PANGO_SCALE,   /* 10 pixels */ 
    239236                  "size", 8 * PANGO_SCALE);    /* 8 points */ 
    240237 
    241          
     238 
    242239        buffer.createTag("rtl_quote", 
    243240                  "wrap_mode", WrapMode.WORD, 
     
    246243                  "left_margin", 20, 
    247244                  "right_margin", 20); 
    248          
     245 
    249246    } 
    250247    /** 
     
    263260        TextChildAnchor anchor; 
    264261        string filename; 
    265          
     262 
    266263        /* demo_find_file() looks in the the current directory first, 
    267264        * so you can run gtk-demo without installing GTK, then looks 
     
    277274        } 
    278275        catch (Exception) 
    279         {       
     276        { 
    280277            version(Tango) Stdout("Failed to load image file gtk-logo-rgb.gif").newline; 
    281278            else printf("Failed to load image file gtk-logo-rgb.gif\n"); 
    282279        } 
    283          
     280 
    284281        /* get start of buffer; each insertion will revalidate the 
    285282        * iterator to point to just after the inserted text. 
    286283        */ 
    287          
     284 
    288285        buffer.getIterAtOffset(iter, 0); 
    289286 
     
    291288 
    292289        buffer.insertWithTagsByName(iter, "Font styles. ","heading"); 
    293    
     290 
    294291        buffer.insert(iter, "For example, you can have "); 
    295292        buffer.insertWithTagsByName(iter, "italic", "italic"); 
    296         buffer.insert(iter, ", ");   
     293        buffer.insert(iter, ", "); 
    297294        buffer.insertWithTagsByName(iter, "bold", "bold"); 
    298295        buffer.insert(iter, ", or "); 
     
    306303        buffer.insertWithTagsByName(iter, "x-large", "x-large"); 
    307304        buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n"); 
    308    
     305 
    309306        buffer.insertWithTagsByName(iter, "Colors. ", "heading"); 
    310    
    311         buffer.insert(iter, "Colors such as ");   
     307 
     308        buffer.insert(iter, "Colors such as "); 
    312309        buffer.insertWithTagsByName(iter, "a blue foreground", "blue_foreground"); 
    313         buffer.insert(iter, " or ");   
     310        buffer.insert(iter, " or "); 
    314311        buffer.insertWithTagsByName(iter, "a red background", "red_background"); 
    315         buffer.insert(iter, " or even ");   
     312        buffer.insert(iter, " or even "); 
    316313        buffer.insertWithTagsByName(iter, "a stippled red background", 
    317314                                    "red_background", "background_stipple"); 
    318315 
    319         buffer.insert(iter, " or ");   
     316        buffer.insert(iter, " or "); 
    320317        buffer.insertWithTagsByName(iter, 
    321318            "a stippled blue foreground on solid red background", 
     
    323320            "red_background", 
    324321            "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"); 
    326323 
    327324        buffer.insertWithTagsByName(iter, "Underline, strikethrough, and rise. ", "heading"); 
    328    
     325 
    329326        buffer.insertWithTagsByName(iter, "Strikethrough", "strikethrough"); 
    330327        buffer.insert(iter, ", "); 
     
    339336 
    340337        buffer.insertWithTagsByName(iter, "Images. ", "heading"); 
    341    
     338 
    342339        buffer.insert(iter, "The buffer can have images in it: "); 
    343340        if ( pixbuf !is  null ) 
     
    356353 
    357354        buffer.insert(iter, "You can adjust the amount of space before each line.\n"); 
    358    
     355 
    359356        buffer.insertWithTagsByName(iter, "This line has a whole lot of space before it.\n", 
    360357                        "big_gap_before_line", "wide_margins"); 
     
    362359                        "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", 
    363360                        "big_gap_after_line", "wide_margins"); 
    364    
     361 
    365362        buffer.insertWithTagsByName(iter, 
    366363                        "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", 
     
    370367 
    371368        buffer.insertWithTagsByName(iter, "Editability. ", "heading"); 
    372    
     369 
    373370        buffer.insertWithTagsByName(iter, 
    374371                        "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", 
     
    378375 
    379376        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 
    382379        buffer.insertWithTagsByName(iter, 
    383380                        "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", 
    384381                        "char_wrap"); 
    385    
     382 
    386383        buffer.insertWithTagsByName(iter, 
    387384                        "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", 
    388385                        "no_wrap"); 
    389386 
    390         buffer.insertWithTagsByName(iter, "Justification. ", "heading");   
    391    
     387        buffer.insertWithTagsByName(iter, "Justification. ", "heading"); 
     388 
    392389        buffer.insertWithTagsByName(iter, 
    393390                        "\nThis line has center justification.\n", "center"); 
     
    398395        buffer.insertWithTagsByName(iter, 
    399396                        "\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"); 
    401398 
    402399        buffer.insertWithTagsByName(iter, "Internationalization. ", "heading"); 
    403        
     400 
    404401        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"); 
    406403 
    407404        buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n"); 
    408405        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", 
    409406                        "rtl_quote"); 
    410        
     407 
    411408        buffer.insert(iter, "You can put widgets in the buffer: Here's a button: "); 
    412409        anchor = buffer.createChildAnchor(iter); 
     
    420417        anchor = buffer.createChildAnchor(iter); 
    421418        buffer.insert(iter, ".\n"); 
    422    
     419 
    423420        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..."); 
    424421 
     
    438435        TextBuffer buffer; 
    439436        int i; 
    440          
     437 
    441438        buffer = view.getBuffer(); 
    442439 
     
    450447            Widget widget; 
    451448            anchor = iter.getChildAnchor(); 
    452              
     449 
    453450            if (i == 0) 
    454451            { 
     
    458455            else if (i == 1) 
    459456            { 
    460                  
     457 
    461458                ComboBox comboBox = new ComboBox(); 
    462459                comboBox.appendText("Option 1"); 
     
    485482                //g_assert_not_reached (); 
    486483            } 
    487              
     484 
    488485            if ( widget !is  null ) 
    489486            { 
    490487                view.addChildAtAnchor(widget,anchor); 
    491488            } 
    492      
     489 
    493490            ++i; 
    494491        } 
    495492    } 
    496      
     493 
    497494    bool findAnchor (TextIter iter) 
    498495    { 
     
    506503        return false; 
    507504    } 
    508      
     505 
    509506} 
  • trunk/demos/gtkD/TestDrawingArea.d

    r480 r535  
    11/* 
    22 * This file is part of gtkD. 
    3  *  
     3 * 
    44 * gtkD is free software; you can redistribute it and/or modify 
    55 * it under the terms of the GNU Lesser General Public License as published by 
    66 * the Free Software Foundation; either version 2.1 of the License, or 
    77 * (at your option) any later version. 
    8  *  
     8 * 
    99 * gtkD is distributed in the hope that it will be useful, 
    1010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1111 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1212 * GNU Lesser General Public License for more details. 
    13  *  
     13 * 
    1414 * You should have received a copy of the GNU Lesser General Public License 
    1515 * along with gtkD; if not, write to the Free Software 
     
    2626private import pango.PgLayout; 
    2727private import gdk.ImageGdk; 
    28          
     28 
    2929version(Tango) private import tango.io.Stdout; 
    3030version(Tango) private import tango.stdc.stdio; 
    3131else private import std.stdio; 
    3232 
    33 version(Tango) private import tango.math.Math;  
     33version(Tango) private import tango.math.Math; 
    3434else private import std.math; 
    3535 
     
    4545private import gdk.Drawable; 
    4646private import gdk.GC; 
    47 private import pango.PgFontDescription;     
     47private import pango.PgFontDescription; 
    4848 
    4949private import gtk.DrawingArea; 
     
    5151private import gtk.SpinButton; 
    5252 
    53 private import gtkc.gtktypes;        
    5453private import gdk.Event; 
    5554 
     
    5857//private import event.Event; 
    5958 
    60      
     59 
    6160/** 
    6261 * This tests the gtkD drawing area widget 
     
    7271        debug(Tango) Stdout("TestDrawingArea.this() 2").newline; 
    7372        TestDrawing drawingArea = new TestDrawing(); 
    74          
     73 
    7574        debug(Tango) Stdout("TestDrawingArea.this() 3").newline; 
    76          
     75 
    7776        ComboBox gcOptions = new ComboBox(); 
    7877        gcOptions.appendText("GC COPY"); 
     
    114113 
    115114        packStart(drawingArea,true,true,0); 
    116          
     115 
    117116