LMMS
Loading...
Searching...
No Matches
Fl_Osc_VSlider.cpp
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 Fl_Osc_VSlider.cpp - OSC Based Vertical Slider
5 Copyright (C) 2016 Mark McCurry
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11*/
12#include <FL/Fl.H>
13#include <FL/fl_draw.H>
14#include "Fl_Osc_VSlider.H"
15#include "Fl_Osc_Interface.h"
16#include "Fl_Osc_Pane.H"
17#include <cstdlib>
18#include <cstring>
19#include <cmath>
20#include <cassert>
21#include <sstream>
22
23Fl_Osc_VSlider::Fl_Osc_VSlider(int X, int Y, int W, int H, const char *label)
24 :Fl_Osc_Slider(X,Y,W,H,label)
25{
26 //bounds(0.0f,1.0f);
27 Fl_Slider::callback(Fl_Osc_Slider::_cb);
28 textfont_ = FL_HELVETICA;
29 textsize_ = 10;
30 textcolor_ = FL_FOREGROUND_COLOR;
31}
32
35
36void Fl_Osc_VSlider::init(std::string path_, char type_)
37{
38 Fl_Osc_Slider::init(path_, type_);
39}
40
42 int sxx = x(), syy = y(), sww = w(), shh = h();
43 int bxx = x(), byy = y(), bww = w(), bhh = h();
44 if (horizontal()) {
45 bww = 35; sxx += 35; sww -= 35;
46 } else {
47 syy += 25; bhh = 25; shh -= 25;
48 }
49 if (damage()&FL_DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color());
50 Fl_Osc_Slider::draw(sxx+Fl::box_dx(box()),
51 syy+Fl::box_dy(box()),
52 sww-Fl::box_dw(box()),
53 shh-Fl::box_dh(box()));
54 draw_box(box(),bxx,byy,bww,bhh,color());
55 char buf[128];
56 format(buf);
57 fl_font(textfont(), textsize());
58 fl_color(active_r() ? textcolor() : fl_inactive(textcolor()));
59 fl_draw(buf, bxx, byy, bww, bhh, FL_ALIGN_CLIP);
60}
61
63{
64 if (ev == FL_PUSH && Fl::visible_focus()) {
65 Fl::focus(this);
66 redraw();
67 }
68 int sxx = x(), syy = y(), sww = w(), shh = h();
69 if (horizontal()) {
70 sxx += 35; sww -= 35;
71 } else {
72 syy += 25; shh -= 25;
73 }
74
75 return Fl_Osc_Slider::handle(ev,
76 sxx+Fl::box_dx(box()),
77 syy+Fl::box_dy(box()),
78 sww-Fl::box_dw(box()),
79 shh-Fl::box_dh(box()));
80}
Fl_Osc_Slider(int X, int Y, int W, int H, const char *label=NULL)
Definition Fl_Osc_Slider.cpp:28
int handle(int ev, int X, int Y, int W, int H)
Definition Fl_Osc_Slider.cpp:90
void init(std::string, char type='f')
Definition Fl_Osc_Slider.cpp:36
static void _cb(Fl_Widget *w, void *)
Definition Fl_Osc_Slider.cpp:252
int handle(int)
Definition Fl_Osc_VSlider.cpp:62
Fl_Fontsize textsize() const
Definition Fl_Osc_VSlider.H:37
void init(std::string, char type='i')
Definition Fl_Osc_VSlider.cpp:36
Fl_Color textcolor() const
Definition Fl_Osc_VSlider.H:39
Fl_Font textfont() const
Definition Fl_Osc_VSlider.H:35
virtual ~Fl_Osc_VSlider(void)
Definition Fl_Osc_VSlider.cpp:33
Fl_Fontsize textsize_
Definition Fl_Osc_VSlider.H:25
Fl_Osc_VSlider(int X, int Y, int W, int H, const char *label=NULL)
Definition Fl_Osc_VSlider.cpp:23
Fl_Color textcolor_
Definition Fl_Osc_VSlider.H:26
void draw(void)
Definition Fl_Osc_VSlider.cpp:41
Fl_Font textfont_
Definition Fl_Osc_VSlider.H:24
UINT_D64 w
Definition inflate.c:942
int y
Definition inflate.c:1588
unsigned x[BMAX+1]
Definition inflate.c:1586
#define X(str)
Definition juce_LV2Common.h:197
Definition jquant2.c:258
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
_WDL_CSTRING_PREFIX void INT_PTR const char * format
Definition wdlcstring.h:263