• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WDL_String类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ReleaseMouseCapture

void IGraphics::OnMouseDown(int x, int y, IMouseMod* pMod)
{
  ReleaseMouseCapture();
  int c = GetMouseControlIdx(x, y);
  if (c >= 0)
  {
    mMouseCapture = c;
    mMouseX = x;
    mMouseY = y;

    IControl* pControl = mControls.Get(c);
    int paramIdx = pControl->ParamIdx();

    #if defined OS_WIN || defined VST3_API  // on Mac, IGraphics.cpp is not compiled in a static library, so this can be #ifdef'd
    if (mPlug->GetAPI() == kAPIVST3)
    {
      if (pMod->R && paramIdx >= 0)
      {
        ReleaseMouseCapture();
        mPlug->PopupHostContextMenuForParam(paramIdx, x, y);
        return;
      }
    }
    #endif
    
    #ifdef AAX_API
    if (mAAXViewContainer && paramIdx >= 0)
    {
      uint32_t mods = GetAAXModifiersFromIMouseMod(pMod);
      #ifdef OS_WIN
      // required to get start/windows and alt keys
      uint32_t aaxViewMods = 0;
      mAAXViewContainer->GetModifiers(&aaxViewMods);
      mods |= aaxViewMods;
      #endif
      WDL_String paramID;
      paramID.SetFormatted(32, "%i", paramIdx+1);

      if (mAAXViewContainer->HandleParameterMouseDown(paramID.Get(), mods) == AAX_SUCCESS)
      {
        return; // event handled by PT
      }
    }
    #endif
    
    if (paramIdx >= 0)
    {
      mPlug->BeginInformHostOfParamChange(paramIdx);
    }
        
    pControl->OnMouseDown(x, y, pMod);
  }
}
开发者ID:Nowhk,项目名称:wdl-ol,代码行数:53,代码来源:IGraphics.cpp


示例2: GetDlgItem

void MainWnd::on_list_update()
{
    WDL_PtrList<ShellAction> *actions = NULL;
    App *the_app = NULL;
    the_app = App::get();
    actions = the_app->get_tasks();

#ifdef WIN32
    HWND ctrl = GetDlgItem(m_hwnd, IDC_TASKS);
    int sel_id = -1;
    sel_id = ListView_GetCurSel(ctrl);
    ListView_DeleteAllItems(ctrl);

    if(!actions->GetSize())
        return;

    for(int i = 0; i < actions->GetSize(); i++)
    {
        LVITEM lvitem;
        WDL_String tmp;
        char buf[128];
        ShellAction *action = actions->Get(i);

        lvitem.mask = LVIF_TEXT | LVIF_PARAM;
        lvitem.iItem = i;
        lvitem.iSubItem = 0;
        lvitem.lParam = (LPARAM)action->get_id();
        lvitem.cchTextMax = strlen(action->get_title());
        lvitem.pszText = action->get_title();

        ListView_InsertItem(ctrl, &lvitem);
        ListView_SetItemText(ctrl, i, 1, action->get_path());

        tmp = "Every ";
        itoa(action->get_interval(), buf, 10);
        tmp.Append(buf);
        tmp.Append(" ");
        tmp.Append(RUN_TYPE_LABELS[action->get_interval_type()]);

        ListView_SetItemText(ctrl, i, 2, tmp.Get());
    }

    if (sel_id >= 0 && m_selected_task)
    {
        ShellAction *action = the_app->get_task_by_id(sel_id + 1);
        the_app->activate_task(action);
        ListView_SetItemState(ctrl, sel_id, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
    }
#endif // WIN32
}
开发者ID:L1quid,项目名称:Slumber,代码行数:50,代码来源:main_wnd.cpp


示例3: GetWindowThreadProcessId

BOOL CALLBACK IGraphicsWin::FindMainWindow(HWND hWnd, LPARAM lParam)
{
    IGraphicsWin* pGraphics = (IGraphicsWin*) lParam;
    if (pGraphics) {
        DWORD wPID;
        GetWindowThreadProcessId(hWnd, &wPID);
        WDL_String str;
        GetWndClassName(hWnd, &str);
        if (wPID == pGraphics->mPID && !strcmp(str.Get(), pGraphics->mMainWndClassName.Get())) {
            pGraphics->mMainWnd = hWnd;
            return FALSE;   // Stop enumerating.
        }
    }
    return TRUE;
}
开发者ID:tappleby,项目名称:hush-vst,代码行数:15,代码来源:IGraphicsWin.cpp


示例4: OpenRelatedProject

void OpenRelatedProject(COMMAND_T* pCmd)
{
	if ((int)pCmd->user == g_relatedProjects.Get()->GetSize())
		// Give the user the chance to add a related project if they selected the first open spot
		if (MessageBox(g_hwndParent, __LOCALIZE("No related project found. Add one now?","sws_mbox"), __LOCALIZE("SWS Open Related Project","sws_mbox"), MB_YESNO) == IDYES)
			AddRelatedProject();

	if ((int)pCmd->user >= g_relatedProjects.Get()->GetSize())
		return;

	WDL_String* pStr = g_relatedProjects.Get()->Get((int)pCmd->user);
	ReaProject* pProj;
	// See if it's already opened
	char cOpenedProj[256];
	int i = 0;
	while ((pProj = EnumProjects(i++, cOpenedProj, 256)))
	{
		if (_stricmp(cOpenedProj, pStr->Get()) == 0)
		{
			SelectProjectInstance(pProj);
			return;
		}
	}

	// Nope, open in new tab
	// Save "prompt on new project" variable
	int iNewProjOpts;
	int sztmp;
	int* pNewProjOpts = (int*)get_config_var("newprojdo", &sztmp);
	iNewProjOpts = *pNewProjOpts;
	*pNewProjOpts = 0;
	pProj = EnumProjects(-1, NULL, 0);
	Main_OnCommand(41929, 0); // New project tab (ignore default template)
	Main_openProject(pStr->Get());
	EnumProjects(-1, cOpenedProj, 256);
	if (_stricmp(pStr->Get(), cOpenedProj))
	{
		Main_OnCommand(40860, 0); // 40860 = Close current project tab
		SelectProjectInstance(pProj);
		g_relatedProjects.Get()->Delete((int)pCmd->user, true);
	}
	*pNewProjOpts = iNewProjOpts;
}
开发者ID:Breeder,项目名称:sws,代码行数:43,代码来源:ProjectMgr.cpp


示例5: handleTeamStreamMsg

void handleTeamStreamMsg(char* fullName , char* username , char* msgIn , bool isPrivate)
{
	bool isEnableTeamStream = !strcmp(msgIn + TEAMSTREAM_CHAT_TRIGGER_LEN , "enabled") ;
	WDL_String msgOut ; msgOut.Set(username) ;
	msgOut.Append((isEnableTeamStream)? " is in TeamStream mode" : " is in NinJam mode") ;
	chat_addline(USERNAME_TEAMSTREAM , msgOut.Get()) ;

	int userId = TeamStream::AddUser(username , fullName) ; if (userId <= USERID_LOCAL) return ;

	if (!isEnableTeamStream || !TeamStream::IsTeamStreamUsernameCollision(username))
		TeamStream::SetTeamStreamMode(userId , isEnableTeamStream) ;
	bool isFirstReply = (!TeamStream::GetNRemoteUsers()) ;
	if (isPrivate) { if (isFirstReply) TeamStream::SendLinksReqChatMsg(fullName) ; }
	else { TeamStream::SendTeamStreamChatMsg(true , fullName) ; TeamStream::SendChatColorChatMsg(true , fullName) ; }

// TODO: we could combine SendTeamStreamChatMsg() with SendChatColorChatMsg()
// TODO: in order for ID_TEAMSTREAM_LOAD/SAVE to work we need to check the current link order now
//	if (!isPrivate) and SetLink() now if match (i think this means bringing back the m_links array)
// and to be sure to remove exitting users only from the listview but keep them in the array?
}
开发者ID:bill-auger,项目名称:TeamStream,代码行数:20,代码来源:chat.cpp


示例6: AppendTimestamp

const char* AppendTimestamp(const char* Mmm_dd_yyyy, const char* hh_mm_ss, const char* cStr)
{
    static WDL_String str;
    str.Set(cStr);
    WDL_String tStr;
    CompileTimestamp(Mmm_dd_yyyy, hh_mm_ss, &tStr);
    str.Append(" ");
    str.Append(tStr.Get());
    return str.Get();
}
开发者ID:b-vesco,项目名称:vfx-wdl,代码行数:10,代码来源:Log.cpp


示例7: handleLinksMsg

void handleLinksMsg(char* senderUsername , char* msgIn)
{
	WDL_String msgOut ; msgOut.Set("Link order:") ;
	int linkIdx ; int lastUsernameIdx = LINKS_CHAT_TRIGGER_LEN ; int usernameLen = -1 ;
	for (linkIdx = 0 ; linkIdx < N_LINKS ; ++linkIdx)
	{
		// parse username
		lastUsernameIdx += usernameLen + 1 ; usernameLen = -1 ; char aChar ;
		do aChar = msgIn[lastUsernameIdx + (++usernameLen)] ;
		while (aChar && aChar != ' ') ; if (!usernameLen) return ;

		char username[255] ; strncpy(username , msgIn + lastUsernameIdx , usernameLen) ; username[usernameLen] = '\0' ;

#if IS_CHAT_LINKS
		// chat full link order
		int userId = TeamStream::GetUserIdByName(username) ; msgOut.Append("\n") ;
		char linkMsg[255] ; sprintf(linkMsg , "Link %d: %s" , linkIdx + 1 , username) ; msgOut.Append(linkMsg) ;
		if (userId == USERID_NOBODY && strcmp(username , USERNAME_NOBODY)) msgOut.Append(" is not here") ;
#else IS_CHAT_LINKS
		int userId = TeamStream::GetUserIdByName(username) ;
#endif IS_CHAT_LINKS

		// set link
		if (!isUsernameLocal(senderUsername))
			if (TeamStream::IsUserIdReal(userId)) TeamStream::SetLink(userId , username , linkIdx , true) ;
			else TeamStream::Set_Link_GUI(USERID_NOBODY , username , linkIdx , N_LINKS) ;
	}
#if IS_CHAT_LINKS
	chat_addline(USERNAME_TEAMSTREAM , msgOut.Get()) ;
#endif IS_CHAT_LINKS
}
开发者ID:bill-auger,项目名称:TeamStream,代码行数:31,代码来源:chat.cpp


示例8: if

WDL_String TeamStream::ParseCommandLineHost(LPSTR cmdParam)
{
	// parse first cmd line arg (e.g. ninjam://ninbot.com:2049)
	WDL_String hostAndPort ; hostAndPort.Set("") ; if (!cmdParam[0]) return hostAndPort ;

	int isQuoted = (int)(cmdParam[0] == '"') ;
	char param[256] ; strncpy(param , cmdParam + isQuoted , 255) ; int len = strlen(param) ;
	int isSlash = (int)(param[len - (1 + isQuoted)] == '/') ;
	param[len - isQuoted - isSlash] = '\0' ;

	// tokenize and validate
	char* prot = strtok(param , ":") ; if (!prot || strcmp(prot , "ninjam")) return hostAndPort ;

	// validate host and port existance
	hostAndPort.Set(param + 9) ; char* host ; int port ;
	host = strtok(NULL , ":") ; char* p = strtok(NULL , ":") ; if (p) port = atoi(p) ;
	if (host && strlen(host) > 2 && port >= MIN_PORT && port <= MAX_PORT)
		host += 2 ; else return hostAndPort ; // strip leading slashes

	// validate allowed host
	if (!ValidateHost(host , true)) hostAndPort.Set(AUTOJOIN_FAIL) ; return hostAndPort ;
}
开发者ID:bill-auger,项目名称:TeamStream,代码行数:22,代码来源:teamstream.cpp


示例9: DoAnalyzeItem

void DoAnalyzeItem(COMMAND_T*)
{
	WDL_TypedBuf<MediaItem*> items;
	SWS_GetSelectedMediaItems(&items);
	bool bDidWork = false;
	for (int i = 0; i < items.GetSize(); i++)
	{
		MediaItem* mi = items.Get()[i];
		int iChannels = ((PCM_source*)mi)->GetNumChannels();
		if (iChannels)
		{
			bDidWork = true;
			ANALYZE_PCM a;
			memset(&a, 0, sizeof(a));
			a.iChannels = iChannels;
			a.dPeakVals = new double[iChannels];
			a.dRMSs     = new double[iChannels];

			if (AnalyzeItem(mi, &a))
			{
				WDL_String str;
				str.Set(__LOCALIZE("Peak level:","sws_analysis"));
				for (int i = 0; i < iChannels; i++) {
					str.Append(" ");
					str.AppendFormatted(50, __LOCALIZE_VERFMT("Channel %d = %.2f dB","sws_analysis"), i+1, VAL2DB(a.dPeakVals[i]));
				}
				str.Append("\n");
				str.Append(__LOCALIZE("RMS level:","sws_analysis"));
				for (int i = 0; i < iChannels; i++) {
					str.Append(" ");
					str.AppendFormatted(50, __LOCALIZE_VERFMT("Channel %d = %.2f dB","sws_analysis"), i+1, VAL2DB(a.dRMSs[i]));
				}
				MessageBox(g_hwndParent, str.Get(), __LOCALIZE("Item analysis","sws_analysis"), MB_OK);
			}
			delete [] a.dPeakVals;
			delete [] a.dRMSs;
		}
	}
	if (!bDidWork)
	{
		MessageBox(NULL, __LOCALIZE("No items selected to analyze.","sws_analysis"), __LOCALIZE("SWS - Error","sws_analysis"), MB_OK);
		return;
	}
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:44,代码来源:Analysis.cpp


示例10: SearchDirectory

int SearchDirectory(vector<string> &refvecFiles, const char* cDir, const char* cExt, bool bSubdirs)
{
	WDL_DirScan ds;
	int iRet = ds.First(cDir);
	int found = 0;
	g_bAbortScan = false;
	if (!iRet)
	{
		do
		{
			if (strcmp(ds.GetCurrentFN(), ".") == 0 || strcmp(ds.GetCurrentFN(), "..") == 0)
				continue;
			WDL_String foundFile;
			ds.GetCurrentFullFN(&foundFile);
			lstrcpyn(g_CurrentScanFile, foundFile.Get(), 1024);
			if (bSubdirs && ds.GetCurrentIsDirectory())
			{
				found += SearchDirectory(refvecFiles, foundFile.Get(), cExt, true);
			}
			else
			{
				char* cFoundExt  = strrchr(foundFile.Get(), '.');
				if (cFoundExt)
				{
					cFoundExt++;
					if ((!cExt && IsMediaExtension(cFoundExt, false)) || (cExt && _stricmp(cFoundExt, cExt) == 0))
					{
						refvecFiles.push_back(foundFile.Get());
						found++;
					}
				}
			}
		}
		while(!ds.Next() && !g_bAbortScan);
	}
	return found;
}
开发者ID:wolqws,项目名称:sws,代码行数:37,代码来源:XenUtils.cpp


示例11: MatchesFilter

bool FilteredVisState::MatchesFilter(MediaTrack* tr)
{
	static WDL_String sTrackName;
	if (!m_parsedFilter->getnumtokens())
		return true;
	sTrackName.Set((char*)GetSetMediaTrackInfo(tr, "P_NAME", NULL));
	if (!sTrackName.GetLength())
		return false;
	for (int i = 0; i < sTrackName.GetLength(); i++)
		sTrackName.Get()[i] = tolower(sTrackName.Get()[i]);
	for (int j = 0; j < m_parsedFilter->getnumtokens(); j++)
		if (strstr(sTrackName.Get(), m_parsedFilter->gettoken_str(j)))
			return true;
	return false;
}
开发者ID:Breeder,项目名称:sws,代码行数:15,代码来源:TracklistFilter.cpp


示例12: SetFilter

// TODO UTF8 support here
void FilteredVisState::SetFilter(const char* cFilter)
{
	if (cFilter && cFilter[0])
		m_sFilter.Set(cFilter);
	else
		m_sFilter.Set("");
	static WDL_String sLCFilter;
	sLCFilter.Set(m_sFilter.Get());
	for (int i = 0; i < sLCFilter.GetLength(); i++)
		sLCFilter.Get()[i] = tolower(sLCFilter.Get()[i]);
	m_parsedFilter->parse(sLCFilter.Get());
}
开发者ID:Breeder,项目名称:sws,代码行数:13,代码来源:TracklistFilter.cpp


示例13: chatmsg_cb

void chatmsg_cb(int user32, NJClient *inst, char **parms, int nparms)
{
  if (!parms[0]) return;

  if (!strcmp(parms[0],"TOPIC"))
  {
    if (parms[2])
    {
      WDL_String tmp;
      if (parms[1] && *parms[1])
      {
        tmp.Set(parms[1]);
        if (parms[2][0])
        {
          tmp.Append(" sets topic to: ");
          tmp.Append(parms[2]);
        }
        else
        {
          tmp.Append(" removes topic.");
        }  
      }
      else
      {
        if (parms[2][0])
        {
          tmp.Set("Topic is: ");
          tmp.Append(parms[2]);
        }
        else tmp.Set("No topic is set.");
      }

      g_topic.Set(parms[2]);
      chat_addline("",tmp.Get());
    
    }
  }
  else if (!strcmp(parms[0],"MSG"))
  {
    if (parms[1] && parms[2])
      chat_addline(parms[1],parms[2]);
  } 
  else if (!strcmp(parms[0],"PRIVMSG"))
  {
    if (parms[1] && parms[2])
    {
      WDL_String tmp;
      tmp.Set("*");
      tmp.Append(parms[1]);
      tmp.Append("* ");
      tmp.Append(parms[2]);
      chat_addline(NULL,tmp.Get());
    }
  } 
  else if (!strcmp(parms[0],"JOIN") || !strcmp(parms[0],"PART"))
  {
    if (parms[1] && *parms[1])
    {
      WDL_String tmp(parms[1]);
      tmp.Append(" has ");
      tmp.Append(parms[0][0]=='P' ? "left" : "joined");
      tmp.Append(" the server");
      chat_addline("",tmp.Get());
    }
  } 
}
开发者ID:balgarath,项目名称:wahjam,代码行数:66,代码来源:chat.cpp


示例14: chatRun

void chatRun(HWND hwndDlg)
{
  WDL_String tmp;
  g_client_mutex.Enter();
  tmp.Set(m_append_text.Get());
  m_append_text.Set("");
  g_client_mutex.Leave();

  if (!tmp.Get()[0]) return;
  HWND m_hwnd=GetDlgItem(hwndDlg,IDC_CHATDISP);
  SCROLLINFO si={sizeof(si),SIF_RANGE|SIF_POS|SIF_TRACKPOS,};
  GetScrollInfo(m_hwnd,SB_VERT,&si);

  {
    int oldsels,oldsele;
    SendMessage(m_hwnd,EM_GETSEL,(WPARAM)&oldsels,(LPARAM)&oldsele);
	  char txt[32768];
	  if(strlen(tmp.Get())>sizeof(txt)-1) return;

	  GetWindowText(m_hwnd,txt,sizeof(txt)-1);
	  txt[sizeof(txt)-1]=0;

	  while(strlen(txt)+strlen(tmp.Get())+4>sizeof(txt))
	  {
		  char *p=txt;
		  while(*p!=0 && *p!='\n') p++;
		  if(*p==0) return;
		  while (*p=='\n') p++;
		  strcpy(txt,p);
      oldsels -= p-txt;
      oldsele -= p-txt;
	  }
    if (oldsels < 0) oldsels=0;
    if (oldsele < 0) oldsele=0;

	  if(txt[0]) strcat(txt,"\n");
	  strcat(txt,tmp.Get());

    CHARFORMAT2 cf2;
    cf2.cbSize=sizeof(cf2);
    cf2.dwMask=CFM_LINK;
    cf2.dwEffects=0;
    SendMessage(m_hwnd,EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&cf2);
	  SetWindowText(m_hwnd,txt);

    GetWindowText(m_hwnd,txt,sizeof(txt)-1);
    txt[sizeof(txt)-1]=0;

    char *t=txt;
    char lt=' ';
    int sub=0;
    while (*t)
    {
      if (lt == ' ' || lt == '\n' || lt == '\r')
      {
        int isurl=0;
        if (!strnicmp(t,"http:",5)) isurl=5;
        else if (!strnicmp(t,"ftp:",4)) isurl=4;
        else if (!strnicmp(t,"www.",4)) isurl=4;

        if (isurl && t[isurl] != ' ' && t[isurl] != '\n' && t[isurl] != '\r' && t[isurl])
        {
          int spos=t-txt-sub;
          t+=isurl;
          while (*t && *t != ' ' && *t != '\n' && *t != '\r') { t++; }
          SendMessage(m_hwnd,EM_SETSEL,spos,(t-txt)-sub);
          CHARFORMAT2 cf2;
          cf2.cbSize=sizeof(cf2);
          cf2.dwMask=CFM_LINK;
          cf2.dwEffects=CFE_LINK;
          SendMessage(m_hwnd,EM_SETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf2);
        }
      }
      if (*t == '\n') sub++;
      if (*t) lt=*t++;
    }
    SendMessage(m_hwnd,EM_SETSEL,oldsels,oldsele);
  }

  if (GetFocus() == m_hwnd)      
  {
    SendMessage(m_hwnd, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION,si.nTrackPos),0);
  }
  else
  {
    GetScrollInfo(m_hwnd,SB_VERT,&si);
    SendMessage(m_hwnd, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION,si.nMax),0);
  }
}
开发者ID:balgarath,项目名称:wahjam,代码行数:89,代码来源:chat.cpp


示例15: chat_addline

void chat_addline(char *src, char *text)
{
  WDL_String tmp;
  if (src && *src && !strncmp(text,"/me ",4))
  {
    tmp.Set("* ");
    tmp.Append(src);
    tmp.Append(" ");
    char *p=text+3;
    while (*p == ' ') p++;
    tmp.Append(p);
  }
  else
  {
   if (src&&*src)
   {
     tmp.Set("<");
     tmp.Append(src);
     tmp.Append("> ");
   }
   else if (src)
   {
     tmp.Set("*** ");
   }
   tmp.Append(text);
  }

  g_client_mutex.Enter();
  if (m_append_text.Get()[0])
    m_append_text.Append("\n");
  m_append_text.Append(tmp.Get());
  g_client_mutex.Leave();

}
开发者ID:balgarath,项目名称:wahjam,代码行数:34,代码来源:chat.cpp


示例16: switch


//.........这里部分代码省略.........
    // fall through
    case 'Y'-'A'+1:
      if ((c == 'Z'-'A'+1 || !SHIFT_KEY_DOWN) && !ALT_KEY_DOWN)
      {
        if (m_undoStack_pos < m_undoStack.GetSize()-1)
        {
          m_undoStack_pos++;
          loadUndoState(m_undoStack.Get(m_undoStack_pos));
          draw();
          setCursor();
          char buf[512];
          snprintf(buf,sizeof(buf),"Redid action - %d items in redo buffer",m_undoStack.GetSize()-m_undoStack_pos-1);
          draw_message(buf);
        }
        else 
        {
          draw_message("Can't Redo");  
        }
      }
    break;
    case KEY_IC:
      if (!SHIFT_KEY_DOWN && !ALT_KEY_DOWN)
      {
        s_overwrite=!s_overwrite;
        setCursor();
        break;
      }
      // fqll through
    case 'V'-'A'+1:
      if (!SHIFT_KEY_DOWN && !ALT_KEY_DOWN)
      {
        // generate a m_clipboard using win32 clipboard data
        WDL_PtrList<const char> lines;
        WDL_String buf;
#ifdef WDL_IS_FAKE_CURSES
        if (CURSES_INSTANCE)
        {
          OpenClipboard(CURSES_INSTANCE->m_hwnd);
          HANDLE h=GetClipboardData(CF_TEXT);
          if (h)
          {
            char *t=(char *)GlobalLock(h);
            int s=GlobalSize(h);
            buf.Set(t,s);
            GlobalUnlock(t);        
          }
          CloseClipboard();
        }
        else
#endif
        {
          buf.Set(s_fake_clipboard.Get());
        }

        if (buf.Get() && buf.Get()[0])
        {
          char *src=buf.Get();
          while (*src)
          {
            char *seek=src;
            while (*seek && *seek != '\r' && *seek != '\n') seek++;
            char hadclr=*seek;
            if (*seek) *seek++=0;
            lines.Add(src);

            if (hadclr == '\r' && *seek == '\n') seek++;
开发者ID:fourthskyinteractive,项目名称:wdl-ol,代码行数:67,代码来源:curses_editor.cpp


示例17: Run

  int Run()
  {
    // perform lookup here

    user_valid=0;

    if (!strncmp(username.Get(),"anonymous",9) && (!username.Get()[9] || username.Get()[9] == ':'))
    {
      logText("got anonymous request (%s)\n",g_config_allowanonymous?"allowing":"denying");
      if (!g_config_allowanonymous) return 1;

      user_valid=1;
      reqpass=0;

      WDL_String tmp(username.Get());

      if (tmp.Get()[9] == ':' && tmp.Get()[10])
      {
        username.Set(tmp.Get()+10);

        int cnt=16;
        char *p=username.Get();
        while (*p)
        {
          if (!cnt--)
          {
            *p=0;
            break;
          }
          if (*p == '@' || *p == '.') *p='_';
          p++;
        }
      }
      else username.Set("anon");

      username.Append("@");
      username.Append(hostmask.Get());

      if (g_config_anonymous_mask_ip)
      {
        char *p=username.Get();
        while (*p) p++;
        while (p > username.Get() && *p != '.' && *p != '@') p--;
        if (*p == '.' && p[1])
        {
          p[1]='x';
          p[2]=0;
        }
      }

      privs=(g_config_allow_anonchat?PRIV_CHATSEND:0) | (g_config_allowanonymous_multi?PRIV_ALLOWMULTI:0) | PRIV_VOTE;
      max_channels=g_config_maxch_anon;
    }
    else
    {
      int x;
      logText("got login request for '%s'\n",username.Get());
      if (g_status_user.Get()[0] && !strcmp(username.Get(),g_status_user.Get()))
      {
        user_valid=1;
        reqpass=1;
        is_status=1;
        privs=0; 
        max_channels=0;

        WDL_SHA1 shatmp;
        shatmp.add(username.Get(),strlen(username.Get()));
        shatmp.add(":",1);
        shatmp.add(g_status_pass.Get(),strlen(g_status_pass.Get()));

        shatmp.result(sha1buf_user);
      }
      else for (x = 0; x < g_userlist.GetSize(); x ++)
      {
        if (!strcmp(username.Get(),g_userlist.Get(x)->name.Get()))
        {
          user_valid=1;
          reqpass=1;

          char *pass=g_userlist.Get(x)->pass.Get();
          WDL_SHA1 shatmp;
          shatmp.add(username.Get(),strlen(username.Get()));
          shatmp.add(":",1);
          shatmp.add(pass,strlen(pass));

          shatmp.result(sha1buf_user);

          privs=g_userlist.Get(x)->priv_flag; 
          max_channels=g_config_maxch_user;
          break;
        }
      }
    }

    return 1;
  }
开发者ID:FeodorFitsner,项目名称:libninjam,代码行数:96,代码来源:ninjamsrv.cpp


示例18: chatRun

void chatRun(HWND hwndDlg)
{
  WDL_String tmp;
  g_client_mutex.Enter();
  tmp.Set(m_append_text.Get());
  m_append_text.Set("");
  g_client_mutex.Leave();

  if (!tmp.Get()[0]) return;
  SCROLLINFO si={sizeof(si),SIF_RANGE|SIF_POS|SIF_TRACKPOS,};
  GetScrollInfo(g_chat_hwnd , SB_VERT , &si) ;

  {
    int oldsels,oldsele;
    SendMessage(g_chat_hwnd , EM_GETSEL , (WPARAM)&oldsels , (LPARAM)&oldsele) ;
	  char txt[32768];
	  if(strlen(tmp.Get())>sizeof(txt)-1) return;

	  GetWindowText(g_chat_hwnd , txt , sizeof(txt)-1) ;
	  txt[sizeof(txt)-1]=0;

	  while(strlen(txt)+strlen(tmp.Get())+4>sizeof(txt))
	  {
		  char *p=txt;
		  while(*p!=0 && *p!='\n') p++;
		  if(*p==0) return;
		  while (*p=='\n') p++;
		  strcpy(txt,p);
      oldsels -= p-txt;
      oldsele -= p-txt;
	  }
    if (oldsels < 0) oldsels=0;
    if (oldsele < 0) oldsele=0;

	  if(txt[0]) strcat(txt,"\n");
	  strcat(txt,tmp.Get());

    CHARFORMAT2 cf2;
    cf2.cbSize=sizeof(cf2);
    cf2.dwMask=CFM_LINK;
    cf2.dwEffects=0;
    SendMessage(g_chat_hwnd , EM_SETCHARFORMAT , SCF_ALL , (LPARAM)&cf2) ;
	  SetWindowText(g_chat_hwnd , txt) ;

    GetWindowText(g_chat_hwnd , txt , sizeof(txt)-1) ;
    txt[sizeof(txt)-1]=0;

#if COLOR_CHAT
		char *t = txt ; int sub=0 ; char lt = '\n' ;		
    while (*t)
    {
      if (lt == '\n' || lt == '\r')
      {
				int usernameOffset = 0 ; bool isParseTokens ; bool isColorText ;
				if (!strnicmp(t , "<PM from " , 9))	// private chat (choose color per user)
					{ usernameOffset = 9 ; isParseTokens = true ; }
				else if (!strnicmp(t , "<" , 1))			// user chat (choose color per user)
					{ usernameOffset = 1 ; isParseTokens = true ; }
				else isParseTokens = isColorText = false ;

				int lineBegin ; int boldEnd ; int normalBegin ; int lineEnd ; char theUsername[256] ;
				if (isParseTokens)
				{
					// parse username token and set seperator pointers (<bold> normal)
					lineBegin = t - txt - sub ; char* usernameBegin = (t += usernameOffset) ;
					while (*t && *t != '\n' && *t != '\r' && *t != ' ') ++t ;
					boldEnd = t - txt - sub ; normalBegin = boldEnd + 1 ;
					int theUsernameLen = boldEnd - lineBegin - usernameOffset - 1 ;
					if (isColorText = theUsernameLen < 256)
						{ strncpy(theUsername , usernameBegin , theUsernameLen) ; theUsername[theUsernameLen] = '\0' ; }
					while (*t && *t != '\n' && *t != '\r') ++t ; lineEnd = t - txt - sub ;
				}

				if (isColorText)
				{
					// choose color per user
					int chatColorIdx = TeamStream::GetChatColorIdxByName(theUsername) ;
					COLORREF color = TeamStream::Get_Chat_Color(chatColorIdx) ;

					// apply char formatting
					CHARFORMAT2 cf2 ; cf2.cbSize = sizeof(cf2) ;
					// bold text - sender name
					cf2.dwMask = CFM_COLOR | CFM_BOLD ; cf2.crTextColor = color ; cf2.dwEffects = CFE_BOLD ;
					SendMessage(g_chat_hwnd , EM_SETSEL , lineBegin , boldEnd) ;
					SendMessage(g_chat_hwnd , EM_SETCHARFORMAT , SCF_SELECTION , (LPARAM)&cf2) ;
					if (!cfg_color_names_only)
					{
						// normal text - everything after bold text
						cf2.dwMask = CFM_COLOR ; cf2.crTextColor = color ;
						SendMessage(g_chat_hwnd , EM_SETSEL , normalBegin , lineEnd) ;
						SendMessage(g_chat_hwnd , EM_SETCHARFORMAT , SCF_SELECTION , (LPARAM)&cf2) ;
					}
				}
      } // if terminator char
      if (*t == '\n') sub++ ;
      if (*t) lt = *t++ ;
		} // while

// NOTE: the original link parser code was unnecessary it is sufficient to
// send EM_AUTOURLDETECT to the richedit20 control (catches most protocols)
//.........这里部分代码省略.........
开发者ID:bill-auger,项目名称:TeamStream,代码行数:101,代码来源:chat.cpp


示例19: while

WDL_SHM_Connection::WDL_SHM_Connection(bool whichChan,
                      const char *uniquestring, // identify 
                      int shmsize, // bytes, whoever opens first decides
                      int timeout_sec,
                      int extra_flags // unused on win32

                    )
{
  m_timeout_cnt=0;
  m_timeout_sec=timeout_sec;
  m_last_recvt=time(NULL)+2; // grace period
  { // make shmsize the next power of two
    int a = shmsize;
    shmsize=2;
    while (shmsize < SHM_MINSIZE || shmsize<a) shmsize*=2;
  }

  m_file=INVALID_HANDLE_VALUE;
  m_filemap=NULL;
  m_mem=NULL;
  m_lockmutex=m_events[0]=m_events[1]=NULL;

  m_whichChan=whichChan ? 1 : 0;

  char buf[512];
  GetTempPath(sizeof(buf)-4,buf);
  if (!buf[0]) lstrcpyn(buf,"C:\\",32);
  if (buf[strlen(buf)-1] != '/' && buf[strlen(buf)-1] != '\\') strcat(buf,"\\");
  m_tempfn.Set(buf);
  m_tempfn.Append("WDL_SHM_");
  m_tempfn.Append(uniquestring);
  m_tempfn.Append(".tmp");

  WDL_String tmp;
  if (!(GetVersion()&0x80000000)) tmp.Set("Global\\WDL_SHM_");
  else tmp.Set("WDL_SHM_");
  tmp.Append(uniquestring);
  int tmp_l = strlen(tmp.Get());

  tmp.Append(".m");
  HANDLE mutex = CreateMutex(NULL,FALSE,tmp.Get());

  if (mutex) WaitForSingleObject(mutex,INFINITE);

  tmp.Get()[tmp_l]=0;
  tmp.Append(whichChan?".l1":".l0");
  m_lockmutex = CreateMutex(NULL,FALSE,tmp.Get());
  if (m_lockmutex)
  {
    if (WaitForSingleObject(m_lockmutex,100) == WAIT_OBJECT_0)
    {
      DeleteFile(m_tempfn.Get()); // this is designed to fail if another process has it locked

      m_file=CreateFile(m_tempfn.Get(),GENERIC_READ|GENERIC_WRITE,
                        FILE_SHARE_READ|FILE_SHARE_WRITE ,
                        NULL,whichChan ? OPEN_EXISTING : OPEN_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
    }
    else
    {
      CloseHandle(m_lockmutex);
      m_lockmutex=0;
    }
  }
  
  int mapsize;
  if (m_file != INVALID_HANDLE_VALUE && 
        ((mapsize=GetFileSize(m_file,NULL)) < SHM_HDRSIZE+SHM_MINSIZE*2 || 
          mapsize == 0xFFFFFFFF))
  {
    char buf[4096];
    memset(buf,0,sizeof(buf));
    *(int *)buf=shmsize;

    int sz=shmsize*2 + SHM_HDRSIZE;
    while (sz>0)
    {
      DWORD d;
      int a = sz;
      if (a>sizeof(buf))a=sizeof(buf);
      WriteFile(m_file,buf,a,&d,NULL);
      sz-=a;
      *(int *)buf = 0;
    }
  }

  if (m_file!=INVALID_HANDLE_VALUE)
    m_filemap=CreateFileMapping(m_file,NULL,PAGE_READWRITE,0,0,NULL);

  if (m_filemap)
  {
    m_mem=(unsigned char *)MapViewOfFile(m_filemap,FILE_MAP_WRITE,0,0,0);

    tmp.Get()[tmp_l]=0;
    tmp.Append(".1");
    m_events[0]=CreateEvent(NULL,false,false,tmp.Get());
    tmp.Get()[strlen(tmp.Get())-1]++; 
    m_events[1]=CreateEvent(NULL,false,false,tmp.Get());
  }

  if (mutex) 
//.........这里部分代码省略.........
开发者ID:M-l-M,项目名称:wdl,代码行数:101,代码来源:shm_connection.cpp


示例20: DrawRect

// The OS is announcing what needs to be redrawn,
// which may be a larger area than what is strictly dirty.
bool IGraphics::Draw(IRECT* pR)
{
//  #pragma REMINDER("Mutex set while drawing")
//  WDL_MutexLock lock(&mMutex);

  int i, j, n = mControls.GetSize();
  if (!n)
  {
    return true;
  }

  if (mStrict)
  {
    mDrawRECT = *pR;
    int n = mControls.GetSize();
    IControl** ppControl = mControls.GetList();
    for (int i = 0; i < n; ++i, ++ppControl)
    {
      IControl* pControl = *ppControl;
      if (!(pControl->IsHidden()) && pR->Intersects(pControl->GetRECT()))
      {
        pControl->Draw(this);
      }
      pControl->SetClean();
    }
  }
  else
  {
    IControl* pBG = mControls.Get(0);
    if (pBG->IsDirty())   // Special case when everything needs to be drawn.
    {
      mDrawRECT = *(pBG->GetRECT());
      for (int j = 0; j < n; ++j)
      {
        IControl* pControl2 = mControls.Get(j);
        if (!j || !(pControl2->IsHidden()))
        {
          pControl2->Draw(this);
          pControl2->SetClean();
        }
      }
    }
    else
    {
      for (i = 1; i < n; ++i)   // loop through all controls starting from one (not bg)
      {
        IControl* pControl = mControls.Get(i); // assign control i to pControl
        if (pControl->IsDirty())   // if pControl is dirty
        {

          // printf("control %i is Dirty\n", i);

          mDrawRECT = *(pControl->GetRECT()); // put the rect in the mDrawRect member variable
          for (j = 0; j < n; ++j)   // loop through all controls
          {
            IControl* pControl2 = mControls.Get(j); // assign control j to pControl2

            // if control1 == control2 OR control2 is not hidden AND control2's rect intersects mDrawRect
            if (!pControl2->IsHidden() && (i == j || pControl2->GetRECT()->Intersects(&mDrawRECT)))
            {
              //if ((i == j) && (!pControl2->IsHidden())|| (!(pControl2->IsHidden()) && pControl2->GetRECT()->Intersects(&mDrawRECT))) {
              //printf("control %i and %i \n", i, j);

              pControl2->Draw(this);
            }
          }
          pControl->SetClean();
        }
      }
    }
  }

#ifndef NDEBUG
  if (mShowControlBounds) 
  {
    for (int j = 1; j < mControls.GetSize(); j++)
    {
      IControl* pControl = mControls.Get(j);
      DrawRect(&CONTROL_BOUNDS_COLOR, pControl->GetRECT());
    }
    
    WDL_String str;
    str.SetFormatted(32, "x: %i, y: %i", mMouseX, mMouseY);
    IText txt(20, &CONTROL_BOUNDS_COLOR);
    IRECT rect(Width() - 150, Height() - 20, Width(), Height());
    DrawIText(&txt, str.Get(), &rect);
  }
#endif

  return DrawScreen(pR);
}
开发者ID:AdrianGin,项目名称:Pathogen,代码行数:93,代码来源:IGraphics.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WDTS_TransportDriverTrype类代码示例发布时间:2022-05-31
下一篇:
C++ WDL_PtrList类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap