bool IpoptData::Initialize(const Journalist& jnlst, const OptionsList& options, const std::string& prefix) { if (prefix=="resto.") { // The default for the restoration phase is 1e-2 time the value // for the regular algorithm if (!options.GetNumericValue("resto.tol", tol_, "")) { options.GetNumericValue("tol", tol_, prefix); tol_ *= 1e-2; } } else { options.GetNumericValue("tol", tol_, prefix); } iter_count_ = 0; curr_mu_ = -1.; mu_initialized_ = false; curr_tau_ = -1.; tau_initialized_ = false; have_prototypes_ = false; have_deltas_ = false; have_affine_deltas_ = false; free_mu_mode_ = false; tiny_step_flag_ = false; ResetInfo(); initialize_called_ = true; return cgpen_data_->Initialize(jnlst, options, prefix); }
void ContactDetails::show(const MRIMSearchParams& aInfo) { ResetInfo(); SetInfo(aInfo); move(MRIMCommonUtils::DesktopCenter(size())); ui.addToCLButton->setVisible(!m_client->Protocol()->IsInList(m_email)); QWidget::show(); }
void CNowPlayingCtrl::OnPlayStop(MusikPlayerEvent & ev) { m_pTunage->Stopped(); PauseBtnToPlayBtn(); ResetInfo(); ev.Skip(); }
APPlayerInfo::APPlayerInfo(void) : varLock(false) { // Initialize member variables ResetInfo(); // Well, the volume isn't initialized in the previous // function call, so we do it here volume = 256; }
bool IpoptData::Initialize(const Journalist& jnlst, const OptionsList& options, const std::string& prefix) { #if 0 // I (AW) took the following heuristic out again, since it seemed // that the restoration phase tolerance became too tight by // default. I originally probably put it in to avoid that a claim // of infeasibility is made prematurely... let's see if someone // starts screaming... if (prefix=="resto.") { // The default for the restoration phase is 1e-2 time the value // for the regular algorithm if (!options.GetNumericValue("resto.tol", tol_, "")) { options.GetNumericValue("tol", tol_, prefix); tol_ *= 1e-2; } } else { options.GetNumericValue("tol", tol_, prefix); } #else options.GetNumericValue("tol", tol_, prefix); #endif iter_count_ = 0; curr_mu_ = -1.; mu_initialized_ = false; curr_tau_ = -1.; tau_initialized_ = false; have_prototypes_ = false; have_deltas_ = false; have_affine_deltas_ = false; free_mu_mode_ = false; tiny_step_flag_ = false; info_ls_count_ = 0; ResetInfo(); info_last_output_ = -1.; info_iters_since_header_ = 1000; // need to be larger 10 initialize_called_ = true; if (cpu_time_start_==-1.) { cpu_time_start_ = CpuTime(); } bool retval = true; if (IsValid(add_data_)) { retval = add_data_->Initialize(jnlst, options, prefix); } return retval; }
//===================================================== void Renderer::Render() { SharedStruct<IpcStruct> *pSharedStruct = Ipc::Get()->GetSharedStruct(); LPAIOVERLAY_Info pInfo; LPAIOVERLAY_InfoOptions pOptions; LPAIOVERLAY_Calculations pCalculations; for (int x = 0; x < MAX_INFOS; x++) { pInfo = &(*pSharedStruct)->infos[x]; pOptions = &pInfo->options; pCalculations = &pInfo->calculations; if (pInfo->nState == info_New) { pInfo->nState = info_Displaying; CalculateRect (pInfo); switch (pOptions->position) { case pos_AutoTopLeft: pOptions->rect.top = INFO_SCREEN_PADDING; pOptions->rect.left = INFO_SCREEN_PADDING; for (int y = 0; y < MAX_INFOS; y++) { if (x != y && (*pSharedStruct)->infos[y].nState != info_Invalid && (*pSharedStruct)->infos[y].options.position == pos_AutoTopLeft) { if ((*pSharedStruct)->infos[y].options.rect.bottom >= pOptions->rect.top) { int nOldDistance = pOptions->rect.bottom - pOptions->rect.top; pOptions->rect.top = (*pSharedStruct)->infos[y].options.rect.bottom + INFO_CONSECUTIVE_PADDING; pOptions->rect.bottom = pOptions->rect.top + nOldDistance; } } } break; } //char test[1024]; //sprintf (test, "%d, %d, %d, %d", pInfo->options.rect.top, pInfo->options.rect.left, pInfo->options.rect.bottom, pInfo->options.rect.right); //MessageBox (NULL, test, "OK", MB_OK); pCalculations->dwStartTime = GetTickCount(); } else if (pInfo->nState == info_Displaying) { DrawText (pInfo); if (GetTickCount () - pCalculations->dwStartTime >= pOptions->dwHoldTime) { pInfo->nState = info_Fading; } } else if (pInfo->nState == info_Fading) { DrawText (pInfo); pOptions->nAlpha -= pOptions->nFadeRate; pOptions->nOutlineAlpha -= pOptions->nFadeRate; if (pOptions->nAlpha < 0) { ResetInfo (pInfo); } if (pOptions->nOutlineAlpha < 0) { pOptions->nOutlineAlpha = 0; } } } }
bool CTaskProgressWnd::OnInit() { // Сделаем иконку у диалога SendMessage(m_hWindow, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(Instance, MAKEINTRESOURCE(IDI_MAIN_APP_SMALL))); // Зададим границы у progress bar (0..100) SendDlgItemMessage(m_hWindow, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); // Сбросим надписи в начальное положение ResetInfo(); return true; }
bool CTaskProgressWnd::CreateProgressWnd(bool bHidden) { // Если окно уже создано, и не закрыто, то заново создавать ничего не надо if (m_hWindow) { // но сбросим надписи в начальное положение ResetInfo(); } else { // Создаём новое окно CreateDialogParam(Instance, MAKEINTRESOURCE(IDD_TASK_PROGRESS), MainWindow, StaticDlgProc, (LPARAM) this); } if (!bHidden) ShowWindow(m_hWindow, SW_SHOW); return true; }
//拷贝信息 bool CServerListInfo::CopyServerListInfo(CServerListInfo & ServerListInfoScr) { //重置列表 ResetInfo(); //拷贝类型 tagGameType * pGameType=NULL; INT_PTR nTypeScrCount=ServerListInfoScr.m_GameTypePtrArrayActive.GetCount(); if (nTypeScrCount>m_GameTypePtrArrayBuffer.GetCount()) { for (INT_PTR i=m_GameTypePtrArrayBuffer.GetCount();i<nTypeScrCount;i++) { pGameType=new tagGameType; memset(pGameType,0,sizeof(tagGameType)); m_GameTypePtrArrayBuffer.Add(pGameType); } } for (INT_PTR i=0;i<nTypeScrCount;i++) { pGameType=m_GameTypePtrArrayBuffer[i]; CopyMemory(pGameType,ServerListInfoScr.m_GameTypePtrArrayActive[i],sizeof(tagGameType)); m_GameTypePtrArrayActive.Add(pGameType); } m_GameTypePtrArrayBuffer.RemoveAt(0,nTypeScrCount); //拷贝种类 tagGameKind * pGameKind=NULL; INT_PTR nKindScrCount=ServerListInfoScr.m_GameKindPtrArrayActive.GetCount(); if (nKindScrCount>m_GameKindPtrArrayBuffer.GetCount()) { for (INT_PTR i=m_GameKindPtrArrayBuffer.GetCount();i<nKindScrCount;i++) { pGameKind=new tagGameKind; memset(pGameKind,0,sizeof(tagGameKind)); m_GameKindPtrArrayBuffer.Add(pGameKind); } } for (INT_PTR i=0;i<nKindScrCount;i++) { pGameKind=m_GameKindPtrArrayBuffer[i]; CopyMemory(pGameKind,ServerListInfoScr.m_GameKindPtrArrayActive[i],sizeof(tagGameKind)); m_GameKindPtrArrayActive.Add(pGameKind); } m_GameKindPtrArrayBuffer.RemoveAt(0,nKindScrCount); //拷贝站点 tagGameStation * pGameStation=NULL; INT_PTR nStationScrCount=ServerListInfoScr.m_GameStationPtrArrayActive.GetCount(); if (nStationScrCount>m_GameStationPtrArrayBuffer.GetCount()) { for (INT_PTR i=m_GameStationPtrArrayBuffer.GetCount();i<nStationScrCount;i++) { pGameStation=new tagGameStation; memset(pGameStation,0,sizeof(tagGameStation)); m_GameStationPtrArrayBuffer.Add(pGameStation); } } for (INT_PTR i=0;i<nStationScrCount;i++) { pGameStation=m_GameStationPtrArrayBuffer[i]; CopyMemory(pGameStation,ServerListInfoScr.m_GameStationPtrArrayActive[i],sizeof(tagGameStation)); m_GameStationPtrArrayActive.Add(pGameStation); } m_GameStationPtrArrayBuffer.RemoveAt(0,nStationScrCount); //拷贝房间 tagGameServer * pGameServer=NULL; INT_PTR nServerScrCount=ServerListInfoScr.m_GameServerPtrArrayActive.GetCount(); if (nServerScrCount>m_GameServerPtrArrayBuffer.GetCount()) { for (INT_PTR i=m_GameServerPtrArrayBuffer.GetCount();i<nServerScrCount;i++) { pGameServer=new tagGameServer; memset(pGameServer,0,sizeof(tagGameServer)); m_GameServerPtrArrayBuffer.Add(pGameServer); } } for (INT_PTR i=0;i<nServerScrCount;i++) { pGameServer=m_GameServerPtrArrayBuffer[i]; CopyMemory(pGameServer,ServerListInfoScr.m_GameServerPtrArrayActive[i],sizeof(tagGameServer)); m_GameServerPtrArrayActive.Add(pGameServer); } m_GameServerPtrArrayBuffer.RemoveAt(0,nServerScrCount); return true; }
CNowPlayingCtrl::CNowPlayingCtrl( wxWindow *parent ) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN| wxTAB_TRAVERSAL |wxFULL_REPAINT_ON_RESIZE) { //-----------------------------// //--- title / artist / time ---// //-----------------------------// //--- now playing static text objects ---// stSong = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stArtist = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stCurtime = new wxStaticText_NoFlicker ( this,MUSIK_NOWPLAYINGCTRL_TIMEDISPLAY, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); //--- fonts ---// stSong->SetFont ( g_fntSong ); stArtist->SetFont ( g_fntArtist ); stCurtime->SetFont ( g_fntTime ); //---------------------------// //--- buttons and bitmaps ---// //---------------------------// //--- bitmaps ---// bmPrev = wxBitmap( prev_xpm ); bmPrevDown = wxBitmap( prev_down_xpm ); bmNext = wxBitmap( next_xpm ); bmNextDown = wxBitmap( next_down_xpm ); bmPlay = wxBitmap( play_xpm ); bmPlayDown = wxBitmap( play_down_xpm ); bmPause = wxBitmap( pause_xpm ); bmPauseDown = wxBitmap( pause_down_xpm ); bmStop = wxBitmap( stop_xpm ); bmStopDown = wxBitmap( stop_down_xpm ); bmVolume = wxBitmap( volume_xpm ); bmVolumeDown = wxBitmap( volume_down_xpm ); //--- buttons ---// btnPrev = new wxBitmapButton( this, MUSIK_NOWPLAYINGCTRL_PREV, bmPrev, wxDefaultPosition, wxSize( 40, -1 ), 0 ); btnNext = new wxBitmapButton( this, MUSIK_NOWPLAYINGCTRL_NEXT, bmNext, wxDefaultPosition, wxSize( 40, -1 ), 0 ); btnPlayPause = new wxBitmapButton( this, MUSIK_NOWPLAYINGCTRL_PLAYPAUSE, bmPlay, wxDefaultPosition, wxSize( 40, -1 ), 0 ); btnStop = new wxBitmapButton( this, MUSIK_NOWPLAYINGCTRL_STOP, bmStop, wxDefaultPosition, wxSize( 40, -1), 0 ); btnVolume = new wxBitmapButton( this, MUSIK_NOWPLAYINGCTRL_VOLUME, bmVolume, wxDefaultPosition, wxSize( 40, -1), 0 ); //--- events ---// btnPrev->SetBitmapLabel ( bmPrev ); btnNext->SetBitmapLabel ( bmNext ); btnPlayPause->SetBitmapLabel ( bmPlay ); btnStop->SetBitmapLabel ( bmStop ); btnVolume->SetBitmapLabel ( bmVolume ); #ifdef __WXGTK__ btnPrev->SetBitmapFocus ( bmPrevDown ); btnNext->SetBitmapFocus ( bmNextDown ); btnPlayPause->SetBitmapFocus ( bmPlayDown ); btnStop->SetBitmapFocus ( bmStopDown ); btnVolume->SetBitmapFocus ( bmVolumeDown ); #else // defined __WXMSW__ pPrevEvt = new CBtnDownEvt ( btnPrev, &bmPrevDown, &bmPrev ); pNextEvt = new CBtnDownEvt ( btnNext, &bmNextDown, &bmNext ); pPlayEvt = new CBtnDownEvt ( btnPlayPause, &bmPlayDown, &bmPlay ); pPauseEvt = new CBtnDownEvt ( btnPlayPause, &bmPauseDown, &bmPause ); pStopEvt = new CBtnDownEvt ( btnStop, &bmStopDown, &bmStop ); pVolumeEvt = new CBtnDownEvt ( btnVolume, &bmVolumeDown, &bmVolume ); btnPrev->PushEventHandler ( pPrevEvt ); btnNext->PushEventHandler ( pNextEvt ); btnPlayPause->PushEventHandler ( pPlayEvt ); btnStop->PushEventHandler ( pStopEvt ); btnVolume->PushEventHandler ( pVolumeEvt ); #endif //----------------// //--- seek bar ---// //----------------// gSeek = new wxGauge ( this, MUSIK_NOWPLAYINGCTRL_SEEK, 100, wxDefaultPosition, wxSize( 12* wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ), wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) ), wxGA_SMOOTH | wxGA_HORIZONTAL | wxCLIP_CHILDREN ); pSeekEvt = new CGaugeSeekEvt ( gSeek ); gSeek->PushEventHandler( pSeekEvt ); //---------------------------------// //--- sizer for artist and time ---// //---------------------------------// hsArtistTime = new wxBoxSizer( wxHORIZONTAL ); hsArtistTime->Add( stArtist, 0, wxALIGN_CENTRE_VERTICAL ); hsArtistTime->Add( stCurtime, 1, wxALIGN_CENTRE_VERTICAL|wxLEFT,3 ); //--- song title, artist and time ---// vsLeftCol = new wxBoxSizer( wxVERTICAL ); vsLeftCol->Add( stSong, 1, wxBOTTOM|wxEXPAND , 3 ); vsLeftCol->Add( hsArtistTime, 1, wxEXPAND ); //--- buttons, seek bar panel ---// wxGridSizer *hsButtons = new wxGridSizer(1,5,2,2); hsButtons->Add( btnPrev ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,10); hsButtons->Add( btnPlayPause ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,10); hsButtons->Add( btnStop ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,10); hsButtons->Add( btnNext ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,10); hsButtons->Add( btnVolume,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,10); vsRightCol = new wxBoxSizer( wxVERTICAL ); //--- playmode ---// wxBoxSizer *vsPlayModeCol = new wxBoxSizer( wxHORIZONTAL ); vsPlayModeCol->Add( hsButtons, 1,wxEXPAND|wxALL,2 ); // vsPlayModeCol->Add( new wxStaticText ( this, -1, _( "Play mode" ) ), 1 ); const wxString playmode_choices[] ={_("Normal"),_("Repeat Song"),_("Repeat List"),_("Shuffle"),_("Auto DJ"),_("Auto DJ Album")}; wxChoice *choicePlaymode = new wxChoice_NoFlicker(this,MUSIK_NOWPLAYINGCTRL_PLAYMODE,wxDefaultPosition,wxDefaultSize,WXSIZEOF(playmode_choices),playmode_choices); int playmode = wxGetApp().Prefs.ePlaymode.val; choicePlaymode->SetSelection(playmode); vsPlayModeCol->Add( choicePlaymode,0, wxRIGHT|wxLEFT|wxALIGN_CENTRE_VERTICAL, 5 ); //-- small top border --// wxCheckBox * pCrossfade = new wxCheckBox_NoFlicker( this, MUSIK_CHK_CROSSFADE, _("Crossfade"), wxPoint( -1, -1 ), wxSize( -1, -1 ) ); vsPlayModeCol->Add( pCrossfade,0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, 2 ); //-- small top border --// pCrossfade->SetValue( wxGetApp().Prefs.bGlobalFadeEnable ); vsRightCol->Add( vsPlayModeCol, 0 ); //-- small top border --// vsRightCol->Add( gSeek, 0, wxTOP|wxEXPAND, 2 ); //-- small top border --// // wxGridSizer *hsCols = new wxGridSizer( 1,2,0,0); wxBoxSizer *hsCols = new wxBoxSizer(wxHORIZONTAL); hsCols->Add( vsLeftCol, 1, wxALL, 2 ); //hsCols->Add(-1,-1,1,wxEXPAND); hsCols->Add( vsRightCol, 0, wxALIGN_RIGHT| wxALL, 2 ); SetSizer( hsCols ); m_pTunage = new CTunage; pSecTimer = NULL; StartTimer(); g_TimeSeeking = false; ResetInfo(); ActivateHotkeys(); }
void Emulator::Load() { Stop(); try { Init(); if (!fs::is_file(m_path)) { LOG_ERROR(LOADER, "File not found: %s", m_path); return; } const std::string& elf_dir = fs::get_parent_dir(m_path); if (IsSelf(m_path)) { const std::size_t elf_ext_pos = m_path.find_last_of('.'); const std::string& elf_ext = fmt::to_upper(m_path.substr(elf_ext_pos != -1 ? elf_ext_pos : m_path.size())); const std::string& elf_name = m_path.substr(elf_dir.size()); if (elf_name.compare(elf_name.find_last_of("/\\", -1, 2) + 1, 9, "EBOOT.BIN", 9) == 0) { m_path.erase(m_path.size() - 9, 1); // change EBOOT.BIN to BOOT.BIN } else if (elf_ext == ".SELF" || elf_ext == ".SPRX") { m_path.erase(m_path.size() - 4, 1); // change *.self to *.elf, *.sprx to *.prx } else { m_path += ".decrypted.elf"; } if (!DecryptSelf(m_path, elf_dir + elf_name)) { LOG_ERROR(LOADER, "Failed to decrypt %s", elf_dir + elf_name); return; } } ResetInfo(); LOG_NOTICE(LOADER, "Path: %s", m_path); // Load custom config if (fs::file cfg_file{ m_path + ".yml" }) { LOG_NOTICE(LOADER, "Custom config: %s.yml", m_path); cfg::root.from_string(cfg_file.to_string()); } const fs::file elf_file(m_path); ppu_exec_loader ppu_exec; ppu_prx_loader ppu_prx; spu_exec_loader spu_exec; arm_exec_loader arm_exec; if (!elf_file) { LOG_ERROR(LOADER, "Failed to open %s", m_path); return; } else if (ppu_exec.open(elf_file) == elf_error::ok) { // PS3 executable m_status = Ready; vm::ps3::init(); if (m_elf_path.empty()) { m_elf_path = "/host_root/" + m_path; LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path); } // Load PARAM.SFO const auto _psf = psf::load_object(fs::file(elf_dir + "/../PARAM.SFO")); m_title = psf::get_string(_psf, "TITLE", m_path); m_title_id = psf::get_string(_psf, "TITLE_ID"); LOG_NOTICE(LOADER, "Title: %s", GetTitle()); LOG_NOTICE(LOADER, "Serial: %s", GetTitleID()); LOG_NOTICE(LOADER, ""); LOG_NOTICE(LOADER, "Used configuration:\n%s\n", cfg::root.to_string()); // Mount /dev_bdvd/ if (g_cfg_vfs_dev_bdvd.size() == 0 && fs::is_file(elf_dir + "/../../PS3_DISC.SFB")) { const auto dir_list = fmt::split(elf_dir, { "/", "\\" }); // Check latest two directories if (dir_list.size() >= 2 && dir_list.back() == "USRDIR" && *(dir_list.end() - 2) == "PS3_GAME") { g_cfg_vfs_dev_bdvd = elf_dir.substr(0, elf_dir.length() - 15); } else { g_cfg_vfs_dev_bdvd = elf_dir + "/../../"; } } // Mount /app_home/ if (g_cfg_vfs_app_home.size() == 0) { g_cfg_vfs_app_home = elf_dir + '/'; } vfs::dump(); ppu_exec.load(); Emu.GetCallbackManager().Init(); fxm::import<GSRender>(PURE_EXPR(Emu.GetCallbacks().get_gs_render())); // TODO: must be created in appropriate sys_rsx syscall } else if (ppu_prx.open(elf_file) == elf_error::ok) { // PPU PRX (experimental) m_status = Ready; vm::ps3::init(); ppu_prx.load(); GetCallbackManager().Init(); } else if (spu_exec.open(elf_file) == elf_error::ok) { // SPU executable (experimental) m_status = Ready; vm::ps3::init(); spu_exec.load(); } else if (arm_exec.open(elf_file) == elf_error::ok) { // ARMv7 executable m_status = Ready; vm::psv::init(); arm_exec.load(); } else { LOG_ERROR(LOADER, "Invalid or unsupported file format: %s", m_path); LOG_WARNING(LOADER, "** ppu_exec_loader -> %s", ppu_exec.get_error()); LOG_WARNING(LOADER, "** ppu_prx_loader -> %s", ppu_prx.get_error()); LOG_WARNING(LOADER, "** spu_exec_loader -> %s", spu_exec.get_error()); LOG_WARNING(LOADER, "** arm_exec_loader -> %s", arm_exec.get_error()); return; } debug::autopause::reload(); SendDbgCommand(DID_READY_EMU); if (g_cfg_autostart) Run(); } catch (const std::exception& e) { LOG_FATAL(LOADER, "%s thrown: %s", typeid(e).name(), e.what()); Stop(); } }
CNowPlayingCtrl::CNowPlayingCtrl( wxWindow *parent ,CMusikPlayer & refMusikPlayer) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN| wxTAB_TRAVERSAL ) ,m_MusikPlayer(refMusikPlayer) { //-----------------------------// //--- title / artist / time ---// //-----------------------------// //--- now playing static text objects ---// stSong = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stArtist = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stCurtime = new wxStaticText_NoFlicker ( this,MUSIK_NOWPLAYINGCTRL_TIMEDISPLAY, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); //--- fonts ---// stSong->SetFont ( g_fntSong ); stArtist->SetFont ( g_fntArtist ); stCurtime->SetFont ( g_fntTime ); //---------------------------// //--- buttons and bitmaps ---// //---------------------------// //--- bitmaps ---// { wxLogNull lognull; // disable logging in this scope LOAD_BUTTONPNG(Prev); LOAD_BUTTONPNG(Play); LOAD_BUTTONPNG(Pause); LOAD_BUTTONPNG(Stop); LOAD_BUTTONPNG(Next); LOAD_BUTTONPNG(Volume); } wxPanel * pPlayPanel = new wxPanel(this); //--- buttons ---// btnPrev = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_PREV, bmPrev ,wxDefaultPosition,wxDefaultSize,0); btnNext = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_NEXT, bmNext,wxDefaultPosition,wxDefaultSize,0); btnPlayPause = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_PLAYPAUSE, bmPlay,wxDefaultPosition,wxDefaultSize,0); btnStop = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_STOP, bmStop,wxDefaultPosition,wxDefaultSize,0); btnVolume = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_VOLUME, bmVolume,wxDefaultPosition,wxDefaultSize,0); //--- events ---// #ifndef __WXMSW__ btnPrev->SetBitmapFocus ( bmPrevDown ); btnNext->SetBitmapFocus ( bmNextDown ); btnPlayPause->SetBitmapFocus ( bmPlayDown ); btnStop->SetBitmapFocus ( bmStopDown ); btnVolume->SetBitmapFocus ( bmVolumeDown ); #else // defined __WXMSW__ pPrevEvt = new CBtnDownEvt ( btnPrev, &bmPrevDown, &bmPrev ); pNextEvt = new CBtnDownEvt ( btnNext, &bmNextDown, &bmNext ); pPlayEvt = new CBtnDownEvt ( btnPlayPause, &bmPlayDown, &bmPlay ); pPauseEvt = new CBtnDownEvt ( btnPlayPause, &bmPauseDown, &bmPause ); pStopEvt = new CBtnDownEvt ( btnStop, &bmStopDown, &bmStop ); pVolumeEvt = new CBtnDownEvt ( btnVolume, &bmVolumeDown, &bmVolume ); btnPrev->PushEventHandler ( pPrevEvt ); btnNext->PushEventHandler ( pNextEvt ); btnPlayPause->PushEventHandler ( pPlayEvt ); btnStop->PushEventHandler ( pStopEvt ); btnVolume->PushEventHandler ( pVolumeEvt ); #endif //----------------// //--- seek bar ---// //----------------// gSeek = new wxGauge ( pPlayPanel, MUSIK_NOWPLAYINGCTRL_SEEK, 100, wxDefaultPosition, wxSize( 4* wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ), wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) ), wxGA_SMOOTH | wxGA_HORIZONTAL | wxCLIP_CHILDREN ); pSeekEvt = new CGaugeSeekEvt ( gSeek ); gSeek->PushEventHandler( pSeekEvt ); gSeek->Connect(wxEVT_RIGHT_DOWN,wxMouseEventHandler(CNowPlayingCtrl::OnClickTimeDisplay),NULL,this); //---------------------------------// //--- sizer for artist and time ---// //---------------------------------// hsArtistTime = new wxBoxSizer( wxHORIZONTAL ); hsArtistTime->Add( stArtist, 0, wxALIGN_CENTRE_VERTICAL ); hsArtistTime->Add( stCurtime, 1, wxALIGN_CENTRE_VERTICAL|wxLEFT,3 ); //--- song title, artist and time ---// vsLeftCol = new wxBoxSizer( wxVERTICAL ); vsLeftCol->Add( stSong, 1, wxBOTTOM|wxEXPAND , 3 ); vsLeftCol->Add( hsArtistTime, 1, wxEXPAND ); //--- buttons, seek bar panel ---// wxGridSizer *hsButtons = new wxGridSizer(5); hsButtons->Add( btnPrev ); hsButtons->Add( btnPlayPause ); hsButtons->Add( btnStop ); hsButtons->Add( btnNext ); hsButtons->Add( btnVolume); vsRightCol = new wxBoxSizer( wxVERTICAL ); //--- playmode ---// wxBoxSizer *vsPlayModeCol = new wxBoxSizer( wxHORIZONTAL ); vsPlayModeCol->Add( hsButtons); // vsPlayModeCol->Add( new wxStaticText ( this, -1, _( "Play mode" ) ), 1 ); const wxString playmode_choices[] ={_("Normal"),_("Repeat Song"),_("Repeat List"),_("Shuffle"),_("Auto DJ"),_("Auto DJ Album")}; wxChoice *choicePlaymode = new wxChoice_NoFlicker(pPlayPanel,MUSIK_NOWPLAYINGCTRL_PLAYMODE,wxDefaultPosition,wxDefaultSize,WXSIZEOF(playmode_choices),playmode_choices); int playmode = wxGetApp().Prefs.ePlaymode.val; choicePlaymode->SetSelection(playmode); vsPlayModeCol->Add( choicePlaymode,0, wxRIGHT|wxLEFT|wxALIGN_CENTRE_VERTICAL, 5 ); //-- small top border --// wxCheckBox * pCrossfade = new wxCheckBox_NoFlicker( pPlayPanel, MUSIK_CHK_CROSSFADE, _("Crossfade")); vsPlayModeCol->Add( pCrossfade,0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, 2 ); //-- small top border --// pCrossfade->SetValue( wxGetApp().Prefs.bGlobalFadeEnable ); vsRightCol->Add( vsPlayModeCol, 0 ); //-- small top border --// vsRightCol->Add( gSeek, 0, wxTOP|wxEXPAND, 2 ); //-- small top border --// pPlayPanel->SetSizer(vsRightCol); // wxGridSizer *hsCols = new wxGridSizer( 1,2,0,0); wxBoxSizer *hsCols = new wxBoxSizer(wxHORIZONTAL); hsCols->Add( vsLeftCol, 1, wxALL, 2 ); //hsCols->Add(-1,-1,1,wxEXPAND); hsCols->Add(pPlayPanel, 0, wxALIGN_RIGHT| wxALL, 2 ); SetSizer( hsCols ); m_pTunage = new CTunage; pSecTimer = NULL; StartTimer(); g_TimeSeeking = false; ResetInfo(); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_SONG_CHANGED,MusikPlayerEventHandler(CNowPlayingCtrl::OnSongChanged),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_START,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayStart),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_STOP,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayStop),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_PAUSE,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayPause),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_RESUME,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayResume),NULL,this); ActivateHotkeys(); }
void CNowPlayingCtrl::OnPlayStop(MusikPlayerEvent & ev) { PauseBtnToPlayBtn(); ResetInfo(); ev.Skip(); }