configure steps for scales
This commit is contained in:
parent
7116369503
commit
feff1f6f05
|
@ -39,7 +39,8 @@ ChannelWidget::ChannelWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::
|
|||
x->get_widget("volumeLabel", volumeLabel);
|
||||
x->get_widget("volumeScale", volumeScale);
|
||||
|
||||
volumeScale->set_value(100);
|
||||
volumeScale->set_value(100.0);
|
||||
volumeScale->set_increments(100.0/PA_VOLUME_NORM, 100.0/PA_VOLUME_NORM);
|
||||
|
||||
volumeScale->signal_value_changed().connect(sigc::mem_fun(*this, &ChannelWidget::onVolumeScaleValueChanged));
|
||||
}
|
||||
|
@ -116,13 +117,16 @@ void ChannelWidget::set_sensitive(bool enabled) {
|
|||
|
||||
void ChannelWidget::setBaseVolume(pa_volume_t v) {
|
||||
|
||||
volumeScale->clear_marks();
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 0.0, (GtkPositionType) GTK_POS_BOTTOM, _("<small>Silence</small>"));
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 100.0, (GtkPositionType) GTK_POS_BOTTOM, _("<small>Max</small>"));
|
||||
|
||||
if (v > PA_VOLUME_MUTED && v < PA_VOLUME_NORM) {
|
||||
double p = ((double) v * 100) / PA_VOLUME_NORM;
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), p, (GtkPositionType) GTK_POS_BOTTOM, NULL);
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), p, (GtkPositionType) GTK_POS_BOTTOM, _("<small><i>Base</i></small>"));
|
||||
}
|
||||
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 0.0, (GtkPositionType) GTK_POS_BOTTOM, NULL);
|
||||
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 100.0, (GtkPositionType) GTK_POS_BOTTOM, NULL);
|
||||
}
|
||||
|
||||
void ChannelWidget::setSteps(unsigned n) {
|
||||
volumeScale->set_increments(100.0/(n-1), 100.0/(n-1));
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
virtual void set_sensitive(bool enabled);
|
||||
virtual void setBaseVolume(pa_volume_t);
|
||||
virtual void setSteps(unsigned n);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
|
|||
is_new = true;
|
||||
|
||||
w->setBaseVolume(info.base_volume);
|
||||
w->setSteps(info.n_volume_steps);
|
||||
}
|
||||
|
||||
w->updating = true;
|
||||
|
@ -315,6 +316,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
|
|||
is_new = true;
|
||||
|
||||
w->setBaseVolume(info.base_volume);
|
||||
w->setSteps(info.n_volume_steps);
|
||||
|
||||
if (pa_context_get_server_protocol_version(get_context()) >= 13)
|
||||
createMonitorStreamForSource(info.index);
|
||||
|
|
|
@ -107,3 +107,9 @@ void StreamWidget::setBaseVolume(pa_volume_t v) {
|
|||
if (channelMap.channels > 0)
|
||||
channelWidgets[channelMap.channels-1]->setBaseVolume(v);
|
||||
}
|
||||
|
||||
void StreamWidget::setSteps(unsigned n) {
|
||||
|
||||
for (int i = 0; i < channelMap.channels; i++)
|
||||
channelWidgets[channelMap.channels-1]->setSteps(n);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
virtual void executeVolumeUpdate();
|
||||
virtual void setBaseVolume(pa_volume_t v);
|
||||
virtual void setSteps(unsigned n);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue