File: meter.cc

package info (click to toggle)
xosview 1.6.1-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 768 kB
  • ctags: 869
  • sloc: cpp: 4,993; sh: 1,642; ansic: 367; makefile: 45; awk: 20
file content (58 lines) | stat: -rw-r--r-- 1,322 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
//  
//  Copyright (c) 1994, 1995 by Mike Romberg ( romberg@fsl.noaa.gov )
//
//  This file may be distributed under terms of the GPL
//
//
// $Id: meter.cc,v 1.3 1996/11/19 04:14:53 bgrayson Exp $
//
#include "general.h"
#include "meter.h"
#include "xosview.h"

CVSID("$Id: meter.cc,v 1.3 1996/11/19 04:14:53 bgrayson Exp $");
CVSID_DOT_H(METER_H_CVSID);

Meter::Meter( XOSView *parent, const char *title, const char *legend, 
              int dolegends, int dousedlegends ) {
  title_ = legend_ = NULL;
  Meter::title( title );
  Meter::legend( legend );
  parent_ = parent;
  dolegends_ = dolegends;
  dousedlegends_ = dousedlegends;
  priority_ = 1;
  counter_ = 0;
  resize( parent->xoff(), parent->newypos(), parent->width() - 10, 10 );

}

Meter::~Meter( void ){
  delete[] title_;
  delete[] legend_;
}

void Meter::checkResources( void ){
  textcolor_ = parent_->allocColor( parent_->getResource( "meterLabelColor") );
}

void Meter::title( const char *title ){
  delete[] title_;
  title_ = new char[strlen( title ) + 1];
  strcpy( title_, title );
}

void Meter::legend( const char *legend ){
  delete[] legend_;
  legend_ = new char[strlen( legend ) + 1];
  strcpy( legend_, legend );
}

void Meter::resize( int x, int y, int width, int height ){
  x_ = x;
  y_ = y;
  width_ = width;
  height_ = height;
}