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

bmsqwin.cpp

Go to the documentation of this file.
00001 // $Id$
00002 
00003 //**********************************************************************
00004 //                                                                     *
00005 //    Description:   'Bell Master' TurboVision window to display a     *
00006 //                   bell code sequence along with matching            *
00007 //                   descriptions from a list.                         *
00008 //                                                                     *
00009 //    Author:        Chris White (whitecf@bcs.org.uk)                  *
00010 //                                                                     *
00011 //    Copyright (C) 2003  Monitor Computing Services Ltd.              *
00012 //                                                                     *
00013 //    This program is free software; you can redistribute it and/or    *
00014 //    modify it under the terms of the GNU General Public License      *
00015 //    as published by the Free Software Foundation; either version 2   *
00016 //    of the License, or any later version.                            *
00017 //                                                                     *
00018 //    This program is distributed in the hope that it will be useful,  *
00019 //    but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00020 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00021 //    GNU General Public License for more details.                     *
00022 //                                                                     *
00023 //    You should have received a copy of the GNU General Public        *
00024 //    License (http://www.gnu.org/copyleft/gpl.html) along with this   *
00025 //    program; if not, write to:                                       *
00026 //       The Free Software Foundation Inc.,                            *
00027 //       59 Temple Place - Suite 330,                                  *
00028 //       Boston, MA  02111-1307,                                       *
00029 //       USA.                                                          *
00030 //                                                                     *
00031 //**********************************************************************
00032 //                                                                     *
00033 //    Notes:                                                           *
00034 //                                                                     *
00035 //**********************************************************************
00036 
00037 #define Uses_TButton
00038 #define Uses_TRect
00039 #define Uses_TScrollBar
00040 #define Uses_TStaticText
00041 
00042 #include <cstring.h>
00043 #include <strstrea.h>
00044 
00045 #include "bclist.h"
00046 #include "bmcdlvw.h"
00047 #include "mytrace.h"
00048 
00049 #include "bmsqwin.h"
00050 
00051 
00052 using namespace Monitor::BellMaster;
00053 
00054 
00055 
00056 SequenceWindow::SequenceWindow(const string&          sequence,
00057                                const BellCodeList&    newBellCodes,
00058                                TRect&                 bounds) :
00059     TDialog(bounds, "Bell Code Sequence"),
00060     TWindowInit(&SequenceWindow::initFrame)
00061 {
00062     _USEMYTRACE_("SequenceWindow::SequenceWindow")
00063 
00064 
00065     bounds = getExtent();
00066 
00067 
00068     TScrollBar    *vScrollBar = new TScrollBar(TRect(bounds.b.x - 1,
00069                                                      bounds.a.y + 5,
00070                                                      bounds.b.x,
00071                                                      bounds.b.y - 4));
00072 
00073     if (vScrollBar == 0)
00074     {
00075         cerr << "vScrollBar init error" << endl;
00076         exit(1);
00077     }
00078 
00079     vScrollBar->options |= ofPostProcess;
00080     insert(vScrollBar);
00081 
00082 
00083     insert(new CodeListView(newBellCodes,
00084                             TRect(bounds.a.x + 1,
00085                                   bounds.a.y + 5,
00086                                   bounds.b.x - 1,
00087                                   bounds.b.y - 4),
00088                             vScrollBar));
00089 
00090 
00091     // Use a string stream to display the sequence
00092     ostrstream              sequenceStream;
00093     const unsigned char*    rings = (const unsigned char*)sequence.c_str();
00094 
00095     // Must have at least one ring to have got this far
00096     sequenceStream << "Sequence: " << (unsigned int)*rings;
00097     ++rings;
00098 
00099     // Walk the array of rings adding them to the display string
00100     while (0 < *rings)
00101     {
00102         sequenceStream << ", " << (unsigned int)*rings;
00103         ++rings;
00104     }
00105 
00106     sequenceStream << '\0';
00107 
00108     insert(new TStaticText(TRect(bounds.a.x + 2,
00109                                  bounds.a.y + 2,
00110                                  bounds.b.x,
00111                                  bounds.a.y + 3),
00112                            sequenceStream.str()));
00113 
00114 
00115     int    midX         = (bounds.b.x - bounds.a.x) / 2;
00116     int    buttonBottom = bounds.b.y - 1;
00117     int    buttonTop    = buttonBottom - 2;
00118 
00119     insert(new TButton(TRect(midX + 5, buttonTop, midX + 15, buttonBottom),
00120                        "~I~gnore",
00121                        cmCancel,
00122                        bfNormal));
00123 
00124     insert(new TButton(TRect(midX - 15, buttonTop, midX - 5, buttonBottom),
00125                        "~A~ccept",
00126                        cmOK,
00127                        bfDefault));
00128 }
00129 

Generated on Wed Oct 29 20:55:43 2003 for Bellmaster BC Turbo Vision by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002