pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3106 - in trunk/pingus/src: . editor gui


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3106 - in trunk/pingus/src: . editor gui
Date: Fri, 7 Sep 2007 18:59:49 +0200

Author: grumbel
Date: 2007-09-07 18:59:48 +0200 (Fri, 07 Sep 2007)
New Revision: 3106

Added:
   trunk/pingus/src/editor/file_list.cpp
   trunk/pingus/src/editor/file_list.hpp
   trunk/pingus/src/editor/file_load_dialog.cpp
   trunk/pingus/src/editor/file_load_dialog.hpp
   trunk/pingus/src/editor/file_save_dialog.cpp
   trunk/pingus/src/editor/file_save_dialog.hpp
   trunk/pingus/src/editor/object_properties.cpp
   trunk/pingus/src/editor/object_properties.hpp
Modified:
   trunk/pingus/src/SConscript
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/file_dialog.cpp
   trunk/pingus/src/gui/rect_component.hpp
   trunk/pingus/src/system.cpp
   trunk/pingus/src/system.hpp
Log:
- commit started a new file dialog

Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-07 14:58:50 UTC (rev 3105)
+++ trunk/pingus/src/SConscript 2007-09-07 16:59:48 UTC (rev 3106)
@@ -26,7 +26,7 @@
     CCFLAGS = ['-O0', '-Wall', '-Werror', '-g'],
     CPPDEFINES = ['ENABLE_BINRELOC', 'HAVE_CWIID'],
     CPPPATH = ['..', '.'],
-    LIBS = ['cwiid', 'Xi']) # FIXME: Make this configurable
+    LIBS = ['cwiid', 'Xi', 'boost_signals']) # FIXME: Make this configurable
 
 env.ParseConfig('sdl-config  --cflags --libs')
 env['LIBS'] += ['SDL_image', 'SDL_mixer', 'png']
@@ -91,7 +91,10 @@
 
 'editor/context_menu.cpp',
 'editor/editor_level.cpp', 
-'editor/panel.cpp', 
+'editor/panel.cpp',
+'editor/file_list.cpp',
+'editor/file_load_dialog.cpp',
+'editor/file_save_dialog.cpp', 
 'editor/editor_screen.cpp', 
 'editor/editor_viewport.cpp', 
 'editor/level_objs.cpp',

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-07 14:58:50 UTC (rev 
3105)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-07 16:59:48 UTC (rev 
3106)
@@ -29,6 +29,7 @@
 #include "../resource.hpp"
 #include "../fonts.hpp"
 #include "../file_dialog.hpp"
+#include "file_load_dialog.hpp"
 #include "../path_manager.hpp"
 #include "../pathname.hpp"
 #include "game_session.hpp"
@@ -60,6 +61,10 @@
   panel = new Panel(this);
 
   object_selector = new ObjectSelector(this);
+
+  FileLoadDialog* file_load_dialog = new FileLoadDialog(this, Rect(100, 150, 
700, 450));
+  gui_manager->add(file_load_dialog, true);
+  file_load_dialog->set_directory("/tmp");
 }
 
 // Destructor

Added: trunk/pingus/src/editor/file_list.cpp
===================================================================
--- trunk/pingus/src/editor/file_list.cpp       2007-09-07 14:58:50 UTC (rev 
3105)
+++ trunk/pingus/src/editor/file_list.cpp       2007-09-07 16:59:48 UTC (rev 
3106)
@@ -0,0 +1,123 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include <iostream>
+#include "math.hpp"
+#include "fonts.hpp"
+#include "file_list.hpp"
+
+namespace Editor {
+
+FileList::FileList(const Rect& rect)
+  : RectComponent(rect),
+    current_item(-1),
+    click_item(-1)
+{
+  update_layout();
+}
+
+void
+FileList::update_layout() 
+{
+  hspace = rect.get_width()/2;
+  vspace = 20;
+}
+
+void
+FileList::set_directory(const std::string& pathname, const std::string& 
pattern)
+{
+  directory = System::opendir(pathname, pattern);
+}
+
+void
+FileList::draw(DrawingContext& gc)
+{
+  gc.draw_fillrect(rect.left, rect.top, rect.right, rect.bottom,
+                   Color(0, 0, 0));
+
+  int x = rect.left;
+  int y = rect.top;
+  for(System::Directory::iterator i = directory.begin(); i != directory.end(); 
++i)
+    {
+      if (i->type == System::DE_DIRECTORY)
+        gc.draw(directory_icon, x, y);
+      else if (i->type == System::DE_FILE)
+        gc.draw(file_icon, x, y);
+
+      if ((click_item == -1 && (i - directory.begin()) == current_item) ||
+          (i - directory.begin()) == click_item)
+        {
+          if (click_item == current_item)
+            gc.draw_fillrect(x, y, x + hspace, y + vspace, Color(0, 0, 255));
+          else
+            gc.draw_rect(x, y, x + hspace, y + vspace, Color(0, 0, 255));
+        }
+      
+      gc.print_left(Fonts::courier_small, x + 4, y + 3,
+                    ((i->type == System::DE_DIRECTORY) ? "[DIR]  " : "[FILE] 
") + i->name);
+
+      y += 20;
+      if (y > rect.bottom - vspace)
+        {
+          y = rect.top;
+          x += hspace;
+        }
+    }
+}
+
+void
+FileList::on_primary_button_press (int x, int y)
+{
+  on_pointer_move(x,y);
+  click_item = current_item;
+}
+
+void
+FileList::on_primary_button_release (int x, int y)
+{
+  on_pointer_move(x,y);
+  if (click_item == current_item)
+    {
+      std::cout << directory[current_item].name << std::endl;
+      on_click(directory[current_item].name);
+    }
+  click_item = -1;
+}
+
+void
+FileList::on_pointer_move (int x, int y)
+{
+  x = x - rect.left;
+  y = y - rect.top;
+
+  current_item = Math::clamp(0, y / vspace, rect.get_height() / vspace - 1)
+    + Math::clamp(0, x / hspace, rect.get_width() / hspace - 1) * 
(rect.get_height()/vspace);
+  
+  if (current_item < 0 || current_item >= int(directory.size()))
+    current_item = -1;
+}
+
+void
+FileList::update (float delta)
+{
+}
+
+} // namespace Editor
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_list.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/file_list.hpp
===================================================================
--- trunk/pingus/src/editor/file_list.hpp       2007-09-07 14:58:50 UTC (rev 
3105)
+++ trunk/pingus/src/editor/file_list.hpp       2007-09-07 16:59:48 UTC (rev 
3106)
@@ -0,0 +1,68 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_FILE_LIST_HPP
+#define HEADER_FILE_LIST_HPP
+
+#include <boost/signal.hpp>
+#include "system.hpp"
+#include "sprite.hpp"
+#include "gui/rect_component.hpp"
+
+namespace Editor {
+
+/** */
+class FileList : public GUI::RectComponent
+{
+private:
+  int hspace;
+  int vspace;
+
+  Sprite file_icon;
+  Sprite directory_icon;
+  System::Directory directory;
+  int current_item;
+  int click_item;
+
+public:
+  FileList(const Rect& rect);
+
+  void draw (DrawingContext& gc);
+  void update (float delta);
+  
+  void update_layout();
+  void set_directory(const std::string& pathname, const std::string& pattern = 
"*"); 
+
+  void on_pointer_move (int x, int y);
+
+  void on_primary_button_press (int x, int y);
+  void on_primary_button_release (int x, int y);
+
+  boost::signal<void (const std::string&)> on_click;
+
+private:
+  FileList (const FileList&);
+  FileList& operator= (const FileList&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_list.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/file_load_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.cpp        2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/file_load_dialog.cpp        2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,63 @@
+/*  $Id$
+**   __      __ __             ___        __   __ __   __
+**  /  \    /  \__| ____    __| _/_______/  |_|__|  | |  |   ____
+**  \   \/\/   /  |/    \  / __ |/  ___/\   __\  |  | |  | _/ __ \
+**   \        /|  |   |  \/ /_/ |\___ \  |  | |  |  |_|  |_\  ___/
+**    \__/\  / |__|___|  /\____ /____  > |__| |__|____/____/\___  >
+**         \/          \/      \/    \/                         \/
+**  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU General Public License
+**  as published by the Free Software Foundation; either version 2
+**  of the License, or (at your option) any later version.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+** 
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+**  02111-1307, USA.
+*/
+
+#include <iostream>
+#include <boost/bind.hpp>
+#include "gui/gui_manager.hpp"
+#include "editor_screen.hpp"
+#include "file_load_dialog.hpp"
+
+namespace Editor {
+
+FileLoadDialog::FileLoadDialog(EditorScreen* editor_, const Rect& rect)
+  : RectComponent(rect),
+    editor(editor_),
+    file_list(Rect(rect.left  + 10, rect.top + 10,
+                   rect.right - 10, rect.bottom - 10))
+{
+  editor->get_gui_manager()->add(&file_list, false);
+  
+  file_list.on_click.connect(boost::bind(&FileLoadDialog::load_file, this, 
_1));
+}
+
+FileLoadDialog::~FileLoadDialog()
+{
+}
+  
+void
+FileLoadDialog::load_file(const std::string& file) const
+{
+  std::cout << "FileLoadDialog::load_file: " << file << std::endl;
+}
+
+void
+FileLoadDialog::set_directory(const std::string& pathname)
+{
+  file_list.set_directory(pathname);
+}
+
+} // namespace Editor
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_load_dialog.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/file_load_dialog.hpp
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.hpp        2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/file_load_dialog.hpp        2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,64 @@
+/*  $Id$
+**   __      __ __             ___        __   __ __   __
+**  /  \    /  \__| ____    __| _/_______/  |_|__|  | |  |   ____
+**  \   \/\/   /  |/    \  / __ |/  ___/\   __\  |  | |  | _/ __ \
+**   \        /|  |   |  \/ /_/ |\___ \  |  | |  |  |_|  |_\  ___/
+**    \__/\  / |__|___|  /\____ /____  > |__| |__|____/____/\___  >
+**         \/          \/      \/    \/                         \/
+**  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU General Public License
+**  as published by the Free Software Foundation; either version 2
+**  of the License, or (at your option) any later version.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+** 
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+**  02111-1307, USA.
+*/
+
+#ifndef HEADER_FILE_LOAD_DIALOG_HPP
+#define HEADER_FILE_LOAD_DIALOG_HPP
+
+#include "file_list.hpp"
+#include "gui/rect_component.hpp"
+
+namespace Editor {
+
+class EditorScreen;
+
+/** */
+class FileLoadDialog : public GUI::RectComponent
+{
+private:
+  EditorScreen* editor;
+  FileList file_list;
+
+public:
+  FileLoadDialog(EditorScreen* editor, const Rect& rect);
+  ~FileLoadDialog();
+  
+  bool is_at(int x, int y) { return false; }
+
+  void draw(DrawingContext&) {}
+  void update_layout() {}
+
+  void load_file(const std::string& file) const;
+  void set_directory(const std::string& pathname);
+
+private:
+  FileLoadDialog (const FileLoadDialog&);
+  FileLoadDialog& operator= (const FileLoadDialog&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_load_dialog.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/file_save_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_save_dialog.cpp        2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/file_save_dialog.cpp        2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,30 @@
+/*  $Id$
+**   __      __ __             ___        __   __ __   __
+**  /  \    /  \__| ____    __| _/_______/  |_|__|  | |  |   ____
+**  \   \/\/   /  |/    \  / __ |/  ___/\   __\  |  | |  | _/ __ \
+**   \        /|  |   |  \/ /_/ |\___ \  |  | |  |  |_|  |_\  ___/
+**    \__/\  / |__|___|  /\____ /____  > |__| |__|____/____/\___  >
+**         \/          \/      \/    \/                         \/
+**  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU General Public License
+**  as published by the Free Software Foundation; either version 2
+**  of the License, or (at your option) any later version.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+** 
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+**  02111-1307, USA.
+*/
+
+#include "file_save_dialog.hpp"
+
+
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_save_dialog.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/file_save_dialog.hpp
===================================================================
--- trunk/pingus/src/editor/file_save_dialog.hpp        2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/file_save_dialog.hpp        2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,42 @@
+/*  $Id$
+**   __      __ __             ___        __   __ __   __
+**  /  \    /  \__| ____    __| _/_______/  |_|__|  | |  |   ____
+**  \   \/\/   /  |/    \  / __ |/  ___/\   __\  |  | |  | _/ __ \
+**   \        /|  |   |  \/ /_/ |\___ \  |  | |  |  |_|  |_\  ___/
+**    \__/\  / |__|___|  /\____ /____  > |__| |__|____/____/\___  >
+**         \/          \/      \/    \/                         \/
+**  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU General Public License
+**  as published by the Free Software Foundation; either version 2
+**  of the License, or (at your option) any later version.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+** 
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+**  02111-1307, USA.
+*/
+
+#ifndef HEADER_FILE_SAVE_DIALOG_HPP
+#define HEADER_FILE_SAVE_DIALOG_HPP
+
+/** */
+class FileSaveDialog
+{
+private:
+public:
+
+private:
+  FileSaveDialog (const FileSaveDialog&);
+  FileSaveDialog& operator= (const FileSaveDialog&);
+};
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/file_save_dialog.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/object_properties.cpp
===================================================================
--- trunk/pingus/src/editor/object_properties.cpp       2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/object_properties.cpp       2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,40 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2006 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include "object_properties.hpp"
+
+namespace Editor {
+
+ObjectProperties::ObjectProperties(EditorScreen* editor_)
+  : editor(editor_)
+{
+}
+
+ObjectProperties::~ObjectProperties()
+{
+}
+
+void
+ObjectProperties::set_object(LevelObj* obj)
+{
+}
+
+} // namespace Editor
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/object_properties.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/editor/object_properties.hpp
===================================================================
--- trunk/pingus/src/editor/object_properties.hpp       2007-09-07 14:58:50 UTC 
(rev 3105)
+++ trunk/pingus/src/editor/object_properties.hpp       2007-09-07 16:59:48 UTC 
(rev 3106)
@@ -0,0 +1,47 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_EDITOR_OBJECT_PROPERTIES_HPP
+#define HEADER_EDITOR_OBJECT_PROPERTIES_HPP
+
+namespace Editor {
+
+/** */
+class ObjectProperties
+{
+private:
+  Editor* editor;
+  LevelObj* current_object;
+  
+public:
+  ObjectProperties(EditorScreen* editor);
+  ~ObjectProperties();
+  
+  void set_object(LevelObj* obj);
+
+private:
+  ObjectProperties (const ObjectProperties&);
+  ObjectProperties& operator= (const ObjectProperties&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/editor/object_properties.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: trunk/pingus/src/file_dialog.cpp
===================================================================
--- trunk/pingus/src/file_dialog.cpp    2007-09-07 14:58:50 UTC (rev 3105)
+++ trunk/pingus/src/file_dialog.cpp    2007-09-07 16:59:48 UTC (rev 3106)
@@ -39,268 +39,268 @@
 class FileDialogOkButton : public GUI::SurfaceButton
 {
 private:
-       FileDialog* file_dialog;
-       std::string label;
-       bool is_hidden;
+  FileDialog* file_dialog;
+  std::string label;
+  bool is_hidden;
 
 public:
-       FileDialogOkButton (FileDialog *f, std::string l)
-               : GUI::SurfaceButton(Display::get_width()/2 + 230,
-               Display::get_height()/2 + 160,
-               ResDescriptor("core/menu/exit_button_normal"),
-               ResDescriptor("core/menu/exit_button_pressed"),
-               ResDescriptor("core/menu/exit_button_hover")),
-               file_dialog(f),
-               label (l),
-               is_hidden(true)
-       {
-       }
+  FileDialogOkButton (FileDialog *f, std::string l)
+    : GUI::SurfaceButton(Display::get_width()/2 + 230,
+                         Display::get_height()/2 + 160,
+                         ResDescriptor("core/menu/exit_button_normal"),
+                         ResDescriptor("core/menu/exit_button_pressed"),
+                         ResDescriptor("core/menu/exit_button_hover")),
+      file_dialog(f),
+      label (l),
+      is_hidden(true)
+  {
+  }
 
-       void draw (DrawingContext& gc) {
-               if (!is_hidden)
-               {
-                       SurfaceButton::draw(gc);
-                       gc.print_right(Fonts::chalk_large, 
(float)Display::get_width()/2 + 230,
-                               (float)Display::get_height()/2 + 160, label);
-               }
-       }
+  void draw (DrawingContext& gc) {
+    if (!is_hidden)
+      {
+        SurfaceButton::draw(gc);
+        gc.print_right(Fonts::chalk_large, (float)Display::get_width()/2 + 230,
+                       (float)Display::get_height()/2 + 160, label);
+      }
+  }
 
-       bool is_at(int x, int y) {
-               return x > x_pos - Fonts::chalk_large.get_width(label)
-                       && x < x_pos + int(button_surface.get_width())
-                       && y > y_pos && y < y_pos + 
int(button_surface.get_height());
-       }
+  bool is_at(int x, int y) {
+    return x > x_pos - Fonts::chalk_large.get_width(label)
+      && x < x_pos + int(button_surface.get_width())
+      && y > y_pos && y < y_pos + int(button_surface.get_height());
+}
 
-       void on_click()
-       {
-               if (!is_hidden)
-               {
-                       Sound::PingusSound::play_sound ("yipee");
-                       file_dialog->ok_pressed();
-               }
-       }
+  void on_click()
+{
+  if (!is_hidden)
+    {
+      Sound::PingusSound::play_sound ("yipee");
+      file_dialog->ok_pressed();
+    }
+}
 
-       void on_pointer_enter()
-       {
-               if (!is_hidden)
-               {
-                       SurfaceButton::on_pointer_enter();
-                       Sound::PingusSound::play_sound ("tick");
-               }
-       }
+void on_pointer_enter()
+{
+  if (!is_hidden)
+    {
+      SurfaceButton::on_pointer_enter();
+      Sound::PingusSound::play_sound ("tick");
+    }
+}
 
-       void hide() { is_hidden = true; }
-       void show() { is_hidden = false; }
+void hide() { is_hidden = true; }
+void show() { is_hidden = false; }
 
 };
 
 class FileDialogCancelButton : public GUI::SurfaceButton
 {
 private:
-       FileDialog* file_dialog;
+  FileDialog* file_dialog;
 
 public:
-       FileDialogCancelButton (FileDialog* f)
-               : GUI::SurfaceButton(Display::get_width()/2 - 280 + 
Fonts::chalk_large.get_width(CANCEL_TEXT),
-               Display::get_height()/2 + 160,
-               ResDescriptor("core/menu/exit_button_normal"),
-               ResDescriptor("core/menu/exit_button_pressed"),
-               ResDescriptor("core/menu/exit_button_hover")),
-               file_dialog (f)
-       {
-       }
+  FileDialogCancelButton (FileDialog* f)
+    : GUI::SurfaceButton(Display::get_width()/2 - 280 + 
Fonts::chalk_large.get_width(CANCEL_TEXT),
+                         Display::get_height()/2 + 160,
+                         ResDescriptor("core/menu/exit_button_normal"),
+                         ResDescriptor("core/menu/exit_button_pressed"),
+                         ResDescriptor("core/menu/exit_button_hover")),
+      file_dialog (f)
+  {
+  }
 
-       void draw (DrawingContext& gc) {
-               SurfaceButton::draw(gc);
-               gc.print_left(Fonts::chalk_large, (float)Display::get_width()/2 
- 280,
-                       (float)Display::get_height()/2 + 160, CANCEL_TEXT);
-       }
+  void draw (DrawingContext& gc) {
+    SurfaceButton::draw(gc);
+    gc.print_left(Fonts::chalk_large, (float)Display::get_width()/2 - 280,
+                  (float)Display::get_height()/2 + 160, CANCEL_TEXT);
+  }
 
-       bool is_at(int x, int y) {
-               return x > x_pos - Fonts::chalk_large.get_width(CANCEL_TEXT)
-                       && x < x_pos + int(button_surface.get_width())
-                       && y > y_pos && y < y_pos + 
int(button_surface.get_height());
-       }
+  bool is_at(int x, int y) {
+    return x > x_pos - Fonts::chalk_large.get_width(CANCEL_TEXT)
+      && x < x_pos + int(button_surface.get_width())
+      && y > y_pos && y < y_pos + int(button_surface.get_height());
+  }
 
-       void on_click()
-       {
-               Sound::PingusSound::play_sound ("yipee");
-               file_dialog->cancel_pressed();
-       }
+  void on_click()
+  {
+    Sound::PingusSound::play_sound ("yipee");
+    file_dialog->cancel_pressed();
+  }
 
-       void on_pointer_enter()
-       {
-               SurfaceButton::on_pointer_enter();
-               Sound::PingusSound::play_sound ("tick");
-       }
+  void on_pointer_enter()
+  {
+    SurfaceButton::on_pointer_enter();
+    Sound::PingusSound::play_sound ("tick");
+  }
 };
 
 class FileDialogScrollButton : public GUI::Component
 {
 private:
-       /** FileDialog box to this which button is assigned */
-       FileDialog* file_dialog;
+  /** FileDialog box to this which button is assigned */
+  FileDialog* file_dialog;
 
-       /** Where the image is located */
-       Vector3f pos;
+  /** Where the image is located */
+  Vector3f pos;
 
-       /** Image used for the scroll button */
-       Sprite sprite;
+  /** Image used for the scroll button */
+  Sprite sprite;
 
-       /** 0 for Up, 1 for Down */
-       int direction;
+  /** 0 for Up, 1 for Down */
+  int direction;
 
-       /** Show it or not */
-       bool is_hidden;
+  /** Show it or not */
+  bool is_hidden;
 
-       bool hover;
+  bool hover;
 
 public:
-       FileDialogScrollButton (FileDialog* f, int d, int height_offset)
-               : file_dialog(f),
-                       pos(Vector3f((float)Display::get_width()/2 + 210,
-                               (float)Display::get_height()/2 + 
height_offset)),
-                       direction(d),
-                       is_hidden(false),
-                       hover(false)
-       {
-               std::string str_direction = d==0 ? "up" : "down";
-               sprite = Resource::load_sprite("core/menu/" + str_direction + 
"_arrow");
-       }
+  FileDialogScrollButton (FileDialog* f, int d, int height_offset)
+    : file_dialog(f),
+      pos(Vector3f((float)Display::get_width()/2 + 210,
+                   (float)Display::get_height()/2 + height_offset)),
+      direction(d),
+      is_hidden(false),
+      hover(false)
+  {
+    std::string str_direction = d==0 ? "up" : "down";
+    sprite = Resource::load_sprite("core/menu/" + str_direction + "_arrow");
+  }
 
-       void draw (DrawingContext& gc) {
-               if (!is_hidden)
-               {
-                       gc.draw(sprite, pos);
-                       if (hover)
-                               gc.draw_rect(pos.x, pos.y, pos.x + 
sprite.get_width(), 
-                                       pos.y + sprite.get_height(), 
Color(255,255,255,150));
-               }
-       }
+  void draw (DrawingContext& gc) {
+    if (!is_hidden)
+      {
+        gc.draw(sprite, pos);
+        if (hover)
+          gc.draw_rect(pos.x, pos.y, pos.x + sprite.get_width(), 
+                       pos.y + sprite.get_height(), Color(255,255,255,150));
+      }
+  }
        
-       void on_primary_button_click(int x, int y)
-       {
-               file_dialog->scroll(direction);
-       }
+  void on_primary_button_click(int x, int y)
+  {
+    file_dialog->scroll(direction);
+  }
 
-       void on_pointer_enter() { hover = true; }
-       void on_pointer_leave() { hover = false; }
+  void on_pointer_enter() { hover = true; }
+  void on_pointer_leave() { hover = false; }
 
-       bool is_at(int x, int y)
-       {
-               if (is_hidden)
-                       return false;
-               return (x > (int)pos.x && x < (int)pos.x + sprite.get_width()
-                       && y > (int)pos.y && y < (int)pos.y + 
sprite.get_height());
-       }
+  bool is_at(int x, int y)
+  {
+    if (is_hidden)
+      return false;
+    return (x > (int)pos.x && x < (int)pos.x + sprite.get_width()
+            && y > (int)pos.y && y < (int)pos.y + sprite.get_height());
+  }
 
-       void show() { is_hidden = false; }
-       void hide() { is_hidden = true; }
+  void show() { is_hidden = false; }
+  void hide() { is_hidden = true; }
 };
 
 class FileDialogParentFolderButton : public GUI::Component
 {
 private:
-       /** FileDialog box to this which button is assigned */
-       FileDialog* file_dialog;
+  /** FileDialog box to this which button is assigned */
+  FileDialog* file_dialog;
 
-       /** Where the image is located */
-       Vector3f pos;
+  /** Where the image is located */
+  Vector3f pos;
 
-       /** Image used for the parent folder button */
-       Sprite sprite;
+  /** Image used for the parent folder button */
+  Sprite sprite;
 
-       bool hover;
+  bool hover;
 
 public:
-       FileDialogParentFolderButton (FileDialog* f)
-               : file_dialog(f),
-    pos(Vector3f((float)Display::get_width()/2 + 230,
-               (float)Display::get_height()/2 - 210)),
-                 sprite(Resource::load_sprite("core/menu/parent_folder")),
-                       hover(false)
-       {
-       }
+  FileDialogParentFolderButton (FileDialog* f)
+    : file_dialog(f),
+      pos(Vector3f((float)Display::get_width()/2 + 230,
+                   (float)Display::get_height()/2 - 210)),
+      sprite(Resource::load_sprite("core/menu/parent_folder")),
+      hover(false)
+  {
+  }
 
-       void draw (DrawingContext& gc) {
-               gc.draw(sprite, pos);
-               if (hover)
-                       gc.draw_rect(pos.x, pos.y, pos.x + sprite.get_width(), 
-                               pos.y + sprite.get_height(), 
Color(255,255,255,150));
-       }
+  void draw (DrawingContext& gc) {
+    gc.draw(sprite, pos);
+    if (hover)
+      gc.draw_rect(pos.x, pos.y, pos.x + sprite.get_width(), 
+                   pos.y + sprite.get_height(), Color(255,255,255,150));
+  }
        
-       void on_primary_button_click(int x, int y)
-       {
-               FileItem f;
-               f.name = "..";
-               f.is_directory = true;
-               file_dialog->set_selected_file(f);
-       }
+  void on_primary_button_click(int x, int y)
+  {
+    FileItem f;
+    f.name = "..";
+    f.is_directory = true;
+    file_dialog->set_selected_file(f);
+  }
 
-       void on_pointer_enter() { hover = true; }
-       void on_pointer_leave() { hover = false; }
+  void on_pointer_enter() { hover = true; }
+  void on_pointer_leave() { hover = false; }
 
-       bool is_at(int x, int y)
-       {
-               return (x > (int)pos.x && x < (int)pos.x + sprite.get_width()
-                       && y > (int)pos.y && y < (int)pos.y + 
sprite.get_height());
-       }
+  bool is_at(int x, int y)
+  {
+    return (x > (int)pos.x && x < (int)pos.x + sprite.get_width()
+            && y > (int)pos.y && y < (int)pos.y + sprite.get_height());
+  }
 };
 
 FileDialog::FileDialog (FileDialogListener* listener_, 
-       const std::string filemask_, 
-       const std::string searchpath_, 
-       bool for_load)
-       : PingusSubMenu (PingusMenuManager::instance()),
-                                                               
listener(listener_),
-              for_loading(for_load),
-              file_mask(filemask_),
-              current_path(searchpath_)
+                        const std::string filemask_, 
+                        const std::string searchpath_, 
+                        bool for_load)
+  : PingusSubMenu (PingusMenuManager::instance()),
+    listener(listener_),
+    for_loading(for_load),
+    file_mask(filemask_),
+    current_path(searchpath_)
 {
-       // Initialize the buttons
-       ok_button = new FileDialogOkButton(this,
-               for_loading ? _("Load") : _("Save"));
+  // Initialize the buttons
+  ok_button = new FileDialogOkButton(this,
+                                     for_loading ? _("Load") : _("Save"));
 
-       up_button = new FileDialogScrollButton(this, DIR_UP, -150);
-       down_button = new FileDialogScrollButton(this, DIR_DOWN, 100);
+  up_button = new FileDialogScrollButton(this, DIR_UP, -150);
+  down_button = new FileDialogScrollButton(this, DIR_DOWN, 100);
 
-       gui_manager->add(ok_button, true);
-       gui_manager->add(up_button, true);
-       gui_manager->add(down_button, true);
-       gui_manager->add(new FileDialogCancelButton(this), true);
-       gui_manager->add(new FileDialogParentFolderButton(this), true);
+  gui_manager->add(ok_button, true);
+  gui_manager->add(up_button, true);
+  gui_manager->add(down_button, true);
+  gui_manager->add(new FileDialogCancelButton(this), true);
+  gui_manager->add(new FileDialogParentFolderButton(this), true);
 
-       // FIXME: Ugly - hardcoded values for items in file dialog.  Should be 
dynamic.
-       // Create 8 FileDialogItems and add them to the gui_manager.
-       float center_x = (float)Display::get_width()/2;
-       float center_y = (float)Display::get_height()/2;
+  // FIXME: Ugly - hardcoded values for items in file dialog.  Should be 
dynamic.
+  // Create 8 FileDialogItems and add them to the gui_manager.
+  float center_x = (float)Display::get_width()/2;
+  float center_y = (float)Display::get_height()/2;
 
-       inputbox = new GUI::InputBox(450, Vector3f(center_x - 225, 
-               center_y - 170), "", for_loading);
-       gui_manager->add((GUI::Component*)inputbox, true);
+  inputbox = new GUI::InputBox(450, Vector3f(center_x - 225, 
+                                             center_y - 170), "", for_loading);
+  gui_manager->add((GUI::Component*)inputbox, true);
 
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 280, center_y - 140)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 280, center_y - 70)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 280, center_y + 10)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 280, center_y + 80)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 10, center_y - 140)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 10, center_y - 70)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 10, center_y + 10)));
-       file_dialog_items.push_back(new FileDialogItem(this, 
-               Vector3f(center_x - 10, center_y + 80)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 280, 
center_y - 140)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 280, 
center_y - 70)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 280, 
center_y + 10)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 280, 
center_y + 80)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 10, 
center_y - 140)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 10, 
center_y - 70)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 10, 
center_y + 10)));
+  file_dialog_items.push_back(new FileDialogItem(this, 
+                                                 Vector3f(center_x - 10, 
center_y + 80)));
 
-       for (std::vector<FileDialogItem*>::const_iterator i = 
file_dialog_items.begin();
-               i != file_dialog_items.end(); i++)
-               gui_manager->add((GUI::Component*)(*i), true);
+  for (std::vector<FileDialogItem*>::const_iterator i = 
file_dialog_items.begin();
+       i != file_dialog_items.end(); i++)
+    gui_manager->add((GUI::Component*)(*i), true);
 
-       refresh();
+  refresh();
 }
 
 FileDialog::~FileDialog ()
@@ -309,166 +309,166 @@
 
 bool FileDialog::draw (DrawingContext& gc)
 {
-       gc.draw(sprite, Vector3f(gc.get_width ()/2 - sprite.get_width ()/2,
-               gc.get_height ()/2 - sprite.get_height ()/2));
-       gc.draw_rect(gc.get_width() / 2 - 285, gc.get_height() / 2 - 160,
-               gc.get_width() / 2 + 285, gc.get_height() / 2 + 160, 
Color(0,0,0));
-       gc.print_center(Fonts::chalk_large, gc.get_width()/2, gc.get_height()/2 
- 220, 
-               current_file.friendly_name == "" ? current_file.name : 
current_file.friendly_name);
+  gc.draw(sprite, Vector3f(gc.get_width ()/2 - sprite.get_width ()/2,
+                           gc.get_height ()/2 - sprite.get_height ()/2));
+  gc.draw_rect(gc.get_width() / 2 - 285, gc.get_height() / 2 - 160,
+               gc.get_width() / 2 + 285, gc.get_height() / 2 + 160, 
Color(0,0,0));
+  gc.print_center(Fonts::chalk_large, gc.get_width()/2, gc.get_height()/2 - 
220, 
+                  current_file.friendly_name == "" ? current_file.name : 
current_file.friendly_name);
 
-       PingusSubMenu::draw(gc);
-       return true;
+  PingusSubMenu::draw(gc);
+  return true;
 }
 
 void FileDialog::preload ()
 {
-       sprite = Resource::load_sprite("core/menu/filedialog");
+  sprite = Resource::load_sprite("core/menu/filedialog");
 }
 
 void FileDialog::refresh ()
 {
-       // Clear the current list of files
-       file_list.clear();
-       current_offset=0;
+  // Clear the current list of files
+  file_list.clear();
+  current_offset=0;
 
-       System::Directory d;
-       System::DirectoryIter diter;
-       FileItem f;
+  System::Directory d;
+  System::DirectoryIter diter;
+  FileItem f;
 
-       // Get the list of files and folders in the current folder
-       d = System::opendir(current_path, "*");
-       for (diter = d.begin(); diter != d.end(); ++diter)
-       {
-               if ((*diter).name != "." && (*diter).name != ".."
-                       && (*diter).name != ".svn" && (*diter).type == 
System::DirectoryEntry::DE_DIRECTORY)
-               {
-                       f.name = (*diter).name;
-                       f.is_directory = true;
-                       file_list.push_back(f);
-               }
-       }
+  // Get the list of files and folders in the current folder
+  d = System::opendir(current_path, "*");
+  for (diter = d.begin(); diter != d.end(); ++diter)
+    {
+      if ((*diter).name != "." && (*diter).name != ".."
+          && (*diter).name != ".svn" && (*diter).type == System::DE_DIRECTORY)
+        {
+          f.name = (*diter).name;
+          f.is_directory = true;
+          file_list.push_back(f);
+        }
+    }
 
-       d = System::opendir(current_path, "*" + file_mask);
-       for (diter = d.begin(); diter != d.end(); ++diter)
-       {
-               f.name = (*diter).name;
-               f.is_directory = false;
-               file_list.push_back(f);
-       }
+  d = System::opendir(current_path, "*" + file_mask);
+  for (diter = d.begin(); diter != d.end(); ++diter)
+    {
+      f.name = (*diter).name;
+      f.is_directory = false;
+      file_list.push_back(f);
+    }
 
-       std::sort(file_list.begin(), file_list.end(), &FileItemCompare);
+  std::sort(file_list.begin(), file_list.end(), &FileItemCompare);
 
-       current_offset = 0;
-       offset_changed();
+  current_offset = 0;
+  offset_changed();
 }
 
 // Whenever the list of showing files has changed.
 void FileDialog::offset_changed()
 {
-       unsigned j = current_offset;
+  unsigned j = current_offset;
 
-       for (std::vector<FileDialogItem*>::const_iterator i = 
file_dialog_items.begin();
-               i != file_dialog_items.end(); i++, j++)
-       {
-                if (j < (unsigned)file_list.size())
-                        (*i)->set_file(file_list[j]);
-                else
-                        (*i)->hide();
-       }
+  for (std::vector<FileDialogItem*>::const_iterator i = 
file_dialog_items.begin();
+       i != file_dialog_items.end(); i++, j++)
+    {
+      if (j < (unsigned)file_list.size())
+        (*i)->set_file(file_list[j]);
+      else
+        (*i)->hide();
+    }
 
-       // Show or hide scroll buttons
-       if (current_offset == 0)
-               up_button->hide();
-       else
-               up_button->show();
+  // Show or hide scroll buttons
+  if (current_offset == 0)
+    up_button->hide();
+  else
+    up_button->show();
 
-       if (current_offset + (unsigned)file_dialog_items.size() < 
(unsigned)file_list.size())
-               down_button->show();
-       else
-               down_button->hide();
+  if (current_offset + (unsigned)file_dialog_items.size() < 
(unsigned)file_list.size())
+    down_button->show();
+  else
+    down_button->hide();
 }
 
 // Scroll the list up or down.
 void FileDialog::scroll(int direction)
 {
-       if (direction == DIR_UP)
-       {
-               if (current_offset != 0)
-                       current_offset -= (unsigned)file_dialog_items.size();
-       }
-       else
-       {
-               if (current_offset + (unsigned)file_dialog_items.size() < 
(unsigned)file_list.size())
-                       current_offset += (unsigned)file_dialog_items.size();
-       }
-       offset_changed();
+  if (direction == DIR_UP)
+    {
+      if (current_offset != 0)
+        current_offset -= (unsigned)file_dialog_items.size();
+    }
+  else
+    {
+      if (current_offset + (unsigned)file_dialog_items.size() < 
(unsigned)file_list.size())
+        current_offset += (unsigned)file_dialog_items.size();
+    }
+  offset_changed();
 }
 
 // Set the file and show or hide the OK button.
 void FileDialog::set_selected_file(FileItem f)
 { 
-       current_file = f;
-       if (current_file.name != "")
-               ok_button->show();
-       else
-               ok_button->hide();
+  current_file = f;
+  if (current_file.name != "")
+    ok_button->show();
+  else
+    ok_button->hide();
        
-       inputbox->set_string(current_file.name.substr(0, 
-               current_file.name.length()-file_mask.length()));
+  inputbox->set_string(current_file.name.substr(0, 
+                                                
current_file.name.length()-file_mask.length()));
        
-       if (current_file.is_directory)
-               ok_pressed();
+  if (current_file.is_directory)
+    ok_pressed();
 }
 
 void FileDialog::ok_pressed()
 {
-       // If it's a directory, change to it.
-       if (current_file.is_directory)
-       {
-               if (current_file.name != "..")
-               {
-                       current_path += current_file.name + "/";
-               }
-               else
-               {
-                       size_t index = current_path.size() > 1 ? 
current_path.size() - 2 : std::string::npos;
-                       size_t pos = current_path.find_last_of('/', index);
-                       if (pos != std::string::npos)
-                               current_path = current_path.substr(0, pos + 1);
-                       else
-                               current_path.clear();
-               }
-               refresh();
-               ok_button->hide();
-       }
-       else
-       {
-               if (for_loading)
-                       listener->load(current_path + current_file.name, 
file_mask);
-               else
-                       listener->save(current_path + current_file.name, 
file_mask);
-       }
+  // If it's a directory, change to it.
+  if (current_file.is_directory)
+    {
+      if (current_file.name != "..")
+        {
+          current_path += current_file.name + "/";
+        }
+      else
+        {
+          size_t index = current_path.size() > 1 ? current_path.size() - 2 : 
std::string::npos;
+          size_t pos = current_path.find_last_of('/', index);
+          if (pos != std::string::npos)
+            current_path = current_path.substr(0, pos + 1);
+          else
+            current_path.clear();
+        }
+      refresh();
+      ok_button->hide();
+    }
+  else
+    {
+      if (for_loading)
+        listener->load(current_path + current_file.name, file_mask);
+      else
+        listener->save(current_path + current_file.name, file_mask);
+    }
 }
 
 void FileDialog::cancel_pressed()
 {
-       listener->cancel();
+  listener->cancel();
 }
 
 void FileDialog::update(const GameDelta &delta)
 {
-       PingusSubMenu::update(delta);
+  PingusSubMenu::update(delta);
        
-       // FIXME: Ugly busy polling
-       if (!for_loading)
-               if (inputbox->get_string() != current_file.name)
-               {
-                       FileItem f;
-                       f.friendly_name = inputbox->get_string();
-                       f.name = f.friendly_name + file_mask;
-                       f.is_directory = false;
-                       set_selected_file(f);
-               }
+  // FIXME: Ugly busy polling
+  if (!for_loading)
+    if (inputbox->get_string() != current_file.name)
+      {
+        FileItem f;
+        f.friendly_name = inputbox->get_string();
+        f.name = f.friendly_name + file_mask;
+        f.is_directory = false;
+        set_selected_file(f);
+      }
 }
 
 

Modified: trunk/pingus/src/gui/rect_component.hpp
===================================================================
--- trunk/pingus/src/gui/rect_component.hpp     2007-09-07 14:58:50 UTC (rev 
3105)
+++ trunk/pingus/src/gui/rect_component.hpp     2007-09-07 16:59:48 UTC (rev 
3106)
@@ -20,6 +20,7 @@
 #ifndef HEADER_PINGUS_GUI_RECT_COMPONENT_HPP
 #define HEADER_PINGUS_GUI_RECT_COMPONENT_HPP
 
+#include "math/rect.hpp"
 #include "component.hpp"
 
 namespace GUI {
@@ -36,14 +37,13 @@
   {}
   
   virtual bool is_at (int x, int y) { return rect.is_inside(Vector2i(x, y)); }
+  virtual void update_layout() =0;
   
   void set_rect(const Rect& rect_) 
   {
     rect = rect_;
-    layout();
+    update_layout();
   }
-
-  virtual void update_layout() =0;
 };
 
 } // namespace GUI

Modified: trunk/pingus/src/system.cpp
===================================================================
--- trunk/pingus/src/system.cpp 2007-09-07 14:58:50 UTC (rev 3105)
+++ trunk/pingus/src/system.cpp 2007-09-07 16:59:48 UTC (rev 3106)
@@ -63,7 +63,7 @@
 System::Directory
 System::opendir(const std::string& pathname, const std::string& pattern)
 {
-  std::list<System::DirectoryEntry> dir_list;
+  Directory dir_list;
 
 #ifndef WIN32
   DIR* dp;
@@ -86,11 +86,11 @@
 
              if (S_ISDIR(buf.st_mode))
                {
-                 dir_list.push_back(DirectoryEntry(de->d_name, 
DirectoryEntry::DE_DIRECTORY));
+                 dir_list.push_back(DirectoryEntry(de->d_name, DE_DIRECTORY));
                }
              else
                {
-                 dir_list.push_back(DirectoryEntry(de->d_name, 
DirectoryEntry::DE_FILE));
+                 dir_list.push_back(DirectoryEntry(de->d_name, DE_FILE));
                }
            }
        }

Modified: trunk/pingus/src/system.hpp
===================================================================
--- trunk/pingus/src/system.hpp 2007-09-07 14:58:50 UTC (rev 3105)
+++ trunk/pingus/src/system.hpp 2007-09-07 16:59:48 UTC (rev 3106)
@@ -23,7 +23,7 @@
 
 #include "pingus.hpp"
 #include <string>
-#include <list>
+#include <vector>
 #include <map>
 #include "SDL.h"
 
@@ -37,17 +37,19 @@
   static std::string default_email;
   static std::string default_username;
 public:
+  enum FileType { DE_DIRECTORY, DE_FILE };
+
   struct DirectoryEntry
   {
-    enum FileType { DE_DIRECTORY, DE_FILE } type;
+    FileType type;
     std::string name;
 
     DirectoryEntry(const std::string&, FileType t = DE_FILE);
   };
 
   ///
-  typedef std::list<DirectoryEntry> Directory;
-  typedef std::list<DirectoryEntry>::iterator DirectoryIter;
+  typedef std::vector<DirectoryEntry> Directory;
+  typedef Directory::iterator DirectoryIter;
 
   ///
   static Directory opendir(const std::string& pathname, const std::string& 
pattern = "*");





reply via email to

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