Skip to content

Commit c03a379

Browse files
committed
gui/component: Remove conditional macros for slider graphics and labels
1 parent e8b582e commit c03a379

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

src/dmt/gui/component/LinearSliderComponent.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@
4343

4444
//==============================================================================
4545

46-
// Define to 1 to exclude the main slider graphics
47-
#define DMT_EXCLUDE_SLIDER_GRAPHICS 0
48-
49-
// Define to 1 to exclude title/info labels
50-
#define DMT_EXCLUDE_SLIDER_LABELS 0
46+
// Slider graphics and labels are always included; remove conditional macros
5147

5248
//==============================================================================
5349

@@ -112,20 +108,12 @@ class LinearSliderComponent
112108
TRACER("LinearSliderComponent::LinearSliderComponent");
113109
slider.addListener(this);
114110
updateLabel(static_cast<float>(slider.getValue()));
115-
#if DMT_EXCLUDE_SLIDER_GRAPHICS == 0
116111
addAndMakeVisible(slider);
117-
#endif
118-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
119112
addAndMakeVisible(this->infoLabel);
120-
#endif
121113

122114
if (_svgTitle) {
123115
titleIcon = dmt::icons::getIcon(_param);
124-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
125-
this->titleLabel.setVisible(false);
126-
#else
127116
this->titleLabel.setVisible(false);
128-
#endif
129117
}
130118

131119
this->parameter = _apvts.getParameter(_param);
@@ -166,36 +154,28 @@ class LinearSliderComponent
166154
const auto titleSliderBounds =
167155
titleLabelBounds.removeFromTop(titleLabelHeight)
168156
.reduced(titleLabelOffset);
169-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
170157
this->titleLabel.setBounds(titleSliderBounds);
171-
#endif
172158
auto infoLabelBounds = sliderBounds;
173159
const auto infoLabelHeight =
174160
static_cast<int32_t>(2 * infoFontSize * this->size);
175161
const auto infoLabelOffset = static_cast<int32_t>(9 * this->size);
176162
const auto infoSliderBounds =
177163
infoLabelBounds.removeFromBottom(infoLabelHeight)
178164
.reduced(infoLabelOffset);
179-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
180165
this->infoLabel.setBounds(infoSliderBounds);
181-
#endif
182166
}
183167
case Orientation::Vertical: {
184-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
185168
this->titleLabel.setBounds(
186169
bounds.withTrimmedTop(static_cast<int32_t>(padding)));
187170
this->infoLabel.setBounds(
188171
bounds.withTrimmedBottom(static_cast<int32_t>(padding)));
189-
#endif
190172

191173
auto sliderBounds = bounds;
192174
sliderBounds.removeFromTop(
193175
static_cast<int32_t>(titleFontSize * this->size + padding));
194176
sliderBounds.removeFromBottom(
195177
static_cast<int32_t>(infoFontSize * this->size + padding));
196-
#if DMT_EXCLUDE_SLIDER_GRAPHICS == 0
197178
slider.setBounds(sliderBounds);
198-
#endif
199179
}
200180
}
201181
}

src/dmt/gui/component/RotarySliderComponent.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@
4343

4444
//==============================================================================
4545

46-
// Define to 1 to exclude the main slider graphics
47-
#define DMT_EXCLUDE_SLIDER_GRAPHICS 0
48-
49-
// Define to 1 to exclude title/info labels
50-
#define DMT_EXCLUDE_SLIDER_LABELS 0
46+
// Slider graphics and labels are always included; remove conditional macros
5147

5248
//==============================================================================
5349

@@ -107,9 +103,7 @@ class RotarySliderComponent
107103
TRACER("RotarySliderComponent::RotarySliderComponent");
108104
slider.addListener(this);
109105
updateLabel(static_cast<float>(slider.getValue()));
110-
#if DMT_EXCLUDE_SLIDER_GRAPHICS == 0
111106
addAndMakeVisible(slider);
112-
#endif
113107
// Set up context menu callback for host automation and parameter actions
114108
slider.onContextMenuRequested = [this]() {
115109
this->showContextMenuForSlider();
@@ -131,18 +125,14 @@ class RotarySliderComponent
131125
auto sliderBounds = bounds;
132126
const auto sliderSize =
133127
static_cast<int>(rawSliderSize * sliderBounds.getHeight());
134-
#if DMT_EXCLUDE_SLIDER_GRAPHICS == 0
135128
slider.setBounds(sliderBounds.removeFromTop(sliderSize));
136-
#endif
137129
const int labelPadding = static_cast<int>(padding * 0.5f);
138130
auto labelsBounds = bounds.reduced(labelPadding);
139131
const auto labelsSize =
140132
static_cast<int>(rawLabelsSize * labelsBounds.getHeight());
141133
labelsBounds = labelsBounds.removeFromBottom(labelsSize);
142-
#if DMT_EXCLUDE_SLIDER_LABELS == 0
143134
this->titleLabel.setBounds(labelsBounds);
144135
this->infoLabel.setBounds(labelsBounds);
145-
#endif
146136
}
147137

148138
/**

0 commit comments

Comments
 (0)