/***************************************************************************
 *   Copyright (C) 2008 by Jürgen Böhm   *
 *   juergen.boehm@aviduratas.de   *
 *                                                                         *
 *   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 SIMEMU_H
#define SIMEMU_H

#include <qmainwindow.h>
#include <qtoolbutton.h>
#include <deque>


#include "emuprocessor.h"
#include "qjbdisplay.h"



static char akt_test_file[] = "/home/juergen/lisp/micasm/akt-test.dump";

typedef std::deque<int> deqint;
extern deqint keyPressedQueue;



class QjbDisplay;

class simemu: public QMainWindow
{
    Q_OBJECT

public:
    simemu();
    ~simemu();

		void customEvent (QCustomEvent * ev);

		QjbDisplay* getDisplay () { return e; };

protected:
    void closeEvent( QCloseEvent* );

private slots:
    void newDoc();
    void choose();
    void load( const QString &fileName );
    void save();
    void saveAs();
    void print();

		void haltProgram ();
		void breakProgram ();
		void execute ();

    void about();
    void aboutQt();

private:

		QToolButton* runButton;
		bool codeLoaded;

		EmuProcessor* emuproc;

    QPrinter *printer;
    QjbDisplay *e;
    QString filename;
};


class QxycEvent : public QCustomEvent {

	public:

	QxycEvent (int xa, int ya, int ca) : QCustomEvent(65432), x(xa), y(ya), c(ca) {};

		int x;
		int y;
		int c;

};

static int maxlines = 54;
static int maxcols = 133;

extern simemu* glMainWindow;

#endif
