void CBOINCListCtrl::OnClick(wxCommandEvent& event) {
    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function Begin"));

    wxASSERT(m_pParentView);
    wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView));

    wxListEvent leDeselectedEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED, m_windowId);
    leDeselectedEvent.SetEventObject(this);

    if (m_bIsSingleSelection) {
        if (GetFocusedItem() != GetFirstSelected()) {
            wxLogTrace(wxT("Function Status"), wxT("CBOINCListCtrl::OnClick - GetFocusedItem() '%d' != GetFirstSelected() '%d'"), GetFocusedItem(), GetFirstSelected());

            if (-1 == GetFirstSelected()) {
                wxLogTrace(wxT("Function Status"), wxT("CBOINCListCtrl::OnClick - Force Selected State"));

                long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED;
                SetItemState(GetFocusedItem(), desiredstate, desiredstate);
            } else {
                m_pParentView->FireOnListDeselected(leDeselectedEvent);
            }
        }
    } else {
        if (-1 == GetFirstSelected()) {
            m_pParentView->FireOnListDeselected(leDeselectedEvent);
        }
    }

    event.Skip();
    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function End"));
}
示例#2
0
void BreakpointList::keydownEvent(wxKeyEvent& evt)
{
	int sel = GetFirstSelected();
	switch (evt.GetKeyCode())
	{
	case WXK_DELETE:
		if (sel+1 == GetItemCount())
			Select(sel-1);
		removeBreakpoint(sel);
		break;
	case WXK_UP:
		if (sel > 0)
			Select(sel-1);
		break;
	case WXK_DOWN:
		if (sel+1 < GetItemCount())
			Select(sel+1);
		break;
	case WXK_RETURN:
		editBreakpoint(sel);
		break;
	case WXK_SPACE:
		toggleEnabled(sel);
		break;
	}
}
示例#3
0
void TTreeView::ClearSelection()
{
	uint32 item;
	while ((item = GetFirstSelected()) != 0) {
		SetSelected( item, false );
	}
}
示例#4
0
void EditTagDialog::ShowCover() {
  Song* song = GetFirstSelected();
  if (!song) {
    return;
  }

  album_cover_choice_controller_->ShowCover(*song);
}
示例#5
0
int CFileListView::GetCurrentSelected()
{
	int nIndex = GetFirstSelected();
	if(m_FileStack.size() > 1)
		nIndex--;

	return nIndex;
}
示例#6
0
// -------------------------------------------------------------------------------- //
void guAlListBox::OnSearchLinkClicked( wxCommandEvent &event )
{
    unsigned long cookie;
    int Item = GetFirstSelected( cookie );
    if( Item != wxNOT_FOUND )
    {
        ExecuteOnlineLink( event.GetId(), GetSearchText( Item ) );
    }
}
示例#7
0
// -------------------------------------------------------------------------------- //
void guPLSoListBox::MoveSelection( void )
{
    if( ( m_TracksOrder != wxNOT_FOUND ) ||
        ( m_PLIds.Count() != 1 ) ||
        ( m_PLTypes[ 0 ] != guPLAYLIST_TYPE_STATIC ) )
        return;

    wxArrayInt   MoveIds;
    wxArrayInt   MoveIndex;
    wxArrayInt   ItemIds;

    // Copy the elements we are going to move
    unsigned long cookie;
    int item = GetFirstSelected( cookie );
    while( item != wxNOT_FOUND )
    {
        MoveIndex.Add( item );
        MoveIds.Add( m_Items[ item ].m_SongId );
        item = GetNextSelected( cookie );
    }

    // Get the position where to move it
    int InsertPos;
    if( m_DragOverItem != wxNOT_FOUND )
        InsertPos = m_DragOverItem + m_DragOverAfter;
    else
        InsertPos = m_Items.Count();

    // Remove the elements from the original position
    int index;
    int count = MoveIndex.Count();
    for( index = count - 1; index >= 0; index-- )
    {
        m_Items.RemoveAt( MoveIndex[ index ] );

        if( MoveIndex[ index ] < InsertPos )
            InsertPos--;
    }

    count = m_Items.Count();
    for( index = 0; index < count; index++ )
    {
        ItemIds.Add( m_Items[ index ].m_SongId );
    }

    count = MoveIds.Count();
    for( index = 0; index < count; index++ )
    {
        ItemIds.Insert( MoveIds[ index ], InsertPos + index );
    }

    // Save it to the database
    m_Db->UpdateStaticPlayList( m_PLIds[ 0 ], ItemIds );
    m_Db->UpdateStaticPlayListFile( m_PLIds[ 0 ] );

    ReloadItems();
}
示例#8
0
void EditTagDialog::UnsetCover() {
  Song* song = GetFirstSelected();
  if (!song) return;

  const QModelIndexList sel =
      ui_->song_list->selectionModel()->selectedIndexes();

  QString cover = album_cover_choice_controller_->UnsetCover(song);
  UpdateCoverOf(*song, sel, cover);
}
        void WadListBox::GetSelections(wxArrayInt& selection) const {
            selection.clear();

            unsigned long cookie;
            int index = GetFirstSelected(cookie);
            while (index != wxNOT_FOUND) {
                selection.push_back(index);
                index = GetNextSelected(cookie);
            }
        }
示例#10
0
void GameViewer::RemoveGame(wxCommandEvent& event)
{
	long i = GetFirstSelected();
	if (i < 0) return;
	
	Emu.GetVFS().Init("/");
	Emu.GetVFS().DeleteAll(m_path + "/" + this->GetItemText(i, 6).ToStdString());
	Emu.GetVFS().UnMountAll();

	Refresh();
}
示例#11
0
void GameViewer::ConfigureGame(wxCommandEvent& WXUNUSED(event))
{
	long i = GetFirstSelected();
	if (i < 0) return;

	Emu.CreateConfig(m_game_data[i].serial);
	rpcs3::config_t custom_config { fs::get_config_dir() + "data/" + m_game_data[i].serial + "/settings.ini" };
	custom_config.load();
	LOG_NOTICE(LOADER, "Configure: '%s'", custom_config.path().c_str());
	SettingsDialog(this, &custom_config);
}
示例#12
0
void EditTagDialog::LoadCoverFromURL() {
  Song* song = GetFirstSelected();
  if (!song) return;

  const QModelIndexList sel =
      ui_->song_list->selectionModel()->selectedIndexes();

  QString cover = album_cover_choice_controller_->LoadCoverFromURL(song);

  if (!cover.isEmpty()) UpdateCoverOf(*song, sel, cover);
}
示例#13
0
void TTreeView::DoActivate(bool flag)
{
	EnableDrawing();
	
	XGDraw draw(this);
	draw.SetFont(XGFont::LoadFont(1));
	for (uint32 item = GetFirstSelected(); item; item = GetNextSelected( item )) {
		RedrawItem(draw,(TableEntryRecord *)item);
	}

	XGView::DoActivate(flag);
}
wxString LIBRARY_LISTBOX::GetSelectedLibrary()
{
    wxString libraryName;
    int      ii = GetFirstSelected();

    if( ii >= 0 )
    {
        libraryName = m_libraryList[ii];
    }

    return libraryName;
}
示例#15
0
// -------------------------------------------------------------------------------- //
int guPLSoListBox::GetSelectedSongs( guTrackArray * tracks, const bool isdrag ) const
{
    unsigned long cookie;
    guPLSoListBox * self = wxConstCast( this, guPLSoListBox );
    self->m_ItemsMutex.Lock();
    int item = GetFirstSelected( cookie );
    while( item != wxNOT_FOUND )
    {
        tracks->Add( new guTrack( m_Items[ item ] ) );
        item = GetNextSelected( cookie );
    }
    self->m_ItemsMutex.Unlock();
    return tracks->Count();
}
示例#16
0
// -------------------------------------------------------------------------------- //
int guPLSoListBox::GetPlayListSetIds( wxArrayInt * setids ) const
{
    unsigned long cookie;
    if( m_PLSetIds.Count() )
    {
        int item = GetFirstSelected( cookie );
        while( item != wxNOT_FOUND )
        {
            setids->Add( m_PLSetIds[ item ] );
            item = GetNextSelected( cookie );
        }
    }
    return setids->Count();
}
示例#17
0
/**
 * \brief Remove all items.
 * \return true if something has changed.
 */
bool bf::item_field_edit::clear()
{
  bool result = !empty();

  m_group.clear();
  int index = GetFirstSelected();

  if (index != wxNOT_FOUND)
    m_last_selected_field = index;

  DeleteAllItems();

  return result;
} // item_field_edit::clear()
wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
{
    wxString footprintName;
    int      ii = GetFirstSelected();

    if( ii >= 0 )
    {
        wxString msg = m_footprintList[ii];
        msg.Trim( true );
        msg.Trim( false );
        footprintName = msg.AfterFirst( wxChar( ' ' ) );
    }

    return footprintName;
}
示例#19
0
void GameViewer::DClick(wxListEvent& event)
{
	long i = GetFirstSelected();
	if(i < 0) return;

	const wxString& path = m_path + "\\" + m_game_data[i].root + "\\" + "USRDIR" + "\\" + "BOOT.BIN";
	if(!wxFileExists(path))
	{
		ConLog.Error("Boot error: elf not found! [%s]", path);
		return;
	}

	Emu.Stop();
	Emu.SetElf(path);
	Emu.Run();
}
示例#20
0
void GameViewer::DClick(wxListEvent& event)
{
	long i = GetFirstSelected();
	if(i < 0) return;

	const wxString& path = m_path + m_game_data[i].root;

	Emu.Stop();
	Emu.GetVFS().Init(path);
	wxString local_path;
	if(Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path.ToStdString()))
	{
		ConLog.Error("Boot error: elf not found! [%s]", path.wx_str());
		return;
	}
	Emu.Run();
}
示例#21
0
void DataModelListCtrl::OnEndLabelEdit(wxListEvent& event)
{
    if (!event.IsEditCancelled())
    {
        wxDataModelBase* db = GetModel();
        const wxString str = event.GetLabel();
        const int pos = GetFirstSelected();
        bool ok = (pos != wxNOT_FOUND);
        wxString errorMsg = _("Failed");

        if (ok)
        {
            wxDataModelColumnInfo info;

            ok = GetModel()->GetColumn(m_column_clicked, &info);
            if (ok && (info.VariantType == wxT("string")) )
            {
                ok = (str.length() <= info.Length);
                if (!ok)
                    errorMsg = _("Text too long");
            }
            if (ok)
            {
                wxVariant var = str;
                if (ok)
                    ok = db->SetValueByRow(var, pos, m_column_clicked);
            }
        }
        if (!ok)
        {
            wxMessageBox(errorMsg);
            event.Veto();
        }
    }
    m_column_clicked = wxNOT_FOUND;
}
示例#22
0
bool EditTagDialog::eventFilter(QObject* o, QEvent* e) {
  if (o == ui_->art) {
    switch (e->type()) {
      case QEvent::MouseButtonRelease:
        cover_menu_->popup(static_cast<QMouseEvent*>(e)->globalPos());
        break;

      case QEvent::DragEnter: {
        QDragEnterEvent* event = static_cast<QDragEnterEvent*>(e);
        if (AlbumCoverChoiceController::CanAcceptDrag(event)) {
          event->acceptProposedAction();
        }
        break;
      }

      case QEvent::Drop: {
        const QDropEvent* event = static_cast<QDropEvent*>(e);
        const QModelIndexList sel =
            ui_->song_list->selectionModel()->selectedIndexes();
        Song* song = GetFirstSelected();

        const QString cover =
            album_cover_choice_controller_->SaveCover(song, event);
        if (!cover.isEmpty()) {
          UpdateCoverOf(*song, sel, cover);
        }

        break;
      }

      default:
        break;
    }
  }
  return false;
}
示例#23
0
void GameViewer::DClick(wxListEvent& event)
{
	long i = GetFirstSelected();
	if (i < 0) return;

	const std::string& path = m_path + m_game_data[i].root;

	Emu.Stop();

	Debug::AutoPause::getInstance().Reload();

	Emu.GetVFS().Init("/");
	std::string local_path;
	if (Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path))
	{
		LOG_ERROR(HLE, "Boot error: elf not found! [%s]", path.c_str());
		return;
	}

	if (rpcs3::config.misc.always_start.value() && Emu.IsReady())
	{
		Emu.Run();
	}
}
示例#24
0
bool CFileListView::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
{
	switch (wID)
	{
	case MENU_LOOK:
		LookItem(GetFirstSelected());
		break;
	case MENU_EXTRACT:
		ExtractSelect();
		break;
	case MENU_RENAME:
		break;
	case MENU_DELETE:
		{
			if(m_pArchive != NULL)
			{
				RemoveFileNode(*(m_FileStack.back()), GetCurrentSelected());
				ShowFileInfo(*(m_FileStack.back()));
			}
		}
		break;
	case MENU_NEW:
		{
			if(m_pArchive == NULL)
			{
				char szBuffer[MAX_PATH] = {0}; 
				OPENFILENAME ofn= {0}; 

				ofn.lStructSize = sizeof(ofn); 
				ofn.hwndOwner = m_hWnd; 
				ofn.lpstrFilter = "JArchive文件(*.arc)\0*.arc\0所有文件(*.*)\0*.*\0";
				ofn.nFilterIndex = 0; 
				ofn.lpstrInitialDir = NULL;
				ofn.lpstrFile = szBuffer;
				ofn.nMaxFile = MAX_PATH; 
				ofn.Flags = OFN_OVERWRITEPROMPT;

				if(GetSaveFileName(&ofn))
				{
					char* pExt = strrchr(szBuffer,'.');
					if(pExt == NULL)
						strcat_s(szBuffer, MAX_PATH, ".arc");

					m_pArchive = archive_create(szBuffer,0);
					if(m_pArchive != NULL && m_pParent != NULL)
					{
						char szTitle[MAX_PATH];
						sprintf_s(szTitle, MAX_PATH, "JArchiveEditor - %s",szBuffer);
						m_pParent->SetWindowText(szTitle);
						strcpy_s(m_szArchiveName, MAX_PATH, szBuffer);
					}
				}
			}
		}
		break;
	case MENU_OPEN:
		{
			if(m_pArchive == NULL)
			{
				char szBuffer[MAX_PATH] = {0}; 
				OPENFILENAME ofn= {0};

				ofn.lStructSize = sizeof(ofn); 
				ofn.hwndOwner = m_hWnd; 
				ofn.lpstrFilter = "JArchive文件(*.arc)\0*.arc\0所有文件(*.*)\0*.*\0";
				ofn.nFilterIndex = 0; 
				ofn.lpstrInitialDir = NULL;
				ofn.lpstrFile = szBuffer;
				ofn.nMaxFile = MAX_PATH; 
				ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;

				if(GetOpenFileName(&ofn))
					OpenArchive(szBuffer);
			}
		}
		break;
	case MENU_CLOSE:
		CloseArchive();
		break;
	case MENU_EXTRACT_FILEINFO:
		{
			char szSavePath[MAX_PATH];
			OPENFILENAME ofn = {0};

			if(m_pArchive == NULL)
				break;

			char* pName = strrchr(m_szArchiveName, '\\');
			if(pName != NULL)
				strcpy_s(szSavePath, MAX_PATH, pName+1);
			else
				strcpy_s(szSavePath, MAX_PATH, m_szArchiveName);

			pName = strrchr(szSavePath, '.');
			if(pName != NULL)
				*pName = 0;

			ofn.lStructSize = sizeof(ofn); 
			ofn.hwndOwner = m_hWnd; 
			ofn.lpstrFilter = "JArchive文件信息(*.afi)\0*.afi\0所有文件(*.*)\0*.*\0";
			ofn.nFilterIndex = 0; 
			ofn.lpstrInitialDir = NULL;
			ofn.lpstrFile = szSavePath;
			ofn.nMaxFile = MAX_PATH; 
			ofn.Flags = OFN_OVERWRITEPROMPT;

			if(GetSaveFileName(&ofn))
			{
				char* pExt = strrchr(szSavePath,'.');
				if(pExt == NULL)
					strcat_s(szSavePath, MAX_PATH, ".afi");

				archive_extract_describe(m_pArchive, szSavePath);
			}
		}
		break;
	}
	return false;
}
示例#25
0
void EditTagDialog::SaveCoverToFile() {
  Song* song = GetFirstSelected();
  if (!song) return;

  album_cover_choice_controller_->SaveCoverToFile(*song, original_);
}