Ejemplo n.º 1
0
bool CGUIWindowJukeboxSongs::OnContextButton(CFileItemPtr pItem, CONTEXT_BUTTON button) {
  if (m_vecItems->IsVirtualDirectoryRoot() && pItem) {
    if (CGUIDialogContextMenu::OnContextButton("music", pItem, button)) {
      if (button == CONTEXT_BUTTON_REMOVE_SOURCE)
        OnRemoveSource(pItem);

      Update("");
      return true;
    }
  }

  switch (button) {
    case CONTEXT_BUTTON_SCAN:
      OnScan(pItem);
      return true;

    case CONTEXT_BUTTON_RIP_TRACK:
      OnRipTrack(pItem);
      return true;

    case CONTEXT_BUTTON_RIP_CD:
      OnRipCD();
      return true;

    case CONTEXT_BUTTON_CDDB:
      if (m_musicdatabase.LookupCDDBInfo(true))
        Update(m_vecItems->GetPath());
      return true;

    case CONTEXT_BUTTON_DELETE:
      OnDeleteItem(pItem);
      return true;

    case CONTEXT_BUTTON_RENAME:
      OnRenameItem(pItem);
      return true;

    case CONTEXT_BUTTON_SWITCH_MEDIA:
      CGUIDialogContextMenu::SwitchMedia("music", m_vecItems->GetPath());
      return true;
    default:
      break;
  }
  return CGUIWindowJukeboxBase::OnContextButton(pItem, button);
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
// General.
// -----------------------------------------------------------------------------
ReAnimGraphicsScene::ReAnimGraphicsScene( ReAnimModel* _model, QObject* _parent /* = NULL */ )
: TSuper( _parent )
, m_editMenu( NULL )
{
	const int width = 2000;
	const int height = 2000;
	QColor penColor( 190, 190, 190 );
	setSceneRect( -width / 2, -height / 2, width, height );
	setBackgroundBrush( QBrush( Qt::gray ) );
	QGraphicsLineItem* lineA = addLine( -width / 2, 0, width / 2, 0, QPen( penColor ) );
	lineA->setZValue( -999.0f );
	QGraphicsLineItem* lineB = addLine( 0, -height / 2, 0, height / 2, QPen( penColor ) );
	lineA->setZValue( -999.0f );

	m_editMenu = new QMenu();
	m_createItemAction = m_editMenu->addAction( tr( "&Add Item" ) );
	connect( m_createItemAction, SIGNAL( triggered() ), this, SLOT( OnAddItem() ) );
	m_deleteItemAction = m_editMenu->addAction( tr( "&Delete Item" ) );
	connect( m_deleteItemAction, SIGNAL( triggered() ), this, SLOT( OnDeleteItem() ) );
}
Ejemplo n.º 3
0
void ContentPane::OnKeyDown(_In_ NMTVKEYDOWN* ptvkd)
{
    HTREEITEM selectedItem = _archivePane.GetSelectedItem();
    if (selectedItem != NULL)
    {
        switch(ptvkd->wVKey)
        {
        case VK_DELETE:
            OnDeleteItem(selectedItem);
            break;

        case VK_F1:
            _notifyView->OnContentFrameChanged(false);
            break;

        case VK_F2:
            _notifyView->OnContentFrameChanged(true);
            break;

        default:
            break;
        }
    }
}
Ejemplo n.º 4
0
/*
	OnDeleteFile()
*/
void CWallBrowserFileView::OnDeleteFile(void)
{
	CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
	
	if(pDoc)
	{
		if(pDoc->HavePathName() && pDoc->HaveFileName())
		{
			_snprintf(m_szFileName,
					sizeof(m_szFileName)-1,
					"%s%s",
					pDoc->GetPathName(),
					pDoc->GetFileName()
					);
			
			BOOL bDelete = FALSE;
			BOOL bDeleteToRecycleBin = TRUE;
			BOOL bConfirmFileDelete = TRUE;
			
			CWinAppEx* pWinAppEx = (CWinAppEx*)AfxGetApp();
			if(pWinAppEx)
			{
				bDeleteToRecycleBin = pWinAppEx->m_Config.GetNumber(WALLBROWSER_OPTIONS_KEY,WALLBROWSER_DELETEFILESTORECYCLEBIN_KEY);
				bConfirmFileDelete = pWinAppEx->m_Config.GetNumber(WALLBROWSER_OPTIONS_KEY,WALLBROWSER_CONFIRMFILEDELETE_KEY);
			}

			if(bDeleteToRecycleBin)
			{
				bDelete = ::DeleteFileToRecycleBin(this->m_hWnd,m_szFileName,bConfirmFileDelete);
			}
			else
			{
				if(bConfirmFileDelete)
					bDelete = ::MessageBoxResourceEx(this->m_hWnd,MB_ICONQUESTION|MB_YESNO,WALLBROWSER_PROGRAM_NAME,IDS_QUESTION_FILEDELETE,m_szFileName)==IDYES;
				else
					bDelete = TRUE;
				if(bDelete)
					::DeleteFile(m_szFileName);
			}

			if(bDelete)
			{
				int nItem = OnDeleteItem();
				OnSelectItem(nItem);

				int nTotItems = GetListCtrl().GetItemCount();
				CWnd* pWnd = AfxGetMainWnd();
				if(pWnd)
				{
					pWnd->SendMessage(WM_VIEW_PREVIOUS_PICTURE,nTotItems > 0 ? TRUE : FALSE,0L);
					pWnd->SendMessage(WM_VIEW_NEXT_PICTURE,nTotItems > 0 ? TRUE : FALSE,0L);
				}

				if(m_pMainFrameStatusBar)
				{
					char szStatus[_MAX_PATH+1];

					_snprintf(szStatus,
							sizeof(szStatus)-1,
							"%d file(s)",
							--m_nFiles
							);
					m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILES_ID,szStatus);

					_snprintf(szStatus,
							sizeof(szStatus)-1,
							"%d picture(s)",
							--m_nPictures
							);
					m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_PICTURES_ID,szStatus);
				}
			}
		}
	}
}
Ejemplo n.º 5
0
/*
	OnMoveFile()
*/
void CWallBrowserFileView::OnMoveFile(void)
{
	CWinAppEx* pWinAppEx = (CWinAppEx*)AfxGetApp();
	CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
	
	if(pWinAppEx && pDoc)
	{
		if(pDoc->HavePathName() && pDoc->HaveFileName())
		{
			char szFolder[_MAX_PATH+1] = {0};
			char szDestinationFile[_MAX_PATH+1] = {0};

			// selezione della directory
			CDirDialog dlg(pWinAppEx->m_Config.GetString(WALLBROWSER_OPTIONS_KEY,WALLBROWSER_LASTMOVETODIR_KEY),
						"Move To...",
						"Select a folder:"
						);
select_dir:
			if(dlg.DoModal()==IDOK)
			{
				strcpyn(szFolder,dlg.GetPathName(),sizeof(szFolder));
				pWinAppEx->m_Config.UpdateString(WALLBROWSER_OPTIONS_KEY,WALLBROWSER_LASTMOVETODIR_KEY,szFolder);
				pWinAppEx->m_Config.SaveKey(WALLBROWSER_INSTALL_KEY,WALLBROWSER_LASTMOVETODIR_KEY);
				
				_snprintf(m_szFileName,
						sizeof(m_szFileName)-1,
						"%s%s",
						pDoc->GetPathName(),
						pDoc->GetFileName()
						);
				
				_snprintf(szDestinationFile,sizeof(szDestinationFile)-1,"%s\\%s",szFolder,pDoc->GetFileName());
				
				if(strcmp(m_szFileName,szDestinationFile)==0)
				{
					dlg.SetWindowTitle("Move To...");
					dlg.SetTitle("Select a folder (the destination folder cannot be the same as the source folder):");
					goto select_dir;
				}

				BOOL bMoved = FALSE;
				if(m_szFileName[1]==':' && szDestinationFile[1]==':' && (m_szFileName[0]!=szDestinationFile[0]))
				{
					bMoved = ::CopyFile(m_szFileName,szDestinationFile,FALSE);
					::DeleteFile(m_szFileName);
				}
				else
				{
					::DeleteFile(szDestinationFile);
					bMoved = ::MoveFile(m_szFileName,szDestinationFile);
				}

				if(bMoved)
				{
					int nItem = OnDeleteItem();
					OnSelectItem(nItem);

					int nTotItems = GetListCtrl().GetItemCount();
					CWnd* pWnd = AfxGetMainWnd();
					if(pWnd)
					{
						pWnd->SendMessage(WM_VIEW_PREVIOUS_PICTURE,nTotItems > 0 ? TRUE : FALSE,0L);
						pWnd->SendMessage(WM_VIEW_NEXT_PICTURE,nTotItems > 0 ? TRUE : FALSE,0L);
					}

					if(m_pMainFrameStatusBar)
					{
						char szStatus[_MAX_PATH+1];

						_snprintf(szStatus,
								sizeof(szStatus)-1,
								"%d file(s)",
								--m_nFiles
								);
						m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILES_ID,szStatus);

						_snprintf(szStatus,
								sizeof(szStatus)-1,
								"%d picture(s)",
								--m_nPictures
								);
						m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_PICTURES_ID,szStatus);
					}
				}
			}
		}
	}
}
Ejemplo n.º 6
0
	//--------------------------------------------------------------------------------
	long CTreeView::OnNotify( NotificationMessageHeader* pHdr )
	{
		_WINQ_FCONTEXT( "CTreeView::OnNotify" );
		long lResult = 0;

		if( pHdr != 0 )
		{
			switch ( pHdr->m_uiCode )
			{
			case NM_CLICK:
				{
					lResult = static_cast< long >( OnClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_CUSTOMDRAW:
				{
					lResult = OnCustomDraw( reinterpret_cast< NMTVCUSTOMDRAW* >( pHdr ) );
				}
				break;
			case NM_DBLCLK:
				{
					lResult = static_cast< long >( OnDblClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_KILLFOCUS:
				{
					OnKillFocus( pHdr );
				}
				break;
			case NM_RCLICK:
				{
					lResult = static_cast< long >( OnRClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_RDBLCLK:
				{
					lResult = static_cast< long >( OnRDblClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_RETURN:
				{
					lResult = static_cast< long >( OnReturn( pHdr ) ? 0 : 1 );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case NM_SETCURSOR:
				{
					lResult = static_cast< long >( OnSetCursor( reinterpret_cast< NMMOUSE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
			case NM_SETFOCUS:
				{
					OnSetFocus( pHdr );
				}
				break;
#if		( _WIN32_IE >= 0x0600 )
			case TVN_ASYNCDRAW:
				{
					OnAsyncDraw( reinterpret_cast< NMTVASYNCDRAW* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0600 )
			case TVN_BEGINDRAG:
				{
					OnBeginDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_BEGINLABELEDIT:
				{
					lResult = static_cast< long >( OnBeginLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_BEGINRDRAG:
				{
					OnBeginRDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_DELETEITEM:
				{
					OnDeleteItem( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_ENDLABELEDIT:
				{
					lResult = static_cast< long >( OnEndLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 1 : 0 );
				}
				break;
			case TVN_GETDISPINFO:
				{
					OnGetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case TVN_GETINFOTIP:
				{
					OnGetInfoTip( reinterpret_cast< NMTVGETINFOTIP* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
#if		( _WIN32_IE > 0x0600 )
			case TVN_ITEMCHANGED:
				{
					lResult = static_cast< long >( OnItemChanged( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_ITEMCHANGING:
				{
					lResult = static_cast< long >( OnItemChanging( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
#endif//( _WIN32_IE > 0x0600 )
			case TVN_ITEMEXPANDED:
				{
					OnItemExpanded( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_ITEMEXPANDING:
				{
					lResult = static_cast< long >( OnItemExpanding( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_KEYDOWN:
				{
					lResult = static_cast< long >( OnKeyDown( reinterpret_cast< NMTVKEYDOWN* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_SELCHANGED:
				{
					OnSelChanged( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_SELCHANGING:
				{
					lResult = static_cast< long >( OnSelChanging( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_SETDISPINFO:
				{
					OnSetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case TVN_SINGLEEXPAND:
				{
					lResult = OnSingleExpand( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
			default:
				{
					lResult = OnUnknownNotification( pHdr );
				}
				break;
			}
		}
		return lResult;
	}
Ejemplo n.º 7
0
	void TinyListView::LvnDeleteItem(INT iItem)
	{
		OnDeleteItem(iItem);
	}
Ejemplo n.º 8
0
	//--------------------------------------------------------------------------------
	bool CWinCtrlParentController::ProcessMessage( COSWindow& Window, Cmp_long_ptr& lResult, unsigned int uMsg, Cmp_uint_ptr wParam, Cmp_long_ptr lParam )
	{
		_WINQ_FCONTEXT( "CWinCtrlParentController:ProcessMessage" );
		bool bProcessed = ProcessHook( Window, lResult, uMsg, wParam, lParam );

		switch ( uMsg )
		{
		case COSWindow::wmCtlColorMsgBox:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refMsgBox = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColourMsgBox( Window, refDC, refMsgBox )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorEdit:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refEdit = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColour( Window, refDC, refEdit, COSWindow::wmCtlColorEdit )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorListBox:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refListBox = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColour( Window, refDC, refListBox, COSWindow::wmCtlColorListBox )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorBtn:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refButton = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColour( Window, refDC, refButton, COSWindow::wmCtlColorBtn )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorDlg:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refDlg = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColourDialog( Window, refDC, refDlg )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorScrollbar:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refScrollBar = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColour( Window, refDC, refScrollBar, COSWindow::wmCtlColorStatic )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCtlColorStatic:
			{
				CDeviceContext::refType refDC = CDeviceContext::FromHandle( CDCHandle( (CDCInternal*)0, (void*)( wParam ) ).Ref() );
				COSWindow::refType refStatic = COSWindow::FromHandle( CWindowHandle( 0, (void*)(lParam ) ).Ref() );
				lResult = reinterpret_cast< long >( OnCtlColour( Window, refDC, refStatic, COSWindow::wmCtlColorStatic )->Handle()->AsHandle().ptr() );
				bProcessed = true;
			}
			break;
		case COSWindow::wmDrawItem:
			{
					DrawItemStruct* pItemStruct = reinterpret_cast< DrawItemStruct* >( lParam );
					OnDrawItem( Window, wParam, pItemStruct );
					lResult = 1;
					bProcessed = true;
			}
			break;
		case COSWindow::wmCompareItem:
			{
				lResult = OnCompareItem( Window, wParam, reinterpret_cast< ComparisonItem* >( lParam ) );					
				bProcessed = true;
			}
			break;
		case COSWindow::wmMeasureItem:
			{
				nsWin32::MeasureItemStruct* pItemStruct = reinterpret_cast< nsWin32::MeasureItemStruct* >( lParam );
				OnMeasureItem( Window, wParam, pItemStruct );
				lResult = 1;
				bProcessed = true;
			}
			break;
		case COSWindow::wmDeleteItem:
			{
				nsWin32::DeleteItemStruct* pItemStruct = reinterpret_cast< nsWin32::DeleteItemStruct* >( lParam );
				OnDeleteItem( Window, wParam, pItemStruct );
				lResult = 1;
				bProcessed = true;
			}
			break;
		case COSWindow::wmVKeyToItem:
			{
				unsigned short wVKey = LoWord( wParam );
				unsigned short wPos = HiWord( wParam );
				COSWindow::refType refListBox = COSWindow::FromHandle( CWindowHandle( 0, (void*)( lParam ) ).Ref() );
				lResult = OnVKeyToItem( Window, wVKey, wPos, refListBox );
				bProcessed = true;
			}
			break;
		case COSWindow::wmCharToItem:
			{
				unsigned short wKey = LoWord( wParam );
				unsigned short wPos = HiWord( wParam );
				COSWindow::refType refListBox = COSWindow::FromHandle( CWindowHandle( 0, (void*)( lParam ) ).Ref() );
				lResult = OnCharToItem( Window, wKey, wPos, refListBox );
				bProcessed = true;
			}
			break;
		}			

		return bProcessed;
	}