BOOL CSetDialog::OnInitDialog() { CDialog::OnInitDialog(); int len; len = set_variables.GetSize(); ASSERT( len > 0 ); m_CurrentInstanceIdx = 0; // always start on the first entry so we don't want the user to try to go // past the "front" of the list m_PrevButton.EnableWindow(FALSE); // if we only have one entry, don't try to go beyond the end of the list if( len == 1 ) { m_NextButton.EnableWindow(FALSE); } UpdateVariableDisplay(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void GLIShaderDebug::InitPropertyControl(HWND initDialogWindow) { //Init the dialog window variable dialogWindow = initDialogWindow; //Retrieve the area of the shader values control HWND renderAreaWnd = GetDlgItem(dialogWindow, IDC_SHADERVALUES); if(renderAreaWnd == NULL) { return; } RECT clientArea; GetWindowRect(renderAreaWnd, &clientArea); POINT clientPoint = {clientArea.left, clientArea.top}; ScreenToClient(dialogWindow, &clientPoint); //Create the client area rect for the properties RECT newClientArea; newClientArea.left = clientPoint.x; newClientArea.top = clientPoint.y; newClientArea.right = clientPoint.x + (clientArea.right - clientArea.left); newClientArea.bottom = clientPoint.y + (clientArea.bottom - clientArea.top ); //Create CPropTree control propTree->Create(WS_CHILD|WS_VISIBLE|PTS_NOTIFY, newClientArea, dialogWindow, IDC_SHADERPROPERTY); propTree->ShowInfoText(FALSE); //Set the initial display of watches/uniforms UpdateVariableDisplay(); }
void CSetDialog::OnPrevButton() { int prev_idx; int len, max_idx; // if the current data is wrong, don't change if( ! ValidateData() ) { return; } len = set_variables.GetSize(); max_idx = len-1; ASSERT( m_CurrentInstanceIdx > 0 ); if( m_CurrentInstanceIdx <= 0 ) { // shouldn't happen (we should have disabled the prev button so we // can't go beyond the front of the list) return; } prev_idx = m_CurrentInstanceIdx - 1; // if we're going to be on the first entry, disable the prev button so we // can't try to go beyond the first of the list if( prev_idx == 0 ) { m_PrevButton.EnableWindow( FALSE ); } // if we were on the last entry, reenable the next button if( m_CurrentInstanceIdx == max_idx ) { m_NextButton.EnableWindow( TRUE ); } m_CurrentInstanceIdx = prev_idx; UpdateVariableDisplay(); }
bool GLIShaderDebug::DebugBegin(uint bufferSize, void *buffer) { uint i; //Check the debug state if(debugState != DBS_None) { scite->OutputAppendString("== Unable to switch to debug mode. Already debugging? ==\n"); return false; } //Check the input data if(bufferSize == 0 || buffer == NULL) { return false; } //Clear all existing uniforms/frame buffer data uniformValues.clear(); frameBufferArray.clear(); //Read the input data NetworkBufferReceive bufferData(bufferSize, buffer); //Get the debug shader UID/GL ID if(!bufferData.Get(debugUID) || !bufferData.Get(debugGLID)) { return false; } //Get the shader source if(!bufferData.Get(debugSource)) { return false; } //Get the number of uniforms uint numUniforms = 0; if(!bufferData.Get(numUniforms)) { return false; } //Loop and get each uniform for(i=0; i<numUniforms; i++) { UniformData newUniform; uint isFloat; //Get the main uniform data if(!bufferData.Get(newUniform.name) || !bufferData.Get(newUniform.type) || !bufferData.Get(newUniform.numTypeElements) || !bufferData.Get(isFloat)) { return false; } //Assign if it is a float or not if(isFloat > 0) { newUniform.isFloatType = true; if(!bufferData.Get(newUniform.floatUniformData)) { return false; } //Return now if there is an uneven number of variables if(newUniform.floatUniformData.size() % newUniform.numTypeElements != 0) { return false; } } else { newUniform.isFloatType = false; if(!bufferData.Get(newUniform.intUniformData)) { return false; } //Return now if there is an uneven number of variables if(newUniform.intUniformData.size() % newUniform.numTypeElements != 0) { return false; } } //Add the uniform data uniformValues.push_back(newUniform); } //Get the number of frame buffers uint numFrameBuffers = 0; if(!bufferData.Get(numFrameBuffers)) { return false; } //Loop and get each frame buffer for(i=0; i<numFrameBuffers; i++) { //Add a new item frameBufferArray.push_back(FrameBufferData()); //Get a reference to it (faster than copying all this buffer data twice) FrameBufferData &newFrameBuffer = frameBufferArray.back(); //Get the main frame buffer data if(!bufferData.Get(newFrameBuffer.bufferType) || !bufferData.Get(newFrameBuffer.drawBuffer) || !bufferData.Get(newFrameBuffer.bufferWidth) || !bufferData.Get(newFrameBuffer.bufferHeight) || !bufferData.Get(newFrameBuffer.numPixelValues) || !bufferData.Get(newFrameBuffer.preBuffer) || !bufferData.Get(newFrameBuffer.postBuffer)) { frameBufferArray.pop_back(); return false; } //Check the size of the data if(newFrameBuffer.preBuffer.size() != newFrameBuffer.postBuffer.size() || newFrameBuffer.preBuffer.size() != (newFrameBuffer.bufferWidth * newFrameBuffer.bufferHeight * newFrameBuffer.numPixelValues)) { scite->OutputAppendString("== Invalid frame buffer data ==\n"); frameBufferArray.pop_back(); return false; } } //Check for any remaining network data if(bufferData.GetBufferSizeLeft() > 0) { scite->OutputAppendString("== Extra debug start data found in network buffer ==\n"); } //Flag that debug mode has started debugState = DBS_Init; //Update the watch/uniform display UpdateVariableDisplay(); //Show the window ShowWindow(dialogWindow, SW_SHOW); //Ensure the source that is being debugged is open OpenDebugSource(); return true; }