Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/BlenderExport/ogrepkg/gui.py @ 6

Last change on this file since 6 was 6, checked in by anonymous, 17 years ago

=…

File size: 126.7 KB
RevLine 
[6]1"""Graphical user interface system.
2
3   Widgets properties are classified as mutable or static.
4   Mutable properties have a clear separation between model and view.
5
6   @author Michael Reimpell
7"""
8# Copyright (C) 2005  Michael Reimpell
9#
10# This library is free software; you can redistribute it and/or
11# modify it under the terms of the GNU Lesser General Public
12# License as published by the Free Software Foundation; either
13# version 2.1 of the License, or (at your option) any later version.
14#
15# This library is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18# Lesser General Public License for more details.
19#
20# You should have received a copy of the GNU Lesser General Public
21# License along with this library; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23
24# epydoc doc format
25__docformat__ = "javadoc en"
26
27import os
28import Blender
29from Blender import Draw
30from Blender.BGL import *
31
32import base
33from base import *
34
35class Action:
36        """Action interface.
37       
38           Actions encapsulate user requests.
39        """
40        def __init__(self):
41                """Constructor.
42                """
43                return
44        def execute(self):
45                """Executes the action.
46                """
47                return
48
49class QuitAction(Action):
50        """Quits the windowing system.
51        """
52        def execute(self):
53                Blender.Draw.Exit()
54                return
55
56class Size:
57        """Size hints.
58       
59           @cvar INFINITY Infinity value for size hints.
60        """
61        INFINITY = 2147483647
62        def __init__(self, preferredSize=None, minimumSize=None, maximumSize=None):
63                """Constructor.
64               
65                A size hint is a list of integers <code>[width, height]</code>.
66               
67                @param preferredSize Default <code>[0,0]</code>.
68                @param minimumSize Default <code>[0,0]</code>.
69                @param maximumSize Default <code>[Size.INFINITY, Size.INFINITY]</code>.
70                """
71                self.preferredSize = preferredSize or [0, 0]
72                if minimumSize:
73                        self.minimumSize = minimumSize
74                elif ((self.preferredSize[0] < Size.INFINITY) and (self.preferredSize[1] < Size.INFINITY)):
75                        self.minimumSize = self.preferredSize[:]
76                else:
77                        self.minimumSize = [0, 0]
78                if preferredSize:
79                        self.maximumSize = maximumSize or self.preferredSize[:]
80                else:
81                        self.maximumSize = maximumSize or [Size.INFINITY, Size.INFINITY]
82                return
83        def getPreferredSize(self):
84                return self.preferredSize
85        def getMinimumSize(self):
86                return self.minimumSize
87        def getMaximumSize(self):
88                return self.maximumSize
89
90class Widget:
91        """Widget interface.
92        """
93        def __init__(self, parent, size = Size()):
94                """Constructor.
95               
96                   Overwrite the constructor to get event numbers for all used
97                   actions via a call to <code>parent._addButtonAction()</code>.
98               
99                   @param name The widget name must be unique.
100                   @param size Size hints.
101                """
102                self.parent = parent
103                self.size = size
104                self.parent._addWidget(self)
105                return
106        def draw(self, screenRectangle):
107                """Draws the widget into an area of the screen.
108               
109                   @param screenRectangle Area of the screen to draw into.
110                          The screenRectangle is a list of the integers
111                          <code>[xl, yl, xu, yu]</code>, where (xl,yl) is
112                          the lower left corner of the area and (xu, yu) is
113                          the upper right corner of the area.
114                """
115                return
116        def eventFilter(self, event, value):
117                """Called from event callback function.
118               
119                   @see Blender.Draw.Register
120                """
121                return
122        def getSize(self):
123                """Size hints of the widget.
124               
125                   @return Size object.
126                """
127                return self.size
128        def resize(self, size=None):
129                """Resizes the widget.
130               
131                   @param size New widget size or <code>None</code> to
132                               inform about resize of child widgets.
133                """
134                if size:
135                        self.size = size
136                self.parent.resize()
137                return
138        def removeFromParent(self):
139                """Remove this widget from parent widget.
140               
141                   Remove a widget from its parent before deleting it. Overwrite
142                   this to also remove all button actions separately with a call
143                   to <code>self.parent._removeButtonAction()</code>. This is not
144                   done in the destructor as Python's garbage collector does not
145                   guarantee to delete objects.
146                """
147                self.parent._removeWidget(self)
148                return
149        def _addWidget(self, widget):
150                """Adds a child widget.
151               
152                   @param widget Child widget to add.
153                """
154                raise NotImplementedError
155                return
156        def _removeWidget(self, widget):
157                """Removes a child widget.
158               
159                   @param widget Child widget to remove.
160                """
161                raise NotImplementedError
162                return
163        def _addButtonAction(self, action):
164                """Registers an action for a button event.
165               
166                   @param action Action to execute on receive of the returned button event number.
167                   @return eventNumber Event number to use for the button that corresponds to that action.
168                """
169                return self.parent._addButtonAction(action)
170        def _removeButtonAction(self, eventNumber):
171                """Action for the given event number will no longer be called.
172               
173                   @param eventNumber Event number for the action.
174                """
175                self.parent._removeButtonAction(eventNumber)
176                return
177
178class Spacer(Widget):
179        """Occupies blank space on the screen.
180        """
181        def __init__(self, parent, size):
182                Widget.__init__(self, parent, size)
183                return
184
185class Decorator(Widget):
186        """Decorates a child widget.
187       
188           A decorator does not have a name on its own. It adopts the name
189           of its child widget.
190        """
191        def __init__(self, parent):
192                self.childWidget = None
193                Widget.__init__(self, parent)
194                return
195        def draw(self, screenRectangle):
196                self.childWidget.draw(screenRectangle)
197                return
198        def eventFilter(self, event, value):
199                self.childWidget.eventFilter(event, value)
200                return
201        def getSize(self):
202                if self.childWidget:
203                        size = self.childWidget.getSize()
204                else:
205                        # no child widget yet
206                        size = Size()
207                return size
208        def resize(self, size=None):
209                if size:
210                        # pass resize request to the child
211                        self.childWidget.resize(size)
212                else:
213                        # pass child resize notification to the parent
214                        self.parent.resize()
215                return
216        def _addWidget(self, widget):
217                self.childWidget = widget
218                self.parent.resize()
219                return
220
221class Activator(Decorator):
222        """Enables and disables child widget.
223        """
224        def __init__(self, parent, enabled=1):
225                Decorator.__init__(self, parent)
226                self.enabled = enabled
227        def eventFilter(self, event, value):
228                if self.enabled:
229                        self.childWidget.eventFilter(event, value)
230                return
231        def draw(self, screenRectangle):
232                if self.enabled:
233                        self.childWidget.draw(screenRectangle)
234                return
235        def setEnabled(self, enabled):
236                self.enabled = enabled
237                return
238        def isEnabled(self):
239                return self.enabled
240
241class ValueModel(Model):
242        """Model with a value of arbitrary type.
243        """
244        def __init__(self, value):
245                Model.__init__(self)
246                self.value = None
247                self.setValue(value)
248                return
249        def setValue(self, value):
250                self.value = value
251                self._notify()
252                return
253        def getValue(self):
254                return self.value
255       
256class T(ValueModel):
257        """Short name for ValueModel.
258       
259           @see ValueModel
260        """
261
262class BoundedValueModel(ValueModel):
263        def __init__(self, minimum=0, maximum=0, initial=0):
264                self.minimum = minimum
265                self.maximum = maximum
266                ValueModel.__init__(self, initial)
267                return
268        def getMinimum(self):
269                return self.minimum
270        def getMaximum(self):
271                return self.maximum
272        def setValue(self, value):
273                if (value != self.value):
274                        if value < self.minimum:
275                                self.value = self.minimum
276                        elif value > self.maximum:
277                                self.value = self.maximum
278                        else:
279                                self.value = value
280                        self._notify()
281                return
282
283class BoundedRangeModel(BoundedValueModel):
284        """Model for a bounded range.
285       
286           minimum <= value <= value + extend <= maximum
287        """
288        def __init__(self, minimum=0, initial=0, extend=0, maximum=0):
289                self.extend = 0
290                BoundedValueModel.__init__(self, minimum, maximum, initial)
291                self.setExtend(extend)
292                return
293        def setMaximum(self, maximum, silent=0):
294                if (maximum != self.maximum):
295                        self.maximum = maximum
296                        if self.value > self.maximum:
297                                self.value = self.maximum
298                        if ((self.value + self.extend) > self.maximum):
299                                self.extend = self.maximum - self.value
300                        if not silent:
301                                self._notify()
302                return
303        def setValue(self, value, silent=0):
304                if (value != self.value):
305                        if value < self.minimum:
306                                self.value = self.minimum
307                        elif value > self.maximum:
308                                self.value = self.maximum
309                        else:
310                                self.value = value
311                        if ((self.value + self.extend) > self.maximum):
312                                # minimum <= value <= maximum
313                                # ==> maximum - value >= 0
314                                self.extend = self.maximum - self.value
315                        if not silent:
316                                self._notify()
317                return
318        def getExtend(self):
319                return self.extend
320        def setExtend(self, extend, silent=0):
321                """
322                   @param extend positive integer.
323                """
324                if (extend != self.extend):
325                        if ((self.value + extend) > self.maximum):
326                                self.extend = self.maximum - self.value
327                        else:
328                                self.extend = extend
329                        if not silent:
330                                self._notify()
331                return
332
333class BasenameModel(ValueModel):
334        """Ensure string is a valid file name.
335        """
336        def __init__(self, basename):
337                ValueModel.__init__(self, self._ensureIsBasename(basename))
338                return
339        def setValue(self, basename):
340                ValueModel.setValue(self, self._ensureIsBasename(basename))
341                return
342        def _ensureIsBasename(self, basename):
343                return os.path.basename(basename)
344
345class DirnameModel(ValueModel):
346        """Ensure string is a valid directory name.
347        """
348        def __init__(self, dirname):
349                ValueModel.__init__(self, self._ensureIsDirname(dirname))
350                return
351        def setValue(self, dirname):
352                ValueModel.setValue(self, self._ensureIsDirname(dirname))
353                return
354        def _ensureIsDirname(self, dirname):
355                if os.path.isdir(dirname) and os.path.exists(dirname):
356                        # remove possible trailing seperators
357                        name = os.path.dirname(dirname + os.sep)
358                else:
359                        name = os.path.dirname(dirname)
360                return name
361
362class RedrawView(View):
363        def __init__(self, model):
364                View.__init__(self, model)
365                return
366        def update(self):
367                Blender.Draw.Redraw(1)
368                return
369
370class ActionWidget(Widget):
371        """Widget with single action and tooltip.
372        """
373        def __init__(self, parent, size=Size(), action=Action(), tooltip=None):
374                """Constructor.
375               
376                   @param tooltip Optional widget tooltip string ValueModel.
377                """
378                Widget.__init__(self, parent, size)
379                self.event = self.parent._addButtonAction(action)
380                self.tooltip = tooltip
381                if tooltip:
382                        RedrawView(self.tooltip)
383                return
384        def removeFromParent(self):
385                self.parent._removeButtonAction(self.event)
386                Widget.removeFromParent(self)
387                return
388
389class ActionTitleWidget(ActionWidget):
390        """Widget with single action, title and tooltip.
391        """
392        def __init__(self, parent, size=Size(), action=Action(), title=ValueModel(''), tooltip=None):
393                """Constructor.
394               
395                   @param title Widget title string ValueModel.
396                   @param tooltip Optional widget tooltip string ValueModel.
397                """
398                ActionWidget.__init__(self, parent, size, action, tooltip)
399                self.title = title
400                RedrawView(self.title)
401                return
402       
403class Button(ActionTitleWidget):
404        """Push button.
405        """
406        def __init__(self, parent, size, action, title, tooltip=None):
407                """Constructor.
408               
409                   @param action Action to execute when the button is pushed.
410                """
411                ActionTitleWidget.__init__(self, parent, size, action, title, tooltip)
412                return
413        def draw(self, rect):
414                if self.tooltip:
415                        Blender.Draw.PushButton(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.tooltip.getValue())
416                else:
417                        Blender.Draw.PushButton(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1)
418                return
419
420class ActionView(View):
421        """View with single model and action.
422        """
423        def __init__(self, model):
424                View.__init__(self, model)
425                self.valueButton = Blender.Draw.Create(self.model.getValue())
426                return
427        def update(self):
428                Blender.Draw.Redraw(1)
429                return
430        class ViewAction(Action):
431                def __init__(self, view):
432                        self.view = view
433                        return
434                def execute(self):
435                        self.view.model.setValue(self.view.valueButton.val)
436                        return
437
438class StringView(ActionTitleWidget, ActionView):
439        def __init__(self, parent, size, model, title=ValueModel(''), tooltip=None):
440                """Constructor.
441               
442                   @param model String ValueModel.
443                """
444                ActionView.__init__(self, model)
445                ActionTitleWidget.__init__(self, parent, size, StringView.ViewAction(self), title, tooltip)
446                return
447        def draw(self, rect):
448                if self.tooltip:
449                        self.valueButton = Blender.Draw.String(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.model.getValue(), 255, self.tooltip.getValue())
450                else:
451                        self.valueButton = Blender.Draw.String(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.model.getValue(), 255)
452                return
453
454class ToggleModel(ValueModel):
455        """Interface and default implementation for a toggle model.
456       
457           The toggle value can be <code>True</code> or <code>False</code>.
458        """
459        def toggle(self):
460                if self.getValue():
461                        self.setValue(False)
462                else:
463                        self.setValue(True)
464                return
465
466class ToggleGroup(ValueModel):
467        """An exclusive toggle group.
468       
469           Only one toggle is selected at a time. Returns current active
470           ToggleModel as value.
471        """
472        def __init__(self):
473                # key: ToggleModel, value: ToggleGroup.Toggle
474                self.toggleDict = {}
475                ValueModel.__init__(self, None)
476                return
477        def addToggle(self, model):
478                """Adds a toggle to the toggle group.
479               
480                   @param model ToggleModel.
481                """
482                self.toggleDict[model] = ToggleGroup.Toggle(self, model)
483                if (len(self.toggleDict) == 1):
484                        # always one toggle selected
485                        self.value = model
486                        model.setValue(True)
487                        self._notify()
488                elif model.getValue():
489                        # enable toggle
490                        self._toggle(model)
491                return
492        def removeToggle(self, model):
493                """Removes a toggle from the toggle group.
494               
495                   If the removed toggle was the current active,
496                   select the first toggle instead.
497                   
498                   @param model ToggleModel.
499                """
500                if model in self.toggleDict.keys():
501                        # remove toggle from group
502                        self.toggleDict[model].detachModel()
503                        del self.toggleDict[model]
504                        # update current selected
505                        if (model == self.getValue()):
506                                if (len(self.toggleDict) > 0):
507                                        self.toggleDict.keys()[0].toggle()
508                                else:
509                                        self.value = None
510                                        self._notify()
511                else:
512                        raise KeyError
513                return
514        def setValue(self, value):
515                """Sets a toggle to <code>True</code>.
516               
517                   @param value Key of ToggleModel.
518                """
519                # set value as current active
520                if (value in self.toggleDict.keys()):
521                        self.value = value
522                        self._notify()
523                elif value is None:
524                        pass
525                else:
526                        raise KeyError
527                return
528        def _toggle(self, model):
529                # if self.toggleDict.has_key(model):
530                if model.getValue():
531                        ## selected
532                        if (self.value != model):
533                                # deselect old
534                                oldKey = self.value
535                                self.setValue(model)
536                                if self.toggleDict.has_key(oldKey):
537                                        oldKey.setValue(False)
538                elif (model == self.value):
539                        ## current selected deselected
540                        # select again, as always one toggle is selected
541                        model.setValue(True)
542                return
543        class Toggle(View):
544                def __init__(self, group, model):
545                        View.__init__(self, model)
546                        self.group = group
547                        return
548                def update(self):
549                        self.group._toggle(self.model)
550                        return
551
552class ToggleView(ActionTitleWidget, ActionView):
553        def __init__(self, parent, size, model, title=ValueModel(''), tooltip=None):
554                """Constructor.
555                   @param model ToggleModel.
556                """
557                View.__init__(self, model)
558                ActionTitleWidget.__init__(self, parent, size, ToggleView.ViewAction(self), title, tooltip)
559        def draw(self, rect):
560                if self.tooltip:
561                        Blender.Draw.Toggle(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.model.getValue(), self.tooltip.getValue())
562                else:
563                        Blender.Draw.Toggle(self.title.getValue(), self.event, rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.model.getValue())
564                return
565        class ViewAction(Action):
566                def __init__(self, view):
567                        self.view = view
568                        return
569                def execute(self):
570                        self.view.model.toggle()
571                        return
572
573class ScrollbarBase(Widget, RedrawView):
574        """Scrollbar base class.
575       
576           This class contains code common to VerticalScrollbar and HorizontalScrollbar.       
577           Don't use this class directly, use VerticalScrollbar or HorizontalScrollbar instead.
578        """
579        def __init__(self, parent, size, model):
580                """Constructor.
581               
582                   @param size If l is the desired length of the smaller side, set the larger side to at least 2*l+5.
583                   @param model BoundedRangeModel
584                """
585                Widget.__init__(self, parent, size)
586                RedrawView.__init__(self, model)
587                #  translate MOUSEX and MOUSEY coordinates into local ones
588                self.barRect = [0,0,0,0]
589                self.markerRect = [0,0,0,0]
590                self.mousePressed = 0
591                self.mouseFocusX = 0
592                self.mouseFocusY = 0
593                self.markerFocus = 0
594                self.mousePosition = 0
595                return
596        def _inc(self, amount=1):
597                """limit maximum value to value + extend <= maximum
598                """
599                value = self.model.getValue()
600                value += amount
601                if ((value + self.model.getExtend()) <= self.model.getMaximum()):
602                        self.model.setValue(value)
603                else:
604                        # set to maximum value
605                        self.model.setValue(self.model.getMaximum() - self.model.getExtend())
606                return
607        def _dec(self, amount=1):
608                value = self.model.getValue()
609                value -= amount
610                if (self.model.getMinimum() <= value):
611                        self.model.setValue(value)
612                else:
613                        # set to minimum value
614                        self.model.setValue(self.model.getMinimum())
615                return
616        def _addWidget(self, widget):
617                return
618        class IncAction(Action):
619                def __init__(self, scrollbar):
620                        self.scrollbar = scrollbar
621                        return
622                def execute(self):
623                        self.scrollbar._inc()
624                        return
625        class DecAction(Action):
626                def __init__(self, scrollbar):
627                        self.scrollbar = scrollbar
628                        return
629                def execute(self):
630                        self.scrollbar._dec()
631                        return
632
633class VerticalScrollbar(ScrollbarBase):
634        """Vertical scrollbar.
635        """
636        def __init__(self, parent, size, model):
637                ScrollbarBase.__init__(self, parent, size, model)
638                self.incButton = Button(self, Size(), ScrollbarBase.IncAction(self), ValueModel("\\/"), ValueModel("Scroll down"))
639                self.decButton = Button(self, Size(), ScrollbarBase.DecAction(self), ValueModel("/\\"), ValueModel("Scroll up"))
640                return
641        def draw(self, rect):
642                # buttons
643                buttonSize = rect[2] - rect[0]
644                # \/
645                self.incButton.draw([rect[0], rect[1], rect[2], rect[1] + buttonSize])
646                # /\
647                self.decButton.draw([rect[0], rect[3]-buttonSize, rect[2], rect[3]])
648                # bar
649                # marker and bar are > 3x3 pix each as they have 1 pix border
650                self.barRect = [rect[0], rect[1] + buttonSize, rect[2], rect[3] - buttonSize]
651                Blender.BGL.glColor3f(0.13,0.13,0.13) # dark grey
652                Blender.BGL.glRectf(self.barRect[0], self.barRect[1], self.barRect[2], self.barRect[3])
653                Blender.BGL.glColor3f(0.78,0.78,0.78) # light grey
654                Blender.BGL.glRectf(self.barRect[0] + 1, self.barRect[1], self.barRect[2], self.barRect[3] - 1)
655                Blender.BGL.glColor3f(0.48,0.48,0.48) # grey
656                Blender.BGL.glRectf(self.barRect[0] + 1, self.barRect[1] + 1, self.barRect[2] - 1, self.barRect[3] - 1)
657                # marker
658                #  calculate marker size
659                range = self.model.getMaximum() - self.model.getMinimum()
660                if range:
661                        step = float(self.barRect[3] - self.barRect[1] - 2)/range
662                        # relative positions
663                        markerStart = step*(self.model.getValue() - self.model.getMinimum())
664                        markerEnd = markerStart + step*self.model.getExtend()
665                else:
666                        # relative positions
667                        markerStart = 0.0
668                        markerEnd = self.barRect[3] - self.barRect[1] - 2
669                if ((markerEnd - markerStart) < 3):
670                        # minimal marker size
671                        markerEnd = markerStart + 3
672                self.markerRect = [self.barRect[0] + 1, \
673                                self.barRect[3] - 1 - markerEnd, \
674                                self.barRect[2] - 1, \
675                                self.barRect[3] - 1 - markerStart]
676                #  draw maker
677                Blender.BGL.glColor3f(0.78,0.78,0.78) # light grey
678                Blender.BGL.glRectf(self.markerRect[0], self.markerRect[1], self.markerRect[2], self.markerRect[3])
679                Blender.BGL.glColor3f(0.13,0.13,0.13) # dark grey
680                Blender.BGL.glRectf(self.markerRect[0] + 1, self.markerRect[1], self.markerRect[2], self.markerRect[3] - 1)
681                #  check if marker has foucs
682                if (self.mouseFocusX and self.mouseFocusY and (self.mousePosition > self.markerRect[1]) and (self.mousePosition < self.markerRect[3])):
683                        Blender.BGL.glColor3f(0.64,0.64,0.64) # marker focus grey
684                else:
685                        Blender.BGL.glColor3f(0.60,0.60,0.60) # marker grey
686                Blender.BGL.glRectf(self.markerRect[0] + 1, self.markerRect[1] + 1, self.markerRect[2] - 1, self.markerRect[3] - 1)
687                return
688        def eventFilter(self, event, value):
689                if (value != 0):
690                        # Mouse
691                        if (event == Blender.Draw.MOUSEX):
692                                mousePositionX = value - ScreenManager.getSingleton().getScissorRectangle()[0]
693                                # check if mouse is inside bar
694                                if ((mousePositionX >= self.barRect[0]) and (mousePositionX <= self.barRect[2])):
695                                        # redraw if marker got focus
696                                        if (not self.mouseFocusX) and self.mouseFocusY:
697                                                Blender.Draw.Redraw(1)
698                                        self.mouseFocusX = 1
699                                else:
700                                        # redraw if marker lost focus
701                                        if self.mouseFocusX and self.mouseFocusY:
702                                                Blender.Draw.Redraw(1)
703                                        self.mouseFocusX = 0
704                        elif (event == Blender.Draw.MOUSEY):
705                                # relative mouse position
706                                self.mousePosition = value - ScreenManager.getSingleton().getScissorRectangle()[1]
707                                # check if mouse is inside bar
708                                if ((self.mousePosition >= self.barRect[1]) and (self.mousePosition <= self.barRect[3])):
709                                        self.mouseFocusY = 1
710                                        if ((self.mousePosition > self.markerRect[1]) and (self.mousePosition < self.markerRect[3])):
711                                                # redraw if marker got focus
712                                                if self.mouseFocusX and (not self.markerFocus):
713                                                        Blender.Draw.Redraw(1)
714                                                self.markerFocus = 1
715                                        else:
716                                                # redraw if marker lost focus
717                                                if self.mouseFocusX and self.markerFocus:
718                                                        Blender.Draw.Redraw(1)
719                                                self.markerFocus = 0
720                                        # move marker
721                                        if (self.mousePressed == 1):
722                                                # calculate step from distance to marker
723                                                if (self.mousePosition > self.markerRect[3]):
724                                                        self._dec(1)
725                                                        Blender.Draw.Draw()
726                                                elif (self.mousePosition < self.markerRect[1]):
727                                                        self._inc(1)
728                                                        Blender.Draw.Draw()
729                                else:
730                                        # redraw if marker lost focus
731                                        if self.mouseFocusX and self.markerFocus:
732                                                Blender.Draw.Redraw(1)
733                                        self.markerFocus = 0
734                                        self.mouseFocusY = 0
735                                        self.mousePressed = 0
736                        elif ((event == Blender.Draw.LEFTMOUSE) and (self.mouseFocusX == 1) and (self.mouseFocusY == 1)):
737                                self.mousePressed = 1
738                                # move marker
739                                if (self.mousePosition > self.markerRect[3]):
740                                        self._dec(1)
741                                elif (self.mousePosition < self.markerRect[1]):
742                                        self._inc(1)
743                        elif (event == Blender.Draw.WHEELUPMOUSE):
744                                if self.mouseFocusX and self.mouseFocusY:
745                                        self._dec(1)
746                        elif (event == Blender.Draw.WHEELDOWNMOUSE):
747                                if self.mouseFocusX and self.mouseFocusY:
748                                        self._inc(1)
749                else: # released keys and buttons
750                        if (event == Blender.Draw.LEFTMOUSE):
751                                self.mousePressed = 0
752                return
753
754class HorizontalScrollbar(ScrollbarBase):
755        """Horizontal scrollbar.
756        """
757        def __init__(self, parent, size, model):
758                ScrollbarBase.__init__(self, parent, size, model)
759                self.incButton = Button(self, Size(), ScrollbarBase.IncAction(self), ValueModel(">"), ValueModel("Scroll right"))
760                self.decButton = Button(self, Size(), ScrollbarBase.DecAction(self), ValueModel("<"), ValueModel("Scroll left"))
761                return
762        def draw(self, rect):
763                # buttons
764                buttonSize = rect[3] - rect[1]
765                # <
766                self.decButton.draw([rect[0], rect[1], rect[0] + buttonSize, rect[3]])
767                # >
768                self.incButton.draw([rect[2] - buttonSize, rect[1], rect[2], rect[3]])
769                # bar
770                # marker and bar are > 3x3 pix each as they have 1 pix border
771                #TODO: Missed by one
772                self.barRect = [rect[0] + buttonSize, rect[1] - 1, rect[2] - buttonSize, rect[3] - 1]
773                Blender.BGL.glColor3f(0.13,0.13,0.13) # dark grey
774                Blender.BGL.glRectf(self.barRect[0], self.barRect[1], self.barRect[2], self.barRect[3])
775                Blender.BGL.glColor3f(0.78,0.78,0.78) # light grey
776                Blender.BGL.glRectf(self.barRect[0] + 1, self.barRect[1], self.barRect[2], self.barRect[3] - 1)
777                Blender.BGL.glColor3f(0.48,0.48,0.48) # grey
778                Blender.BGL.glRectf(self.barRect[0] + 1, self.barRect[1] + 1, self.barRect[2] - 1, self.barRect[3] - 1)
779                # marker
780                #  calculate marker size
781                range = self.model.getMaximum() - self.model.getMinimum()
782                if range:
783                        step = float(self.barRect[2] - self.barRect[0] - 2)/range
784                        # relative positions
785                        markerStart = step*(self.model.getValue() - self.model.getMinimum())
786                        markerEnd = markerStart + step*self.model.getExtend()
787                else:
788                        # relative positions
789                        markerStart = 0.0
790                        markerEnd = self.barRect[2] - self.barRect[0] - 2
791                if ((markerEnd - markerStart) < 3):
792                        # minimal marker size
793                        markerEnd = markerStart + 3
794                self.markerRect = [self.barRect[0] + 1 + markerStart, \
795                                self.barRect[1] + 1, \
796                                self.barRect[0] + markerEnd, \
797                                self.barRect[3] - 1]
798                #  draw maker
799                Blender.BGL.glColor3f(0.78,0.78,0.78) # light grey
800                Blender.BGL.glRectf(self.markerRect[0], self.markerRect[1], self.markerRect[2], self.markerRect[3])
801                Blender.BGL.glColor3f(0.13,0.13,0.13) # dark grey
802                Blender.BGL.glRectf(self.markerRect[0] + 1, self.markerRect[1], self.markerRect[2], self.markerRect[3] - 1)
803                #  check if marker has foucs
804                if (self.mouseFocusX and self.mouseFocusY and (self.mousePosition > self.markerRect[0]) and (self.mousePosition < self.markerRect[2])):
805                        Blender.BGL.glColor3f(0.64,0.64,0.64) # marker focus grey
806                else:
807                        Blender.BGL.glColor3f(0.60,0.60,0.60) # marker grey
808                Blender.BGL.glRectf(self.markerRect[0] + 1, self.markerRect[1] + 1, self.markerRect[2] - 1, self.markerRect[3] - 1)
809                return
810        def eventFilter(self, event, value):
811                if (value != 0):
812                        # Mouse
813                        if (event == Blender.Draw.MOUSEY):
814                                mousePositionY = value - ScreenManager.getSingleton().getScissorRectangle()[1]
815                                # check if mouse is inside bar
816                                if ((mousePositionY >= self.barRect[1]) and (mousePositionY <= self.barRect[3])):
817                                        # redraw if marker got focus
818                                        if (not self.mouseFocusY) and self.mouseFocusX:
819                                                Blender.Draw.Redraw(1)
820                                        self.mouseFocusY = 1
821                                else:
822                                        # redraw if marker lost focus
823                                        if self.mouseFocusX and self.mouseFocusY:
824                                                Blender.Draw.Redraw(1)
825                                        self.mouseFocusY = 0
826                        elif (event == Blender.Draw.MOUSEX):
827                                # relative mouse position
828                                self.mousePosition = value - ScreenManager.getSingleton().getScissorRectangle()[0]
829                                # check if mouse is inside bar
830                                if ((self.mousePosition >= self.barRect[0]) and (self.mousePosition <= self.barRect[2])):
831                                        self.mouseFocusX = 1
832                                        if ((self.mousePosition > self.markerRect[0]) and (self.mousePosition < self.markerRect[2])):
833                                                # redraw if marker got focus
834                                                if (not self.markerFocus) and self.mouseFocusY:
835                                                        Blender.Draw.Redraw(1)
836                                                self.markerFocus = 1
837                                        else:
838                                                # redraw if marker lost focus
839                                                if self.mouseFocusX and self.markerFocus:
840                                                        Blender.Draw.Redraw(1)
841                                                self.markerFocus = 0
842                                        # move marker
843                                        if (self.mousePressed == 1):
844                                                # calculate step from distance to marker
845                                                if (self.mousePosition > self.markerRect[2]):
846                                                        self._inc(1)
847                                                        Blender.Draw.Draw()
848                                                elif (self.mousePosition < self.markerRect[0]):
849                                                        self._dec(1)
850                                                        Blender.Draw.Draw()
851                                else:
852                                        # redraw if marker lost focus
853                                        if self.mouseFocusX and self.markerFocus:
854                                                Blender.Draw.Redraw(1)
855                                        self.markerFocus = 0
856                                        self.mouseFocusX = 0
857                                        self.mousePressed = 0
858                        elif ((event == Blender.Draw.LEFTMOUSE) and (self.mouseFocusX == 1) and (self.mouseFocusY == 1)):
859                                self.mousePressed = 1
860                                # move marker
861                                if (self.mousePosition > self.markerRect[2]):
862                                        self._inc(1)
863                                elif (self.mousePosition < self.markerRect[0]):
864                                        self._dec(1)
865                        elif (event == Blender.Draw.WHEELUPMOUSE):
866                                if self.mouseFocusX and self.mouseFocusY:
867                                        self._dec(1)
868                        elif (event == Blender.Draw.WHEELDOWNMOUSE):
869                                if self.mouseFocusX and self.mouseFocusY:
870                                        self._inc(1)
871                else: # released keys and buttons
872                        if (event == Blender.Draw.LEFTMOUSE):
873                                self.mousePressed = 0
874                return
875
876class NumberView(ActionTitleWidget, ActionView):
877        def __init__(self, parent, size, model, title=ValueModel(''), tooltip=None):
878                """Constructor.
879               
880                   @param model BoundedValueModel.
881                """
882                ActionView.__init__(self, model)
883                ActionTitleWidget.__init__(self, parent, size, StringView.ViewAction(self), title, tooltip)
884                return
885        def draw(self, rect):
886                if self.tooltip:
887                        self.valueButton = Blender.Draw.Number(self.title.getValue(), self.event, \
888                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, \
889                                self.model.getValue(), self.model.getMinimum(), self.model.getMaximum(), self.tooltip.getValue())
890                else:
891                        self.valueButton = Blender.Draw.Number(self.title.getValue(), self.event, \
892                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, \
893                                self.model.getValue(), self.model.getMinimum(), self.model.getMaximum())
894                return
895
896class SliderView(ActionTitleWidget, ActionView):
897        def __init__(self, parent, size, model, title=ValueModel(''), tooltip=None):
898                """Constructor.
899               
900                   @param model BoundedValueModel.
901                """
902                ActionView.__init__(self, model)
903                ActionTitleWidget.__init__(self, parent, size, StringView.ViewAction(self), title, tooltip)
904                return
905        def draw(self, rect):
906                if self.tooltip:
907                        self.valueButton = Blender.Draw.Slider(self.title.getValue(), self.event, \
908                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, \
909                                self.model.getValue(), self.model.getMinimum(), self.model.getMaximum(), 1, self.tooltip.getValue())
910                else:
911                        self.valueButton = Blender.Draw.Slider(self.title.getValue(), self.event, \
912                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, \
913                                self.model.getValue(), self.model.getMinimum(), self.model.getMaximum(), 1)
914                return
915
916class MenuItem(ValueModel):
917        def __init__(self, text, action=Action()):
918                """Constructor.
919               
920                   @param text Item string.
921                   @param action Action to execute on selection.
922                """
923                ValueModel.__init__(self, text)
924                self.action = action
925                return
926        def select(self):
927                self.action.execute()
928                return
929
930class MenuTitle(MenuItem):
931        def __init__(self, text):
932                MenuItem.__init__(self, text + " %t")
933                return
934        def setValue(self, value):
935                MenuItem.setValue(self, value + " %t")
936                return
937
938class MenuSeparator(MenuItem):
939        def __init__(self):
940                MenuItem.__init__(self, " %l")
941                return
942        def setValue(self, value):
943                raise NotImplementedError
944                return
945
946class Menu(ActionWidget):
947        """Blender menu button.
948        """
949        def __init__(self, parent, size, tooltip=None):
950                """Constructor.
951               
952                   @param title Optional title ValueModel.
953                """
954                ActionWidget.__init__(self, parent, size, Menu.SelectAction(self), tooltip)
955                # cached menu string
956                self.menuString = ''
957                # current selected item id
958                self.current = 0
959                # id management
960                #  display order of ids in menu
961                #  value: id
962                self.displayList = []
963                #  key: id, value: MenuItem
964                self.itemDict = {}
965                self.valueButton = Blender.Draw.Create(0)
966                return
967        def update(self):
968                """Update cached menu string.
969                """
970                self.menuString = ''
971                for itemId in self.displayList:
972                        self.menuString = self.menuString + self.itemDict[itemId].getValue() + " %x" + str(itemId) + "|"
973                return
974        def insertItem(self, menuItem, position, setCurrent=False):
975                """Inserts a menu item into a specific position of the display list.
976                """
977                id = self._getId(menuItem, setCurrent)
978                self.displayList.insert(position, id)
979                # recreate menu string
980                self.update()
981                return id
982        def appendItem(self, menuItem, setCurrent=False):
983                """Appends an item to the menu.
984               
985                   @param menuItem The MenuItem to add.
986                   @param setCurrent Sets the item to be the current selected.
987                   @return Item identifier.
988                """
989                # get free id
990                id = self._getId(menuItem, setCurrent)
991                # append id
992                self.displayList.append(id)
993                # create menu string
994                self.menuString = self.menuString + menuItem.getValue() + " %x" + str(id) + "|"
995                return id
996        def removeItem(self, id):
997                if id in self.displayList:
998                        # remove id
999                        if self.current == id:
1000                                self.current = 0
1001                        del self.itemDict[id]
1002                        self.displayList.remove(id)
1003                        # recreate menu string
1004                        self.update()
1005                return
1006        def removeAll(self):
1007                """Removes all menu items.
1008                """
1009                self.itemDict = {}
1010                self.displayList = []
1011                self.current = 0
1012                self.menuString = ''
1013                return
1014        def draw(self, rect):
1015                if self.tooltip:
1016                        self.valueButton = Blender.Draw.Menu(self.menuString, self.event, \
1017                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.current, self.tooltip.getValue())
1018                else:
1019                        self.valueButton = Blender.Draw.Menu(self.menuString, self.event, \
1020                                rect[0], rect[1], rect[2]-rect[0]-1, rect[3]-rect[1]-1, self.current.getValue())
1021                return
1022        def _getId(self, menuItem, setCurrent):
1023                """Creates an id for the menuItem and optinally set it to current menu string.
1024                """
1025                #  get a free id (button value)
1026                if (len(self.itemDict) == len(self.displayList)):
1027                        #  Blender's button values start with 1
1028                        id = len(self.displayList) + 1
1029                else:
1030                        #  first unused
1031                        id = [(x+1) for x in range(len(self.displayList)) if (x+1) not in self.itemDict.keys()][0]
1032                #  assign menu item to that id
1033                self.itemDict[id] = menuItem
1034                # manage current state
1035                if setCurrent:
1036                        self.current = id
1037                return id
1038        class SelectAction(Action):
1039                def __init__(self, menu):
1040                        self.menu = menu
1041                        return
1042                def execute(self):
1043                        if self.menu.valueButton.val in self.menu.displayList:
1044                                self.menu.itemDict[self.menu.valueButton.val].select()
1045                                self.menu.current = self.menu.valueButton.val
1046                        return
1047
1048class Border(Decorator):
1049        """Fixed border around widgets.
1050        """
1051        def __init__(self, parent, borderSize=10):
1052                """Constructor.
1053               
1054                   @param borderSize Size of the border.
1055                """
1056                Decorator.__init__(self, parent)
1057                self.borderSize = borderSize
1058                return
1059        def draw(self, screenRectangle):
1060                rect = screenRectangle[:]
1061                rect[0] += self.borderSize
1062                rect[1] += self.borderSize
1063                rect[2] -= self.borderSize
1064                rect[3] -= self.borderSize
1065                self.childWidget.draw(rect)
1066                return
1067        def getSize(self):
1068                prefSize = self.childWidget.getSize().getPreferredSize()[:]
1069                prefSize[0] += 2*self.borderSize
1070                prefSize[1] += 2*self.borderSize
1071                minSize = self.childWidget.getSize().getMinimumSize()[:]
1072                minSize[0] += 2*self.borderSize
1073                minSize[1] += 2*self.borderSize
1074                maxSize = self.childWidget.getSize().getMaximumSize()[:]
1075                maxSize[0] += 2*self.borderSize
1076                maxSize[1] += 2*self.borderSize
1077                return Size(prefSize, minSize, maxSize)
1078
1079class LabelModel(Model):
1080        def __init__(self, text, fontsize='normal', color=None):
1081                """Constructor.
1082               
1083                   @param text Text to display.
1084                   @param fontsize 'large', 'normal', 'small' or 'tiny'
1085                   @param color List of font color values.
1086                """
1087                Model.__init__(self)
1088                self.text = text
1089                if fontsize in ['large', 'normal', 'small', 'tiny']:
1090                        self.fontsize = fontsize
1091                else:
1092                        raise ValueError
1093                self.color = color
1094                return
1095        def setText(self, text):
1096                self.text = text
1097                self._notify()
1098                return
1099        def getText(self):
1100                return self.text
1101        def setFontsize(self, fontsize):
1102                if fontsize in ['large', 'normal', 'small', 'tiny']:
1103                        self.fontsize = fontsize
1104                        self._notify()
1105                else:
1106                        raise ValueError
1107                return
1108        def getFontsize(self):
1109                return self.fontsize
1110        def setColor(self, color):
1111                self.color = color
1112                self._notify()
1113        def getColor(self):
1114                return self.color
1115
1116class L(LabelModel):
1117        """Short name for LabelModel.
1118       
1119           @see LabelModel
1120        """
1121
1122class LabelView(Widget, View):
1123        """Displays a text string.
1124        """
1125        _HEIGHTDICT = {'large':14, 'normal':12, 'small':10, 'tiny':8}
1126        _YSHIFT = {'large':5, 'normal':4, 'small':3, 'tiny':2}
1127        def __init__(self, parent, model, size=None):
1128                View.__init__(self, model)
1129                if not size:
1130                        self.calculateSize = True
1131                        size = self._calculateSize()
1132                else:
1133                        self.calculateSize = False
1134                Widget.__init__(self, parent, size)
1135                return
1136        def draw(self, screenRectangle):
1137                range = len(self.model.getText())
1138                while ((range > 0) and (Blender.Draw.GetStringWidth(self.model.getText()[:range], self.model.getFontsize()) > (screenRectangle[2] - screenRectangle[0]))):
1139                        range -= 1
1140                if self.model.getColor():
1141                        if (len(self.model.getColor()) == 3):
1142                                glColor3f(*self.model.getColor())
1143                        else:
1144                                glColor4f(*self.model.getColor())
1145                else:
1146                        # theme font color
1147                        theme = Blender.Window.Theme.Get()[0]
1148                        glColor4ub(*theme.get('text').text)
1149                glRasterPos2i(screenRectangle[0], screenRectangle[1] + LabelView._YSHIFT[self.model.getFontsize()])
1150                Blender.Draw.Text(self.model.getText()[:range], self.model.getFontsize())
1151                return
1152        def update(self):
1153                if self.calculateSize:
1154                        self.size = self._calculateSize()
1155                Blender.Draw.Redraw(1)
1156                return
1157        def _calculateSize(self):
1158                size = [0, 0]
1159                size[0] = Blender.Draw.GetStringWidth(self.model.getText(), self.model.getFontsize())
1160                size[1] = LabelView._HEIGHTDICT[self.model.getFontsize()]
1161                return Size(size, size, size)
1162
1163class Box(Decorator):
1164        """Provides a border with an optional title for a child widget.
1165        """
1166        def __init__(self, parent, label=None, outerBorder=0, innerBorder=0):
1167                """Constructor.
1168               
1169                   @param childWidget Widget to decorate.
1170                   @param label Optional LabelModel as title.
1171                """
1172                # borders
1173                self.outerBorder = outerBorder
1174                self.innerBorder = innerBorder
1175                self.model = label
1176                self.view = None
1177                if self.model:
1178                        self.model.addView(self)
1179                        # use view to caculate size only
1180                        self.view = LabelView(Box.NoParent(), self.model)
1181                Decorator.__init__(self, parent)
1182                return
1183        def draw(self, screenRectangle):
1184                rect = screenRectangle[:]
1185                rect[0] += self.outerBorder
1186                rect[1] += self.outerBorder
1187                rect[2] -= self.outerBorder
1188                rect[3] -= self.outerBorder
1189                if self.model:
1190                        # title
1191                        [labelWidth, labelHeight] = self.view.getSize().getMinimumSize()
1192                        self.view.draw([rect[0] + 7, rect[3] - labelHeight, rect[0] + 7 + labelWidth, rect[3]])
1193                        # border
1194                        glColor3f(0.0, 0.0, 0.0)
1195                        glBegin(GL_LINE_STRIP)
1196                        # 5--6   TITLE  1--2
1197                        # |                |
1198                        # 4----------------3
1199                        glVertex2i(rect[0] + 9 + labelWidth, rect[3] - int(labelHeight/2.0))
1200                        glVertex2i(rect[2], rect[3] - int(labelHeight/2.0))
1201                        glVertex2i(rect[2], rect[1])
1202                        glVertex2i(rect[0], rect[1])
1203                        glVertex2i(rect[0], rect[3]  - int(labelHeight/2.0))
1204                        glVertex2i(rect[0] + 3, rect[3] - int(labelHeight/2.0))
1205                        glEnd()
1206                        rect[0] += 1
1207                        rect[1] += 1
1208                        rect[2] -= 1
1209                        rect[3] -= labelHeight
1210                else:
1211                        # border only
1212                        glColor3f(0.0, 0.0, 0.0)
1213                        glBegin(GL_LINE_STRIP)
1214                        glVertex2i(rect[0], rect[1])
1215                        glVertex2i(rect[0], rect[3])
1216                        glVertex2i(rect[2], rect[3])
1217                        glVertex2i(rect[2], rect[1])
1218                        glVertex2i(rect[0], rect[1])
1219                        glEnd()
1220                        rect[0] += 1
1221                        rect[1] += 1
1222                        rect[2] -= 1
1223                        rect[3] -= 1
1224                rect[0] += self.innerBorder
1225                rect[1] += self.innerBorder
1226                rect[2] -= self.innerBorder
1227                rect[3] -= self.innerBorder
1228                self.childWidget.draw(rect)
1229                return
1230        def getSize(self):
1231                if self.childWidget:
1232                        minSize = self.childWidget.getSize().getMinimumSize()[:]
1233                        prefSize = self.childWidget.getSize().getPreferredSize()[:]
1234                        maxSize = self.childWidget.getSize().getMaximumSize()[:]
1235                else:
1236                        minSize = [0, 0]
1237                        prefSize = [0, 0]
1238                        maxSize = [0, 0]
1239                # border
1240                minSize[0] += 2 + 2*self.outerBorder + 2*self.innerBorder
1241                minSize[1] += 2 + 2*self.outerBorder + 2*self.innerBorder
1242                prefSize[0] += 2 + 2*self.outerBorder + 2*self.innerBorder
1243                prefSize[1] += 2 + 2*self.outerBorder + 2*self.innerBorder
1244                maxSize[0] += 2 + 2*self.outerBorder + 2*self.innerBorder
1245                maxSize[1] += 2 + 2*self.outerBorder + 2*self.innerBorder
1246                if self.model:
1247                        titleSize = self.view.getSize()
1248                        # 1+3 +3  +x  +3+1 = 11+x
1249                        # +---___TITLE___+ y
1250                        # |              | +
1251                        # +--------------+ 1
1252                        if (minSize[0] < (titleSize.getMinimumSize()[0] + 9)):
1253                                minSize[0] += 9 + titleSize.getMinimumSize()[0]
1254                                prefSize[0] += 9 + titleSize.getPreferredSize()[0]
1255                                maxSize[0] += 9 + titleSize.getMaximumSize()[0]
1256                        minSize[1] += titleSize.getMinimumSize()[1] - 1
1257                        prefSize[1] += titleSize.getPreferredSize()[1] - 1
1258                        maxSize[1] += titleSize.getMaximumSize()[1] - 1
1259                return Size(prefSize, minSize, maxSize)
1260        class NoParent(Widget):
1261                """Widget acts as dummy parent.
1262                """
1263                def __init__(self):
1264                        return
1265                def resize(self, size=None):
1266                        return
1267                def _addWidget(self, widget):
1268                        return
1269                def _removeWidget(self, widget):
1270                        return
1271
1272class OgreFrame(Decorator):
1273        """Ogre Logo, Title and border.
1274        """
1275        OGRE_LOGO = Buffer(GL_BYTE, [48,122*4],[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,64,0,0,0,95,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1276[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,0,0,0,127,0,1,0,127,0,2,0,127,2,5,2,127,2,5,2,127,4,6,4,127,5,8,5,127,8,11,8,127,8,11,8,127,3,5,3,127,2,3,2,127,0,1,0,127,0,1,0,127,0,1,0,127,0,1,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1277[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,1,2,1,127,4,6,4,127,10,13,10,127,18,22,18,127,23,28,23,127,24,30,24,127,25,31,25,127,25,31,25,127,26,32,26,127,26,32,26,127,26,32,26,127,25,31,25,127,24,30,24,127,18,23,18,127,3,5,3,127,4,6,4,127,8,11,8,127,9,12,9,127,13,17,13,127,17,22,17,127,15,19,15,127,7,9,7,127,1,2,1,127,0,0,0,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1278[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,2,4,2,127,4,6,4,127,18,22,18,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,18,22,18,127,15,19,15,127,20,26,20,127,25,31,25,127,26,32,26,127,26,32,26,127,25,31,25,127,25,31,25,127,25,31,25,127,26,32,26,127,24,30,24,127,16,20,16,127,4,5,4,127,0,0,0,95,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1279[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,1,1,1,127,13,15,13,127,12,15,12,127,24,29,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,29,23,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,3,5,3,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1280[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,1,1,1,127,19,24,19,127,11,15,11,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,17,21,17,127,22,28,22,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,3,5,3,127,0,0,0,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1281[0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,20,24,20,127,16,20,16,127,20,25,20,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,22,28,22,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,3,5,3,127,0,0,0,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1282[0,0,0,0,0,0,0,0,0,0,0,64,5,7,5,127,26,32,26,127,15,19,15,127,41,48,41,127,38,45,38,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,3,4,3,127,0,0,0,127,58,66,58,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1283[0,0,0,0,0,0,0,0,0,0,0,127,20,24,20,127,27,34,27,127,26,32,26,127,47,55,47,127,47,55,47,127,39,46,39,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,11,16,11,127,0,1,0,127,3,3,3,127,94,106,94,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1284[0,0,0,0,0,0,0,0,0,0,0,127,33,39,33,127,45,52,45,127,28,32,28,127,47,55,47,127,44,51,44,127,39,46,39,127,27,33,27,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,21,26,21,127,0,2,0,127,0,0,0,127,23,26,23,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1285[0,0,0,0,0,0,0,0,0,0,0,127,24,28,24,127,33,40,33,127,18,22,18,127,29,35,29,127,25,31,25,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,5,8,5,127,1,2,1,127,0,0,0,127,70,79,70,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,94,105,94,127,70,79,70,127,76,86,76,127,90,101,90,127,103,116,103,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1286[0,0,0,0,0,0,0,64,0,0,0,127,4,6,4,127,12,16,12,127,22,27,22,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,29,23,127,28,34,28,127,35,42,35,127,28,35,28,127,25,31,25,127,23,29,23,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,17,21,17,127,0,2,0,127,0,0,0,127,31,36,31,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,100,112,100,127,92,103,92,127,103,116,103,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,100,112,100,127,81,92,81,127,68,77,68,127,65,73,65,127,65,73,65,127,76,86,76,127,78,88,78,127,83,94,83,127,92,103,92,127,85,95,85,127,31,35,31,127,6,7,6,127,6,7,6,127,13,14,13,127,13,14,13,127,19,21,19,127,26,29,26,127,26,29,26,127,48,54,48,127,96,108,96,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,70,78,70,127,3,3,3,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,12,13,11,127,23,26,23,127,36,40,36,127,49,55,49,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1287[0,0,0,64,0,0,0,127,2,4,2,127,16,20,16,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,26,33,26,127,59,68,59,127,81,91,81,127,87,98,87,127,86,96,86,127,80,90,80,127,71,79,71,127,59,66,59,127,36,41,35,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,31,24,127,26,32,26,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,5,8,5,127,0,1,0,127,18,20,18,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,91,103,91,127,58,65,58,127,29,33,29,127,6,7,6,127,0,0,0,127,0,0,0,127,1,2,1,127,22,24,22,127,54,61,54,127,94,106,94,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,88,99,88,127,51,58,51,127,18,21,18,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,17,19,17,127,48,54,48,127,80,91,80,127,102,115,102,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,29,33,29,127,0,0,0,127,41,31,14,127,33,25,11,127,18,14,6,127,2,2,1,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1288[0,0,0,127,2,3,2,127,24,29,24,127,26,32,26,127,24,30,24,127,25,31,25,127,24,30,24,127,24,30,24,127,24,30,24,127,23,29,23,127,34,41,34,127,78,88,78,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,97,87,127,87,97,87,127,84,93,84,127,62,69,62,127,34,40,34,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,28,23,127,26,30,26,127,36,38,36,127,47,50,46,127,39,42,37,127,34,40,34,127,30,37,30,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,15,19,15,127,0,1,0,127,0,0,0,127,102,115,102,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,94,106,94,127,43,48,43,127,4,5,4,127,0,0,0,127,0,0,0,127,0,0,0,127,6,5,2,127,16,12,5,127,2,2,1,127,0,0,0,127,0,0,0,127,7,8,7,127,58,65,58,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,96,108,96,127,41,47,41,127,1,1,1,127,0,0,0,127,0,0,0,127,6,5,2,127,27,21,9,127,42,33,14,127,46,36,16,127,46,36,16,127,33,25,11,127,31,24,11,127,25,19,9,127,16,12,5,127,12,9,4,127,0,0,0,127,107,82,36,127,115,88,38,127,107,82,36,127,107,82,36,127,100,76,33,127,92,71,31,127,88,68,30,127,0,0,0,127,4,3,2,127,0,0,0,127,0,0,0,127,0,0,0,127,13,15,13,127,65,73,65,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,13,14,13,127,0,0,0,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,109,84,36,127,96,73,32,127,80,62,27,127,65,50,22,127,52,40,17,127,37,28,12,127,21,16,7,127,2,2,1,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1289[0,0,0,127,9,11,9,127,48,56,48,127,45,53,45,127,41,48,41,127,33,40,33,127,34,41,34,127,37,44,37,127,54,62,54,127,77,87,77,127,87,97,87,127,87,97,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,79,88,79,127,61,69,61,127,25,31,25,127,25,31,25,127,23,28,23,127,19,23,19,127,42,43,41,127,60,60,59,127,61,61,59,127,61,61,59,127,63,63,61,127,35,37,34,127,38,45,38,127,33,39,33,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,15,19,15,127,0,1,0,127,0,0,0,127,102,115,102,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,81,91,81,127,9,11,9,127,0,0,0,127,2,2,1,127,44,34,15,127,86,66,29,127,115,88,38,127,122,94,41,127,122,94,41,127,121,92,40,127,94,72,31,127,39,30,13,127,0,0,0,127,0,0,0,127,40,45,40,127,101,114,101,127,105,118,105,127,105,118,105,127,105,118,105,127,85,95,85,127,11,13,11,127,0,0,0,127,4,3,2,127,50,38,17,127,94,72,31,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,92,71,31,127,0,0,0,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,2,2,1,127,105,81,35,127,98,75,33,127,60,46,20,127,23,18,8,127,0,0,0,127,1,1,1,127,90,102,90,127,105,118,105,127,105,118,105,127,105,118,105,127,6,7,6,127,0,0,0,127,115,88,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,8,6,3,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1290[0,0,0,127,3,5,3,127,45,53,45,127,46,54,46,127,46,54,46,127,47,55,47,127,46,54,46,127,68,78,68,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,98,87,127,67,76,67,127,38,46,38,127,21,26,21,127,50,52,50,127,60,60,59,127,61,61,59,127,60,60,58,127,60,60,58,127,60,60,58,127,61,61,59,127,39,41,38,127,52,59,52,127,67,76,67,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,15,19,15,127,0,1,0,127,0,0,0,127,102,115,102,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,59,67,59,127,1,1,1,127,0,0,0,127,35,27,12,127,105,81,35,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,86,66,29,127,8,6,3,127,0,0,0,127,36,40,36,127,105,118,105,127,105,118,105,127,82,92,82,127,7,7,7,127,0,0,0,127,31,24,10,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,80,62,27,127,0,0,0,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,82,63,28,127,46,36,16,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,27,21,9,127,0,0,0,127,78,88,78,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,127,0,0,0,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1291[0,0,0,127,0,2,0,127,41,49,41,127,46,54,46,127,46,54,46,127,49,56,49,127,77,87,77,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,85,96,85,127,55,64,55,127,44,52,44,127,23,28,23,127,17,22,17,127,90,92,90,127,84,84,82,127,60,60,58,127,60,60,58,127,60,60,58,127,60,60,58,127,61,61,59,127,39,41,38,127,54,62,54,127,62,71,62,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,15,20,15,127,0,1,0,127,0,0,0,127,102,115,102,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,81,90,81,127,1,1,1,127,0,0,0,127,61,47,21,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,103,79,34,127,12,9,4,127,0,0,0,127,47,52,47,127,93,104,93,127,8,9,8,127,0,0,0,127,52,40,17,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,0,0,0,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,63,49,21,127,105,81,35,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,0,0,0,127,9,11,9,127,101,113,101,127,105,118,105,127,105,118,105,127,105,118,105,127,0,0,0,127,0,0,0,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,69,53,23,127,0,0,0,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1292[0,0,0,127,0,1,0,127,37,44,37,127,46,54,46,127,49,57,49,127,79,89,79,127,87,97,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,56,64,56,127,46,53,46,127,25,31,25,127,22,27,22,127,25,31,25,127,44,47,44,127,116,116,115,127,59,59,57,127,60,60,58,127,60,60,58,127,60,60,58,127,61,61,59,127,38,41,37,127,69,78,69,127,45,53,45,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,15,20,15,127,0,0,0,127,5,6,5,127,104,117,104,127,105,118,105,127,105,118,105,127,105,118,105,127,93,104,93,127,8,9,8,127,0,0,0,127,61,47,21,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,96,73,32,127,2,2,1,127,0,0,0,127,24,28,24,127,0,0,0,127,37,28,12,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,10,8,3,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,88,68,30,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,39,30,13,127,0,0,0,127,43,49,43,127,105,118,105,127,105,118,105,127,105,118,105,127,93,105,93,127,0,0,0,127,14,11,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,39,30,13,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1293[0,0,0,64,0,1,0,127,21,25,21,127,48,57,49,127,82,92,82,127,87,97,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,97,87,127,87,98,87,127,60,69,60,127,43,50,43,127,29,36,29,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,116,116,116,127,71,71,70,127,60,60,58,127,60,60,58,127,60,60,58,127,62,62,60,127,30,32,29,127,75,85,75,127,29,36,29,127,25,31,25,127,24,30,24,127,24,30,24,127,23,28,23,127,10,14,10,127,0,0,0,127,40,45,40,127,105,118,105,127,105,118,105,127,105,118,105,127,105,118,105,127,33,38,33,127,0,0,0,127,39,30,13,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,67,52,23,127,0,0,0,127,0,0,0,127,10,8,3,127,113,87,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,107,82,36,127,84,65,28,127,71,54,24,127,115,88,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,67,51,22,127,16,12,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,105,81,35,127,2,2,1,127,0,0,0,127,0,0,0,127,18,21,18,127,61,69,61,127,102,115,102,127,92,103,92,127,0,0,0,127,16,12,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,60,46,20,127,52,40,17,127,69,53,23,127,86,66,29,127,10,8,3,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1294[0,0,0,0,0,0,0,127,2,5,2,127,49,57,49,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,98,87,127,86,97,86,127,75,84,75,127,53,61,53,127,34,41,34,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,22,28,22,127,96,97,96,127,93,93,92,127,59,59,58,127,60,60,58,127,60,60,58,127,61,61,59,127,34,39,34,127,74,84,74,127,23,29,23,127,25,31,25,127,37,39,34,127,47,47,41,127,44,45,39,127,17,18,16,127,0,0,0,127,52,59,52,127,105,118,105,127,105,118,105,127,105,118,105,127,81,92,81,127,0,0,0,127,8,6,3,127,111,85,37,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,50,38,17,127,16,12,5,127,33,25,11,127,103,79,34,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,23,18,8,127,0,0,0,127,69,53,23,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,27,21,9,127,0,0,0,127,0,0,0,127,0,0,0,127,92,71,31,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,61,47,21,127,18,14,6,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,117,90,39,127,88,68,29,127,54,41,18,127,14,11,5,127,0,0,0,127,0,0,0,127,17,18,17,127,68,76,68,127,0,0,0,127,21,16,7,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,31,24,11,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1295[0,0,0,0,0,0,0,95,0,0,0,127,37,43,37,127,89,100,89,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,97,87,127,88,99,88,127,82,92,82,127,61,69,61,127,36,42,36,127,27,32,27,127,23,29,23,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,29,23,127,78,80,76,127,102,102,102,127,58,58,57,127,60,60,58,127,60,60,58,127,58,58,56,127,40,47,40,127,56,64,56,127,24,29,23,127,44,45,40,127,49,49,43,127,49,49,43,127,46,46,41,127,41,42,37,127,0,0,0,127,38,43,38,127,105,118,105,127,105,118,105,127,105,118,105,127,33,37,33,127,0,0,0,127,61,47,21,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,0,0,0,127,0,0,0,127,0,0,0,127,12,9,4,127,113,87,38,127,122,94,41,127,122,94,41,127,122,94,41,127,84,65,28,127,4,3,2,127,115,88,38,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,42,33,14,127,0,0,0,127,119,91,40,127,102,78,34,127,75,57,25,127,52,40,17,127,88,68,29,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,61,47,21,127,31,24,11,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,84,65,28,127,19,15,7,127,0,0,0,127,4,5,4,127,0,0,0,127,31,24,11,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,111,85,37,127,115,88,38,127,122,94,41,127,122,94,41,127,48,37,16,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1296[0,0,0,0,0,0,0,32,0,0,0,127,6,7,5,127,67,75,67,127,89,100,89,127,87,97,87,127,87,97,87,127,87,98,87,127,88,99,88,127,88,98,88,127,80,90,80,127,62,71,62,127,45,52,45,127,39,46,39,127,57,65,57,127,65,74,65,127,59,67,59,127,54,61,54,127,55,61,55,127,28,34,28,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,64,67,64,127,109,109,108,127,58,58,57,127,60,60,58,127,61,60,59,127,50,50,47,127,47,55,47,127,33,39,33,127,44,44,39,127,48,48,42,127,48,48,42,127,28,30,25,127,36,37,31,127,48,48,42,127,1,2,1,127,36,41,36,127,105,118,105,127,105,118,105,127,99,111,99,127,4,5,4,127,2,2,1,127,113,87,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,65,50,22,127,0,0,0,127,30,34,30,127,27,30,27,127,0,0,0,127,67,51,22,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,58,44,19,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,71,54,24,127,0,0,0,127,18,14,6,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,54,41,18,127,31,24,11,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,56,43,19,127,0,0,0,127,0,0,0,127,31,24,11,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,37,28,12,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1297[0,0,0,0,0,0,0,0,0,0,0,95,0,0,0,127,2,3,2,127,28,32,28,127,58,65,58,127,56,64,56,127,50,57,50,127,46,54,46,127,42,49,42,127,43,50,43,127,62,71,62,127,80,90,80,127,87,98,87,127,87,98,87,127,87,97,87,127,87,98,87,127,86,97,87,127,78,85,78,127,46,52,46,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,64,67,64,127,104,104,104,127,58,58,57,127,60,60,58,127,62,61,60,127,34,38,33,127,37,43,37,127,50,51,44,127,48,48,42,127,48,48,42,127,23,27,22,127,32,36,30,127,95,95,82,127,43,45,39,127,0,0,0,127,45,51,45,127,105,118,105,127,105,118,105,127,71,80,71,127,0,0,0,127,35,27,12,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,103,79,35,127,2,2,1,127,0,0,0,127,11,13,11,127,0,0,0,127,65,50,22,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,23,18,8,127,0,0,0,127,35,27,12,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,46,36,16,127,41,31,14,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,119,91,40,127,37,28,12,127,50,38,17,127,73,56,24,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,69,53,23,127,0,0,0,127,44,34,15,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,27,21,9,127,0,0,0,127,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,0,0,0,0,0],
1298[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,8,10,8,127,51,59,51,127,84,95,84,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,87,127,63,71,63,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,23,29,23,127,76,78,75,127,100,100,99,127,58,58,57,127,61,60,59,127,53,54,51,127,24,30,24,127,29,33,28,127,77,76,63,127,47,48,42,127,29,32,27,127,24,30,24,127,30,35,29,127,90,91,84,127,28,29,25,127,0,0,0,127,77,86,76,127,105,118,105,127,105,118,105,127,44,50,44,127,0,0,0,127,69,53,23,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,81,62,27,127,4,3,2,127,0,0,0,127,12,9,4,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,4,3,2,127,0,0,0,127,54,41,18,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,46,36,16,127,46,36,16,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,48,37,16,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,42,33,14,127,46,36,16,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,16,12,5,127,0,0,0,127,0,0,0,127,4,3,2,127,6,5,2,127,0,0,0,95,0,0,0,0],
1299[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,64,0,0,0,95,1,1,1,127,60,68,60,127,87,98,87,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,97,87,127,73,82,73,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,22,28,22,127,89,92,89,127,87,87,86,127,59,59,58,127,60,59,58,127,31,35,31,127,25,31,25,127,43,45,38,127,74,74,62,127,43,43,38,127,22,28,22,127,25,31,25,127,24,30,24,127,26,32,26,127,13,14,12,127,0,0,0,127,100,113,100,127,105,118,105,127,105,118,105,127,21,24,21,127,0,0,0,127,98,75,33,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,113,87,38,127,92,71,31,127,117,90,39,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,19,15,7,127,0,0,0,127,71,54,24,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,39,30,13,127,50,38,17,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,82,63,28,127,0,0,0,127,23,26,23,127,38,42,38,127,5,7,5,127,0,0,0,127,96,73,32,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,111,85,37,127,54,41,18,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,82,63,28,127,16,12,5,127,16,12,5,127,16,12,5,127,12,9,4,127,46,35,16,127,82,63,28,127,117,90,39,127,46,36,16,127,0,0,0,127,0,0,0,0],
1300[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,33,38,33,127,89,99,89,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,84,94,84,127,28,35,28,127,25,31,25,127,25,31,25,127,25,31,25,127,22,28,22,127,100,101,100,127,73,73,71,127,61,60,59,127,35,38,35,127,24,30,24,127,24,30,24,127,48,51,41,127,69,69,57,127,36,37,32,127,24,30,24,127,28,34,28,127,25,31,25,127,25,31,25,127,17,21,17,127,0,0,0,127,80,90,80,127,105,118,105,127,105,118,105,127,6,7,6,127,0,0,0,127,115,88,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,56,43,19,127,0,0,0,127,88,68,29,127,117,90,39,127,107,82,36,127,92,71,31,127,80,62,27,127,69,53,23,127,60,46,20,127,46,36,16,127,33,25,11,127,23,18,8,127,4,3,2,127,61,47,21,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,65,50,22,127,0,0,0,127,20,22,20,127,26,30,26,127,0,0,0,127,2,2,1,127,109,84,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,21,16,7,127,60,46,20,127,94,72,31,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,54,41,18,127,0,0,0,127,0,0,0,0],
1301[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,6,7,6,127,81,91,81,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,88,98,88,127,60,68,60,127,27,33,27,127,24,30,24,127,25,31,25,127,22,28,22,127,91,91,91,127,57,58,56,127,31,36,31,127,24,30,24,127,25,31,25,127,25,31,25,127,27,31,26,127,70,71,58,127,41,42,36,127,37,43,37,127,66,74,66,127,23,29,23,127,25,31,25,127,19,22,19,127,0,0,0,127,75,84,75,127,105,118,105,127,102,114,102,127,0,0,0,127,4,3,2,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,117,90,39,127,31,24,10,127,2,2,1,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,4,3,2,127,61,47,21,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,46,36,16,127,0,0,0,127,0,0,0,127,0,0,0,127,8,6,3,127,73,56,24,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,61,47,21,127,0,0,0,127,0,0,0,0],
1302[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,45,52,45,127,87,98,88,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,82,92,82,127,46,54,46,127,34,41,34,127,25,31,25,127,25,31,25,127,26,30,26,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,33,37,31,127,48,48,42,127,43,43,38,127,66,74,65,127,23,29,23,127,25,31,25,127,20,25,20,127,0,0,0,127,70,78,70,127,105,118,105,127,92,103,92,127,0,0,0,127,16,12,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,86,66,29,127,48,37,16,127,31,24,11,127,16,12,5,127,23,18,8,127,33,25,11,127,52,40,17,127,71,54,24,127,96,73,32,127,117,90,39,127,63,49,21,127,73,56,24,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,88,68,29,127,77,59,26,127,77,59,26,127,90,69,30,127,117,90,39,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,73,56,24,127,0,0,0,127,0,0,0,32],
1303[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,25,28,25,127,88,99,88,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,86,97,86,127,87,98,87,127,70,79,70,127,46,54,46,127,47,55,47,127,45,52,45,127,30,37,30,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,44,52,44,127,72,81,72,127,70,79,70,127,23,29,23,127,25,31,25,127,21,25,21,127,0,0,0,127,66,73,65,127,105,118,105,127,92,103,92,127,0,0,0,127,16,12,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,80,62,27,127,77,59,26,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,77,59,26,127,0,0,0,127,0,0,0,64],
1304[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,1,0,127,64,72,64,127,87,97,87,127,86,97,86,127,86,97,86,127,87,97,87,127,86,97,86,127,86,96,86,127,85,95,85,127,71,80,71,127,47,55,47,127,46,54,46,127,46,54,46,127,46,54,46,127,47,55,47,127,31,38,31,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,23,29,23,127,59,67,59,127,77,87,77,127,58,66,58,127,25,31,25,127,25,31,25,127,22,27,22,127,0,0,0,127,48,54,48,127,105,118,105,127,92,103,92,127,0,0,0,127,16,12,5,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,80,62,27,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,92,71,31,127,0,0,0,127,0,0,0,64],
1305[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,127,14,16,14,127,88,99,88,127,88,98,88,127,88,98,88,127,72,82,72,127,51,59,51,127,52,61,52,127,55,63,55,127,47,55,47,127,45,53,45,127,45,53,45,127,46,54,46,127,46,54,46,127,46,54,46,127,45,53,45,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,37,44,37,127,76,86,76,127,73,82,73,127,32,39,32,127,23,29,23,127,2,2,2,127,30,34,30,95,105,118,105,64,98,111,98,64,0,0,0,95,4,3,2,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,115,88,38,127,92,71,31,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,119,91,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,0,0,0,127,0,0,0,64],
1306[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,21,24,21,127,55,62,55,127,51,57,50,127,64,72,64,127,86,96,86,127,85,95,85,127,84,94,84,127,86,96,86,127,84,95,84,127,82,92,82,127,75,85,75,127,52,60,52,127,46,54,46,127,46,54,46,127,45,53,45,127,26,32,26,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,29,36,29,127,28,34,28,127,24,30,24,127,62,71,62,127,88,99,88,127,66,75,66,127,24,30,24,127,8,11,8,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,105,81,35,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,100,76,33,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,107,82,36,127,0,0,0,127,0,0,0,64],
1307[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,31,36,31,127,35,40,35,127,33,36,32,127,31,34,31,127,47,55,47,127,51,59,51,127,47,55,47,127,39,46,39,127,29,36,29,127,37,43,37,127,52,60,52,127,77,87,77,127,49,58,49,127,46,54,46,127,40,48,40,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,29,35,29,127,80,90,80,127,59,67,59,127,24,30,24,127,24,30,24,127,76,86,76,127,87,98,87,127,39,46,39,127,17,22,17,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,75,57,25,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,79,60,26,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,113,87,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,71,55,24,127,103,79,35,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,117,90,39,127,0,0,0,127,0,0,0,64],
1308[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,41,48,41,127,69,79,69,127,39,45,39,127,47,54,47,127,77,87,77,127,86,97,86,127,88,97,87,127,87,97,86,127,82,93,83,127,57,65,57,127,25,31,25,127,24,30,24,127,26,32,26,127,26,32,26,127,26,32,26,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,75,85,75,127,87,98,87,127,67,75,67,127,23,29,23,127,23,29,23,127,56,64,56,127,85,95,85,127,75,84,75,127,24,30,24,127,3,3,3,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,127,29,22,10,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,119,91,40,127,8,6,3,127,109,84,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,119,91,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,6,5,2,127,107,82,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,0,0,0,127,0,0,0,64],
1309[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,12,15,12,127,45,53,46,127,48,56,48,127,65,72,63,127,98,81,79,127,123,119,119,127,117,108,108,127,94,79,76,127,88,88,80,127,64,73,64,127,24,30,24,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,35,41,35,127,86,96,86,127,87,98,87,127,61,69,61,127,23,29,23,127,24,30,24,127,46,53,46,127,84,94,84,127,87,98,87,127,55,63,55,127,10,12,10,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,92,71,31,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,75,57,25,127,0,0,0,127,52,40,17,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,12,9,4,127,0,0,0,127,109,84,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,14,11,5,127,0,0,0,95],
1310[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,22,26,22,127,30,37,30,127,23,29,23,127,41,40,35,127,91,73,72,127,113,103,103,127,100,75,75,127,87,58,58,127,83,72,66,127,54,63,55,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,30,25,127,34,41,34,127,69,78,69,127,81,91,81,127,34,41,34,127,25,31,25,127,23,29,23,127,61,69,61,127,82,92,82,127,75,85,75,127,82,92,82,127,24,29,24,127,1,1,1,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,127,23,18,8,127,119,91,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,17,14,6,127,0,0,0,127,2,2,1,127,96,73,32,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,75,58,25,127,6,5,2,127,0,0,0,127,0,0,0,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,18,14,6,127,0,0,0,127],
1311[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,24,29,24,127,48,56,48,127,28,34,28,127,24,30,24,127,25,31,25,127,36,37,32,127,68,55,52,127,82,63,62,127,80,52,52,127,81,82,74,127,28,34,28,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,23,29,23,127,25,31,25,127,24,30,24,127,25,31,25,127,24,29,24,127,56,64,56,127,87,97,87,127,70,79,70,127,88,99,88,127,49,57,49,127,10,12,10,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,44,34,15,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,67,52,23,127,0,0,0,127,0,0,0,95,0,0,0,127,12,9,4,127,109,84,36,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,100,76,33,127,33,25,11,127,0,0,0,127,0,0,0,127,0,0,0,95,0,0,0,127,107,82,36,127,117,90,39,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,31,24,11,127,0,0,0,127],
1312[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,14,16,14,127,81,91,81,127,72,81,72,127,43,51,43,127,23,29,23,127,24,30,24,127,23,30,24,127,23,30,23,127,25,31,25,127,26,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,26,32,26,127,32,39,32,127,30,37,30,127,24,30,24,127,25,31,25,127,25,31,25,127,25,32,25,127,83,93,83,127,77,86,77,127,87,97,87,127,80,90,80,127,22,27,22,127,1,1,1,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,46,35,15,127,121,92,40,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,96,73,32,127,4,3,2,127,0,0,0,95,0,0,0,0,0,0,0,32,0,0,0,127,12,9,4,127,98,75,33,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,96,73,32,127,40,31,14,127,2,2,1,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,32,0,0,0,127,0,0,0,127,0,0,0,127,2,2,1,127,16,12,5,127,25,19,9,127,33,25,11,127,46,36,16,127,56,43,19,127,61,47,21,127,77,59,26,127,84,65,28,127,92,71,31,127,107,82,36,127,115,88,38,127,122,94,41,127,122,94,41,127,39,30,13,127,0,0,0,127],
1313[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,18,21,18,127,83,93,83,127,89,100,89,127,71,81,71,127,54,61,54,127,37,44,37,127,24,30,24,127,23,29,23,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,24,30,24,127,42,50,42,127,70,79,70,127,87,98,87,127,74,83,74,127,28,35,28,127,25,31,25,127,24,30,24,127,42,49,42,127,76,86,76,127,86,97,86,127,88,99,88,127,41,49,41,127,11,14,11,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,27,21,9,127,105,81,35,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,98,75,33,127,12,9,4,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,2,2,1,127,58,44,19,127,113,87,38,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,105,81,35,127,63,49,21,127,21,16,7,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,16,12,5,127,6,5,2,127,0,0,0,95],
1314[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,13,17,13,127,61,70,61,127,85,96,85,127,89,100,89,127,88,98,88,127,77,87,77,127,60,67,60,127,26,32,26,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,25,31,25,127,12,16,12,127,12,15,12,127,40,46,40,127,80,90,80,127,80,89,80,127,34,40,34,127,24,30,24,127,23,29,23,127,51,59,51,127,88,99,88,127,86,97,86,127,76,85,76,127,22,27,22,127,1,2,1,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,4,3,2,127,59,46,20,127,111,85,37,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,119,91,40,127,65,50,22,127,4,3,2,127,0,0,0,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,0,0,0,127,4,3,2,127,44,34,15,127,80,62,27,127,111,85,37,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,122,94,41,127,121,92,40,127,100,76,33,127,75,57,25,127,48,37,16,127,18,13,6,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,127,0,0,0,64,0,0,0,0],
1315[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,127,19,23,19,127,46,53,46,127,64,72,64,127,80,90,80,127,85,96,85,127,74,84,74,127,28,34,28,127,25,31,25,127,25,31,25,127,25,30,25,127,25,31,25,127,25,31,25,127,25,31,25,127,17,21,17,127,1,3,1,127,0,1,0,127,0,0,0,127,9,11,9,127,51,59,52,127,82,93,83,127,45,52,45,127,23,29,23,127,24,30,24,127,59,67,59,127,88,99,88,127,85,96,85,127,30,37,30,127,12,15,12,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,4,3,2,127,42,33,14,127,82,63,28,127,107,82,36,127,103,79,35,127,84,65,28,127,54,41,18,127,12,9,4,127,0,0,0,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,0,0,0,127,0,0,0,127,10,8,3,127,25,19,9,127,31,24,11,127,31,24,11,127,31,24,11,127,31,24,11,127,18,14,6,127,35,27,12,127,105,81,35,127,80,62,27,127,54,41,18,127,29,22,10,127,6,5,2,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,95,0,0,0,64,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1316[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,8,10,8,127,33,39,33,127,44,51,44,127,46,53,46,127,44,52,44,127,39,46,39,127,25,30,25,127,25,31,25,127,25,31,25,127,24,30,24,127,15,19,15,127,5,7,5,127,0,1,0,127,0,0,0,127,0,0,0,95,0,0,0,64,0,0,0,64,0,1,0,127,21,24,21,127,66,74,66,127,57,66,57,127,24,30,24,127,23,29,23,127,52,60,52,127,40,47,40,127,24,30,24,127,23,28,23,127,1,2,1,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,95,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,64,0,0,0,95,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,64,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1317[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,11,13,11,127,23,28,23,127,33,39,33,127,36,43,36,127,23,29,23,127,20,26,20,127,11,15,11,127,3,4,3,127,0,1,0,127,0,0,0,127,0,0,0,95,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,3,5,3,127,37,41,37,127,58,66,58,127,27,33,27,127,24,30,24,127,26,32,26,127,25,31,25,127,25,31,25,127,8,9,8,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,64,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1318[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,0,0,0,127,0,0,0,127,0,0,0,127,0,1,0,127,0,0,0,127,0,0,0,127,0,0,0,127,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,127,12,15,12,127,42,49,42,127,32,39,32,127,24,30,24,127,25,31,25,127,25,31,25,127,18,22,18,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1319[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,2,2,2,127,23,27,23,127,37,43,37,127,26,33,26,127,25,31,25,127,24,30,24,127,4,4,4,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1320[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,4,5,4,127,24,28,23,127,29,35,29,127,25,31,25,127,12,16,12,127,0,0,0,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1321[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,95,4,4,4,127,11,14,11,127,16,20,16,127,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
1322[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,64,0,0,0,127,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]])
1323        def __init__(self, parent, title):
1324                """Constructor.
1325               
1326                   @param title Header title.
1327                """
1328                Decorator.__init__(self, parent)
1329                self.title = title
1330                self.border = 10
1331                return
1332        def draw(self, screenRectangle):
1333                rect = screenRectangle[:]
1334                rect[0] += self.border
1335                rect[1] += self.border
1336                rect[2] -= self.border
1337                rect[3] -= self.border
1338                # title
1339                glColor3ub(210, 236, 210)
1340                glRecti(rect[0],rect[3]-41,rect[2],rect[3]-17)
1341                glColor3ub(50, 62, 50)
1342                glRasterPos2i(rect[0]+126, rect[3]-34)
1343                Blender.Draw.Text(self.title)
1344                glRasterPos2i(rect[0]+127, rect[3]-34)
1345                Blender.Draw.Text(self.title)
1346                # logo
1347                glRasterPos2i(rect[0]+1, rect[3]-48)   
1348                glEnable(GL_BLEND)
1349                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
1350                glDrawPixels(122, 48, GL_RGBA, GL_BYTE, OgreFrame.OGRE_LOGO)
1351                rect[3] -= 48 + self.border
1352                glDisable(GL_BLEND)
1353                # child
1354                self.childWidget.draw(rect)
1355                return
1356        def getSize(self):
1357                width = 2*self.border + Blender.Draw.GetStringWidth(self.title) + 85
1358                height = 48 + 3*self.border
1359                minSize = self.childWidget.getSize().getMinimumSize()[:]
1360                minSize[0] += 2*self.border
1361                minSize[1] += 3*self.border + 48
1362                if minSize[0] < width:
1363                        minSize[0] = width
1364                if minSize[1] < height:
1365                        minSize[1] = height
1366                prefSize = self.childWidget.getSize().getPreferredSize()[:]
1367                prefSize[0] += 2*self.border
1368                prefSize[1] += 3*self.border + 48
1369                if prefSize[0] < width:
1370                        prefSize[0] = width
1371                if prefSize[1] < height:
1372                        prefSize[1] = height                   
1373                maxSize = self.childWidget.getSize().getMaximumSize()[:]
1374                return Size(prefSize, minSize, maxSize)
1375
1376class DirectionalLayout(Widget):
1377        """Common layout functionality for horizontal and vertical layout.
1378        """
1379        def __init__(self, parent):
1380                """Constructor.
1381                """
1382                Widget.__init__(self, parent, Size([0, 0]))
1383                self.widgetList = []           
1384                return
1385        def resize(self, size=None):
1386                self.size = Size([0, 0])
1387                for widget in self.widgetList:
1388                        self._addWidgetSize(widget)
1389                self.parent.resize()
1390                return
1391        def eventFilter(self, event, value):
1392                for widget in self.widgetList:
1393                        widget.eventFilter(event, value)
1394                return
1395        def _addWidget(self, widget):
1396                """Adds a child widget to this layout.
1397               
1398                   The child widget is appended below all other widgets. This
1399                   method gets called by the constructor of the child widget.
1400                """
1401                self.widgetList.append(widget)
1402                self._addWidgetSize(widget)
1403                self.parent.resize()
1404                return
1405        def _removeWidget(self, widget):
1406                """Removes a child widget from this layout.
1407               
1408                   This method gets called by the <code>removeFromParent()</code>
1409                   method of the corresponding child widget.
1410                """
1411                if widget in self.widgetList:
1412                        self.widgetList.remove(widget)
1413                        self.resize()
1414                return
1415        def _addWidgetSize(self, widget):
1416                raise NotImplementedError
1417                return
1418       
1419class HorizontalLayout(DirectionalLayout):
1420        """Widget that manages horizontally stacked child widgets.
1421        """
1422        def draw(self, screenRectangle):
1423                # split height for the child widgets
1424                minimumSize = self.size.getMinimumSize()
1425                width = screenRectangle[2]- screenRectangle[0]
1426                additionalWidth = width - minimumSize[0]
1427                stretchWidgetList = []
1428                extraWidth = 0
1429                # get widgets with unlimited preferred height
1430                if (additionalWidth > 0):
1431                        stretchWidgetList = [w for w in self.widgetList if w.getSize().getPreferredSize()[0] >= Size.INFINITY]
1432                        if (len(stretchWidgetList) > 0):
1433                                # give equal extra height to widgets with unlimited preferred height
1434                                extraWidth = additionalWidth / len(stretchWidgetList)
1435                # draw widgets with minimum or minimum plus extra size
1436                x = screenRectangle[0]
1437                dx = 0
1438                for widget in self.widgetList:
1439                        dx = widget.getSize().getMinimumSize()[0]
1440                        if (widget in stretchWidgetList):
1441                                dx += extraWidth
1442                        widget.draw([x, screenRectangle[1], x+dx, screenRectangle[3]])
1443                        x += dx
1444                return
1445        def _addWidgetSize(self, widget):
1446                """Adds size of a widget but does not notify parent.
1447                """
1448                wMinSize = widget.getSize().getMinimumSize()
1449                wMaxSize = widget.getSize().getMaximumSize()
1450                wPrefSize = widget.getSize().getPreferredSize()
1451                minSize = self.getSize().getMinimumSize()
1452                maxSize = self.getSize().getMaximumSize()
1453                prefSize = self.getSize().getPreferredSize()
1454                # add in x direction
1455                minSize[0] += wMinSize[0]
1456                maxSize[0] += wMaxSize[0]
1457                if (prefSize[0] < Size.INFINITY):
1458                        if (wPrefSize[0] < Size.INFINITY):
1459                                prefSize[0] += wPrefSize[0]
1460                        else:
1461                                prefSize[0] = Size.INFINITY
1462                # maximum in y direction
1463                if (wMinSize[1] > minSize[1]):
1464                        minSize[1] = wMinSize[1]
1465                if (wPrefSize[1] > prefSize[1]):
1466                        prefSize[1] = wPrefSize[1]
1467                if (wMaxSize[1] > maxSize[1]):
1468                        maxSize[1] = wMaxSize[1]
1469                self.size = Size(prefSize, minSize, maxSize)
1470                return
1471
1472
1473class VerticalLayout(DirectionalLayout):
1474        """Widget that manages vertically stacked child widgets.
1475        """
1476        def draw(self, screenRectangle):
1477                # split height for the child widgets
1478                minimumSize = self.getSize().getMinimumSize()
1479                height = screenRectangle[3]- screenRectangle[1]
1480                additionalHeight = height - minimumSize[1]
1481                stretchWidgetList = []
1482                extraHeight = 0
1483                # get widgets with unlimited preferred height
1484                if (additionalHeight > 0):
1485                        stretchWidgetList = [w for w in self.widgetList if w.getSize().getPreferredSize()[1] >= Size.INFINITY]
1486                        if (len(stretchWidgetList) > 0):
1487                                # give equal extra height to widgets with unlimited preferred height
1488                                extraHeight = additionalHeight / len(stretchWidgetList)
1489                # draw widgets with minimum or minimum plus extra size
1490                y = screenRectangle[3]
1491                dy = 0
1492                for widget in self.widgetList:
1493                        dy = widget.getSize().getMinimumSize()[1]
1494                        if (widget in stretchWidgetList):
1495                                dy += extraHeight
1496                        widget.draw([screenRectangle[0], y-dy, screenRectangle[2], y])
1497                        y -= dy
1498                return
1499        def _addWidgetSize(self, widget):
1500                """Adds size of a widget but does not notify parent.
1501                """
1502                wMinSize = widget.getSize().getMinimumSize()
1503                wMaxSize = widget.getSize().getMaximumSize()
1504                wPrefSize = widget.getSize().getPreferredSize()
1505                minSize = self.getSize().getMinimumSize()
1506                maxSize = self.getSize().getMaximumSize()
1507                prefSize = self.getSize().getPreferredSize()
1508                # add in y direction
1509                minSize[1] += wMinSize[1]
1510                maxSize[1] += wMaxSize[1]
1511                if (prefSize[1] < Size.INFINITY):
1512                        if (wPrefSize[1] < Size.INFINITY):
1513                                prefSize[1] += wPrefSize[1]
1514                        else:
1515                                prefSize[1] = Size.INFINITY
1516                # maximum in x direction
1517                if (wMinSize[0] > minSize[0]):
1518                        minSize[0] = wMinSize[0]
1519                if (wPrefSize[0] > prefSize[0]):
1520                        prefSize[0] = wPrefSize[0]
1521                if (wMaxSize[0] > maxSize[0]):
1522                        maxSize[0] = wMaxSize[0]
1523                self.size = Size(prefSize, minSize, maxSize)
1524                return
1525
1526class AlternativesLayout(Widget):
1527        """Displays one widget out of a given set of alternatives.
1528        """
1529        def __init__(self, parent):
1530                """Constructor.
1531                """
1532                Widget.__init__(self, parent, Size())
1533                self.widgetList = []
1534                self.current = None
1535                return
1536        def getCurrent(self):
1537                """Returns name of current choosen widget.
1538                """
1539                return self.current
1540        def setCurrent(self, widget):
1541                """Sets current active widget to alternative called name.
1542               
1543                   @param widget A previously added widget or <code>None</code>.
1544                """
1545                if widget is None:
1546                        self.current = None
1547                        self.size = Size()
1548                        self.parent.resize()
1549                elif widget in self.widgetList:
1550                        self.current = widget
1551                        self.size = widget.getSize()
1552                        self.parent.resize()           
1553                return
1554        def removeAll(self):
1555                self.setCurrent(None)
1556                self.widgetList = []
1557                return
1558        def draw(self, screenRectangle):
1559                if self.current:
1560                        self.current.draw(screenRectangle)
1561                return
1562        def eventFilter(self, event, value):
1563                if self.current:
1564                        self.current.eventFilter(event, value)
1565                return
1566        def _addWidget(self, widget):
1567                """Adds a child widget to this layout.
1568               
1569                   The child widget is appended below all other widgets. This
1570                   method gets called by the constructor of the child widget.
1571                """
1572                self.widgetList.append(widget)
1573                return
1574        def _removeWidget(self, widget):
1575                """Removes a child widget from this layout.
1576               
1577                   This method gets called by the <code>removeFromParent()</code>
1578                   method of the corresponding child widget.
1579                """
1580                if widget in self.widgetList:
1581                        if (widget == self.current):
1582                                self.setCurrent(None)
1583                        self.widgetList.remove(widget)
1584                return
1585
1586class WidgetListLayout(Widget):
1587        """Displays a list of vertically stacked widgets using a scrollbar if necessary.
1588        """
1589        def __init__(self, parent, size, scrollbarWidth=20):
1590                """Constructor.
1591               
1592                   @param size Minimum size should exceed 3*scrollbarWidth in both directions
1593                """
1594                Widget.__init__(self, parent, size)
1595                # mousewheel scrolling
1596                self.listRect = [0, 0, 0, 0]
1597                # list of child widgets
1598                self.widgetList = []
1599                # list of current displayed widgets
1600                self.visibleList = []
1601                # parent to register buttons to.
1602                self.boundedRange = BoundedRangeModel()
1603                self.scrollbarWidth = scrollbarWidth
1604                self.scrollbar = VerticalScrollbar(WidgetListLayout.Mediator(self), Size([self.scrollbarWidth, self.scrollbarWidth]), self.boundedRange)
1605                # mousewheel scrolling
1606                self.mouseFocusX = 0
1607                self.mouseFocusY = 0
1608                # unused widget space
1609                self.remainingHeight = 0
1610                self.autoScroll = False
1611                return
1612        def setAutoScroll(self, autoScroll=True):
1613                """Scroll to newly added widgets.
1614                """
1615                self.autoScroll = autoScroll
1616                return
1617        def _addWidget(self, widget):
1618                self.widgetList.append(widget)
1619                self.boundedRange.setMaximum(self.boundedRange.getMaximum() + 1)
1620                if self.autoScroll:
1621                        # scroll into visible area
1622                        # Avoid call to Blender.Draw.Draw() to get the current
1623                        # scrollbar extend, as widget may be disabled
1624                        if( widget.getSize().getMinimumSize()[1] > self.remainingHeight):
1625                                self.boundedRange.setValue(self.boundedRange.getMaximum() - self.boundedRange.getExtend())
1626                return
1627        def _removeWidget(self, widget):
1628                if widget in self.widgetList:
1629                        if widget in self.visibleList:
1630                                self.visibleList.remove(widget)
1631                        self.widgetList.remove(widget)
1632                        self.boundedRange.setMaximum(self.boundedRange.getMaximum() - 1)
1633                return
1634        def removeAll(self):
1635                self.widgetList = []
1636                self.boundedRangeModel = BoundedRangeModel()
1637                return
1638        def draw(self, rect):
1639                self.listRect = [rect[0] + 2, rect[1] + 2, rect[2] - self.scrollbarWidth - 2, rect[3] - 2]
1640                remainingHeight = self.listRect[3] - self.listRect[1]
1641                # Box
1642                glColor3f(0.0, 0.0, 0.0)
1643                glBegin(GL_LINE_STRIP)
1644                glVertex2i(rect[0], rect[3])
1645                glVertex2i(rect[2], rect[3])
1646                glVertex2i(rect[2], rect[1])
1647                glVertex2i(rect[0], rect[1])
1648                glVertex2i(rect[0], rect[3])
1649                glEnd()
1650                # Widgets
1651                self.visibleList = []
1652                if len(self.widgetList):
1653                        listIndex = self.boundedRange.getValue()
1654                        widgetRect = self.listRect[:]
1655                        while ((listIndex < len(self.widgetList)) \
1656                                and (remainingHeight >= self.widgetList[listIndex].getSize().getMinimumSize()[1])):
1657                                widgetRect[3] = self.listRect[1] + remainingHeight
1658                                remainingHeight -= self.widgetList[listIndex].getSize().getMinimumSize()[1]
1659                                widgetRect[1] = self.listRect[1] + remainingHeight
1660                                self.widgetList[listIndex].draw(widgetRect)
1661                                self.visibleList.append(self.widgetList[listIndex])
1662                                listIndex += 1
1663                        self.boundedRange.setExtend(len(self.visibleList), 1)
1664                # Scrollbar
1665                self.scrollbar.draw([rect[2]-self.scrollbarWidth-1, rect[1]+1, rect[2]-1, rect[3]-1])
1666                self.remainingHeight = remainingHeight
1667                return
1668        def eventFilter(self, event, value):
1669                for widget in self.visibleList:
1670                        widget.eventFilter(event, value)
1671                # mousewheel scrolling
1672                if (event == Blender.Draw.MOUSEX):
1673                        mousePositionX = value - ScreenManager.getSingleton().getScissorRectangle()[0]
1674                        if (mousePositionX >= self.listRect[0]) and (mousePositionX <= self.listRect[2]):
1675                                self.mouseFocusX = 1
1676                        else:
1677                                self.mouseFocusX = 0
1678                elif (event == Blender.Draw.MOUSEY):
1679                        mousePositionY = value - ScreenManager.getSingleton().getScissorRectangle()[1]
1680                        if (mousePositionY >= self.listRect[1]) and (mousePositionY <= self.listRect[3]):
1681                                self.mouseFocusY = 1
1682                        else:
1683                                self.mouseFocusY = 0
1684                elif (event == Blender.Draw.WHEELUPMOUSE) \
1685                        and self.mouseFocusX and self.mouseFocusY:
1686                        self.scrollbar._dec(1)
1687                elif (event == Blender.Draw.WHEELDOWNMOUSE) \
1688                        and self.mouseFocusX and self.mouseFocusY:
1689                        self.scrollbar._inc(1)
1690                # scrollbar
1691                self.scrollbar.eventFilter(event, value)
1692                return
1693        class Mediator(Widget):
1694                def __init__(self, parent):
1695                        self.parent = parent
1696                        return
1697                def resize(self, size=None):
1698                        self.parent.resize()
1699                        return
1700                def _addWidget(self, widget):
1701                        return
1702                def _removeWidget(self, widget):
1703                        return
1704                def _addButtonAction(self, action):
1705                        return self.parent._addButtonAction(action)
1706                def _removeButtonAction(self, eventNumber):
1707                        self.parent._removeButtonAction(eventNumber)
1708                        return
1709
1710class AddWidgetListLayout(WidgetListLayout):
1711        """WidgetList with an additional button in the last row.
1712       
1713           The first widget added to this layout is used as add-button. The
1714           add-button is not specified in the constructor in order to not
1715           complicate a reference from the button action to the parent layout.
1716        """
1717        def __init__(self, parent, size, scrollbarWidth=20):
1718                """Constructor.
1719                """
1720                WidgetListLayout.__init__(self, parent, size, scrollbarWidth)
1721                # additional button
1722                self.addButton = None
1723                return
1724        def removeAll(self):
1725                """Remove all widgets but the add-button.
1726                """
1727                self.widgetList = []
1728                self.boundedRangeModel = BoundedRangeModel(0, 0, 0, 1)
1729                return
1730        def draw(self, rect):
1731                self.listRect = [rect[0] + 2, rect[1] + 2, rect[2] - self.scrollbarWidth - 2, rect[3] - 2]
1732                self.visibleList = []
1733                remainingHeight = self.listRect[3] - self.listRect[1]
1734                widgetRect = self.listRect[:]
1735                if len(self.widgetList):
1736                        listIndex = self.boundedRange.getValue()
1737                        while ((listIndex < len(self.widgetList)) \
1738                                and (remainingHeight >= self.widgetList[listIndex].getSize().getMinimumSize()[1])):
1739                                widgetRect[3] = self.listRect[1] + remainingHeight
1740                                remainingHeight -= self.widgetList[listIndex].getSize().getMinimumSize()[1]
1741                                widgetRect[1] = self.listRect[1] + remainingHeight
1742                                self.widgetList[listIndex].draw(widgetRect)
1743                                self.visibleList.append(self.widgetList[listIndex])
1744                                listIndex += 1
1745                        self.boundedRange.setExtend(len(self.visibleList), 1)
1746                # add button
1747                if remainingHeight >= self.addButton.getSize().getMinimumSize()[1]:
1748                        # draw button
1749                        widgetRect[3] = self.listRect[1] + remainingHeight
1750                        remainingHeight -= self.addButton.getSize().getMinimumSize()[1]
1751                        widgetRect[1] = self.listRect[1] + remainingHeight
1752                        widgetRect[2] = widgetRect[0] + self.addButton.getSize().getMinimumSize()[0]
1753                        self.addButton.draw(widgetRect)
1754                        self.boundedRange.setExtend(self.boundedRange.getExtend() + 1, 1)
1755                # Scrollbar
1756                self.scrollbar.draw([rect[2]-self.scrollbarWidth-1, rect[1]+1, rect[2]-1, rect[3]-1])
1757                self.remainingHeight = remainingHeight
1758                return
1759        def _addWidget(self, widget):
1760                if self.addButton:
1761                        self.widgetList.append(widget)
1762                        self.boundedRange.setMaximum(self.boundedRange.getMaximum() + 1)
1763                        # scroll into visible area
1764                        # Avoid call to Blender.Draw.Draw() to get the current
1765                        # scrollbar extend, as widget may be disabled
1766                        if self.autoScroll:
1767                                if((widget.getSize().getMinimumSize()[1]  + self.addButton.getSize().getMinimumSize()[1]) > self.remainingHeight):
1768                                        self.boundedRange.setValue(self.boundedRange.getMaximum() - self.boundedRange.getExtend())
1769                else:
1770                        self.addButton = widget
1771                        self.boundedRange.setMaximum(self.boundedRange.getMaximum() + 1)
1772                return
1773
1774class LogView(Decorator, View):
1775        """Shows the log messages.
1776        """
1777        _COLOR = {Log.INFO:[0.0, 0.0, 0.0], Log.WARNING:[1.0, 1.0, 0.0], Log.ERROR:[1.0, 0.0, 0.0]}
1778        def __init__(self, parent, size, scrollbarWidth=20, viewPrevious=True):
1779                Decorator.__init__(self, parent)
1780                WidgetListLayout(self, size, scrollbarWidth)
1781                View.__init__(self, Log.getSingleton())
1782                self.labelSize = Size([self.getSize().getMinimumSize()[0], LabelView._HEIGHTDICT['normal'] + 2])
1783                # last considered log message
1784                self.iMessages = 0
1785                for entry in Log.getSingleton().getMessageList():
1786                        if viewPrevious:
1787                                self._addLogEntry(entry)
1788                        self.iMessages += 1
1789                # first line to display
1790                if viewPrevious:
1791                        self.firstLine = 0
1792                else:
1793                        self.firstLine = self.iMessages
1794                self.childWidget.setAutoScroll(True)
1795                return
1796        def update(self):
1797                if (self.iMessages < len(Log.getSingleton().getMessageList())):
1798                        for entry in Log.getSingleton().getMessageList()[self.iMessages:]:
1799                                self._addLogEntry(entry)
1800                                self.iMessages += 1
1801                        Blender.Draw.Draw()
1802                return
1803        def _addLogEntry(self, entry):
1804                LabelView(self.childWidget, LabelModel(entry[1], color=LogView._COLOR[entry[0]]), size=self.labelSize)
1805                return
1806               
1807class Screen:
1808        """Represents the complete script window.
1809       
1810           A screen represents the complete script window. It handles
1811           drawing and events and can consist of several user interface
1812           components. A screen has a single child widget.
1813        """
1814        def __init__(self):
1815                """Constructor.
1816                """
1817                # buttonHandler event number management
1818                self.nButtonEvent = 0
1819                # buttonEventDict key: iButtonEvent, value: Action
1820                self.buttonEventDict = {}
1821                # root widget of the screen
1822                self.widget = None
1823                Widget(self)
1824                # scissor rectangle
1825                self.scissorRectangle = [0, 0, 0, 0]
1826                return
1827        def activate(self):
1828                """Makes this the current active screen.
1829               
1830                   This method registers itself at the ScreenManager.
1831                """
1832                ScreenManager.getSingleton().activate(self)
1833                return
1834        def deactivate(self):
1835                """Deactivates this screen.
1836                """
1837                ScreenManager.getSingleton().deactivate(self)
1838                return
1839        def resize(self):
1840                """Resize notification from child widget.
1841                """
1842                Blender.Draw.Redraw(1)
1843                return
1844        def getScissorRectangle(self):
1845                return self.scissorRectangle
1846        def _addWidget(self, widget):
1847                """Adds a child widget.
1848               
1849                   @param widget Child widget to add.
1850                """
1851                if self.widget:
1852                        self.widget.removeFromParent()
1853                self.widget = widget
1854                return
1855        def _removeWidget(self, widget):
1856                """Removes a child widget.
1857               
1858                   @param widget Child widget to remove.
1859                """
1860                if (self.widget == widget):
1861                        self.widget = None
1862                        Widget(self)
1863                return
1864        def _addButtonAction(self, action):
1865                """Registers an action for a button event.
1866               
1867                   @param action Action to execute on receive of the returned button event number.
1868                   @return Event number to use for the button that corresponds to that action.
1869                """
1870                # workaround for Blender 2.37 event 8 bug:
1871                shiftEvents = 100
1872                # get a free event number
1873                if (len(self.buttonEventDict) == self.nButtonEvent):
1874                        self.nButtonEvent += 1
1875                        eventNumber = self.nButtonEvent + shiftEvents
1876                else:
1877                        eventNumber = [(x+1+shiftEvents) for x in range(self.nButtonEvent) if (x+1+shiftEvents) not in self.buttonEventDict.keys()][0]
1878                # assign action to that event
1879                self.buttonEventDict[eventNumber] = action
1880                return eventNumber
1881        def _removeButtonAction(self, eventNumber):
1882                """Action for the given event number will no longer be called.
1883               
1884                   @param eventNumber Event number for the action.
1885                """
1886                if self.buttonEventDict.has_key(eventNumber):
1887                        del self.buttonEventDict[eventNumber]
1888                return
1889        # callbacks for Blender.Draw.Register
1890        def _draw(self):
1891                """Draws the screen.
1892               
1893                   Callback function for Blender.Draw.Register
1894                """
1895                # clear background
1896                theme = Blender.Window.Theme.Get()[0]
1897                bgColor = [color/255.0 for color in theme.get('buts').back]
1898                glClearColor(*bgColor)
1899                glClear(GL_COLOR_BUFFER_BIT)
1900                # scissor box: [lower-left-x, lower-left-y, width, height]
1901                scissorBox = Blender.BGL.Buffer(GL_INT, 4)
1902                Blender.BGL.glGetIntegerv(Blender.BGL.GL_SCISSOR_BOX, scissorBox)
1903                self.scissorRectangle = [scissorBox[0], scissorBox[1], scissorBox[0] + scissorBox[2], scissorBox[1] + scissorBox[3]]
1904                # size of the script window
1905                size = list(Blender.Window.GetAreaSize())
1906                minimumSize = self.widget.getSize().getMinimumSize()
1907                if size[0] < minimumSize[0]:
1908                        size[0] = minimumSize[0]
1909                if size[1] < minimumSize[1]:
1910                        size[1] = minimumSize[1]
1911                screenRect = [0, 0, size[0]-1, size[1]-1]
1912                # draw widgets
1913                self.widget.draw(screenRect)
1914                return
1915        def _eventHandler(self, event, value):
1916                """Handles keyboard and mouse input events.
1917               
1918                   Callback function for Blender.Draw.Register
1919                """
1920                self.widget.eventFilter(event, value)
1921                return
1922        def _buttonHandler(self, event):
1923                """Handles draw button events.
1924               
1925                   Callback function for Blender.Draw.Register
1926                """
1927                if self.buttonEventDict.has_key(event):
1928                        self.buttonEventDict[event].execute()
1929                return
1930
1931class ScreenManager(Singleton):
1932        """Manages screens.
1933        """
1934        def __init__(self):
1935                Singleton.__init__(self)
1936                # current active screen is on top
1937                self.screenStack = []
1938                return
1939        def activate(self, screen):
1940                """Activates a screen.
1941               
1942                   This method calls Blender.Draw.Register to register a screen to
1943                   be responsible for windowing.
1944                """
1945                self.screenStack.append(screen)
1946                Blender.Draw.Register(screen._draw, screen._eventHandler, screen._buttonHandler)
1947                Blender.Draw.Draw()
1948                return
1949        def deactivate(self, screen):
1950                """Deactivates a screen.
1951               
1952                   If the screen is the current displayed screen, the next screen on the stack
1953                   of activated screens will be reactivated. If there is no screen left, an empty
1954                   screen will be displayed.
1955                """
1956                if screen in self.screenStack:
1957                        position = self.screenStack.index(screen)
1958                        self.screenStack.remove(screen)
1959                        if (position == len(self.screenStack)):
1960                                # screen was current active
1961                                if len(self.screenStack):
1962                                        screen = self.screenStack.pop()
1963                                        self.activate(screen)
1964                                else:
1965                                        # empty screen
1966                                        Blender.Draw.Register()
1967                                        Blender.Draw.Draw()
1968                return
1969        def getScissorRectangle(self):
1970                if len(self.screenStack):
1971                        scissorRectangle = self.screenStack[-1].getScissorRectangle()
1972                else:
1973                        scissorRectangle = [0, 0, 0, 0]
1974                return scissorRectangle
Note: See TracBrowser for help on using the repository browser.