Ejemplo n.º 1
0
void UpdateFindGui(HWND hwndPanel, SEARCH_PANE_STATE *sps)
{
	//CheckRadioButton(hwndPanel, IDC_SCOPE_CURSOR, IDC_SCOPE_SEL, g_fFindInSelection ? IDC_SCOPE_SEL : IDC_SCOPE_CURSOR);
	CheckDlgButton(hwndPanel, IDC_SCOPE_CURSOR, !g_fFindInSelection);
	CheckDlgButton(hwndPanel, IDC_SCOPE_SEL, g_fFindInSelection);
	CheckDlgButton(hwndPanel, IDC_SEARCHBACK, g_fSearchBackwards);
	CheckDlgButton(hwndPanel, IDC_MATCHCASE, g_fMatchCase);
	CheckDlgButton(hwndPanel, IDC_SEARCH_ENDIAN, g_fBigEndian);
	EnableDlgItem(hwndPanel, IDOK, searchValid);

	//CheckDlgButton(hwndPanel, IDC_KEEPVISIBLE, g_fKeepVisible);

	UpdatePin(hwndPanel, IDC_KEEPVISIBLE, g_fKeepVisible);
}
Ejemplo n.º 2
0
/***    GCMD::ACTION ComposeHTMLPostPicture(CLIENTINFO * pClientInfo)
 *
 *    Parameters:
 *          pClientInfo - the client info representing this connection and web page
 *
 *    Return Values:
 *          GCMD::ACTION    - GCMD::CONTINUE, just return with no outside action
 *                          - GCMD::READ, non-blocking read of input data into the rgbIn buffer appended to the end of rgbIn[] which has a predefined size of 256 bytes
 *                              when we return to this compose function cbRead will have the number of bytes read, and likely could be zero.
 *                          - GCMD::GETLINE, blocking read until a line of input is read or until the rgbIn buffer is full, always the line starts at the beginnig of the rgbIn
 *                              cbRead has the number of bytes read
 *                          - GCMD::WRITE, loop writing until all cbWrite bytes are written from the pbOut buffer
 *                              pbOut can point to any valid buffer that will remain unchanged until execution returns to this function. We could get a TIMOUT
 *                              if we can't write the data. cbWritten will have the number of bytes actually written. As part of each connection there is a
 *                              scratch buffer of 256 provide at rgbOut; it is optional to point pbOut to rgbOut. PbOut can point anywhere and that is what will be written
 *                              cbWrite must be set to the number of bytes to write.
 *                          - GCMD::DONE, we are done processing and the connection can be closed
 *
 *    Description:
 *
 *      This parsge the Post command and sets the picture to print
 *      and jumps to the SelPic page to redraw the picture.
 *
 * ------------------------------------------------------------ */
GCMD::ACTION ComposeHTMLPostPINS(CLIENTINFO * pClientInfo)
{
    GCMD::ACTION retCMD = GCMD::CONTINUE;

    // a word of caution... DO NOT cast htmlState to your enum type!
    // the compiler will silently remove the HTTPSTART case as
    // that state is not part of your enum. Keep the switch on typed
    // aginst the generic uint32_t.
    switch(pClientInfo->htmlState)
    {

        // Every Compose function will start at the magic HTTPSTART state
        // we MUST support this state.
        case HTTPSTART:

            // serialize so we only do this page once at a time
            // this protects the szPageBuffer
            if(pClientMutex != NULL)
            {
                break;
            }
            pClientMutex = pClientInfo;

            Serial.println("Post Pins Page Detected");
            pClientInfo->htmlState = CONTLEN;
            retCMD = GCMD::GETLINE;
            break;

        case CONTLEN:

            // if we hit the end of the header then there was no content length
            // and we don't know how to handle that, so exit with an error
            // File not found is probably the wrong error, but it does get out out
            // Fortunately all major browsers put in the content lenght, so this
            // will almost never fail.
            if(strlen((char *) pClientInfo->rgbIn) == 0)    // cbRead may be longer than just the line, so do a strlen()
            {
                pClientMutex = NULL;
                return(JumpToComposeHTMLPage(pClientInfo, ComposeHTTP404Error));
            }

            // found the content lengths
            else if(memcmp((byte *) szContentLength, pClientInfo->rgbIn, sizeof(szContentLength)-1) == 0)
            {

                cbContentLenght = atoi((char *) &pClientInfo->rgbIn[sizeof(szContentLength)-1]);
                pClientInfo->htmlState = ENDHDR;
            }
            retCMD = GCMD::GETLINE;
            break;

        case ENDHDR:

            // the header is ended with a double \r\n\r\n, so I will get
            // a zero length line. Just keep reading lines until we get to the blank line
            if(strlen((char *) pClientInfo->rgbIn) == 0)    // cbRead may be longer than just the line, so do a strlen()
            {
                uint32_t i = 0;

                // go to beyond the \0
                for(i = 0; i < pClientInfo->cbRead && pClientInfo->rgbIn[i] == '\0'; i++);

                // move the buffer to the front
                pClientInfo->cbRead -= i;
                if(pClientInfo->cbRead > 0)
                {
                    memcpy(pClientInfo->rgbIn, &pClientInfo->rgbIn[i], pClientInfo->cbRead);
                }

                pClientInfo->htmlState = DATA;
                cParsed = 0;
                iIn = 0;
            }
            else
            {
                retCMD = GCMD::GETLINE;
            }
            break;

        case DATA:

            if(cParsed < cModifiablePins)
            {
                char * pUnderscore = NULL;

                // because we are doing string searches, we need to make sure there is a null terminator on the string
                // remember, we have 4 extra overflow byes at the end of the read buffer we can write into, so even if
                // the rgbIn buffer is completely full, we can write one past the end with the zero terminator.
                pClientInfo->rgbIn[pClientInfo->cbRead] = '\0';

                // there are other things in the form post besides the pin values, specifically
                // there is the submit button entry, so we need to skip about anything that is not a pin state
                // search for an underscore, that is the start of the pin number
                if((pUnderscore = strstr((char *) &pClientInfo->rgbIn[iIn], "_")) != NULL)
                {
                    // move up to the underscore, the start of the pin number
                    iIn += ((byte *) pUnderscore - &pClientInfo->rgbIn[iIn]);
                }

                if((pClientInfo->cbRead - iIn) < sizeof(PINDATA))
                {
                    memcpy(pClientInfo->rgbIn, &pClientInfo->rgbIn[iIn], (pClientInfo->cbRead - iIn));
                    pClientInfo->cbRead -= iIn;
                    iIn = 0;
                    retCMD = GCMD::READ;
                }
                else
                {
                    uint32_t i = 0;
                    PINDATA * ppinData = (PINDATA *) &pClientInfo->rgbIn[iIn];

                    iIn += sizeof(PINDATA);
                    cParsed++;
                    for(i=0; i<sizeof(ppinData->szPin); i++)
                    {
                        if(ppinData->szPin[i] == '_')
                        {
                            ppinData->szPin[i] = ' ';
                        }
                        else
                        {
                            break;
                        }
                    }

                    if(i<sizeof(ppinData->szPin))
                    {
                        ppinData->equal = '\0';
                        i = atoi(&ppinData->szPin[i]);
                        UpdatePin(i, ppinData->state);
                    }
                }
            }
            else
            {
                pClientInfo->htmlState = GETPAGE;
            }
            break;

        case GETPAGE:
            Serial.println("Jumping to Pins Page");
            return(JumpToComposeHTMLPage(pClientInfo, ComposeHTMLGetPINS));
            break;

        case HTTPDISCONNECT:
            if(pClientMutex == pClientInfo)
            {
                Serial.print("Closing Client ID: 0x");
                Serial.println((uint32_t) pClientMutex, HEX);
                pClientMutex = NULL;
            }
            // fall thru Done

        // the done state is were we say we are done, and that
        // the connection can be closed
        case FINISH:
        default:

            // by returning DONE, we will close the connection
            // and be done with this page
            retCMD = GCMD::DONE;
            break;
    }

    // Return the command we want to do
    // like WRITE, or DONE
    return(retCMD);
}
void UK2Node_EaseFunction::PinTypeChanged(UEdGraphPin* Pin)
{
	const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>();
	bool bChanged = false;

	if (Pin->PinName == FEaseFunctionNodeHelper::GetAPinName() ||
		Pin->PinName == FEaseFunctionNodeHelper::GetBPinName() ||
		Pin->PinName == FEaseFunctionNodeHelper::GetResultPinName())
	{
		// Get pin refs
		UEdGraphPin* APin = FindPin(FEaseFunctionNodeHelper::GetAPinName());
		UEdGraphPin* BPin = FindPin(FEaseFunctionNodeHelper::GetBPinName());
		UEdGraphPin* ResultPin = FindPin(FEaseFunctionNodeHelper::GetResultPinName());

		// Propagate the type change or reset to wildcard PinType
		if (Pin->LinkedTo.Num() > 0)
		{
			UEdGraphPin* InstigatorPin = Pin->LinkedTo[0];

			bChanged |= UpdatePin(APin, InstigatorPin);
			bChanged |= UpdatePin(BPin, InstigatorPin);
			bChanged |= UpdatePin(ResultPin, InstigatorPin);

			if (bChanged)
			{
				// Just in case we switch to an invalid function clean it first
				EaseFunctionName = TEXT("");

				// Generate the right function name
				if (InstigatorPin->PinType.PinCategory == Schema->PC_Float)
				{
					EaseFunctionName = TEXT("Ease");
				}
				else if (InstigatorPin->PinType.PinCategory == Schema->PC_Struct)
				{
					if (InstigatorPin->PinType.PinSubCategoryObject.Get()->GetName() == TEXT("Vector"))
					{
						EaseFunctionName = TEXT("VEase");
					}
					else if (InstigatorPin->PinType.PinSubCategoryObject.Get()->GetName() == TEXT("Rotator"))
					{
						EaseFunctionName = TEXT("REase");
					}
					else if (InstigatorPin->PinType.PinSubCategoryObject.Get()->GetName() == TEXT("Transform"))
					{
						EaseFunctionName = TEXT("TEase");
					}
				}
			}
		}
		else
		{	
			if (APin->GetDefaultAsString().IsEmpty() && APin->LinkedTo.Num() == 0 &&
				BPin->GetDefaultAsString().IsEmpty() && BPin->LinkedTo.Num() == 0 &&
				ResultPin->LinkedTo.Num() == 0)
			{
				// Restore wild card pin
				APin->PinType.PinCategory = Schema->PC_Wildcard;
				APin->PinType.PinSubCategory = TEXT("");
				APin->PinType.PinSubCategoryObject = NULL;

				// Propagate change
				UpdatePin(BPin, APin);
				UpdatePin(ResultPin, APin);

				// Make sure the function name is nulled out
				EaseFunctionName = TEXT("");
				bChanged = true;			
			}
		}

		// Pin connections and data changed in some way
		if (bChanged)
		{
			SetPinToolTip(*APin, LOCTEXT("APinDescription", "Easing start value"));
			SetPinToolTip(*BPin, LOCTEXT("BPinDescription", "Easing end value"));
			SetPinToolTip(*ResultPin, LOCTEXT("ResultPinDescription", "Easing result value"));

			// Let our subclasses generate some pins if required, this way we can add any aditional pins required by some types for examples
			GenerateExtraPins();

			// Let the graph know to refresh
			GetGraph()->NotifyGraphChanged();

			UBlueprint* Blueprint = GetBlueprint();
			if (!Blueprint->bBeingCompiled)
			{
				FBlueprintEditorUtils::MarkBlueprintAsModified(Blueprint);
				Blueprint->BroadcastChanged();
			}
		}
	}

	Super::PinTypeChanged(Pin);
}
Ejemplo n.º 4
0
INT_PTR CALLBACK FindHexDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static BOOL g_nLastTextIdx = 0;
	static BOOL g_nLastNumIdx = 0;
	static BOOL g_nLastRepIdx = 0;

	//static SEARCH_PANE_STATE state[4];

	SEARCH_PANE_STATE *sps = (SEARCH_PANE_STATE *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
//	TCHAR szText[MAX_SEARCH_TEXT];
	int i;
	HWND hwndPin;

	HWND hwndHV = g_hwndHexView;

	switch(msg)
	{
	case WM_INITDIALOG:

		sps = (SEARCH_PANE_STATE *)lParam;
		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)sps);

		EnableDialogTheme(hwnd);

		UpdateFindGui(hwnd, sps);

		hwndPin = CreatePinToolbar(hwnd, IDC_KEEPVISIBLE, FALSE);//TRUE);

		AlignWindow(hwndPin, GetDlgItem(hwnd, IDC_GROUP), ALIGN_BOTTOM);
		AlignWindow(hwndPin, GetDlgItem(hwnd, IDCANCEL),  ALIGN_LEFT);


		// add the history!
		for(i = 0; i < sps->nHistoryCount1; i++)
		{
			int idx = (int)SendDlgItemMessage(hwnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)sps->history1[i].szText);
			SendDlgItemMessage(hwnd, IDC_COMBO1, CB_SETITEMDATA, idx, sps->history1[i].nDataTypeIdx);
		}

		return FALSE;

	case WM_COMMAND:

		switch(LOWORD(wParam))
		{
		case IDCANCEL:
			DestroyWindow(GetParent(hwnd));
			return TRUE;

		case IDC_KEEPVISIBLE:

			g_fKeepVisible = IsToolbarButtonChecked(GetDlgItem(hwnd, IDC_KEEPVISIBLE), IDC_KEEPVISIBLE);
			UpdatePin(hwnd, IDC_KEEPVISIBLE, g_fKeepVisible);
			return TRUE;

		case IDC_REPLACE:
			Replace(hwnd, hwndHV);
			return TRUE;

		case IDC_REPLACEALL:
			return TRUE;

		case IDOK:
			Find(hwnd, hwndHV);
			return TRUE;
		}

		// one of the buttons/checks/radios was clicked. update all state
		if(HIWORD(wParam) == BN_CLICKED)
		{
			g_fFindInSelection	= IsDlgButtonChecked(hwnd, IDC_SCOPE_SEL);
			g_fSearchBackwards	= IsDlgButtonChecked(hwnd, IDC_SEARCHBACK);
			g_fBigEndian		= IsDlgButtonChecked(hwnd, IDC_SEARCH_ENDIAN);
			g_fMatchCase		= IsDlgButtonChecked(hwnd, IDC_MATCHCASE);
			searchLen = sizeof(searchData);
			//Update(hwnd, sps, searchData, &searchLen);
			searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);
			return TRUE;
		}

		if(HIWORD(wParam) == CBN_EDITUPDATE || HIWORD(wParam) == CBN_SELCHANGE)
		{
			if(LOWORD(wParam) == IDC_COMBO1)
			{
				searchLen = sizeof(searchData);
				searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);

				EnableDlgItem(hwnd, IDOK, searchValid);
			}

			if(LOWORD(wParam) == IDC_COMBO2)
			{
				replaceLen   = sizeof(replaceData);
				replaceValid = UpdateSearchDataDlg(hwnd, IDC_COMBO2, g_fBigEndian, replaceData, &replaceLen);

				EnableDlgItem(hwnd, IDC_REPLACE,    replaceValid);
				EnableDlgItem(hwnd, IDC_REPLACEALL, replaceValid);
			}

			if(LOWORD(wParam) == IDC_COMBO_DATATYPE)
			{
				searchLen = sizeof(searchData);
				searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);

				EnableDlgItem(hwnd, IDOK, searchValid);
			}

			/*if(LOWORD(wParam) == IDC_COMBO1 && HIWORD(wParam) == CBN_SELCHANGE)
			{
				int idx = SendDlgItemMessage(hwnd, IDC_COMBO1, CB_GETCURSEL, 0, 0);
				idx = SendDlgItemMessage(hwnd, IDC_COMBO1, CB_GETITEMDATA, idx, 0);
				SendDlgItemMessage(hwnd, IDC_COMBO_DATATYPE, CB_SETCURSEL, sps->history1[idx].nDataTypeIdx, 0);
			}*/
			
			return TRUE;
		}

		return FALSE;

	case WM_CLOSE:
		DestroyWindow(GetParent(hwnd));
		return TRUE;
	}
	return FALSE;
}