Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

level_editor.h

00001 /*
00002  *   EasySok --- A(nother) sokoban game for KDE.
00003  *
00004  *   Copyright (C) 2001 by Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2 as
00008  *   published by the Free Software Foundation.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with this program; if not, write to the Free Software
00017  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 
00021 #ifndef EASYSOK_LEVEL_EDITOR_INC_GUARD_H
00022 #define EASYSOK_LEVEL_EDITOR_INC_GUARD_H
00023 
00024 
00025 #include <kmainwindow.h>
00026 
00027 #include "compressed_map.h"
00028 #include "level.h"
00029 #include "theme.h"
00030 
00031 
00032 class KAction;
00033 class KRadioAction;
00034 class MapWidget;
00035 
00036 
00037 
00038 
00046 class LevelEditor : public KMainWindow
00047 {
00048     Q_OBJECT
00049 
00050 public:
00051 
00063     LevelEditor(Level const & level, int collection_nr, int level_nr, Theme * theme,
00064                 QWidget * parent = 0, const char * name = 0);
00065 
00066 
00071     virtual ~LevelEditor();
00072 
00073 
00082     void setOriginalLevel(Level const & level, int collection_nr, int level_nr);
00083 
00084 
00089     Level const & level() const;
00090 
00091 
00096     Level const & originalLevel() const;
00097 
00098 
00103     int collectionNr() const;
00104 
00105 
00110     int levelNr() const;
00111 
00112 
00113 public slots:
00114 
00119     void saveAndExit();
00120 
00121 
00128     bool save();
00129 
00130 
00135     void exitWithoutSave();
00136 
00137 
00142     void undo();
00143 
00144 
00149     void redo();
00150 
00151 
00158     void fieldClicked(QPoint position);
00159 
00160 
00168     void gemMoved(QPoint from, QPoint to);
00169 
00170 
00178     void keeperMoved(QPoint from, QPoint to);
00179 
00180 
00185     void rotateLeft();
00186 
00187 
00192     void rotateRight();
00193 
00194 
00199     void mirrorHorizontally();
00200 
00201 
00206     void mirrorVertically();
00207 
00208 
00213     void simplify();
00214 
00215 
00220     void fillEdges();
00221 
00222 
00227     void fillOutside();
00228 
00229 
00234     void changeProperties();
00235 
00236 
00241     void changeSize();
00242 
00243 
00248     void adjustSize();
00249 
00250 
00255     void createEmptyMap();
00256 
00257 
00262     void createGoals();
00263 
00264 
00269     void createGems();
00270 
00271 
00276     void createSolvableMap();
00277 
00278 
00283     void checkValidity();
00284 
00285 
00290     void isSolvable();
00291 
00292 
00297     void activeElementChanged();
00298 
00299 
00304     void showKeyDialog();
00305 
00306 
00311     void showToolbarDialog();
00312 
00313 
00318     void updateToolbar();
00319 
00320 
00321 signals:
00322 
00329     void saveLevel(LevelEditor * level_editor);
00330 
00331 
00338     void exited(LevelEditor * level_editor);
00339 
00340 
00341 private:
00342 
00349     void saveUnsavedChanges(bool cancel_possible);
00350 
00351 
00356     void createAccels();
00357 
00358 
00363     void createActions();
00364 
00365 
00372     void showValidityMessage(Map::MapValidity validity);
00373 
00374 
00379     void updateUndoRedoState();
00380 
00381 
00386     void insertMap();
00387 
00388 
00393     void updateOutside();
00394 
00395 
00400     mutable Level m_level;
00401 
00402 
00407     Level m_original_level;
00408 
00409 
00414     int m_collection_nr;
00415 
00416 
00421     int m_level_nr;
00422 
00423 
00428     Map m_map;
00429 
00430 
00435     MapWidget * m_map_widget;
00436 
00437 
00442     Theme m_theme;
00443 
00444 
00449     enum ActiveElement
00450     {
00455         EMPTY,
00456 
00457 
00462         WALL,
00463 
00464 
00469         GOAL,
00470 
00471 
00476         KEEPER,
00477 
00478 
00483         GEM
00484     };
00485 
00486 
00491     ActiveElement m_active_element;
00492 
00493 
00498     int m_undo_pointer;
00499 
00500 
00505     std::vector<CompressedMap> m_maps;
00506 
00507 
00512     KAction * m_undo_action;
00513 
00514 
00519     KAction * m_redo_action;
00520 
00521 
00526     KRadioAction * m_empty_field_action;
00527 
00528 
00533     KRadioAction * m_wall_field_action;
00534 
00535 
00540     KRadioAction * m_keeper_field_action;
00541 
00542 
00547     KRadioAction * m_goal_field_action;
00548 
00549 
00554     KRadioAction * m_gem_field_action;
00555 
00556 
00561     bool m_was_saved;
00562 
00563 
00568     bool m_exited_signaled;
00569 
00570 
00575     static int s_pieces[65];
00576 };
00577 
00578 
00579 #endif

Generated at Sun Jan 6 18:49:09 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001