/home/martin/src/mimasim/src/mima_gtk/mimaEdit.h

Go to the documentation of this file.
00001 //$Id: mimaEdit.h,v 1.5 2006/11/04 17:09:02 der_martin Exp $
00002 /*
00003  * mimasim -- a simulator of a minimal microprocessor system
00004  * Copyright (C) 2006 Martin Grandrath <gr@ndrath.de>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301, USA.
00020  */
00021 
00022 #ifndef MIMAEDIT_H
00023 #define MIMAEDIT_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028 
00029 #include <iostream>
00030 #include <fstream>
00031 #include <sstream>
00032 
00033 #include <gtkmm/notebook.h>
00034 #include <gtkmm/scrolledwindow.h>
00035 #include <gtkmm/textview.h>
00036 #include <gtkmm/textbuffer.h>
00037 #include <gtkmm/box.h>
00038 #include <gtkmm/label.h> // just for testing
00039 #include <gtkmm/filechooserdialog.h>
00040 #include <gtkmm/messagedialog.h>
00041 #include <gtkmm/table.h>
00042 
00043 #include <gtkmm/uimanager.h>
00044 #include <gtkmm/menu.h>
00045 #include <gtkmm/stock.h>
00046 
00047 #include <mima.h>
00048 #include "mimaWidgets.h" // for EntryInt
00049 #include "mimaChildWindow.h"
00050 
00051 // declare classes
00052 namespace MimaGtk {
00053      class MimaEdit;
00054 }
00055 
00057 std::istream& operator>>(std::istream& is, MimaGtk::MimaEdit& mimaEdit);
00058 
00060 namespace MimaGtk {
00061 
00062      class MimaEdit : public Gtk::Notebook
00063           {
00064           private:
00065 
00066                class Tab : public Gtk::ScrolledWindow
00067                     {
00068                     protected:
00069                          Gtk::TextView m_textView;
00070 
00072                          Glib::RefPtr<Gtk::TextBuffer::Tag> m_refTagMono;
00073 
00074                     public:
00075                          Tab();
00076                          ~Tab();
00077 
00078                          void read(std::istream &is);
00079                          void write(std::ostream &os);
00080                     };
00081 
00082           protected:
00083                int m_filecount;
00084 
00085           public:
00086                MimaEdit();
00087                ~MimaEdit();
00088 
00089                void empty_tab(std::string _title="");
00090                void open_file(Gtk::Window *_parent);
00091                void close_tab();
00092                void new_tab(std::istream &is, std::string _title="");
00093                void get_code(std::ostream &os);
00094           };
00095 
00096 
00098      class MimaEditMenu
00099           {
00100           private:
00101                typedef sigc::signal<void> type_signal_void;
00102 
00103           protected:
00104                type_signal_void
00105                     m_signal_new_tab,
00106                     m_signal_close_tab,
00107                     m_signal_open,
00108                     m_signal_save,
00109                     m_signal_save_as,
00110                     m_signal_import,
00111                     m_signal_export;
00112 
00113           public:
00114                MimaEditMenu();
00115                ~MimaEditMenu();
00116 
00117                Glib::RefPtr<Gtk::UIManager>   UIManager;
00118                Glib::RefPtr<Gtk::ActionGroup> ActionGroup;
00119 
00120                /*
00121                 * signal accessors
00122                 * ================
00123                 */
00124                type_signal_void signal_new_tab()   { return m_signal_new_tab;   };
00125                type_signal_void signal_close_tab() { return m_signal_close_tab; };
00126                type_signal_void signal_open()      { return m_signal_open;      };
00127                type_signal_void signal_save()      { return m_signal_save;      };
00128                type_signal_void signal_save_as()   { return m_signal_save_as;   };
00129                type_signal_void signal_import()    { return m_signal_import;    };
00130                type_signal_void signal_export()    { return m_signal_export;    };
00131 
00132           };
00133 
00134 
00136 
00138      class MimaEditWnd : public MimaChildWindow
00139           {
00140           private:
00141 
00142           protected:
00143                MimaSim::AssConvert m_assConvert;
00144 
00145                virtual bool ask_to_save();
00146 
00148                static int m_count;
00149 
00150                /*
00151                 * child widgets
00152                 * =============
00153                 */
00154                MimaEditMenu m_mimaEditMenu;
00155                MimaEdit     m_mimaEditFrame;
00156 
00157                Gtk::VBox    m_vbox;
00158 
00159                void on_assembler_import();
00160                void on_assembler_export();
00161 
00162           public:
00163                MimaEditWnd(MimaSim::Mima *_mima);
00164                ~MimaEditWnd();
00165 
00166                virtual ChildWindowType type()
00167                     { return EDIT; }
00168           };
00169 
00170 }
00171 
00172 #endif // MIMAEDIT_H

Generated on Sat Nov 4 19:40:57 2006 for mimasim by  doxygen 1.4.7