Exemplo n.º 1
0
/*********************************************************************
*
*       _ChangeWindowPosSize
*/
static void _ChangeWindowPosSize(FRAMEWIN_Handle hWin, int* px, int* py) {
  int dx = 0, dy = 0;
  GUI_RECT Rect;
  WM_GetClientRectEx(hWin, &Rect);
  /* Calculate new size of window */
  if (_HasCaptured & RESIZE_X) {
    dx = (_HasCaptured & REPOS_X) ? (_CaptureX - *px) : (*px - _CaptureX);
  }
  if (_HasCaptured & RESIZE_Y) {
    dy = (_HasCaptured & REPOS_Y) ? (_CaptureY - *py) : (*py - _CaptureY);
  }
  /* Check the minimal size of window */
  if ((Rect.x1 + dx + 1) < MIN_SIZE_X) {
    dx = MIN_SIZE_X - (Rect.x1 + 1);
    *px = _CaptureX;
  }
  if ((Rect.y1 + dy + 1) < MIN_SIZE_Y) {
    dy = MIN_SIZE_Y - (Rect.y1 + 1);
    *py = _CaptureY;
  }
  /* Set new window position */
  if (_HasCaptured & REPOS_X) {
    WM_MoveWindow(hWin, -dx, 0);
  }
  if (_HasCaptured & REPOS_Y) {
    WM_MoveWindow(hWin, 0, -dy);
  }
  /* Set new window size */
  WM_ResizeWindow(hWin, dx, dy);
}
Exemplo n.º 2
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);
      }
    }
  }
}
Exemplo n.º 3
0
/*********************************************************************
*
*       _ToggleFullScreenMode
*
* Purpose:
*   This routine switches between full screen mode and normal mode by hiding or showing the
*   widgets of the dialog, enlarging/shrinking the graph widget and modifying some other
*   attributes of the dialog widgets.
*/
static void _ToggleFullScreenMode(WM_HWIN hDlg) {
  static int FullScreenMode;
  static GUI_RECT Rect;
  static unsigned ScalePos;
  WM_HWIN hGraph, hButton;
  hGraph  = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
  hButton = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0);
  FullScreenMode ^= 1;
  if (FullScreenMode) {
    /* Enter the full screen mode */
    WM_HWIN hClient;
    GUI_RECT RectInside;
    hClient = WM_GetClientWindow(hDlg);
    BUTTON_SetText(hButton, "Back");
    WM_MoveWindow(hButton, 0, 11);
    FRAMEWIN_SetTitleVis(hDlg, 0);
    WM_GetInsideRectEx(hClient, &RectInside);
    WM_GetWindowRectEx(hGraph, &Rect);
    WM_ForEachDesc(hClient, _ForEach, &FullScreenMode); /* Hide all descendants */
    WM_SetWindowPos(hGraph, WM_GetWindowOrgX(hClient), WM_GetWindowOrgX(hClient), RectInside.x1, RectInside.y1);
    ScalePos = GRAPH_SCALE_SetPos(_hScaleH, RectInside.y1 - 105);
  } else {
    /* Return to normal mode */
    BUTTON_SetText(hButton, "Full Screen");
    WM_MoveWindow(hButton, 0, -11);
    WM_ForEachDesc(WM_GetClientWindow(hDlg), _ForEach, &FullScreenMode); /* Show all descendants */
    WM_SetWindowPos(hGraph, Rect.x0, Rect.y0, Rect.x1 - Rect.x0 + 1, Rect.y1 - Rect.y0 + 1);
    FRAMEWIN_SetTitleVis(hDlg, 1);
    GRAPH_SCALE_SetPos(_hScaleH, ScalePos);
  }
}
Exemplo n.º 4
0
//............................................................................
QState Table::ready(Table *me, QEvt const *e) {
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            l_cb_WM_HBKWIN = WM_SetCallback(WM_HBKWIN, &onMainWndGUI);
                            // create the diaglog box and return right away...
            l_hDlg = GUI_CreateDialogBox(l_dialog, GUI_COUNTOF(l_dialog),
                                         &onDialogGUI, 0, 0, 0);
            return Q_HANDLED();
        }
        case Q_EXIT_SIG: {
            GUI_EndDialog(l_hDlg, 0);
            WM_SetCallback(WM_HBKWIN, l_cb_WM_HBKWIN);
            return Q_HANDLED();
        }
        case Q_INIT_SIG: {
            return Q_TRAN(&Table::serving);
        }

        case MOUSE_CHANGE_SIG: {         // mouse change (move or click) event
            GUI_PID_STATE mouse;
            mouse.x = ((MouseEvt const *)e)->xPos;
            mouse.y = ((MouseEvt const *)e)->yPos;
            mouse.Pressed = ((MouseEvt const *)e)->buttonStates;

            GUI_PID_StoreState(&mouse);   // update the state of the Mouse PID

            WM_Exec();            // update the screen and invoke WM callbacks
            return Q_HANDLED();
        }

        // ... hardkey events ...
        case KEY_LEFT_REL_SIG: {                      // hardkey LEFT released
            WM_MoveWindow(l_hDlg, -5, 0);
            WM_Exec();            // update the screen and invoke WM callbacks
            return Q_HANDLED();
        }
        case KEY_RIGHT_REL_SIG: {                    // hardkey RIGHT released
            WM_MoveWindow(l_hDlg, 5, 0);
            WM_Exec();            // update the screen and invoke WM callbacks
            return Q_HANDLED();
        }
        case KEY_DOWN_REL_SIG: {                      // hardkey DOWN released
            WM_MoveWindow(l_hDlg, 0, 5);
            WM_Exec();            // update the screen and invoke WM callbacks
            return Q_HANDLED();
        }
        case KEY_UP_REL_SIG: {                          // hardkey UP released
            WM_MoveWindow(l_hDlg, 0, -5);
            WM_Exec();            // update the screen and invoke WM callbacks
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm::top);
}
Exemplo n.º 5
0
/*******************************************************************
*
*       _LiftUp
*/
static void _LiftUp(int dy) {
  int i, tm;
  for (i = 0; i < (dy/4); i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1, 0, -4);
    WM_MoveWindow(_hWindow2, 0, -4);
    while ((GUI_GetTime() - tm) < 20) {
      WM_Exec();
    }
  }
}
Exemplo n.º 6
0
/*******************************************************************
*
*       _cbWindow

  The callback moves the edit-fiels when a notification message
  was send.
*/
static void _cbWindow(WM_MESSAGE *pMsg) {
  WM_SCROLL_STATE ScrollState;
  switch (pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
      if (WM_GetId(pMsg->hWinSrc) == GUI_ID_HSCROLL) {
        WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
        if (_x != ScrollState.v) {
          int x, y;
          for (y = 0; y < EDIT_MAX_Y; y++) {
            for (x = 0; x < EDIT_MAX_X; x++) {
              WM_MoveWindow(_aahEdit[y][x], _x - ScrollState.v, 0);
            }
          }
          _x = ScrollState.v;
        }
      }
    }
    break;
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLACK);
    GUI_Clear();
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Exemplo n.º 7
0
/*******************************************************************
*
*       _DemoRedrawing
*
* Function description
*   Demonstrates how useful can be a callback
*/
static void _DemoRedrawing(void) {
  int i;
  int tm;
  int tDiff;

  _ChangeInfoText("Demonstrating redrawing");
  GUI_Delay(SPEED);
  _LiftUp(40);
  GUI_Delay(SPEED/3);
  _ChangeInfoText("Using a callback for redrawing");
  GUI_Delay(SPEED/3);
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1,  1,  1);
    WM_MoveWindow(_hWindow2, -1, -1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1, -1, -1);
    WM_MoveWindow(_hWindow2,  1,  1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  GUI_Delay(SPEED/4);
  _LiftDown(30);
  GUI_Delay(SPEED/2);
  _ChangeInfoText("Without redrawing");
  GUI_Delay(SPEED);
  _LiftUp(30);
  GUI_Delay(SPEED/4);
  WM_SetCallback(WM_HBKWIN, _cbBkWindowOld);
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1,  1,  1);
    WM_MoveWindow(_hWindow2, -1, -1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1, -1, -1);
    WM_MoveWindow(_hWindow2,  1,  1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  GUI_Delay(SPEED/3);
  WM_SetCallback(WM_HBKWIN, _cbBkWindow);
  _LiftDown(40);
  GUI_Delay(SPEED);
}
Exemplo n.º 8
0
/*******************************************************************
*
*       _DemoMoveWindow

  Demonstrates the use of WM_MoveWindow
*/
static void _DemoMoveWindow(void) {
  int i, tm, tDiff;
  _ChangeInfoText("WM_MoveWindow()");
  GUI_Delay(SPEED);
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1,  1,  1);
    WM_MoveWindow(_hWindow2, -1, -1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 55; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hWindow1, -1, -1);
    WM_MoveWindow(_hWindow2,  1,  1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  GUI_Delay(SPEED);
}
/*********************************************************************
*
*       WM__UpdateChildPositions
*
* Purpose:
*   Move and/or resize all children of a resized window.
*   What exactly happens to the window depends on how the edges are
*   anchored.
*/
void WM__UpdateChildPositions(WM_Obj* pObj, int dx0, int dy0, int dx1, int dy1) {
  WM_HWIN hChild;
  WM_Obj* pChild;
  int dx, dy, dw, dh;
  for (hChild = pObj->hFirstChild; hChild; hChild = pChild->hNext) {
    int Status;
    GUI_RECT rOld, rNew;
    pChild = WM_H2P(hChild);
    /* Compute size of new rectangle */
    rOld = pChild->Rect;
    rNew = rOld;
    Status = pChild->Status & (WM_SF_ANCHOR_RIGHT | WM_SF_ANCHOR_LEFT);
    switch (Status) {
      case WM_SF_ANCHOR_RIGHT:                      /* Right ANCHOR : Move window with right side */
        rNew.x0 += dx1;
        rNew.x1 += dx1;
        break;
      case WM_SF_ANCHOR_RIGHT | WM_SF_ANCHOR_LEFT:    /* Left & Right ANCHOR: Resize window */
        rNew.x0 += dx0;
        rNew.x1 += dx1;
        break;
      default:                                    /* Left ANCHOR: Move window with left side of parent */
        rNew.x0 += dx0;
        rNew.x1 += dx0;
    }
    Status = pChild->Status & (WM_SF_ANCHOR_TOP   | WM_SF_ANCHOR_BOTTOM);
    switch (Status) {
      case WM_SF_ANCHOR_BOTTOM:                     /* Bottom ANCHOR */
        rNew.y0 += dy1;
        rNew.y1 += dy1;
        break;
      case WM_SF_ANCHOR_BOTTOM | WM_SF_ANCHOR_TOP:    /* resize window */
        rNew.y0 += dy0;
        rNew.y1 += dy1;
        break;
      default:                                    /* Top ANCHOR */
        rNew.y0 += dy0;
        rNew.y1 += dy0;
    }
    /* Set new window position using Move and Resize as required */
    dx = rNew.x0 - rOld.x0;
    dy = rNew.y0 - rOld.y0;
    if (dx || dy) {
      WM_MoveWindow(hChild, dx, dy);
    }
    dw = (rNew.x1 - rNew.x0) - (rOld.x1 - rOld.x0);
    dh = (rNew.y1 - rNew.y0) - (rOld.y1 - rOld.y0);
    if (dw || dh) {
      WM_ResizeWindow(hChild, dw, dh);
    }
  }
}
Exemplo n.º 10
0
/*******************************************************************
*
*       _DemoClipping
*
* Function description
*   Demonstrates clipping at parent borders
*/
static void _DemoClipping(void) {
  int i;
  int tm;
  int tDiff;

  _ChangeInfoText("Demonstrating clipping of child");
  GUI_Delay(SPEED);
  for (i = 0; i < 25; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hChild,  1,  0);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 25; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hChild,  0,  1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 50; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hChild, -1,  0);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 25; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hChild,  0, -1);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  for (i = 0; i < 25; i++) {
    tm = GUI_GetTime();
    WM_MoveWindow(_hChild,  1,  0);
    tDiff = 15 - (GUI_GetTime() - tm);
    GUI_Delay(tDiff);
  }
  GUI_Delay(SPEED);
}
/*******************************************************************
*
*       _MoveWindow
*/
static void _MoveWindow(const char* pText) {
  WM_HWIN hWnd;
  int i;
  /* Create foreground window */
  hWnd = WM_CreateWindow(10, 50, 150, 100, WM_CF_SHOW, _cbWindow, 0);
  GUI_Delay(500);
  /* Move foreground window */
  for (i = 0; i < 40; i++) {
    WM_MoveWindow(hWnd, 2, 2);
    GUI_Delay(10);
  }
  /* Show text before deleting window if we have one */
  if (pText) {
    GUI_DispStringAt(pText, 5, 50);
    GUI_Delay(2500);
  }
  /* Delete foreground window */
  WM_DeleteWindow(hWnd);
  WM_Invalidate(WM_HBKWIN);
  GUI_Exec();
}
Exemplo n.º 12
0
Arquivo: ipc.c Projeto: berkus/acess2
int IPC_Msg_SetWinPos(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
{
	tIPCMsg_SetWindowPos	*info = (void*)Msg->Data;
	tWindow	*win;
	
	ASSERT(Msg->ID == IPCMSG_SETWINPOS);
	
	if(Msg->Size < sizeof(*info))	return -1;
	
	win = IPC_int_GetWindow(Client, Msg->Window);
	if(!win)	return 1;
	
	_SysDebug("info = {..., bSetPos=%i,bSetDims=%i}", info->bSetPos, info->bSetDims);
	
	if(info->bSetPos)
		WM_MoveWindow(win, info->X, info->Y);
	if(info->bSetDims)
		WM_ResizeWindow(win, info->W, info->H);
	
	return 0;
}
Exemplo n.º 13
0
static void _OnTouch(FRAMEWIN_Handle hWin, FRAMEWIN_Obj* pObj, WM_MESSAGE* pMsg) {
  GUI_TOUCH_tState* pState;
  pState = (GUI_TOUCH_tState*)pMsg->Data.p;
  if (pMsg->Data.p) {  /* Something happened in our area (pressed or released) */
    if (pState->Pressed) {
      WM_SetFocus(hWin);
      WM_BringToTop(hWin);
      if (pObj->Flags & FRAMEWIN_SF_MOVEABLE) {
        if (!WM_HasCaptured(hWin)) {
          WM_SetCapture(hWin, 1);
          pObj->CapturePoint.x = pState->x;
          pObj->CapturePoint.y = pState->y;
        } else {
          int dx, dy;
          dx = pState->x - pObj->CapturePoint.x;
          dy = pState->y - pObj->CapturePoint.y;
          WM_MoveWindow(hWin, dx, dy);
        }
      }
    }
  }
}
Exemplo n.º 14
0
	void Window::SetPosition(const gds::Point &p){
		Select();
		WM_MoveWindow(p.x, p.y);
	}
Exemplo n.º 15
0
int Decorator_HandleMessage(tWindow *Window, int Message, int Length, const void *Data)
{
	static tWindow	*btn1_down;
	static enum {
		BTN1_MOVE,
		BTN1_RLEFT,
		BTN1_RRIGHT,
		BTN1_RBOTTOM,
	} btn1_mode;
	switch(Message)
	{
	case WNDMSG_MOUSEMOVE: {
		const struct sWndMsg_MouseMove	*msg = Data;

		if( Window && btn1_down == Window )
		{
			switch(btn1_mode)
			{
			case BTN1_MOVE:	// Move
				WM_MoveWindow(Window, Window->X + msg->dX, Window->Y + msg->dY);
				break;
			case BTN1_RLEFT:	// Resize left
				if( Window->W + msg->dX > 50 )
				{
					WM_MoveWindow(Window, Window->X + msg->dX, Window->Y);
					WM_ResizeWindow(Window, Window->W - msg->dX, Window->H);
				}
				break;
			case BTN1_RRIGHT:	// Resize right
				if( Window->W + msg->dX > 50 )
				{
					WM_ResizeWindow(Window, Window->W + msg->dX, Window->H);
				}
				break;
			case BTN1_RBOTTOM:	// Resize bottom
				if( Window->H + msg->dY > 50 )
				{
					WM_ResizeWindow(Window, Window->W, Window->H + msg->dY);
				}
				break;
			}
			return 0;
		}

		// TODO: Change cursor when hovering over edges

		if(msg->Y >= 0)	return 1;	// Pass

		// TODO: Handle
		return 0; }
	case WNDMSG_MOUSEBTN: {
		const struct sWndMsg_MouseButton	*msg = Data;
		
		// TODO: Do something with other buttons
		// - Window menu for example
		if( msg->Button != 0 )
			return 1;	// pass on

		if( !msg->bPressed )
			btn1_down = 0;		

		#define HOTSPOTR(x,y,w,h) Decorator_INT_CoordInRangeR(msg->X, msg->Y, x, y, w, h)
		#define HOTSPOTA(sx,sy,ex,ey) Decorator_INT_CoordInRange(msg->X, msg->Y, sx, sy, ew, eh)
		// Left resize border
		if( msg->bPressed && HOTSPOTR(-ciSideBorderWidth, -ciTitlebarHeight,
				ciSideBorderWidth, ciTitlebarHeight+Window->H+ciBottomBorderWidth) )
		{
			btn1_down = Window;
			btn1_mode = BTN1_RLEFT;
			return 0;
		}
		// Right resize border
		if( msg->bPressed && HOTSPOTR(Window->W, -ciTitlebarHeight,
			ciSideBorderWidth, ciTitlebarHeight+Window->H+ciBottomBorderWidth) )
		{
			btn1_down = Window;
			btn1_mode = BTN1_RRIGHT;
			return 0;
		}
		// Bottom resize border
		if( msg->bPressed && HOTSPOTR(0, Window->H,
			Window->W, ciTitlebarHeight) )
		{
			btn1_down = Window;
			btn1_mode = BTN1_RBOTTOM;
			return 0;
		}
		// Titlebar buttons
		if( msg->bPressed && Decorator_INT_CoordInRangeR(msg->X, msg->Y, BTN_CLOSE(Window)) )
		{
			WM_SendMessage(NULL, Window, WNDMSG_CLOSE, 0, NULL);
			return 0;
		}
		// Titlebar - Move
		if( msg->bPressed && msg->Y < 0 )
		{
			btn1_down = Window;
			btn1_mode = BTN1_MOVE;
			return 0;
		}
		#undef HOTSPOTR
		#undef HOTSPOTA

		return 1; }
	default:	// Anything unhandled is passed on
		return 1;
	}
}
Exemplo n.º 16
0
//
//  PrintWinCallback
//
static void _cbDialog(WM_MESSAGE *pMsg)
{

		WM_KEY_INFO *KEY;
 	MENU_MSG_DATA * pData;
  switch (pMsg->MsgId)
	 {
			 case USER_MSG_LANGUAGE:
					    //pLanguage = &Lguprintwin[Language];
					    //TEXT_SetText(hPrintText,pLanguage->PrintTitle);
				     break;
			 case WM_PAINT:
									GUI_SetBkColor(GUI_WHITE);
									GUI_Clear();
									GUI_SetFont(&GUI_Font30);
									GUI_SetColor(GUI_BLACK);
				     //GUI_DispStringAt("打印选项",40,25);
				     if (Language == 0)
									{
										  GUI_DispStringAt("打印选项",40,25);
												GUI_DrawLine(0,59,193,59);
												GUI_DrawLine(193,20,193,59);
												GUI_DrawLine(0,20,193,20);
									}
									else  //ENGLISH
									{
										  GUI_DispStringAt("PRINT OPTIONS",30,25);
										  GUI_DrawLine(0,59,240,59);
												GUI_DrawLine(240,20,240,59);
												GUI_DrawLine(0,20,240,20);
									}
									break;
			
				case WM_MENU:
									pData = (MENU_MSG_DATA*)pMsg->Data.p;
									switch (pData->MsgType)
									{
							    case MENU_ON_ITEMSELECT:  // 选中
												    INFO("ISOK");
												    MENU_SetSel(hPrintMenu, 0);
											     PrintActiveId = ID_Print_All;
																switch (pData->ItemId)
																{
																	  case ID_Print_Fre_Int: 
																	  case ID_Print_Fre_Loc1:
																	  case ID_Print_Fre_Loc2:
																			case ID_Print_Fre_Chs : 
																			case ID_Print_Info_Prt:
																			case ID_Print_Site_Prt:
																			case ID_Print_All:
																			case ID_Print_Showing:
																				    pTooltip = &Lgutooltip[Language];
																				    StarPrint = 1;
																								//ptipText = "正在打印......";
																								WM_BringToTop(ToolTip);
																								WM_SetFocus(ToolTip);
																								WM_HideWindow(ToolTip_BUTTON[0]);
																								WM_HideWindow(ToolTip_BUTTON[1]);
																								WM_HideWindow(ToolTipText1);
																								TEXT_SetText(ToolTipText0,pTooltip->Text1[4]);
																			
																			     PrintTimer = WM_CreateTimer(ToolTip,0,2000,0);
																			
																								break;
																}
																break;
										
												case MENU_ON_ITEMACTIVATE:  //高亮
													    PrintActiveId = pData->ItemId;
												     _SetHintText(PrintHintText,PrintActiveId,1);  //设置提示信息
																	switch (pData->ItemId)    //用于修正第三级菜单的窗口位置	
																	{
																					case ID_Print_Site_SiteSet_Prt_0:
																						    if(Language == 0)
																										{
																													if (PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hSiteSet,195,81);
																																PrintMenuThird = 1;
																													}
																										}
																										else  
																										{
																											  if (PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hSiteSet,240,90);
																																PrintMenuThird = 1;
																													}
																										}
																										break;
																								
																					case ID_Print_Info_InfoSet_Prt_0:
																										if (Language == 0)
																										{
																													if(PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hInfoSet,195,121);
																																PrintMenuThird = 1;
																													}
																										}
																										else
																										{
																											  if(PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hInfoSet,240,121);
																																PrintMenuThird = 1;
																													}
																										}
																								  break; 
                     default:
												             WM_DefaultProc(pMsg);
												            break;																								
																	}
																	break;
									  default:
												     WM_DefaultProc(pMsg);
												     break;
									}
         break;
							
			default:		
						WM_DefaultProc(pMsg);
						break;
		}
		WM_DefaultProc(pMsg);
}
Exemplo n.º 17
0
static void _cbProtection_FrameWin(WM_MESSAGE * pMsg) 
{
  switch (pMsg->MsgId)
  {
  case WM_NOTIFY_PARENT:
    {
      WM_HWIN hObjSrc = pMsg->hWinSrc;
      int Id = WM_GetId(hObjSrc);
      int NCode = pMsg->Data.v;
      
      switch (NCode)
      {
      case WM_NOTIFICATION_GOT_FOCUS:
        {
          if (focus_Modbus_settings != hObjSrc)
          {
            /*
            Визначаємо координати об'єкта, який сфокусований
            */
            WM_SCROLL_STATE ScrollState;
            WM_GetScrollState(ScrollBar_Modbus, &ScrollState);

            int y_hWinSrc = _y_cbPickup_Modbus + WM_GetWindowOrgY(pMsg->hWinSrc);
            int y_hWin    = WM_GetWindowOrgY(pMsg->hWin);
            int y_tmp = y_hWinSrc - y_hWin;
            int v_scroll;
            v_scroll = y_tmp/ScrollState.PageSize;
            v_scroll *= ScrollState.PageSize;
        
            if (_y_cbPickup_Modbus != v_scroll)
            {
              int dy = _y_cbPickup_Modbus - v_scroll;
              for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_MODBUS; i++) 
              {
                WM_MoveWindow(*(Modbus_t + i), 0, dy);
                WM_MoveWindow(*(Modbus_v + i), 0, dy);
              }
              WM_MoveWindow(Modbus_d, 0, dy);
            }
            _y_cbPickup_Modbus = v_scroll;
            focus_Modbus_settings = hObjSrc;
            SCROLLBAR_SetValue(ScrollBar_Modbus, v_scroll);
          }
          break;
        }
      case WM_NOTIFICATION_VALUE_CHANGED:
        {
          if (
              (Id == ID_MODBUS_ADDRESS_VALUE) ||
              (Id == ID_MODBUS_TIMEOUT_VALUE)
             )   
          {
            float value = EDIT_GetFloatValue(hObjSrc);

            int  min = 0, max = 0, value_int;
            unsigned int changer_was_made = false;
            
            switch (Id)
            {
            case ID_MODBUS_ADDRESS_VALUE:
              {
                min = KOEF_ADDRESS_MIN;
                max = KOEF_ADDRESS_MAX;
                value_int = (int)(value);
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.RS_comm_addres != value_int)
                   )
                {
                  edit_settings_1.RS_comm_addres = value_int;
                  changer_was_made = true;
                }
                break;
              }
            case ID_MODBUS_TIMEOUT_VALUE:
              {
                min = VALUE_TIME_OUT_1_INTERFACE_MIN;
                max = VALUE_TIME_OUT_1_INTERFACE_MAX;
                value_int = (int)(round(value*10.0f));
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.chTimeOut_RS != value_int)
                   )
                {
                  edit_settings_1.chTimeOut_RS = value_int;
                  changer_was_made = true;
                }
                break;
              }
              default: break;
            }
            
            if (
                (changer_was_made == true) &&
                (current_ekran.edition == 1)
               )    
            {
              //Помічаємо, що дані змінені
              char title[256];
              title[0] = '\0';
              strcat_mal(title, (char *)Modbus_panel_title.ptitle[sel_language]);
              strcat_mal(title, (char *)MODE.ptitle[sel_language]);
              strcat_mal(title, "*");
              FRAMEWIN_SetText(Modbus_FrameWin, title);
              current_ekran.edition = 2;
            }
            
            __info_data info_data;
            EDIT_GetUserData(hObjSrc, &info_data, sizeof(__info_data));
            if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) value_int = abs(value_int);
            if ((value_int >= min) && (value_int <= max))
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_BLACK);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_BLACK);
            }
            else
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_RED);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_RED);
            }
          }
          
          break;
        }
      }

      break;
    }
//  case WM_PAINT:
//    {
//      
//      break;
//    }
  default:
    {
      WM_DefaultProc(pMsg);
      break;
    }
  }
}