windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 371 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 371 - trunk/src
Date: Sun, 30 May 2004 21:21:30 +0200

Author: grumbel
Date: 2004-05-30 21:21:30 +0200 (Sun, 30 May 2004)
New Revision: 371

Modified:
   trunk/src/editor.py
   trunk/src/icon.cxx
   trunk/src/icon.hxx
   trunk/src/supertux.py
Log:
- icon cleanup
- supertuxlevel constructor cleanup

Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-30 17:38:58 UTC (rev 370)
+++ trunk/src/editor.py 2004-05-30 19:21:30 UTC (rev 371)
@@ -62,7 +62,7 @@
 
 workspace.set_tool(tilemap_paint_tool.to_tool());
 
-startlevel = SuperTuxLevel()
+startlevel = SuperTuxLevel(100, 50)
 startlevel.activate(workspace)
 
 def do_quit():
@@ -130,22 +130,31 @@
 
 p = Counter(2)
 
-new_icon         = Icon(CL_Point(p.inc(0),  2), 
make_sprite("../data/images/icons24/stock_new.png"), "Some tooltip", willow);
-load_icon        = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/stock_open.png"), "Some tooltip", willow);
-load_recent_icon = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/downarrow.png"), "Some tooltip", willow);
-save_icon        = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/stock_save.png"), "Some tooltip", willow);
-save_as_icon     = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/stock_save_as.png"), "Some tooltip", 
willow);
+new_icon         = Icon(CL_Rect(CL_Point(p.inc(0),  2), CL_Size(32, 32)),
+                                
make_sprite("../data/images/icons24/stock_new.png"), "Some tooltip", willow);
+load_icon        = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/stock_open.png"), 
"Some tooltip", willow);
+load_recent_icon = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(16, 32)),
+                        make_sprite("../data/images/icons24/downarrow.png"), 
"Some tooltip", willow);
+save_icon        = Icon(CL_Rect(CL_Point(p.inc(16), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/stock_save.png"), 
"Some tooltip", willow);
+save_as_icon     = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                        
make_sprite("../data/images/icons24/stock_save_as.png"), "Some tooltip", 
willow);
 
 load_icon.set_callback(gui_level_load)
 load_recent_icon.set_callback(lambda: recent_files_menu.run())
 save_icon.set_callback(gui_level_save)
 save_as_icon.set_callback(gui_level_save_as)
 
-copy_icon    = Icon(CL_Point(p.inc(48), 2), 
make_sprite("../data/images/icons24/stock_copy.png"), "Some tooltip", willow);
-paste_icon   = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/stock_paste.png"), "Some tooltip", willow);
+copy_icon    = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
+                    make_sprite("../data/images/icons24/stock_copy.png"), 
"Some tooltip", willow);
+paste_icon   = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                    make_sprite("../data/images/icons24/stock_paste.png"), 
"Some tooltip", willow);
 
-undo_icon = Icon(CL_Point(p.inc(48), 2), 
make_sprite("../data/images/icons24/stock_undo.png"), "Some tooltip", willow);
-redo_icon = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/stock_redo.png"), "Some tooltip", willow);
+undo_icon = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
+                 make_sprite("../data/images/icons24/stock_undo.png"), "Some 
tooltip", willow);
+redo_icon = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                 make_sprite("../data/images/icons24/stock_redo.png"), "Some 
tooltip", willow);
 
 undo_icon.set_callback(editor.undo)
 redo_icon.set_callback(editor.redo)
@@ -153,10 +162,14 @@
 undo_icon.disable()
 redo_icon.disable()
 
-foreground_icon  = Icon(CL_Point(p.inc(48), 2), 
make_sprite("../data/images/icons24/foreground.png"), "Some tooltip", willow);
-interactive_icon = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/interactive.png"), "Some tooltip", willow);
-background_icon  = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/background.png"), "Some tooltip", willow);
-eye_icon         = Icon(CL_Point(p.inc(32), 2), 
make_sprite("../data/images/icons24/eye.png"), "Some tooltip", willow);
+foreground_icon  = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/foreground.png"), 
"Some tooltip", willow);
+interactive_icon = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/interactive.png"), 
"Some tooltip", willow);
+background_icon  = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/background.png"), 
"Some tooltip", willow);
+eye_icon         = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                        make_sprite("../data/images/icons24/eye.png"), "Some 
tooltip", willow);
 
 layer_menu = Menu(CL_Point(32*11+2, 54), gui.get_component())
 
@@ -205,16 +218,16 @@
 
 toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 32*4+2)), 
gui.get_component())
 
-paint = Icon(CL_Point(2, 32*0+2), 
make_sprite("../data/images/tools/stock-tool-pencil-22.png"), "Some tooltip", 
toolbar);
+paint = Icon(CL_Rect(CL_Point(2, 32*0+2), CL_Size(32, 32)), 
make_sprite("../data/images/tools/stock-tool-pencil-22.png"), "Some tooltip", 
toolbar);
 paint.set_callback(set_tilemap_paint_tool)
 
-select = Icon(CL_Point(2, 32*1+2), 
make_sprite("../data/images/tools/stock-tool-rect-select-22.png"), "Some 
tooltip", toolbar);
+select = Icon(CL_Rect(CL_Point(2, 32*1+2), CL_Size(32,32)), 
make_sprite("../data/images/tools/stock-tool-rect-select-22.png"), "Some 
tooltip", toolbar);
 select.set_callback(set_tilemap_select_tool)
 
-zoom = Icon(CL_Point(2, 32*2+2), 
make_sprite("../data/images/tools/stock-tool-zoom-22.png"), "Some tooltip", 
toolbar);
+zoom = Icon(CL_Rect(CL_Point(2, 32*2+2), CL_Size(32,32)), 
make_sprite("../data/images/tools/stock-tool-zoom-22.png"), "Some tooltip", 
toolbar);
 zoom.set_callback(set_zoom_tool)
 
-object = Icon(CL_Point(2, 32*3+2), 
make_sprite("../data/images/tools/stock-tool-clone-22.png"), "Some tooltip", 
toolbar);
+object = Icon(CL_Rect(CL_Point(2, 32*3+2), CL_Size(32,32)), 
make_sprite("../data/images/tools/stock-tool-clone-22.png"), "Some tooltip", 
toolbar);
 object.set_callback(set_objmap_select_tool)
 
 # erase  = Icon(CL_Point(2, 32+1+2), 
make_sprite("../data/images/tools/stock-tool-eraser-22.png"), "Some tooltip", 
toolbar);
@@ -249,10 +262,17 @@
 
 def menu_show_all():
     display_properties.show_all = True
+    display_properties.current_only = False
     display_properties.set(workspace.get_map().get_metadata())
 
+def menu_show_current():
+    display_properties.show_all = False
+    display_properties.current_only = False
+    display_properties.set(workspace.get_map().get_metadata())
+
 def menu_show_only_current():
     display_properties.show_all = False
+    display_properties.current_only = True
     display_properties.set(workspace.get_map().get_metadata())
 
 foreground_icon.set_callback(menu_show_foreground)
@@ -278,6 +298,7 @@
 del Menu_add_item
 
 layer_menu.add_item(mysprite, "Show all", menu_show_all)
+layer_menu.add_item(mysprite, "Show current", menu_show_current)
 layer_menu.add_item(mysprite, "Show only current", menu_show_only_current)
 
 supertux = SuperTuxGUI(load_supertux_tiles(), gui)

Modified: trunk/src/icon.cxx
===================================================================
--- trunk/src/icon.cxx  2004-05-30 17:38:58 UTC (rev 370)
+++ trunk/src/icon.cxx  2004-05-30 19:21:30 UTC (rev 371)
@@ -51,23 +51,6 @@
   void mouse_move(const CL_InputEvent& event);
 };
 
-Icon::Icon(const CL_Point& pos, const CL_Sprite& sprite, const std::string& 
tooltip, 
-           CL_Component* parent)
-  : CL_Component(CL_Rect(pos, CL_Size(32, 32)), parent),
-    impl(new IconImpl(this))
-{
-  impl->sprite       = sprite;
-  impl->tooltip      = tooltip;
-  impl->draw_tooltip = true;
-  impl->down         = false;
-  impl->is_down      = false;
-  impl->is_enabled   = true;
-
-  impl->slots.push_back(sig_paint().connect(impl.get(), &IconImpl::draw));
-  impl->slots.push_back(sig_mouse_down().connect(impl.get(), 
&IconImpl::mouse_down));
-  impl->slots.push_back(sig_mouse_up().connect(impl.get(),   
&IconImpl::mouse_up));
-}
-
 Icon::Icon(const CL_Rect& rect, const CL_Sprite& sprite, const std::string& 
tooltip, 
            CL_Component* parent)
   : CL_Component(rect, parent),

Modified: trunk/src/icon.hxx
===================================================================
--- trunk/src/icon.hxx  2004-05-30 17:38:58 UTC (rev 370)
+++ trunk/src/icon.hxx  2004-05-30 19:21:30 UTC (rev 371)
@@ -32,7 +32,6 @@
 {
 private:
 public:
-  Icon(const CL_Point& pos, const CL_Sprite& sprite, const std::string& 
tooltip, CL_Component* parent);
   Icon(const CL_Rect& rect, const CL_Sprite& sprite, const std::string& 
tooltip, CL_Component* parent);
 
   void disable();

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-05-30 17:38:58 UTC (rev 370)
+++ trunk/src/supertux.py       2004-05-30 19:21:30 UTC (rev 371)
@@ -59,22 +59,25 @@
 
     editormap = None
 
-    def __init__(self, filename = None):
-        self.filename = filename
-        
-        if filename == None:
+    def __init__(self, *params):
+        if len(params) == 2:
+            (width, height) = params
+            
             self.name   = "No Name"
             self.author = "No Author"
 
-            self.width  = 200
-            self.height = 100
+            self.width  = width
+            self.height = height
 
             self.foreground  = TilemapLayer(supertux_tileset, self.width, 
self.height)
             self.interactive = TilemapLayer(supertux_tileset, self.width, 
self.height)
             self.background  = TilemapLayer(supertux_tileset, self.width, 
self.height)
             self.objects = ObjectLayer()
-        else:
-            tree = sexpr_read_from_file(filename)
+            
+        elif len(params) == 1:
+            (self.filename,) = params
+            
+            tree = sexpr_read_from_file(self.filename)
             data = tree[1:]
 
             self.name   = get_value_from_tree(["name", "_"], data, "no name")
@@ -93,6 +96,9 @@
             self.background.set_data(get_value_from_tree(["background-tm"], 
data, []))
 
             self.objects = ObjectLayer()
+            
+        else:
+            raise "Wrong arguments for SuperTux::___init__"
 
         self.editormap = EditorMap()
         self.editormap.add_layer(self.background.to_layer())
@@ -156,10 +162,15 @@
 class DisplayProperties:
     layer = SuperTuxLevel.INTERACTIVE
     show_all = False
+    current_only = False
     
     def set(self, map):
-        active   = CL_Color(255, 255, 255)
-        deactive = CL_Color(150, 150, 250, 150)
+        if self.current_only:
+            active   = CL_Color(255, 255, 255)
+            deactive = CL_Color(150, 150, 250, 150)
+        else:
+            active   = CL_Color(255, 255, 255)
+            deactive = CL_Color(0, 0, 0, 10)
 
         if (self.show_all):
             map.foreground.set_foreground_color(active)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]