Example #1
0
LRESULT CALLBACK WndProcSubClass(
	HWND hWnd,
	UINT Msg,
	WPARAM wParam,
	LPARAM lParam )
{
	INITLSTR();
	HWND parentWnd=(HWND)GetWindowLong((HWND)GetWindowLong(hWnd,GWL_HWNDPARENT),GWL_HWNDPARENT);
	wchar_t buff[2048];
	switch (Msg)
	{
	case WM_KEYDOWN:
		if (wParam==VK_RETURN)
		{
			SendMessage(mLogWnd[parentWnd].hFindText,WM_GETTEXT,2048,(LPARAM)buff);
			mLogWnd[parentWnd].Find(buff);
		}
	case WM_SETFOCUS:
		SendMessage(mLogWnd[parentWnd].hFindText,WM_GETTEXT,2048,(LPARAM)buff);
		if (!wcscmp(buff,lStr(UFIND)))
		{	SendMessage(mLogWnd[parentWnd].hFindText,WM_SETTEXT,0,(LPARAM)L"");	}
		break;
	case WM_KILLFOCUS:
		SendMessage(mLogWnd[parentWnd].hFindText,WM_GETTEXT,2048,(LPARAM)buff);
		if (!wcscmp(buff,L""))
		{	SendMessage(mLogWnd[parentWnd].hFindText,WM_SETTEXT,0,(LPARAM)lStr(UFIND));	}
		break;
	break;
	}
	return(CallWindowProc((WNDPROC)mLogWnd[parentWnd].wndProc,mLogWnd[parentWnd].hFindText,Msg,wParam,lParam));
	
}
Example #2
0
LRESULT CALLBACK DlgAboutProc(
	HWND hWnd,
	UINT Msg,
	WPARAM wParam,
	LPARAM lParam )
{
	INITLSTR();
	switch (Msg)
	{
	case WM_DESTROY:
		EndDialog(hWnd,0);
		break;
	case WM_INITDIALOG:		
		SetDlgItemText(hWnd,IDC_EDIT2,lStr(UABOUT));
		break;
	case WM_COMMAND:
		if (wParam == IDOK)//wParam ==0x0000F012)
		{EndDialog(hWnd,0);}
		break;
	case WM_SYSCOMMAND:
		if (wParam ==SC_CLOSE)
		{
			EndDialog(hWnd,0);
		}
		break;
	default:
		return (0);
	}
	return (0);
}
Example #3
0
std::vector<std::string> getAllFolders(const sf::String &pFolder)
{
	DIR *lDir;
	struct dirent *ent;

	std::vector<std::string> mReturn;

	// *********** IMAGE LOADING ****/////////////////////////
	lDir = opendir (pFolder.ToAnsiString().c_str());

	if (lDir != NULL) 
	{

	  /* print all the files and directories within directory */
	  while ((ent = readdir (lDir)) != NULL) 
	  {
		  if(ent->d_type == DT_DIR)
		  {
			  sf::String lStr(ent->d_name);
			  if(lStr == "." || lStr == "..")
				  continue;

			  mReturn.push_back(lStr.ToAnsiString());
		  }
	  }
	  closedir (lDir);
	}

	  return mReturn;
}
Example #4
0
LOCAL_C void TestAssignmentOperatorL()
{
	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4007"));	

	test.Next(_L("Assignment operator"));

	TBUF tdes(_TS("Modifiable descriptor"));
	TBUFC tdesc(_TS("Non-modifiable descriptor"));

	LSTRING lStr(32);
	LSTRING lStr2(32);
	lStr2.CopyL(_TS("Buffer descriptor"), 17);

	lStr = tdesc;	test(lStr == tdesc);
	lStr = tdes;	test(lStr == tdes);
	lStr = lStr2;	test(lStr == lStr2);
	
	LSTRING lStr3(tdes);
	lStr = lStr3.PtrZL(); test(lStr == tdes);
	
	test.Next(_L("operator=(char/wchar_t* aCharStr) method"));
	LSTRING lStr4(_CS("123456"));
	LSTRING lStr5 = _CS("123456");
	test(lStr4 == lStr5);
	
	LSTRING lStr6;
	lStr6 =  _CS("123456");
	test(lStr4 == lStr6);
	}
void ImageSaveDlg::Load( PvConfigurationReader &aReader )
{
    PvString lSaveEnabled;
    PvString lSaveEnabledTag("saveenabled");
    aReader.Restore(lSaveEnabledTag, lSaveEnabled);
    if (strcmp(lSaveEnabled.GetAscii(),"1") == 0 )
    {
        mSaveEnabled = true;
    }
    else
    {
        mSaveEnabled = false;
    }

    PvString lOneOutOf;
    aReader.Restore( "oneoutof", lOneOutOf );
    mOneOutOf = atoi( lOneOutOf.GetAscii() );

    PvString lMaxRate;
    aReader.Restore( "maxrate", lMaxRate );
    mMaxRate = atoi( lMaxRate.GetAscii() );

    PvString lAverageThroughput;
    aReader.Restore( "averagethroughput", lAverageThroughput );
    mAverageThroughput = atoi(lAverageThroughput.GetAscii());

    PvString lSaveThrottleOption;
    aReader.Restore( "savethrottleoption", lSaveThrottleOption );
    mSaveThrottling = (SaveThrottleOption)atoi( lSaveThrottleOption.GetAscii() );

    PvString lSavePath;
    aReader.Restore( "savepath", lSavePath );
    mSavePath = lSavePath.GetAscii();

    PvString lFormat;
    aReader.Restore( "saveformat", lFormat );
    QString lStr( lFormat.GetAscii() );
    QString lLower = lStr.toLower();
    if ( lLower == "bmp" )
    {
        mFormat = FORMAT_BMP;
    }
    else if ( lLower == "raw" )
    {
        mFormat = FORMAT_RAW;
    }
    else
    {
        // Default. Can be expected as the user can end up manually
        // editing the persistence file.
        mFormat = FORMAT_BMP;
    }
}
Example #6
0
LOCAL_C void TestCapacityChangesL(LSTRING*)
{
	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4008"));
	
	test.Next(_L("Test capacity growth and compression on LString"));

	LSTRING lStr(_TS("0123456"));
	test(lStr.Length()==7);
	test(lStr.MaxLength() >=7);

 	lStr.SetMaxLengthL(10);
	test(lStr.Length()==7);
	test(lStr.MaxLength() >=10);

 	lStr.SetMaxLengthL(6);
	test(lStr.Length()==6);
	test(lStr.MaxLength() >=6);
 	
 	lStr.SetMaxLengthL(10);
	test(lStr.Length()==6);
	test(lStr.MaxLength() >=10);
	
	//Call the same thing again to check the condition
	//that required length is already set
 	lStr.SetMaxLengthL(10);
	test(lStr.Length()==6);
	test(lStr.MaxLength() >=10);

 	lStr.Compress();
 	test(lStr.Length()==6);
	test(lStr.MaxLength() >= 6);
	
	//Call the same thing again to check the condition
	//that the string is already compressed
 	lStr.Compress();
 	test(lStr.Length()==6);
	test(lStr.MaxLength() >= 6);
	
	lStr.ReserveFreeCapacityL(15);
 	test(lStr.Length()==6);
	test(lStr.MaxLength() >= 32);
	
	lStr.Reset();
 	test(lStr.Length()==0);
	test(lStr.MaxLength() == 0);

}
Example #7
0
void EjectOSD::ProcessHotkeys(HotkeyInfo &hki) {
    switch (hki.action) {
    case HotkeyInfo::EjectDrive:
        if (hki.args.size() > 0) {
            EjectDrive(hki.args[0]);
        }
        break;

    case HotkeyInfo::EjectLatestDrive:
        if (_latestDrive != 0) {
            wchar_t letter = MaskToDriveLetter(_latestDrive);
            std::wstring lStr(1, letter);
            EjectDrive(lStr);
            _latestDrive = 0;
        }

        break;
    }
}
Example #8
0
LOCAL_C void TestReAllocLeaving(LSTRING*)
{

	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4005"));
	
	test.Next(_L("ReAllocL(TInt aMaxLength) method"));
	TBUF des(_TS("01"));

	LSTRING lStr(des);
	TRAPD(ret, lStr.ReAllocL(6));	//ReAlloc buffer
	test(KErrNone == ret);

#if defined(_DEBUG)
	__UHEAP_FAILNEXT(1);
	TRAP(ret, lStr.ReAllocL(100));	//Realloc buffer. This should fail.
	test(KErrNoMemory == ret);
#endif //(_DEBUG)

	test(lStr.MaxLength() >=6);		//Check LString is the same as before ... 
	test(lStr.Length()==2);			//... ReAlloc that failed.
	test(lStr[0] == (TTEXT)('0'));
	test(lStr[1] == (TTEXT)('1'));
}
Example #9
0
LRESULT CALLBACK WndProc(
	HWND hWnd,
	UINT Msg,
	WPARAM wParam,
	LPARAM lParam )
{
	LPNMHDR hdr;
	TVITEM tvit;
	INITLSTR();
	TBBUTTON tbButton={LOWORD(lParam)-160, 0,  TBSTATE_ENABLED, BTNS_SEP, 0L, 0};
	switch(Msg)
	{
		case WM_DESTROY:
			App.TreeViewDelFile(0);
			PostQuitMessage(0);
			break;
		case WM_SIZE:
			MoveWindow(App.hTreeView,0,44,LOWORD(lParam),HIWORD(lParam)-44,TRUE);
			SendMessage(App.hToolBar,TB_AUTOSIZE,0,0);
			SendMessage(App.hToolBar,TB_DELETEBUTTON,0,0);
			SendMessage(App.hToolBar,TB_INSERTBUTTON,0,(LPARAM)&tbButton);
			SendMessage(App.hToolBar,TB_AUTOSIZE,0,0);
			break;
		case WM_COMMAND:
			if ((HWND)lParam==App.hToolBar)
			{
				switch (wParam)
				{
				case 123: //destroy button
					switch (DialogBoxW(App.hIns,MAKEINTRESOURCE(IDD_RESETDEL),hWnd,(DLGPROC)DlgResetProc))
					{
					case IDRESET:
					App.TreeViewDelFile(0);
						break;
					case IDRESETDEL:
						tvit.hItem = TreeView_GetSelection(App.hTreeView);
						if (tvit.hItem!=0)
						{
							App.TreeViewDelFile(tvit.hItem);
						}
						else
						{
							MessageBox(hWnd,lStr(UNSELECT),lStr2(UERROR),MB_OK);
						}
						break;
					}
					
					break;
				case 124: //activate monitoring button
					if (!App.readyMon)
					{
						ShowWindow(App.hWnd,SW_MINIMIZE);
						ShowWindow(App.hWnd,SW_HIDE);
						App.readyMon=false;
						_beginthreadex(NULL,0,ThreadPrepareMon,(void *)123,0,NULL);
					}
					break;
				case 125:
					if (SendMessage(App.hToolBar,TB_ISBUTTONCHECKED,125,0))
					{	SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);	}
					else
					{	SetWindowPos(hWnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);	}
					break;
				case 126:
					DialogBoxW(App.hIns,MAKEINTRESOURCE(IDD_DIALOGABOUT),hWnd,(DLGPROC)DlgAboutProc);
					break;
				}
			}
			break;
		case WM_NOTIFY:
			hdr = (LPNMHDR) lParam;
			if (hdr->code==NM_DBLCLK)
			{
				tvit.mask = TVIF_PARAM;
				tvit.hItem = TreeView_GetSelection(App.hTreeView);
				TreeView_GetItem(App.hTreeView,&tvit);
				switch (tvit.lParam)
				{
					case 10://Project
					_beginthreadex(NULL,0,ThreadScanFolder,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
					case 20://Category of log message
						_beginthreadex(NULL,0,ThreadScanFile,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
					case 30:
						_beginthreadex(NULL,0,LogWindow,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
				}
			}
			if (hdr->code==NM_CLICK)
			{
				App.alert=false;
			}
			
			if (hdr->code==TTN_GETDISPINFO) 
			{ 
				LPTOOLTIPTEXT lpttt; 
				lpttt = (LPTOOLTIPTEXT) lParam; 
				lpttt->hinst = App.hIns; 
				// Specify the resource identifier of the descriptive 
				// text for the given button. 
				UINT idButton = lpttt->hdr.idFrom; 
				switch (idButton) 
				{ 
				    case 123: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UDESTOY); 
				        break; 
				    case 124: 
						lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UMON); 
				        break; 
				    case 125: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UTOP); 
				        break;
					case 126: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UABOUTBUTTON); 
				        break;
				} 
			} 
			break;
		case WM_TRAYMSG:
			switch ((UINT)lParam)
			{
			case WM_LBUTTONUP:
				if (App.readyMon)
				{
					App.readyMon=false;
					ShowWindow(App.hWnd,SW_SHOW);
					ShowWindow(App.hWnd,SW_RESTORE);
					SetForegroundWindow(App.hTreeView);
					App.DeleteTrayIcon();
				}
				
				break;
			}
			break;

		default:
			return DefWindowProc(hWnd,Msg,wParam,lParam);
	}
	return (0);
}
Example #10
0
LOCAL_C void TestCharacterStringSupport_Modifiers(LSTRING*)
	{
	test.Next (_L ("@SYMTestCaseID:BASESRVCS-EUSERHL-UT-4068"));
	
	// 1. test Constructor 
	// Constructs LString object from the supplied null terminated 
	// character string
	test.Next(_L("LString_(char/wchar_t * aCharStr) constructor"));
	LSTRING lStr(_CS("0123456789"));
	test(lStr.Length() == 10);		
	test(lStr.MaxLength() >= 10);
	test(lStr.Compare(_CS("0123456789")) == 0 );
	// try strings ending with 0
	LSTRING lStr1(_CS("01234567890"));
	test(lStr1.Length() == 11);		
	test(lStr1.MaxLength() >= 11);
	test(lStr1.Compare(_CS("01234567890")) == 0 );
	
	// 2. test '=' operator
	LSTRING lTestStr;
	// Assign new string to the constructed LString object
	test.Next(_L("LString_ operator '=' "));
	lTestStr = _CS("Try a New String");
	test(lTestStr.Compare(_CS("Try a New String")) == 0 );
	test(lTestStr.Length() == 16);		
	test(lTestStr.MaxLength() >= 16);
	
	// 3. test '+=' operator
	// Appends data onto the end of this LString object's data.
	// The length of this descriptor is incremented to reflect the new content.
	test.Next(_L("LString_ operator '+=' "));
	lTestStr += _CS("!!!");
	test(lTestStr.Compare(_CS("Try a New String!!!")) == 0 );
	test(lTestStr.Length() == 19);		
	test(lTestStr.MaxLength() >= 19);
		
	// 4.Test "Copy()" Variants
	LSTRING lTestStr1;
	LSTRING lTestStr2;
	// Copy new data into the LString object, replacing any existing
	// data, and expanding its heap buffer to accommodate if necessary.
	test.Next(_L("LString_ CopyL "));
	lTestStr1.CopyL(_TS("Try a New String"));
	test(lTestStr1.Compare(_TS("Try a New String")) == 0 );
	test(lTestStr1.Length() == 16);		
	test(lTestStr1.MaxLength() >= 16);
	
	// Copy folded(normalized) content
	test.Next(_L("LString_ CopyFL "));
	lTestStr1.CopyFL(_CS("Some RaNDom STRING"));
	lTestStr2.CopyFL(_CS("SOME RaNDom string"));
	test(lTestStr1.Compare(lTestStr2) == 0);
	
	// Copy contents in Lower case
	test.Next(_L("LString_ CopyLCL "));
	lTestStr1.CopyLCL(_CS("SOME STRING IN UPPER CASE"));
	test(lTestStr1 == _CS("some string in upper case"));

	// Copy contents in Upper case
	test.Next(_L("LString_ CopyUCL "));
	lTestStr1.CopyUCL(_CS("some string in lower case"));
	test(lTestStr1 == _CS("SOME STRING IN LOWER CASE"));
		
	// Copy Capitalized contents
	test.Next(_L("LString_ CopyCPL "));
	lTestStr1.CopyCPL(_CS("some string in lower case"));
	test(lTestStr1 == _CS("Some string in lower case"));
			
	// 5. Test Insert()
	LSTRING lTestStr3;
	// Insert contents into a string
	test.Next(_L("LString_ InsertL "));
	lTestStr3 = _CS("Some Content Can Be Into This String");
	lTestStr3.InsertL(20,_CS("Inserted "));
	test(lTestStr3 == _CS("Some Content Can Be Inserted Into This String"));
	
	// 6. Test Replace()
	LSTRING lTestStr4;
	// Replace contents form the string
	test.Next(_L("LString_ ReplaceL "));
	lTestStr4 = _CS("Some Content Can Be Decalper");
	lTestStr4.ReplaceL(20,8,_CS("Replaced"));
	test(lTestStr4 == _CS("Some Content Can Be Replaced"));
	
	// 7. Test Append()
	LSTRING lTestStr5;
	//Append data of specified length, to the end of the LString object.	
	test.Next(_L("LString_ AppendL(src,length)"));
	lTestStr5.CopyL( _CS("Try appending "));
	lTestStr5.AppendL(_CS("Try appending some more"),3);
	test(lTestStr5 == _CS("Try appending Try"));
		
	//Append data , to the end of the LString object.	
	test.Next(_L("LString_ AppendL(src)"));
	lTestStr5.CopyL( _CS("Try appending "));
	lTestStr5.AppendL(_CS("Try appending some more"));
	test(lTestStr5 == _CS("Try appending Try appending some more"));
		
	// 8. Test Justify()
	LSTRING lTestStr6;
	//Copy data into this descriptor and justifies it, replacing any existing data	
	test.Next(_L("LString_ JustifyL "));
	lTestStr6.CopyL(_CS("Justified"));
	lTestStr6.JustifyL(_CS("Just"),9,ERight,*(_TS("x")));
	test(lTestStr6 == _CS("xxxxxJust"));
	
	// 9. Test AppendJustify variants
	LSTRING lTestStr7;
	// Append data to the end of the LString object and justify it.
	test.Next(_L("LString_ AppendJustifyL(const char*,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill)"));
	lTestStr7.CopyL(_CS("One "));
	lTestStr7.AppendJustifyL(_CS("Two "),KDefaultJustifyWidth,ERight,*(_TS("x")));
	test(lTestStr7 == _TS("One Two "));
	
	lTestStr7.CopyL(_CS("One "));
	lTestStr7.AppendJustifyL(_CS("Two Three"),3,7,ERight,*(_TS("x")));
	test(lTestStr7 == _CS("One xxxxTwo") );
	
	// Append data to the end of the LString object and justify it.
	test.Next(_L("LString_ AppendJustifyL(const char* aCharStr,TInt aWidth,TAlign anAlignment,TChar aFill)"));
	lTestStr7.CopyL(_CS("One "));
	lTestStr7.AppendJustifyL(_CS("Two Three"),KDefaultJustifyWidth,ERight,*(_TS("x")));
	test(lTestStr7 == _TS("One Two Three"));
	
	lTestStr7.CopyL(_CS("One "));
	lTestStr7.AppendJustifyL(_CS("Two Three"),13,ERight,*(_TS("x")));
	test(lTestStr7 == _CS("One xxxxTwo Three") );
	}
Example #11
0
LOCAL_C void TestReAllocL(LSTRING*)
{
	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4004"));

	test.Next(_L("ReAlloc(TInt aMaxLength) method"));

	TBUF des (_TS("0123456"));
	
	//reallocate EPtr type - decrease memory
	LSTRING lStr(des);
	lStr.SetLengthL(3);
	test(lStr.ReAlloc(3)==KErrNone);					//ReAlloc to EPtr
	test(lStr.MaxLength()>=3);
	test(lStr.Length()==3);
	test(lStr[0] == (TTEXT)('0'));
	test(lStr[2] == (TTEXT)('2'));

	//reallocate EBufCPtr type - decrease memory
	HBUF* hBuf = HBUF::NewMax(9);
	*hBuf = _TS("012345678");
	lStr.Assign(hBuf);						//Create as EBufCPtr
	lStr.SetLengthL(5);
	test(lStr.ReAlloc(5)==KErrNone);		//ReAlloc to EBufCPtr
	test(lStr.MaxLength()>=5);//There could be more allocated memory - see HBufC8::Des()
	test(lStr.Length()==5);
	test(lStr[0] == (TTEXT)('0'));
	test(lStr[4] == (TTEXT)('4'));

	//reallocate EBufCPtr type - increase memory
	hBuf = HBUF::NewMax(9);
	*hBuf = _TS("012345678");
	lStr.Assign(hBuf);						//Create as EBufCPtr
	test(lStr.ReAlloc(15)==KErrNone);		//ReAlloc to EBufCPtr
	test(lStr.MaxLength()>=15);//There could be more allocated memory - see HBufC8::Des()
	test(lStr.Length()==9);
	test(lStr[0] == (TTEXT)('0'));
	test(lStr[8] == (TTEXT)('8'));

	//reallocate EPtr type - to zero-length
	lStr = des;
	lStr.SetLengthL(0);
	test(lStr.ReAlloc(0)==KErrNone);		//ReAlloc to EPtr
	test(lStr.MaxLength()==0);
	test(lStr.Length()==0);

	//reallocate EBufCPtr type to zero-length
	hBuf = HBUF::NewMax(9);
	*hBuf = _TS("012345678");
	lStr.Assign(hBuf);						//Create as EBufCPtr
	lStr.SetLengthL(0);
	test(lStr.ReAlloc(0)==KErrNone);		//ReAlloc to EPtr
	test(lStr.MaxLength()==0);
	test(lStr.Length()==0);

	//reallocate from zero-length
	lStr.Reset();						
	test(lStr.ReAlloc(9)==KErrNone);		//ReAlloc to EPtr
	test(lStr.MaxLength() >=9);
	test(lStr.Length()==0);

	//reallocate from zero-length to zero-length
	lStr.Reset();							
	test(lStr.ReAlloc(0)==KErrNone);		//ReAlloc to EPtr
	test(lStr.Length() == 0);		
	test(lStr.MaxLength() == 0);		
}