00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
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
00092 ostrstream sequenceStream;
00093 const unsigned char* rings = (const unsigned char*)sequence.c_str();
00094
00095
00096 sequenceStream << "Sequence: " << (unsigned int)*rings;
00097 ++rings;
00098
00099
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