Smeter PWRmeter

* Added resize methods to both classes
pull/4/head
David Freese 2015-11-23 18:40:03 -06:00
rodzic e08e403757
commit 482d0606c8
5 zmienionych plików z 103 dodań i 4 usunięć

Wyświetl plik

@ -3990,6 +3990,11 @@ UI_return:
text_panel->position( orgx, orgy, nux, nuy);
RigControlFrame->init_sizes();
RigControlFrame->redraw();
smeter->redraw();
pwrmeter->redraw();
center_group->redraw();
wefax_group->redraw();
fsq_group->redraw();

Wyświetl plik

@ -69,6 +69,7 @@ public:
void value(double v) { value_ = v; redraw(); }
double value() const { return (value_); }
void resize(int x, int y, int w, int h);
void set_background(Fl_Color c1) { bgnd_ = c1; redraw(); }
void set_metercolor(Fl_Color c2) { fgnd_ = c2; redraw(); }
@ -83,5 +84,6 @@ private:
void select_200W();
};
#endif // !pwrmeter

Wyświetl plik

@ -76,6 +76,7 @@ public:
redraw();
}
double value() const { return (value_); }
void resize(int x, int y, int w, int h);
void set_background(Fl_Color c1) { bgnd_ = c1; redraw(); }
void set_metercolor(Fl_Color c2) { fgnd_ = c2; redraw(); }

Wyświetl plik

@ -132,10 +132,10 @@ void PWRmeter::select( int sel ) {
redraw();
}
const char * PWRmeter::W25_face = "| : : : : | : : : : | : : : : | : : : : | : : : : | 25";
const char * PWRmeter::W50_face = "| : | : | : | : | : | 50";
const char * PWRmeter::W100_face = "| | | | | | | | | | | 100";
const char * PWRmeter::W200_face = "| : | : | : | : | 200";
const char * PWRmeter::W25_face = "| : : : : | : : : : | : : : : | : : : : | : : : 25|";
const char * PWRmeter::W50_face = "| : | : | : | : | : 50|";
const char * PWRmeter::W100_face = "| | | | | | | | | | 100|";
const char * PWRmeter::W200_face = "| : | : | : | : 200|";
PWRmeter::PWRmeter(int X, int Y, int W, int H, const char* l)
: Fl_Widget(X, Y, W, H, "")
@ -188,6 +188,63 @@ PWRmeter::PWRmeter(int X, int Y, int W, int H, const char* l)
meter_width -= fl_width("| 100");
}
void PWRmeter::resize(int X, int Y, int W, int H) {
Fl_Widget::resize(X,Y,W,H);
bx = Fl::box_dx(box());
by = Fl::box_dy(box());
bw = Fl::box_dw(box());
bh = Fl::box_dh(box());
tx = X + bx;
tw = W - bw;
ty = Y + by;
th = H - bh;
const char *face;
switch (select_) {
case P25:
face = W25_face;
break;
case P50:
face = W50_face;
break;
case P100:
face = W100_face;
break;
case P200:
face = W200_face;
break;
case AUTO:
default:
face = W25_face;
}
static int fsize = 6;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(face);
while ((meter_width < tw) && (fl_height() < th)) {
fsize++;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(face);
}
fsize--;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(face);
meter_height = fl_height();
label(face);
labelfont(FL_HELVETICA);
labelsize(fsize);
labelcolor(scale_color);
sx = (tw - meter_width) / 2 + fl_width("|") / 2;
meter_width -= fl_width("| 100");
}
//
// End of PWRmeter.cxx
//

Wyświetl plik

@ -98,6 +98,40 @@ Smeter::Smeter(int X, int Y, int W, int H, const char* l)
sx = (tw - meter_width) / 2;
}
void Smeter::resize(int X, int Y, int W, int H) {
Fl_Widget::resize(X,Y,W,H);
bx = Fl::box_dx(box());
by = Fl::box_dy(box());
bw = Fl::box_dw(box());
bh = Fl::box_dh(box());
tx = X + bx;
tw = W - bw;
ty = Y + by;
th = H - bh;
static int fsize = 6;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(meter_face);
while ((meter_width < tw) && (fl_height() < th)) {
fsize++;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(meter_face);
}
fsize--;
fl_font(FL_HELVETICA, fsize);
meter_width = fl_width(meter_face);
meter_height = fl_height();
label(meter_face);
labelfont(FL_HELVETICA);
labelsize(fsize);
labelcolor(scale_color);
meter_width -= fl_width("|");
sx = (tw - meter_width) / 2;
}
//
// End of Smeter.cxx
//