brewpanel/brewpanel.c

changeset 431
b3895cd6edd3
parent 425
c51265b518ce
child 432
332daf75352e
equal deleted inserted replaced
430:36ecc8bbb75d 431:b3895cd6edd3
24 #include "sdlgui.h" 24 #include "sdlgui.h"
25 #include "dlgBrew.h" 25 #include "dlgBrew.h"
26 26
27 #ifdef HAVE_SDL_SDL_H 27 #ifdef HAVE_SDL_SDL_H
28 28
29 int DebugPanel = FALSE; /* Logfile debugging */
30 int debug = FALSE; /* Console debugging */ 29 int debug = FALSE; /* Console debugging */
31 int my_shutdown = FALSE; /* Shutdown requested */ 30 int my_shutdown = FALSE; /* Shutdown requested */
32 char *Paneltype = NULL; /* Panel to emulate */ 31 char *Paneltype = NULL; /* Panel to emulate */
33 int PAN_x; /* Screen X size */ 32 int PAN_x; /* Screen X size */
34 int PAN_y; /* Screen Y size */ 33 int PAN_y; /* Screen Y size */
42 void help(void) 41 void help(void)
43 { 42 {
44 fprintf(stdout, "Usage: brewpanel [-d] [-h] [-p <paneltype>]\n"); 43 fprintf(stdout, "Usage: brewpanel [-d] [-h] [-p <paneltype>]\n");
45 fprintf(stdout, " -d --debug Debug on\n"); 44 fprintf(stdout, " -d --debug Debug on\n");
46 fprintf(stdout, " -h --help Display this help\n"); 45 fprintf(stdout, " -h --help Display this help\n");
47 fprintf(stdout, " -p --paneltype <ferm|brew> Select machine, default last used\n"); 46 fprintf(stdout, " -p --paneltype <ferm|brew> Select panel type\n");
48 } 47 }
49 48
50 49
51 50
52 void die(int onsig) 51 void die(int onsig)
90 c = getopt_long(argc, argv, "dhp:", long_options, &option_index); 89 c = getopt_long(argc, argv, "dhp:", long_options, &option_index);
91 if (c == -1) 90 if (c == -1)
92 break; 91 break;
93 92
94 switch (c) { 93 switch (c) {
95 case 'd': DebugPanel = TRUE; 94 case 'd': debug = TRUE;
96 break; 95 break;
97 case 'h': help(); 96 case 'h': help();
98 return 1; 97 return 1;
99 case 'p': snprintf(Paneltype, 127, "%s", optarg); 98 case 'p': snprintf(Paneltype, 127, "%s", optarg);
100 break; 99 break;
136 } 135 }
137 136
138 PAN_x = 384; 137 PAN_x = 384;
139 PAN_y = 480; 138 PAN_y = 480;
140 139
141 fprintf(stdout, "Screen max X*Y: %d*%d panel X*Y: %d*%d\n", max_x, max_y, PAN_x, PAN_y); 140 if (debug)
141 fprintf(stdout, "Screen max X*Y: %d*%d panel X*Y: %d*%d\n", max_x, max_y, PAN_x, PAN_y);
142 142
143 PAN_surface = SDL_SetVideoMode( PAN_x, PAN_y, 32, SDL_SWSURFACE|SDL_DOUBLEBUF ); 143 PAN_surface = SDL_SetVideoMode( PAN_x, PAN_y, 32, SDL_SWSURFACE|SDL_DOUBLEBUF );
144 if (PAN_surface == NULL) { 144 if (PAN_surface == NULL) {
145 syslog(LOG_NOTICE, "Could not create main surface: %s", SDL_GetError()); 145 syslog(LOG_NOTICE, "Could not create main surface: %s", SDL_GetError());
146 exit(-1); 146 exit(-1);
149 SDLGui_Init(); 149 SDLGui_Init();
150 snprintf(title, 80, "brewpanel v%s", VERSION); 150 snprintf(title, 80, "brewpanel v%s", VERSION);
151 SDL_WM_SetCaption(title, NULL); 151 SDL_WM_SetCaption(title, NULL);
152 152
153 syslog(LOG_NOTICE, "Starting mainloop"); 153 syslog(LOG_NOTICE, "Starting mainloop");
154 Dialog_BrewDlg(1); 154 if (strlen(Paneltype) && !strcmp(Paneltype, (char *)"ferm") ) {
155 Dialog_BrewDlg(1);
156 } else {
157 Dialog_BrewDlg(0);
158 }
155 syslog(LOG_NOTICE, "Out of mainloop, cleanup"); 159 syslog(LOG_NOTICE, "Out of mainloop, cleanup");
156 160
157 SDLGui_UnInit(); 161 SDLGui_UnInit();
158 SDL_FreeSurface(PAN_surface); 162 SDL_FreeSurface(PAN_surface);
159 SDL_Quit(); 163 SDL_Quit();

mercurial