Example #1
0
wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
{
    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)

    wxCHECK( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE),
             wxNullProperty);

    wxPropertyGridPageState* state = p->GetParentState();
    wxPropertyGrid* grid = state->GetGrid();

    if ( grid->GetState() == state )
    {
        grid->DoSelectProperty(NULL,
            wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
    }

    state->DoDelete( p, false );

    // Mark the property as 'unattached'
    p->m_parentState = NULL;
    p->m_parent = NULL;

    RefreshGrid(state);

    return p;
}
Example #2
0
wxPGProperty* wxPropertyGridInterface::Insert( wxPGPropArg id, int index, wxPGProperty* newproperty )
{
    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
    wxPGProperty* retp = m_pState->DoInsert((wxPGProperty*)p,index,newproperty);
    RefreshGrid();
    return retp;
}
Example #3
0
/* Callback to execute the pathfinder */
void GridView::DoPathfind(Fl_Widget *pButton)
{
    // Refresh the grid first
    RefreshGrid();
    
    AStar pathfinder(*grid);
    
    Path path;

    // Depending on which button was pressed to trigger this, call either with
    // or without using heuristic
    if (!std::strcmp(pButton->label(), "Pathfind!"))
        path = pathfinder.buildFromWaypoints(waypoints);
    else
        path = pathfinder.buildWithHeuristic(waypoints);

    for (int y = 0; y < grid->getHeight(); ++y)
        for (int x = 0; x < grid->getWidth(); ++x) {
            // If this point is on the path, set the button's color to green
            if (std::find(path.begin(), path.end(), Point(x, y)) != path.end()) {
                squares[Point(x, y)]->color(FL_GREEN);
            }
        }
        
    // Set result label
    if (path.size() == 0) {
        result_output->value("Couldn't find path");
        result_output->color(FL_RED);
    } else {
        result_output->value("Success!");
        result_output->color(FL_GREEN);
    }
}
bool GLIDebugVariableGrid::ToggleRowExpansion(int currRow)
{
  //Test if the passed row is within range
  if(currRow >= 0 && currRow < rowTypeDataArray.size())
  {
    //If the value is a uniform that has more that one value
    if(rowTypeDataArray[currRow].type == RT_Uniform)
    {
      //Get the uniform index
      uint uniformIndex = rowTypeDataArray[currRow].indexValue;
      if(uniformIndex < uniformDataArray.size() &&
         uniformDataArray[uniformIndex].arrayCount > 1)
      {
        //Toggle the array show value if necessary
        uniformDataArray[uniformIndex].isExpanded = !uniformDataArray[uniformIndex].isExpanded;

        //Refresh the grid
        RefreshGrid();

        //Reset the selected row
        SetCurrentCell(currRow, NAME_COLUMN_INDEX);
        return true;
      }
    }
  }

  return false;
}
Example #5
0
wxPGProperty* wxPropertyGridInterface::Insert( wxPGPropArg id, wxPGProperty* property )
{
    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
    wxPGProperty* retp = m_pState->DoInsert(p->GetParent(), p->GetIndexInParent(), property);
    RefreshGrid();
    return retp;
}
bool GLIDebugVariableGrid::OnDnDText(const wxString &newWatchName)
{
  //If currently editing, return now
  if(IsCellEditControlEnabled())
  {
    return false;
  }

  //If showing watch values or there is already too many watch variables
  if(!(gridFlags & DF_ShowWatchValues) || 
     watchValuesArray.size() >= MAX_NUM_WATCH_VALUES)
  {
    return false;
  }

  //Add the value
  UniformData newWatchData;
  newWatchData.name = newWatchName;
  newWatchData.type = GL_FLOAT;
  newWatchData.isFloatType = true;

  watchValuesArray.push_back(newWatchData);

  //Refresh the display
  int currRow    = GetGridCursorRow();
  int currColumn = GetGridCursorCol();

  //Update the grid
  RefreshGrid();
  
  //Reset the selected cell
  SetCurrentCell(currRow, currColumn);

  return true;
}
Example #7
0
void wxPropertyGridInterface::DeleteProperty( wxPGPropArg id )
{
    wxPG_PROP_ARG_CALL_PROLOG()

    wxPropertyGridPageState* state = p->GetParentState();

    state->DoDelete( p, true );

    RefreshGrid(state);
}
Example #8
0
void wxPropertyGridInterface::DeleteProperty( wxPGPropArg id )
{
    wxPG_PROP_ARG_CALL_PROLOG()

    wxPropertyGridPageState* state = p->GetParentState();
    wxPropertyGrid* grid = state->GetGrid();

    if ( grid->GetState() == state )
        grid->DoSelectProperty(NULL, wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);

    state->DoDelete( p, true );

    RefreshGrid(state);
}
Example #9
0
wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
{
    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)

    wxCHECK( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE),
             wxNullProperty);

    wxPropertyGridPageState* state = p->GetParentState();

    state->DoDelete( p, false );

    RefreshGrid(state);

    return p;
}
Example #10
0
bool wxPropertyGridInterface::ExpandAll( bool doExpand )
{
    wxPropertyGridPageState* state = m_pState;

    if ( !state->DoGetRoot()->GetChildCount() )
        return true;

    wxPropertyGrid* pg = state->GetGrid();

    if ( GetSelection() && GetSelection() != state->DoGetRoot() &&
         !doExpand )
    {
        pg->ClearSelection(false);
    }

    wxPGVIterator it;

    for ( it = GetVIterator( wxPG_ITERATE_ALL ); !it.AtEnd(); it.Next() )
    {
        wxPGProperty* p = (wxPGProperty*) it.GetProperty();
        if ( p->GetChildCount() )
        {
            if ( doExpand )
            {
                if ( !p->IsExpanded() )
                {
                    state->DoExpand(p);
                }
            }
            else
            {
                if ( p->IsExpanded() )
                {
                    state->DoCollapse(p);
                }
            }
        }
    }

    pg->RecalculateVirtualSize();

    RefreshGrid();

    return true;
}
Example #11
0
udfFinalMarks::udfFinalMarks( wxWindow* parent, unsigned int tourId )
: FinalMarks( parent )
, m_pCon(NULL)
, m_tourId(tourId)
, m_catId(0)
{
	m_pCon = CDbManager::Instance()->GetConnection();

	unsigned int catId = 0;
	
	int scale = udfSettingsBase::Instance()->GetFinalMarksScale();
	m_spinScale->SetValue(scale);
	m_fntSize = m_gridMarks->GetDefaultCellFont().GetPointSize();
	
	if(UDF_OK == GetTourCategoryId(tourId, catId))
		m_catId = catId;

	RefreshGrid();
}
Example #12
0
/* Randomly populate the grid again depending on the input box */
void GridView::Repopulate(Fl_Widget *pButton)
{
    grid->clear();
    
    // Get the repopulation amount from the text input
    std::stringstream strValue;
    int value;
    
    strValue << repopulation_input->value();
    strValue >> value;
    
    grid->populate(value);
    
    // Set all of the waypoints to empty squares so they don't accidentally get set
    for (std::vector<Point>::const_iterator it = waypoints.begin(); it != waypoints.end(); ++it) {
        grid->setSquare(*it, EMPTY);
    }
    
    // Refresh everything
    RefreshGrid();
}
Example #13
0
/* Deleted the waypoint selected from `waypoints_selection` and `waypoints` */
void GridView::DeleteWaypoint(Fl_Widget *pButton)
{
    int index = waypoints_selection->value();

    // Don't remove start and end waypoints
    if (index == 0 || index == waypoints.size() - 1) {
        result_output->value("Can't delete start/end");
        result_output->color(FL_RED);

        return;
    }

    // Decrement all higher numbers in the drop down box
    for (int i = index; i < waypoints.size() - 1; ++i) {
        // Convert label to int
        const char* label = waypoints_selection->text(i);
        std::stringstream oldStrVal;
        oldStrVal << label;

        unsigned int intVal;
        oldStrVal >> intVal;

	// Decrement the index
        intVal--;

	// Convert int to const char*
        std::stringstream newStrVal;
        newStrVal << intVal;
        std::string newStr = newStrVal.str();

        waypoints_selection->replace(i, newStr.c_str());
    }

    // Remove the waypoint from the drop down box and the vector
    waypoints_selection->remove(index);
    waypoints.erase(waypoints.begin() + index);

    RefreshGrid();
}
Example #14
0
/* Add a new waypoint at (0, 0) to `waypoints` and `waypoints_selection` */
void GridView::AddWaypoint(Fl_Widget *pButton)
{
    // Get next available index in the waypoints
    int index = waypoints.size() - 1;

    // Use index as the string label
    std::stringstream strs;
    strs << index;
    std::string str = strs.str();
    const char* label = str.c_str();

    // Insert it into the drop down box behind the end point
    waypoints_selection->replace(index, label);
    waypoints_selection->add("end");

    // Set drop down box to new index
    waypoints_selection->value(index);

    // Add new waypoint at (0, 0) to the list
    waypoints.insert(waypoints.begin() + index, Point(0, 0));

    RefreshGrid();
}
void GLIDebugVariableGrid::OnKeyDown(wxKeyEvent &keyEvent)
{
  //If in edit mode, allow all keys through
  if(IsCellEditControlEnabled())
  {
    keyEvent.Skip();
    return;
  }

  //Don't allow the enter key to switch between rows
  if(keyEvent.m_keyCode == WXK_RETURN)
  {
    //Toggle the expandable rows if necessary
    if(ToggleRowExpansion(GetGridCursorRow()))
    {
      return;
    }

    //If the cell is able to be edited, start editing
    if(!IsCurrentCellReadOnly())
    {
      EnableCellEditControl();
    }

    return;
  }

  //Delete watch values on the delete key
  if(keyEvent.m_keyCode == WXK_DELETE)
  {
    int currRow    = GetGridCursorRow();
    int currColumn = GetGridCursorCol();

    //Check that the current row is in range
    if(currRow >= 0 && currRow < rowTypeDataArray.size() &&
       rowTypeDataArray[currRow].type == RT_WatchValue)
    {
      //Can only delete old stored watch values, not in progress editing ones
      uint watchIndex = rowTypeDataArray[currRow].indexValue;
      if(watchIndex < watchValuesArray.size())
      {
        //Delete the watch value from the array
        watchValuesArray.erase(watchValuesArray.begin() + watchIndex);

        //Refresh the grid
        RefreshGrid();

        //Reset the selected cell
        SetCurrentCell(currRow, currColumn);
        return;
      }
    }
  }

  //Handle Ctrl-C to copy the contents of a cell to the clipboard
  if(keyEvent.m_keyCode == 'C' && keyEvent.m_controlDown)
  {
    if (wxTheClipboard->Open())
    {
      //Add the data this is in the current cell
      wxTheClipboard->SetData( new wxTextDataObject(GetCellValue(GetGridCursorRow(), GetGridCursorCol())) );
      wxTheClipboard->Close();
    }
  }

  //Process all other keys
  keyEvent.Skip();
}
Example #16
0
/* Clear the grid and refresh the grid buttons */
void GridView::Clear(Fl_Widget *pButton)
{
    grid->clear();
    RefreshGrid();
}
void CItemCommerceSearchView::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE);
    

	int iCase = m_cSearchCase.GetRowCount()-1;
    int iDispay = m_cDisplay.GetColumnCount()-1;

	m_cDisplay.DeleteNonFixedRows();
    CString str,strCase1,strCase2,str1,str2;

	CGridCellCheck* pCell; 
	BOOL bCheck;

	if(iCase == 0)
	{
		AfxMessageBox("查询条目为空,请先定制查询条件!",MB_ICONEXCLAMATION);
		return;
	}
	if(iDispay==0)
	{
		AfxMessageBox("显示条目为空,请先显示设置!",MB_ICONEXCLAMATION);
		return;
	}
	str = "select DISTINCT";
    for(int i= 0;i<iDispay;i++)
	{
        str = str + " " +m_iName[i].sTable+"."+m_iName[i].sItem + " ";
//		str = str + " " +m_iName[i].sItem + " ";
		if(i<iDispay-1)
			str = str+", ";

	}

	switch(m_iLink)
	{
	case 0:
//	   str  = str+"from (PBInformation INNER JOIN (Configuration INNER JOIN  OrderOfProject ON Configuration.OrderID = OrderOfProject.OrderID) ON PBInformation.ID = OrderOfProject.ID) INNER JOIN Delivery ON (Configuration.OrderID = Delivery.OrderID) AND (OrderOfProject.OrderID = Delivery.OrderID)  where (";
	   str  = str+"from (Configuration LEFT JOIN Controller ON Configuration.OrderID = Controller.OrderID) INNER JOIN (PBInformation INNER JOIN (OrderOfProject INNER JOIN Delivery ON OrderOfProject.OrderID = Delivery.OrderID) ON PBInformation.ID = OrderOfProject.ID) ON Configuration.OrderID = OrderOfProject.OrderID  where (";
       break;
	case 1:
		str= str + " from (Configuration LEFT JOIN Controller ON Configuration.OrderID = Controller.OrderID) RIGHT JOIN (PBInformation INNER JOIN (OrderOfProject LEFT JOIN Delivery ON OrderOfProject.OrderID = Delivery.OrderID) ON PBInformation.ID = OrderOfProject.ID) ON Configuration.OrderID = OrderOfProject.OrderID where (";
//	   str= str + " from (PBInformation OUTER JOIN (Configuration OUTER JOIN OrderOfProject ON Configuration.OrderID = OrderOfProject.OrderID) ON PBInformation.ID = OrderOfProject.ID) OUTER JOIN Delivery ON OrderOfProject.OrderID = Delivery.OrderID where (";
		break;
	default:
		break;
	}

//	str  = str+"from OrderOfProject INNER JOIN Delivery (INNER JOIN Configuration ON Delivery.OrderID = Configuration.OrderID)   where ";

	for(int j= 0;j<iCase;j++)
	{
		
		  if(j!=0)
			str = str + " and ";
          switch(m_iType[j].tType) {
          case 1:
            strCase1 = m_cSearchCase.GetItemText(j+1,4);
			strCase2= strCase1;
			if(m_iType[j].sItem == _T("OrderID"))
			{
				strCase2.Remove(' ');
				if(strCase2.GetLength()==8)
				{
				  str1= strCase2.Left(2);
				  str2 = strCase2.Mid(2,2);
				  strCase2 = strCase2.Right(4);
				  strCase2 = str1 + " " + str2 + " " +strCase2;
				  strCase1 = strCase2 ;
				}
			}
			str = str + " " + m_iType[j].sTable +"."+m_iType[j].sItem +" like  '%"+strCase1+"%'";
          	break;
          case 2:
            strCase1 =  m_cSearchCase.GetItemText(j+1, 2);
			strCase2 = m_cSearchCase.GetItemText(j+1,3);
			if(strCase1.IsEmpty()&&strCase2.IsEmpty())
				str= str +" " + m_iType[j].sTable+"."+m_iType[j].sItem+" Is Null";
			else{
			if(strCase1.IsEmpty())
				strCase1 = "1900-01-01";
			if(strCase2.IsEmpty())
				strCase2 = "9999-12-31";
			str = str+" " +  m_iType[j].sTable +"."+m_iType[j].sItem+ " >= #"+strCase1+"# and "+ m_iType[j].sTable +"."+m_iType[j].sItem+" <= #"+strCase2+"#";
			}
          	break;
		  case 3:
            strCase1 = m_cSearchCase.GetItemText(j+1, 2);
			strCase2 = m_cSearchCase.GetItemText(j+1, 3);
            if(strCase1.IsEmpty())
                 strCase1 = "0";
			if(strCase2.IsEmpty())
				strCase2 = "999999999";
			str = str + " " +  m_iType[j].sTable +"."+ m_iType[j].sItem+">= "+strCase1 + " and " +  m_iType[j].sTable +"."+ m_iType[j].sItem+" <= "+strCase2;
			break;
		  case 4:
			 pCell = (CGridCellCheck*)m_cSearchCase.GetCell(j+1, 5);
			 bCheck = pCell->GetCheck();
             if(bCheck)
				 strCase1 = "TRUE";
			 else 
				 strCase1 = "FALSE";
			 str = str +" " +  m_iType[j].sTable +"."+ m_iType[j].sItem + " = " + strCase1;
			break;
          default:
		    break;
          }
  
	}

	str= str +")";
	strSQL = str.AllocSysString();

	try{
		theApp.ADOExecute(m_pResult, theApp.m_pConnect, strSQL);
		int iCount  = theApp.GetRecordCountEx(m_pResult);
		m_iTotalCount = iCount;
	
		if(iCount==0)
		{
			AfxMessageBox(_T("没有所要查询的内容!"),MB_ICONEXCLAMATION);
			m_cDisplay.DeleteNonFixedRows();
			m_iTotalCount = 0;
			m_bSearch = FALSE;
			return;
		}
		else
		{
			m_bSearch = TRUE;
			m_pResult->MoveFirst();
            for(int i=1;i<=iCount;i++)
			{
				str.Format("%d",i);

				m_cDisplay.InsertRow(str, -1);
				RefreshGrid(m_pResult, i);
				m_pResult->MoveNext();
			}
		}

	}
	catch(_com_error &e)///捕捉异常
	{
		CString errormessage;
		errormessage.Format("连接数据库失败!\r\n错误信息:%s",e.ErrorMessage());
		AfxMessageBox(errormessage);///显示错误信
		return;
	} 
	catch(...)
	{
		AfxMessageBox("未知错误...");
		return;
	}
	UpdateData(FALSE);

}
void GLIDebugVariableGrid::OnCellChange(wxGridEvent &gridEvent)
{
  int currRow    = gridEvent.GetRow();
  int currColumn = gridEvent.GetCol();

  //Get if the cell data is a watch value 
  // (and not currently doing a manual cell update)
  if(internalCellEditCounter == 0 &&
     currRow >= 0 && currRow < rowTypeDataArray.size() &&
     rowTypeDataArray[currRow].type == RT_WatchValue)
  {
    UniformData newWatchData;

    //Get the string value
    newWatchData.name = GetCellValue(currRow, NAME_COLUMN_INDEX);

    //Get the type data
    newWatchData.type = GL_FLOAT;
    newWatchData.isFloatType = true;
    GetGLSLType(GetCellValue(currRow, TYPE_COLUMN_INDEX), newWatchData.type, newWatchData.isFloatType); 

    //Test if the watch value index is for a new watch or, editing an old one
    uint watchIndex = rowTypeDataArray[currRow].indexValue;
    if(watchIndex >= watchValuesArray.size())
    {
      //Add the new watch if there is room (should always be) and the name has been set
      if(currColumn == NAME_COLUMN_INDEX && 
         newWatchData.name.length() > 0 &&
         watchValuesArray.size() < MAX_NUM_WATCH_VALUES)
      {
        watchValuesArray.push_back(newWatchData);

        //Refresh the grid
        RefreshGrid();

        //Reset the selected cell
        SetCurrentCell(currRow, currColumn);
      }
    }
    else
    {
      //If the name is valid
      if(newWatchData.name.length() > 0)
      {
        //Override the watch data
        watchValuesArray[watchIndex] = newWatchData;
      }
      else
      {
        //Delete the watch value from the array
        watchValuesArray.erase(watchValuesArray.begin() + watchIndex);

        //Refresh the grid
        RefreshGrid();

        //Reset the selected cell
        SetCurrentCell(currRow, currColumn);
      }
    }

    return;
  }

  //The event was not processed
  gridEvent.Skip();
}
Example #19
0
/* Callback for clicking a grid button to toggle it */
void GridView::ToggleGridSquare(Fl_Widget *pButton)
{
    // Iterate through each point/button pair
    for (std::map<Point, Fl_Button*>::iterator it = squares.begin(); it != squares.end();
	 ++it) {

        /* Reset all green buttons (from pathfinding) back to white, except for
	   start and end, which we color blue and magenta respectively, and
	   waypoints, which we color yellow */
        if (it->first == waypoints.front())
            it->second->color(FL_BLUE);
        
        else if (it->first == waypoints.back())
            it->second->color(FL_MAGENTA);

        else if (std::find(waypoints.begin(), waypoints.end(), it->first)
		 != waypoints.end())
            it->second->color(FL_YELLOW);
           
        else if (it->second->color() == FL_GREEN)
            it->second->color(FL_WHITE);
        
        // If it->second is the just pressed button
        if (it->second == pButton) {
            // We are just clicking a button fill it in/empty it
            if (state.state == NORMAL) {
                // Don't allow setting the start/end/waypoint points
                if (it->second->color() == FL_BLUE ||
                    it->second->color() == FL_MAGENTA ||
                    it->second->color() == FL_YELLOW)
                    return;
                        
                // Turn grid point to FULL
                if (it->second->color() == FL_WHITE) {
                    grid->setSquare(it->first, FULL);
                    it->second->color(FL_RED);
                }
                        
                // Turn grid point to EMPTY
                else if (it->second->color() == FL_RED) {
                    grid->setSquare(it->first, EMPTY);
                    it->second->color(FL_WHITE);
                }
            }
            
            // We are setting a waypoint
            else if (state.state == SETTING_WAYPOINT) {
                grid->setSquare(it->first, EMPTY);

                if (state.index == 0)
                    it->second->color(FL_BLUE);
                else if (state.index == waypoints.size() - 1)
                    it->second->color(FL_MAGENTA);
                else
                    it->second->color(FL_YELLOW);

                waypoints.at(state.index) = it->first;
            }
                
            RefreshGrid();
        }
    }
    
    // Reset the gameview state to normal editing
    state.state = NORMAL;
    result_output->value("");
    result_output->color(FL_WHITE);
}
Example #20
0
GridView::GridView(Grid *grid, const char* title)
    : Fl_Double_Window(650, 450, title), grid(grid)
{
    // Set color of window to white
    color(FL_WHITE);
    // Begin adding children to this window
    begin();
    
    // Set default state
    state.state = NORMAL;
    
    // Button dimensions for grid
    const int buttonXOffset = 10;
    const int buttonYOffset = 10;
    const int buttonHeight = 20;
    const int buttonWidth = 20;
    
    // Width of inputs
    const int input_width = 120;

    // Minimum width and height are as if the grid is (20, 20)
    int winWidth;
    int winHeight;

    // Get grid dimensions
    int gridWidth = grid->getWidth();
    int gridHeight = grid->getHeight();

    winWidth = (gridWidth < 20) ? buttonWidth * 20 + buttonXOffset * 2 + 220
    : buttonWidth * gridWidth + buttonXOffset * 2 + 120 + input_width;
    
    winHeight = (gridHeight < 20) ? buttonHeight * 20 + buttonYOffset * 2
    : buttonHeight * gridHeight + buttonYOffset * 2;

    // x offset for the other inputs
    const int x_offset = winWidth - input_width - 20;

    // Set size so that the new grid fits
    size(winWidth, winHeight);
    
    // Generate all of the grid view buttons
    for (int x = 0; x < gridWidth; ++x)
    for (int y = 0; y < gridHeight; ++y) {
        Fl_Button *button = new Fl_Button(buttonXOffset + x * buttonWidth,
            buttonYOffset + y * buttonHeight,
            buttonWidth - 2, buttonHeight - 2);
            
        if (grid->getSquare(Point(x, y)) == EMPTY)
            button->color(FL_WHITE);
        else
            button->color(FL_RED);
            
        button->callback(GridView::StaticToggleGridSquare, this);
            
        squares[Point(x, y)] = button;
    }
    
    
    // Add button to trigger pathfinding
    Fl_Button *pathfindButton = new Fl_Button(x_offset, 20, input_width, 20, "Pathfind!");
    pathfindButton->callback(GridView::StaticDoPathfind, this);
    
    // Add button to trigger pathfinding in heuristic order
    Fl_Button *pathfindHeuristicButton = new Fl_Button(x_offset, 50, input_width,
						       20, "w/ Heuristic");
    pathfindHeuristicButton->callback(GridView::StaticDoPathfind, this);
    
    // Add button and textbox to repopulate the grid
    repopulation_input = new Fl_Int_Input(x_offset, 80, input_width, 20, "Num. to fill");
    // Set default repopulation amount as 200
    repopulation_input->value("200");
    
    Fl_Button *repopulateButton = new Fl_Button(x_offset, 110, input_width,
						20, "Repopulate!");
    repopulateButton->callback(GridView::StaticRepopulate, this);
    
    
    // Add button to clear the grid
    Fl_Button *clearButton = new Fl_Button(x_offset, 140, input_width, 20, "Clear!");
    clearButton->callback(GridView::StaticClear, this);
    
    // Add success/fail label for pathfinding
    result_output = new Fl_Output(x_offset - 10, 180, input_width + 20, 20);
    
    // Add new grid width and height textboxes
    width_input = new Fl_Int_Input(x_offset, 210, input_width, 20, "Width:");
    width_input->value("20");
    
    height_input = new Fl_Int_Input(x_offset, 240, input_width, 20, "Height:");
    height_input->value("20");
    
    // Add new grid button
    Fl_Button *newGridButton = new Fl_Button(x_offset, 270, input_width, 20, "New Grid!");
    newGridButton->callback(GridView::StaticNewGrid, this);
    
    // Add waypoint drop-down menu
    waypoints_selection = new Fl_Choice(x_offset, 300, 50, 20);

    // Add start and end point by default
    waypoints_selection->add("start");
    waypoints_selection->add("end");

    // Set to start by default
    waypoints_selection->value(0);

    // Set default start/end points to upper-left/lower-right
    waypoints.push_back(Point(0, 0));
    waypoints.push_back(Point(gridWidth - 1, gridHeight - 1));

    // Add button to set selected waypoint
    Fl_Button *setWaypointButton = new Fl_Button(x_offset, 330, input_width,
						 20, "Set Waypoint");
    setWaypointButton->callback(GridView::StaticSetWaypoint, this);

    // Add button to add new waypoint
    Fl_Button *addWaypointButton = new Fl_Button(x_offset, 360, input_width,
						 20, "Add Waypoint");
    addWaypointButton->callback(GridView::StaticAddWaypoint, this);

    // Add button to delete selected waypoint
    Fl_Button *deleteWaypointButton = new Fl_Button(x_offset, 390, input_width,
						    20, "Delete Waypoint");
    deleteWaypointButton->callback(GridView::StaticDeleteWaypoint, this);

    // Stop adding children to this window
    end();
    
    RefreshGrid();
    
    // Generate a timeout of 0.1s to redraw the window
    Fl::add_timeout(0.1, GridView::Redraw, this);
}