pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3167 - in trunk/pingus: . src src/components src/editor


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3167 - in trunk/pingus: . src src/components src/editor
Date: Mon, 17 Sep 2007 13:23:13 +0200

Author: grumbel
Date: 2007-09-17 13:23:11 +0200 (Mon, 17 Sep 2007)
New Revision: 3167

Added:
   trunk/pingus/src/editor/file_dialog.cpp
   trunk/pingus/src/editor/file_dialog.hpp
Removed:
   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
Modified:
   trunk/pingus/TODO
   trunk/pingus/src/SConscript
   trunk/pingus/src/components/menu_button.cpp
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/editor/editor_screen.hpp
   trunk/pingus/src/pingus_menu.cpp
   trunk/pingus/src/pingus_menu.hpp
Log:
- renamed FileLoadDialog to just FileDialog
- added documentation of fullscreen, screenshot, mousegrab keys to main menu

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-16 15:29:14 UTC (rev 3166)
+++ trunk/pingus/TODO   2007-09-17 11:23:11 UTC (rev 3167)
@@ -79,7 +79,8 @@
 Important:
 ==========
 
-- replace Windstille headers with Pingus header
+- rewrite Config file support, make game automatically write a default
+  config file, use s-expr
 
 - create verdana11 for latin2 and latin9
 
@@ -89,12 +90,8 @@
 
 - update ChangeLog
 
-- enable default fullscreen for release
-
 - add some SConscript checks (for compiler missing)
 
-- document the mouse-trap, fullscreen, etc. shortcuts somewhere
-
 - level converter has a bug that causes some object types to be
   ignored (startpos and likely the other more excotic worldobj things)
 
@@ -108,7 +105,9 @@
   Format: bpp: 32
 
 - bridging gets more complicated has graphical error (background?!)
-  surface background doesn't handle larger res due to the Playfield being 
offsetted
+  surface background doesn't handle larger res due to the Playfield
+  being offsetted (might be solveable with new DrawingContext that
+  features Rect)
 
 - Liquids/water is 32, others are 64, this is causing trouble with the
   collision map
@@ -116,6 +115,10 @@
 Less Important:
 ===============
 
+- rework command line parsing so that it actually works properly and
+  doesn't depend so much on the order (setting datadir causes trouble
+  with translation, since translation need datadir to work)
+
 - some people like auto-scrolling in window mode, in 0.6.0 it worked
   even when completly out of the window, in SDL the mouse coords don't
   get updated when the mouse isn't in the window (need to switch from
@@ -161,6 +164,8 @@
 Important:
 ==========
 
+- add object duplication
+
 - add color prop for surface-background
 
 - make GPType prop
@@ -181,15 +186,11 @@
   r       - rotate90
   shift+r - rotate270
 
-- implement a minimap (just rects when surfaces are to tricky)
-
 - implement proper tmpfile Support (save tmp levels to ~/.pingus/tmp/
   for backup purpose in case of editor crash or so)
 
 - make combo box open to the top or bottom depending on variable
 
-- could/should rotate around object center
-
 - fix align of exits
 
 - add options to show/hide hidden files and filter stuff
@@ -201,6 +202,10 @@
 Less Important:
 ===============
 
+- implement a minimap (just rects when surfaces are to tricky)
+
+- could/should rotate around object center
+
 - write a color select widget (Hue, Saturation.Value)
 
 - object raising doesn't work for group

Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-16 15:29:14 UTC (rev 3166)
+++ trunk/pingus/src/SConscript 2007-09-17 11:23:11 UTC (rev 3167)
@@ -97,8 +97,7 @@
 'editor/panel.cpp',
 'editor/label.cpp',
 'editor/file_list.cpp',
-'editor/file_load_dialog.cpp',
-'editor/file_save_dialog.cpp', 
+'editor/file_dialog.cpp',
 'editor/editor_screen.cpp',
 'editor/combobox.cpp', 
 'editor/editor_viewport.cpp', 

Modified: trunk/pingus/src/components/menu_button.cpp
===================================================================
--- trunk/pingus/src/components/menu_button.cpp 2007-09-16 15:29:14 UTC (rev 
3166)
+++ trunk/pingus/src/components/menu_button.cpp 2007-09-17 11:23:11 UTC (rev 
3167)
@@ -78,10 +78,6 @@
 {
   if (mouse_over && !pressed)
     {
-      gc.print_center(font, Display::get_width() / 2,
-                      Display::get_height() - font.get_height() - 2,
-                      desc.c_str());
-
       gc.draw(surface_p, Vector2i(x_pos - surface_p.get_width()/2,
                                   y_pos - surface_p.get_height()/2));
 
@@ -92,11 +88,6 @@
   else if (mouse_over && pressed)
     {
       float shrink = 0.9f;
-
-      gc.print_center(font, Display::get_width() / 2,
-                      Display::get_height() - 20,
-                      desc.c_str());
-
       gc.draw(surface_p,
               Vector3f(x_pos - surface_p.get_width()/2 * shrink,
                        y_pos - surface_p.get_height()/2 * shrink));
@@ -127,6 +118,7 @@
   mouse_over = true;
   Sound::PingusSound::play_sound ("tick");
   //std::cout << "X: " << this << "enter" << std::endl;
+  menu->set_hint(desc);
 }
 
 void
@@ -134,6 +126,7 @@
 {
   //std::cout << "X: " << this << "leave" << std::endl;
   mouse_over = false;
+  menu->set_hint("");
 }
 
 void

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-16 15:29:14 UTC (rev 
3166)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-17 11:23:11 UTC (rev 
3167)
@@ -30,7 +30,7 @@
 #include "../resource.hpp"
 #include "../fonts.hpp"
 #include "../file_dialog.hpp"
-#include "file_load_dialog.hpp"
+#include "file_dialog.hpp"
 #include "../path_manager.hpp"
 #include "../pathname.hpp"
 #include "game_session.hpp"
@@ -74,12 +74,12 @@
   object_properties = new ObjectProperties(this, 
Rect(Vector2i(0,Display::get_height()-150), Size(200, 150)));
   gui_manager->add(object_properties, true);
 
-  file_load_dialog = new FileLoadDialog(this, Rect(Vector2i(50, 50), 
-                                                   Size(Display::get_width() - 
100, 
-                                                        Display::get_height() 
- 100)));
-  file_load_dialog->set_directory(".");
-  file_load_dialog->hide();
-  gui_manager->add(file_load_dialog, true);
+  file_dialog = new FileDialog(this, Rect(Vector2i(50, 50), 
+                                          Size(Display::get_width() - 100, 
+                                               Display::get_height() - 100)));
+  file_dialog->set_directory(".");
+  file_dialog->hide();
+  gui_manager->add(file_dialog, true);
 
   
viewport->selection_changed.connect(boost::bind(&ObjectProperties::set_objects, 
object_properties, _1));
 
@@ -225,13 +225,13 @@
 void 
 EditorScreen::level_load()
 {
-  if (file_load_dialog->is_visible())
-    file_load_dialog->hide();
+  if (file_dialog->is_visible())
+    file_dialog->hide();
   else 
     {
-      //file_load_dialog->set_rect(Rect(Vector2i(rand() % 200, rand() % 200),
+      //file_dialog->set_rect(Rect(Vector2i(rand() % 200, rand() % 200),
       //                                Size(rand()%600+200, rand()%600+300)));
-      file_load_dialog->show();
+      file_dialog->show();
     }
 }
 

Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp   2007-09-16 15:29:14 UTC (rev 
3166)
+++ trunk/pingus/src/editor/editor_screen.hpp   2007-09-17 11:23:11 UTC (rev 
3167)
@@ -53,7 +53,7 @@
   ObjectProperties* object_properties;
   ActionProperties* action_properties;
   LevelProperties*  level_properties;
-  FileLoadDialog*   file_load_dialog;
+  FileDialog*   file_dialog;
   
   bool show_help;
 

Copied: trunk/pingus/src/editor/file_dialog.cpp (from rev 3166, 
trunk/pingus/src/editor/file_load_dialog.cpp)
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.cpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_dialog.cpp     2007-09-17 11:23:11 UTC (rev 
3167)
@@ -0,0 +1,201 @@
+//  $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 <boost/bind.hpp>
+#include "display/drawing_context.hpp"
+#include "gui/gui_manager.hpp"
+#include "editor_screen.hpp"
+#include "gui_style.hpp"
+#include "fonts.hpp"
+#include "pathname.hpp"
+#include "button.hpp"
+#include "file_load_dialog.hpp"
+
+namespace Editor {
+
+FileDialog::FileDialog(EditorScreen* editor_, const Rect& rect)
+  : GroupComponent(rect),
+    editor(editor_),
+    file_list(Rect(4, 30 + 30 + 30,
+                   rect.get_width()-4 - 30, rect.get_height() - 4 - 35))
+{
+  add(&file_list, false);
+  file_list.on_click.connect(boost::bind(&FileDialog::load_file, this, _1));
+
+  Rect file_rect = file_list.get_rect();
+  up_button = new Button(Rect(file_rect.right + 2, file_rect.top,
+                                     rect.get_width()-4, file_rect.top + 
file_rect.get_height()/2 - 1),
+                                "/\\\n|");
+  down_button = new Button(Rect(file_rect.right + 2, file_rect.top + 
file_rect.get_height()/2 + 1,
+                                rect.get_width()-4, file_rect.bottom),
+                           "|\n\\/");
+
+  // FIXME: This could be turned into system specific hotkeys (C:, D:,
+  // etc. on windows, Home, '/', Datadir on Linux)
+  home_button = new Button(Rect(Vector2i(4, rect.get_height() - 4 - 30),
+                                        Size(100, 30)), "Home");
+  
+  open_button = new Button(Rect(Vector2i(rect.get_width() - 104, 
rect.get_height() - 4 - 30),
+                                        Size(100, 30)), "Open");
+  
+  cancel_button = new Button(Rect(Vector2i(rect.get_width() - 104 - 104, 
rect.get_height() - 4 - 30),
+                                  Size(100, 30)), "Cancel");
+  
+  up_button->on_click.connect(boost::bind(&FileDialog::on_up, this));
+  down_button->on_click.connect(boost::bind(&FileDialog::on_down, this));
+  home_button->on_click.connect(boost::bind(&FileDialog::on_home, this));
+  open_button->on_click.connect(boost::bind(&FileDialog::on_open, this));
+  cancel_button->on_click.connect(boost::bind(&FileDialog::on_cancel, this));
+  
+  add(up_button, true);
+  add(down_button, true);
+
+  add(home_button, true);
+
+  add(open_button, true);
+  add(cancel_button, true);
+}
+
+FileDialog::~FileDialog()
+{
+}
+
+void
+FileDialog::draw_background(DrawingContext& gc)
+{
+  GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height()));
+  gc.draw_fillrect(4,4,rect.get_width()-4, 30, Color(77,130,180));
+  gc.print_center(Fonts::pingus_small, rect.get_width()/2, 2, "Open a level");
+
+  GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+30,rect.get_width()-4, 26+30),
+                             Color(255,255,255));
+
+  gc.print_left(Fonts::verdana11, 10, 8+30, "File: ");
+  gc.print_left(Fonts::verdana11, 10 + 60, 8+30, filename);
+
+  GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+60,rect.get_width()-4, 26+60),
+                             Color(255,255,255));
+  gc.print_left(Fonts::verdana11, 10, 8+60, "Path: ");
+  gc.print_left(Fonts::verdana11, 10 + 60, 8+60, pathname);
+}
+  
+void
+FileDialog::load_file(const System::DirectoryEntry& entry)
+{
+  if (entry.type == System::DE_DIRECTORY)
+    {
+      //std::cout << "Directory: " << entry.name << std::endl;
+      set_directory(pathname + "/" + entry.name);
+    }
+  else
+    {
+      //std::cout << pathname + "/" + entry.name << std::endl;
+      filename = entry.name;
+    }
+}
+
+void
+FileDialog::set_directory(const std::string& pathname_)
+{
+  filename = "";
+  pathname = System::realpath(pathname_);
+  file_list.set_directory(pathname);
+  update_button_state();
+}
+
+void
+FileDialog::on_cancel()
+{
+  std::cout << "Cancel" << std::endl;
+  hide();
+}
+
+void
+FileDialog::on_open()
+{
+  if (!filename.empty())
+    {
+      Pathname file(pathname + "/" + filename, Pathname::SYSTEM_PATH);
+      std::cout << "Open: " << file << std::endl;
+      editor->load(file);
+      hide();
+    }
+}
+
+void
+FileDialog::on_up()
+{
+  file_list.prev_page();
+  update_button_state();
+}
+
+void
+FileDialog::on_down()
+{
+  file_list.next_page();
+  update_button_state();
+}
+
+void
+FileDialog::update_layout()
+{
+  GUI::GroupComponent::update_layout();
+
+  file_list.set_rect(Rect(4, 30 + 30 + 30,
+                          rect.get_width()-4 - 30, rect.get_height() - 4 - 
35));
+  
+  Rect file_rect = file_list.get_rect();
+
+  up_button->set_rect(Rect(file_rect.right + 2, file_rect.top,
+                          rect.get_width()-4, file_rect.top + 
file_rect.get_height()/2 - 1));
+                     
+  down_button->set_rect(Rect(file_rect.right + 2, file_rect.top + 
file_rect.get_height()/2 + 1,
+                             rect.get_width()-4, file_rect.bottom));
+  
+  open_button->set_rect(Rect(Vector2i(rect.get_width() - 104, 
rect.get_height() - 4 - 30),
+                             Size(100, 30)));
+  
+  cancel_button->set_rect(Rect(Vector2i(rect.get_width() - 104 - 104, 
rect.get_height() - 4 - 30),
+                               Size(100, 30)));
+}
+
+void
+FileDialog::on_home()
+{
+  
+}
+
+void
+FileDialog::update_button_state()
+{
+  if (file_list.has_more_prev_pages())
+    up_button->enable();
+  else
+    up_button->disable();
+
+  if (file_list.has_more_next_pages())
+    down_button->enable();
+  else
+    down_button->disable();
+}
+  
+} // namespace Editor
+
+/* EOF */

Copied: trunk/pingus/src/editor/file_dialog.hpp (from rev 3166, 
trunk/pingus/src/editor/file_load_dialog.hpp)
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.hpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_dialog.hpp     2007-09-17 11:23:11 UTC (rev 
3167)
@@ -0,0 +1,76 @@
+//  $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_LOAD_DIALOG_HPP
+#define HEADER_FILE_LOAD_DIALOG_HPP
+
+#include "file_list.hpp"
+#include "gui/group_component.hpp"
+
+namespace Editor {
+
+class Button;
+class EditorScreen;
+
+/** */
+class FileDialog : public GUI::GroupComponent
+{
+private:
+  EditorScreen* editor;
+  FileList file_list;
+  Button* up_button;
+  Button* down_button;
+  Button* open_button;
+  Button* cancel_button;
+
+  Button* home_button;
+
+  std::string pathname;
+  std::string filename;
+
+public:
+  FileDialog(EditorScreen* editor, const Rect& rect);
+  ~FileDialog();
+  
+  void draw_background(DrawingContext& gc);
+  void update_layout();
+
+  void load_file(const System::DirectoryEntry& entry);
+  void set_directory(const std::string& pathname);
+
+  void on_cancel();
+  void on_open();
+
+  void on_up();
+  void on_down();
+  
+  void on_home();
+
+private:
+  void update_button_state();
+
+  FileDialog (const FileDialog&);
+  FileDialog& operator= (const FileDialog&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */

Deleted: trunk/pingus/src/editor/file_load_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.cpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_load_dialog.cpp        2007-09-17 11:23:11 UTC 
(rev 3167)
@@ -1,201 +0,0 @@
-//  $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 <boost/bind.hpp>
-#include "display/drawing_context.hpp"
-#include "gui/gui_manager.hpp"
-#include "editor_screen.hpp"
-#include "gui_style.hpp"
-#include "fonts.hpp"
-#include "pathname.hpp"
-#include "button.hpp"
-#include "file_load_dialog.hpp"
-
-namespace Editor {
-
-FileLoadDialog::FileLoadDialog(EditorScreen* editor_, const Rect& rect)
-  : GroupComponent(rect),
-    editor(editor_),
-    file_list(Rect(4, 30 + 30 + 30,
-                   rect.get_width()-4 - 30, rect.get_height() - 4 - 35))
-{
-  add(&file_list, false);
-  file_list.on_click.connect(boost::bind(&FileLoadDialog::load_file, this, 
_1));
-
-  Rect file_rect = file_list.get_rect();
-  up_button = new Button(Rect(file_rect.right + 2, file_rect.top,
-                                     rect.get_width()-4, file_rect.top + 
file_rect.get_height()/2 - 1),
-                                "/\\\n|");
-  down_button = new Button(Rect(file_rect.right + 2, file_rect.top + 
file_rect.get_height()/2 + 1,
-                                rect.get_width()-4, file_rect.bottom),
-                           "|\n\\/");
-
-  // FIXME: This could be turned into system specific hotkeys (C:, D:,
-  // etc. on windows, Home, '/', Datadir on Linux)
-  home_button = new Button(Rect(Vector2i(4, rect.get_height() - 4 - 30),
-                                        Size(100, 30)), "Home");
-  
-  open_button = new Button(Rect(Vector2i(rect.get_width() - 104, 
rect.get_height() - 4 - 30),
-                                        Size(100, 30)), "Open");
-  
-  cancel_button = new Button(Rect(Vector2i(rect.get_width() - 104 - 104, 
rect.get_height() - 4 - 30),
-                                  Size(100, 30)), "Cancel");
-  
-  up_button->on_click.connect(boost::bind(&FileLoadDialog::on_up, this));
-  down_button->on_click.connect(boost::bind(&FileLoadDialog::on_down, this));
-  home_button->on_click.connect(boost::bind(&FileLoadDialog::on_home, this));
-  open_button->on_click.connect(boost::bind(&FileLoadDialog::on_open, this));
-  cancel_button->on_click.connect(boost::bind(&FileLoadDialog::on_cancel, 
this));
-  
-  add(up_button, true);
-  add(down_button, true);
-
-  add(home_button, true);
-
-  add(open_button, true);
-  add(cancel_button, true);
-}
-
-FileLoadDialog::~FileLoadDialog()
-{
-}
-
-void
-FileLoadDialog::draw_background(DrawingContext& gc)
-{
-  GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height()));
-  gc.draw_fillrect(4,4,rect.get_width()-4, 30, Color(77,130,180));
-  gc.print_center(Fonts::pingus_small, rect.get_width()/2, 2, "Open a level");
-
-  GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+30,rect.get_width()-4, 26+30),
-                             Color(255,255,255));
-
-  gc.print_left(Fonts::verdana11, 10, 8+30, "File: ");
-  gc.print_left(Fonts::verdana11, 10 + 60, 8+30, filename);
-
-  GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+60,rect.get_width()-4, 26+60),
-                             Color(255,255,255));
-  gc.print_left(Fonts::verdana11, 10, 8+60, "Path: ");
-  gc.print_left(Fonts::verdana11, 10 + 60, 8+60, pathname);
-}
-  
-void
-FileLoadDialog::load_file(const System::DirectoryEntry& entry)
-{
-  if (entry.type == System::DE_DIRECTORY)
-    {
-      //std::cout << "Directory: " << entry.name << std::endl;
-      set_directory(pathname + "/" + entry.name);
-    }
-  else
-    {
-      //std::cout << pathname + "/" + entry.name << std::endl;
-      filename = entry.name;
-    }
-}
-
-void
-FileLoadDialog::set_directory(const std::string& pathname_)
-{
-  filename = "";
-  pathname = System::realpath(pathname_);
-  file_list.set_directory(pathname);
-  update_button_state();
-}
-
-void
-FileLoadDialog::on_cancel()
-{
-  std::cout << "Cancel" << std::endl;
-  hide();
-}
-
-void
-FileLoadDialog::on_open()
-{
-  if (!filename.empty())
-    {
-      Pathname file(pathname + "/" + filename, Pathname::SYSTEM_PATH);
-      std::cout << "Open: " << file << std::endl;
-      editor->load(file);
-      hide();
-    }
-}
-
-void
-FileLoadDialog::on_up()
-{
-  file_list.prev_page();
-  update_button_state();
-}
-
-void
-FileLoadDialog::on_down()
-{
-  file_list.next_page();
-  update_button_state();
-}
-
-void
-FileLoadDialog::update_layout()
-{
-  GUI::GroupComponent::update_layout();
-
-  file_list.set_rect(Rect(4, 30 + 30 + 30,
-                          rect.get_width()-4 - 30, rect.get_height() - 4 - 
35));
-  
-  Rect file_rect = file_list.get_rect();
-
-  up_button->set_rect(Rect(file_rect.right + 2, file_rect.top,
-                          rect.get_width()-4, file_rect.top + 
file_rect.get_height()/2 - 1));
-                     
-  down_button->set_rect(Rect(file_rect.right + 2, file_rect.top + 
file_rect.get_height()/2 + 1,
-                             rect.get_width()-4, file_rect.bottom));
-  
-  open_button->set_rect(Rect(Vector2i(rect.get_width() - 104, 
rect.get_height() - 4 - 30),
-                             Size(100, 30)));
-  
-  cancel_button->set_rect(Rect(Vector2i(rect.get_width() - 104 - 104, 
rect.get_height() - 4 - 30),
-                               Size(100, 30)));
-}
-
-void
-FileLoadDialog::on_home()
-{
-  
-}
-
-void
-FileLoadDialog::update_button_state()
-{
-  if (file_list.has_more_prev_pages())
-    up_button->enable();
-  else
-    up_button->disable();
-
-  if (file_list.has_more_next_pages())
-    down_button->enable();
-  else
-    down_button->disable();
-}
-  
-} // namespace Editor
-
-/* EOF */

Deleted: trunk/pingus/src/editor/file_load_dialog.hpp
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.hpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_load_dialog.hpp        2007-09-17 11:23:11 UTC 
(rev 3167)
@@ -1,76 +0,0 @@
-//  $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_LOAD_DIALOG_HPP
-#define HEADER_FILE_LOAD_DIALOG_HPP
-
-#include "file_list.hpp"
-#include "gui/group_component.hpp"
-
-namespace Editor {
-
-class Button;
-class EditorScreen;
-
-/** */
-class FileLoadDialog : public GUI::GroupComponent
-{
-private:
-  EditorScreen* editor;
-  FileList file_list;
-  Button* up_button;
-  Button* down_button;
-  Button* open_button;
-  Button* cancel_button;
-
-  Button* home_button;
-
-  std::string pathname;
-  std::string filename;
-
-public:
-  FileLoadDialog(EditorScreen* editor, const Rect& rect);
-  ~FileLoadDialog();
-  
-  void draw_background(DrawingContext& gc);
-  void update_layout();
-
-  void load_file(const System::DirectoryEntry& entry);
-  void set_directory(const std::string& pathname);
-
-  void on_cancel();
-  void on_open();
-
-  void on_up();
-  void on_down();
-  
-  void on_home();
-
-private:
-  void update_button_state();
-
-  FileLoadDialog (const FileLoadDialog&);
-  FileLoadDialog& operator= (const FileLoadDialog&);
-};
-
-} // namespace Editor
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/editor/file_save_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_save_dialog.cpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_save_dialog.cpp        2007-09-17 11:23:11 UTC 
(rev 3167)
@@ -1,24 +0,0 @@
-//  $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 "file_save_dialog.hpp"
-
-
-
-/* EOF */

Deleted: trunk/pingus/src/editor/file_save_dialog.hpp
===================================================================
--- trunk/pingus/src/editor/file_save_dialog.hpp        2007-09-16 15:29:14 UTC 
(rev 3166)
+++ trunk/pingus/src/editor/file_save_dialog.hpp        2007-09-17 11:23:11 UTC 
(rev 3167)
@@ -1,36 +0,0 @@
-//  $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_SAVE_DIALOG_HPP
-#define HEADER_FILE_SAVE_DIALOG_HPP
-
-/** */
-class FileSaveDialog
-{
-private:
-public:
-
-private:
-  FileSaveDialog (const FileSaveDialog&);
-  FileSaveDialog& operator= (const FileSaveDialog&);
-};
-
-#endif
-
-/* EOF */

Modified: trunk/pingus/src/pingus_menu.cpp
===================================================================
--- trunk/pingus/src/pingus_menu.cpp    2007-09-16 15:29:14 UTC (rev 3166)
+++ trunk/pingus/src/pingus_menu.cpp    2007-09-17 11:23:11 UTC (rev 3167)
@@ -41,8 +41,7 @@
 
 
 PingusMenu::PingusMenu (PingusMenuManager* m)
-  : PingusSubMenu (m),
-    filedialog(0)
+  : PingusSubMenu (m)
 {
   is_init = false;
     
@@ -82,6 +81,8 @@
                                       _("Multiplayer"),
                                       _("..:: Multiplayer Match ::.."));
 #endif
+
+  help = _("..:: Ctrl-g: mouse grab   ::   F10: fps counter   ::   F11: 
fullscreen   ::   F12: screenshot ::..");
 }
 
 void
@@ -124,21 +125,25 @@
 void
 PingusMenu::setup_contrib_menu()
 {
+#if 0
   if (filedialog)
     delete filedialog;
   filedialog = new FileDialog(this, ".pingus", 
                               path_manager.complete("levels/"), true);
   manager->push_menu (filedialog);
+#endif
 }
 
 void
 PingusMenu::setup_worldmap_menu()
 {
+#if 0
   if (filedialog)
     delete filedialog;
   filedialog = new FileDialog(this, ".worldmap", 
                               path_manager.complete("worldmaps/"), true);
   manager->push_menu (filedialog);
+#endif 
 }
 
 void
@@ -163,7 +168,6 @@
   delete story_button;
   delete multiplayer_button;
 #endif
-  delete filedialog;
 }
 
 void
@@ -244,6 +248,19 @@
                 Display::get_height()-80,
                 "Pingus comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are\n"
                 "welcome to redistribute it under certain conditions; see the 
file COPYING for details.\n");
+
+  if (hint.empty())
+    {
+      gc.print_center(Fonts::pingus_small, Display::get_width() / 2,
+                      Display::get_height() - Fonts::pingus_small.get_height(),
+                      help);
+    }
+  else
+    {
+      gc.print_center(Fonts::pingus_small, Display::get_width() / 2,
+                      Display::get_height() - Fonts::pingus_small.get_height(),
+                      hint);
+    }
 }
 
 void
@@ -299,4 +316,16 @@
 #endif
 }
 
+void
+PingusMenu::set_hint(const std::string& str)
+{
+  hint = str;
+}
+
+void
+PingusMenu::update(float delta)
+{
+  //text_scroll_offset += 100.0f * delta;
+}
+
 /* EOF */

Modified: trunk/pingus/src/pingus_menu.hpp
===================================================================
--- trunk/pingus/src/pingus_menu.hpp    2007-09-16 15:29:14 UTC (rev 3166)
+++ trunk/pingus/src/pingus_menu.hpp    2007-09-17 11:23:11 UTC (rev 3167)
@@ -23,12 +23,10 @@
 #include <vector>
 #include "fonts.hpp"
 #include "pingus_sub_menu.hpp"
-#include "file_dialog_listener.hpp"
 #include "layer_manager.hpp"
 
 class SurfaceButton;
 class GameDelta;
-class FileDialog;
 
 namespace GUI {
 class GUIManager;
@@ -36,10 +34,13 @@
 
 class MenuButton;
 
-class PingusMenu : public PingusSubMenu, public FileDialogListener
+class PingusMenu : public PingusSubMenu
 {
 public:
   bool is_init;
+  std::string hint;
+  std::string help;
+  float text_scroll_offset;
 private:
   Sprite background;
   LayerManager layer_manager;
@@ -53,7 +54,6 @@
   MenuButton* story_button;
   MenuButton* multiplayer_button;
 #endif
-  FileDialog* filedialog;
   
   void on_resize (int w, int h);
 
@@ -86,6 +86,7 @@
   ~PingusMenu();
 
   void on_click(MenuButton* button);
+  void set_hint(const std::string& str);
 
   /// Load all images and other stuff for the menu
   void preload ();
@@ -93,6 +94,8 @@
 
   void on_escape_press ();
   void draw_foreground(DrawingContext& gc);
+
+  void update(float delta);
 private:
   PingusMenu (const PingusMenu&);
   PingusMenu& operator= (const PingusMenu&);





reply via email to

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