1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2014
3 //              David Freese, W1HKJ
4 //
5 // This file is part of flmsg
6 //
7 // flrig 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 // flrig 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 #include "gettext.h"
22 #include "status.h"
23 #include "util.h"
24 
25 #include "flmsg_dialog.h"
26 #include "flmsg.h"
27 
28 Fl_Group	*tab_plaintext = (Fl_Group *)0;
29 Fl_Input2	*txt_pt_title = (Fl_Input2 *)0;
30 Fl_Input2	*txt_pt_to = (Fl_Input2 *)0;
31 Fl_Input2	*txt_pt_fm = (Fl_Input2 *)0;
32 Fl_Input2	*txt_pt_subj = (Fl_Input2 *)0;
33 FTextEdit	*txt_pt_msg = (FTextEdit *)0;
34 Fl_DateInput	*txt_pt_date = (Fl_DateInput *)0;
35 Fl_Button	*btn_pt_date = (Fl_Button *)0;
36 Fl_Input2	*txt_pt_time = (Fl_Input2 *)0;
37 Fl_Button	*btn_pt_time = (Fl_Button *)0;
38 
cb_btn_pt_date(Fl_Button *,void *)39 static void cb_btn_pt_date(Fl_Button*, void*) {
40   cb_set_pt_date();
41 }
42 
cb_btn_pt_time(Fl_Button *,void *)43 static void cb_btn_pt_time(Fl_Button*, void*) {
44   cb_set_pt_time();
45 }
46 
plain_changed(Fl_Widget *,void *)47 void plain_changed(Fl_Widget *, void *)
48 {
49 	estimate();
50 }
51 
create_plaintext_tab()52 void create_plaintext_tab()
53 {
54 	int Y = tab_top + 4;
55 	tab_plaintext = new Fl_Group(0, Y, 570, 380);
56 	tab_plaintext->align(FL_ALIGN_TOP);
57 
58 	txt_pt_title = new Fl_Input2(41, Y, 525, 24, _("Title"));
59 	txt_pt_title->tooltip(_("Addressee"));
60 	txt_pt_title->box(FL_DOWN_BOX);
61 	txt_pt_title->color((Fl_Color)FL_BACKGROUND2_COLOR);
62 	txt_pt_title->selection_color((Fl_Color)FL_SELECTION_COLOR);
63 	txt_pt_title->labeltype(FL_NORMAL_LABEL);
64 	txt_pt_title->labelfont(0);
65 	txt_pt_title->labelsize(14);
66 	txt_pt_title->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
67 	txt_pt_title->align(FL_ALIGN_LEFT);
68 	txt_pt_title->callback(plain_changed);
69 	txt_pt_title->when(FL_WHEN_CHANGED);
70 
71 	txt_pt_to = new Fl_Input2(42, Y+25, 320, 24, _("To"));
72 	txt_pt_to->tooltip(_("Addressee"));
73 	txt_pt_to->box(FL_DOWN_BOX);
74 	txt_pt_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
75 	txt_pt_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
76 	txt_pt_to->labeltype(FL_NORMAL_LABEL);
77 	txt_pt_to->labelfont(0);
78 	txt_pt_to->labelsize(14);
79 	txt_pt_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
80 	txt_pt_to->align(FL_ALIGN_LEFT);
81 	txt_pt_to->callback(plain_changed);
82 	txt_pt_to->when(FL_WHEN_CHANGED);
83 
84 	txt_pt_fm = new Fl_Input2(42, Y+50, 320, 24, _("Fm"));
85 	txt_pt_fm->tooltip(_("Originator"));
86 	txt_pt_fm->box(FL_DOWN_BOX);
87 	txt_pt_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
88 	txt_pt_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
89 	txt_pt_fm->labeltype(FL_NORMAL_LABEL);
90 	txt_pt_fm->labelfont(0);
91 	txt_pt_fm->labelsize(14);
92 	txt_pt_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
93 	txt_pt_fm->align(FL_ALIGN_LEFT);
94 	txt_pt_fm->callback(plain_changed);
95 	txt_pt_fm->when(FL_WHEN_CHANGED);
96 
97 	txt_pt_subj = new Fl_Input2(42, Y+75, 525, 24, _("Sub."));
98 	txt_pt_subj->tooltip(_("Subject"));
99 	txt_pt_subj->box(FL_DOWN_BOX);
100 	txt_pt_subj->color((Fl_Color)FL_BACKGROUND2_COLOR);
101 	txt_pt_subj->selection_color((Fl_Color)FL_SELECTION_COLOR);
102 	txt_pt_subj->labeltype(FL_NORMAL_LABEL);
103 	txt_pt_subj->labelfont(0);
104 	txt_pt_subj->labelsize(14);
105 	txt_pt_subj->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
106 	txt_pt_subj->align(FL_ALIGN_LEFT);
107 	txt_pt_subj->callback(plain_changed);
108 	txt_pt_subj->when(FL_WHEN_CHANGED);
109 
110 	txt_pt_msg = new FTextEdit(4, Y+125, 562, 250, _("Message:"));
111 	txt_pt_msg->box(FL_DOWN_FRAME);
112 	txt_pt_msg->color((Fl_Color)FL_BACKGROUND2_COLOR);
113 	txt_pt_msg->selection_color((Fl_Color)FL_SELECTION_COLOR);
114 	txt_pt_msg->labeltype(FL_NORMAL_LABEL);
115 	txt_pt_msg->labelfont(0);
116 	txt_pt_msg->labelsize(14);
117 	txt_pt_msg->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
118 	txt_pt_msg->align(FL_ALIGN_TOP_LEFT);
119 	txt_pt_msg->callback(plain_changed);
120 	txt_pt_msg->when(FL_WHEN_CHANGED);
121 	Fl_Group::current()->resizable(txt_pt_msg);
122 
123 	txt_pt_date = new Fl_DateInput(404, Y+25, 125, 24, _("Date"));
124 	txt_pt_date->tooltip(_("Date of origination"));
125 	txt_pt_date->box(FL_DOWN_BOX);
126 	txt_pt_date->color((Fl_Color)FL_BACKGROUND2_COLOR);
127 	txt_pt_date->selection_color((Fl_Color)FL_SELECTION_COLOR);
128 	txt_pt_date->labeltype(FL_NORMAL_LABEL);
129 	txt_pt_date->labelfont(0);
130 	txt_pt_date->labelsize(14);
131 	txt_pt_date->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
132 	txt_pt_date->align(FL_ALIGN_LEFT);
133 	txt_pt_date->callback(plain_changed);
134 	txt_pt_date->when(FL_WHEN_CHANGED);
135 
136 	btn_pt_date = new Fl_Button(537, Y+27, 20, 20, _("..."));
137 	btn_pt_date->tooltip(_("Set today"));
138 	btn_pt_date->callback((Fl_Callback*)cb_btn_pt_date);
139 
140 	txt_pt_time = new Fl_Input2(404, Y+50, 125, 24, _("Time"));
141 	txt_pt_time->tooltip(_("Time of origination"));
142 	txt_pt_time->box(FL_DOWN_BOX);
143 	txt_pt_time->color((Fl_Color)FL_BACKGROUND2_COLOR);
144 	txt_pt_time->selection_color((Fl_Color)FL_SELECTION_COLOR);
145 	txt_pt_time->labeltype(FL_NORMAL_LABEL);
146 	txt_pt_time->labelfont(0);
147 	txt_pt_time->labelsize(14);
148 	txt_pt_time->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
149 	txt_pt_time->align(FL_ALIGN_LEFT);
150 	txt_pt_time->callback(plain_changed);
151 	txt_pt_time->when(FL_WHEN_CHANGED);
152 
153 	btn_pt_time = new Fl_Button(537, Y+52, 20, 20, _("..."));
154 	btn_pt_time->tooltip(_("Set time now"));
155 	btn_pt_time->callback((Fl_Callback*)cb_btn_pt_time);
156 
157 	tab_plaintext->end();
158 
159 	tab_plaintext->hide();
160 }
161