当前位置: 首页>>代码示例>>C++>>正文


C++ Translate函数代码示例

本文整理汇总了C++中Translate函数的典型用法代码示例。如果您正苦于以下问题:C++ Translate函数的具体用法?C++ Translate怎么用?C++ Translate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Translate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Translate

bool Layer::Translate( double x, double y, double z )
{
  double pos[3] = { x, y, z };
  return Translate( pos );
}
开发者ID:CBoensel,项目名称:freesurfer,代码行数:5,代码来源:Layer.cpp

示例2: CheckMailInbox

void CheckMailInbox(Account *curAcc)
{
	// internet connection handle
	// internet request handle
	HINTERNET hHTTPConnection = 0, hHTTPRequest = 0;		    

	DBVARIANT dbv;
	static char *contentType = "Content-Type: application/x-www-form-urlencoded";
	char requestBuffer[256] = "continue=https%3A%2F%2Fmail.google.com%2Fa%2F";
	char fileBuffer[_MAX_DOWN_BUFFER] = "";
	char *tail;
	char str[64];
	char temp[_MAX_DOWN_BUFFER] = "";
	unsigned long bufferLength;

	if (curAcc->IsChecking)
		return;

	curAcc->IsChecking = TRUE;

	if (!db_get_s(curAcc->hContact, "CList", "MyHandle", &dbv)) {
		mir_strcpy(curAcc->results.content, dbv.pszVal);
		db_free(&dbv);
	}
	else mir_strcpy(curAcc->results.content, curAcc->name);

	tail = strstr(curAcc->results.content, " [");
	if (tail) *tail = '\0';
	mir_strcat(curAcc->results.content, " [");

	mir_strcpy(str, curAcc->results.content);
	mir_strcat(str, Translate("Checking..."));
	mir_strcat(str, "]");

	db_set_s(curAcc->hContact, "CList", "MyHandle", str);
	// internet open handle
	HINTERNET hHTTPOpen = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0);
	if (!hHTTPOpen) {
		mir_strcat(curAcc->results.content, Translate("Can't open Internet!"));
		goto error_handle;
	}

	if (curAcc->hosted[0]) {
		hHTTPConnection = InternetConnectA(hHTTPOpen,
			"www.google.com",
			INTERNET_DEFAULT_HTTPS_PORT,
			NULL,
			NULL,
			INTERNET_SERVICE_HTTP,
			0,
			0);

		if (!hHTTPConnection) {
			mir_strcat(curAcc->results.content, Translate("Can't reach server!"));
			goto error_handle;
		}
		mir_strcpy(str, "/a/");
		mir_strcat(str, curAcc->hosted);
		mir_strcat(str, "/LoginAction");
		hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0);
		mir_strcat(requestBuffer, curAcc->hosted);
		mir_strcat(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName=");
		mir_strcat(requestBuffer, curAcc->name);
		tail = strchr(requestBuffer, '@');
		*tail = '\0';
		mir_strcat(requestBuffer, "&password=");
		mir_strcat(requestBuffer, curAcc->pass);
		if (!HttpSendRequestA(hHTTPRequest, contentType, (int)mir_strlen(contentType) + 1, requestBuffer, (int)mir_strlen(requestBuffer) + 1)) {
			mir_strcpy(curAcc->results.content, Translate("Can't send account data!"));
			goto error_handle;
		}

		InternetCloseHandle(hHTTPConnection);
		InternetCloseHandle(hHTTPRequest);
		hHTTPRequest = 0;
	}

	hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
	if (!hHTTPConnection) {
		mir_strcat(curAcc->results.content, Translate("Can't reach server!"));
		goto error_handle;
	}
	if (curAcc->hosted[0]) {
		mir_strcpy(str, "/a/");
		mir_strcat(str, curAcc->hosted);
		mir_strcat(str, "/feed/atom");
	}
	else mir_strcpy(str, "/mail/feed/atom");

	hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
	InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)mir_strlen(curAcc->name) + 1);
	InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)mir_strlen(curAcc->pass) + 1);
	if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) {
		mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!"));
		goto error_handle;
	}
	while (InternetReadFile(hHTTPRequest, temp, _MAX_DOWN_BUFFER, &bufferLength) && bufferLength > 0) {
		temp[bufferLength] = '\0';
		mir_strcat(fileBuffer, temp);
	}
//.........这里部分代码省略.........
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:101,代码来源:check.cpp

示例3: DlgProcYAMNBadConnection

INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITDIALOG:
		{
			BOOL ShowPopup,ShowMsg,ShowIco;
			HACCOUNT ActualAccount;
			DWORD  ErrorCode;
			char* TitleStrA;
			char *Message1A=NULL;
			TCHAR *Message1W=NULL;
			POPUPDATAT BadConnectPopup;

			ActualAccount=((struct BadConnectionParam *)lParam)->account;
			ErrorCode=((struct BadConnectionParam *)lParam)->errcode;
#ifdef DEBUG_SYNCHRO
			DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n");
#endif
			if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
			{
#ifdef DEBUG_SYNCHRO
				DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait failed\n");
#endif
				return FALSE;
			}
#ifdef DEBUG_SYNCHRO
			DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
#endif
			int size = (int)(strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE)));
			TitleStrA = new char[size];
			mir_snprintf(TitleStrA, size, Translate(BADCONNECTTITLE), ActualAccount->Name);

			ShowPopup=ActualAccount->BadConnectN.Flags & YAMN_ACC_POP;
			ShowMsg=ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG;
			ShowIco=ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO;

			if (ShowPopup) {
				BadConnectPopup.lchIcon = g_LoadIconEx(3);
				BadConnectPopup.colorBack = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupB : GetSysColor(COLOR_BTNFACE);
				BadConnectPopup.colorText = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupT : GetSysColor(COLOR_WINDOWTEXT);
				BadConnectPopup.iSeconds = ActualAccount->BadConnectN.PopupTime;

				BadConnectPopup.PluginWindowProc = BadConnectPopupProc;
				BadConnectPopup.PluginData = ActualAccount;
				lstrcpyn(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(BadConnectPopup.lptzContactName));
			}

			if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
				Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
				SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
				lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
				if (ShowPopup)
					PUAddPopupT(&BadConnectPopup);
			}
			else if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr != NULL)
			{
				Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
				SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
				lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
				if (ShowPopup)
					PUAddPopupT(&BadConnectPopup);
			}
			else
			{
				Message1W=TranslateT("Unknown error");
				SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
				lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
				if (ShowPopup)
					PUAddPopupT(&BadConnectPopup);
			}

			if (!ShowMsg && !ShowIco)
				DestroyWindow(hDlg);
#ifdef DEBUG_SYNCHRO
			DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read done\n");
#endif
			ReadDoneFcn(ActualAccount->AccountAccessSO);

			SetWindowTextA(hDlg, TitleStrA);
			delete[] TitleStrA;
			if (Message1A != NULL)
				delete[] Message1A;
			if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1A != NULL)
				ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1A);
			if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1W != NULL)
				ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1W);
			return 0;
		}
		case WM_DESTROY:
		{
			NOTIFYICONDATA nid;

			ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
			nid.cbSize=sizeof(NOTIFYICONDATA);
			nid.hWnd=hDlg;
			nid.uID=0;
			Shell_NotifyIcon(NIM_DELETE,&nid);
			PostQuitMessage(0);
			break;
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:badconnect.cpp

示例4: EvalGraphProc

// Note: Once the eval graph is opened, this window-proc lives forever; een closing the
// eval-graph window merely hides it. On opening we re-initialize it, though, so it could
// as well hae been destroyed. While it is open it processes the REFRESH_GRAPH commands.
LRESULT CALLBACK EvalGraphProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    static SnapData sd;

    PAINTSTRUCT stPS;
    HDC hDC;

    switch (message) {
    case WM_INITDIALOG:
        Translate(hDlg, DLG_EvalGraph);
        if( evalGraphDialog == NULL ) {
            evalGraphDialog = hDlg;

            RestoreWindowPlacement( hDlg, &wpEvalGraph ); /* Restore window placement */
        }

        return FALSE;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
          EndDialog(hDlg, TRUE);
          return TRUE;

        case IDCANCEL:
          EndDialog(hDlg, FALSE);
          return TRUE;

        default:
          break;
        }

        break;

    case WM_ERASEBKGND:
        return TRUE;

    case WM_PAINT:
        hDC = BeginPaint( hDlg, &stPS );
        DisplayEvalGraph( hDlg, hDC );
        EndPaint( hDlg, &stPS );
        break;

    case WM_REFRESH_GRAPH:
        hDC = GetDC( hDlg );
        DisplayEvalGraph( hDlg, hDC );
        ReleaseDC( hDlg, hDC );
        break;

    case WM_LBUTTONDOWN:
        if( wParam == 0 || wParam == MK_LBUTTON ) {
            int index = GetMoveIndexFromPoint( LOWORD(lParam), HIWORD(lParam) );

            if( index >= 0 && index < currLast ) {
                ToNrEvent( index + 1 );
            }
        }
        return TRUE;

    case WM_SIZE:
        InvalidateRect( hDlg, NULL, FALSE );
        break;

    case WM_GETMINMAXINFO:
        {
            MINMAXINFO * mmi = (MINMAXINFO *) lParam;
        
            mmi->ptMinTrackSize.x = 100;
            mmi->ptMinTrackSize.y = 100;
        }
        break;

    /* Support for captionless window */
    case WM_CLOSE:
        EvalGraphPopDown();
        break;

    case WM_ENTERSIZEMOVE:
        return OnEnterSizeMove( &sd, hDlg, wParam, lParam );

    case WM_SIZING:
        return OnSizing( &sd, hDlg, wParam, lParam );

    case WM_MOVING:
        return OnMoving( &sd, hDlg, wParam, lParam );

    case WM_EXITSIZEMOVE:
        return OnExitSizeMove( &sd, hDlg, wParam, lParam );
    }

    return FALSE;
}
开发者ID:MaddTheSane,项目名称:MacBoard,代码行数:95,代码来源:wevalgraph.c

示例5: CVKNewsItem

CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost)
{
    bool bPostLink = true;
    CVKNewsItem *vkNewsItem = new CVKNewsItem();
    if (!jnItem)
        return vkNewsItem;

    LONG iSourceId = !jnItem["source_id"] ? jnItem["owner_id"].as_int() : jnItem["source_id"].as_int();
    LONG iPostId = jnItem["post_id"].as_int();
    CMString tszText(jnItem["text"].as_mstring());
    CMString tszPopupText(tszText);

    vkNewsItem->tszType = jnItem["type"].as_mstring();
    vkNewsItem->vkUser = GetVkUserInfo(iSourceId, vkUsers);
    vkNewsItem->bIsGroup = vkNewsItem->vkUser->m_bIsGroup;
    vkNewsItem->tDate = jnItem["date"].as_int();

    if (!tszText.IsEmpty())
        tszText += _T("\n");

    debugLog(_T("CVkProto::GetVkNewsItem %d %d %s"), iSourceId, iPostId, vkNewsItem->tszType);

    if (vkNewsItem->tszType == _T("photo_tag")) {
        bPostLink = false;
        const JSONNode &jnPhotos = jnItem["photo_tags"];
        if (jnPhotos) {
            const JSONNode &jnPhotoItems = jnPhotos["items"];
            if (jnPhotoItems) {
                tszText = TranslateT("User was tagged in these photos:");
                tszPopupText = tszText + TranslateT("(photos)");
                for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it)
                    tszText += _T("\n") + GetVkPhotoItem((*it), m_iBBCForNews);
            }
        }
    }
    else if (vkNewsItem->tszType == _T("photo") || vkNewsItem->tszType == _T("wall_photo")) {
        bPostLink = false;
        const JSONNode &jnPhotos = jnItem["photos"];
        int i = 0;
        if (jnPhotos) {
            const JSONNode &jnPhotoItems = jnPhotos["items"];
            if (jnPhotoItems) {
                tszPopupText += TranslateT("(photos)");
                for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it) {
                    const JSONNode &jnPhotoItem = (*it);
                    tszText += GetVkPhotoItem(jnPhotoItem, m_iBBCForNews) + _T("\n");
                    if (i == 0 && vkNewsItem->tszType == _T("wall_photo")) {
                        if (jnPhotoItem["post_id"]) {
                            bPostLink = true;
                            iPostId = jnPhotoItem["post_id"].as_int();
                            break; // max 1 wall_photo when photo post_id !=0
                        }
                    }
                    i++;
                }
            }
        }
    }
    else if (vkNewsItem->tszType == _T("post") || vkNewsItem->tszType.IsEmpty()) {
        bPostLink = true;
        const JSONNode &jnRepost = jnItem["copy_history"];
        if (jnRepost) {
            CVKNewsItem *vkRepost = GetVkNewsItem((*jnRepost.begin()), vkUsers, true);
            vkRepost->tszText.Replace(_T("\n"), _T("\n\t"));
            tszText += vkRepost->tszText;
            tszText += _T("\n");

            tszPopupText += _T("\t");
            tszPopupText += vkRepost->tszPopupTitle;
            tszPopupText += _T("\n\t");
            tszPopupText += vkRepost->tszPopupText;
            vkNewsItem->bIsRepost = true;
            delete vkRepost;
        }

        const JSONNode &jnAttachments = jnItem["attachments"];
        if (jnAttachments) {
            if (!tszText.IsEmpty())
                tszText.AppendChar(_T('\n'));
            if (!tszPopupText.IsEmpty())
                tszPopupText.AppendChar(_T('\n'));
            tszPopupText += TranslateT("(attachments)");
            tszText += GetAttachmentDescr(jnAttachments, m_bUseBBCOnAttacmentsAsNews ? m_iBBCForNews : m_iBBCForAttachments);
        }
    }

    CMString tszResFormat, tszTitleFormat;

    if (!isRepost) {
        tszResFormat = Translate("News from %s\n%s");
        tszTitleFormat = Translate("News from %s");
    }
    else {
        tszResFormat = Translate("\tRepost from %s\n%s");
        tszTitleFormat = Translate("Repost from %s");
        bPostLink = false;
    }

    vkNewsItem->tszText.AppendFormat(tszResFormat,
                                     SetBBCString(vkNewsItem->vkUser->m_tszUserNick, m_iBBCForNews, vkbbcUrl,
//.........这里部分代码省略.........
开发者ID:kxepal,项目名称:miranda-ng,代码行数:101,代码来源:vk_feed.cpp

示例6: DlgProcOpts

// main ping options 
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HWND hw;
	OPENFILENAME ofn = {0};

	switch ( msg ) {
	case WM_INITDIALOG: {
		TranslateDialogDefault( hwndDlg );

		if(!ServiceExists(MS_FONT_REGISTER)) {
			SetDlgItemText(hwndDlg, IDC_STATFS, Translate("Install the FontService plugin to change the font and font colour."));
		}

		if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
			hw = GetDlgItem(hwndDlg, IDC_CHK_ATTACH);
			EnableWindow(hw, FALSE);
		}
		CheckDlgButton(hwndDlg, IDC_CHK_ATTACH, options.attach_to_clist);

		SetDlgItemInt(hwndDlg, IDC_PPM, options.ping_period, FALSE);
		SetDlgItemInt(hwndDlg, IDC_PT, options.ping_timeout, FALSE);
		CheckDlgButton(hwndDlg, IDC_CHECKPOPUP, options.show_popup);
		CheckDlgButton(hwndDlg, IDC_CHECKPOPUP2, options.show_popup2);
		CheckDlgButton(hwndDlg, IDC_CHK_BLOCK, options.block_reps);
		CheckDlgButton(hwndDlg, IDC_CHK_LOG, options.logging);
		CheckDlgButton(hwndDlg, IDC_CHK_LOGCSV, options.log_csv);
		CheckDlgButton(hwndDlg, IDC_CHK_NOTESTICON, options.no_test_icon);

		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 0));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETPOS, 0, options.indent);
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 6));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETPOS, 0, options.row_height);

		SetDlgItemInt(hwndDlg, IDC_RPT, options.retries, FALSE);

		SetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename);
		if(!options.logging) {
			hw = GetDlgItem(hwndDlg, IDC_ED_FILENAME);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_CHK_LOGCSV);
			EnableWindow(hw, FALSE);
		}

		if(!ServiceExists( MS_POPUP_ADDPOPUP )) {
			hw = GetDlgItem(hwndDlg, IDC_CHECKPOPUP);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_CHECKPOPUP2);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_CHK_BLOCK);
			EnableWindow(hw, FALSE);
		} 
		return TRUE;
	}
	case WM_COMMAND:
		if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
			switch( LOWORD( wParam )) {
			case IDC_PPM:
			case IDC_PT:
			case IDC_ED_FILENAME:
			case IDC_RPT:
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}	
			break;
		}

		if (HIWORD( wParam ) == CBN_SELCHANGE) {
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;
		}

		if ( HIWORD( wParam ) == BN_CLICKED ) {
			switch( LOWORD( wParam )) {
			case IDC_CHK_LOG:
				hw = GetDlgItem(hwndDlg, IDC_ED_FILENAME);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG));
				hw = GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG));
				hw = GetDlgItem(hwndDlg, IDC_CHK_LOGCSV);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG));
				// drop through
			case IDC_CHK_LOGCSV:
			case IDC_CHECKPOPUP:
			case IDC_CHECKPOPUP2:
			case IDC_CHK_BLOCK:
			case IDC_CHK_MINMAX:
			case IDC_CHK_NOTESTICON:
			case IDC_CHK_ATTACH:
				SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				break;
			case IDC_BTN_VIEWLOG:
				CallService(PLUG "/ViewLogData", 0, 0);
				break;
			case IDC_BTN_LOGBROWSE:
				ofn.lStructSize = sizeof(ofn);
				ofn.lpstrFile = options.log_filename;
				ofn.hwndOwner = hwndDlg;
				ofn.Flags = CC_FULLOPEN;
//.........这里部分代码省略.........
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:101,代码来源:options.cpp

示例7: SleepEx

void __cdecl CYahooProto::im_sendackfail_longmsg(HANDLE hContact)
{
	SleepEx(1000, TRUE);
	ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, 
						(LPARAM)Translate("Message is too long: Yahoo messages are limited by 800 UTF8 chars"));
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:6,代码来源:im.cpp

示例8: pbrtTranslate

void pbrtTranslate(Float dx, Float dy, Float dz) {
    VERIFY_INITIALIZED("Translate");
    FOR_ACTIVE_TRANSFORMS(curTransform[i] = curTransform[i] *
                                            Translate(Vector3f(dx, dy, dz));)
}
开发者ID:richardjpurcell,项目名称:pbrt-v3,代码行数:5,代码来源:api.cpp

示例9: sizeof

INT_PTR CDropbox::ProtoSendMessage(void *obj, WPARAM, LPARAM lParam)
{
	CDropbox *instance = (CDropbox*)obj;

	if (!instance->HasAccessToken())
		return ACKRESULT_FAILED;

	CCSDATA *pccsd = (CCSDATA*)lParam;

	char *message = (char*)pccsd->lParam;

	DBEVENTINFO dbei = { sizeof(dbei) };
	dbei.szModule = MODULE;
	dbei.timestamp = time(NULL);
	dbei.eventType = EVENTTYPE_MESSAGE;
	dbei.cbBlob = strlen(message);
	dbei.pBlob = (PBYTE)message;
	dbei.flags = DBEF_SENT | DBEF_READ | DBEF_UTF;
	db_event_add(pccsd->hContact, &dbei);

	char help[1024];

	if (message[0] && message[0] == '/')
	{
		// parse commands
		char *sep = strchr(message, ' ');
		int len = strlen(message) - (sep ? strlen(sep) : 0) - 1;
		ptrA cmd((char*)mir_alloc(len + 1));
		strncpy(cmd, message + 1, len);
		cmd[len] = 0;
		if (instance->commands.find((char*)cmd) != instance->commands.end())
		{
			ULONG messageId = InterlockedIncrement(&instance->hMessageProcess);

			CommandParam *param = new CommandParam();
			param->instance = instance;
			param->hContact = pccsd->hContact;
			param->hProcess = (HANDLE)messageId;
			param->data = (sep ? sep + 1 : NULL);

			mir_forkthread(instance->commands[(char*)cmd], param);

			return messageId;
		}
		else
		{
			mir_snprintf(
				help,
				SIZEOF(help),
				Translate("Unknown command \"%s\".\nUse \"/help\" for more info."),
				message);

			CallContactService(instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help);

			return 0;
		}
	}

	mir_snprintf(
		help,
		SIZEOF(help),
		Translate("\"%s\" is not valid.\nUse \"/help\" for more info."),
		message);

	CallContactService(instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help);

	return 0;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:68,代码来源:dropbox_services.cpp

示例10: _T

	void SpriteBatch::FlushText(
		const std::vector<sstring>& text, 
		const tstring& fontname,
		TransformComponent* transform,
		const Color& color
		)
	{
		if(text.size() == 0)
		{
			Logger::GetInstance()->Log(LogLevel::Warning,
				_T("FontManager::DrawText: Drawing an empty string..."));
			return;
		}
		
		auto curfont = FontManager::GetInstance()->GetFont(fontname);
		float32 h = curfont.GetSize()/0.63f;
		const vec2& position = transform->GetWorldPosition().pos2D();
		const vec2& origposition = position;

		GLuint* textures = curfont.GetTextures();
		const std::vector<fontUvCoords>& tempuvs = curfont.GetUvCoords();
		const std::vector<fontVertices>& tempverts = curfont.GetVetrices();
		const std::vector<ivec2>& tempsizes = curfont.GetLetterDimensions();

		m_Shader.Bind();
		
		//Enable the attributes
		glEnableVertexAttribArray(ATTRIB_VERTEX);
		glEnableVertexAttribArray(ATTRIB_UV);

		glActiveTexture(GL_TEXTURE0);
		GLint s_textureId = glGetUniformLocation(m_Shader.GetID(), "textureSampler");
		glUniform1i(s_textureId, 0);
		GLint s_colorId = glGetUniformLocation(m_Shader.GetID(), "colorMultiplier");
		glUniform4f(s_colorId,color.r,color.g,color.b,color.a);
	
		float32 scaleValue = ScaleSystem::GetInstance()->GetScale();
		mat4 scaleMat = Scale(scaleValue, scaleValue, 1.0f);

		int32 offsetX(0);
		int32 offsetY(0);
		for(auto it = text.begin(); it != text.end() ; ++it)
		{
			const schar *start_line=it->c_str();
			for(int32 i = 0 ; start_line[i] != 0 ; ++i) 
			{

				glBindTexture(GL_TEXTURE_2D,textures[ start_line[i] ]);

				//Set attributes and buffers
				glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT,0,0,
					tempverts[start_line[i]].ver);
				glVertexAttribPointer(ATTRIB_UV, 2, GL_FLOAT, 0, 0, 
					tempuvs[start_line[i]].uv);

				mat4 offsetTrans;
				
				if(start_line[i] != 0)
				{
					int32 offset = curfont.GetMaxLetterHeight() - tempsizes[start_line[i]].y;
					offsetTrans = Translate(
						vec3(offsetX, offsetY - curfont.GetMaxLetterHeight() - offset, 0));
					offsetX += tempsizes[start_line[i]].x;
				}
				else
				{
					offsetTrans = Translate(0.0f, 0.0f, 0.0f);
				}
				const mat4& world = transform->GetWorldMatrix() * offsetTrans;

				glUniformMatrix4fv(glGetUniformLocation(m_Shader.GetID(),"MVP"),
					1,GL_FALSE,
					ToPointerValue(
						Transpose(world) *
						scaleMat *
						GraphicsManager::GetInstance()->GetViewProjectionMatrix()
						)
					);
				glDrawArrays(GL_TRIANGLE_STRIP,0,4);
			}
			offsetY -= curfont.GetMaxLetterHeight();
			offsetX = 0;
		}	

		//Unbind attributes and buffers
		glDisableVertexAttribArray(ATTRIB_VERTEX);
		glDisableVertexAttribArray(ATTRIB_UV);
		m_Shader.Unbind();
	}
开发者ID:guangmingzd,项目名称:StarEngine,代码行数:89,代码来源:SpriteBatch.cpp

示例11: GetDataNode


//.........这里部分代码省略.........
    a[0] = (cornerPoints[0][0] - cornerPoints[6][0]);
    a[1] = (cornerPoints[0][1] - cornerPoints[6][1]);
    a[2] = (cornerPoints[0][2] - cornerPoints[6][2]);

    b[0] = (cornerPoints[0][0] - cornerPoints[2][0]);
    b[1] = (cornerPoints[0][1] - cornerPoints[2][1]);
    b[2] = (cornerPoints[0][2] - cornerPoints[2][2]);

    vtkMath::Cross(a, b, result1);

    a[0] = (cornerPoints[2][0] - cornerPoints[7][0]);
    a[1] = (cornerPoints[2][1] - cornerPoints[7][1]);
    a[2] = (cornerPoints[2][2] - cornerPoints[7][2]);

    b[0] = (cornerPoints[2][0] - cornerPoints[6][0]);
    b[1] = (cornerPoints[2][1] - cornerPoints[6][1]);
    b[2] = (cornerPoints[2][2] - cornerPoints[6][2]);

    vtkMath::Cross(a, b, result2);

    vtkMath::Normalize(result0);
    vtkMath::Normalize(result1);
    vtkMath::Normalize(result2);

    // create cube for rendering bounding box
    auto cube = vtkCubeSource::New();
    cube->SetXLength(extent[0] / spacing[0]);
    cube->SetYLength(extent[1] / spacing[1]);
    cube->SetZLength(extent[2] / spacing[2]);

    // calculates translation based on offset+extent not on the transformation matrix
    vtkSmartPointer<vtkMatrix4x4> imageTransform = geometry->GetVtkTransform()->GetMatrix();
    auto translation = vtkSmartPointer<vtkTransform>::New();
    translation->Translate(center[0] - imageTransform->GetElement(0, 3),
      center[1] - imageTransform->GetElement(1, 3),
      center[2] - imageTransform->GetElement(2, 3));

    auto transform = vtkSmartPointer<vtkTransform>::New();
    transform->SetMatrix(imageTransform);
    transform->PostMultiply();
    transform->Concatenate(translation);
    transform->Update();
    cube->Update();

    auto transformFilter = vtkSmartPointer<vtkTransformFilter>::New();
    transformFilter->SetInputData(cube->GetOutput());
    transformFilter->SetTransform(transform);
    transformFilter->Update();
    cube->Delete();

    vtkSmartPointer<vtkPolyData> polydata = transformFilter->GetPolyDataOutput();
    if (polydata == nullptr || (polydata->GetNumberOfPoints() < 1))
    {
      localStorage->m_Actor->VisibilityOff();
      localStorage->m_HandleActor->VisibilityOff();
      localStorage->m_SelectedHandleActor->VisibilityOff();
      return;
    }

    // estimate current image plane to decide whether the cube is visible or not
    const PlaneGeometry *planeGeometry = renderer->GetCurrentWorldPlaneGeometry();
    if ((planeGeometry == nullptr) || (!planeGeometry->IsValid()) || (!planeGeometry->HasReferenceGeometry()))
      return;

    double origin[3];
    origin[0] = planeGeometry->GetOrigin()[0];
开发者ID:junaidnaseer,项目名称:MITK,代码行数:67,代码来源:mitkBoundingShapeVtkMapper2D.cpp

示例12: LoadJSONMesh


//.........这里部分代码省略.........
    for(idx = 0; idx < iNumIndices; ++idx)
    {
        cJSON* psIndex = cJSON_GetArrayItem(psIndices, idx);
        pui16Indices[idx] = psIndex->valueint;
    }

    iNumVertices = cJSON_GetArraySize(psVertices) / 3; //GetArraySize will give the number of floats in vertex position array. Always XYZ.

    pfVertices = new float[iNumVertices * 3];
    pfTexCoords = new float[iNumVertices * 3];
    pfNormals = new float[iNumVertices * 3];
    for(vtx = 0; vtx < (iNumVertices * 3);)
    {
        cJSON* psVertex;
        cJSON* psTexC;
        cJSON* psNrm;

        psVertex = cJSON_GetArrayItem(psVertices, vtx);
        pfVertices[vtx] = psVertex->valuedouble;

        psTexC = cJSON_GetArrayItem(psTexCoords, vtx);
        pfTexCoords[vtx] = psTexC->valuedouble;

        psNrm = cJSON_GetArrayItem(psNormals, vtx);
        pfNormals[vtx] = psNrm->valuedouble;

        ++vtx;

        psVertex = cJSON_GetArrayItem(psVertices, vtx);
        pfVertices[vtx] = psVertex->valuedouble;

        psTexC = cJSON_GetArrayItem(psTexCoords, vtx);
        pfTexCoords[vtx] = 1 - psTexC->valuedouble;

        psNrm = cJSON_GetArrayItem(psNormals, vtx);
        pfNormals[vtx] = psNrm->valuedouble;

        ++vtx;

        psVertex = cJSON_GetArrayItem(psVertices, vtx);
        pfVertices[vtx] = psVertex->valuedouble;

        psTexC = cJSON_GetArrayItem(psTexCoords, vtx);
        pfTexCoords[vtx] = psTexC->valuedouble;

        psNrm = cJSON_GetArrayItem(psNormals, vtx);
        pfNormals[vtx] = psNrm->valuedouble;

        ++vtx;
    }

    fMinX = cJSON_GetArrayItem(psBoundingBox, 0)->valuedouble;
    fMinY = cJSON_GetArrayItem(psBoundingBox, 1)->valuedouble;
    fMinZ = cJSON_GetArrayItem(psBoundingBox, 2)->valuedouble;
    fMaxX = cJSON_GetArrayItem(psBoundingBox, 3)->valuedouble;
    fMaxY = cJSON_GetArrayItem(psBoundingBox, 4)->valuedouble;
    fMaxZ = cJSON_GetArrayItem(psBoundingBox, 5)->valuedouble;

    cJSON_Delete(psRoot);

    //Translation and scaling to get the object to the middle of the screen.

    Identity(psMatrices->rot);
    Identity(psMatrices->scale);
    Identity(psMatrices->xform);

	fScale = fMaxX-fMinX;
	fScale = max(fMaxY - fMinY,fScale);
	fScale = max(fMaxZ - fMinZ,fScale);
	fScale = 1.f / fScale;
    Scale(psMatrices->scale, fScale, fScale, fScale);

    fCenterX = (fMinX + fMaxX) / 2.0f;
    fCenterY = (fMinY + fMaxY) / 2.0f;
    fCenterZ = (fMinZ + fMaxZ) / 2.0f;
    Translate(psMatrices->xform, -fCenterX, -fCenterY, -fCenterZ );

    //Put the vertices and indices into device memory.

    gl->GenBuffers(context, 1, puiVBO);
    gl->GenBuffers(context, 1, puiIBO);

    gl->BindBuffer(context, GL_ARRAY_BUFFER, *puiVBO);
    gl->BufferData(context, GL_ARRAY_BUFFER, sizeof(GLfloat)*(iNumVertices*9), NULL, GL_STATIC_DRAW);
    gl->BufferSubData(context, GL_ARRAY_BUFFER, 0, sizeof(GLfloat)*(iNumVertices*3), pfVertices);
    gl->BufferSubData(context, GL_ARRAY_BUFFER, sizeof(GLfloat)*(iNumVertices*3), sizeof(GLfloat)*(iNumVertices*3), pfTexCoords);
    gl->BufferSubData(context, GL_ARRAY_BUFFER, sizeof(GLfloat)*(iNumVertices*6), sizeof(GLfloat)*(iNumVertices*3), pfNormals);
    gl->BindBuffer(context, GL_ARRAY_BUFFER, 0);

    gl->BindBuffer(context, GL_ELEMENT_ARRAY_BUFFER, *puiIBO);
    gl->BufferData(context, GL_ELEMENT_ARRAY_BUFFER, sizeof(GLushort)*iNumIndices, pui16Indices, GL_STATIC_DRAW);
    gl->BindBuffer(context, GL_ELEMENT_ARRAY_BUFFER, 0);

    delete [] pui16Indices;
    delete [] pfVertices;
    delete [] pfTexCoords;

    *piNumIndices = iNumIndices;
    *piNumVertices = iNumVertices;
}
开发者ID:James-Jones,项目名称:Displacement-map-editor,代码行数:101,代码来源:demo.cpp

示例13: RenderAll

void RenderAll(wsWindow *window, guiItem *Items, int nrItems, char *db)
{
    guiItem *item;
    guiImage *image = NULL;
    int i, ofs;

    image_buffer = db;
    image_width  = window->Width;

    for (i = 0; i < nrItems + 1; i++) {
        item = &Items[i];

        switch (item->pressed) {
        case btnPressed:
            ofs = 0;
            break;

        case btnReleased:
            ofs = 1;
            break;

        default:
            ofs = 2;
            break;
        }

        switch (item->type) {
        case itButton:

            PutImage(&item->Bitmap, item->x, item->y, 3, ofs);
            break;

        case itPotmeter:

            if (item->numphases == 1)
                SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0);
            else
                PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0));

            break;

        case itHPotmeter:

            if (item->numphases == 1)
                SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0);
            else
                PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0));

            PutImage(&item->Mask, item->x + (item->width - item->pwidth) * (item->value / 100.0), item->y, 3, ofs);
            break;

        case itVPotmeter:

            PutImage(&item->Bitmap, item->x, item->y, item->numphases, item->numphases * (1.0 - item->value / 100.0));
            PutImage(&item->Mask, item->x, item->y + (item->height - item->pheight) * (1.0 - item->value / 100.0), 3, ofs);
            break;

        case itSLabel:

            if (item->width == -1)
                item->width = fntTextWidth(item->fontid, item->label);

            image = fntTextRender(item, 0, item->label);

            if (image)
                PutImage(image, item->x, item->y, 1, 0);

            break;

        case itDLabel:
        {
            int x;
            unsigned int d;
            char *t = Translate(item->label);

            if (!item->text || (strcmp(item->text, t) != 0)) {
                free(item->text);
                item->text      = strdup(t);
                item->textwidth = fntTextWidth(item->fontid, t);
                item->starttime = GetTimerMS();
                item->last_x    = 0;
            }

            d = GetTimerMS() - item->starttime;

            if (d < DLABEL_DELAY)
                x = item->last_x;                     // don't scroll yet
            else {
                int l;
                char c[2];

                l    = (item->textwidth ? item->textwidth : item->width);
                x    = (l ? l - ((d - DLABEL_DELAY) / 20) % l - 1 : 0);
                c[0] = *item->text;
                c[1] = '\0';

                if (x < (fntTextWidth(item->fontid, c) + 1) >> 1) {
                    item->starttime = GetTimerMS();   // stop again
                    item->last_x    = x;              // at current x pos
                }
//.........这里部分代码省略.........
开发者ID:C3MA,项目名称:fc_mplayer,代码行数:101,代码来源:render.c

示例14: Q_strcpy

//---------------------------------------------------------------------------------
// Purpose: Update victim/attacker stats matrix
//---------------------------------------------------------------------------------
void ManiVictimStats::ShowChatStats(player_t *victim_ptr, player_t *attacker_ptr, int mode)
{
	// Normal player, dump stats out to them
	// Show attackers first

	int victim_index = victim_ptr->index - 1;

	if (mani_show_victim_stats_inflicted_only.GetInt() == 0)
	{
		for (int i = 0; i < max_players; i++)
		{
			if (damage_list[victim_index][i].shots_taken == 0)
			{
				continue;
			}

			char hit_groups[1024];

			Q_strcpy(hit_groups, " ");

			if (mode == 2)
			{
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_GENERIC], hit_groups, Translate(victim_ptr, M_VSTATS_BODY));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_HEAD], hit_groups, Translate(victim_ptr, M_VSTATS_HEAD));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_CHEST], hit_groups, Translate(victim_ptr, M_VSTATS_CHEST));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_STOMACH], hit_groups, Translate(victim_ptr, M_VSTATS_STOMACH));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_LEFTARM], hit_groups, Translate(victim_ptr, M_VSTATS_LEFT_ARM));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_RIGHTARM], hit_groups, Translate(victim_ptr, M_VSTATS_RIGHT_ARM));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_LEFTLEG], hit_groups, Translate(victim_ptr, M_VSTATS_LEFT_LEG));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_RIGHTLEG], hit_groups, Translate(victim_ptr, M_VSTATS_RIGHT_LEG));
				AddHitGroup(damage_list[victim_index][i].hit_groups_taken[HITGROUP_GEAR], hit_groups, Translate(victim_ptr, M_VSTATS_GEAR));
			}

			char attacker_string[256];
			snprintf(attacker_string, sizeof(attacker_string), "%s", Translate(victim_ptr, 1109, "%s%c%c%i%i%s%s",
				damage_list[victim_index][i].name,
				0xC2, 0xBB,
				damage_list[victim_index][i].health_taken/* + damage_list[victim_index][i].armor_taken*/,
				damage_list[victim_index][i].shots_taken,
				(damage_list[victim_index][i].shots_taken == 1) ? Translate(victim_ptr, M_VSTATS_HIT_SINGLE):Translate(victim_ptr, M_VSTATS_HIT_PLURAL),
				hit_groups
				));

			SayToPlayer(ORANGE_CHAT, victim_ptr, "%s", attacker_string);
		}
	}

	for (int i = 0; i < max_players; i++)
	{
		if (damage_list[victim_index][i].shots_inflicted == 0)
		{
			continue;
		}


		if (damage_list[victim_index][i].killed)
		{
			continue;
		}

		char hit_groups[1024];

		Q_strcpy(hit_groups, " ");

		if (mode == 2)
		{
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_GENERIC], hit_groups, Translate(victim_ptr, M_VSTATS_BODY));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_HEAD], hit_groups, Translate(victim_ptr, M_VSTATS_HEAD));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_CHEST], hit_groups, Translate(victim_ptr, M_VSTATS_CHEST));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_STOMACH], hit_groups, Translate(victim_ptr, M_VSTATS_STOMACH));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_LEFTARM], hit_groups, Translate(victim_ptr, M_VSTATS_LEFT_ARM));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_RIGHTARM], hit_groups, Translate(victim_ptr, M_VSTATS_RIGHT_ARM));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_LEFTLEG], hit_groups, Translate(victim_ptr, M_VSTATS_LEFT_LEG));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_RIGHTLEG], hit_groups, Translate(victim_ptr, M_VSTATS_RIGHT_LEG));
			AddHitGroup(damage_list[victim_index][i].hit_groups_inflicted[HITGROUP_GEAR], hit_groups, Translate(victim_ptr, M_VSTATS_GEAR));
		}

		char victim_string[256];

		snprintf(victim_string, sizeof(victim_string), "%s", Translate(victim_ptr, 1110, "%s%c%c%i%i%s%s",
			damage_list[victim_index][i].name,
			0xC2, 0xBB,
			damage_list[victim_index][i].health_inflicted/* + damage_list[victim_index][i].armor_inflicted*/,
			damage_list[victim_index][i].shots_inflicted,
			(damage_list[victim_index][i].shots_inflicted == 1) ? Translate(victim_ptr, M_VSTATS_HIT_SINGLE):Translate(victim_ptr, M_VSTATS_HIT_PLURAL),
			hit_groups));

		SayToPlayer(ORANGE_CHAT, victim_ptr, "%s", victim_string);
	}

	for (int i = 0; i < max_players; i++)
	{
		if (damage_list[victim_index][i].shots_inflicted == 0)
		{
			continue;
		}

//.........这里部分代码省略.........
开发者ID:imyzcn,项目名称:mani-admin-plugin,代码行数:101,代码来源:mani_victimstats.cpp

示例15: DlgProcDestEdit

// host edit
INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
	HWND hw;
	int sel;
	char *strptr;

	switch ( msg ) {
	case WM_INITDIALOG: 
		{
			for(int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
				strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, (LPARAM)0);
				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT);
				SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr);
				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT2);
				SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr);
			}

			hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT);
			SendMessage(hw, CB_SETCURSEL, 1, 0);
			hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT2);
			SendMessage(hw, CB_SETCURSEL, 0, 0);

			SetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName);
			SetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel);
			SetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand);
			SetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams);

			CheckDlgButton(hwndDlg, IDC_CHK_DESTTCP, add_edit_addr.port != -1);
			if(add_edit_addr.port != -1) {
				hw = GetDlgItem(hwndDlg, IDC_ED_DESTPORT);
				EnableWindow(hw, TRUE);
				SetDlgItemInt(hwndDlg, IDC_ED_DESTPORT, add_edit_addr.port, FALSE);
			}
			{
				int num_protocols;
				PROTOCOLDESCRIPTOR **pppDesc;

				CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTPROTO);
				SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)Translate("<none>"));
				SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)Translate("<all>"));
				for(int i = 0; i < num_protocols; i++) {
					if(pppDesc[i]->type == PROTOTYPE_PROTOCOL)
						SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->szName);
				}

				if(add_edit_addr.pszProto[0] == '\0') {
					SendMessage(hw, CB_SETCURSEL, 0, 0);
				} else {
					SendMessage(hw, CB_SELECTSTRING, 0, (LPARAM)add_edit_addr.pszProto);
					hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT);
					EnableWindow(hw, TRUE);
					SendMessage(hw, CB_SETCURSEL, (WPARAM)(add_edit_addr.set_status - ID_STATUS_OFFLINE), 0);
					hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT2);
					EnableWindow(hw, TRUE);
					SendMessage(hw, CB_SETCURSEL, (WPARAM)(add_edit_addr.get_status - ID_STATUS_OFFLINE), 0);
				}
			}
			// ? doesn't work? ?
			hw = GetDlgItem(hwndDlg, IDC_ED_DESTLAB);
			SetFocus(hw);
		}
		return FALSE;
	case WM_COMMAND:
		if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_COMBO_DESTPROTO) {
			hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTPROTO);
			sel = SendMessage(hw, CB_GETCURSEL, 0, 0);
			if(sel != CB_ERR) {
				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT);
				EnableWindow(hw, sel != 0);
				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT2);
				EnableWindow(hw, sel != 0);
			}
		}

		if ( HIWORD( wParam ) == BN_CLICKED ) {
			switch( LOWORD( wParam )) {
			case IDC_CHK_DESTTCP:
				hw = GetDlgItem(hwndDlg, IDC_ED_DESTPORT);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_DESTTCP));
				break;
			case IDOK:
				GetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName, MAX_PINGADDRESS_STRING_LENGTH);
				GetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel, MAX_PINGADDRESS_STRING_LENGTH);
				GetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand, MAX_PATH);
				GetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams, MAX_PATH);

				hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTPROTO);
				if(SendMessage(hw, CB_GETCURSEL, 0, 0) != -1) {
					GetDlgItemText(hwndDlg, IDC_COMBO_DESTPROTO, add_edit_addr.pszProto, MAX_PINGADDRESS_STRING_LENGTH);
					if(!strcmp(add_edit_addr.pszProto, Translate("<none>"))) add_edit_addr.pszProto[0] = '\0';
					else {
						hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT);
						sel = SendMessage(hw, CB_GETCURSEL, 0, 0);
						if(sel != -1)
							add_edit_addr.set_status = ID_STATUS_OFFLINE + sel;
						hw = GetDlgItem(hwndDlg, IDC_COMBO_DESTSTAT2);
						sel = SendMessage(hw, CB_GETCURSEL, 0, 0);
						if(sel != -1)
							add_edit_addr.get_status = ID_STATUS_OFFLINE + sel;
//.........这里部分代码省略.........
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:101,代码来源:options.cpp


注:本文中的Translate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。