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 => 35, months => 2 }
189 my $me = Person->new(
191 age => { years => 35, months => 2 }
195 $me->age # DateTime::Duration object
197 my $xoe = Person->new(name => 'Xoe');
201 $xoe->age({ years => 11, months => 10 });
203 $xoe->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 $ppw = Conference->new(
243 attendees => [ $me, @all_you_guys ]
246 $ppw->number_of_attendees; # lots of people
247 $ppw->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
393 <deck flex="1" id="deck">
396 onmousemove="Presentation.onMouseMoveOnCanvas(event);">
397 <toolbox id="canvasToolbar">
399 <toolbarbutton oncommand="Presentation.home()" label="|<<"
401 <toolbarbutton oncommand="Presentation.back()" label="<"
403 <toolbarbutton oncommand="Presentation.forward()" label=">"
404 observes="canForward"/>
405 <toolbarbutton oncommand="Presentation.end()" label=">>|"
406 observes="canForward"/>
408 <hbox align="center">
409 <textbox id="current_page" size="4"
410 oninput="if (this.value) Presentation.showPage(parseInt(this.value)-1);"/>
411 <description value="/"/>
412 <description id="max_page"/>
417 <scrollbar id="scroller"
418 align="center" orient="horizontal"
419 oncommand="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"
420 onclick="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"
421 onmousedown="Presentation.onScrollerDragStart();"
422 onmousemove="Presentation.onScrollerDragMove();"
423 onmouseup="Presentation.onScrollerDragDrop();"/>
429 <toolbarbutton id="toggleEva" label="Eva"
432 oncommand="Presentation.toggleEvaMode();"/>
434 <toolbarbutton label="Edit"
435 oncommand="Presentation.toggleEditMode();"/>
436 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>
439 <vbox flex="1" id="canvas"
440 onclick="Presentation.onPresentationClick(event);">
452 <vbox flex="1" id="edit">
455 <toolbarbutton label="New Page"
456 oncommand="Presentation.addPage()"/>
459 <toolbarbutton label="View"
460 oncommand="Presentation.toggleEditMode();"/>
461 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>
464 <textbox id="textField" flex="1" multiline="true"
465 oninput="Presentation.onEdit()"/>
466 <hbox collapsed="true">
467 <iframe id="dataLoader" onload="if (window.Presentation) Presentation.onDataLoad();"/>
475 <broadcaster id="canBack"/>
476 <broadcaster id="canForward"/>
480 <command id="cmd_forward"
481 oncommand="if (Presentation.isPresentationMode) Presentation.forward();"/>
482 <command id="cmd_back"
483 oncommand="if (Presentation.isPresentationMode) Presentation.back();"/>
484 <command id="cmd_home"
485 oncommand="if (Presentation.isPresentationMode) Presentation.home();"/>
486 <command id="cmd_end"
487 oncommand="if (Presentation.isPresentationMode) Presentation.end();"/>
490 <key keycode="VK_ENTER" command="cmd_forward"/>
491 <key keycode="VK_RETURN" command="cmd_forward"/>
492 <key keycode="VK_PAGE_DOWN" command="cmd_forward"/>
493 <key keycode="VK_RIGHT" command="cmd_forward"/>
494 <key keycode="VK_DOWN" command="cmd_forward"/>
495 <!-- key keycode="VK_BACK_SPACE" command="cmd_back"/-->
496 <key keycode="VK_PAGE_UP" command="cmd_back"/>
497 <!-- <key keycode="VK_BACK_UP" command="cmd_back"/>-->
498 <!-- <key keycode="VK_BACK_LEFT" command="cmd_back"/>-->
499 <key keycode="VK_HOME" command="cmd_home"/>
500 <key keycode="VK_END" command="cmd_end"/>
501 <key key="n" modifiers="accel" oncommand="Presentation.addPage();"/>
502 <key key="r" modifiers="accel" oncommand="window.location.reload();"/>
503 <key key="e" modifiers="accel" oncommand="Presentation.toggleEditMode();"/>
504 <key key="a" modifiers="accel" oncommand="Presentation.toggleEvaMode();"/>
508 <script src="takahashi.js" type="application/x-javascript" />
510 <!-- ***** BEGIN LICENSE BLOCK *****
513 - The contents of this file are subject to the Mozilla Public License Version
514 - 1.1 (the "License"); you may not use this file except in compliance with
515 - the License. You may obtain a copy of the License at
516 - http://www.mozilla.org/MPL/
518 - Software distributed under the License is distributed on an "AS IS" basis,
519 - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
520 - for the specific language governing rights and limitations under the
523 - The Original Code is the Takahashi-Method-based Presentation Tool in XUL.
525 - The Initial Developer of the Original Code is SHIMODA Hiroshi.
526 - Portions created by the Initial Developer are Copyright (C) 2005
527 - the Initial Developer. All Rights Reserved.
529 - Contributor(s): SHIMODA Hiroshi <piro@p.club.ne.jp>
531 - ***** END LICENSE BLOCK ***** -->