Navigation Menu

Skip to content

Commit

Permalink
Wish to run HacketyHack with Green Shoes. This is a first commit just…
Browse files Browse the repository at this point in the history
… to display a basic HH main window and 4 tabs (small pics). But you can click 'Help' tab only so far.
  • Loading branch information
ashbb committed Apr 17, 2011
1 parent 8f425e2 commit 0892f99
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/boot.rb
@@ -1,7 +1,7 @@
# requires and initializations needed for /h-ety-h.rb
# more initializations are in h-ety-h/init.rb

require 'hpricot'
#require 'hpricot'

module ::HH end

Expand Down
25 changes: 14 additions & 11 deletions app/ui/mainwindow.rb
Expand Up @@ -52,30 +52,33 @@ def finalization

w = (HH::PREFS['width'] || '790').to_i
h = (HH::PREFS['height'] || '550').to_i
window :title => "Hackety Hack", :width => w, :height => h do
Shoes.app :title => "Hackety Hack", :width => w, :height => h do
HH::APP = self
extend HH::App, HH::Widgets, HH::Observable
style(Shoes::LinkHover, :fill => nil, :stroke => "#C66")
style(Shoes::Link, :stroke => "#377")

@main_content = flow :width => 1.0, :height => -1 do
background "#e9efe0"
background "#e9efe0".."#c1c5d0", :height => 150, :bottom => 150
end
@lesson_stack = stack :hidden => true, :width => 400
@lesson_stack.finish do
finalization
@main_content = flow do
background "#e9efe0", height: h
flow margin_top: h - 150 do
flow{background "#e9efe0".."#c1c5d0", height: 150}
end
end
#@lesson_stack = stack :hidden => true, :width => 400
#@lesson_stack.finish do
# finalization
#end

extend HH::HasSideTabs
init_tabs @main_content

addtab :Home, :icon => "tab-home.png"
addtab :Editor, :icon => "tab-new.png"
addtab :Lessons, :icon => "tab-tour.png"
addtab :Help, :icon => "tab-help.png" do
Shoes.show_manual
Shoes.show_manual 'English'
end
=begin
addtab :Cheat, :icon => "tab-cheat.png" do
dialog :title => "Hackety Hack - Cheat Sheet", :width => 496 do
image "#{HH::STATIC}/hhcheat.png"
Expand Down Expand Up @@ -127,5 +130,5 @@ def finalization
end
end
=end
end
58 changes: 31 additions & 27 deletions app/ui/tabs/sidetabs.rb
Expand Up @@ -8,16 +8,21 @@ def initialize slot, dir
# tabs whose file has been loaded
@loaded_tabs = {}
sidetabs = self
width = HOVER_WIDTH;
width = HOVER_WIDTH
tabs = %w[home editor lessons help].map &:capitalize
tips = []
tabs.each_with_index do |tab, i|
y = i*26+4
slot.app.instance_eval do
tips << [rect(38, y, 100, 24, fill: "#F7A", curve: 4, strokewidth: 0, hidden: true),
rect(38, y, 10, 24, fill: "#F7A", strokewidth: 0, hidden: true),
para(fg(tab, white), left: 44, top: y+2, hidden: true)]
end
end
tip = {}
tabs.each_with_index{|tab, i| tip.merge! tab => tips[i]}
append_to @slot do
tip = nil
right = stack :margin_left => 38, :height => 1.0
left = stack :top => 0, :left => 0, :width => 38, :height => 1.0 do
tip = stack :top => 0, :left => 0, :width => width, :margin => 4,
:hidden => true do
background "#F7A", :curve => 6
para "HOME", :margin => 3, :margin_left => 40, :stroke => white
end
left = stack :width => 38, :height => height do
# colored background
background "#cdc", :width => 38
background "#dfa", :width => 36
Expand All @@ -27,6 +32,7 @@ def initialize slot, dir
background "#7aa", :width => 12
background "#77a", :width => 6
end
right = stack :margin_left => 38, :height => height
sidetabs.instance_eval{@left, @right, @tip = left, right, tip}
end
end
Expand Down Expand Up @@ -55,22 +61,21 @@ def addtab symbol, opts={}, &blk
end
width = HOVER_WIDTH+22;
append_to @left do
stack pos => pixelpos, :left => 0, :width => 38, :margin => 4 do
bg = background "#DFA", :height => 26, :curve => 6, :hidden => true
image(icon_path, :margin => 4).
hover do
bg.show
tip.parent.width = width
tip.top = nil
tip.bottom = nil
tip.send("#{pos}=", pixelpos)
tip.contents[1].text = hover
tip.show
end.leave do
bg.hide
tip.hide
tip.parent.width = 40
end.click &onclick
stack width: 38, height: 26, margin: 4 do
bg = img = nil
flow do
bg = background "#DFA", width: 32, curve: 6, hidden: true
img = image(icon_path, margin: 4)
end
img.hover do
bg.show
tip[hover].each &:show
end
img.leave do
bg.hide
tip[hover].each &:hide
end
img.click &onclick
end
end

Expand Down Expand Up @@ -134,8 +139,7 @@ class HH::SideTab
def initialize slot
@slot = slot
slot.append do
@content = flow :hidden => true, :left => 0, :top => 0,
:width => 1.0, :height => 1.0 do content end
@content = flow do content end
end
end

Expand Down
3 changes: 2 additions & 1 deletion h-ety-h.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env shoes
require 'green_shoes'
$:.push '.'

# the main application executable

Expand Down
2 changes: 1 addition & 1 deletion lib/all.rb
@@ -1,7 +1,7 @@
require 'lib/web/all'
require 'lib/dev/init'

require 'lib/art/turtle'
#require 'lib/art/turtle'
require 'lib/enhancements'
require 'lib/dev/errors'
require 'lib/dev/events'
Expand Down
2 changes: 2 additions & 0 deletions lib/dev/init.rb
Expand Up @@ -41,9 +41,11 @@

Dir.chdir(HH::USER)

=begin
font "#{HH::FONTS}/Lacuna.ttf"
font "#{HH::FONTS}/LiberationMono-Regular.ttf"
font "#{HH::FONTS}/LiberationMono-Bold.ttf"
font "#{HH::FONTS}/Pixelpoiiz.ttf"
font "#{HH::FONTS}/Phonetica.ttf"
font "#{HH::FONTS}/TakaoGothic.otf"
=end

0 comments on commit 0892f99

Please sign in to comment.