kopia lustrzana https://github.com/jamescoxon/dl-fldigi
				
				
				
			Freq Control Font
Modified Frequency Control widget to allow selection of font Added configuration item and support to allow user to select font used for the Frequency Control.pull/2/head
							rodzic
							
								
									5b7e839057
								
							
						
					
					
						commit
						54a056907f
					
				|  | @ -92,6 +92,23 @@ void cbViewerFontBrowser(Fl_Widget*, void*) { | |||
|     font_browser->hide(); | ||||
| } | ||||
| 
 | ||||
| void cbFreqControlFontBrowser(Fl_Widget*, void*) { | ||||
|   Fl_Font fnt = font_browser->fontNumber(); | ||||
|     progdefaults.FreqControlFontnbr = fnt; | ||||
|     progdefaults.changed = true; | ||||
| 
 | ||||
|     FDdisplay->labelfont(progdefaults.FreqControlFontnbr); | ||||
|     FDdisplay->redraw(); | ||||
|     qsoFreqDisp1->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp2->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp3->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp1->redraw(); | ||||
|     qsoFreqDisp2->redraw(); | ||||
|     qsoFreqDisp3->redraw(); | ||||
|      | ||||
|     font_browser->hide(); | ||||
| } | ||||
| 
 | ||||
| Fl_Double_Window *dlgColorFont=(Fl_Double_Window *)0; | ||||
| 
 | ||||
| Fl_Button *btnClrFntClose=(Fl_Button *)0; | ||||
|  | @ -104,6 +121,18 @@ Fl_Tabs *tabsColors=(Fl_Tabs *)0; | |||
| 
 | ||||
| Fl_Box *FDdisplay=(Fl_Box *)0; | ||||
| 
 | ||||
| Fl_Button *btn_freq_control_font=(Fl_Button *)0; | ||||
| 
 | ||||
| static void cb_btn_freq_control_font(Fl_Button*, void*) { | ||||
|   font_browser->fontNumber(progdefaults.FreqControlFontnbr); | ||||
|     font_browser->fontSize(14); | ||||
|     font_browser->fontColor(FL_FOREGROUND_COLOR); | ||||
|     font_browser->fontFilter(Font_Browser::FIXED_WIDTH); | ||||
|     font_browser->fontFilter(Font_Browser::ALL_TYPES); | ||||
|     font_browser->callback(cbFreqControlFontBrowser); | ||||
| font_browser->show(); | ||||
| } | ||||
| 
 | ||||
| Fl_Button *btnBackgroundColor=(Fl_Button *)0; | ||||
| 
 | ||||
| static void cb_btnBackgroundColor(Fl_Button*, void*) { | ||||
|  | @ -723,21 +752,25 @@ Fl_Double_Window* make_colorsfonts() { | |||
|     } // Fl_Button* btnClrFntClose
 | ||||
|     { tabsColors = new Fl_Tabs(0, 5, 375, 185); | ||||
|       { Fl_Group* o = new Fl_Group(5, 30, 365, 150, _("Freq Disp")); | ||||
|         { Fl_Box* o = FDdisplay = new Fl_Box(100, 45, 45, 67, _("8")); | ||||
|         { Fl_Box* o = FDdisplay = new Fl_Box(65, 43, 235, 45, _("14070.150")); | ||||
|           FDdisplay->box(FL_DOWN_BOX); | ||||
|           FDdisplay->color((Fl_Color)55); | ||||
|           FDdisplay->labelfont(4); | ||||
|           FDdisplay->labelsize(48); | ||||
|           FDdisplay->labelsize(40); | ||||
|           o->color(fl_rgb_color(progdefaults.FDbackground.R,progdefaults.FDbackground.G,progdefaults.FDbackground.B)); | ||||
|           o->labelcolor(fl_rgb_color(progdefaults.FDforeground.R,progdefaults.FDforeground.G,progdefaults.FDforeground.B)); | ||||
|           o->labelfont(progdefaults.FreqControlFontnbr); | ||||
|         } // Fl_Box* FDdisplay
 | ||||
|         { btnBackgroundColor = new Fl_Button(165, 45, 100, 30, _("Background")); | ||||
|         { btn_freq_control_font = new Fl_Button(144, 96, 87, 24, _("Font")); | ||||
|           btn_freq_control_font->callback((Fl_Callback*)cb_btn_freq_control_font); | ||||
|         } // Fl_Button* btn_freq_control_font
 | ||||
|         { btnBackgroundColor = new Fl_Button(35, 131, 87, 24, _("Bg Color")); | ||||
|           btnBackgroundColor->callback((Fl_Callback*)cb_btnBackgroundColor); | ||||
|         } // Fl_Button* btnBackgroundColor
 | ||||
|         { btnForegroundColor = new Fl_Button(165, 85, 100, 30, _("Foreground")); | ||||
|         { btnForegroundColor = new Fl_Button(144, 131, 87, 24, _("Digit Color")); | ||||
|           btnForegroundColor->callback((Fl_Callback*)cb_btnForegroundColor); | ||||
|         } // Fl_Button* btnForegroundColor
 | ||||
|         { btnFD_SystemColor = new Fl_Button(165, 125, 100, 30, _("System")); | ||||
|         { btnFD_SystemColor = new Fl_Button(259, 131, 87, 24, _("Sys Colors")); | ||||
|           btnFD_SystemColor->callback((Fl_Callback*)cb_btnFD_SystemColor); | ||||
|         } // Fl_Button* btnFD_SystemColor
 | ||||
|         o->end(); | ||||
|  |  | |||
|  | @ -114,11 +114,29 @@ Function {cbViewerFontBrowser(Fl_Widget*, void*)} {open return_type void | |||
|     font_browser->hide();} {} | ||||
| }  | ||||
| 
 | ||||
| Function {cbFreqControlFontBrowser(Fl_Widget*, void*)} {open return_type void | ||||
| } { | ||||
|   code {Fl_Font fnt = font_browser->fontNumber(); | ||||
|     progdefaults.FreqControlFontnbr = fnt; | ||||
|     progdefaults.changed = true; | ||||
| 
 | ||||
|     FDdisplay->labelfont(progdefaults.FreqControlFontnbr); | ||||
|     FDdisplay->redraw(); | ||||
|     qsoFreqDisp1->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp2->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp3->font(progdefaults.FreqControlFontnbr); | ||||
|     qsoFreqDisp1->redraw(); | ||||
|     qsoFreqDisp2->redraw(); | ||||
|     qsoFreqDisp3->redraw(); | ||||
|      | ||||
|     font_browser->hide();} {} | ||||
| }  | ||||
| 
 | ||||
| Function {make_colorsfonts()} {open | ||||
| } { | ||||
|   code {font_browser = new Font_Browser;} {} | ||||
|   Fl_Window dlgColorFont { | ||||
|     label {Colors and Fonts} open selected | ||||
|     label {Colors and Fonts} open | ||||
|     xywh {496 125 375 220} type Double | ||||
|     code0 {dlgColorFont->xclass(PACKAGE_TARNAME);} visible | ||||
|   } { | ||||
|  | @ -135,13 +153,25 @@ Function {make_colorsfonts()} {open | |||
|         xywh {5 30 365 150} | ||||
|       } { | ||||
|         Fl_Box FDdisplay { | ||||
|           label 8 | ||||
|           xywh {100 45 45 67} box DOWN_BOX color 55 labelfont 4 labelsize 48 | ||||
|           label {14070.150} selected | ||||
|           xywh {65 43 235 45} box DOWN_BOX color 55 labelfont 4 labelsize 40 | ||||
|           code0 {o->color(fl_rgb_color(progdefaults.FDbackground.R,progdefaults.FDbackground.G,progdefaults.FDbackground.B));} | ||||
|           code1 {o->labelcolor(fl_rgb_color(progdefaults.FDforeground.R,progdefaults.FDforeground.G,progdefaults.FDforeground.B));} | ||||
|           code2 {o->labelfont(progdefaults.FreqControlFontnbr);} | ||||
|         } | ||||
|         Fl_Button btn_freq_control_font { | ||||
|           label Font | ||||
|           callback {font_browser->fontNumber(progdefaults.FreqControlFontnbr); | ||||
|     font_browser->fontSize(14); | ||||
|     font_browser->fontColor(FL_FOREGROUND_COLOR); | ||||
|     font_browser->fontFilter(Font_Browser::FIXED_WIDTH); | ||||
|     font_browser->fontFilter(Font_Browser::ALL_TYPES); | ||||
|     font_browser->callback(cbFreqControlFontBrowser); | ||||
| font_browser->show();} | ||||
|           xywh {144 96 87 24} | ||||
|         } | ||||
|         Fl_Button btnBackgroundColor { | ||||
|           label Background | ||||
|           label {Bg Color} | ||||
|           callback {uchar r, g, b; | ||||
|     r = progdefaults.FDbackground.R; | ||||
|     g = progdefaults.FDbackground.G; | ||||
|  | @ -169,10 +199,10 @@ Function {make_colorsfonts()} {open | |||
|     } | ||||
| 
 | ||||
|     progdefaults.changed = true;} | ||||
|           xywh {165 45 100 30} | ||||
|           xywh {35 131 87 24} | ||||
|         } | ||||
|         Fl_Button btnForegroundColor { | ||||
|           label Foreground | ||||
|           label {Digit Color} | ||||
|           callback {uchar r, g, b; | ||||
|     r = progdefaults.FDforeground.R; | ||||
|     g = progdefaults.FDforeground.G; | ||||
|  | @ -200,10 +230,10 @@ Function {make_colorsfonts()} {open | |||
|     } | ||||
| 
 | ||||
|     progdefaults.changed = true;} | ||||
|           xywh {165 85 100 30} | ||||
|           xywh {144 131 87 24} | ||||
|         } | ||||
|         Fl_Button btnFD_SystemColor { | ||||
|           label System | ||||
|           label {Sys Colors} | ||||
|           callback {uchar r, g, b; | ||||
|     Fl_Color clr = FL_BACKGROUND2_COLOR; | ||||
| 
 | ||||
|  | @ -237,7 +267,7 @@ Function {make_colorsfonts()} {open | |||
|     } | ||||
|           | ||||
|     progdefaults.changed = true;} | ||||
|           xywh {165 125 100 30} | ||||
|           xywh {259 131 87 24} | ||||
|         } | ||||
|       } | ||||
|       Fl_Group {} { | ||||
|  |  | |||
|  | @ -3067,7 +3067,7 @@ void create_fl_digi_main_primary() { | |||
| 			qsoFreqDisp1->color(FL_BACKGROUND_COLOR); | ||||
| 			qsoFreqDisp1->selection_color(FL_BACKGROUND_COLOR); | ||||
| 			qsoFreqDisp1->labeltype(FL_NORMAL_LABEL); | ||||
| 			qsoFreqDisp1->labelfont(0); | ||||
| 			qsoFreqDisp1->font(progdefaults.FreqControlFontnbr); | ||||
| 			qsoFreqDisp1->labelsize(12); | ||||
| 			qsoFreqDisp1->labelcolor(FL_FOREGROUND_COLOR); | ||||
| 			qsoFreqDisp1->align(FL_ALIGN_CENTER); | ||||
|  | @ -3373,6 +3373,7 @@ void create_fl_digi_main_primary() { | |||
| 			qsoFreqDisp2->align(FL_ALIGN_CENTER); | ||||
| 			qsoFreqDisp2->when(FL_WHEN_RELEASE); | ||||
| 			qsoFreqDisp2->callback(qso_movFreq); | ||||
| 			qsoFreqDisp2->font(progdefaults.FreqControlFontnbr); | ||||
| 			qsoFreqDisp2->SetONOFFCOLOR( | ||||
| 				fl_rgb_color(	progdefaults.FDforeground.R, | ||||
| 								progdefaults.FDforeground.G, | ||||
|  | @ -3484,6 +3485,7 @@ void create_fl_digi_main_primary() { | |||
| 			qsoFreqDisp3->align(FL_ALIGN_CENTER); | ||||
| 			qsoFreqDisp3->when(FL_WHEN_RELEASE); | ||||
| 			qsoFreqDisp3->callback(qso_movFreq); | ||||
| 			qsoFreqDisp3->font(progdefaults.FreqControlFontnbr); | ||||
| 			qsoFreqDisp3->SetONOFFCOLOR( | ||||
| 				fl_rgb_color(	progdefaults.FDforeground.R, | ||||
| 								progdefaults.FDforeground.G, | ||||
|  |  | |||
|  | @ -55,6 +55,7 @@ public: | |||
| 	void updatevalue(); | ||||
| 	void value(long lv); | ||||
| 	long value(){return val;}; | ||||
| 	void font(Fl_Font n); | ||||
| 	void SetONCOLOR (uchar r, uchar g, uchar b); | ||||
| 	void SetOFFCOLOR (uchar r, uchar g, uchar b); | ||||
| 	void GetONCOLOR (uchar &r, uchar &g, uchar &b) { | ||||
|  | @ -73,6 +74,7 @@ private: | |||
| 	static const char	 	*Label[]; | ||||
| 	int					mult[MAX_DIGITS]; | ||||
| 	Fl_Box				*decbx; | ||||
| 	Fl_Font  font_number; | ||||
| 	Fl_Color OFFCOLOR; | ||||
| 	Fl_Color ONCOLOR; | ||||
| 	Fl_Color SELCOLOR; | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
| void selectColorsFonts(); | ||||
| void cbWaterfallFontBrowser(Fl_Widget*, void*); | ||||
| void cbViewerFontBrowser(Fl_Widget*, void*); | ||||
| void cbFreqControlFontBrowser(Fl_Widget*, void*); | ||||
| #include <FL/Fl_Double_Window.H> | ||||
| extern Fl_Double_Window *dlgColorFont; | ||||
| #include <FL/Fl_Button.H> | ||||
|  | @ -16,6 +17,7 @@ extern Fl_Tabs *tabsColors; | |||
| #include <FL/Fl_Group.H> | ||||
| #include <FL/Fl_Box.H> | ||||
| extern Fl_Box *FDdisplay; | ||||
| extern Fl_Button *btn_freq_control_font; | ||||
| extern Fl_Button *btnBackgroundColor; | ||||
| extern Fl_Button *btnForegroundColor; | ||||
| extern Fl_Button *btnFD_SystemColor; | ||||
|  |  | |||
|  | @ -992,6 +992,12 @@ | |||
|         ELEM_(int, WaterfallFontsize, "WATERFALLFONTSIZE",                              \ | ||||
|               "Waterfall font size",                                                    \ | ||||
|               12)                                                                       \ | ||||
|         ELEM_(std::string, FreqControlFontName, "FREQCONTROLFONTNAME",                  \ | ||||
|               "Frequency Control font name",                                            \ | ||||
|               "")                                                                       \ | ||||
|         ELEM_(Fl_Font, FreqControlFontnbr, "FREQCONTROLFONTNBR",                        \ | ||||
|               "Frequency Control font number",                                          \ | ||||
|               FL_COURIER)                                                               \ | ||||
|         ELEM_(std::string, ui_scheme, "UISCHEME",                                       \ | ||||
|               "FLTK UI scheme (none or base, gtk+, plastic)",                           \ | ||||
|               "gtk+")                                                                   \ | ||||
|  |  | |||
|  | @ -449,6 +449,7 @@ void configuration::saveDefaults() | |||
| 	TxFontName = Fl::get_font_name(TxFontnbr); | ||||
| 	WaterfallFontName = Fl::get_font_name(WaterfallFontnbr); | ||||
| 	ViewerFontName = Fl::get_font_name(ViewerFontnbr); | ||||
| 	FreqControlFontName = Fl::get_font_name(FreqControlFontnbr); | ||||
| 
 | ||||
| 	writeDefaultsXML(); | ||||
| 	changed = false; | ||||
|  | @ -983,5 +984,7 @@ void configuration::initFonts(void) | |||
| 		WaterfallFontnbr = font_number(WaterfallFontName.c_str()); | ||||
| 	if (!ViewerFontName.empty()) | ||||
| 		ViewerFontnbr = font_number(ViewerFontName.c_str()); | ||||
| 	if (!FreqControlFontName.empty()) | ||||
| 		FreqControlFontnbr = font_number(FreqControlFontName.c_str()); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -79,6 +79,7 @@ void cbSelectDigit (Fl_Widget *btn, void * nbr) | |||
| 
 | ||||
| cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl): | ||||
| 			  Fl_Group(x,y,w,h,"") { | ||||
| 	font_number = FL_COURIER; | ||||
| 	ONCOLOR = FL_YELLOW; | ||||
| 	OFFCOLOR = FL_BLACK; | ||||
| 	SELCOLOR = fl_rgb_color(100, 100, 100); | ||||
|  | @ -106,20 +107,20 @@ cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl): | |||
| 			fcHeight-4, | ||||
| 			" "); | ||||
| 		Digit[n]->box(FL_FLAT_BOX);	 | ||||
| 		Digit[n]->labelfont(FL_COURIER); | ||||
| 		Digit[n]->labelfont(font_number); | ||||
| 		Digit[n]->labelcolor(ONCOLOR); | ||||
| 		Digit[n]->color(OFFCOLOR, SELCOLOR); | ||||
| 		Digit[n]->labelsize(fcHeight); | ||||
| 		Digit[n]->labelsize(fcHeight-4); | ||||
| 		Digit[n]->callback(cbSelectDigit, (void *) n); | ||||
| 		mult[n] = max; | ||||
| 		max *= 10; | ||||
| 	} | ||||
| 	decbx = new Fl_Box(fcFirst + (nD - 3) * fcWidth + 2, fcTop + 2, pw, fcHeight-4,"."); | ||||
| 	decbx->box(FL_FLAT_BOX); | ||||
| 	decbx->labelfont(FL_COURIER); | ||||
| 	decbx->labelfont(font_number); | ||||
| 	decbx->labelcolor(ONCOLOR); | ||||
| 	decbx->color(OFFCOLOR); | ||||
| 	decbx->labelsize(fcHeight); | ||||
| 	decbx->labelsize(fcHeight-4); | ||||
| 	 | ||||
| 	cbFunc = NULL; | ||||
| 	maxVal = max * 10 - 1; | ||||
|  | @ -202,6 +203,15 @@ void cFreqControl::SetOFFCOLOR (uchar r, uchar g, uchar b) | |||
| 	damage(); | ||||
| } | ||||
| 
 | ||||
| void cFreqControl::font(Fl_Font fnt) | ||||
| { | ||||
| 	font_number = fnt; | ||||
| 	for (int n = 0; n < nD; n++) | ||||
| 		Digit[n]->labelfont(fnt); | ||||
| 	decbx->labelfont(fnt); | ||||
| 	damage(); | ||||
| } | ||||
| 
 | ||||
| static void blink_point(Fl_Widget* w) | ||||
| { | ||||
| 	w->label(*w->label() ? "" : "."); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 David Freese
						David Freese