File: inputclient.cpp

package info (click to toggle)
zhcon 1%3A0.2.6-11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,328 kB
  • ctags: 2,180
  • sloc: cpp: 10,947; sh: 2,998; ansic: 1,635; makefile: 51
file content (75 lines) | stat: -rw-r--r-- 2,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// vi:ts=4:shiftwidth=4:expandtab
/***************************************************************************
                          inputclient.cpp  -  description
                             -------------------
    begin                : Sun Sep 9 2001
    copyright            : (C) 2001 by ejoy
    email                : ejoy@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <stdlib.h>
#include "inputclient.h"

Console* InputClient::mpCon = NULL;
InputClient::InputClient()
: mVisible(false),
mpServer(0) {
    assert(mpCon);
}

InputClient::~InputClient() {}

void InputClient::SetColor(string & s) {
    unsigned int ParmNo, Pos;
    unsigned int NextPos;
    int iVal;
    string sVal;
    // debug << "inputcolor define " << s << endl;
    ParmNo = 0;
    Pos = 0;
    while ( Pos < s.length() ) {
        NextPos = s.find(',', Pos);
        if (NextPos == (unsigned int)string::npos)
            NextPos = s.length();
        sVal = s.substr(Pos,NextPos - Pos);
        // debug << atoi(sVal.c_str()) << endl;
        iVal = atoi(sVal.c_str());
        iVal %= 16;
        switch (ParmNo) {
            case 0:
                mFgColor = iVal;
                break;
            case 1:
                mBgColor = iVal;
                break;
            case 2:
                mColor1 = iVal;
                break;
            case 3:
                mColor2 = iVal;
                break;
            case 4:
                mPixLight = iVal;
                break;
            case 5:
                mPixDark = iVal;
                break;
            default:
                break;
        }
        ParmNo++;
        Pos = NextPos + 1;
    }
    // debug << mFgColor << mBgColor << mColor1 << mColor2 << endl;
    return;
}