예제 #1
0
/*********************************************************************
*
*       WM_SetCaptureMove
*/
void WM_SetCaptureMove(WM_HWIN hWin, const GUI_PID_STATE* pState, int MinVisibility) {
  if (!WM_HasCaptured(hWin)) {
    WM_SetCapture(hWin, 1);        /* Set capture with auto release */
    WM__CapturePoint.x = pState->x;
    WM__CapturePoint.y = pState->y;
  } else {                         /* Moving ... let the window move ! */
    int dx, dy;
    dx = pState->x - WM__CapturePoint.x;
    dy = pState->y - WM__CapturePoint.y;
    /* make sure at least a part of the windows stays inside of its parent */
    if (MinVisibility == 0) {
      WM_MoveWindow(hWin, dx, dy);
    } else {
      GUI_RECT Rect, RectParent;
      /* make sure at least a part of the windows stays inside of its parent */
      WM_GetWindowRectEx(hWin, &Rect);
      WM_GetWindowRectEx(WM_GetParent(hWin), &RectParent);
      GUI_MoveRect(&Rect, dx, dy);
      GUI__ReduceRect(&RectParent, &RectParent, MinVisibility);
      if (GUI_RectsIntersect(&Rect, &RectParent)) {
        WM_MoveWindow(hWin, dx, dy);
      }
    }
  }
}
예제 #2
0
파일: GUICurs.c 프로젝트: Jaly314/CH-K-Lib
/*********************************************************************
*
*       _TempHide
*
* Purpose:
*   Hide cursor if a part of the given rectangle is located in the
*   rectangle used for the cursor. This routine is called automatically
*   by the window manager. This way the window manager can
*   automatically make sure that the cursor is always displayed
*   correctly.
*
* Params:
*   pRect   Rectangle under consideration
*
* Return value:
*   0:      No action taken
*           Cursor was not visible or not affected because rectangles
*           did not overlap
*   1:      Cursor hidden -> WM needs to restore cursor after
*           drawing operation
*/
static char _TempHide(const GUI_RECT* pRect) {
  if (!_CursorIsVis) {
    return 0;             /* Cursor not visible -> nothing to do */
  }
  if ((pRect == NULL) || GUI_RectsIntersect(pRect, &_Rect)) {
    _Hide();              /* Cursor needs to be hidden */
    return 1;
  }
  return 0;               /* Cursor not affected -> nothing to do */
}
예제 #3
0
/*********************************************************************
*
*       _NotifyVisChanged
*
* Description
*   Notify all descendents
*/
static void _NotifyVisChanged(WM_HWIN hWin, GUI_RECT * pRect) {
  WM_Obj* pWin;

  for (hWin = WM_GetFirstChild(hWin); hWin; hWin = pWin->hNext) {
    pWin = WM_H2P(hWin);
    if (pWin->Status & WM_SF_ISVIS) {
      if (GUI_RectsIntersect(&pWin->Rect, pRect)) {
        WM__SendMsgNoData(hWin, WM_NOTIFY_VIS_CHANGED);             /* Notify window that visibility may have changed */
        _NotifyVisChanged(hWin, pRect);
      }
    }
  }
}
/*********************************************************************
*
*        _WindowSiblingsOverlapRect
*
*/
static char _WindowSiblingsOverlapRect(WM_HWIN iWin, GUI_RECT* pRect) {
  WM_Obj* pWin;
  for (; iWin; iWin = pWin->hNext) { 
    int Status = (pWin = WM_H2P(iWin))->Status;
    /* Check if this window affects us at all */    
    if (Status & WM_SF_ISVIS) {
      /* Check if this window affects us at all */    
      if (GUI_RectsIntersect(pRect, &pWin->Rect)) {
        return 1;
      }
    }
  }
  return 0;
}
예제 #5
0
/*********************************************************************
*
*       _DispLine_UC
*/
static void _DispLine_UC(const U16 GUI_UNI_PTR *s, int Len, const GUI_RECT *pRect) {
  if (GUI_Context.pClipRect_HL[GUI_Context.SelLayer]) {
    if (GUI_RectsIntersect(GUI_Context.pClipRect_HL[GUI_Context.SelLayer], pRect) == 0)
      return;
  }
  {
    U16 c0;
	c0=*s;  
	if((c0 == '\n') || (c0 == '\r')) //modified by Derek 2010.12.02.10:10
	{
		GUI_DispNextLine();
	}
	else
	{
		while (--Len >=0) 
		{
      		c0=*s++;
      		GL_DispChar(c0);
    	}
	}
	
    
  }
}
예제 #6
0
/*********************************************************************
*
*       _DispLine
*/
static void _DispLine(const char GUI_UNI_PTR *s, int MaxNumChars, const GUI_RECT *pRect) {
  /* Check if we have anything to do at all ... */
  if (GUI_Context.pClipRect_HL) {
    if (GUI_RectsIntersect(GUI_Context.pClipRect_HL, pRect) == 0)
      return;
  }

 // #if GUI_COMPILER_SUPPORTS_FP
  //if (GUI_Context.pAFont->pafEncode) {
 //  GUI_Context.pAFont->pafEncode->pfDispLine(s, MaxNumChars);
 // } else {
 // #else
  {
 // #endif
    U16 Char;
    while (--MaxNumChars >= 0) {
      Char = GUI_UC__GetCharCodeInc(&s);
      GUI_Context.pAFont->pfDispChar(Char);
      if (GUI_pfDispCharStyle) {
        GUI_pfDispCharStyle(Char);
      }
    }
  }
}
예제 #7
0
파일: wm.c 프로젝트: uKingSky/KingSky
static int FindNext_IVR(void) {
  int hParent;
  int iWin;
  GUI_RECT r;
  U8 Status;
  WM_Obj* pWin;
  WM_Obj* pAWin;
  WM_Obj* pParent;
  r = ClipContext.CurRect;  /* temps  so we do not have to work with pointers too much */
  /*
     STEP 1:
       Set the next position which could be part of the next IVR
       This will be the first unhandle pixel in reading order, i.e. next one to the right
       or next one down if we are at the right border.
  */
  if (ClipContext.Cnt == 0) {       /* First IVR starts in upper left */
    r.x0 = ClipContext.ClientRect.x0;
    r.y0 = ClipContext.ClientRect.y0;
  } else {
    r.x0 = ClipContext.CurRect.x1+1;
    r.y0 = ClipContext.CurRect.y0;
    if (r.x0 > ClipContext.ClientRect.x1) {
NextStripe:  /* go down to next stripe */
      r.x0 = ClipContext.ClientRect.x0;
      r.y0 = ClipContext.CurRect.y1+1;
    }
  }
  /*
     STEP 2:
       Check if we are done completely.
  */
  if (r.y0 >ClipContext.ClientRect.y1)
    return 0;
  /* STEP 3:
       Find out the max. height (r.y1) if we are at the left border.
       Since we are using the same height for all IVRs at the same y0,
       we do this only for the leftmost one.
  */
  pAWin = WM_H2P(GUI_Context.hAWin);
  if (r.x0 == ClipContext.ClientRect.x0) {
    r.y1 = ClipContext.ClientRect.y1;
    r.x1 = ClipContext.ClientRect.x1;
    /* Iterate over all windows which are above */
    /* Check all siblings above (Iterate over Parents and top siblings (hNext) */
    for (hParent = GUI_Context.hAWin; hParent; hParent = pParent->hParent) {
      pParent = WM_H2P(hParent);
      for (iWin= pParent->hNext; iWin !=0; iWin = pWin->hNext) { 
        Status = (pWin = WM_H2P(iWin))->Status;
        /* Check if this window affects us at all */    
        if ((Status & WM_SF_ISVIS)  && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {
          if (pWin->Rect.y0 > r.y0) {
            ASSIGN_IF_LESS(r.y1, pWin->Rect.y0-1);      /* Check upper border of window */
          } else {
            ASSIGN_IF_LESS(r.y1, pWin->Rect.y1);        /* Check lower border of window */
          }
        }
      }
    }
    /* Check all children */
    for (iWin= pAWin->hFirstChild; iWin !=0; iWin = pWin->hNext) { 
      Status = (pWin = WM_H2P(iWin))->Status;
      /* Check if this window affects us at all */    
      if ((Status & WM_SF_ISVIS)  && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {
        if (pWin->Rect.y0 > r.y0) {
          ASSIGN_IF_LESS(r.y1, pWin->Rect.y0-1);      /* Check upper border of window */
        } else {
          ASSIGN_IF_LESS(r.y1, pWin->Rect.y1);        /* Check lower border of window */
        }
      }
    }
  }
  /* 
    STEP 4
      Find out x0 for the given y0, y1 by iterating over windows above.
      if we find one that intersects, adjust x0 to the right.
  */
Find_x0:
  r.x1 = r.x0;
  /* Iterate over all windows which are above */
  /* Check all siblings above */
    for (hParent = GUI_Context.hAWin; hParent; hParent = pParent->hParent) {
    pParent = WM_H2P(hParent);
    for (iWin= pParent->hNext; iWin !=0; iWin = pWin->hNext) { 
      Status = (pWin = WM_H2P(iWin))->Status;
      if ( (Status & WM_SF_ISVIS) && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {     /* Check if this window affects us at all */
        r.x0 = pWin->Rect.x1+1;
        goto Find_x0;
      }
    }
  }
  /* Check all children */
  for (iWin= pAWin->hFirstChild; iWin !=0; iWin = pWin->hNext) { 
    Status = (pWin = WM_H2P(iWin))->Status;
    if ( (Status & WM_SF_ISVIS) && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {     /* Check if this window affects us at all */
      r.x0 = pWin->Rect.x1+1;
      goto Find_x0;
    }
  }
  /* 
   STEP 5:
     If r.x0 out of right border, this stripe is done. Set next stripe and goto STEP 2
     Find out x1 for the given x0, y0, y1
  */
  r.x1 = ClipContext.ClientRect.x1;
  if (r.x1 < r.x0) {/* horizontal border reached ? */
    ClipContext.CurRect = r;
    goto NextStripe;
  }    
  /* 
   STEP 6:
     Find r.x1. We have to Iterate over all windows which are above
  */
  /* Check all siblings above (Iterate over Parents and top siblings (hNext) */
  for (hParent = GUI_Context.hAWin; hParent; hParent = pParent->hParent) {
    pParent = WM_H2P(hParent);
    for (iWin= pParent->hNext; iWin !=0; iWin = pWin->hNext) { 
      Status = (pWin = WM_H2P(iWin))->Status;
      if (    (Status & WM_SF_ISVIS) && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {     /* Check if this window affects us at all */
        r.x1 = pWin->Rect.x0-1;    
      }
    }
  }
  /* Check all children */
  for (iWin= pAWin->hFirstChild; iWin !=0; iWin = pWin->hNext) { 
    Status = (pWin = WM_H2P(iWin))->Status;
    if (    (Status & WM_SF_ISVIS) && (!(Status & WM_SF_HASTRANS)) && GUI_RectsIntersect(&r, &pWin->Rect)) {     /* Check if this window affects us at all */
      r.x1 = pWin->Rect.x0-1;    
    }
  }
  /* We are done. Return the rectangle we found in the ClipContext. */
  if (ClipContext.Cnt >200) {
    return 0;  /* error !!! This should not happen !*/
  }
  ClipContext.CurRect = r;
  return 1;  /* IVR is valid ! */
}