summaryrefslogtreecommitdiff
path: root/utils/wpseditor/libwps/src/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/wpseditor/libwps/src/lcd.c')
-rw-r--r--utils/wpseditor/libwps/src/lcd.c150
1 files changed, 150 insertions, 0 deletions
diff --git a/utils/wpseditor/libwps/src/lcd.c b/utils/wpseditor/libwps/src/lcd.c
new file mode 100644
index 0000000000..1f12332750
--- /dev/null
+++ b/utils/wpseditor/libwps/src/lcd.c
@@ -0,0 +1,150 @@
1#include "font.h"
2#include "screen_access.h"
3//#include <windef.h>
4#include "api.h"
5#include "defs.h"
6#include "proxy.h"
7#include "dummies.h"
8
9static struct viewport default_vp =
10{
11 .x = 0,
12 .y = 0,
13 .width = LCD_WIDTH,
14 .height = LCD_HEIGHT,
15 .font = FONT_SYSFIXED,
16 .drawmode = DRMODE_SOLID,
17 .fg_pattern = LCD_DEFAULT_FG,
18 .bg_pattern = LCD_DEFAULT_BG,
19 .lss_pattern = LCD_DEFAULT_BG,
20 .lse_pattern = LCD_DEFAULT_BG,
21 .lst_pattern = LCD_DEFAULT_BG,
22};
23
24struct viewport* current_vp = &default_vp;
25
26void get_current_vp(struct viewport_api *avp){
27 avp->x = current_vp->x;
28 avp->y = current_vp->y;
29 avp->width = current_vp->width;
30 avp->height = current_vp->height;
31
32 //TODO: font_get(current_vp->font)->height;
33 avp->fontheight = sysfont.height;
34}
35
36void lcd_set_viewport(struct viewport* vp)
37{
38 if (vp == NULL){
39 current_vp = &default_vp;
40 DEBUGF3("lcd_set_viewport(struct viewport* vp= DEFAULT)\n");
41 }
42 else{
43 current_vp = vp;
44 DEBUGF3("lcd_set_viewport(struct viewport* vp=%x,vpx=%d,vpy=%d,vpw=%d,vph=%d)\n",vp,vp->x,vp->y,vp->width,vp->height);
45 }
46}
47
48void lcd_update_viewport(void)
49{
50 //lcd_update_rect(current_vp->x, current_vp->y,current_vp->width, current_vp->height);
51}
52
53void lcd_update_viewport_rect(int x, int y, int width, int height)
54{
55 //lcd_update_rect(current_vp->x + x, current_vp->y + y, width, height);
56}
57/*** parameter handling ***/
58
59void lcd_set_drawmode(int mode)
60{
61 current_vp->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
62}
63
64int lcd_get_drawmode(void)
65{
66 return current_vp->drawmode;
67}
68
69void lcd_set_foreground(unsigned color)
70{
71 current_vp->fg_pattern = color;
72}
73
74unsigned lcd_get_foreground(void)
75{
76 return current_vp->fg_pattern;
77}
78
79void lcd_set_background(unsigned color)
80{
81 current_vp->bg_pattern = color;
82}
83
84unsigned lcd_get_background(void)
85{
86 return current_vp->bg_pattern;
87}
88
89void lcd_set_selector_start(unsigned color)
90{
91 current_vp->lss_pattern = color;
92}
93
94void lcd_set_selector_end(unsigned color)
95{
96 current_vp->lse_pattern = color;
97}
98
99void lcd_set_selector_text(unsigned color)
100{
101 current_vp->lst_pattern = color;
102}
103
104void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color)
105{
106 //lcd_set_drawmode(mode);
107 current_vp->fg_pattern = fg_color;
108 current_vp->bg_pattern = bg_color;
109}
110
111int lcd_getwidth(void)
112{
113 return current_vp->width;
114}
115
116int lcd_getheight(void)
117{
118 return current_vp->height;
119}
120
121void lcd_setfont(int newfont)
122{
123 current_vp->font = newfont;
124}
125
126int lcd_getfont(void)
127{
128 return current_vp->font;
129}
130
131/* Clear the whole display */
132void lcd_clear_display(void)
133{
134 struct viewport* old_vp = current_vp;
135
136 current_vp = &default_vp;
137
138 lcd_clear_viewport();
139
140 current_vp = old_vp;
141}
142
143void lcd_clear_viewport(){
144 DEBUGF2("lcd_clear_viewport()\n");
145 xapi->clear_viewport(current_vp->x,current_vp->y,current_vp->width,current_vp->height,current_vp->bg_pattern);
146
147}
148void lcd_scroll_stop(struct viewport* vp){
149 DEBUGF3("lcd_scroll_stop(struct viewport* vp=%x)\n",vp);
150}