~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/include/FreqControl.h

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-10-25 11:17:10 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20141025111710-n32skgya3l9u1brw
Tags: 1.3.17-1
* New upstream release (Closes: #761839)
* Debian Standards-Version: 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// "$Id: FreqControl.cpp,v  2006/02/26"
2
 
//
3
 
// Frequency Control Widget for the Fast Light Tool Kit (Fltk)
4
 
//
5
 
// Copyright 2005-2006, Dave Freese W1HKJ
6
 
//
7
 
// This library is free software; you can redistribute it and/or
8
 
// modify it under the terms of the GNU Library General Public
9
 
// License as published by the Free Software Foundation; either
10
 
// version 2 of the License, or (at your option) any later version.
11
 
//
12
 
// This library is distributed in the hope that it will be useful,
13
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
// Library General Public License for more details.
16
 
//
17
 
// You should have received a copy of the GNU Library General Public
18
 
// License along with this library; if not, write to the Free Software
19
 
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
 
// USA.
21
 
//
22
 
// Please report all bugs and problems to "w1hkj@w1hkj.com".
23
 
//
24
 
// Usage:
25
 
//      Create a multi-digit receiver / transceiver frequency control widget
26
 
//
27
 
// label used to pass # digits & decimal position to control
28
 
// the widget can be used in Fluid & initialized with the
29
 
// number of digits as the label string
30
 
// default is 7; min number is 1, max number is 9 as in
31
 
//
32
 
// cFreqControl myFreqConrol(x0, y0, w0, h0, "N");  where N is # digits
33
 
// cFreqControl *pMyFreqControl = new cFreqControl(x0,y0,w0,h0,"N");
34
 
 
35
 
#ifndef _FREQCONTROL_H_
36
 
#define _FREQCONTROL_H_
37
 
 
38
 
#include <FL/Fl.H>
39
 
#include <FL/Fl_Widget.H>
40
 
#include <FL/Fl_Repeat_Button.H>
41
 
#include <FL/Fl_Group.H>
42
 
#include <FL/Enumerations.H>
43
 
 
44
 
#ifdef MAX_DIGITS
45
 
#undef MAX_DIGITS
46
 
#endif
47
 
#define MAX_DIGITS 10
48
 
 
49
 
#ifdef MIN_DIGITS
50
 
#undef MIN_DIGITS
51
 
#endif
52
 
#define MIN_DIGITS 4
53
 
 
54
 
class Fl_Box;
55
 
class Fl_Float_Input;
56
 
 
57
 
class cFreqControl : public Fl_Group {
58
 
friend void cbSelectDigit (Fl_Widget *btn, void * nbr);
59
 
public:
60
 
        cFreqControl(int x, int y, int w, int h, const char *lbl = "7");
61
 
        ~cFreqControl();
62
 
        void updatevalue();
63
 
        void value(long lv);
64
 
        long value(){return val;};
65
 
        void font(Fl_Font fnt);
66
 
        void SetONCOLOR (uchar r, uchar g, uchar b);
67
 
        void SetOFFCOLOR (uchar r, uchar g, uchar b);
68
 
        void GetONCOLOR (uchar &r, uchar &g, uchar &b) {
69
 
                        Fl::get_color(ONCOLOR, r, g, b);
70
 
        };
71
 
        void GetOFFCOLOR (uchar &r, uchar &g, uchar &b) {
72
 
                        Fl::get_color(OFFCOLOR, r, g, b);
73
 
        };
74
 
        void SetONOFFCOLOR( Fl_Color, Fl_Color);
75
 
        void setCallBack (int (*cbf)() ){ cbFunc = cbf;};
76
 
        void do_callback() { if (cbFunc) cbFunc(); }
77
 
        int  handle(int event);
78
 
        void visual_beep();
79
 
 
80
 
        void resize (int X, int Y, int W, int H);
81
 
 
82
 
        void set_precision(int val) {
83
 
                switch (val) {
84
 
                        case 100:
85
 
                                dpoint = 1; precision = 100; break;
86
 
                        case 10:
87
 
                                dpoint = 2; precision = 10; break;
88
 
                        default:
89
 
                                dpoint = 3; precision = 1; break;
90
 
                }
91
 
        }
92
 
 
93
 
        void set_ndigits(int val);
94
 
 
95
 
private:
96
 
        Fl_Repeat_Button                *Digit[MAX_DIGITS];
97
 
        Fl_Float_Input                  *finp;
98
 
        static const char               *Label[];
99
 
        int                                     mult[MAX_DIGITS];
100
 
        Fl_Box                          *decbx;
101
 
        Fl_Box                          *hfill1;
102
 
        Fl_Box                          *hfill2;
103
 
        Fl_Font  font_number;
104
 
        Fl_Color OFFCOLOR;
105
 
        Fl_Color ONCOLOR;
106
 
        Fl_Color SELCOLOR;
107
 
        Fl_Color ILLUMCOLOR;
108
 
        int nD;
109
 
        int active;
110
 
        long maxVal;
111
 
        long minVal;
112
 
 
113
 
        int pw; // decimal width
114
 
        int wfill;
115
 
        int bdr;
116
 
        int fcWidth;
117
 
        int fcTop;
118
 
        int fcHeight;
119
 
        int W;
120
 
 
121
 
        void DecFreq(int n);
122
 
        void IncFreq(int n);
123
 
        int (*cbFunc)();
124
 
        static void freq_input_cb(Fl_Widget* input, void* arg);
125
 
protected:
126
 
        long val, oldval;
127
 
        int  precision;
128
 
        int  dpoint;
129
 
};
130
 
 
131
 
#endif