pingus-cvs
[Top][All Lists]
Advanced

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

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


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3707 - in trunk/pingus/src: . editor gui
Date: Mon, 7 Jul 2008 09:21:22 +0200

Author: grumbel
Date: 2008-07-07 09:21:21 +0200 (Mon, 07 Jul 2008)
New Revision: 3707

Modified:
   trunk/pingus/src/editor/file_dialog.cpp
   trunk/pingus/src/editor/file_dialog.hpp
   trunk/pingus/src/gui/group_component.cpp
   trunk/pingus/src/pingus_menu.cpp
Log:
Changed all calls to GroupComponent::add(*, bool) to GroupComponent::add(*, 
true)

Modified: trunk/pingus/src/editor/file_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_dialog.cpp     2008-07-07 07:18:42 UTC (rev 
3706)
+++ trunk/pingus/src/editor/file_dialog.cpp     2008-07-07 07:21:21 UTC (rev 
3707)
@@ -34,14 +34,15 @@
 FileDialog::FileDialog(EditorScreen* editor_, const Rect& rect, Mode mode_)
   : GroupComponent(rect),
     editor(editor_),
-    mode(mode_),
-    file_list(Rect(4, 30 + 30 + 30,
-                   rect.get_width()-4 - 30, rect.get_height() - 4 - 35))
+    mode(mode_)
 {
-  add(&file_list, false);
-  file_list.on_click.connect(boost::bind(&FileDialog::load_file, this, _1));
+  file_list = new FileList(Rect(4, 30 + 30 + 30,
+                                rect.get_width()-4 - 30, rect.get_height() - 4 
- 35));
+  add(file_list, true);
 
-  Rect file_rect = file_list.get_rect();
+  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|");
@@ -118,7 +119,7 @@
 FileDialog::set_directory(const std::string& pathname_)
 {
   std::string pathname = System::realpath(pathname_);
-  file_list.set_directory(pathname);
+  file_list->set_directory(pathname);
   update_button_state();
 
   filename_inputbox->set_text("");
@@ -157,14 +158,14 @@
 void
 FileDialog::on_up()
 {
-  file_list.prev_page();
+  file_list->prev_page();
   update_button_state();
 }
 
 void
 FileDialog::on_down()
 {
-  file_list.next_page();
+  file_list->next_page();
   update_button_state();
 }
 
@@ -173,10 +174,10 @@
 {
   GUI::GroupComponent::update_layout();
 
-  file_list.set_rect(Rect(4, 30 + 30 + 30,
+  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();
+  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));
@@ -212,12 +213,12 @@
 void
 FileDialog::update_button_state()
 {
-  if (file_list.has_more_prev_pages())
+  if (file_list->has_more_prev_pages())
     up_button->enable();
   else
     up_button->disable();
 
-  if (file_list.has_more_next_pages())
+  if (file_list->has_more_next_pages())
     down_button->enable();
   else
     down_button->disable();

Modified: trunk/pingus/src/editor/file_dialog.hpp
===================================================================
--- trunk/pingus/src/editor/file_dialog.hpp     2008-07-07 07:18:42 UTC (rev 
3706)
+++ trunk/pingus/src/editor/file_dialog.hpp     2008-07-07 07:21:21 UTC (rev 
3707)
@@ -36,7 +36,7 @@
   EditorScreen* editor;
   Mode mode;
 
-  FileList file_list;
+  FileList* file_list;
   Button* up_button;
   Button* down_button;
   Button* open_button;

Modified: trunk/pingus/src/gui/group_component.cpp
===================================================================
--- trunk/pingus/src/gui/group_component.cpp    2008-07-07 07:18:42 UTC (rev 
3706)
+++ trunk/pingus/src/gui/group_component.cpp    2008-07-07 07:21:21 UTC (rev 
3707)
@@ -14,6 +14,7 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include <assert.h>
 #include <iostream>
 #include "group_component.hpp"
 
@@ -245,6 +246,8 @@
 void
 GroupComponent::add(Component* comp, bool delete_comp)
 {
+  assert(delete_comp == true);
+
   comp->set_parent(this);
   children.push_back(comp);
   if (delete_comp)

Modified: trunk/pingus/src/pingus_menu.cpp
===================================================================
--- trunk/pingus/src/pingus_menu.cpp    2008-07-07 07:18:42 UTC (rev 3706)
+++ trunk/pingus/src/pingus_menu.cpp    2008-07-07 07:21:21 UTC (rev 3707)
@@ -62,10 +62,10 @@
                                   _("Levelsets"),
                                   _("..:: Play User Built levels ::.."));
 
-  gui_manager->add(quit_button,    false);
-  gui_manager->add(contrib_button, false);
-  gui_manager->add(start_button,   false);
-  gui_manager->add(editor_button,  false);
+  gui_manager->add(quit_button,    true);
+  gui_manager->add(contrib_button, true);
+  gui_manager->add(start_button,   true);
+  gui_manager->add(editor_button,  true);
 
   logo = Sprite("core/misc/logo");
 
@@ -80,10 +80,6 @@
 
 PingusMenu::~PingusMenu()
 {
-  delete start_button;
-  delete quit_button;
-  delete editor_button;
-  delete contrib_button;
 }
 
 void





reply via email to

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