/*****************************************************************************/ int
xrdp_bitmap_hash_crc(struct xrdp_bitmap *self)
{ void *hash; int bytes; int crc; int index; char hash_data[16];
/*****************************************************************************/ /* copy part of self at x, y to 0, 0 in dest */ /* returns error */ int
xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap *self, struct xrdp_bitmap *dest, int x, int y, int cx, int cy)
{ int i; int j; int destx; int desty; int pixel; int crc; int incs; int incd;
tui8 *s8;
tui8 *d8;
tui16 *s16;
tui16 *d16;
tui32 *s32;
tui32 *d32;
/*****************************************************************************/ /* returns true if they are the same, else returns false */ int
xrdp_bitmap_compare(struct xrdp_bitmap *self, struct xrdp_bitmap *b)
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_bitmap_compare:");
/*****************************************************************************/ staticint
xrdp_bitmap_draw_focus_box(struct xrdp_bitmap *self, struct xrdp_painter *painter, int x, int y, int cx, int cy)
{
painter->rop = 0xf0;
xrdp_painter_begin_update(painter);
painter->use_clip = 0;
painter->mix_mode = 1;
painter->brush.pattern[0] = 0xaa;
painter->brush.pattern[1] = 0x55;
painter->brush.pattern[2] = 0xaa;
painter->brush.pattern[3] = 0x55;
painter->brush.pattern[4] = 0xaa;
painter->brush.pattern[5] = 0x55;
painter->brush.pattern[6] = 0xaa;
painter->brush.pattern[7] = 0x55;
painter->brush.x_origin = x;
painter->brush.y_origin = y;
painter->brush.style = 3;
painter->fg_color = self->wm->black;
painter->bg_color = self->parent->bg_color; /* top */
xrdp_painter_fill_rect(painter, self, x, y, cx, 1); /* bottom */
xrdp_painter_fill_rect(painter, self, x, y + (cy - 1), cx, 1); /* left */
xrdp_painter_fill_rect(painter, self, x, y + 1, 1, cy - 2); /* right */
xrdp_painter_fill_rect(painter, self, x + (cx - 1), y + 1, 1, cy - 2);
xrdp_painter_end_update(painter);
painter->rop = 0xcc;
painter->mix_mode = 0; return0;
}
/*****************************************************************************/ /* x and y are in relation to self for 0, 0 is the top left of the control */ staticint
xrdp_bitmap_draw_button(struct xrdp_bitmap *self, struct xrdp_painter *painter, int x, int y, int w, int h, int down)
{ if (down)
{ /* gray box */
painter->fg_color = self->wm->grey;
xrdp_painter_fill_rect(painter, self, x, y, w, h); /* black top line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x, y, w, 1); /* black left line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x, y, 1, h); /* dark grey top line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, x + 1, y + 1, w - 2, 1); /* dark grey left line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, x + 1, y + 1, 1, h - 2); /* dark grey bottom line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, x + 1, y + (h - 2), w - 1, 1); /* dark grey right line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, x + (w - 2), y + 1, 1, h - 1); /* black bottom line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x, y + (h - 1), w, 1); /* black right line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x + (w - 1), y, 1, h);
} else
{ /* gray box */
painter->fg_color = self->wm->grey;
xrdp_painter_fill_rect(painter, self, x, y, w, h); /* white top line */
painter->fg_color = self->wm->white;
xrdp_painter_fill_rect(painter, self, x, y, w, 1); /* white left line */
painter->fg_color = self->wm->white;
xrdp_painter_fill_rect(painter, self, x, y, 1, h); /* dark grey bottom line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, x + 1, y + (h - 2), w - 1, 1); /* dark grey right line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, (x + w) - 2, y + 1, 1, h - 1); /* black bottom line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x, y + (h - 1), w, 1); /* black right line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, x + (w - 1), y, 1, h);
}
return0;
}
/*****************************************************************************/ /* nil for rect means the whole thing */ /* returns error */ int
xrdp_bitmap_invalidate(struct xrdp_bitmap *self, struct xrdp_rect *rect)
{ int i; int w; int h; int x; int y; struct xrdp_bitmap *b; struct xrdp_rect r1; struct xrdp_rect r2; struct xrdp_painter *painter; unsignedint font_height; char *p;
if (self == 0) /* if no bitmap */
{ return0;
}
if (self->type == WND_TYPE_BITMAP) /* if 0, bitmap, leave */
{ return0;
}
/* dark grey top line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, 0, 0, self->width, 1); /* dark grey left line */
painter->fg_color = self->wm->dark_grey;
xrdp_painter_fill_rect(painter, self, 0, 0, 1, self->height); /* white bottom line */
painter->fg_color = self->wm->white;
xrdp_painter_fill_rect(painter, self, 0, self->height - 1, self->width, 1); /* white right line */
painter->fg_color = self->wm->white;
xrdp_painter_fill_rect(painter, self, self->width - 1, 0, 1, self->height); /* black left line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, 1, 1, 1, self->height - 3); /* black top line */
painter->fg_color = self->wm->black;
xrdp_painter_fill_rect(painter, self, 1, 1, self->width - 3, 1);
/* draw text */ if (self->parent->focused_control == self)
{
painter->fg_color = self->wm->white;
} else
{
painter->fg_color = self->wm->black;
}
xrdp_painter_draw_text(painter, self, 4, 2,
(char *)list_get_item(self->string_list, self->item_index)); /* draw button on right */
x = self->width - 20;
y = 2;
w = (self->width - x) - 2;
h = self->height - 4; /* looks better with a background around */
painter->fg_color = self->wm->grey;
xrdp_painter_fill_rect(painter, self, x, y, w, h);
if (self->state == BUTTON_STATE_UP) /* 0 */
{
xrdp_bitmap_draw_button(self, painter, x + 1, y + 1, w - 1, h - 1, 0);
} else
{
xrdp_bitmap_draw_button(self, painter, x + 1, y + 1, w - 1, h - 1, 1);
}
/* draw the arrow */
w = w / 2;
x = x + (w / 2) + 1;
h = (h / 2) + 2;
y = y + (h / 2) + 1;
painter->fg_color = self->wm->black;
for (i = w; i > 0; i = i - 2)
{
xrdp_painter_fill_rect(painter, self, x, y, i, 1);
y++;
x = x + 1;
}
} elseif (self->type == WND_TYPE_SPECIAL) /* 8 special */
{ if (self->popped_from != 0)
{ /* change height if there are too many items in the list */
i = xrdp_painter_font_body_height(painter);
i = self->popped_from->string_list->count * i;
/* draw the list items */ if (self->popped_from != 0)
{
y = 0;
for (i = 0; i < self->popped_from->string_list->count; i++)
{
p = (char *)list_get_item(self->popped_from->string_list, i);
h = xrdp_painter_font_body_height(painter);
self->item_height = h;
if (i == self->item_index)
{
painter->fg_color = self->wm->blue;
xrdp_painter_fill_rect(painter, self, 0, y, self->width, h);
painter->fg_color = self->wm->white;
} else
{
painter->fg_color = self->wm->black;
}
xrdp_painter_draw_text(painter, self, 2, y, p);
y = y + h;
}
}
}
/*****************************************************************************/ /* returns error */ int
xrdp_bitmap_def_proc(struct xrdp_bitmap *self, int msg, int param1, int param2)
{ int n; int i; int shift; int ext; int scan_code; struct xrdp_bitmap *b; struct xrdp_bitmap *focus_out_control;
if (self == 0)
{ return0;
}
if (self->wm == 0)
{ return0;
}
if (self->type == WND_TYPE_WND)
{ if (msg == WM_KEYDOWN)
{
scan_code = param1 % 128;
if (scan_code == 15) /* tab */
{ /* move to next tab stop */
shift = self->wm->keys[42] || self->wm->keys[54];
i = -1;
if (self->child_list != 0)
{
i = list_index_of(self->child_list, (long)self->focused_control);
if (shift)
{
i--;
if (i < 0)
{
i = self->child_list->count - 1;
}
} else
{
i++;
if (i >= self->child_list->count)
{
i = 0;
}
}
n = self->child_list->count;
b = (struct xrdp_bitmap *)list_get_item(self->child_list, i);
while (b != self->focused_control && b != 0 && n > 0)
{
n--;
/*****************************************************************************/ /* convert the controls coords to screen coords */ int
xrdp_bitmap_to_screenx(struct xrdp_bitmap *self, int x)
{ int i;
i = x;
while (self != 0)
{
i = i + self->left;
self = self->parent;
}
return i;
}
/*****************************************************************************/ /* convert the controls coords to screen coords */ int
xrdp_bitmap_to_screeny(struct xrdp_bitmap *self, int y)
{ int i;
i = y;
while (self != 0)
{
i = i + self->top;
self = self->parent;
}
return i;
}
/*****************************************************************************/ /* convert the screen coords to controls coords */ int
xrdp_bitmap_from_screenx(struct xrdp_bitmap *self, int x)
{ int i;
i = x;
while (self != 0)
{
i = i - self->left;
self = self->parent;
}
return i;
}
/*****************************************************************************/ /* convert the screen coords to controls coords */ int
xrdp_bitmap_from_screeny(struct xrdp_bitmap *self, int y)
{ int i;
i = y;
while (self != 0)
{
i = i - self->top;
self = self->parent;
}
return i;
}
/*****************************************************************************/ int
xrdp_bitmap_get_screen_clip(struct xrdp_bitmap *self, struct xrdp_painter *painter, struct xrdp_rect *rect, int *dx, int *dy)
{ int ldx; int ldy;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.