Canola  0.8.D001
canola/calculator/gnome.h
Go to the documentation of this file.
00001 //
00002 // canola - canon canola 1614p emulator
00003 // Copyright (C) 2011, 2012 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, version 3, as
00007 // published by the Free Software Foundation.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program. If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef CANOLA_CALCULATOR_GNOME_H
00019 #define CANOLA_CALCULATOR_GNOME_H
00020 
00021 #include <gtkmm/box.h>
00022 #include <gtkmm/button.h>
00023 #include <gtkmm/label.h>
00024 #include <gtkmm/notebook.h>
00025 #include <gtkmm/table.h>
00026 #include <gtkmm/textview.h>
00027 #include <gtkmm/uimanager.h>
00028 #include <gtkmm/window.h>
00029 
00030 #include <lib/calculator.h>
00031 
00032 #include <canola/nixie_tubes.h>
00033 #include <canola/retro_button.h>
00034 #include <canola/debugger/gnome.h>
00035 #include <canola/slider/power.h>
00036 #include <canola/slider/program_mode.h>
00037 #include <canola/slider/program_selector.h>
00038 #include <canola/slider/rounding.h>
00039 #include <canola/window/card_reader.h>
00040 
00041 class debugger_gnome; // forward
00042 class message_dialog_error; // forward
00043 
00048 class calculator_gnome:
00049     public calculator,
00050     public Gtk::Window
00051 {
00052 public:
00056     virtual ~calculator_gnome();
00057 
00062     static pointer create(void);
00063 
00064     // See base class for documentation.
00065     void run(void);
00066 
00067     // See base class for documentation.
00068     void on_error_v(const char *fmt, va_list ap);
00069 
00070     void program_mode_set_from_dialog(int id);
00071 
00072 private:
00073     // See base class for documentation.
00074     void derived_print(const display &value);
00075 
00076     // See base class for documentation.
00077     void derived_feed(void);
00078 
00079     // See base class for documentation.
00080     void derived_off(void);
00081 
00082     // See base class for documentation.
00083     void derived_update_display(const display &value);
00084 
00085     // See base class for documentation.
00086     void clock_tick_start_running(void);
00087 
00088     // See base class for documentation.
00089     void printer_timer_start_running(void);
00090 
00095     calculator_gnome();
00096 
00102     retro_button button_uj;
00103 
00108     void on_uj(void);
00109 
00115     retro_button button_mj;
00116 
00121     void on_mj(void);
00122 
00128     retro_button button_ej;
00129 
00134     void on_ej(void);
00135 
00141     retro_button button_sj;
00142 
00147     void on_sj(void);
00148 
00154     retro_button button_fj;
00155 
00160     void on_fj(void);
00161 
00167     retro_button button_rv;
00168 
00173     void on_rv(void);
00174 
00180     retro_button button_cm1;
00181 
00186     void on_cm1(void);
00187 
00193     retro_button button_c;
00194 
00199     void on_c(void);
00200 
00206     retro_button button_chg_sign;
00207 
00212     void on_chg_sign(void);
00213 
00219     retro_button button_right;
00220 
00225     void on_right(void);
00226 
00232     retro_button button_cm2;
00233 
00238     void on_cm2(void);
00239 
00244     retro_button button_clear_indicator;
00245 
00250     void on_clear_indicator(void);
00251 
00257     retro_button button_n7;
00258 
00263     void on_n7(void);
00264 
00270     retro_button button_n4;
00271 
00276     void on_n4(void);
00277 
00283     retro_button button_n1;
00284 
00289     void on_n1(void);
00290 
00296     retro_button button_n0;
00297 
00302     void on_n0(void);
00303 
00309     retro_button button_n8;
00310 
00315     void on_n8(void);
00316 
00322     retro_button button_n5;
00323 
00328     void on_n5(void);
00329 
00335     retro_button button_n2;
00336 
00341     void on_n2(void);
00342 
00348     retro_button button_n9;
00349 
00354     void on_n9(void);
00355 
00361     retro_button button_n6;
00362 
00367     void on_n6(void);
00368 
00374     retro_button button_n3;
00375 
00380     void on_n3(void);
00381 
00387     retro_button button_dot;
00388 
00393     void on_dot(void);
00394 
00400     retro_button button_mul;
00401 
00406     void on_mul(void);
00407 
00413     retro_button button_ent;
00414 
00419     void on_ent(void);
00420 
00426     retro_button button_start;
00427 
00432     void on_start(void);
00433 
00455     retro_button button_k;
00456 
00461     void on_k_down(void);
00462 
00467     void on_k_up(void);
00468 
00474     retro_button button_div;
00475 
00480     void on_div(void);
00481 
00487     retro_button button_sqrt;
00488 
00493     void on_sqrt(void);
00494 
00500     retro_button button_minus_equals;
00501 
00506     void on_minus_equals(void);
00507 
00513     retro_button button_plus_equals;
00514 
00519     void on_plus_equals(void);
00520 
00531     retro_button button_am1;
00532 
00537     void on_am1_down(void);
00538 
00543     void on_am1_up(void);
00544 
00550     retro_button button_m3;
00551 
00556     void on_m3_tilde(void);
00557 
00563     retro_button button_m2;
00564 
00569     void on_m2(void);
00570 
00576     retro_button button_m1;
00577 
00582     void on_m1(void);
00583 
00589     retro_button button_sm3;
00590 
00595     void on_sm3_tilde(void);
00596 
00602     retro_button button_mm2;
00603 
00608     void on_mm2(void);
00609 
00615     retro_button button_mm1;
00616 
00621     void on_mm1(void);
00622 
00628     retro_button button_cm3;
00629 
00634     void on_cm3_tilde(void);
00635 
00641     retro_button button_rm3;
00642 
00647     void on_rm3_tilde(void);
00648 
00654     retro_button button_rm2;
00655 
00660     void on_rm2(void);
00661 
00667     retro_button button_rm1;
00668 
00673     void on_rm1(void);
00674 
00679     Gtk::Table keyboard;
00680 
00688     slider_power power_switch;
00689 
00690     Gtk::HBox control_group;
00691 
00692     nixie_tubes display_widget;
00693     Gtk::Alignment display_widget_aligner;
00694 
00695     Gtk::VBox calculator_layout;
00696 
00702     Gtk::Notebook right_hand_panel;
00703 
00708     Gtk::Label printer_label;
00709 
00715     Gtk::VBox printer_group;
00716 
00723     Gtk::TextView printer_paper;
00724 
00730     Gtk::ScrolledWindow printer_paper_scroller;
00731 
00736     Gtk::HBox printer_button_group;
00737 
00742     Gtk::Button printer_power;
00743 
00748     void on_printer_power(void);
00749 
00755     Gtk::ToggleButton printer_manual_calculation;
00756 
00762     Gtk::Button printer_display_print;
00763 
00768     void on_display_print(void);
00769 
00775     Gtk::Button printer_program_print;
00776 
00781     void on_program_print(void);
00782 
00788     Gtk::Button printer_paper_feed;
00789 
00794     void on_paper_feed(void);
00795 
00801     Gtk::Label debugger_label;
00802 
00807     debugger_gnome debugger_content;
00808 
00809     Gtk::HBox overall_layout;
00810 
00815     void on_quit(void);
00816 
00817     Glib::RefPtr<Gtk::UIManager> menu_ui;
00818     Gtk::Widget *menu_bar;
00819     Gtk::VBox menu_layout;
00820 
00832     void on_load_program(void);
00833 
00839     void on_save_program(void);
00840 
00847     void on_save_memories_as_program(void);
00848 
00854     bool do_key_press_event(GdkEventKey *event);
00855 
00861     bool do_key_release_event(GdkEventKey *event);
00862 
00867     slider_program_mode program_mode_switch;
00868 
00873     slider_program_selector program_selector_switch;
00874 
00879     slider_rounding rounding_switch;
00880 
00881     struct decimal_point_selector_dial_columns_t:
00882         public Gtk::TreeModel::ColumnRecord
00883     {
00884         decimal_point_selector_dial_columns_t()
00885         {
00886             add(column_id);
00887             add(column_name);
00888         }
00889 
00890         Gtk::TreeModelColumn<int> column_id;
00891         Gtk::TreeModelColumn<Glib::ustring> column_name;
00892     };
00893 
00898     decimal_point_selector_dial_columns_t decimal_point_selector_dial_columns;
00899 
00904     Gtk::ComboBox decimal_point_selector_dial;
00905 
00911     Glib::RefPtr<Gtk::ListStore> decimal_point_selector_dial_tree_model;
00912 
00913 private:
00919     void on_program_mode_switch_changed(void);
00920 
00926     void on_program_selector_switch_changed(void);
00927 
00933     void on_rounding_switch_changed(void);
00934 
00940     void on_decimal_point_selector_dial_changed(void);
00941 
00946     bool on_clock_tick(void);
00947 
00952     sigc::connection clock_tick_timer;
00953 
00959     bool on_printer_finished(void);
00960 
00965     sigc::connection printer_timer;
00966 
00972     message_dialog_error *error_window;
00973 
00982     void on_opcode(opcode_t op);
00983 
00989     void on_special_key_symbol(void);
00990 
00996     void on_edit_preferences(void);
00997 
01002     void load_preferences_file(void);
01003 
01009     void save_preferences_file(void);
01010 
01018     void user_changed_debugger_address(int new_address);
01019 
01025     bool animate_card_reader;
01026 
01031     window_card_reader::pointer crp;
01032 
01037     calculator_gnome(const calculator_gnome &);
01038 
01043     calculator_gnome &operator=(const calculator_gnome &);
01044 };
01045 
01046 // vim: set ts=8 sw=4 et :
01047 #endif // CANOLA_CALCULATOR_GNOME_H