Revision 6f1fe643 chunker_player/player_gui.c

View differences:

chunker_player/player_gui.c
18 18
void RedrawStats();
19 19
void SetupGUI();
20 20
void ToggleAudio();
21
void PSNRLedCallback();
21 22

  
22 23
static char AudioStatsText[255];
23 24
static char VideoStatsText[255];
......
196 197
			&& ( y > Buttons[i].ButtonIconBox.y ) && ( y < Buttons[i].ButtonIconBox.y + Buttons[i].ButtonIcon->h )
197 198
		)
198 199
		{
200
		    // LED Button 
201
		    if(i>=PSNR_LED_RED_BUTTON_INDEX && i<=PSNR_LED_GREEN_BUTTON_INDEX)
202
		    {
203
		        SDL_SetCursor(defaultCursor);
204
		        break;
205
		    }
206
		        
199 207
			Buttons[i].Hover = 1;
200 208
			SDL_SetCursor(handCursor);
201 209
			break;
......
231 239

  
232 240
void ChunkerPlayerGUI_HandleKey()
233 241
{
234
	static Uint32 LastTime=0;
242
	/*static Uint32 LastTime=0;
235 243
	static int LastKey=-1;
236 244

  
237 245
	Uint32 Now=SDL_GetTicks();
......
242 250
		LastKey=SDLK_ESCAPE;
243 251
		LastTime=Now;
244 252
		quit=1;
245
	}
253
	}*/
246 254
}
247 255

  
248 256
void ChunkerPlayerGUI_Close()
......
637 645
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
638 646
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
639 647
	SDL_FreeSurface(temp);
648
	
649
	// PSNR RED LED
650
	temp = IMG_Load(PSNR_LED_RED_ICON_FILE);
651
	if (temp == NULL) {
652
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_RED_ICON_FILE, SDL_GetError());
653
		exit(1);
654
	}
655
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
656
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
657
	SDL_FreeSurface(temp);
658
	
659
	// PSNR YELLOW LED
660
	temp = IMG_Load(PSNR_LED_YELLOW_ICON_FILE);
661
	if (temp == NULL) {
662
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_YELLOW_ICON_FILE, SDL_GetError());
663
		exit(1);
664
	}
665
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
666
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
667
	SDL_FreeSurface(temp);
668
	
669
	// PSNR GREEN LED
670
	temp = IMG_Load(PSNR_LED_GREEN_ICON_FILE);
671
	if (temp == NULL) {
672
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_GREEN_ICON_FILE, SDL_GetError());
673
		exit(1);
674
	}
675
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
676
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
677
	SDL_FreeSurface(temp);
640 678

  
641 679
	/** Setting up icon boxes */
642 680
	Buttons[FULLSCREEN_BUTTON_INDEX].XOffset = Buttons[NO_FULLSCREEN_BUTTON_INDEX].XOffset = 20;
......
675 713
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
676 714
	Buttons[AUDIO_ON_BUTTON_INDEX].Visible = 0;
677 715
	
716
	Buttons[PSNR_LED_RED_BUTTON_INDEX].XOffset = -106;
717
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon->w;
718
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon->h;
719
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_RED_BUTTON_INDEX].XOffset);
720
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
721
	Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
722
	
723
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].XOffset = -106;
724
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon->w;
725
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon->h;
726
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].XOffset);
727
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
728
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
729
	
730
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].XOffset = -106;
731
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon->w;
732
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon->h;
733
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_GREEN_BUTTON_INDEX].XOffset);
734
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
735
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 1;
736
	
678 737
	// Setting up buttons events
679 738
	Buttons[FULLSCREEN_BUTTON_INDEX].ToggledButton = &(Buttons[NO_FULLSCREEN_BUTTON_INDEX]);
680 739
	Buttons[FULLSCREEN_BUTTON_INDEX].LButtonUpCallback = &ChunkerPlayerGUI_ToggleFullscreen;
......
683 742
	Buttons[CHANNEL_DOWN_BUTTON_INDEX].LButtonUpCallback = &ZapDown;
684 743
	Buttons[AUDIO_OFF_BUTTON_INDEX].LButtonUpCallback = &ToggleAudio;
685 744
	Buttons[AUDIO_ON_BUTTON_INDEX].LButtonUpCallback = &ToggleAudio;
745
	Buttons[PSNR_LED_RED_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
746
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
747
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
686 748
}
687 749

  
688 750
void ChunkerPlayerGUI_SetChannelTitle(char* title)
......
705 767
	RedrawChannelName();
706 768
}
707 769

  
708
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text)
770
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text, int ledstatus)
709 771
{
710 772
	if(SilentMode)
711 773
		return;
......
725 787
	strcpy(AudioStatsText, audio_text);
726 788
	strcpy(VideoStatsText, video_text);
727 789
	
790
	switch(ledstatus)
791
    {
792
    case LED_RED:
793
        // PSNR LED RED
794
        Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 1;
795
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
796
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 0;
797
	    break;
798
	case LED_YELLOW:
799
	    // PSNR LED YELLOW
800
	    Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
801
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 1;
802
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 0;
803
	    break;
804
	case LED_GREEN:
805
	    // PSNR LED GREEN
806
	    Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
807
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
808
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 1;
809
	    break;
810
	}
811
	
728 812
	RedrawStats();
813
	RedrawButtons();
729 814
}
730 815

  
731 816
void RedrawStats()
......
819 904
	RedrawButtons();
820 905
}
821 906

  
907
void PSNRLedCallback()
908
{
909
}
910

  
822 911
void ChunkerPlayerGUI_ChannelSwitched()
823 912
{
824 913
	if(!Audio_ON)

Also available in: Unified diff