Beispiel #1
0
static void OnSnippetDuplicate(HWND hWnd)
{
	// Get the current item and its snippet
	int item = (int) SendDlgItemMessage(hWnd, IDC_LIST, LB_GETCURSEL, 0, 0L);

	// Was there an item selected?
	if (item == LB_ERR)
		return;

	// Get the data for this item
	Snippet* snip = (Snippet*) SendDlgItemMessage(s_hDlg, IDC_LIST, LB_GETITEMDATA, (WPARAM) item, 0);
	if (snip == NULL)
		return;

	WCHAR wszTmp[MAX_PATH];
	wcsncpy(wszTmp, L"Are you sure you want to duplicate the snippet:\r\n", MAX_PATH);
	wcsncat(wszTmp, snip->WGetName(), MAX_PATH);

	// Ask for confirmation
	if (!MsgBoxYesNo(wszTmp))
		return;

	// Make a copy of the selected snippet
	Snippet* pNew = new Snippet(*snip);

	// Adjust the name of the duplicate
	wcsncpy(wszTmp, snip->WGetName(), MAX_PATH);
	wcsncat(wszTmp, L" - Dup", MAX_PATH);
	pNew->WSetName(wszTmp);

	// Save to the database and refresh the list
	pNew->SaveToDB();
	UpdateSnippetsList();
}
Beispiel #2
0
static void OnSnippetDelete(HWND hWnd)
{
	// Get the current item and its snippet
	int item = (int) SendDlgItemMessage(hWnd, IDC_LIST, LB_GETCURSEL, 0, 0L);

	// Was there an item selected?
	if (item == LB_ERR)
		return;

	// Get the data for this item
	Snippet* snip = (Snippet*) SendDlgItemMessage(s_hDlg, IDC_LIST, LB_GETITEMDATA, (WPARAM) item, 0);
	if (snip == NULL)
		return;

	WCHAR wszTmp[MAX_PATH];
	wcsncpy(wszTmp, L"Are you sure you want to delete the snippet:\r\n", MAX_PATH);
	wcsncat(wszTmp, snip->WGetName(), MAX_PATH);

	// Ask for confirmation
	if (!MsgBoxYesNo(wszTmp))
		return;

	// Delete from the database
	if (!snip->DeleteFromDB())
		return;

	// Clean up the item data
	delete snip;

	// Delete the entry from the list
	SendDlgItemMessage(s_hDlg, IDC_LIST, LB_DELETESTRING, (WPARAM) item, (LPARAM) NULL);
}
Beispiel #3
0
void CCaptionSettingsDlg::OnDelete()
{
  TRACE("[CStoreSettingsDlg]OnDelete()\n");

  int iIndex = m_lbCaptions.GetCurSel();
  ASSERT (iIndex != LB_ERR);

  if (MsgBoxYesNo("Delete this entry?"))
  {
    // Delete from EventManager
    CCaptionEvent* pEvent = (CCaptionEvent*) m_lbCaptions.GetItemData(iIndex);
    m_pMngr->Remove(pEvent->GetName());

    // Delete from ListBox
    m_lbCaptions.DeleteString(iIndex);
  }
  OnSelChangeCaption();
}
Beispiel #4
0
static void OnLibraryDelete(HWND hWnd)
{
	UNREFERENCED_PARAMETER(hWnd);

	WCHAR wszTmp[MAX_PATH];
	wcsncpy(wszTmp, L"Are you sure you want to delete the library:\r\n", MAX_PATH);
	wcsncat(wszTmp, s_curLibrary->WGetName(), MAX_PATH);

	// Ask for confirmation
	if (!MsgBoxYesNo(wszTmp))
		return;

	// Delete from the database
	if (!s_curLibrary->DeleteFromDB())
		return;

	// Fill the snippets again
	UpdateSnippetsList();
}
static void DeleteQuest(GUI *data)
{
    MsgBoxYesNo(1, (int)lgp[lgpDelQ], Delete);
    GeneralFuncF1(2);
}