/*****************************************************************************
    * Function - CalculateUnitStringWidths
    * DESCRIPTION:
    *
    ****************************************************************************/
    void StringWidthCalculator::CalculateUnitStringWidths()
    {
      mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");

      Label* pLabel = new Label();

      // use the same size as mLabelErrorUnit in AlarmListItem
      pLabel->SetSize(225-19+1, 15);
      pLabel->SetChildPos(240, 0);
      pLabel->SetVisible();

      for(int i = 0; i < DISPLAY_UNIT_STRINGS_CNT; ++i)
      {
        pLabel->SetStringId( DISPLAY_UNIT_STRINGS[i].StringId );
        //ignore duplicates
        if (!pLabel->IsValid())
          pLabel->CalculateStringWidths(true);
      }

      pLabel->SetStringId( SID_UNIT_UNKNOWN );
      pLabel->CalculateStringWidths(true);
      pLabel->SetVisible(false);

      delete pLabel;
    }
    /*****************************************************************************
    * Function - CalculateSpecialStringWidths
    * DESCRIPTION:
    *
    ****************************************************************************/
    void StringWidthCalculator::CalculateSpecialStringWidths()
    {      
      mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");

      Label* pLabel = new Label();
      pLabel->SetSize(239+1, 15);
      pLabel->SetStringId( SID_STEP_BY_STEP_INSTALLATION_GUIDE );
      pLabel->CalculateStringWidths(true);

      pLabel->SetSize(78, 15);
      pLabel->SetStringId( SID_WORK_PERIOD );
      pLabel->CalculateStringWidths(true);
      pLabel->SetStringId( SID_OFF_PERIOD );
      pLabel->CalculateStringWidths(true);
      pLabel->SetStringId( SID_SLEEP_PERIOD );
      pLabel->CalculateStringWidths(true);
      pLabel->SetVisible(false);
      delete pLabel;

      CancelOrContinuePopUp* pConfirm = new CancelOrContinuePopUp();
      pConfirm->SetQuestionStringId( SID_PASSWORD_TEXT );
      pConfirm->CalculateStringWidths(true);
      pConfirm->SetQuestionStringId( SID_YOU_ARE_ABOUT_TO_CHANGE_PUMP_OPERATION_MODE_ );
      pConfirm->CalculateStringWidths(true);
      pConfirm->SetVisible(false);
      delete pConfirm;

    }
//-----------------------------------------------------------------------------
// Purpose: Setup our scheme
//-----------------------------------------------------------------------------
void CMovieDisplayScreen::ApplySchemeSettings( IScheme *pScheme )
{
    assert( pScheme );

    m_cDefault = Color( 255, 255, 255, 255 );
    m_cInvisible = Color( 0, 0, 0, 0 );

    m_pDisplayTextLabel->SetFgColor( m_cDefault );
    m_pDisplayTextLabel->SetText( "" );
    m_pDisplayTextLabel->SetVisible( false );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFWaitingForPlayersPanel::FireGameEvent( IGameEvent * event )
{
	const char *pEventName = event->GetName();

	if ( Q_strcmp( "teamplay_waiting_ends", pEventName ) == 0 )
	{
		SetVisible( false );
	}
	else if ( Q_strcmp( "teamplay_waiting_begins", pEventName ) == 0 )
	{
		SetVisible( true );
		m_pWaitingForPlayersLabel->SetVisible( true );
		m_pWaitingForPlayersEndingLabel->SetVisible( false );
	}
	else if ( Q_strcmp( "teamplay_waiting_abouttoend", pEventName ) == 0 )
	{
		SetVisible( true );
		m_pWaitingForPlayersLabel->SetVisible( false );
		m_pWaitingForPlayersEndingLabel->SetVisible( true );
	}
}
Exemple #5
0
void BangHide(HWND hwndOwner, LPCTSTR args)
{
    TCHAR name[MAX_LINE_LENGTH];
    
    if (GetToken(args, name, &args, FALSE))
    {
        // Find the label
        Label *label = gLabelManager->FindLabel(name);
        
        if (label)
        {
            // Hide it
            label->SetVisible(FALSE);
        }
    }
}
Exemple #6
0
void BangToggle(HWND hwndOwner, LPCTSTR args)
{
    TCHAR name[MAX_LINE_LENGTH];
    
    if (GetToken(args, name, &args, FALSE))
    {
        // Find the label
        Label *label = gLabelManager->FindLabel(name);
        
        if (label)
        {
            // Toggle it's visibility
            label->SetVisible(!label->IsVisible());
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose: Event handler
//-----------------------------------------------------------------------------
void CTFStatsSummaryPanel::FireGameEvent( IGameEvent *event )
{
	const char *pEventName = event->GetName();

	// when we are changing levels and 
	if ( 0 == Q_strcmp( pEventName, "server_spawn" ) )
	{
		if ( !m_bInteractive )
		{
			const char *pMapName = event->GetString( "mapname" );
			if ( pMapName )
			{
				// If we're loading a background map, don't display anything
				// HACK: Client doesn't get gpGlobals->eLoadType, so just do string compare for now.
				if ( Q_stristr( pMapName, "background" ) )
				{
					ClearMapLabel();
				}
				else
				{
					// set the map name in the UI
					wchar_t wzMapName[255] = L"";
					g_pVGuiLocalize->ConvertANSIToUnicode( GetMapDisplayName( pMapName ), wzMapName, sizeof( wzMapName ) );

					SetDialogVariable( "maplabel", wzMapName );

					// set the map type in the UI
					const char *szMapType = GetMapType( pMapName );
					SetDialogVariable( "maptype", g_pVGuiLocalize->Find( szMapType ) );

					// set the map author name in the UI
					const char *szMapAuthor = GetMapAuthor( pMapName );
					if ( szMapAuthor[0] != '\0' )
					{
						SetDialogVariable( "mapauthor", szMapAuthor );

						Label *pMapAuthorLabel = dynamic_cast<Label *>( FindChildByName( "MapAuthorLabel" ) );
						if ( pMapAuthorLabel && !pMapAuthorLabel->IsVisible() )
							pMapAuthorLabel->SetVisible( true );
					}
				}
			}
		}
	}
}
Exemple #8
0
	virtual void ApplySchemeSettings( IScheme *pScheme )
	{
		m_TextColor = pScheme->GetColor( "NewGame.TextColor", Color(255, 255, 255, 255) );
		m_FillColor = pScheme->GetColor( "NewGame.FillColor", Color(255, 255, 255, 255) );
		m_DisabledColor = pScheme->GetColor( "NewGame.DisabledColor", Color(255, 255, 255, 255) );
		m_SelectedColor = pScheme->GetColor( "NewGame.SelectionColor", Color(255, 255, 255, 255) );

		BaseClass::ApplySchemeSettings( pScheme );

		// Hide chapter numbers for new episode teasers
		if ( m_bTeaserChapter )
		{
			m_pChapterLabel->SetVisible( false );
		}

		m_pCommentaryIcon = dynamic_cast<ImagePanel*>( FindChildByName( "CommentaryIcon" ) );
		if ( m_pCommentaryIcon )
			m_pCommentaryIcon->SetVisible( m_bCommentaryMode );
	}
    /*****************************************************************************
    * Function - CalculateAlarmStringWidths
    * DESCRIPTION:
    *
    ****************************************************************************/
    void StringWidthCalculator::CalculateAlarmStringWidths()
    {
      Label* pLabel = new Label();

      // use the same size as mLabelErrorString in AlarmListItem
      pLabel->SetSize(225-5+1, 15);

      mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");

      for(int i = 0; i < DISPLAY_ALARM_STRINGS_CNT; ++i)
      {
        pLabel->SetStringId( DISPLAY_ALARM_STRINGS[i].StringId );
        pLabel->CalculateStringWidths(true);
      }

      pLabel->SetStringId( SID_ALARM_UNKNOWN );
      pLabel->CalculateStringWidths(true);
      pLabel->SetVisible(false);

      delete pLabel;
    }
    /*****************************************************************************
    * Function - ExportStringWidths
    * DESCRIPTION:
    *
    ****************************************************************************/
    void StringWidthCalculator::ExportStringWidthsAdv(StringWidthParameters* parameters)
    {
      if (parameters->includeHeader)
      {//create new file
        mpStringLengthFile = fopen(parameters->filename, "wb");
      }
      else
      {//append to file
        mpStringLengthFile = fopen(parameters->filename, "ab");
      }

      if (mpStringLengthFile == NULL)
      {
        TCHAR sz_msg[512];
        _stprintf(sz_msg, TEXT("Unable to open file: %s"), parameters->filename);
        ::MessageBox(NULL,sz_msg,TEXT("Unable to open file."),MB_OK|MB_ICONHAND);
        return;
      }

      strncpy(mpFirstColumnContents, parameters->firstcolumn, MAX_PATH);
      
      if (parameters->includeHeader)
      {
        Languages* p_lang = Languages::GetInstance();
        LANGUAGE_TYPE orig_lang = p_lang->GetLanguage();
        p_lang->SetLanguage(DEV_LANGUAGE);

        // write a simple header
        DataPointTime* pdt = new DataPointTime();
        fprintf(mpStringLengthFile, "\"%s\";\"%s\"\r\n",
          p_lang->GetLanguageName( orig_lang ),
          pdt->GetText()
          );

        p_lang->SetLanguage(orig_lang);

        delete pdt;


        if (parameters->onlyRelationsInCurrentDisplay)
        {
          sHelpStringIdExported.clear();

          // write column names
          fprintf(mpStringLengthFile, "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\r\n",
            "DisplayFilename","DisplayId","Display","StringId","Visible");
        }
        else
        {
          // write column names
          fprintf(mpStringLengthFile, "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\r\n",
            "DisplayId","Display",
            "StringId","Visible","String Width","String Height",
            "ComponentId","Component Width","Component Height", "Max. no of lines",
            "Wrapped","Fits");
        }
      }

      sStringIdCompWidth.clear();

      if (parameters->onlyRelationsInCurrentDisplay)
      {
        // special export for first display
        if (parameters->includeHeader)
        {
          mpDisplayCtrl->GetMenuBar()->CalculateStringWidths(false);
        }

        // special export of unreferenced helptexts
        if (strcmp(mpFirstColumnContents, UNREFERENCED_HELPTEXT) == 0)
        {
          for (int i = 0; i < LANG_GEN_HELP_STRING_COUNT; ++i)
          {
            int id = Languages::GetInstance()->GetHelpStingId(i);

            std::map<U16, bool>::iterator itr = sHelpStringIdExported.find(id);
            if (itr == sHelpStringIdExported.end())
            {
              fprintf(mpStringLengthFile, "\"%s\";\"%d\";\"[%s]\";\"%d\";\"%d\"\r\n",
                mpFirstColumnContents, 0, "", id, 2);
            }
          }

        }
        else // normal export
        {

        // don't set g_is_calculating_strings, only visible listview rows should be exported
        PopupBox* popup = mpDisplayCtrl->GetCurrentPopupBox();
        if (popup != NULL)
        {
          popup->CalculateStringWidths(false);
        }
        else
        {
          Display* disp = mpDisplayCtrl->GetCurrentDisplay();
         
          g_is_calculating_strings = true;
          disp->GetRoot()->Invalidate();
          disp->GetRoot()->Run();
          g_is_calculating_strings = false;

          disp->CalculateStringWidths(false);

          //special export for display 2.1 Pump Control. (on/off/auto switch)
          if (disp->GetId() == 37)
          {
            CancelOrContinuePopUp* pConfirm = new CancelOrContinuePopUp();
            pConfirm->SetQuestionStringId( SID_YOU_ARE_ABOUT_TO_CHANGE_PUMP_OPERATION_MODE_ );
            pConfirm->SetVisible(false);
            pConfirm->CalculateStringWidths(false);
            delete pConfirm;
          }

          //special export for display 4.5 Alarm settings
          if (disp->GetId() == 58)
          {
            Label* pLabel = new Label(disp->GetRoot());
            pLabel->SetSize(230, 15);
            pLabel->SetStringId(SID_PUMP_ALARMS_GROUP_1);
            pLabel->CalculateStringWidths(false);
            pLabel->SetStringId(SID_PUMP_ALARMS_GROUP_2);
            pLabel->CalculateStringWidths(false);
            delete pLabel;
          }

          //special export for display 4.5.2 Pump Alarms
          if (disp->GetId() == 60)
          {
            Label* pLabel = new Label(disp->GetRoot());
            pLabel->SetSize(230, 15);
            pLabel->SetStringId(SID_PUMP_ALARM_GENIBUS_COM_ERROR_IO111);
            pLabel->CalculateStringWidths(false);
            delete pLabel;
          }


          //special export for 4.3.4.8 work/off/sleep schedule
          if (disp->GetId() == 76)
          {
            Label* pLabel = new Label(disp->GetRoot());
            pLabel->SetSize(78, 15);
            pLabel->SetVisible();
            pLabel->SetStringId( SID_WORK_PERIOD );
            pLabel->CalculateStringWidths(false);
            pLabel->SetStringId( SID_OFF_PERIOD );
            pLabel->CalculateStringWidths(false);
            pLabel->SetStringId( SID_SLEEP_PERIOD );
            pLabel->CalculateStringWidths(false);
            pLabel->SetVisible(false);
            delete pLabel;
          }
        }
      
        }
      }
      else // calculate widths of all strings
      {
        g_is_calculating_strings = true;

        // calculate menu bars strings
        mpDisplayCtrl->GetMenuBar()->CalculateStringWidths(true);

        // calculate strings of all displays
        int i = 0;
        while (i++ < MAX_DISPLAY_ID)
        {
          Display* p_disp = GetDisplay(i);
          if(p_disp && p_disp->GetAbleToShow())
          {
            mpDisplayCtrl->Push(p_disp);
            p_disp->CalculateStringWidths(true);

            p_disp->Hide();
          }
        }

        // calculate all alarm strings 
        CalculateAlarmStringWidths();

        // calculate all help texts
        CalculateHelpStringWidths();

        // calculate all unit texts
        CalculateUnitStringWidths();

        // calculate all remaining strings
        CalculateSpecialStringWidths();

        i = 0;
        std::map<U16, U16>::iterator itr;

        // ensure all string id's are exported
        while (i++ <= LANG_GEN_STRING_COUNT)
        {
          itr = sStringIdCompWidth.find(i);
          if (itr == sStringIdCompWidth.end())
          {
            fprintf(mpStringLengthFile, "\"%d\";\"%s\";\"%d\";\"%d\";\"%s\";\"%s\";\"%d\";\"%d\";\"%d\";\"%d\";\"%d\";\"%d\"\r\n",
              0,"",i,
              0,"","",
              0,0,0,
              0,0,0);
          }
        }

        g_is_calculating_strings = false;
        mpDisplayCtrl->ResetToHome();

      }

      fclose(mpStringLengthFile);
      
    }
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFSpectatorGUI::UpdateKeyLabels( void )
{
	// get the desired player class
	int iClass = TF_CLASS_UNDEFINED;
	bool bIsHLTV = engine->IsHLTV();

	C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
	if ( pPlayer )
	{
		iClass = pPlayer->m_Shared.GetDesiredPlayerClassIndex();
	}

	// if it's time to change the tip, or the player has changed desired class, update the tip
	if ( ( gpGlobals->curtime >= m_flNextTipChangeTime ) || ( iClass != m_iTipClass ) )
	{
		if ( bIsHLTV )
		{
			const wchar_t *wzTip = g_pVGuiLocalize->Find( "#Tip_HLTV" );

			if ( wzTip )
			{
				SetDialogVariable( "tip", wzTip );
			}
		}
		else
		{
			wchar_t wzTipLabel[512]=L"";
			const wchar_t *wzTip = g_TFTips.GetNextClassTip( iClass );
			Assert( wzTip && wzTip[0] );
			g_pVGuiLocalize->ConstructString( wzTipLabel, sizeof( wzTipLabel ), g_pVGuiLocalize->Find( "#Tip_Fmt" ), 1, wzTip );
			SetDialogVariable( "tip", wzTipLabel );
		}
		
		m_flNextTipChangeTime = gpGlobals->curtime + 10.0f;
		m_iTipClass = iClass;
	}

	if ( m_pClassOrTeamLabel )
	{
		C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
		if ( pPlayer )
		{
			static wchar_t wzFinal[512] = L"";
			const wchar_t *wzTemp = NULL;

			if ( bIsHLTV )
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_AutoDirector" );
			}
			else if ( pPlayer->GetTeamNumber() == TEAM_SPECTATOR )
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_ChangeTeam" );
			}
			else
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_ChangeClass" );
			}

			if ( wzTemp )
			{
				UTIL_ReplaceKeyBindings( wzTemp, 0, wzFinal, sizeof( wzFinal ) );
				m_pClassOrTeamLabel->SetText( wzFinal );
			}
		}
	}

	if ( m_pSwitchCamModeKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( ( mp_forcecamera.GetInt() == OBS_ALLOW_TEAM ) || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) || mp_fadetoblack.GetBool() ) )
		{
			if ( m_pSwitchCamModeKeyLabel->IsVisible() )
			{
				m_pSwitchCamModeKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "SwitchCamModeLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pSwitchCamModeKeyLabel->IsVisible() )
			{
				m_pSwitchCamModeKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "SwitchCamModeLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_SwitchCamModeKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pSwitchCamModeKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pCycleTargetFwdKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( mp_fadetoblack.GetBool() || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) ) )
		{
			if ( m_pCycleTargetFwdKeyLabel->IsVisible() )
			{
				m_pCycleTargetFwdKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetFwdLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pCycleTargetFwdKeyLabel->IsVisible() )
			{
				m_pCycleTargetFwdKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetFwdLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_CycleTargetFwdKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pCycleTargetFwdKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pCycleTargetRevKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( mp_fadetoblack.GetBool() || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) ) )
		{
			if ( m_pCycleTargetRevKeyLabel->IsVisible() )
			{
				m_pCycleTargetRevKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetRevLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pCycleTargetRevKeyLabel->IsVisible() )
			{
				m_pCycleTargetRevKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetRevLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_CycleTargetRevKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pCycleTargetRevKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pMapLabel )
	{
		wchar_t wMapName[16];
		wchar_t wLabel[256];
		char szMapName[16];

		char tempname[128];
		Q_FileBase( engine->GetLevelName(), tempname, sizeof( tempname ) );
		Q_strlower( tempname );

		if ( IsX360() )
		{
			char *pExt = Q_stristr( tempname, ".360" );
			if ( pExt )
			{
				*pExt = '\0';
			}
		}

		Q_strncpy( szMapName, GetMapDisplayName( tempname ), sizeof( szMapName ) );

		g_pVGuiLocalize->ConvertANSIToUnicode( szMapName, wMapName, sizeof(wMapName));
		g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#Spec_Map" ), 1, wMapName );

		m_pMapLabel->SetText( wLabel ); 
	}
}
Exemple #12
0
MainPanel::MainPanel()
  : Panel(MAIN_PANEL_ID)
{
  // TODO CS349: Create your entire interface here. You will need to
  // modify the provided code below to lay things out the way you like

  // Note the use of unique identifiers for each widget when they are
  // constructed. See A2WidgetIdentifiers.h and the assignment
  // specification for the identifiers you should use for each of the
  // components you create. These identifiers are used for unit tests
  // to easily identify components in the interactor tree.

  

  Component* turtleGraphicsPanel = new Panel(TURTLE_GRAPHICS_PANEL_ID);
  Label *turtleLabel = new Label(TURTLE_GRAPHICS_OUTPUT_LABEL_ID,"Turtle Graphics Output:",Point(100,100));
  TurtleGraphics* turtle = new TurtleGraphics(TURTLE_GRAPHICS_WIDGET_ID);
  TurtleListener* tl = new TurtleListener();



  Component *playbackPanel = new Panel(PLAYBACK_PANEL_ID);
  Label *playbackLabel = new Label(PLAYBACK_OUTPUT_LABEL_ID,"Playback Rate:",Point(200,25-10));
  Slider *playbackSlider = new Slider(PLAYBACK_SLIDER_ID,Slider::HORIZONTAL_SLIDER,Point(200,25));
  

  Component *currentStepPanel = new Panel(CURRENT_TURTLE_STEP_PANEL_ID);
  Label *currentLabel = new Label(CURRENT_TURTLE_STEP_LABEL_ID,"Current Turtle Step:",Point(200,90-10));
  Slider *currentSlider = new Slider(CURRENT_TURTLE_STEP_SLIDER_ID,Slider::HORIZONTAL_SLIDER,Point(200,90));

  tl->SetTurtleGraphics(turtle,currentSlider);

  Component *buttonPanel = new Panel(BUTTON_PANEL_ID);
  buttonPanel->SetBounds(Rectangle(0,110,100,140));
  Button *startButton = new Button(GO_TO_START_BUTTON_ID,"Go To Start",Point(1,110));
  Button *previousButton = new Button(PREVIOUS_FRAME_BUTTON_ID,"Previous Frame",Point(21,110));
  Button *playButton = new Button(PLAY_BUTTON_ID,"Play",Point(41,110));
  Button *nextButton = new Button(NEXT_FRAME_BUTTON_ID,"Next Frame",Point(61,110));
  Button *endButton = new Button(GO_TO_END_BUTTON_ID,"End Frame",Point(81,110));


  ButtonListener *bl = new ButtonListener();

  bl->SetSlider(currentSlider);
  startButton->AddActionListener(bl);
  previousButton->AddActionListener(bl);
  playButton->AddActionListener(bl);
  nextButton->AddActionListener(bl);
  endButton->AddActionListener(bl);
  bl->SetTurtleListener(tl);


  startButton->SetBounds(Rectangle(1,110,18,20));
  previousButton->SetBounds(Rectangle(21,110,18,20));
  playButton->SetBounds(Rectangle(41,110,18,20));
  nextButton->SetBounds(Rectangle(61,110,18,20));
  endButton->SetBounds(Rectangle(81,110,18,20));


  this->SetBounds(Rectangle(0, 0, 300, 150));
  
  turtleGraphicsPanel->SetBounds(Rectangle(0,0,100,100));
  turtle->SetBounds(Rectangle(0,0,100,100));

  playbackPanel->SetBounds(Rectangle(200-75,25,100+75,100));

  currentStepPanel->SetBounds(Rectangle(200-75,90,100+75,100));
  buttonPanel->SetBounds(Rectangle(0,0,200,300));


  
  playbackSlider->SetMinimum(1);
  playbackSlider->SetMaximum(100);
  playbackSlider->SetCurValue(50);
  playbackSlider->SetBounds(Rectangle(0,0,200,60));

  currentSlider->SetMinimum(1);
  
  currentSlider->SetCurValue(1);
  currentSlider->SetBounds(Rectangle(0,0,200,60));





  //add components to proper interactor tree
  turtleGraphicsPanel->AddComponent(turtleLabel);
  turtleGraphicsPanel->AddComponent(turtle);

  playbackPanel->AddComponent(playbackLabel);
  playbackPanel->AddComponent(playbackSlider);

  currentStepPanel->AddComponent(currentLabel);
  currentStepPanel->AddComponent(currentSlider);

  buttonPanel->AddComponent(startButton);
  buttonPanel->AddComponent(previousButton);
  buttonPanel->AddComponent(playButton);
  buttonPanel->AddComponent(nextButton);
  buttonPanel->AddComponent(endButton);

  this->AddComponent(turtleGraphicsPanel);
  this->AddComponent(playbackPanel);
  this->AddComponent(currentStepPanel);
  this->AddComponent(buttonPanel);

  //set visible to be true
  turtleLabel->SetVisible(true);
  turtle->SetVisible(true);

  playbackLabel->SetVisible(true);
  playbackSlider->SetVisible(true);

  currentLabel->SetVisible(true);
  currentSlider->SetVisible(true);

  startButton->SetVisible(true);
  previousButton->SetVisible(true);
  playButton->SetVisible(true);
  nextButton->SetVisible(true);
  endButton->SetVisible(true);

  turtleGraphicsPanel->SetVisible(true);
  playbackPanel->SetVisible(true);
  currentStepPanel->SetVisible(true);
  buttonPanel->SetVisible(true);

  


  // TODO CS349: Add other initialization code here
// TODO CS349

  // Some simple operations to show the turtle when starting up
  // This is an entirely random set of instructions
  // Once started up, try typing this into the console:
  // (turtle-star (find-turtle-graphics-widget) 300 23)
  // The 300 argument is the length of the edges of the star, in
  // pixels
  // The 23 argument is the number of points for the star
  turtle->RotateInDegrees(45);
  turtle->Forward(100, true);
  turtle->RotateInDegrees(135);
  turtle->Forward(65, true);
  turtle->RotateInDegrees(135);
  turtle->Forward(100, true);
  turtle->RotateInDegrees(150);
  turtle->Forward(30, true);

  currentSlider->SetMaximum(turtle->GetNumSteps());
  tl->SetMaximum(turtle->GetNumSteps());

  tl->Start();
}