Canola  0.8.D001
canola/dialog/prog_mode.cc
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 #include <canola/calculator/gnome.h>
00019 #include <canola/dialog/prog_mode.h>
00020 #include <canola/load_image.h>
00021 
00022 
00023 dialog_prog_mode::~dialog_prog_mode()
00024 {
00025 }
00026 
00027 
00028 dialog_prog_mode::dialog_prog_mode(calculator_gnome *a_subject) :
00029     Dialog("Program Mode", *a_subject, true),
00030     subject(a_subject)
00031 {
00032     set_icon(load_gui_image("canola"));
00033 
00034     std::string text = "You are reading program cards, but the Program Mode "
00035         "selector is in the ";
00036     text += calculator::program_mode_name(subject->program_mode_get());
00037     text += " position.  Please confirm the correct Program Mode selection.";
00038     message.set_text(text);
00039     message.set_line_wrap(true);
00040     get_content_area()->add(message);
00041     message.show();
00042 
00043     add_button("LRN", calculator::program_mode_learn);
00044     add_button("OPE", calculator::program_mode_operation);
00045     add_button("PRO\nCHE", calculator::program_mode_program_check);
00046     add_button("OPE\nCHE", calculator::program_mode_operation_check);
00047     set_default_response(calculator::program_mode_learn);
00048 }
00049 
00050 
00051 void
00052 dialog_prog_mode::on_response(int id)
00053 {
00054     subject->program_mode_set_from_dialog(id);
00055 }