brewpanel/dlgBrew.c

Thu, 19 Nov 2015 22:50:17 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 19 Nov 2015 22:50:17 +0100
changeset 427
e8e548922e31
parent 425
c51265b518ce
child 428
d64c4c1edd78
permissions
-rw-r--r--

Initial part of LEDs and backlight implemented.

409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Copyright (C) 2015
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of the mbsePi-apps
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * The gui code is based on the gui from the emulator ARAnyM,
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * Copyright (c) 2004 Petr Stehlik of ARAnyM dev team
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * mbsePi-apps is free software; you can redistribute it and/or modify it
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * under the terms of the GNU General Public License as published by the
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * Free Software Foundation; either version 2, or (at your option) any
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * later version.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * mbsePi-apps is distributed in the hope that it will be useful, but
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * General Public License for more details.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 * along with mbsePi-apps; see the file COPYING. If not, write to the Free
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 *****************************************************************************/
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "brewpanel.h"
420
644a6106d712 The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 416
diff changeset
27 #include "sockio.h"
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 #include "dlgBrew.h"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 #include "sdlgui.h"
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
30 #include "slcd.h"
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
31
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
410
e3f8a51b566a Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
33 #ifdef HAVE_SDL_SDL_H
e3f8a51b566a Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
34
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 extern SDL_Surface *PAN_surface;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 extern int my_shutdown;
422
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
37 extern uint16_t keys;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
40 #define MAINDLG_QUIT 2
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
41 #define MAINDLG_B1 3
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
42 #define MAINDLG_B2 5
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
43 #define MAINDLG_B3 7
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
44 #define MAINDLG_B4 9
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
45 #define MAINDLG_B12 11
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
46 #define MAINDLG_B23 12
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
47 #define MAINDLG_B34 13
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
48 #define MAINDLG_BALL 14
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 /* The main dialog: */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 static SGOBJ maindlg[] =
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 /* type flags state x y w h txt */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 { SGBOX, 0, 0, 0, 0, 374, 470, NULL },
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 { SGLCD, 0, 0, -1, 44, 20, 4, NULL },
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
57 { SGBUTTON, 0, 0, 147, 430, 80, 20, (char *)"Quit" },
416
7e6d682fc950 Updated the panel layout.
Michiel Broek <mbroek@mbse.eu>
parents: 412
diff changeset
58 { SGBUTTON, 0, 0, 80, 135, 30, 30, (char *)"1" },
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
59 { SGTTF, 0, 0, 85, 170, 20, 20, (char *)"Up" },
416
7e6d682fc950 Updated the panel layout.
Michiel Broek <mbroek@mbse.eu>
parents: 412
diff changeset
60 { SGBUTTON, 0, 0, 140, 135, 30, 30, (char *)"2" },
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
61 { SGTTF, 0, 0, 135, 170, 20, 20, (char *)"Down" },
416
7e6d682fc950 Updated the panel layout.
Michiel Broek <mbroek@mbse.eu>
parents: 412
diff changeset
62 { SGBUTTON, 0, 0, 200, 135, 30, 30, (char *)"3" },
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
63 { SGTTF, 0, 0, 203, 170, 20, 20, (char *)"Ret" },
416
7e6d682fc950 Updated the panel layout.
Michiel Broek <mbroek@mbse.eu>
parents: 412
diff changeset
64 { SGBUTTON, 0, 0, 260, 135, 30, 30, (char *)"4" },
7e6d682fc950 Updated the panel layout.
Michiel Broek <mbroek@mbse.eu>
parents: 412
diff changeset
65 { SGTTF, 0, 0, 258, 170, 20, 20, (char *)"Enter" },
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
66 { SGBUTTON, 0, 0, 110, 195, 30, 30, (char *)"12" },
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
67 { SGBUTTON, 0, 0, 170, 195, 30, 30, (char *)"23" },
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
68 { SGBUTTON, 0, 0, 230, 195, 30, 30, (char *)"34" },
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
69 { SGBUTTON, 0, 0, 170, 255, 30, 30, (char *)"All" },
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { -1, 0, 0, 0, 0, 0, 0, NULL }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 };
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
75 int Dialog_LCDinit(int *x, int *y, int *w, int *h, int *cols, int *rows, int index)
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
76 {
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
77 int retval;
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
78
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
79 retval = SDLGui_LCDinit(maindlg, x, y, w, h, cols, rows, index);
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
80
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
81 fprintf(stdout, "SDLGui_LCDinit(maindlg, %d, %d, %d, %d, %d, %d, %d) = %d\n", *x, *y, *w, *h, *cols, *rows, index, retval);
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
82 return retval;
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
83 }
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
84
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
85
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 * This functions sets up the actual font and then displays the brew panel dialog.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 */
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
90 int Dialog_BrewDlg(int fermenter)
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 int retbut;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 int bOldMouseVisibility;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 int nOldMouseX, nOldMouseY;
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
95 int x, y, w, h, cols, rows, fd;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 if (SDLGui_SetScreen(PAN_surface)) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 syslog(LOG_NOTICE, "SDLGui_SetScreen(PAN_surface) failed: %s", SDL_GetError());
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 return FALSE;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 SDL_GetMouseState(&nOldMouseX, &nOldMouseY);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 SDL_ShowCursor(SDL_ENABLE);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
106 if (fermenter == 1) {
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
107 maindlg[1].w = 16;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
108 maindlg[1].h = 2;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
109 maindlg[7].type = SGLEDRED;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
110 maindlg[7].x = 218;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
111 maindlg[7].y = 153;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
112 maindlg[7].w = 12;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
113 maindlg[8].txt = (char *)"";
427
e8e548922e31 Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents: 425
diff changeset
114 maindlg[12].type = -1;
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
115 }
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
116
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 SDLGui_CenterDlg(maindlg);
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
118 SDLGui_DoDialogInit(maindlg);
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
119 fd = Dialog_LCDinit(&x, &y, &w, &h, &cols, &rows, 0);
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
120 fprintf(stdout, "Dialog_LCDinit(%d, %d, %d, %d, %d, %d, 0) = %d\n", x, y, w, h, cols, rows, fd);
420
644a6106d712 The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 416
diff changeset
121 socket_connect();
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
122 slcdInit(fd, x, y, w, h, cols, rows);
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 do {
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
125 retbut = SDLGui_DoDialogLoop(maindlg);
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 fprintf(stdout, "SDLGui_DoDialog retbut=%d\n", retbut);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 switch (retbut) {
422
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
129 case MAINDLG_B1 + 1000:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
130 keys |= 0x0008;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
131 break;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
132 case MAINDLG_B1:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
133 keys &= ~0x0008;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 break;
422
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
135 case MAINDLG_B2 + 1000:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
136 keys |= 0x0004;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
137 break;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
138 case MAINDLG_B2:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
139 keys &= ~0x0004;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 break;
422
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
141 case MAINDLG_B3 + 1000:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
142 keys |= 0x0002;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
143 break;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
144 case MAINDLG_B3:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
145 keys &= ~0x0002;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 break;
422
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
147 case MAINDLG_B4 + 1000:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
148 keys |= 0x0001;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
149 break;
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
150 case MAINDLG_B4:
13502d0dda65 The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents: 420
diff changeset
151 keys &= ~0x0001;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 break;
425
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
153 case MAINDLG_B12 + 1000:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
154 keys |= 0x000c;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
155 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
156 case MAINDLG_B12:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
157 keys &= ~0x000c;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
158 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
159 case MAINDLG_B23 + 1000:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
160 keys |= 0x0006;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
161 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
162 case MAINDLG_B23:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
163 keys &= ~0x0006;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
164 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
165 case MAINDLG_B34 + 1000:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
166 keys |= 0x0003;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
167 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
168 case MAINDLG_B34:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
169 keys &= ~0x0003;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
170 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
171 case MAINDLG_BALL + 1000:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
172 keys |= 0x000f;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
173 break;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
174 case MAINDLG_BALL:
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
175 keys &= ~0x000f;
c51265b518ce Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents: 422
diff changeset
176 break;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 case MAINDLG_QUIT: my_shutdown = TRUE;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 break;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 } while (retbut != SDLGUI_QUIT && retbut != SDLGUI_ERROR && !my_shutdown);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182
412
f1a042a59b61 Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
183 SDLGui_DoDialogEnd();
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 SDL_ShowCursor(bOldMouseVisibility);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 return TRUE;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
410
e3f8a51b566a Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
189 #endif

mercurial