コード例 #1
0
void ModEditWindow::JarModListCtrl::PasteMod()
{
	wxFileDataObject data;

	// Get data from the clipboard.
	if (wxTheClipboard->Open())
	{
		if (wxTheClipboard->IsSupported(wxDF_FILENAME))
		{
			wxTheClipboard->GetData(data);
		}
		else
		{
			wxTheClipboard->Close();
			return;
		}
		wxTheClipboard->Close();
	}

	// Determine where to insert the files.
	int insertPoint = m_inst->GetModList()->size();
	if (GetSelectedItems().Count() > 0)
		insertPoint = GetSelectedItems()[0];

	// Add the given mods.
	wxArrayString filenames = data.GetFilenames();
	for (wxArrayString::iterator iter = filenames.begin(); iter != filenames.end(); ++iter)
	{
		m_inst->GetModList()->InsertMod(insertPoint, *iter);
	}
	UpdateItems();
}
コード例 #2
0
void SFbxSSceneBaseMeshListView::SetSelectionImportState(bool MarkForImport)
{
	TArray<FbxMeshInfoPtr> SelectedFbxMeshes;
	GetSelectedItems(SelectedFbxMeshes);
	for (auto Item : SelectedFbxMeshes)
	{
		FbxMeshInfoPtr ItemPtr = Item;
		ItemPtr->bImportAttribute = MarkForImport;
	}
}
コード例 #3
0
void ModEditWindow::JarModListCtrl::DeleteMod()
{
	if (GetItemCount() <= 0)
		return;
	
	wxArrayInt indices = GetSelectedItems();
	for (int i = indices.GetCount() -1; i >= 0; i--)
	{
		m_inst->GetModList()->DeleteMod(indices[i]);
	}
	UpdateItems();
}
コード例 #4
0
ファイル: PcListBox.cpp プロジェクト: Hreinnjons/guayadeque
// -------------------------------------------------------------------------------- //
int guPcListBox::GetSelectedSongs( guTrackArray * songs, const bool isdrag ) const
{
    wxArrayInt Items = GetSelectedItems();
    int Index;
    int Count = Items.Count();
    for( Index = 0; Index < Count; Index++ )
    {
        if( Items[ Index ] )
            Items[ Index ]--;
    }
    Count = m_Db->GetPlayCountsSongs( Items, songs );
    m_LibPanel->NormalizeTracks( songs, isdrag );
    return Count;
}
コード例 #5
0
ファイル: InventoryUI.cpp プロジェクト: belven/Mech_RPG
void UInventoryUI::EquipItems()
{
	for (UItemUI* itemUI : GetSelectedItems()) {
		AItem* item = itemUI->GetItem();
		if (item != nullptr && item->GetClass()->IsChildOf(AWeapon::StaticClass())) {
			GetOwner()->SetCurrentWeapon(Cast<AWeapon>(item));
		}
		/*else if (item->GetClass()->IsChildOf(UArmour::StaticClass())) {
			GetOwner()->AddArmour(Cast<UArmour>(item));
		}
		else if (item->GetClass()->IsChildOf(UAbility::StaticClass())) {
			GetOwner()->AddAbility(Cast<UAbility>(item));
		}*/
		itemUI->DeselectItem();
	}
}
コード例 #6
0
ファイル: RulesDlg.cpp プロジェクト: JasonSchlauch/mfcmapi
void CRulesDlg::OnModifySelectedItem()
{
	HRESULT		hRes = S_OK;
	CWaitCursor	Wait; // Change the mouse to an hourglass while we work.

	LPROWLIST lpSelectedItems = NULL;

	EC_H(GetSelectedItems(RULE_INCLUDE_ID|RULE_INCLUDE_OTHER, ROW_MODIFY, &lpSelectedItems));

	if (lpSelectedItems)
	{
		EC_MAPI(m_lpExchTbl->ModifyTable(
			0,
			lpSelectedItems));
		MAPIFreeBuffer(lpSelectedItems);
		if (S_OK == hRes) OnRefreshView();
	}
} // CRulesDlg::OnModifySelectedItem
コード例 #7
0
void SFbxSSceneBaseMeshListView::OnSelectionChanged(FbxMeshInfoPtr Item, ESelectInfo::Type SelectionType)
{
	//Change the option selection
	TArray<FbxMeshInfoPtr> SelectedFbxMeshes;
	GetSelectedItems(SelectedFbxMeshes);
	for (FbxMeshInfoPtr SelectItem : SelectedFbxMeshes)
	{
		for (auto kvp : *OverrideNameOptionsMap)
		{
			if (kvp.Key.Compare(SelectItem->OptionName) == 0)
			{
				OptionComboBox->SetSelectedItem(FindOptionNameFromName(kvp.Key));
				return;
			}
		}
	}
	//Select Default in case we don't have a valid OptionName
	OptionComboBox->SetSelectedItem(FindOptionNameFromName(UFbxSceneImportFactory::DefaultOptionName));
}
コード例 #8
0
ファイル: savemgrwindow.cpp プロジェクト: Edgars7363/MultiMC4
void SaveMgrWindow::SaveListCtrl::OnCopy(wxCommandEvent& event)
{
	WorldList *worlds = m_inst->GetWorldList();
	wxFileDataObject *worldFileObj = new wxFileDataObject;

	wxArrayInt indices = GetSelectedItems();
	for (wxArrayInt::const_iterator iter = indices.begin(); iter != indices.end(); ++iter)
	{
		wxFileName worldFile = worlds->at(*iter).GetSaveDir();
		worldFile.MakeAbsolute();
		worldFileObj->AddFile(worldFile.GetFullPath());
	}

	if (wxTheClipboard->Open())
	{
		wxTheClipboard->SetData(worldFileObj);
		wxTheClipboard->Close();
	}
}
コード例 #9
0
ファイル: AudioList.cpp プロジェクト: HaikuArchives/BurnItNow
void
AudioListView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kDraggedItem:
		{
			BPoint dropPoint = message->DropPoint();
			int32 dropIndex = IndexOf(ConvertFromScreen(dropPoint));
			int32 count = CountItems();
			if (dropIndex < 0 || dropIndex > count)
				dropIndex = count;

			BList indices;
			GetSelectedItems(indices);
			MoveItems(indices, dropIndex);

			RenumberTracks();
			break;
		}
		case kDeleteItem:
		{
			if (!IsEmpty()) {
				RemoveSelected();

				if (!IsEmpty())
					RenumberTracks();
			}
			// fake to update button state and calculate SizeBar
			Looper()->PostMessage(B_REFS_RECEIVED);
			break;
		}
		case kPopupClosed:
		{
			fShowingPopUpMenu = false;
			break;
		}
		default:
		{
			BListView::MessageReceived(message);
			break;
		}
	}
}
コード例 #10
0
ファイル: AudioList.cpp プロジェクト: HaikuArchives/BurnItNow
void
AudioListView::RemoveSelected()
{
	BList indices;
	GetSelectedItems(indices);
	int32 index = CurrentSelection() - 1;

	DeselectAll();

	if (indices.CountItems() > 0)
		RemoveItemList(indices);

	if (CountItems() > 0) {
		if (index < 0)
			index = 0;

		Select(index);
	}
}
コード例 #11
0
void ModEditWindow::MLModListCtrl::CopyMod()
{
	ModList *mods = m_inst->GetMLModList();
	wxFileDataObject *modFileObj = new wxFileDataObject;

	wxArrayInt indices = GetSelectedItems();
	for (wxArrayInt::const_iterator iter = indices.begin(); iter != indices.end(); ++iter)
	{
		wxFileName modFile = mods->at(*iter).GetFileName();
		modFile.MakeAbsolute();
		modFileObj->AddFile(modFile.GetFullPath());
	}

	if (wxTheClipboard->Open())
	{
		wxTheClipboard->SetData(modFileObj);
		wxTheClipboard->Close();
	}
}
コード例 #12
0
ファイル: AclDlg.cpp プロジェクト: JasonSchlauch/mfcmapi
void CAclDlg::OnDeleteSelectedItem()
{
    HRESULT		hRes = S_OK;
    CWaitCursor	Wait; // Change the mouse to an hourglass while we work.

    LPROWLIST lpSelectedItems = NULL;

    EC_H(GetSelectedItems(ACL_INCLUDE_ID, ROW_REMOVE, &lpSelectedItems));

    if (lpSelectedItems)
    {
        EC_MAPI(m_lpExchTbl->ModifyTable(
                    m_ulTableFlags,
                    lpSelectedItems));
        MAPIFreeBuffer(lpSelectedItems);
        if (S_OK == hRes)
            OnRefreshView();
    }
} // CAclDlg::OnDeleteSelectedItem
コード例 #13
0
void SFbxSSceneBaseMeshListView::AssignToOptions(FString OptionName)
{
	bool IsDefaultOptions = OptionName.Compare(UFbxSceneImportFactory::DefaultOptionName) == 0;
	if (!OverrideNameOptionsMap->Contains(OptionName) && !IsDefaultOptions)
	{
		return;
	}
	TArray<FbxMeshInfoPtr> SelectedFbxMeshes;
	GetSelectedItems(SelectedFbxMeshes);
	for (FbxMeshInfoPtr ItemPtr : SelectedFbxMeshes)
	{
		if (ItemPtr->bOriginalTypeChanged)
		{
			continue;
		}
		ItemPtr->OptionName = OptionName;
	}
	OptionComboBox->SetSelectedItem(FindOptionNameFromName(OptionName));
}
コード例 #14
0
void SFbxSSceneBaseMeshListView::AssignToPivot(uint64 NodeUid)
{
	FbxNodeInfoPtr NodeInfo = FindNodeInfoByUid(NodeUid, SceneInfo);
	TArray<FbxMeshInfoPtr> SelectedFbxMeshes;
	int32 SelectCount = GetSelectedItems(SelectedFbxMeshes);
	for (FbxMeshInfoPtr MeshInfo : SelectedFbxMeshes)
	{
		if (MeshInfo->bOriginalTypeChanged)
		{
			continue;
		}
		MeshInfo->PivotNodeUid = NodeUid;
		if (NodeUid == INVALID_UNIQUE_ID)
		{
			MeshInfo->PivotNodeName = TEXT("-");
		}
		else if(NodeInfo.IsValid())
		{
			MeshInfo->PivotNodeName = NodeInfo->NodeName;
		}
	}
}
コード例 #15
0
ファイル: AlListBox.cpp プロジェクト: anonbeat/guayadeque
// -------------------------------------------------------------------------------- //
void guAlListBox::ReloadItems( bool reset )
{
    wxArrayInt Selection;
    int FirstVisible = GetVisibleRowsBegin();

    if( reset )
        SetSelection( -1 );
    else
        Selection = GetSelectedItems( false );

    m_Items->Empty();

    GetItemsList();
    m_Items->Insert( new guAlbumItem( 0, wxString::Format( wxT( "%s (%lu)" ), _( "All" ), m_Items->Count() ) ), 0 );
    SetItemCount( m_Items->Count() );

    if( !reset )
    {
      SetSelectedItems( Selection );
      ScrollToRow( FirstVisible );
    }
    RefreshAll();
}
コード例 #16
0
void SFbxSSceneBaseMeshListView::FillPivotContextMenu(FMenuBuilder& MenuBuilder)
{
	TArray<FbxMeshInfoPtr> SelectedFbxMeshes;
	int32 SelectCount = GetSelectedItems(SelectedFbxMeshes);

	uint64 InvalidUid = INVALID_UNIQUE_ID;
	if (SelectedFbxMeshes.Num() == 1)
	{
		FbxMeshInfoPtr Item = SelectedFbxMeshes[0];
		if (Item->bOriginalTypeChanged)
			return;
		MenuBuilder.AddMenuEntry(Item->PivotNodeUid == INVALID_UNIQUE_ID ? LOCTEXT("ResetPivotBakeCurrent", "* No Pivot Bake") : LOCTEXT("ResetPivotBake", "No Pivot Bake"), FText(), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SFbxSSceneBaseMeshListView::AssignToPivot, InvalidUid)));
		for (auto Kvp : Item->NodeReferencePivots)
		{
			//Create an entry for each pivot
			const FVector &PivotValue = Kvp.Key;
			const TArray<uint64> &NodeUids = Kvp.Value;
			bool IsCurrentPivotSelected = false;
			for (uint64 NodeUid : NodeUids)
			{
				if (Item->PivotNodeUid == NodeUid)
				{
					IsCurrentPivotSelected = true;
					break;
				}
			}
			FString MenuText = (IsCurrentPivotSelected ? TEXT("* Pivot: ") : TEXT("Pivot: ")) + PivotValue.ToCompactString();
			FString MenuTooltipText = IsCurrentPivotSelected ? LOCTEXT("PivotCurrentMenuItemTooltip", "This is the pivot that will be use to import this mesh. Node Number using this pivot: ").ToString() : LOCTEXT("PivotMenuItemTooltip", "Node Number using this pivot: ").ToString();
			MenuTooltipText.AppendInt(NodeUids.Num());
			MenuBuilder.AddMenuEntry(FText::FromString(*MenuText), FText::FromString(*MenuTooltipText), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SFbxSSceneBaseMeshListView::AssignToPivot, NodeUids[0])));
		}
	}
	else
	{
		MenuBuilder.AddMenuEntry(LOCTEXT("ResetPivotBakeAll", "All No Pivot Bake"), FText(), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SFbxSSceneBaseMeshListView::AssignToPivot, InvalidUid)));
	}
}
コード例 #17
0
ファイル: AlListBox.cpp プロジェクト: anonbeat/guayadeque
// -------------------------------------------------------------------------------- //
void guAlListBox::OnCommandClicked( wxCommandEvent &event )
{
    int index;
    int count;
    wxArrayInt Selection = GetSelectedItems();
    if( Selection.Count() )
    {
        index = event.GetId();

        guConfig * Config = ( guConfig * ) guConfig::Get();
        if( Config )
        {
            wxArrayString Commands = Config->ReadAStr( CONFIG_KEY_COMMANDS_EXEC, wxEmptyString, CONFIG_PATH_COMMANDS_EXECS );

            //guLogMessage( wxT( "CommandId: %u" ), index );
            index -= ID_COMMANDS_BASE;
            wxString CurCmd = Commands[ index ];

            if( CurCmd.Find( guCOMMAND_ALBUMPATH ) != wxNOT_FOUND )
            {
                wxArrayString AlbumPaths = m_Db->GetAlbumsPaths( Selection );
                wxString Paths = wxEmptyString;
                count = AlbumPaths.Count();
                for( index = 0; index < count; index++ )
                {
                    //Paths += wxT( " \"" ) + AlbumPaths[ index ] + wxT( "\"" );
                    AlbumPaths[ index ].Replace( wxT( " " ), wxT( "\\ " )  );
                    Paths += wxT( " " ) + AlbumPaths[ index ];
                }
                CurCmd.Replace( guCOMMAND_ALBUMPATH, Paths.Trim( false ) );
            }

            if( CurCmd.Find( guCOMMAND_COVERPATH ) != wxNOT_FOUND )
            {
                int CoverId = m_Db->GetAlbumCoverId( Selection[ 0 ] );
                wxString CoverPath = wxEmptyString;
                if( CoverId > 0 )
                {
                    CoverPath = wxT( "\"" ) + m_Db->GetCoverPath( CoverId ) + wxT( "\"" );
                }
                CurCmd.Replace( guCOMMAND_COVERPATH, CoverPath );
            }

            if( CurCmd.Find( guCOMMAND_TRACKPATH ) != wxNOT_FOUND )
            {
                guTrackArray Songs;
                wxString SongList = wxEmptyString;
                if( m_Db->GetAlbumsSongs( Selection, &Songs ) )
                {
                    count = Songs.Count();
                    for( index = 0; index < count; index++ )
                    {
                        SongList += wxT( " \"" ) + Songs[ index ].m_FileName + wxT( "\"" );
                    }
                    CurCmd.Replace( guCOMMAND_TRACKPATH, SongList.Trim( false ) );
                }
            }

            //guLogMessage( wxT( "Execute Command '%s'" ), CurCmd.c_str() );
            guExecute( CurCmd );
        }
    }
}
コード例 #18
0
void EMFRecordEditorFrame::OnMoveDownClick( wxCommandEvent& event )
{
    wxArrayInt sel = GetSelectedItems();
    for (int i=0; i<sel.GetCount(); i++)
        SwapRecords(sel[i], sel[i]+1);
}
コード例 #19
0
ファイル: AlListBox.cpp プロジェクト: anonbeat/guayadeque
// -------------------------------------------------------------------------------- //
int guAlListBox::GetSelectedSongs( guTrackArray * tracks, const bool isdrag ) const
{
    int Count = m_Db->GetAlbumsSongs( GetSelectedItems(), tracks );
    m_LibPanel->NormalizeTracks( tracks, isdrag );
    return Count;
}
コード例 #20
0
void EMFRecordEditorFrame::OnDeleteRecordClick( wxCommandEvent& event )
{
    wxArrayInt sel = GetSelectedItems();
    for (int i=0; i<sel.GetCount(); i++)
        DeleteRecord(sel[i]);
}
コード例 #21
0
ファイル: CoListBox.cpp プロジェクト: Hreinnjons/guayadeque
// -------------------------------------------------------------------------------- //
int guCoListBox::GetSelectedSongs( guTrackArray * songs, const bool isdrag ) const
{
    int Count = m_Db->GetComposersSongs( GetSelectedItems(), songs );
    m_LibPanel->NormalizeTracks( songs, isdrag );
    return Count;
}
コード例 #22
0
ファイル: OpWindowList.cpp プロジェクト: prestocore/browser
BOOL OpWindowList::OnInputAction(OpInputAction* action)
{
	switch (action->GetAction())
	{
		case OpInputAction::ACTION_GET_ACTION_STATE:
		{
			OpInputAction* child_action = action->GetChildAction();
			OpTreeModelItem* item = GetSelectedItem();
			DesktopWindow* dw = item
					? static_cast<DesktopWindowCollectionItem*>(item)
							->GetDesktopWindow()
					: 0;

			switch(child_action->GetAction())
			{
				case OpInputAction::ACTION_MAXIMIZE_PAGE:
				case OpInputAction::ACTION_MINIMIZE_PAGE:
				case OpInputAction::ACTION_RESTORE_PAGE:
				case OpInputAction::ACTION_ACTIVATE_WINDOW:
				case OpInputAction::ACTION_DETACH_PAGE:
					{
						child_action->SetEnabled( dw && dw->GetType() != WINDOW_TYPE_BROWSER && dw->GetWorkspace() );
					}
					return TRUE;

				case OpInputAction::ACTION_RELOAD:
					{
						child_action->SetEnabled( dw && dw->GetType() == WINDOW_TYPE_DOCUMENT && dw->GetWorkspace() );
					}
					return TRUE;

				case OpInputAction::ACTION_LOCK_PAGE:
				case OpInputAction::ACTION_UNLOCK_PAGE:
					{
						UINT32 items = GetSelectedItemCount();
						if(items > 1)
						{
							child_action->SetSelected(FALSE);
						}
						else
						{
							child_action->SetEnabled( dw && dw->GetType() != WINDOW_TYPE_BROWSER && dw->GetWorkspace() );
							if(child_action->GetAction() == OpInputAction::ACTION_LOCK_PAGE)
							{
								child_action->SetSelected( dw && dw->IsLockedByUser());
							}
							else
							{
								child_action->SetSelected( dw && !dw->IsLockedByUser());
							}
						}
					}
					return TRUE;

				case OpInputAction::ACTION_CLOSE_PAGE:
					{
						UINT32 items = GetSelectedItemCount();
						if(items > 1)
						{
							child_action->SetEnabled(TRUE);
						}
						else
						{
							child_action->SetEnabled( dw && dw->IsClosableByUser());
						}
					}
					return TRUE;

				case OpInputAction::ACTION_DISSOLVE_TAB_GROUP:
				case OpInputAction::ACTION_CLOSE_TAB_GROUP:
					child_action->SetEnabled(item && item->GetType() == WINDOW_TYPE_GROUP);
					return TRUE;
			}
			return FALSE;
		}

		case OpInputAction::ACTION_LOCK_PAGE:
		case OpInputAction::ACTION_UNLOCK_PAGE:
			{
				OpINT32Vector items;
				INT32 idx;
				INT32 count = GetSelectedItems(items, FALSE);

				for(idx = 0; idx < count; idx++)
				{
					INT32 id = items.Get((UINT32)idx);
					OpTreeModelItem* item = GetItemByPosition(id);
					if (item)
					{
						DesktopWindow *window =
								static_cast<DesktopWindowCollectionItem*>(item)
										->GetDesktopWindow();
						if(window != NULL)
						{
							OpPagebar* pagebar = NULL;

							window->SetLockedByUser(window->IsLockedByUser() ? FALSE : TRUE);

							pagebar = (OpPagebar *)window->GetWidgetByType(OpTypedObject::WIDGET_TYPE_PAGEBAR);
							if(pagebar)
							{
								INT32 pos = pagebar->FindWidgetByUserData(window);
								if (pos >= 0)
								{
									OpWidget *button = pagebar->GetWidget(pos);
									if(button && button->IsOfType(WIDGET_TYPE_PAGEBAR_BUTTON))
									{
										pagebar->OnLockedByUser(static_cast<PagebarButton *>(button), window->IsLockedByUser());
									}
									else
									{
										if (button)
											button->Relayout(TRUE, TRUE);
									}
								}
							}
						}
					}
				}
				g_input_manager->UpdateAllInputStates();
			}
			return TRUE;

		// Only the first.
		case OpInputAction::ACTION_ACTIVATE_WINDOW:
		{
			OpTreeModelItem* item = GetSelectedItem();
			if (item)
			{
				DesktopWindow* window =
						static_cast<DesktopWindowCollectionItem*>(item)
								->GetDesktopWindow();
				if (!window)
					break;

				window->Activate();

#if defined(_UNIX_DESKTOP_)
				// We cannot do Raise() in Activate() in unix because focus-follows-mouse
				// focus mode shall activate but not auto raise a window [espen 2006-09-28]
				if( window->GetType() == WINDOW_TYPE_BROWSER )
				{
					window->GetOpWindow()->Raise();
				}
				else if( window->GetParentDesktopWindow() )
				{
					window->GetParentDesktopWindow()->GetOpWindow()->Raise();
					window->GetOpWindow()->Raise();
				}
#endif

			}
			return TRUE;
		}

		case OpInputAction::ACTION_DELETE:
		{
			OpInputAction new_action(OpInputAction::ACTION_CLOSE_PAGE);
			new_action.SetActionData(2);
			return OnInputAction(&new_action);
		}

		case OpInputAction::ACTION_SHOW_CONTEXT_MENU:
		{
			OnContextMenu(GetBounds().Center(), NULL, action->IsKeyboardInvoked());
			return TRUE;
		}
		case OpInputAction::ACTION_CLOSE_PAGE:
		{
			OpINT32Vector items;
			INT32 idx;
			INT32 count = GetSelectedItems(items, FALSE);

			for(idx = 0; idx < count; idx++)
			{
				INT32 id = items.Get((UINT32)idx);
				OpTreeModelItem* item = GetItemByPosition(id);
				if (item)
				{
					if (item->GetType() == WINDOW_TYPE_BROWSER)
					{
						BrowserDesktopWindow *window =
								static_cast<BrowserDesktopWindow*>(
										static_cast<DesktopWindowCollectionItem*>(
												item)->GetDesktopWindow());
						window->Close(FALSE, TRUE, FALSE);
						return TRUE;
					}
					else
					{
						DesktopWindow *window =
								static_cast<DesktopWindowCollectionItem*>(item)
										->GetDesktopWindow();
						if(window != NULL && window->IsClosableByUser())
						{
							window->Close(FALSE, TRUE, FALSE);
						}
					}
				}
			}
		}
		return TRUE;

		case OpInputAction::ACTION_FOCUS_NEXT_WIDGET:
		case OpInputAction::ACTION_FOCUS_PREVIOUS_WIDGET:
			return OpTreeView::OnInputAction(action);

		case OpInputAction::ACTION_DISSOLVE_TAB_GROUP:
		{
			DesktopWindowCollectionItem* item = static_cast<DesktopWindowCollectionItem*>(GetSelectedItem());
			if (item && item->GetType() == WINDOW_TYPE_GROUP)
				item->GetModel()->UnGroup(item);
			return TRUE;
		}
		case OpInputAction::ACTION_CLOSE_TAB_GROUP:
		{
			DesktopWindowCollectionItem* item = static_cast<DesktopWindowCollectionItem*>(GetSelectedItem());
			if (item && item->GetType() == WINDOW_TYPE_GROUP)
				item->GetModel()->DestroyGroup(item);
			return TRUE;
		}

		default:
		{
			// Prevent sending lowlevel events to desktop windows (bug #227626) [espen 2007-02-22]
			if( action->GetAction() < OpInputAction::LAST_ACTION )
			{
				OpINT32Vector items;
				int item_count = GetSelectedItems(items);
				BOOL handled = FALSE;

				for (INT32 i = 0; i < item_count; i++)
				{
					DesktopWindow* window = GetDesktopWindowByPosition(GetItemByID(items.Get(i)));
					if( window && window->OnInputAction(action) )
					{
						handled = TRUE;
					}
				}

				if (handled)
					return TRUE;
			}
		}
	}

	return OpTreeView::OnInputAction(action);
}
コード例 #23
0
ファイル: MuleListCtrl.cpp プロジェクト: windreamer/amule-dlp
void CMuleListCtrl::SortList()
{
	if (!IsSorting() && (m_sort_func && GetColumnCount())) {

		m_isSorting = true;
	
		MuleSortData sortdata(m_sort_orders, m_sort_func);

		// In many cases control already has correct order, and sorting causes nasty flickering.
		// Make one pass through it to check if sorting is necessary at all.
		int nrItems = GetItemCount();
		bool clean = true;
		long lastItemdata = 0;
		if (nrItems > 1) {
			lastItemdata = GetItemData(0);
		}
		for (int i = 1; i < nrItems; i++) {
			long nextItemdata = GetItemData(i);
			if (SortProc(lastItemdata, nextItemdata, (long int)&sortdata) > 0) {
				// ok - we need to sort
				clean = false;
				break;
			}
			lastItemdata = nextItemdata;
		}
		if (clean) {
			// no need to sort
			m_isSorting = false;
			return;
		}

		// Positions are likely to be invalid after sorting.
		ResetTTS();
		
		// Store the current selected items
		ItemDataList selectedItems = GetSelectedItems();
		// Store the focused item
		long pos = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED );
		wxUIntPtr focused = (pos == -1) ? 0 : GetItemData(pos);
		
		SortItems(SortProc, (long int)&sortdata);
		
		// Re-select the selected items.
		for (unsigned i = 0; i < selectedItems.size(); ++i) {
			long it_pos = FindItem(-1, selectedItems[i]);
			if (it_pos != -1) {
				SetItemState(it_pos, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
			}
		}
		
		// Set focus on item if any was focused
		if (focused) {
			long it_pos = FindItem(-1, focused);
			if (it_pos != -1) {
				SetItemState(it_pos, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
			}
		}

		m_isSorting = false;
	}
}
コード例 #24
0
void CuDlgIjaTable::OnButtonRedo() 
{
	BOOL bError = FALSE;
	CString strMsg;
	CWaitCursor doWaitCursor;
	if (m_bInconsistent)
	{
		strMsg.LoadString (IDS_RECOVERREDO_IMPOSSIBLE);
		AfxMessageBox (strMsg, MB_ICONEXCLAMATION|MB_OK);
		return;
	}

	CxDlgRedo dlg;
	CTypedPtrList < CObList, CaBaseTransactionItemData* >& ltr = dlg.GetListTransaction();
	//
	// Prepare the selected transactions:
	GetSelectedTransactions (ltr);
	if (!RCRD_CheckValidateTransaction (ltr))
		return;

	//
	// Query other related transactions of other tables:
	CTypedPtrList < CObList, CaBaseTransactionItemData* > ltr2;
	CTypedPtrList < CObList, CaDatabaseTransactionItemData* > listRelatedTransaction;
	CString strTable;
	CString strTableOwner;
	m_queryTransactionInfo.GetTable (strTable, strTableOwner);

	try
	{
		if (!IJA_QueryDatabaseTransaction (&m_queryTransactionInfo, listRelatedTransaction))
		{
			//
			// Failed to query the related transactions.
			strMsg.LoadString (IDS_FAIL_TO_QUERY_RELATED_TRANS);

			AfxMessageBox (strMsg, MB_OK|MB_ICONEXCLAMATION);
			return;
		}

		BOOL bInitLsnEnd = FALSE;
		POSITION pos = listRelatedTransaction.GetHeadPosition();
		while (pos != NULL)
		{
			CaDatabaseTransactionItemData* pDbTr = listRelatedTransaction.GetNext (pos);
			CTypedPtrList < CObList, CaDatabaseTransactionItemDataDetail* >& ldt = pDbTr->GetDetailTransaction();
			POSITION p = ldt.GetHeadPosition();
			while (p != NULL)
			{
				CaDatabaseTransactionItemDataDetail* pDetail = ldt.GetNext (p);
				//
				// If for each detail transaction, if this transaction is the same as the one of the current
				// table (eg in the list 'ltr') then take this detail transaction too:
				CString strItem = pDetail->GetTable();
				CString strItemOwner = pDetail->GetTableOwner();
				if (strTable.CompareNoCase (strItem) == 0 && strTableOwner.CompareNoCase (strItemOwner) == 0)
				{
					CString strLsnEnd = pDbTr->GetLsnEnd();
					POSITION px = ltr.GetHeadPosition();
					while (px != NULL && !bInitLsnEnd)
					{
						CaBaseTransactionItemData* pItem = ltr.GetNext(px);
						pItem->SetLsnEnd(strLsnEnd);
					}
					bInitLsnEnd = TRUE;
					continue;
				}
				if (ExistTransaction (pDetail, ltr))
				{
					ltr2.AddTail ((CaBaseTransactionItemData*)pDetail);
				}
			}
		}
		while (!ltr2.IsEmpty())
		{
			CaBaseTransactionItemData* pDetail = ltr2.RemoveHead();
			ltr.AddTail (pDetail);
		}
	}
	catch (CeSqlException e)
	{
		AfxMessageBox (e.GetReason());
		bError = TRUE;
	}
	catch (...)
	{
		bError = TRUE;
		AfxMessageBox (_T("System error: CuDlgIjaTable::OnButtonRedo(), ReDo failed"));
	}

	UINT* pArraySelectedItem = NULL;
	int   nSelectedCount = 0;
	if (!bError)
	{
		GetSelectedItems (pArraySelectedItem, nSelectedCount);
		dlg.SetQueryTransactionInfo(&m_queryTransactionInfo);
		dlg.SetInitialSelection (pArraySelectedItem, nSelectedCount);
		//
		// Luanch the dialog box:
		dlg.DoModal();
	}

	if (pArraySelectedItem)
		delete [] pArraySelectedItem;
	while (!listRelatedTransaction.IsEmpty())
		delete listRelatedTransaction.RemoveHead();
}