summaryrefslogtreecommitdiff
path: root/apps/gui/gwps.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r--apps/gui/gwps.c141
1 files changed, 0 insertions, 141 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index d70863d895..b43ff9d96c 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -61,8 +61,6 @@
61#include "ata_idle_notify.h" 61#include "ata_idle_notify.h"
62#include "root_menu.h" 62#include "root_menu.h"
63 63
64#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
65#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
66/* currently only on wps_state is needed */ 64/* currently only on wps_state is needed */
67struct wps_state wps_state; 65struct wps_state wps_state;
68struct gui_wps gui_wps[NB_SCREENS]; 66struct gui_wps gui_wps[NB_SCREENS];
@@ -81,7 +79,6 @@ static void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display);
81/* connects a wps with a statusbar*/ 79/* connects a wps with a statusbar*/
82static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar); 80static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar);
83 81
84
85#ifdef HAVE_LCD_BITMAP 82#ifdef HAVE_LCD_BITMAP
86static void gui_wps_set_margin(struct gui_wps *gwps) 83static void gui_wps_set_margin(struct gui_wps *gwps)
87{ 84{
@@ -671,144 +668,6 @@ long gui_wps_show(void)
671 668
672/* needs checking if needed end*/ 669/* needs checking if needed end*/
673 670
674/* wps_data*/
675#ifdef HAVE_LCD_BITMAP
676/* Clear the WPS image cache */
677static void wps_clear(struct wps_data *data )
678{
679 int i;
680 /* set images to unloaded and not displayed */
681 for (i = 0; i < MAX_IMAGES; i++) {
682 data->img[i].loaded = false;
683 data->img[i].display = false;
684 data->img[i].always_display = false;
685 }
686 data->wps_sb_tag = false;
687 data->show_sb_on_wps = false;
688 data->progressbar.have_bitmap_pb=false;
689}
690#else
691#define wps_clear(a)
692#endif
693
694/* initial setup of wps_data */
695void wps_data_init(struct wps_data *wps_data)
696{
697#ifdef HAVE_LCD_BITMAP
698 wps_clear(wps_data);
699#else /* HAVE_LCD_CHARCELLS */
700 {
701 int i;
702 for(i = 0; i < 8; i++)
703 wps_data->wps_progress_pat[i] = 0;
704 wps_data->full_line_progressbar = 0;
705 }
706#endif
707 wps_data->format_buffer[0] = '\0';
708 wps_data->wps_loaded = false;
709 wps_data->peak_meter_enabled = false;
710}
711
712static void wps_reset(struct wps_data *data)
713{
714 data->wps_loaded = false;
715 memset(&data->format_buffer, 0, sizeof data->format_buffer);
716 wps_data_init(data);
717}
718
719/* to setup up the wps-data from a format-buffer (isfile = false)
720 from a (wps-)file (isfile = true)*/
721bool wps_data_load(struct wps_data *wps_data,
722 const char *buf,
723 bool isfile)
724{
725 int fd;
726
727 if(!wps_data || !buf)
728 return false;
729
730 if(!isfile)
731 {
732 wps_clear(wps_data);
733 strncpy(wps_data->format_buffer, buf, sizeof(wps_data->format_buffer));
734 wps_data->format_buffer[sizeof(wps_data->format_buffer) - 1] = 0;
735 gui_wps_format(wps_data);
736 return true;
737 }
738 else
739 {
740 /*
741 * Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this
742 * wants to be a virtual file. Feel free to modify dirbrowse()
743 * if you're feeling brave.
744 */
745 if (! strcmp(buf, WPS_DEFAULTCFG) )
746 {
747 wps_reset(wps_data);
748 global_settings.wps_file[0] = 0;
749 return false;
750 }
751
752#ifdef HAVE_REMOTE_LCD
753 if (! strcmp(buf, RWPS_DEFAULTCFG) )
754 {
755 wps_reset(wps_data);
756 global_settings.rwps_file[0] = 0;
757 return false;
758 }
759#endif
760
761 size_t bmpdirlen;
762 char *bmpdir = strrchr(buf, '.');
763 bmpdirlen = bmpdir - buf;
764
765 fd = open(buf, O_RDONLY);
766
767 if (fd >= 0)
768 {
769 unsigned int start = 0;
770
771 wps_reset(wps_data);
772#ifdef HAVE_LCD_BITMAP
773 wps_data->img_buf_ptr = wps_data->img_buf; /* where in image buffer */
774
775 wps_data->img_buf_free = IMG_BUFSIZE; /* free space in image buffer */
776#endif
777 while( ( read_line(fd, &wps_data->format_buffer[start],
778 sizeof(wps_data->format_buffer)-start) ) > 0 )
779 {
780 if(!wps_data_preload_tags(wps_data,
781 &wps_data->format_buffer[start],
782 buf, bmpdirlen))
783 {
784 start += strlen(&wps_data->format_buffer[start]);
785
786 if (start < sizeof(wps_data->format_buffer) - 1)
787 {
788 wps_data->format_buffer[start++] = '\n';
789 wps_data->format_buffer[start] = 0;
790 }
791 }
792 }
793
794 if (start > 0)
795 {
796 gui_wps_format(wps_data);
797 }
798
799 close(fd);
800
801 wps_data->wps_loaded = true;
802
803 return start > 0;
804 }
805 }
806
807 return false;
808}
809
810/* wps_data end */
811
812/* wps_state */ 671/* wps_state */
813 672
814static void wps_state_init(void) 673static void wps_state_init(void)