Ejemplo n.º 1
0
void CDxpsParamDlg::OnButtonResetReg() 
{
	if(MessageBox("Are you sure to delete data of this region?  ", "Deleting region data", 
			   MB_ICONQUESTION|MB_OKCANCEL )==IDCANCEL)
		return;
	//”даление всех данных, св¤занных с данным регионом
	DxpsOutList::iterator j;
	for (j = CDxpsRegion::OutData.begin(); j != CDxpsRegion::OutData.end();)
	{
		if(j->RegionN==m_RegionID)
		{
			j=CDxpsRegion::OutData.erase(j);
			if(CDxpsRegion::PassedNumberOfPoints>0)
				CDxpsRegion::PassedNumberOfPoints--;

		}
		else
			++j;
	}

	if(CDxpsRegion::PassedNumberOfPoints==0)
		CDxpsRegion::PassedCommonTime=0;

	EnableDisableControls();


	//≈сли проект был сохранен (или открыт), удал¤ем его и переписываем заново
	if (theApp.m_pMainFrame->m_Doc.IsFileOpen())
		theApp.m_pMainFrame->m_Doc.SaveProjectFile();
	theApp.m_pMainFrame->m_Doc.CheckDocType();
}
Ejemplo n.º 2
0
void Dialog::Render()
{
    PopulateGrid();
    EnableDisableControls();
    m_Table->setCurrentCell(SearchGrid(*m_Table, *m_Controller, CQTableIndexFunctor()), CCylinderVolumeEnums::RadiusColumn);
    m_LblErrorMessage->setText("");
}
Ejemplo n.º 3
0
static BOOL CALLBACK CanSetupDlgProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
switch(uMessage)
  {
  case WM_INITDIALOG : {
                       InitCanSetupDlg(hdlg, CanCfg);
                       break;
                       }
  case WM_COMMAND    : {
                       switch (LOWORD(wparam))
                         {
                         case IDOK     : {
                                         SaveCanSetup(hdlg, CanCfg);
                                         EndDialog(hdlg, TRUE);
                                         return(TRUE);
                                         }
                         case IDCANCEL : {
                                         EndDialog(hdlg, TRUE);
                                         return(TRUE);
                                         }
						 case BN_CLICKED: {
										  EnableDisableControls(hdlg, lparam);
										  }
                         }
                       break;
                       }
  }
return(FALSE);
}
Ejemplo n.º 4
0
void ServerConnectWnd::IPAddressEdited(const std::string& str)
{
    if (str != "") {
        m_servers_lb->DeselectAll();
        ServerSelected(m_servers_lb->Selections());
    }
    EnableDisableControls();
}
Ejemplo n.º 5
0
void CTDLFilterDlg::OnSelchangeFiltercombo() 
{
	// enable/disable controls if necessary
	UpdateData();
	EnableDisableControls();

	m_cbOptions.Initialize(m_filter, m_nView);
}
Ejemplo n.º 6
0
BOOL CTDLFilterDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// disable translation of user-data combos
	CLocalizer::EnableTranslation(m_cbAllocByFilter, FALSE);
	CLocalizer::EnableTranslation(m_cbAllocToFilter, FALSE);
	CLocalizer::EnableTranslation(m_cbCategoryFilter, FALSE);
	CLocalizer::EnableTranslation(m_cbStatusFilter, FALSE);
	CLocalizer::EnableTranslation(m_cbVersionFilter, FALSE);
	CLocalizer::EnableTranslation(m_cbTagFilter, FALSE);

	// auto droplist filters
	m_cbAllocToFilter.SetStrings(m_aAllocTo);
	m_cbAllocToFilter.AddEmptyString(); // add blank item to top

	m_cbAllocByFilter.SetStrings(m_aAllocBy);
	m_cbAllocByFilter.AddEmptyString(); // add blank item to top

	m_cbCategoryFilter.SetStrings(m_aCategory);
	m_cbCategoryFilter.AddEmptyString(); // add blank item to top

	m_cbStatusFilter.SetStrings(m_aStatus);
	m_cbStatusFilter.AddEmptyString(); // add blank item to top

	m_cbVersionFilter.SetStrings(m_aVersion);
	m_cbVersionFilter.AddEmptyString(); // add blank item to top

	m_cbTagFilter.SetStrings(m_aTags);
	m_cbTagFilter.AddEmptyString(); // add blank item to top

	// priority
	CEnString sAny(IDS_TDC_ANY);

	m_cbPriorityFilter.SetColors(m_aPriorityColors);
	m_cbPriorityFilter.InsertColor(0, (COLORREF)-1, sAny); // add a blank item

	// risk
	m_cbRiskFilter.InsertString(0, sAny); // add a blank item

	// title
	m_mgrPrompts.SetEditPrompt(IDC_TITLEFILTERTEXT, *this, sAny);

	// custom filters
	m_cbTaskFilter.AddCustomFilters(m_aCustomFilters);

	// update UI
	UpdateData(FALSE);
	EnableDisableControls();

	EnableToolTips();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 7
0
static void InitCanSetupDlg(HWND hdlg, struct TMhsCanCfg *cfg)
{
	SetDlgItemText(hdlg, IDC_SNR_EDIT, cfg->CanSnrStr);
	SetDlgItemHex(hdlg, IDC_BTR_EDIT, HEX_WORD, cfg->CanBtrValue);

	FillComboBox(hdlg, IDC_CAN_SPEED, CanSpeedTabStr, CanSpeedTab,
				 CanSpeedTabSize, cfg->CanSpeed);

	// Set default value as bitrate
	CheckRadioButton(hDlg, IDC_RADIOBTN_BITRATE, IDC_RADIOBTN_BTR, IDC_RADIOBTN_BITRATE);
	EnableDisableControls(hDlg, IDC_RADIOBTN_BITRATE);
}
Ejemplo n.º 8
0
void CDxpsParamDlg::OnButtonResetAll() 
{
	//CSingleLock sLock(&MutexThread); //Ќе может сюда зайти при работающем потоке

	if(MessageBox("Are you sure to delete ALL data of ALL regions?  ", "Deleting ALL data", 
			   MB_ICONQUESTION|MB_OKCANCEL )==IDCANCEL)
		return;
	//THRI_LOCK();
	CDxpsRegion::OutData.clear();
	CDxpsRegion::PassedCommonTime=0;
	CDxpsRegion::PassedNumberOfPoints=0;
	//≈сли проект был сохранен (или открыт), удал¤ем его и переписываем заново
	if (theApp.m_pMainFrame->m_Doc.IsFileOpen())
		theApp.m_pMainFrame->m_Doc.SaveProjectFile();
	EnableDisableControls();
	theApp.m_pMainFrame->m_Doc.CheckDocType();
}
Ejemplo n.º 9
0
void ExportFFmpegOptions::DoOnFormatList()
{
   wxString *selfmt = NULL;
   wxString *selfmtlong = NULL;
   FindSelectedFormat(&selfmt, &selfmtlong);
   if (selfmt == NULL)
   {
      return;
   }

   wxString *selcdc = NULL;
   wxString *selcdclong = NULL;
   FindSelectedCodec(&selcdc, &selcdclong);

   AVOutputFormat *fmt = FFmpegLibsInst->guess_format(selfmt->ToUTF8(),NULL,NULL);
   if (fmt == NULL)
   {
      //This shouldn't really happen
      mFormatName->SetLabel(wxString(wxT("Failed to guess format")));
      return;
   }
   mFormatName->SetLabel(wxString::Format(wxT("%s"),selfmtlong->c_str()));
   int selcdcid = -1;

   if (selcdc != NULL)
   {
      AVCodec *cdc = FFmpegLibsInst->avcodec_find_encoder_by_name(selcdc->ToUTF8());
      if (cdc != NULL)
      {
         selcdcid = cdc->id;
      }
   }
   int newselcdc = FetchCompatibleCodecList(selfmt->c_str(), (CodecID)selcdcid);
   if (newselcdc >= 0) mCodecList->Select(newselcdc);

   AVCodec *cdc = NULL;
   if (selcdc != NULL)
      cdc = FFmpegLibsInst->avcodec_find_encoder_by_name(selcdc->ToUTF8());
   EnableDisableControls(cdc, selfmt);
   return;
}
Ejemplo n.º 10
0
static void InitCanSetupDlg(HWND hdlg, struct TMhsCanCfg* cfg)
{
    int nResIDRadioItem = 0;
    SetDlgItemText(hdlg, IDC_SNR_EDIT, cfg->CanSnrStr);
    SetDlgItemHex(hdlg, IDC_BTR_EDIT, HEX_WORD, cfg->CanBtrValue);

    FillComboBox(hdlg, IDC_CAN_SPEED, CanSpeedTabStr, CanSpeedTab,
                 CanSpeedTabSize, cfg->CanSpeed);

    // Set default value as bitrate
    if ( cfg->m_bBitRateSelected )
    {
        nResIDRadioItem = IDC_RADIOBTN_BITRATE;
    }
    else
    {
        nResIDRadioItem = IDC_RADIOBTN_BTR;
    }

    CheckRadioButton(hdlg, IDC_RADIOBTN_BITRATE, IDC_RADIOBTN_BTR, nResIDRadioItem);
    EnableDisableControls(hdlg, nResIDRadioItem);
}
Ejemplo n.º 11
0
void ServerConnectWnd::NameEdited(const std::string& str)
{
    EnableDisableControls();
}
Ejemplo n.º 12
0
void ServerConnectWnd::ServerSelected(const GG::ListBox::SelectionSet& selections)
{
    if (!selections.empty())
        *m_IP_address_edit << "";
    EnableDisableControls();
}
Ejemplo n.º 13
0
void ServerConnectWnd::HostOrJoinClicked(std::size_t idx)
{
    EnableDisableControls();
}
Ejemplo n.º 14
0
BOOL CDxpsParamDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	char str[50];
	int Index;
	//≈сли измерение запущено, то запрещаетс¤ все, кроме комментари¤ и Delay
	//≈сли регион содержит данные, то запрещаетс¤ HV, BE, Dwell, Anode, TypeBE, TypeDiv
	//но разрешаетс¤ кнопка сброса данных региона

	m_TypeBE=pParameters->Type;

	BOOL TypeBE=(m_TypeBE==TYPE_BE);
	BOOL MeasureRun=theApp.m_pMainFrame->m_StartStop;
	BOOL RegionHasData=FALSE;
	if(m_pReg)
		if(m_pReg->HasData())
			RegionHasData=TRUE;

	BOOL EnableTypeDiv= (CDxpsRegion::GetRegNumber()>=2) && !RegionHasData;
	BOOL EnableDivisorDivident=(CDxpsRegion::GetRegNumber()>=2) && !RegionHasData && !TypeBE;
	BOOL EnableDelay= TypeBE;

	EnableDisableControls();

	if(m_NewRegion)
		SetWindowText("New DXPS Region");
	else
	{
		CString str;
		str.Format("DXPS Parameters - D%i", m_RegionID+1);
		SetWindowText((LPCSTR)str);
	}
	m_BE=pParameters->BE;
	m_Comments=pParameters->Comments;
	for(int i=0;i<CDxpsRegion::GetRegNumber();i++)
	{
		if(i==m_RegionID && !m_NewRegion)
			continue;
		sprintf(str,"%i", i+1);
		m_ComboDivident.AddString(str);
		m_ComboDivisor.AddString(str);
	}

	if(EnableTypeDiv || (m_TypeBE==TYPE_DIV))
	{
			sprintf(str,"%i", pParameters->Divident);
			m_ComboDivident.SetWindowText(str);
			sprintf(str,"%i", pParameters->Divisor);
			m_ComboDivisor.SetWindowText(str);
	}

	m_Delay=pParameters->Delay;
	m_Dwell=pParameters->Dwell;
	m_HV=(int)pParameters->HV;
	if(!theApp.Ini.HighPressureMode.Value)
	{
		m_ComboHV.ShowWindow(SW_HIDE);
	}
	else
	{
		GetDlgItem(IDC_EDIT_DXPSPAR_HV)->ShowWindow(SW_HIDE);
		sprintf(str,"%i", (int)pParameters->HV);
		Index = m_ComboHV.FindStringExact(0,str);
		if(Index>0)
			m_ComboHV.SetCurSel(Index);
		else
			m_ComboHV.SetWindowText(str);
	}
	m_SwitchOn=pParameters->Off;
	m_ComboAnode.SetCurSel(pParameters->Anode);
	UpdateData(FALSE);
	for(int i=0;i<15;i++)
	{
		sprintf(str,"Color %i", i);
		m_ComboColor.AddString(str);
	}
	m_ComboColor.SetCurSel(pParameters->ColorIndex);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 15
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd);
   BOOL Success;

   switch (id)
   {
       case IDOK:
           if (lpauditdb->bStartSinceTable)
           {
             char szTblOwner[MAXOBJECTNAME];
             OwnerFromString(table.lpTable->lpObject, szTblOwner);
             if ( IsTheSameOwner(GetCurMdiNodeHandle(),szTblOwner) == FALSE )
               break;
             if ( table.bRefuseTblWithDupName && IsTableNameUnique(GetCurMdiNodeHandle(),lpauditdb->DBName,table.lpTable->lpObject) == FALSE)
               break;
           }
           Success = FillStructureFromControls (hwnd);

           if (!Success)
               break;
           else
           {
               FreeObjectList (table.lpTable);
               table.lpTable = NULL;
               lpfile = FreeTableAndFile (lpfile);
               EndDialog (hwnd, TRUE);
           }
           break;

       case IDCANCEL:
           FreeObjectList (table.lpTable);
           table.lpTable = NULL;
           lpfile = FreeTableAndFile (lpfile);

           EndDialog (hwnd, FALSE);
           break;

       case IDC_AUDITDB_CKP:
           EnableDisableControls (hwnd);
           break;

       case IDC_AUDITDB_CKP_BUTTON:
           {
               char szCurChkPtNum[MAXOBJECTNAME];
               char szUserName    [MAXOBJECTNAME];
               int ires;
               LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());

               DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName);
               ires = MfcDlgCheckPointLst(lpauditdb->DBName ,szUserName, vnodeName, szCurChkPtNum);
               if (ires != IDCANCEL)
                   Edit_SetText   (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), szCurChkPtNum);
               break;
           }
       case IDC_AUDITDB_IDTABLE:
           {
               int   iret;
               char* aString;
               char  szTable [MAXOBJECTNAME];
               LPOBJECTLIST ls;
               LPTABLExFILE lf;

               x_strcpy (table.DBName,  lpauditdb->DBName);
               table.bRefuseTblWithDupName = TRUE;
               iret = DlgAuditDBTable (hwnd, &table);

               ls = table.lpTable;
               EnableDisableControls (hwnd);

               while (ls)
               {
                   aString = (char *)ls->lpObject;
                   if (!FindStringInListTableAndFile (lpfile, aString))
                   {
                       //
                       // Add table  into TABLExFILE
                       //
                       lpfile = AddElement (lpfile, aString);
                   }
                   ls = ls->lpNext;
               }
               AddFile (hwnd, lpfile);

               lf = lpfile;
               while (lf)
               {
                   if (!FindStringInListObject (table.lpTable, lf->TableName))
                   {
                       //
                       // Delete table from TABLExFILE
                       //
                       x_strcpy (szTable, lf->TableName);
                       lf = lf->next;
                       lpfile = RemoveElement (lpfile, szTable);
                   }
                   else lf = lf->next;
               }
           }
           break;

       case IDC_AUDITDB_IDFILE:
           {
               int iret;
               AUDITDBFPARAMS file;
               ZEROINIT (file);

               x_strcpy (file.DBName,  lpauditdb->DBName);
               file.lpTableAndFile = lpfile;
               iret   = DlgAuditDBFile (hwnd, &file);
               if (iret)
                   lpfile = file.lpTableAndFile;
           }
           break;

       case IDC_AUDITDB_TABLES:
           EnableDisableControls (hwnd);
           break;
       case IDC_AUDITDB_FILES:
           EnableDisableControls (hwnd);
           break;
   }
}
Ejemplo n.º 16
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   HWND hwndActionUser = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   LPAUDITDBPARAMS lpauditdb  = (LPAUDITDBPARAMS)lParam;
   char szFormat [100];
   char szTitle  [MAX_TITLEBAR_LEN];

   if (!AllocDlgProp (hwnd, lpauditdb))
       return FALSE;

   ZEROINIT (table);
   table.bRefuseTblWithDupName = TRUE;
   table.lpTable = NULL;
   lpfile        = NULL;

   LoadString (hResource, (UINT)IDS_T_AUDITDB, szFormat, sizeof (szFormat));
   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpauditdb->DBName);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_AUDITDB));

   if (lpauditdb->bStartSinceTable)
   {
     LPOBJECTLIST obj;
     char sztemp[MAXOBJECTNAME];
     // Title
     wsprintf( sztemp ," , table %s",lpauditdb->szDisplayTableName);
     lstrcat(szTitle,sztemp);
     // Fill Object List
     obj = AddListObject (table.lpTable, x_strlen (lpauditdb->szCurrentTableName) +1);
     if (obj)
     {
       lstrcpy ((UCHAR *)obj->lpObject,lpauditdb->szCurrentTableName );
       table.lpTable = obj;
     }
     else
     {
       ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
       table.lpTable = NULL;
     }
     lpfile = AddElement (lpfile,lpauditdb->szCurrentTableName );
     AddFile (hwnd, lpfile);

     ShowWindow      (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_STATIC_TABLE_NAME),SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_AUDITDB_IDTABLE)  ,SW_HIDE);
     SetWindowText   (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,lpauditdb->szDisplayTableName );
     EnableWindow    (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,FALSE );
     Button_SetCheck (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,BST_CHECKED);
     EnableWindow    (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,FALSE );
   }
   SetWindowText (hwnd, szTitle);

   InitializeControls     (hwnd);

   ComboBoxFillUsers (hwndActionUser);
   EnableDisableOKButton (hwnd);
   EnableDisableControls (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
Ejemplo n.º 17
0
void CDxpsParamDlg::OnRadioDxpsParTypeDiv() 
{
m_TypeBE=TYPE_DIV;
CheckDlgButton(IDC_RADIO_DXPSPAR_TYPE_BE, FALSE);
EnableDisableControls();
}
Ejemplo n.º 18
0
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	HWND hwndList = GetDlgItem(hwnd, IDC_AVATARLIST);

	switch(uMsg) {
	case WM_INITDIALOG:
		{
			AvatarDialogData *data = (struct AvatarDialogData*) lParam;
			SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)createDefaultOverlayedIcon(TRUE));
			SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)createDefaultOverlayedIcon(FALSE));
			if (db_get_b(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
				FillAvatarListFromDB(hwndList, data->hContact);
			else if (opts.log_store_as_hash)
				FillAvatarListFromFolder(hwndList, data->hContact);
			else
				FillAvatarListFromFiles(hwndList, data->hContact);

			TCHAR *displayName = pcli->pfnGetContactDisplayName(data->hContact, 0);
			if (displayName) {
				TCHAR title[MAX_PATH];
				mir_sntprintf(title, _countof(title), TranslateT("Avatar History for %s"), displayName);
				SetWindowText(hwnd, title);
			}

			SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data->hContact);
			UpdateAvatarPic(hwnd);
			CheckDlgButton(hwnd, IDC_LOGUSER, (UINT)db_get_b(data->hContact, MODULE_NAME, "LogToDisk", BST_INDETERMINATE));
			CheckDlgButton(hwnd, IDC_POPUPUSER, (UINT)db_get_b(data->hContact, MODULE_NAME, "AvatarPopups", BST_INDETERMINATE));
			CheckDlgButton(hwnd, IDC_HISTORYUSER, (UINT)db_get_b(data->hContact, MODULE_NAME, "LogToHistory", BST_INDETERMINATE));
			ShowWindow(GetDlgItem(hwnd, IDC_OPENFOLDER), opts.log_per_contact_folders ? SW_SHOW : SW_HIDE);
			Utils_RestoreWindowPositionNoSize(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
			WindowList_Add(hAvatarWindowsList,hwnd,data->hContact);
			TranslateDialogDefault(hwnd);
			EnableDisableControls(hwnd);
			free(data);
			data = NULL;
		}
		break;

	case WM_CLOSE:
		CleanupAvatarPic(hwnd);
		EndDialog(hwnd, 0);
		return TRUE;

	case WM_DESTROY:
		Utils_SaveWindowPosition(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
		WindowList_Remove(hAvatarWindowsList,hwnd);
		DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0));
		DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0));
		{
			int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
			for(int i = 0; i < count; i++)
				delete (ListEntry*)SendMessage(hwndList, LB_GETITEMDATA, i, 0);
		}
		break;

	case WM_CONTEXTMENU:
		{
			HWND pic = GetDlgItem(hwnd, IDC_AVATAR);
			int pos;

			if ((HANDLE)wParam == hwndList) {
				POINT p = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
				ScreenToClient(hwndList, &p);

				pos = SendMessage(hwndList, LB_ITEMFROMPOINT, 0, MAKELONG(p.x, p.y));
				if (HIWORD(pos))
					break;
				pos = LOWORD(pos);

				int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
				if (pos >= count)
					break;

				SendMessage(hwndList, LB_SETCURSEL, pos, 0);
				EnableDisableControls(hwnd);
			}
			else if ((HANDLE) wParam == pic) {
				pos = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
				if (pos == LB_ERR)
					break;
			}
			else break;

			HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
			HMENU submenu = GetSubMenu(menu, 0);
			TranslateMenu(submenu);

			if (!UpdateAvatarPic(hwnd)) {
				RemoveMenu(submenu, 2, MF_BYPOSITION);
				RemoveMenu(submenu, 0, MF_BYPOSITION);
			}

			POINT p;
			p.x = LOWORD(lParam); 
			p.y = HIWORD(lParam); 
			int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwndList, NULL);
			DestroyMenu(menu);

			ListEntry *le = (ListEntry*) SendMessage(hwndList, LB_GETITEMDATA, pos, 0);
			MCONTACT hContact = (MCONTACT) GetWindowLongPtr(hwnd, GWLP_USERDATA);
			switch(ret) {
			case ID_AVATARLISTPOPUP_SAVEAS:
				ShowSaveDialog(hwnd, le->filename, hContact);
				break;

			case ID_AVATARLISTPOPUP_DELETE:
				{
					BOOL blDelete;

					if (le->hDbEvent)
						blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this history entry?\nOnly the entry in history will be deleted, bitmap file will be kept!"), 
						TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
					else
						blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this avatar shortcut?\nOnly shortcut will be deleted, bitmap file will be kept!"), 
						TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;

					if (blDelete) {
						if (le->hDbEvent)
							db_event_delete(hContact, le->hDbEvent);
						else
							DeleteFile(le->filelink);

						delete le;

						SendMessage(hwndList, LB_DELETESTRING, pos, 0);

						int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
						if (count > 0) {
							if (pos >= count)
								pos = count -1;
							SendMessage(hwndList, LB_SETCURSEL, pos, 0);
						}

						UpdateAvatarPic(hwnd);
						EnableDisableControls(hwnd);
					}
				}
				break;

			case ID_AVATARLISTPOPUP_DELETE_BOTH:
				BOOL blDelete;

				if (le->hDbEvent)
					blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the history entry and the bitmap file.\nWARNING:This can affect more than one entry in history!"), 
					TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
				else
					blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the shortcut and the bitmap file.\nWARNING:This can affect more than one shortcut!"), 
					TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;

				if (blDelete) {
					DeleteFile(le->filename);

					if (le->hDbEvent)
						db_event_delete(hContact, le->hDbEvent);
					else
						DeleteFile(le->filelink);

					delete le;

					SendMessage(hwndList, LB_DELETESTRING, pos, 0);

					int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
					if (count > 0) {
						if (pos >= count)
							pos = count -1;
						SendMessage(hwndList, LB_SETCURSEL, pos, 0);
					}

					UpdateAvatarPic(hwnd);
					EnableDisableControls(hwnd);
				}
			}
		}
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDOK:
			if (HIWORD(wParam) == BN_CLICKED) {
				MCONTACT hContact = (MCONTACT) GetWindowLongPtr(hwnd, GWLP_USERDATA);
				db_set_b(hContact, MODULE_NAME, "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
				db_set_b(hContact, MODULE_NAME, "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER));
				db_set_b(hContact, MODULE_NAME, "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));

				CleanupAvatarPic(hwnd);
				EndDialog(hwnd, 0);
				return TRUE;
			}
			break;

		case IDC_AVATARLIST:
			if (HIWORD(wParam) == LBN_SELCHANGE) {
				UpdateAvatarPic(hwnd);
				EnableDisableControls(hwnd);
				return TRUE;
			}
			break;

		case IDC_OPENFOLDER:
			if (HIWORD(wParam) == BN_CLICKED && opts.log_per_contact_folders) {
				TCHAR avfolder[MAX_PATH];
				MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
				GetContactFolder(avfolder, hContact);
				ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL);
				return TRUE;
			}
			break;

		case IDC_NEXT:
			if (HIWORD(wParam) == BN_CLICKED) {
				SendMessage(hwndList, LB_SETCURSEL, SendMessage(hwndList, LB_GETCURSEL, 0, 0) +1, 0);
				UpdateAvatarPic(hwnd);
				EnableDisableControls(hwnd);
				return TRUE;
			}
			break;

		case IDC_BACK:
			if (HIWORD(wParam) == BN_CLICKED) {
				int cursel = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
				if (cursel == LB_ERR)
					SendMessage(hwndList, LB_SETCURSEL, SendMessage(hwndList, LB_GETCOUNT, 0, 0) -1, 0);
				else
					SendMessage(hwndList, LB_SETCURSEL, cursel -1, 0);
				UpdateAvatarPic(hwnd);
				EnableDisableControls(hwnd);
				return TRUE;
			}
		}
		break;
	}
	return FALSE;
}