#!/usr/bin/ruby1.8
#
# $Id$

require 'color'
require 'ming/ming'
require 'bgshape'
require 'pagehandle'
require 'mingtext'
require 'mingline'
include Ming

def slidepage(tstr, strs, dim, pg, white, black)
  m = SWFMovie.new
  m.set_dimension(dim[0], dim[1])
  mincho = SWFFont.new('KochiGMincho.fdb')
  m.set_background(white.red, white.green, white.blue)
  bg = BgShape.new(black, dim)
  btn = bg.setResume()
  btn.add_action(pg.action(pg.prev), key_press('b'))
  m.add(btn)
  bgitem = m.add(bg.shape)

  title = m.add(lefttext(tstr, 25, mincho, white))
  title.move_to(5, 15)
  line = m.add(headingline(2, white, dim))
  line.move_to(0, 35)
  items = multitext(m, strs, 20, mincho, white, [5, 50])

  m.add(SWFAction.new('stop();'))
  m.next_frame
  m.add(pg.action(pg.next))
  m.next_frame
  m.save(pg.cur)
  pg.iteration
end

pg = PageHandle.new('os-win-lose')

dim = [400, 400]
tsize = 40
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
SWFFont.font_path.push "/usr/share/libming/fonts/"
SWFFont.font_path.push "../lc2003lt"
mincho = SWFFont.new('KochiGMincho.fdb')

#black = Color.new(0, 0, 0)
#white = Color.new(255, 255, 255)
black = Color.new(255, 255, 255)
white = Color.new(0, 0, 0)
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
m.add(btn)
bgitem = m.add(bg.shape)

title1 = m.add(centertext('オープンソースにみる', 35, mincho, white))
title2 = m.add(centertext('勝ち組と負け組', 35, mincho, white))
author = m.add(centertext('野首貴嗣', 20, mincho, white))
email = m.add(centertext('knok@daionet.gr.jp', 15, mincho, white))

title1.move_to(200, 160)
title2.move_to(200, 200)
author.move_to(200, 260)
email.move_to(200, 290)

m.add(SWFAction.new('stop();'))
m.next_frame

m.add(pg.action(pg.next))
m.next_frame

m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('勝ち組とは', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)
strs = [
  '第二次世界対戦後、海外にいて',
        '日本の敗北を認めなかった人達',
        '',
        nil,
        '一般的な認識では', 
        '  人生の勝者'
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('Linusの場合', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

strs = [
  '実績',
        '  Linux kernel hack',
        nil, 
        '',
        '利益',
        nil,
        '  Transmeta就職', #（　σ・∀・）σゲッツ!!'
        '  OSDL転職'
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('彼は本当に勝利したか?', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

strs = [
  'hackが仕事になっている',
        nil, 
        '  もはや辞められない',
        nil,
        '  過去にとらわれていて勝利と言えるのか',
  nil,
  'ハッカーは飽きっぽい',
  nil,
  '  興味は次々と移る'
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('真の勝者', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

p1 = m.add(lefttext('高林哲', 20, mincho, white))
p1.move_to(5, 50)
i = m.add(SWFBitmap.new('satoru.jpg'))
i.scale_to(0.5)
i.move_to(210, 55)

m.add(SWFAction.new('stop();'))
m.next_frame

strs = [
        '実績: Namazu開発',
        nil,
   '利益', nil,
        '  進学（σ・∀・）σ', nil,
        '  就職（σ・∀・）σ', nil,
        '  転職（σ・∀・）σ', nil,
        '', '', '',
  'でももう Namazu は触っていない',
]
items = multitext(m, strs, 20, mincho, white, [5, 80])

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('では負け組とは?', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

strs = [
  '他人のソフトウェアをメンテナンス',
        nil, 
        '',
        '  バグ修正',nil, 
        '  backport',nil, 
        '  環境変化への追従', nil
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

p1 = m.add(centertext('他のhackする暇なし!', 30, mincho, white))
p1.move_to(200, 260)

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('g氏の場合', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)
#i = m.add(SWFBitmap.new('gotom-rh.jpg'))
#i.scale_to(0.5)
#i.move_to(300, 55)

strs = [
  'Debian glibc team',
        nil, 
        '',
        '  バグ修正しまくり',nil, 
        '  でも新たなバグが次から次へと',nil, 
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

p1 = m.add(centertext('「glibcと関係ないバグ送ってくるな!」', 20, mincho, white))
p1.move_to(200, 260)

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('t氏の場合', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

strs = [
  'Debian GNOME team',
        nil, 
        '',
        '  バグ修正しまくり',nil, 
        '  でも新たなバグが次から次へと',nil, 
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

p1 = m.add(centertext('「非公式パッケージのバグなんか知らん!」', 20, mincho, white))
p1.move_to(200, 260)

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

#
pg.done
m = SWFMovie.new
m.set_dimension(dim[0], dim[1])
mincho = SWFFont.new('KochiGMincho.fdb')
m.set_background(white.red, white.green, white.blue)
bg = BgShape.new(black, dim)
btn = bg.setResume()
btn.add_action(pg.action(pg.prev), key_press('b'))
m.add(btn)
bgitem = m.add(bg.shape)

title = m.add(lefttext('Conclusion', 25, mincho, white))
title.move_to(5, 15)
line = m.add(headingline(2, white, dim))
line.move_to(0, 35)

strs = [
  'オープンソース開発はベンチャーのごとし',
        nil, 
        '',
        '  人の興味を魅くものを作る',nil, 
        '  さっさと逃げる',nil, 
]
items = multitext(m, strs, 20, mincho, white, [5, 50])

p1 = m.add(centertext('これであなたも勝ち組', 30, mincho, white))
p1.move_to(200, 260)

m.add(SWFAction.new('stop();'))
m.next_frame
m.add(pg.action(pg.next))
m.next_frame
m.save(pg.cur)
pg.iteration

__END__
