[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3706 - trunk/pingus/src/editor
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3706 - trunk/pingus/src/editor |
Date: |
Mon, 7 Jul 2008 09:18:43 +0200 |
Author: grumbel
Date: 2008-07-07 09:18:42 +0200 (Mon, 07 Jul 2008)
New Revision: 3706
Removed:
trunk/pingus/src/editor/editor_panel.cpp
trunk/pingus/src/editor/editor_panel.hpp
trunk/pingus/src/editor/level_head.cpp
trunk/pingus/src/editor/level_head.hpp
trunk/pingus/src/editor/panel_buttons.cpp
trunk/pingus/src/editor/panel_buttons.hpp
Log:
Removed obsolete files
Deleted: trunk/pingus/src/editor/editor_panel.cpp
===================================================================
--- trunk/pingus/src/editor/editor_panel.cpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/editor_panel.cpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,171 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <vector>
-#include "../resource.hpp"
-#include "../display/display.hpp"
-#include "../math/vector3f.hpp"
-#include "../display/drawing_context.hpp"
-#include "../gui/gui_manager.hpp"
-#include "../gui/checkbox.hpp"
-#include "../gui/combobox.hpp"
-#include "../fonts.hpp"
-#include "editor_panel.hpp"
-#include "editor_screen.hpp"
-#include "viewport.hpp"
-#include "panel_buttons.hpp"
-
-
-class GUI::Component;
-
-namespace Editor {
-
-// Constructor
-EditorPanel::EditorPanel(EditorScreen* es)
- : editor(es),
- pressed_button(0),
- combobox_1(0),
- combobox_2(0),
- snap_to_checkbox(0)
-{
-
-}
-
-// Destructor
-EditorPanel::~EditorPanel()
-{
-}
-
-// Wait to run this until after the panel has been added to the gui_manager
-// This sets up the buttons, text fields, etc. for this panel
-// No need to delete the buttons because the gui_manager will do it for us.
-void
-EditorPanel::init()
-{
- // Create panel buttons
- add((PanelButton*)(new PanelButtonExit(this)));
- add((PanelButton*)(new PanelButtonLoad(this)));
- add((PanelButton*)(new PanelButtonSave(this)));
- add((PanelButton*)(new PanelButtonGroundpiece(this)));
- add((PanelButton*)(new PanelButtonHead(this)));
- // Create Checkboxes
- snap_to_checkbox = new GUI::Checkbox(Vector3f(370, 5), "Snap To Grid: ",
this);
- get_screen()->get_gui_manager()->add(snap_to_checkbox, true);
-
- // Create Comboboxes
- combobox_3 = new GUI::Combobox(Vector3f(500, 36), this);
- combobox_2 = new GUI::Combobox(Vector3f(500, 18), this);
- combobox_1 = new GUI::Combobox(Vector3f(500, 0), this);
- get_screen()->get_gui_manager()->add(combobox_3, true);
- get_screen()->get_gui_manager()->add(combobox_2, true);
- get_screen()->get_gui_manager()->add(combobox_1, true);
- combobox_3->set_enabled(false);
- combobox_2->set_enabled(false);
- combobox_1->set_enabled(false);
-}
-
-// Draw the panel
-void
-EditorPanel::draw (DrawingContext& gc)
-{
- // Draw the panel
- gc.draw_fillrect(0, 0, (float)Display::get_width(),
- 50.0f, Color(80,80,80), -50);
-}
-
-// Add the button to the vector, set it's position, and add to the gui_manager
-void
-EditorPanel::add(PanelButton* button)
-{
- // Determind where to place this buttons
- Vector3f new_pos;
-
- if (panel_buttons.empty())
- new_pos = Vector3f(0.0f, 0.0f, 0.0f);
- else
- new_pos = Vector3f(panel_buttons.back()->get_pos() +
- Vector3f((float)(5 +
panel_buttons.back()->get_width()), 0.0f));
- // Add button to collection of buttons
- panel_buttons.push_back(button);
-
- // Add a 5 pixel spacing between all buttons
- button->set_pos(new_pos);
-
- // Add the button to the GUI Manager
- get_screen()->get_gui_manager()->add((GUI::Component*)button, true);
-}
-
-void
-EditorPanel::set_selected_button(PanelButton* pb)
-{
- if (pressed_button)
- {
- combobox_1->set_enabled(false);
- combobox_2->set_enabled(false);
- combobox_3->set_enabled(false);
- pressed_button->select(false);
- }
-
- pressed_button = pb;
- if (pressed_button)
- pressed_button->select(true);
-}
-
-GUI::Combobox*
-EditorPanel::get_combobox(int i)
-{
- switch(i)
- {
- case 1 :
- return combobox_1;
- case 2 :
- return combobox_2;
- case 3:
- return combobox_3;
- default :
- return 0;
- }
-}
-
-void
-EditorPanel::checkbox_changed(bool new_value, GUI::Checkbox* box)
-{
- if (box == snap_to_checkbox)
- editor->get_viewport()->set_snap_to(new_value);
-}
-
-void
-EditorPanel::combobox_changed(GUI::Combobox* box)
-{
- if (pressed_button)
- {
- int i;
- if (box == combobox_1)
- i = 1;
- else if (box == combobox_2)
- i = 2;
- else
- i = 3;
-
- // Send the ID field of the Combobox to whichever button is currently
selected.
- pressed_button->combobox_changed(i,
-
get_combobox(i)->get_selected_item()->get_id());
- }
-
-}
-
-} // Editor namespace
Deleted: trunk/pingus/src/editor/editor_panel.hpp
===================================================================
--- trunk/pingus/src/editor/editor_panel.hpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/editor_panel.hpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,105 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_EDITOR_PANEL_HPP
-#define HEADER_PINGUS_EDITOR_PANEL_HPP
-
-#include <vector>
-#include <iostream>
-#include "../gui/component.hpp"
-#include "../gui/checkbox_listener.hpp"
-#include "../gui/combobox_listener.hpp"
-
-
-class DrawingContext;
-class GUI::Checkbox;
-class GUI::Combobox;
-
-namespace Editor {
-
-class PanelButton;
-class EditorScreen;
-
-/** This class contains all of the buttons, comboboxes, and other components */
-class EditorPanel : public GUI::Component,
- public GUI::CheckboxListener, public GUI::ComboboxListener
-{
-private:
- /** The EditorScreen to which this panel belongs */
- EditorScreen* editor;
-
- /** Collection of buttons on this panel */
- std::vector<PanelButton*> panel_buttons;
-
- /** Currently selected object on this panel */
- PanelButton* pressed_button;
-
- /** Combobox which can change it's item list based on the button pressed */
- GUI::Combobox* combobox_1;
- GUI::Combobox* combobox_2;
- GUI::Combobox* combobox_3;
-
- /** Checkbox which controls the snap-to-grid functionality */
- GUI::Checkbox* snap_to_checkbox;
-
-public:
- /** Constructor
- @param es The EditorScreen to which this panel belongs */
- EditorPanel(EditorScreen* es);
-
- /** Destructor - nothing really happens here */
- ~EditorPanel();
-
- /** Initialize the panel - Adds all of the buttons and text fields
- Wait to run this until after the panel has been added to the gui_manager
*/
- void init();
-
- /** Add a button to the panel
- @param button The PanelButton that you'd like to add. The given object
will be
- deleted automaticly at the end. */
- void add(PanelButton* button);
-
- /** Draws the panel */
- void draw(DrawingContext& gc);
-
- /** Return the editor screen */
- EditorScreen* get_screen() { return editor; }
-
- /** Return the combobox object */
- GUI::Combobox* get_combobox(int i);
-
- /** Changes which button is currently pressed */
- void set_selected_button(PanelButton* pb);
-
- /** Event that fires when a checkbox gets changed */
- void checkbox_changed(bool new_value, GUI::Checkbox* box);
-
- /** Event that fires when a combobox gets changed */
- void combobox_changed(GUI::Combobox* box);
-
-
-private:
- EditorPanel();
- EditorPanel (const EditorPanel&);
- EditorPanel& operator= (const EditorPanel&);
-
-}; // EditorPanel
-} // Editor namespace
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/editor/level_head.cpp
===================================================================
--- trunk/pingus/src/editor/level_head.cpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/level_head.cpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,134 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "../display/drawing_context.hpp"
-#include "../gui/gui_manager.hpp"
-#include "../gui/surface_button.hpp"
-#include "../gui/input_box.hpp"
-#include "../sound/sound.hpp"
-#include "../resource.hpp"
-#include "../math/vector3f.hpp"
-#include "../fonts.hpp"
-#include "../gettext.h"
-#include "level_head.hpp"
-#include "level_impl.hpp"
-#include "../display/display.hpp"
-#include "editor_level.hpp"
-//#include "editor_panel.hpp"
-#include "editor_screen.hpp"
-
-namespace Editor {
-
-class LevelHeadCloseButton : public GUI::SurfaceButton
-{
-private:
- LevelHead* head;
- std::string label;
-
-public:
- LevelHeadCloseButton(LevelHead* h)
- : GUI::SurfaceButton(Display::get_width() -200,
- Display::get_height() -100,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- head(h),
- label(_("Ok"))
- {
- }
-
- void draw (DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large, (float)Display::get_width() - 150,
- (float)Display::get_height() - 100, label);
- }
-
- void on_click()
- {
- //head->get_head_button()->remove_head();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-LevelHead::LevelHead(EditorPanel* p, PanelButtonHead* pbh) :
- head_button(pbh),
- impl(p->get_screen()->get_level()->get_level_impl()),
- gui_manager(p->get_screen()->get_gui_manager()),
- pos(Vector3f(50, 75))
-{
- gui_manager->add((GUI::Component*)this, false);
-
- // Create GUI items
- name = new GUI::InputBox(400, Vector3f(pos.x + 175, pos.y + 10),
- impl->levelname, false, "Level Name");
- desc = new GUI::InputBox(500, Vector3f(pos.x + 175, pos.y + 60),
- impl->description, false, "Level Description");
-
- // Add GUI Items to the GUIManager
- gui_manager->add((GUI::Component*)name, true);
- gui_manager->add((GUI::Component*)desc, true);
-
- // Add close button
- close_button = new LevelHeadCloseButton(this);
- gui_manager->add((GUI::Component*)close_button, true);
-}
-
-LevelHead::~LevelHead()
-{
- // Remove all GUI Items from the GUIManager
- gui_manager->remove(name);
- gui_manager->remove(desc);
- gui_manager->remove(close_button);
- gui_manager->remove((GUI::Component*)this);
-}
-
-void
-LevelHead::draw(DrawingContext& gc)
-{
- // Draw the background for window
- gc.draw_fillrect(pos.x, pos.y, (float)Display::get_width() - 50,
- (float)Display::get_height()-50, Color(100,150,50,150));
- // Draw the window border
- gc.draw_rect(pos.x, pos.y, (float)Display::get_width() - 50,
- (float)Display::get_height()-50, Color(255,255,255));
-}
-
-bool
-LevelHead::is_at(int x, int y)
-{
- return (x > pos.x && y > pos.y && x < Display::get_width()-50 &&
- y < Display::get_height()-50);
-}
-
-void
-LevelHead::update(float delta)
-{
- UNUSED_ARG(delta);
- // FIXME: Should only update this information if it has changed.
- impl->levelname = name->get_string();
- impl->description = desc->get_string();
-}
-
-
-} // namespace Editor
-
-/* EOF */
Deleted: trunk/pingus/src/editor/level_head.hpp
===================================================================
--- trunk/pingus/src/editor/level_head.hpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/level_head.hpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,76 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_EDITOR_LEVEL_HEAD_HPP
-#define HEADER_PINGUS_EDITOR_LEVEL_HEAD_HPP
-
-#include "../gui/component.hpp"
-
-
-class Vector3f;
-
-namespace GUI {
-class GUIManager;
-class InputBox;
-}
-
-namespace Editor {
-
-class LevelImpl;
-class PanelButtonHead;
-class EditorPanel;
-class LevelHeadCloseButton;
-
-/** This class draws a box with different input boxes that
- * determine the specific level information which is saved
- * in the <HEAD> section of the XML level file */
-class LevelHead : public GUI::Component
-{
-private:
- /** The level we are editing */
- PanelButtonHead* head_button;
-
- LevelImpl *impl;
-
- GUI::GUIManager* gui_manager;
-
- /** Where this box is drawn*/
- Vector3f pos;
-
- // Input boxes for each item of the level impl
- GUI::InputBox* name;
- GUI::InputBox* desc;
- LevelHeadCloseButton* close_button;
-
-public:
-
- LevelHead(EditorPanel* p, PanelButtonHead* pbh);
- ~LevelHead();
-
- PanelButtonHead* get_head_button() { return head_button; }
-
- // GUI Component stuff
- bool is_at(int x, int y);
- void draw(DrawingContext& gc);
- void update(float delta);
-};
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/editor/panel_buttons.cpp
===================================================================
--- trunk/pingus/src/editor/panel_buttons.cpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/panel_buttons.cpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,245 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <vector>
-#include "../gui/combobox.hpp"
-#include "../gui/gui_manager.hpp"
-#include "../display/scene_context.hpp"
-#include "../path_manager.hpp"
-#include "../fonts.hpp"
-#include "../resource.hpp"
-#include "panel_buttons.hpp"
-#include "editor_level.hpp"
-//#include "editor_panel.hpp"
-#include "editor_screen.hpp"
-#include "level_objs.hpp"
-#include "level_head.hpp"
-
-class Resource;
-
-namespace Editor {
-
-// Constructor
-PanelButton::PanelButton(EditorPanel* p)
- : hover(false),
- panel(p),
- is_selected(false)
-{
- button = Sprite("core/editor/button");
- button_pressed = Sprite("core/editor/button_pressed");
-}
-
-// Draw the button
-void
-PanelButton::draw(DrawingContext &gc)
-{
- if (is_selected)
- gc.draw(button_pressed, pos);
- else
- gc.draw(button, pos);
-
- // Print the tooltip
- if (hover)
- gc.print_left(Fonts::pingus_small, pos.x, pos.y + (float)get_width(),
- tooltip, 50);
-
- // Draw the actual button image
- gc.draw(sur, pos);
-}
-
-// Set the position of this panelbutton
-void
-PanelButton::set_pos(Vector3f p)
-{
- pos = p;
-}
-
-// Is this button at these x,y coordinates?
-bool
-PanelButton::is_at(int x, int y)
-{
- return (x > pos.x && x < pos.x + sur.get_width()
- && y > pos.y && y < pos.y + sur.get_height());
-}
-
-// Something all buttons should do.
-void
-PanelButton::on_primary_button_click(int x, int y)
-{
- UNUSED_ARG(x);
- UNUSED_ARG(y);
- panel->set_selected_button(this);
-}
-
-// Standard exit button
-PanelButtonExit::PanelButtonExit(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Exit the editor";
- sur = Sprite("core/editor/exit");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonExit::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->on_escape_press();
-}
-
-// Standard Load button
-PanelButtonLoad::PanelButtonLoad(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Load existing level";
- sur = Sprite("core/editor/open");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonLoad::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->show_file_dialog(true);
-}
-
-// Standard save button
-PanelButtonSave::PanelButtonSave(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Save current level";
- sur = Sprite("core/editor/save");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonSave::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->show_file_dialog(false);
-}
-
-
-// Load the groundpieces
-PanelButtonGroundpiece::PanelButtonGroundpiece(EditorPanel *p) :
- PanelButton(p)
-{
- sur = Sprite("core/editor/save"); // FIXME: Update this sprite
- tooltip = "Load a groundpiece";
-}
-
-void
-PanelButtonGroundpiece::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
-
- panel->get_combobox(1)->clear();
- panel->get_combobox(1)->set_label("Type");
- panel->get_combobox(2)->set_label("Subtype");
- panel->get_combobox(3)->set_label("Groundpiece");
-
- std::vector<std::string> groundpieces; //// =
Resource::get_sections("groundpieces");
- for (unsigned i = 0; i < groundpieces.size(); i++)
- {
- // We add each ComboItem to the first box:
- // - The ID field of the ComboItem should be the full resource name.
- // - The displayed field should only be the section name.
- panel->get_combobox(1)->add(new GUI::ComboItem("groundpieces/" +
groundpieces[i],
- groundpieces[i]));
- }
- panel->get_combobox(1)->set_enabled(true);
-}
-
-// Populate the other comboboxes with the available resources.
-void
-PanelButtonGroundpiece::combobox_changed(int i, const std::string &value)
-{
- std::string section;
- if (i == 1)
- {
- // Populate the 2nd combobox with the next resource section & disable
box 3.
- panel->get_combobox(2)->clear();
- panel->get_combobox(2)->set_enabled(true);
- panel->get_combobox(3)->set_enabled(false);
-
- std::vector<std::string> groundpieces;//// = Resource::get_sections(
- ////panel->get_combobox(1)->get_selected_item()->get_displayed_string());
- for (std::vector<std::string>::const_iterator it = groundpieces.begin();
- it != groundpieces.end(); it++)
- panel->get_combobox(2)->add(new GUI::ComboItem(value + "/" + (*it),
(*it)));
- }
- else if (i == 2)
- {
- // Populate the 3rd combobox with the Resource ID's
- panel->get_combobox(3)->clear();
- panel->get_combobox(3)->set_enabled(true);
-
- std::vector<std::string> groundpieces;//// = Resource::get_resources(
- //// "sprite", value);
- for (std::vector<std::string>::const_iterator it = groundpieces.begin();
- it != groundpieces.end(); it++)
- {
- // new_value is the "displayed_string" for the combobox.
- std::string new_value = (*it).substr(value.length()+1);
- panel->get_combobox(3)->add(new GUI::ComboItem(value + "/" +
new_value,
- new_value));
- }
- }
- else
- {
- // 3rd box was selected - add the resource to the current level.
- LevelObj* obj = new LevelObj("groundpiece",
panel->get_screen()->get_level()->get_level_impl());
- obj->set_res_desc(ResDescriptor(value));
- obj->set_pos(Vector3f(0, 0, 0));
- // 1st combobox displayed the "type" of resource (solid, transparent,
etc.)
-
obj->set_type(panel->get_combobox(1)->get_selected_item()->get_displayed_string());
- panel->get_screen()->add_object(obj);
- }
-}
-
-PanelButtonHead::PanelButtonHead(EditorPanel *p)
- : PanelButton(p),
- head(0)
-{
- // FIXME: Update this sprite
- sur = Sprite("core/editor/save");
- tooltip = "Set specific level information";
-}
-
-void
-PanelButtonHead::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- if (!head)
- {
- head = new LevelHead(panel, this);
- }
- else
- {
- remove_head();
- }
-}
-
-void
-PanelButtonHead::remove_head()
-{
- delete head;
- head = 0;
-}
-
-
-} // Editor namespace
Deleted: trunk/pingus/src/editor/panel_buttons.hpp
===================================================================
--- trunk/pingus/src/editor/panel_buttons.hpp 2008-07-07 07:06:04 UTC (rev
3705)
+++ trunk/pingus/src/editor/panel_buttons.hpp 2008-07-07 07:18:42 UTC (rev
3706)
@@ -1,209 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2007 Jason Green <address@hidden>,
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PANEL_BUTTONS_HPP
-#define HEADER_PINGUS_PANEL_BUTTONS_HPP
-
-#include "../gui/component.hpp"
-#include "../math/vector3f.hpp"
-
-class DrawingContext;
-
-namespace Editor {
-
-class EditorPanel;
-class LevelHead;
-
-/** Generic PanelButton class - all buttons in the Editor should inherit from
this */
-class PanelButton : public GUI::Component
-{
-private:
- /** Whether or not the mouse is over the button */
- bool hover;
-
-protected:
- /** The actual button image */
- Sprite sur;
-
- /** The button background image when not pressed */
- Sprite button;
-
- /** The button background image while pressed */
- Sprite button_pressed;
-
- /** The panel to which this button belongs */
- EditorPanel* panel;
-
- /** The string that appears when the mouse is hovering over this button */
- std::string tooltip;
-
- /** The location of this button on the screen (set by the EditorPanel) */
- Vector3f pos;
-
- /** Is this button currently selected? */
- bool is_selected;
-
-public:
- /** Constructor
- @param p The EditorPanel to which this button belongs */
- PanelButton(EditorPanel* p);
-
- /** Destructor - nothing really happens here */
- virtual ~PanelButton() { }
-
- /** Set the position of this button on the screen - used by the EditorPanel
- @param p the x,y,z Vector3f where this button belongs */
- void set_pos (Vector3f p);
-
- /** Returns the Vector3f of this button's location */
- Vector3f get_pos () { return pos; }
-
- /** Returns the width of the sur sprite */
- int get_width() { return sur.get_width(); }
-
- /** Returns the height of the sur sprite */
- int get_height() { return sur.get_height(); }
-
- /** Draws the button */
- void draw(DrawingContext& gc);
-
- /** Return true if the button is located at this x,y coordinate */
- bool is_at(int x, int y);
-
- /** Action taken when the button is clicked */
- virtual void on_primary_button_click(int x, int y);
-
- /** Action taken when the mouse enters the button area */
- virtual void on_pointer_enter () { hover = true; }
-
- /** Action taken when the mouse leaves the button area */
- virtual void on_pointer_leave () { hover = false; }
-
- /** Action taken when the button is selected or not */
- virtual void select(bool s) { is_selected = s; }
-
- /** Event that fires when the first combobox has been changed */
- virtual void combobox_changed(int i, const std::string &value) { }
-
-private:
- PanelButton (const PanelButton&);
- PanelButton& operator= (const PanelButton&);
-}; // PanelButton class
-
-
-/** Standard exit button */
-class PanelButtonExit : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonExit (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonExit ();
- PanelButtonExit (const PanelButtonExit&);
- PanelButtonExit& operator= (const PanelButtonExit&);
-}; // PanelButtonExit class
-
-
-/** Standard load button */
-class PanelButtonLoad : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonLoad (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonLoad ();
- PanelButtonLoad (const PanelButtonLoad&);
- PanelButtonLoad& operator= (const PanelButtonLoad&);
-}; // PanelButtonLoad class
-
-
-/** Standard save button */
-class PanelButtonSave : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonSave (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonSave ();
- PanelButtonSave (const PanelButtonSave&);
- PanelButtonSave& operator= (const PanelButtonSave&);
-}; // PanelButtonSave class
-
-
-/** Display all of the groundpiece objects */
-class PanelButtonGroundpiece : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonGroundpiece (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked */
- virtual void on_primary_button_click (int x, int y);
-
- /** Want to update the other comboboxes with the new groundpieces */
- virtual void combobox_changed(int i, const std::string &value);
-
-private:
- PanelButtonGroundpiece ();
- PanelButtonGroundpiece (const PanelButtonGroundpiece&);
- PanelButtonGroundpiece& operator= (const PanelButtonGroundpiece&);
-}; // PanelButtonGroundpiece class
-
-
-/** Display all of the level description <HEAD> information */
-class PanelButtonHead : public PanelButton
-{
-private:
- LevelHead* head;
-
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonHead (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked */
- virtual void on_primary_button_click (int x, int y);
-
- void remove_head();
-
-private:
- PanelButtonHead ();
- PanelButtonHead (const PanelButtonHead&);
- PanelButtonHead& operator= (const PanelButtonHead&);
-};
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3706 - trunk/pingus/src/editor,
grumbel at BerliOS <=