Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv4311/view
Modified Files:
fox.rb
Log Message:
modifying cookbooks and categories and recipes. how nice. Now need to add/del/order them.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** fox.rb 20 Dec 2003 03:18:17 -0000 1.7
--- fox.rb 20 Dec 2003 03:30:02 -0000 1.8
***************
*** 2,5 ****
--- 2,51 ----
include Fox
+ class CookbookForm < FXVerticalFrame
+ def initialize(parent,o)
+ super(parent)
+ @cookbook = o
+
+ FXLabel.new(self,"Name")
+ @name = FXTextField.new(self, 80)
+
+ @name.connect(SEL_COMMAND) do |sender,sel,data|
+ @cookbook.name = data
+ end
+
+ populate
+ end
+ def populate
+ return if not @cookbook
+ @name.text = @cookbook.name
+ end
+ def cookbook=(o)
+ @cookbook = o
+ populate
+ end
+ end
+ class CategoryForm < FXVerticalFrame
+ def initialize(parent,o)
+ super(parent)
+ @category = o
+
+ FXLabel.new(self,"Name")
+ @name = FXTextField.new(self,80)
+
+ @name.connect(SEL_COMMAND) do |sender,sel,data|
+ @category.name = data
+ end
+
+ populate
+ end
+ def populate
+ return if not @category
+ @name.text = @category.name
+ end
+ def category=(o)
+ @category = o
+ populate
+ end
+ end
class RecipeForm < FXVerticalFrame
def initialize(parent,r)
***************
*** 65,72 ****
end
! populate if @recipe
end
def populate
@name.text = @recipe.name
@author.text = @recipe.author
--- 111,119 ----
end
! populate
end
def populate
+ return if not @recipe
@name.text = @recipe.name
@author.text = @recipe.author
***************
*** 101,104 ****
--- 148,153 ----
counterSwitcher = FXSwitcher.new(counter,LAYOUT_FILL_X|LAYOUT_FILL_Y)
FXWindow.new(counterSwitcher)
+ CookbookForm.new(counterSwitcher,nil)
+ CategoryForm.new(counterSwitcher,nil)
RecipeForm.new(counterSwitcher,nil)
***************
*** 106,111 ****
--- 155,164 ----
$replicator.shelf.each do |cookbook|
cookbook_item = shelfTree.addItemLast(nil, FXTreeItem.new(cookbook.name))
+ cookbook_item.data = cookbook
+ cookbook.add_observer { cookbook_item.text = cookbook.name; shelfTree.update }
cookbook.categories.each do |category|
category_item = shelfTree.addItemLast(cookbook_item, FXTreeItem.new(category.name))
+ category_item.data = category
+ category.add_observer { category_item.text = category.name; shelfTree.update }
category.recipes.each do |recipe|
item = FXTreeItem.new(recipe.name)
***************
*** 117,123 ****
end
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
! if Recipe === ptr.data
! counterSwitcher.children[1].recipe = ptr.data
counterSwitcher.current = 1
end
end
--- 170,183 ----
end
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
! case ptr.data
! when Cookbook
! counterSwitcher.children[1].cookbook = ptr.data
counterSwitcher.current = 1
+ when Category
+ counterSwitcher.children[2].category = ptr.data
+ counterSwitcher.current = 2
+ when Recipe
+ counterSwitcher.children[3].recipe = ptr.data
+ counterSwitcher.current = 3
end
end
|