mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-15 08:02:34 -05:00
Extensive code policing (indentation levels, tab characters).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6199 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f89087df4b
commit
31b28f523a
4 changed files with 302 additions and 310 deletions
|
|
@ -60,109 +60,109 @@ static int get_raw_button (void)
|
|||
int ev=screenhack_handle_events(&release, &repeat);
|
||||
switch(ev)
|
||||
{
|
||||
case XK_KP_Left:
|
||||
case XK_Left:
|
||||
case XK_KP_4:
|
||||
k = BUTTON_LEFT;
|
||||
case XK_KP_Left:
|
||||
case XK_Left:
|
||||
case XK_KP_4:
|
||||
k = BUTTON_LEFT;
|
||||
break;
|
||||
|
||||
case XK_KP_Right:
|
||||
case XK_Right:
|
||||
case XK_KP_6:
|
||||
k = BUTTON_RIGHT;
|
||||
case XK_KP_Right:
|
||||
case XK_Right:
|
||||
case XK_KP_6:
|
||||
k = BUTTON_RIGHT;
|
||||
break;
|
||||
|
||||
case XK_KP_Up:
|
||||
case XK_Up:
|
||||
case XK_KP_8:
|
||||
case XK_KP_Up:
|
||||
case XK_Up:
|
||||
case XK_KP_8:
|
||||
#ifdef BUTTON_UP
|
||||
k = BUTTON_UP;
|
||||
k = BUTTON_UP;
|
||||
#elif defined BUTTON_PLAY
|
||||
k = BUTTON_PLAY;
|
||||
k = BUTTON_PLAY;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case XK_KP_Down:
|
||||
case XK_Down:
|
||||
case XK_KP_2:
|
||||
case XK_KP_Down:
|
||||
case XK_Down:
|
||||
case XK_KP_2:
|
||||
#ifdef BUTTON_DOWN
|
||||
k = BUTTON_DOWN;
|
||||
k = BUTTON_DOWN;
|
||||
#elif defined BUTTON_STOP
|
||||
k = BUTTON_STOP;
|
||||
k = BUTTON_STOP;
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_ON
|
||||
case XK_KP_Add:
|
||||
case XK_Q:
|
||||
case XK_q:
|
||||
k = BUTTON_ON;
|
||||
case XK_KP_Add:
|
||||
case XK_Q:
|
||||
case XK_q:
|
||||
k = BUTTON_ON;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUTTON_OFF
|
||||
case XK_KP_Enter:
|
||||
case XK_A:
|
||||
case XK_a:
|
||||
k = BUTTON_OFF;
|
||||
case XK_KP_Enter:
|
||||
case XK_A:
|
||||
case XK_a:
|
||||
k = BUTTON_OFF;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUTTON_F1
|
||||
case XK_KP_Divide:
|
||||
case XK_1:
|
||||
k = BUTTON_F1;
|
||||
case XK_KP_Divide:
|
||||
case XK_1:
|
||||
k = BUTTON_F1;
|
||||
break;
|
||||
|
||||
case XK_KP_Multiply:
|
||||
case XK_2:
|
||||
k = BUTTON_F2;
|
||||
case XK_KP_Multiply:
|
||||
case XK_2:
|
||||
k = BUTTON_F2;
|
||||
break;
|
||||
|
||||
case XK_KP_Subtract:
|
||||
case XK_3:
|
||||
k = BUTTON_F3;
|
||||
case XK_KP_Subtract:
|
||||
case XK_3:
|
||||
k = BUTTON_F3;
|
||||
break;
|
||||
#elif defined(BUTTON_REC)
|
||||
case XK_KP_Divide:
|
||||
case XK_1:
|
||||
k = BUTTON_REC;
|
||||
break;
|
||||
case XK_KP_Divide:
|
||||
case XK_1:
|
||||
k = BUTTON_REC;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case XK_KP_Space:
|
||||
case XK_KP_5:
|
||||
case XK_KP_Begin:
|
||||
case XK_space:
|
||||
case XK_KP_Space:
|
||||
case XK_KP_5:
|
||||
case XK_KP_Begin:
|
||||
case XK_space:
|
||||
#ifdef BUTTON_PLAY
|
||||
k = BUTTON_PLAY;
|
||||
k = BUTTON_PLAY;
|
||||
#elif defined(BUTTON_SELECT)
|
||||
k = BUTTON_SELECT;
|
||||
k = BUTTON_SELECT;
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
case XK_5:
|
||||
if(!release)
|
||||
{
|
||||
screen_dump();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case XK_5:
|
||||
if(!release)
|
||||
{
|
||||
screen_dump();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case XK_KP_Separator:
|
||||
case XK_KP_Insert:
|
||||
case XK_Insert:
|
||||
case XK_KP_Separator:
|
||||
case XK_KP_Insert:
|
||||
case XK_Insert:
|
||||
#ifdef BUTTON_MENU
|
||||
k = BUTTON_MENU;
|
||||
k = BUTTON_MENU;
|
||||
#elif defined(BUTTON_MODE)
|
||||
k = BUTTON_MODE;
|
||||
k = BUTTON_MODE;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
k = 0;
|
||||
default:
|
||||
k = 0;
|
||||
if(ev)
|
||||
DEBUGF("received ev %d\n", ev);
|
||||
break;
|
||||
|
|
@ -172,7 +172,8 @@ static int get_raw_button (void)
|
|||
/* return a release event */
|
||||
button_state &= ~k;
|
||||
k |= BUTTON_REL;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(k) {
|
||||
button_state |= k;
|
||||
k = button_state;
|
||||
|
|
@ -222,8 +223,8 @@ long button_get(bool block)
|
|||
} while(1);
|
||||
|
||||
if(!block)
|
||||
/* delay a bit */
|
||||
sim_sleep(1);
|
||||
/* delay a bit */
|
||||
sim_sleep(1);
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,21 +173,21 @@ static unsigned char lcd_buffer_copy[11][2];
|
|||
|
||||
void lcd_update (void)
|
||||
{
|
||||
bool changed=false;
|
||||
int x, y;
|
||||
for (y=0; y<2; y++) {
|
||||
for (x=0; x<11; x++) {
|
||||
if (lcd_display_redraw ||
|
||||
lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y]) {
|
||||
lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y];
|
||||
lcd_print_char(x, y);
|
||||
changed=true;
|
||||
}
|
||||
bool changed=false;
|
||||
int x, y;
|
||||
for (y=0; y<2; y++) {
|
||||
for (x=0; x<11; x++) {
|
||||
if (lcd_display_redraw ||
|
||||
lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y]) {
|
||||
lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y];
|
||||
lcd_print_char(x, y);
|
||||
changed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
XSync(dpy,False);
|
||||
lcd_display_redraw=false;
|
||||
if (changed)
|
||||
XSync(dpy,False);
|
||||
lcd_display_redraw=false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <X11/keysym.h>
|
||||
|
||||
#ifdef __sgi
|
||||
# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
|
||||
# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
|
||||
#endif /* __sgi */
|
||||
|
||||
#ifdef HAVE_XMU
|
||||
|
|
@ -128,31 +128,31 @@ XtAppContext app;
|
|||
Bool mono_p;
|
||||
|
||||
static XrmOptionDescRec default_options [] = {
|
||||
{ "-root", ".root", XrmoptionNoArg, "True" },
|
||||
{ "-window", ".root", XrmoptionNoArg, "False" },
|
||||
{ "-mono", ".mono", XrmoptionNoArg, "True" },
|
||||
{ "-install", ".installColormap", XrmoptionNoArg, "True" },
|
||||
{ "-noinstall",".installColormap", XrmoptionNoArg, "False" },
|
||||
{ "-visual", ".visualID", XrmoptionSepArg, 0 },
|
||||
{ "-window-id", ".windowID", XrmoptionSepArg, 0 },
|
||||
{ 0, 0, 0, 0 }
|
||||
{ "-root", ".root", XrmoptionNoArg, "True" },
|
||||
{ "-window", ".root", XrmoptionNoArg, "False" },
|
||||
{ "-mono", ".mono", XrmoptionNoArg, "True" },
|
||||
{ "-install", ".installColormap", XrmoptionNoArg, "True" },
|
||||
{ "-noinstall", ".installColormap", XrmoptionNoArg, "False" },
|
||||
{ "-visual", ".visualID", XrmoptionSepArg, 0 },
|
||||
{ "-window-id", ".windowID", XrmoptionSepArg, 0 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static char *default_defaults[] = {
|
||||
".root: false",
|
||||
".root: false",
|
||||
#define GEOMETRY_POSITION 1
|
||||
"*geometry: "
|
||||
"*geometry: "
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
"120x68"
|
||||
"120x68"
|
||||
#else
|
||||
"280x132" /* A bit larger that necessary */
|
||||
"280x132" /* A bit larger that necessary */
|
||||
#endif
|
||||
, /* this should be .geometry, but nooooo... */
|
||||
"*mono: false",
|
||||
"*installColormap: false",
|
||||
"*visualID: default",
|
||||
"*windowID: ",
|
||||
0
|
||||
, /* this should be .geometry, but nooooo... */
|
||||
"*mono: false",
|
||||
"*installColormap: false",
|
||||
"*visualID: default",
|
||||
"*windowID: ",
|
||||
0
|
||||
};
|
||||
|
||||
extern Display* dpy;
|
||||
|
|
@ -261,71 +261,70 @@ int screenhack_handle_event(Display *dpy, XEvent *event,
|
|||
*repeat = false;
|
||||
|
||||
switch (event->xany.type) {
|
||||
case KeyPress:
|
||||
{
|
||||
KeySym keysym;
|
||||
unsigned char c = 0;
|
||||
XLookupString (&event->xkey, &c, 1, &keysym, 0);
|
||||
key = keysym;
|
||||
case KeyPress:
|
||||
{
|
||||
KeySym keysym;
|
||||
unsigned char c = 0;
|
||||
XLookupString (&event->xkey, &c, 1, &keysym, 0);
|
||||
key = keysym;
|
||||
#if 0
|
||||
DEBUGF("Got keypress: %02x %x, time %lx\n", c,
|
||||
event->xkey.keycode,
|
||||
event->xkey.time);
|
||||
DEBUGF("Got keypress: %02x %x, time %lx\n", c,
|
||||
event->xkey.keycode,
|
||||
event->xkey.time);
|
||||
#endif
|
||||
if(lastkeycode == event->xkey.keycode)
|
||||
*repeat = checkrepeat(lasttime, event->xkey.time);
|
||||
lasttime = event->xkey.time;
|
||||
lastkeycode = event->xkey.keycode;
|
||||
}
|
||||
break;
|
||||
case KeyRelease:
|
||||
{
|
||||
KeySym keysym;
|
||||
unsigned char c = 0;
|
||||
XLookupString (&event->xkey, &c, 1, &keysym, 0);
|
||||
key = keysym;
|
||||
if(lastkeycode == event->xkey.keycode)
|
||||
*repeat = checkrepeat(lasttime, event->xkey.time);
|
||||
lasttime = event->xkey.time;
|
||||
lastkeycode = event->xkey.keycode;
|
||||
}
|
||||
break;
|
||||
case KeyRelease:
|
||||
{
|
||||
KeySym keysym;
|
||||
unsigned char c = 0;
|
||||
XLookupString (&event->xkey, &c, 1, &keysym, 0);
|
||||
key = keysym;
|
||||
#if 0
|
||||
DEBUGF("Got keyrelease: %c (%02x) %x\n", c, c,
|
||||
event->xkey.keycode);
|
||||
DEBUGF("Got keyrelease: %c (%02x) %x\n", c, c,
|
||||
event->xkey.keycode);
|
||||
#endif
|
||||
if(lastkeycode == event->xkey.keycode)
|
||||
*repeat = checkrepeat(lasttime, event->xkey.time);
|
||||
lasttime = event->xkey.time;
|
||||
lastkeycode = event->xkey.keycode;
|
||||
if(*repeat)
|
||||
return 0; /* on repeats, return nothing on release */
|
||||
if(lastkeycode == event->xkey.keycode)
|
||||
*repeat = checkrepeat(lasttime, event->xkey.time);
|
||||
lasttime = event->xkey.time;
|
||||
lastkeycode = event->xkey.keycode;
|
||||
if(*repeat)
|
||||
return 0; /* on repeats, return nothing on release */
|
||||
|
||||
*release = TRUE;
|
||||
}
|
||||
break;
|
||||
case Expose:
|
||||
{
|
||||
screen_redraw();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case ClientMessage:
|
||||
{
|
||||
if (event->xclient.message_type != XA_WM_PROTOCOLS) {
|
||||
char *s = XGetAtomName(dpy, event->xclient.message_type);
|
||||
if (!s) s = "(null)";
|
||||
fprintf (stderr, "%s: unknown ClientMessage %s received!\n",
|
||||
progname, s);
|
||||
}
|
||||
else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) {
|
||||
char *s1 = XGetAtomName(dpy, event->xclient.message_type);
|
||||
char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]);
|
||||
if (!s1) s1 = "(null)";
|
||||
if (!s2) s2 = "(null)";
|
||||
fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n",
|
||||
progname, s1, s2);
|
||||
}
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
*release = TRUE;
|
||||
}
|
||||
break;
|
||||
case Expose:
|
||||
screen_redraw();
|
||||
break;
|
||||
case ClientMessage:
|
||||
if (event->xclient.message_type != XA_WM_PROTOCOLS) {
|
||||
char *s = XGetAtomName(dpy, event->xclient.message_type);
|
||||
if (!s)
|
||||
s = "(null)";
|
||||
fprintf (stderr, "%s: unknown ClientMessage %s received!\n",
|
||||
progname, s);
|
||||
}
|
||||
else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) {
|
||||
char *s1 = XGetAtomName(dpy, event->xclient.message_type);
|
||||
char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]);
|
||||
if (!s1)
|
||||
s1 = "(null)";
|
||||
if (!s2)
|
||||
s2 = "(null)";
|
||||
fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n",
|
||||
progname, s1, s2);
|
||||
}
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
|
@ -344,8 +343,7 @@ int screenhack_handle_events(bool *release, bool *repeat)
|
|||
}
|
||||
|
||||
|
||||
static Visual *
|
||||
pick_visual (Screen *screen)
|
||||
static Visual *pick_visual (Screen *screen)
|
||||
{
|
||||
#ifdef USE_GL
|
||||
/* If we're linking against GL (that is, this is the version of
|
||||
|
|
@ -367,7 +365,7 @@ pick_visual (Screen *screen)
|
|||
!strcmp (string, "best") ||
|
||||
!strcmp (string, "color") ||
|
||||
!strcmp (string, "default"))
|
||||
v = get_gl_visual (screen); /* from ../utils/visual-gl.c */
|
||||
v = get_gl_visual (screen); /* from ../utils/visual-gl.c */
|
||||
|
||||
if (string)
|
||||
free (string);
|
||||
|
|
@ -393,64 +391,64 @@ int main (int argc, char **argv)
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
display_zoom=2;
|
||||
{
|
||||
char *env=getenv("RECORDER_ZOOM");
|
||||
if (env) {
|
||||
display_zoom=atoi(env);
|
||||
}
|
||||
char *env=getenv("RECORDER_ZOOM");
|
||||
if (env) {
|
||||
display_zoom=atoi(env);
|
||||
}
|
||||
}
|
||||
#else
|
||||
display_zoom=1;
|
||||
{
|
||||
char *env=getenv("PLAYER_ZOOM");
|
||||
if (env) {
|
||||
display_zoom=atoi(env);
|
||||
}
|
||||
char *env=getenv("PLAYER_ZOOM");
|
||||
if (env) {
|
||||
display_zoom=atoi(env);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
int x;
|
||||
for (x=1; x<argc; x++) {
|
||||
if (!strcmp("--old_lcd", argv[x])) {
|
||||
having_new_lcd=FALSE;
|
||||
printf("Using old LCD layout.\n");
|
||||
} else if (!strcmp("--recorder_zoom", argv[x])) {
|
||||
x++;
|
||||
int x;
|
||||
for (x=1; x<argc; x++) {
|
||||
if (!strcmp("--old_lcd", argv[x])) {
|
||||
having_new_lcd=FALSE;
|
||||
printf("Using old LCD layout.\n");
|
||||
} else if (!strcmp("--recorder_zoom", argv[x])) {
|
||||
x++;
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
display_zoom=atoi(argv[x]);
|
||||
printf("Window zoom is %d\n", display_zoom);
|
||||
display_zoom=atoi(argv[x]);
|
||||
printf("Window zoom is %d\n", display_zoom);
|
||||
#endif
|
||||
} else if (!strcmp("--player_zoom", argv[x])) {
|
||||
x++;
|
||||
} else if (!strcmp("--player_zoom", argv[x])) {
|
||||
x++;
|
||||
#ifndef HAVE_LCD_BITMAP
|
||||
display_zoom=atoi(argv[x]);
|
||||
printf("Window zoom is %d\n", display_zoom);
|
||||
display_zoom=atoi(argv[x]);
|
||||
printf("Window zoom is %d\n", display_zoom);
|
||||
#endif
|
||||
} else {
|
||||
printf("rockboxui\n");
|
||||
printf("Arguments:\n");
|
||||
printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n");
|
||||
printf(" --player_zoom \t [Player] window zoom\n");
|
||||
printf(" --recorder_zoom \t [Recorder] window zoom\n");
|
||||
printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("rockboxui\n");
|
||||
printf("Arguments:\n");
|
||||
printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n");
|
||||
printf(" --player_zoom \t [Player] window zoom\n");
|
||||
printf(" --recorder_zoom \t [Recorder] window zoom\n");
|
||||
printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
static char geometry[40];
|
||||
static char geometry[40];
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
snprintf(geometry, 40, "*geometry: %dx%d",
|
||||
LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8);
|
||||
snprintf(geometry, 40, "*geometry: %dx%d",
|
||||
LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8);
|
||||
#else
|
||||
snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom, 132*display_zoom);
|
||||
snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom,
|
||||
132*display_zoom);
|
||||
#endif
|
||||
default_defaults[GEOMETRY_POSITION]=geometry;
|
||||
default_defaults[GEOMETRY_POSITION]=geometry;
|
||||
}
|
||||
printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
|
||||
|
||||
|
||||
merge_options ();
|
||||
|
||||
#ifdef __sgi
|
||||
|
|
|
|||
|
|
@ -54,158 +54,151 @@ Window window;
|
|||
bool lcd_display_redraw=true;
|
||||
|
||||
XrmOptionDescRec options [] = {
|
||||
/* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */
|
||||
{ "-server", ".server", XrmoptionSepArg, 0 },
|
||||
{ "-help", ".help", XrmoptionNoArg, "false" },
|
||||
{ 0, 0, 0, 0 }
|
||||
/* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */
|
||||
{ "-server", ".server", XrmoptionSepArg, 0 },
|
||||
{ "-help", ".help", XrmoptionNoArg, "false" },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
char *progclass = "rockboxui";
|
||||
|
||||
char *defaults [] = {
|
||||
#ifdef IRIVER_H100
|
||||
".background: lightblue",
|
||||
".background: lightblue",
|
||||
#elif defined ARCHOS_GMINI120
|
||||
".background: royalblue",
|
||||
".background: royalblue",
|
||||
#else
|
||||
".background: lightgreen",
|
||||
".background: lightgreen",
|
||||
#endif
|
||||
".foreground: black",
|
||||
"*help: false",
|
||||
0
|
||||
".foreground: black",
|
||||
"*help: false",
|
||||
0
|
||||
};
|
||||
|
||||
void init_window ()
|
||||
{
|
||||
XGCValues gcv;
|
||||
XWindowAttributes xgwa;
|
||||
XGCValues gcv;
|
||||
XWindowAttributes xgwa;
|
||||
|
||||
XGetWindowAttributes (dpy, window, &xgwa);
|
||||
XGetWindowAttributes (dpy, window, &xgwa);
|
||||
|
||||
cmap = xgwa.colormap;
|
||||
cmap = xgwa.colormap;
|
||||
|
||||
gcv.function = GXxor;
|
||||
gcv.foreground =
|
||||
get_pixel_resource ("foreground", "Foreground", dpy, cmap);
|
||||
draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
|
||||
gcv.function = GXxor;
|
||||
gcv.foreground = get_pixel_resource("foreground", "Foreground", dpy, cmap);
|
||||
draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
|
||||
|
||||
screen_resized(LCD_WIDTH, LCD_HEIGHT);
|
||||
screen_resized(LCD_WIDTH, LCD_HEIGHT);
|
||||
}
|
||||
|
||||
void screen_resized(int width, int height)
|
||||
{
|
||||
int maxx, maxy;
|
||||
maxx = width;
|
||||
maxy = height;
|
||||
int maxx, maxy;
|
||||
maxx = width;
|
||||
maxy = height;
|
||||
|
||||
XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background",
|
||||
dpy, cmap));
|
||||
XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom);
|
||||
lcd_display_redraw=true;
|
||||
screen_redraw();
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom,
|
||||
height*display_zoom);
|
||||
lcd_display_redraw=true;
|
||||
screen_redraw();
|
||||
}
|
||||
|
||||
void drawrect(int color, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
|
||||
x2*display_zoom, y2*display_zoom);
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
|
||||
x2*display_zoom, y2*display_zoom);
|
||||
}
|
||||
|
||||
static void help(void)
|
||||
{
|
||||
printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n"
|
||||
"usage: " PROGNAME "\n"
|
||||
);
|
||||
printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n"
|
||||
"usage: " PROGNAME "\n");
|
||||
}
|
||||
|
||||
void drawline(int color, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
XDrawLine(dpy, window, draw_gc,
|
||||
(int)(x1*display_zoom),
|
||||
(int)(y1*display_zoom),
|
||||
(int)(x2*display_zoom),
|
||||
(int)(y2*display_zoom));
|
||||
XDrawLine(dpy, window, draw_gc,
|
||||
(int)(x1*display_zoom),
|
||||
(int)(y1*display_zoom),
|
||||
(int)(x2*display_zoom),
|
||||
(int)(y2*display_zoom));
|
||||
}
|
||||
|
||||
void drawdot(int color, int x, int y)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom,
|
||||
display_zoom, display_zoom);
|
||||
XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom,
|
||||
display_zoom, display_zoom);
|
||||
}
|
||||
|
||||
void drawdots(int color, struct coordinate *points, int count)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
while (count--) {
|
||||
XFillRectangle(dpy, window, draw_gc,
|
||||
points[count].x*display_zoom,
|
||||
points[count].y*display_zoom,
|
||||
display_zoom,
|
||||
display_zoom);
|
||||
}
|
||||
while (count--) {
|
||||
XFillRectangle(dpy, window, draw_gc,
|
||||
points[count].x*display_zoom,
|
||||
points[count].y*display_zoom,
|
||||
display_zoom,
|
||||
display_zoom);
|
||||
}
|
||||
}
|
||||
|
||||
void drawrectangles(int color, struct rectangle *points, int count)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
while (count--) {
|
||||
XFillRectangle(dpy, window, draw_gc,
|
||||
points[count].x*display_zoom,
|
||||
points[count].y*display_zoom,
|
||||
points[count].width*display_zoom,
|
||||
points[count].height*display_zoom);
|
||||
|
||||
}
|
||||
while (count--) {
|
||||
XFillRectangle(dpy, window, draw_gc,
|
||||
points[count].x*display_zoom,
|
||||
points[count].y*display_zoom,
|
||||
points[count].width*display_zoom,
|
||||
points[count].height*display_zoom);
|
||||
}
|
||||
}
|
||||
|
||||
void drawtext(int color, int x, int y, char *text)
|
||||
{
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0)
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text, strlen(text));
|
||||
XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text,
|
||||
strlen(text));
|
||||
}
|
||||
|
||||
/* this is where the applicaton starts */
|
||||
|
|
@ -214,36 +207,36 @@ extern void app_main(void);
|
|||
void
|
||||
screenhack (Display *the_dpy, Window the_window)
|
||||
{
|
||||
Bool helpme;
|
||||
Bool helpme;
|
||||
|
||||
/* This doesn't work, but I don't know why (Daniel 1999-12-01) */
|
||||
helpme = get_boolean_resource ("help", "Boolean");
|
||||
if(helpme) {
|
||||
help();
|
||||
}
|
||||
printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
|
||||
/* This doesn't work, but I don't know why (Daniel 1999-12-01) */
|
||||
helpme = get_boolean_resource ("help", "Boolean");
|
||||
if(helpme)
|
||||
help();
|
||||
|
||||
dpy=the_dpy;
|
||||
window=the_window;
|
||||
printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
|
||||
|
||||
init_window();
|
||||
dpy=the_dpy;
|
||||
window=the_window;
|
||||
|
||||
screen_redraw();
|
||||
init_window();
|
||||
|
||||
app_main();
|
||||
screen_redraw();
|
||||
|
||||
app_main();
|
||||
}
|
||||
|
||||
void screen_redraw()
|
||||
{
|
||||
/* draw a border around the "Recorder" screen */
|
||||
/* draw a border around the "Recorder" screen */
|
||||
#define X1 0
|
||||
#define Y1 0
|
||||
#define X2 (LCD_WIDTH + MARGIN_X*2)
|
||||
#define Y2 (LCD_HEIGHT + MARGIN_Y)
|
||||
|
||||
drawline(1, X1, Y1, X2, Y1);
|
||||
drawline(1, X2, Y1, X2, Y2);
|
||||
drawline(1, X1, Y2, X2, Y2);
|
||||
drawline(1, X1, Y1, X1, Y2);
|
||||
lcd_update();
|
||||
drawline(1, X1, Y1, X2, Y1);
|
||||
drawline(1, X2, Y1, X2, Y2);
|
||||
drawline(1, X1, Y2, X2, Y2);
|
||||
drawline(1, X1, Y1, X1, Y2);
|
||||
lcd_update();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue