hello,
I needed lift in list.
here is the diff with 0.4.1 stable to have one.
just adding fake mod in xrdp.ini to test it.
I reuse some unused field in xrdp_bitmap for _SPECIAL and _COMBO to do it. also, new _LIFT is declare in xrdp_constants.h
regards,
Jean-Marie
diff -r ../xrdp_origin/xrdp-0.4.1/common/xrdp_constants.h xrdp-0.4.1/common/xrdp_constants.h
415a416
> #define WND_TYPE_LIFT    9
diff -r ../xrdp_origin/xrdp-0.4.1/xrdp/xrdp_bitmap.c xrdp-0.4.1/xrdp/xrdp_bitmap.c
23a24,26
>    2009 : adding list lift
>    jean-marie.beguin (at) neocoretech (dot) com
> 
1155a1159,1177
>     /* 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);
>     /* black left line */
>     painter->fg_color = self->wm->black;
>     xrdp_painter_fill_rect(painter, self, 1, 1, 1, self->height - 2);
>     /* black top line */
>     painter->fg_color = self->wm->black;
>     xrdp_painter_fill_rect(painter, self, 1, 1, self->width - 2, 1);
>     /* grey bottom line */
>     painter->fg_color = self->wm->grey;
>     xrdp_painter_fill_rect(painter, self, 1, self->height- 2, self->width-2, 1);
>     /* grey right line */
>     painter->fg_color = self->wm->grey;
>     xrdp_painter_fill_rect(painter, self, self->width - 2, 2, 1, self->height-3);
> 
1157,1176c1179,1271
<     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_text_height(painter, p);
<         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->font->color = self->wm->white;
<         }
<         else
<           painter->font->color = self->wm->black;
<         xrdp_painter_draw_text(painter, self, 2, y, p);
<         y = y + h;
<       }
<     }
---
> 	struct xrdp_bitmap *lift=list_get_item(self->child_list, 0);
> 	if (lift!=0)
> 	{
> 		/* draw the list items */
> 		if (self->popped_from != 0)
> 		{
> 		  y = 2-lift->edit_pos;
> 		  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_text_height(painter, p);
> 			self->item_height = h;
> 			if (i == self->item_index)
> 			{
> 			  painter->fg_color = self->wm->blue;
> 			  xrdp_painter_fill_rect(painter, self, 2, y, self->width-20, h);
> 			  painter->font->color = self->wm->white;
> 			}
> 			else
> 			  painter->font->color = self->wm->black;
> 			xrdp_painter_draw_text(painter, self, 4, y, p);
> 			y = y + h;
> 		  }
> 		}
> 	    /* 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);
> 	}
> 	else
> 	{
> 		/* draw the list items */
> 		if (self->popped_from != 0)
> 		{
> 		  y = 2;
> 		  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_text_height(painter, p);
> 			self->item_height = h;
> 			if (i == self->item_index)
> 			{
> 			  painter->fg_color = self->wm->blue;
> 			  xrdp_painter_fill_rect(painter, self, 2, y, self->width-4, h);
> 			  painter->font->color = self->wm->white;
> 			}
> 			else
> 			  painter->font->color = self->wm->black;
> 			xrdp_painter_draw_text(painter, self, 4, y, p);
> 			y = y + h;
> 		  }
> 		}
> 	}
>   }
>   else if (self->type == WND_TYPE_LIFT) /* 9 lift */
>   {
> 	int liftHeight=16+(self->height-32-self->item_index)*self->edit_pos/(self->parent->popped_from->edit_pos-self->parent->height);
> 
> 	/* draw lift column */
> 	painter->fg_color = self->wm->grey;
> 	xrdp_painter_fill_rect(painter, self,
> 						0, 16,
> 						self->width-2, self->height - 32);
> 	/* draw lift */
> 	painter->fg_color = self->wm->dark_grey;
> 	xrdp_painter_fill_rect(painter, self,
> 						0, liftHeight,
> 						self->width-2, self->item_index);
> 	/* draw up button */
> 	x = 0;
> 	y = 2;
> 	w = self->width-2;
> 	h = 14;
> 	painter->fg_color = self->wm->dark_grey;
> 	xrdp_bitmap_draw_button(self, painter, x, y, w, h, 0);
> 	/* draw down button */
> 	x = 0;
> 	y = self->height-16;
> 	w = self->width-2;
> 	h = 14;
> 	xrdp_bitmap_draw_button(self, painter, x, y, w, h, 0);
> 
>     /* white left line */
>     painter->fg_color = self->wm->white;
>     xrdp_painter_fill_rect(painter, self, 0, 16, 1, self->height-32);
>     /* black right line */
>     painter->fg_color = self->wm->black;
>     xrdp_painter_fill_rect(painter, self, self->width-3, 16, 1, self->height-32);
>     /* white right line */
>     painter->fg_color = self->wm->white;
>     xrdp_painter_fill_rect(painter, self, self->width-1, 16, 2, self->height-32);
1445a1541
> 	struct xrdp_bitmap *lift=list_get_item(self->child_list, 0);
1450c1546,1549
<         i = param2;
---
>     	if (lift!=0)
>     	  i = param2+lift->edit_pos;
>     	else
>     	  i = param2;
1473a1573,1701
>     /* mouse wheel down */
>     else if (lift != 0 && msg == 5)
>     {
>       if (self->popped_from != 0)
>       {
>   		struct xrdp_bitmap *combo=self->popped_from;
> 		int listHeight=combo->edit_pos;
> 		if (lift->edit_pos<listHeight-self->height)
> 		{
> 		  lift->edit_pos+=self->item_height;
> 		  if (lift->edit_pos>listHeight-self->height)
> 			lift->edit_pos=listHeight-self->height;
> 		}
> 		xrdp_bitmap_invalidate(self, 0);
>       }
>     }
>     /* mouse wheel up */
>     else if (lift != 0 && msg == 4)
>     {
>       if (self->popped_from != 0)
>       {
> 		if (lift->edit_pos>0)
> 		{
> 		  lift->edit_pos-=self->item_height;
> 		  if (lift->edit_pos<0)
> 			lift->edit_pos=0;
> 		}
> 		xrdp_bitmap_invalidate(self, 0);
>       }
>     }
>   }
>   else if (self->type == WND_TYPE_LIFT)
>   {
> 	struct xrdp_bitmap *list=self->parent;
>     struct xrdp_bitmap *combo=list->popped_from;
> 	if (msg == WM_LBUTTONDOWN)
> 	{
> 	  if (self->parent->popped_from != 0)
> 	  {
> 		int subUpButton=xrdp_bitmap_to_screeny(self, 16);
> 		int tmp=16+(self->height-32-self->item_index)*self->edit_pos/(self->parent->popped_from->edit_pos-self->parent->height);
> 		int liftHeight=xrdp_bitmap_to_screeny(self, tmp);
> 		int subLift=xrdp_bitmap_to_screeny(self, tmp+self->item_index);
> 		int downButton=xrdp_bitmap_to_screeny(self, list->height-16);
> 		int subDownButton=xrdp_bitmap_to_screeny(self, list->height-2);
> 
> 		int maxX=xrdp_bitmap_to_screenx(self, 18);
> 
> 		if (param1<=maxX)
> 		{
> 		  if (param2<subUpButton)
> 		  {
> 			if (self->edit_pos>0)
> 			{
> 			  self->edit_pos-=list->item_height;
> 			  if (self->edit_pos<0)
> 			  self->edit_pos=0;
> 			}
> 			self->wm->button_down = 0;
> 			xrdp_bitmap_invalidate(self->parent, 0);
> 		  }
> 		  else if (param2<liftHeight)
> 		  {
> 			if (self->edit_pos>0)
> 			{
> 			  self->edit_pos-=list->item_height;
> 			  self->edit_pos-=list->item_height;
> 			  if (self->edit_pos<0)
> 				self->edit_pos=0;
> 			}
> 			self->wm->button_down = 0;
> 			xrdp_bitmap_invalidate(self->parent, 0);
> 		  }
> 		  else if (param2<subLift)
> 		  {
> 			self->state=xrdp_bitmap_from_screeny(self, param2);
> 			xrdp_bitmap_invalidate(self->parent, 0);
> 		  }
> 		  else if (param2<downButton)
> 		  {
> 			int listHeight=combo->edit_pos;
> 			if (self->edit_pos<listHeight-list->height)
> 			{
> 			  self->edit_pos+=list->item_height;
> 			  self->edit_pos+=list->item_height;
> 			  if (self->edit_pos>listHeight-list->height)
> 				self->edit_pos=listHeight-list->height;
> 			}
> 			self->wm->button_down = 0;
> 			xrdp_bitmap_invalidate(self->parent, 0);
> 		  }
> 		  else if (param2<subDownButton)
> 		  {
> 			int listHeight=combo->edit_pos;
> 			if (self->edit_pos<listHeight-list->height)
> 			{
> 			  self->edit_pos+=list->item_height;
> 			  if (self->edit_pos>listHeight-list->height)
> 				self->edit_pos=listHeight-list->height;
> 			}
> 			self->wm->button_down = 0;
> 			xrdp_bitmap_invalidate(self->parent, 0);
> 		  }
> 		}
> 	  }
> 	}
> 	else if (msg == WM_MOUSEMOVE)
>     {
> 	  if (self->state!=0)
> 	  {
> 	    int listHeight=combo->edit_pos;
>         int liftHeight=16+(self->height-32-self->item_index)*self->edit_pos/(self->parent->popped_from->edit_pos-self->parent->height);
> 
> 		self->edit_pos=self->edit_pos+((param2-self->state)*(listHeight-self->height))/(self->height-32-self->item_index);
> 
> 	    self->state=param2;
>         if (self->edit_pos>listHeight-list->height)
> 	      self->edit_pos=listHeight-list->height;
>         if (self->edit_pos<0)
> 	      self->edit_pos=0;
> 	    xrdp_bitmap_invalidate(self->parent, 0);
> 	  }
>     }
> 	else if (msg == WM_LBUTTONUP)
> 	{
> 	  self->wm->button_down=0;
> 	  self->state=0;
> 	  xrdp_bitmap_invalidate(self->parent, 0);
> 	}
diff -r ../xrdp_origin/xrdp-0.4.1/xrdp/xrdp_wm.c xrdp-0.4.1/xrdp/xrdp_wm.c
20a21,23
>    2009 : adding list lift
>    jean-marie.beguin (at) neocoretech (dot) com
> 
887a891
>     struct bitmap *lift=list_get_item(self->popup_wnd->child_list, 0);
890,893c894,896
<       xrdp_bitmap_def_proc(self->popup_wnd, WM_LBUTTONUP, x, y);
<       xrdp_wm_clear_popup(self);
<       self->button_down = 0;
<       return 0;
---
> 	  xrdp_bitmap_def_proc(self->popup_wnd, but, x, y);
> 	  self->button_down = 0;
> 	  return 0;
895c898,924
<     else if (self->popup_wnd != control && down)
---
>     else if (self->popup_wnd == control && down)
>     {
> 	  xrdp_bitmap_def_proc(self->popup_wnd, WM_LBUTTONUP, x, y);
> 	  xrdp_wm_clear_popup(self);
> 	  self->button_down = 0;
> 	  return 0;
>     }
>     else if (lift != 0 && lift == control)
>     {
>       if (down)
>       {
> 		xrdp_bitmap_def_proc(control, WM_LBUTTONDOWN, x, y);
> 		return 0;
>       }
>       else if (but == 1)
>       {
> 		xrdp_bitmap_def_proc(control, WM_LBUTTONUP, x, y);
> 		return 0;
>       }
>       else
> 	  {
> 		xrdp_bitmap_def_proc(control->parent, but, x, y);
> 		self->button_down = 0;
> 		return 0;
> 	  }
>     }
> 	else if (self->popup_wnd != control && down)
1164a1194,1195
>   char *p;
>   int h, i, listHeight;
1174,1185c1205,1268
<   self->popup_wnd = xrdp_bitmap_create(control->width, 100,
<                                        self->screen->bpp,
<                                        WND_TYPE_SPECIAL, self);
<   self->popup_wnd->popped_from = control;
<   self->popup_wnd->parent = self->screen;
<   self->popup_wnd->owner = self->screen;
<   x = xrdp_bitmap_to_screenx(control, 0);
<   y = xrdp_bitmap_to_screeny(control, 0);
<   self->popup_wnd->left = x;
<   self->popup_wnd->top = y + control->height;
<   self->popup_wnd->item_index = control->item_index;
<   list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
---
> 
>   /* check if lift is needed */
>   if (control->type==WND_TYPE_COMBO)
>   {
> 	listHeight = 0;
> 	for (i = 0; i < control->string_list->count; i++)
> 	{
> 	  p = (char*)list_get_item(control->string_list, i);
> 	  h = xrdp_painter_text_height(self->painter, p);
> 	  control->item_height = h;
> 	  listHeight = listHeight + h;
> 	}
> 	control->edit_pos=listHeight;
> 
> 	/* lift needed */
> 	if (listHeight>96)
> 	{
> 	  /* list creation */
> 	  self->popup_wnd = xrdp_bitmap_create(control->width, 100,
> 										   self->screen->bpp,
> 										   WND_TYPE_SPECIAL, self);
> 	  self->popup_wnd->popped_from = control;
> 	  self->popup_wnd->parent = self->screen;
> 	  self->popup_wnd->owner = self->screen;
> 	  x = xrdp_bitmap_to_screenx(control, 0);
> 	  y = xrdp_bitmap_to_screeny(control, 0);
> 	  self->popup_wnd->left = x;
> 	  self->popup_wnd->top = y + control->height;
> 	  self->popup_wnd->item_index = control->item_index;
> 	  list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
> 	  /* lift creation */
> 		struct xrdp_bitmap *lift;
> 		/* lift size */
> 		int liftSize=((self->popup_wnd->height-4)*(self->popup_wnd->height-32))/listHeight;
> 
> 		lift=xrdp_bitmap_create(20, 100,
> 				self->screen->bpp,
> 				WND_TYPE_LIFT, self);
> 		list_add_item(self->popup_wnd->child_list, (long)lift);
> 		lift->parent = self->popup_wnd;
> 		lift->owner = self->screen;
> 		lift->left = control->width-20;
> 		lift->top = 0;
> 		lift->item_index = liftSize;
> 		lift->edit_pos=0;
> 	}
> 	else
> 	{
> 
> 	  self->popup_wnd = xrdp_bitmap_create(control->width, 100,
> 										   self->screen->bpp,
> 										   WND_TYPE_SPECIAL, self);
> 	  self->popup_wnd->popped_from = control;
> 	  self->popup_wnd->parent = self->screen;
> 	  self->popup_wnd->owner = self->screen;
> 	  x = xrdp_bitmap_to_screenx(control, 0);
> 	  y = xrdp_bitmap_to_screeny(control, 0);
> 	  self->popup_wnd->left = x;
> 	  self->popup_wnd->top = y + control->height;
> 	  self->popup_wnd->item_index = control->item_index;
> 	  list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
> 
> 	}
>   }
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
xrdp-devel mailing list
xrdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xrdp-devel

Reply via email to