1 // ---------------------------------------------------------------------------- 2 // Copyright (C) 2014 3 // David Freese, W1HKJ 4 // 5 // This file is part of fldigi 6 // 7 // fldigi is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License as published by 9 // the Free Software Foundation; either version 3 of the License, or 10 // (at your option) any later version. 11 // 12 // fldigi 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 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program. If not, see <http://www.gnu.org/licenses/>. 19 // ---------------------------------------------------------------------------- 20 21 #ifndef PSK_BROWSER_H 22 #define PSK_BROWSER_H 23 24 #include <FL/Fl.H> 25 #include <FL/Fl_Double_Window.H> 26 #include <FL/Fl_Button.H> 27 #include <FL/Fl_Hold_Browser.H> 28 29 #include <string> 30 31 #include <config.h> 32 #include "viewpsk.h" 33 #include "globals.h" 34 #include "charsetdistiller.h" 35 36 #include "re.h" 37 38 #define BWSR_BORDER 2 39 40 class pskBrowser : public Fl_Hold_Browser{ 41 private: 42 static std::string hilite_color_1; 43 static std::string hilite_color_2; 44 static std::string white; 45 static std::string bkgnd[]; 46 47 std::string fline; 48 std::string nuline; 49 50 std::string bwsrline[MAXCHANNELS]; 51 int bwsrfreq[MAXCHANNELS]; 52 struct {bool regex_alert; bool mycall_alert;} alerted[MAXCHANNELS]; 53 54 CharsetDistiller *cdistiller; 55 56 int labelwidth[VIEWER_LABEL_NTYPES]; 57 58 Fl_Font fnt; 59 Fl_Color HiLite_1; 60 Fl_Color HiLite_2; 61 Fl_Color BkSelect; 62 Fl_Color Backgnd1; 63 Fl_Color Backgnd2; 64 65 int siz; 66 int cols[2]; 67 char szLine[32]; 68 size_t nchars; 69 size_t linechars[32]; 70 71 public: 72 static int cwidth; 73 static int cheight; 74 static int sbarwidth; 75 76 long long rfc; 77 bool usb; 78 fre_t *seek_re; 79 80 public: 81 pskBrowser(int x, int y, int w, int h, const char *l = ""); 82 ~pskBrowser(); 83 void makecolors(); 84 void evalcwidth(); setfont(Fl_Font font,int sz)85 void setfont(Fl_Font font, int sz) { fnt = font; siz = sz; evalcwidth();} HighLight_1(Fl_Color clr)86 void HighLight_1(Fl_Color clr) { HiLite_1 = clr; } HighLight_1()87 Fl_Color HighLight_1() { return HiLite_1; } HighLight_2(Fl_Color clr)88 void HighLight_2(Fl_Color clr) { HiLite_2 = clr; } HighLight_2()89 Fl_Color HighLight_2() { return HiLite_2; } SelectColor(Fl_Color clr)90 void SelectColor(Fl_Color clr) { BkSelect = clr; } SelectColor()91 Fl_Color SelectColor() { return BkSelect; } Background1(Fl_Color clr)92 void Background1(Fl_Color clr) { Backgnd1 = clr; } Background1()93 Fl_Color Background1() { return Backgnd1; } Background2(Fl_Color clr)94 void Background2(Fl_Color clr) { Backgnd2 = clr; } Background2()95 Fl_Color Background2() { return Backgnd2; } columns(int a)96 void columns(int a) { cols[0] = a; cols[1] = 0; column_widths(cols); } 97 void resize(int x, int y, int w, int h); 98 void addchr(int ch, int freq, unsigned char c, int md, bool alert = false); 99 std::string freqformat (int i); 100 void set_freq(int i, int freq); clearline(int i)101 void clearline(int i) { bwsrline[i] = ""; } line(int i)102 std::string line(int i) { return (i < 1 ? "" : i > MAXCHANNELS ? "" : bwsrline[i - 1]); } 103 int freq(int i); 104 void clear(); 105 void clearch(int n, int freq); 106 void swap(int, int); numchars()107 int numchars() { return nchars; } 108 void set_input_encoding(int encoding_id); 109 }; 110 111 #endif 112