1 <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><?xml-stylesheet href="takahashi.css" type="text/css"?><page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="presentation" xmlns:html="http:/www.w3.org/1999/xhtml" orient="vertical" onkeypress="Presentation.onKeyPress(event);">
2 <html:textarea id="builtinCode" style="visibility: collapse"><![CDATA[
11 http://moose.perl.org/
68 has name => (is => 'rw');
69 has age => (is => 'rw');
95 has name => (is => 'rw');
96 has age => (is => 'rw');
110 isa => 'DateTime::Duration',
113 DateTime::Duration->new
120 use Moose::Util::TypeConstraints;
122 subtype 'NonEmptyStr'
124 => where { length $_ > 0 };
128 isa => 'NonEmptyStr',
132 my $me = Person->new(
134 age => DateTime::Duration->new(
139 my $me = Person->new; # BOOM! name is required
141 my $me = Person->new(
144 ); # BOOM! age should be DateTime::Duration
148 class_type 'DateTime::Duration';
149 coerce 'DateTime::Duration'
152 DateTime::Duration->new(
159 isa => 'DateTime::Duration',
163 DateTime::Duration->new
167 my $me = Person->new(
172 coerce 'DateTime::Duration'
175 DateTime::Duration->new(
181 DateTime::Duration->new(%$_)
184 my $me = Person->new(
186 age => { years => 34, months => 11 }
189 my $me = Person->new(
191 age => { years => 34, months => 11 }
195 $me->age # DateTime::Duration object
201 $me->age({ years => 11, months => 8 });
203 $me->age(DateTime::Duration->new({
212 isa => 'DateTime::Duration',
216 DateTime::Duration->new
219 'years_old' => 'years'
230 use MooseX::AttributeHelpers;
233 metaclass => 'Collection::Array',
235 isa => 'ArrayRef[Person]',
237 push => 'add_attendee',
238 count => 'number_of_attendees',
242 my $oscon = Conference->new(
243 attendees => [ $me, @all_you_guys ]
246 $oscon->number_of_attendees; # lots of people
247 $oscon->add_attendee($some_slacker); # add a late comer
251 before 'add_attendee' => sub {
252 my ($self, $attendee) = @_;
253 $self->setup_more_chairs(1);
256 after 'add_attendee' => sub {
257 my ($self, $attendee) = @_;
258 $self->log("Attendee " . $attendee->name . " added");
261 around 'add_attendee' => sub {
262 my ($next, $self, @args) = @_;
264 my @return = $self->$next(@args);
342 # ... all that type stuff
346 isa => 'DateTime::Duration',
350 DateTime::Duration->new
353 'years_old' => 'years'
368 Moose code is shorter
370 less code == less bugs
385 <deck flex="1" id="deck">
388 onmousemove="Presentation.onMouseMoveOnCanvas(event);">
389 <toolbox id="canvasToolbar">
391 <toolbarbutton oncommand="Presentation.home()" label="|<<"
393 <toolbarbutton oncommand="Presentation.back()" label="<"
395 <toolbarbutton oncommand="Presentation.forward()" label=">"
396 observes="canForward"/>
397 <toolbarbutton oncommand="Presentation.end()" label=">>|"
398 observes="canForward"/>
400 <hbox align="center">
401 <textbox id="current_page" size="4"
402 oninput="if (this.value) Presentation.showPage(parseInt(this.value)-1);"/>
403 <description value="/"/>
404 <description id="max_page"/>
409 <scrollbar id="scroller"
410 align="center" orient="horizontal"
411 oncommand="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"
412 onclick="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"
413 onmousedown="Presentation.onScrollerDragStart();"
414 onmousemove="Presentation.onScrollerDragMove();"
415 onmouseup="Presentation.onScrollerDragDrop();"/>
421 <toolbarbutton id="toggleEva" label="Eva"
424 oncommand="Presentation.toggleEvaMode();"/>
426 <toolbarbutton label="Edit"
427 oncommand="Presentation.toggleEditMode();"/>
428 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>
431 <vbox flex="1" id="canvas"
432 onclick="Presentation.onPresentationClick(event);">
444 <vbox flex="1" id="edit">
447 <toolbarbutton label="New Page"
448 oncommand="Presentation.addPage()"/>
451 <toolbarbutton label="View"
452 oncommand="Presentation.toggleEditMode();"/>
453 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>
456 <textbox id="textField" flex="1" multiline="true"
457 oninput="Presentation.onEdit()"/>
458 <hbox collapsed="true">
459 <iframe id="dataLoader" onload="if (window.Presentation) Presentation.onDataLoad();"/>
467 <broadcaster id="canBack"/>
468 <broadcaster id="canForward"/>
472 <command id="cmd_forward"
473 oncommand="if (Presentation.isPresentationMode) Presentation.forward();"/>
474 <command id="cmd_back"
475 oncommand="if (Presentation.isPresentationMode) Presentation.back();"/>
476 <command id="cmd_home"
477 oncommand="if (Presentation.isPresentationMode) Presentation.home();"/>
478 <command id="cmd_end"
479 oncommand="if (Presentation.isPresentationMode) Presentation.end();"/>
482 <key keycode="VK_ENTER" command="cmd_forward"/>
483 <key keycode="VK_RETURN" command="cmd_forward"/>
484 <key keycode="VK_PAGE_DOWN" command="cmd_forward"/>
485 <key keycode="VK_RIGHT" command="cmd_forward"/>
486 <key keycode="VK_DOWN" command="cmd_forward"/>
487 <!-- key keycode="VK_BACK_SPACE" command="cmd_back"/-->
488 <key keycode="VK_PAGE_UP" command="cmd_back"/>
489 <!-- <key keycode="VK_BACK_UP" command="cmd_back"/>-->
490 <!-- <key keycode="VK_BACK_LEFT" command="cmd_back"/>-->
491 <key keycode="VK_HOME" command="cmd_home"/>
492 <key keycode="VK_END" command="cmd_end"/>
493 <key key="n" modifiers="accel" oncommand="Presentation.addPage();"/>
494 <key key="r" modifiers="accel" oncommand="window.location.reload();"/>
495 <key key="e" modifiers="accel" oncommand="Presentation.toggleEditMode();"/>
496 <key key="a" modifiers="accel" oncommand="Presentation.toggleEvaMode();"/>
500 <script src="takahashi.js" type="application/x-javascript" />
502 <!-- ***** BEGIN LICENSE BLOCK *****
505 - The contents of this file are subject to the Mozilla Public License Version
506 - 1.1 (the "License"); you may not use this file except in compliance with
507 - the License. You may obtain a copy of the License at
508 - http://www.mozilla.org/MPL/
510 - Software distributed under the License is distributed on an "AS IS" basis,
511 - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
512 - for the specific language governing rights and limitations under the
515 - The Original Code is the Takahashi-Method-based Presentation Tool in XUL.
517 - The Initial Developer of the Original Code is SHIMODA Hiroshi.
518 - Portions created by the Initial Developer are Copyright (C) 2005
519 - the Initial Developer. All Rights Reserved.
521 - Contributor(s): SHIMODA Hiroshi <piro@p.club.ne.jp>
523 - ***** END LICENSE BLOCK ***** -->