void MainWindow::stop() { pause(); libvlc_media_player_stop(media_player); stop_button->Enable(false); setTimeline(0.0); timeline->Enable(false); }
void MainWindow::setTimeline(float value) { if(value < 0.0) value = 0.0; if(value > 1.0) value = 1.0; Disconnect(myID_TIMELINE); timeline->SetValue((int) (value * TIMELINE_MAX)); connectTimeline(); }
void MyFrame::OnChoice(wxCommandEvent& event) { int sel = event.GetSelection(); wxTaskBarButtonState state; switch(sel) { case 0: state = wxTASKBAR_BUTTON_NO_PROGRESS; break; case 1: state = wxTASKBAR_BUTTON_INDETERMINATE; break; case 2: state = wxTASKBAR_BUTTON_NORMAL; break; case 3: state = wxTASKBAR_BUTTON_ERROR; break; case 4: state = wxTASKBAR_BUTTON_PAUSED; break; default: state = wxTASKBAR_BUTTON_NO_PROGRESS; break; } MSWGetTaskBarButton()->SetProgressValue(m_slider->GetValue()); MSWGetTaskBarButton()->SetProgressState(state); }
void SjViewSettingsPage::GetFontFromDialog(wxString& fontFace, long& fontSize, long& columnWidth, long& coverHeight) { long i = m_fontFaceChoice->GetSelection(); if( i >= 0 ) { fontFace = m_fontFaceChoice->GetString(i); } else { fontFace = g_mainFrame->GetBaseFontFace(); } fontSize = m_fontPtSlider->GetValue(); columnWidth = m_columnWidthSlider->GetValue() * COLUMNWIDTH_DIVISOR; coverHeight = m_coverHeightSlider->GetValue(); }
void MainWindow::play() { libvlc_media_player_play(media_player); playpause_button->SetLabel(wxT("Pause")); playpause_button->Enable(true); stop_button->Enable(true); timeline->Enable(true); }
void SliderTestCase::LinePageSize() { #if wxUSE_UIACTIONSIMULATOR wxUIActionSimulator sim; wxYield(); m_slider->SetFocus(); m_slider->SetPageSize(20); sim.Char(WXK_PAGEUP); wxYield(); CPPUNIT_ASSERT_EQUAL(20, m_slider->GetPageSize()); CPPUNIT_ASSERT_EQUAL(30, m_slider->GetValue()); m_slider->SetLineSize(2); sim.Char(WXK_UP); wxYield(); CPPUNIT_ASSERT_EQUAL(2, m_slider->GetLineSize()); CPPUNIT_ASSERT_EQUAL(28, m_slider->GetValue()); #endif }
void SjViewSettingsPage::OnFontDefault(wxCommandEvent&) { // use default values long i = m_fontFaceChoice->FindString(SJ_DEF_FONT_FACE); if( i == -1 ) i = 0; m_fontFaceChoice->SetSelection(i); m_fontPtSlider->SetValue(SJ_DEF_FONT_SIZE); UpdateFontPtText(); m_columnWidthSlider->SetValue(SJ_DEF_COLUMN_WIDTH / COLUMNWIDTH_DIVISOR); UpdateColumnWidthText(); m_coverHeightSlider->SetValue(SJ_DEF_COVER_HEIGHT); UpdateCoverHeightText(); m_useViewFontInDlgCheckBox->SetValue(false); g_mainFrame->SetFontNCoverBase(SJ_DEF_FONT_FACE, SJ_DEF_FONT_SIZE, SJ_DEF_COLUMN_WIDTH, SJ_DEF_COVER_HEIGHT); }
void MyFrame::OnSetProgressValue(wxScrollEvent& WXUNUSED(event)) { static bool s_hasRangeSet = false; if ( !s_hasRangeSet ) { MSWGetTaskBarButton()->SetProgressRange(100); s_hasRangeSet = true; } MSWGetTaskBarButton()->SetProgressValue(m_slider->GetValue()); }
void syncControls(int value) { ArgsTextControl::setArgValue(value); if (value < 0) { slider_control->SetValue(0); speed_label->SetLabel(""); } else { slider_control->SetValue(value); speed_label->SetLabel(S_FMT( "%s (%.1f units per tic, %.1f units per sec)", arg_t::speedLabel(value), value / 8.0, // A tic is 28ms, slightly less than 1/35 of a second value / 8.0 * 1000.0 / 28.0 )); } }
void SliderTestCase::Thumb() { #if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__) EventCounter track(m_slider, wxEVT_SCROLL_THUMBTRACK); EventCounter release(m_slider, wxEVT_SCROLL_THUMBRELEASE); EventCounter changed(m_slider, wxEVT_SCROLL_CHANGED); wxUIActionSimulator sim; m_slider->SetValue(0); sim.MouseDragDrop(m_slider->ClientToScreen(wxPoint(10, 10)),m_slider->ClientToScreen(wxPoint(50, 10))); wxYield(); CPPUNIT_ASSERT(track.GetCount() != 0); CPPUNIT_ASSERT_EQUAL(1, release.GetCount()); #ifdef __WXMSW__ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount()); #endif #endif }
void SliderTestCase::Range() { CPPUNIT_ASSERT_EQUAL(0, m_slider->GetMin()); CPPUNIT_ASSERT_EQUAL(100, m_slider->GetMax()); // Changing range shouldn't change the value. m_slider->SetValue(17); m_slider->SetRange(0, 200); CPPUNIT_ASSERT_EQUAL(17, m_slider->GetValue()); //Test negative ranges m_slider->SetRange(-50, 0); CPPUNIT_ASSERT_EQUAL(-50, m_slider->GetMin()); CPPUNIT_ASSERT_EQUAL(0, m_slider->GetMax()); }
void SliderTestCase::PageUpDown() { #if wxUSE_UIACTIONSIMULATOR EventCounter pageup(m_slider, wxEVT_SCROLL_PAGEUP); EventCounter pagedown(m_slider, wxEVT_SCROLL_PAGEDOWN); wxUIActionSimulator sim; m_slider->SetFocus(); sim.Char(WXK_PAGEUP); sim.Char(WXK_PAGEDOWN); wxYield(); CPPUNIT_ASSERT_EQUAL(1, pageup.GetCount()); CPPUNIT_ASSERT_EQUAL(1, pagedown.GetCount()); #endif }
void SliderTestCase::Value() { m_slider->SetValue(30); CPPUNIT_ASSERT_EQUAL(30, m_slider->GetValue()); //When setting a value larger that max or smaller than min //max and min are set m_slider->SetValue(-1); CPPUNIT_ASSERT_EQUAL(0, m_slider->GetValue()); m_slider->SetValue(110); CPPUNIT_ASSERT_EQUAL(100, m_slider->GetValue()); }
ArgsSpeedControl(wxWindow* parent) : ArgsTextControl(parent) { wxBoxSizer* row = new wxBoxSizer(wxHORIZONTAL); GetSizer()->Detach(text_control); row->Add(text_control, wxSizerFlags(1).Expand()); speed_label = new wxStaticText(this, -1, ""); row->AddSpacer(4); row->Add(speed_label, wxSizerFlags(4).Align(wxALIGN_CENTER_VERTICAL)); GetSizer()->Add(row, wxSizerFlags(1).Expand()); slider_control = new wxSlider(this, -1, 0, 0, 255); slider_control->SetLineSize(2); slider_control->SetPageSize(8); // These are the generalized Boom speeds slider_control->SetTick(8); slider_control->SetTick(16); slider_control->SetTick(32); slider_control->SetTick(64); slider_control->Bind(wxEVT_SLIDER, &ArgsSpeedControl::onSlide, this); GetSizer()->Add(slider_control, wxSizerFlags(1).Expand()); }
void MainWindow::OnVolumeChanged(wxCommandEvent& event) { libvlc_audio_set_volume(media_player, volume_slider->GetValue()); }
void onSlide(wxCommandEvent& event) { syncControls(slider_control->GetValue()); }
PaletteTintDialog(wxWindow* parent, Palette8bit* pal) : wxDialog(parent, -1, "Tint", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Init variables this->palette = pal; // Set dialog icon wxIcon icon; icon.CopyFromBitmap(Icons::getIcon(Icons::GENERAL, "palette_tint")); SetIcon(icon); // Setup main sizer wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); msizer->Add(sizer, 1, wxEXPAND|wxALL, 6); // Add colour chooser wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxALL, 4); cp_colour = new wxColourPickerCtrl(this, -1, wxColour(255, 0, 0)); hbox->Add(new wxStaticText(this, -1, "Colour:"), 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); hbox->Add(cp_colour, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 8); // Add 'amount' slider hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); slider_amount = new wxSlider(this, -1, 50, 0, 100); label_amount = new wxStaticText(this, -1, "100%"); hbox->Add(new wxStaticText(this, -1, "Amount:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); hbox->Add(slider_amount, 1, wxEXPAND|wxRIGHT, 4); hbox->Add(label_amount, 0, wxALIGN_CENTER_VERTICAL); // Add preview pal_preview = new PaletteCanvas(this, -1); sizer->Add(pal_preview, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); // Add buttons sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxBOTTOM|wxTOP, 4); // Setup preview pal_preview->allowSelection(2); pal_preview->SetInitialSize(wxSize(384, 384)); redraw(); // Init layout Layout(); // Bind events cp_colour->Bind(wxEVT_COLOURPICKER_CHANGED, &PaletteTintDialog::onColourChanged, this); slider_amount->Bind(wxEVT_SLIDER, &PaletteTintDialog::onAmountChanged, this); pal_preview->Bind(wxEVT_LEFT_UP, &PaletteTintDialog::onPaletteLeftUp, this); // Setup dialog size SetInitialSize(wxSize(-1, -1)); SetMinSize(GetSize()); CenterOnParent(); // Set values label_amount->SetLabel("50% "); }
PaletteColourTweakDialog(wxWindow* parent, Palette8bit* pal) : wxDialog(parent, -1, "Tweak Colours", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Init variables this->palette = pal; // Set dialog icon wxIcon icon; icon.CopyFromBitmap(Icons::getIcon(Icons::GENERAL, "palette_tweak")); SetIcon(icon); // Setup main sizer wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); msizer->Add(sizer, 1, wxEXPAND|wxALL, 6); wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxALL, 4); // Add 'hue shift' slider hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); slider_hue = new wxSlider(this, -1, 0, 0, 500); label_hue = new wxStaticText(this, -1, "0.000"); hbox->Add(new wxStaticText(this, -1, "Hue Shift:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); hbox->Add(slider_hue, 1, wxEXPAND|wxRIGHT, 4); hbox->Add(label_hue, 0, wxALIGN_CENTER_VERTICAL); // Add 'Saturation' slider hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); slider_sat = new wxSlider(this, -1, 100, 0, 200); label_sat = new wxStaticText(this, -1, "100%"); hbox->Add(new wxStaticText(this, -1, "Saturation:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); hbox->Add(slider_sat, 1, wxEXPAND|wxRIGHT, 4); hbox->Add(label_sat, 0, wxALIGN_CENTER_VERTICAL); // Add 'Luminosity' slider hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); slider_lum = new wxSlider(this, -1, 100, 0, 200); label_lum = new wxStaticText(this, -1, "100%"); hbox->Add(new wxStaticText(this, -1, "Luminosity:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); hbox->Add(slider_lum, 1, wxEXPAND|wxRIGHT, 4); hbox->Add(label_lum, 0, wxALIGN_CENTER_VERTICAL); // Add preview pal_preview = new PaletteCanvas(this, -1); sizer->Add(pal_preview, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4); // Add buttons sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxBOTTOM|wxTOP, 4); // Setup preview pal_preview->allowSelection(2); pal_preview->SetInitialSize(wxSize(384, 384)); redraw(); // Init layout Layout(); // Bind events slider_hue->Bind(wxEVT_SLIDER, &PaletteColourTweakDialog::onHueChanged, this); slider_sat->Bind(wxEVT_SLIDER, &PaletteColourTweakDialog::onSatChanged, this); slider_lum->Bind(wxEVT_SLIDER, &PaletteColourTweakDialog::onLumChanged, this); pal_preview->Bind(wxEVT_LEFT_UP, &PaletteColourTweakDialog::onPaletteLeftUp, this); // Setup dialog size SetInitialSize(wxSize(-1, -1)); SetMinSize(GetSize()); CenterOnParent(); // Set values label_hue->SetLabel("0.000 "); label_sat->SetLabel("100% "); label_lum->SetLabel("100% "); }
float getSat() { return (float)slider_sat->GetValue()*0.01f; }
float getAmount() { return (float)slider_amount->GetValue()*0.01f; }
void onSatChanged(wxCommandEvent& e) { redraw(); label_sat->SetLabel(S_FMT("%d%%", slider_sat->GetValue())); }
float getHue() { return (float)slider_hue->GetValue()*0.002f; }
void SjViewSettingsPage::UpdateColumnWidthText() { long v = m_columnWidthSlider->GetValue() * COLUMNWIDTH_DIVISOR; m_columnWidthText->SetLabel(wxString::Format(wxT("%i"), (int)v)); }
float getLum() { return (float)slider_lum->GetValue()*0.01f; }
void SjViewSettingsPage::UpdateCoverHeightText() { long v = m_coverHeightSlider->GetValue(); m_coverHeightText->SetLabel(wxString::Format(wxT("%i%%"), (int)v)); }
void onLumChanged(wxCommandEvent& e) { redraw(); label_lum->SetLabel(S_FMT("%d%%", slider_lum->GetValue())); }
void SjViewSettingsPage::UpdateFontPtText(bool addSpaces) { long v = m_fontPtSlider->GetValue(); m_fontPtText->SetLabel(wxString::Format(wxT("%i Pt%s"), (int)v, addSpaces? wxT(" ") : wxT(""))); }