|
Revision 398, 1.1 kB
(checked in by why, 7 months ago)
|
- shoes/world.c: exception handling prior to launch. so file not found doesn't spawn shoes.
- lib/shoes.rb: added --version.
|
| Line | |
|---|
| 1 | NOTES = [ |
|---|
| 2 | ['Welcome to the vJot Clone', 'Okay, you know, just type stuff in and it will save as you go.'] |
|---|
| 3 | ] |
|---|
| 4 | |
|---|
| 5 | Shoes.app :title => "vJot Clone", |
|---|
| 6 | :width => 420, :height => 560, :resizable => false do |
|---|
| 7 | |
|---|
| 8 | @note = NOTES.first |
|---|
| 9 | background "#C7EAFB" |
|---|
| 10 | stack :width => 400, :margin => 20 do |
|---|
| 11 | background "#eee", :radius => 12 |
|---|
| 12 | border "#00D0FF", :strokewidth => 3, :radius => 12 |
|---|
| 13 | stack :margin => 20 do |
|---|
| 14 | caption "vJot Clone" |
|---|
| 15 | @title = edit_line @note[0], :width => 1.0 do |
|---|
| 16 | @note[0] = @title.text |
|---|
| 17 | load_list |
|---|
| 18 | end |
|---|
| 19 | stack :width => 1.0, :height => 200 do |
|---|
| 20 | background "#eee" |
|---|
| 21 | @list = para |
|---|
| 22 | end |
|---|
| 23 | @jot = edit_box @note[1], :width => 1.0, :height => 200, :margin_bottom => 20 do |
|---|
| 24 | @note[1] = @jot.text |
|---|
| 25 | end |
|---|
| 26 | end |
|---|
| 27 | end |
|---|
| 28 | |
|---|
| 29 | def load_list |
|---|
| 30 | @list.replace *(NOTES.map { |note| |
|---|
| 31 | [link(note.first) { @note = load_note(note); load_list }, "\n"] |
|---|
| 32 | }.flatten + |
|---|
| 33 | [link("+ Add a new Note") { NOTES << (@note = load_note); load_list }]) |
|---|
| 34 | end |
|---|
| 35 | |
|---|
| 36 | def load_note(note = ['New Note', '']) |
|---|
| 37 | @note = note |
|---|
| 38 | @title.text = note[0] |
|---|
| 39 | @jot.text = note[1] |
|---|
| 40 | note |
|---|
| 41 | end |
|---|
| 42 | |
|---|
| 43 | load_list |
|---|
| 44 | end |
|---|