Beispiel #1
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);
  }
}
static int _ForwardMouseOverMsg(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) {
    GUI_PID_STATE* pState = (GUI_PID_STATE *)pMsg->Data.p;
    WM_HWIN hBelow;
    pState->x += WM_GetWindowOrgX(hWin);
    pState->y += WM_GetWindowOrgY(hWin);
    hBelow = WM_Screen2hWin(pState->x, pState->y);
    if (hBelow && (hBelow != hWin)) {
        pState->x -= WM_GetWindowOrgX(hBelow);
        pState->y -= WM_GetWindowOrgY(hBelow);
        WM__SendMessage(hBelow, pMsg);
        return 1;
    }
    return 0;
}
/*********************************************************************
*
*       _cbWin
*
* Purpose:
*   Callback routine of window which draws the content of the memory device
*/
static void _cbWin(WM_MESSAGE * pMsg) {
  WM_HWIN hWin;
  int xPos, yPos, xSize, ySize;
  GUI_MEMDEV_Handle hMem;

  hWin = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    //
    // Get window position
    //
    xPos = WM_GetWindowOrgX(hWin);
    yPos = WM_GetWindowOrgY(hWin);
    xSize = WM_GetWindowSizeX(hWin);
    ySize = WM_GetWindowSizeY(hWin);
    //
    // Draw memory device
    //
    WINDOW_GetUserData(hWin, &hMem, sizeof(hMem));
    GUI_MEMDEV_WriteAt(hMem, xPos, yPos);
    //
    // Draw surrounding frame
    //
    GUI_DrawRect(0, 0, xSize - 1, ySize - 1);
    break;
  }
}
/*********************************************************************
*
*       _cbTransWindow
*/
static void _cbTransWindow(WM_MESSAGE* pMsg) {
  static GUI_PID_STATE   StateOld;
  GUI_PID_STATE        * pState;
  GUI_PID_STATE          StateNew;
  GUI_PID_STATE          State;
  WM_HWIN                hBelow;
  WM_HWIN                hWin;
  
  hWin = pMsg->hWin;
  GUI_PID_GetState(&StateNew);
  State    = ((StateNew.x == -1) && (StateNew.y == -1)) ? StateOld : StateNew;
  StateOld = State;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    State.x -= WM_GetWindowOrgX(hWin);
    State.y -= WM_GetWindowOrgY(hWin);
    _DrawEye(EYE_X1, EYE_Y, State.x, State.y, EYE_RX, EYE_RY);
    _DrawEye(EYE_X2, EYE_Y, State.x, State.y, EYE_RX, EYE_RY);
    break;
  case WM_TOUCH:
    if (pMsg->Data.p) {
      pState = (GUI_PID_STATE *)pMsg->Data.p;
      if (pState->Pressed) {
        if (!_ClickedOutsideArea(pState->x, pState->y) || WM_HasCaptured(hWin)) {
          WM_SetCaptureMove(hWin, pState, MIN_VISIBILITY, 0);
        } else {
          //
          // Transfer the message to the underlying window, since the transparent area has been clicked
          //
          hBelow = WM_Screen2hWinEx(hWin, State.x, State.y);
          if (hBelow) {
            pState->x = State.x - WM_GetWindowOrgX(hBelow);
            pState->y = State.y - WM_GetWindowOrgY(hBelow);
            WM_SendMessage(hBelow, pMsg);
          }
        }
      }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Beispiel #5
0
/*********************************************************************
*
*       MENU_Popup
*/
void MENU_Popup(MENU_Handle hObj, WM_HWIN hDestWin, int x, int y, int xSize, int ySize, int Flags) {
  GUI_USE_PARA(Flags);
  if (hObj && hDestWin) {
    MENU_Obj* pObj;
    WM_LOCK();
    pObj = MENU_H2P(hObj);
    if (pObj) {
      pObj->Flags  |= MENU_SF_POPUP;
      pObj->Width   = ((xSize > 0) ? xSize : 0);
      pObj->Height  = ((ySize > 0) ? ySize : 0);
      x            += WM_GetWindowOrgX(hDestWin);
      y            += WM_GetWindowOrgY(hDestWin);
      MENU_SetOwner(hObj, hDestWin);
      WM_AttachWindowAt(hObj, WM_HBKWIN, x, y);
      MENU__SendMenuMessage(hDestWin, hObj, MENU_ON_OPEN, 0);
    }
    WM_UNLOCK();
  }
}
/*********************************************************************
*
*       _cbCallbackFramewin
*
* Purpose:
*   Handles the scroll messages of the scrollbar
*/
static void _cbCallbackFramewin(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_NOTIFY_PARENT:
      if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
        if (pMsg->hWinSrc == WM_GetScrollbarH(hDlg)) {
          int xPos, yPos;
          WM_SCROLL_STATE ScrollState;
          WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
          xPos = WM_GetWindowOrgX(WM_GetParent(_hDlg)) - ScrollState.v;
          yPos = WM_GetWindowOrgY(_hDlg);
          WM_MoveTo(_hDlg, xPos, yPos);
        }
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Beispiel #7
0
/*********************************************************************
*
*       WM_GetOrgX
*/
int WM_GetOrgX(void) {
  return WM_GetWindowOrgX(GUI_Context.hAWin);
}
static void DistortionProc(WM_MESSAGE* pMsg)
{
	int x, y;
	int NCode,Id;
	ProcessCommComponent(pMsg, &hCOMPcomm);
	switch (pMsg->MsgId)
	{
	case WM_CREATE:
		DistortionCreateItems(pMsg->hWin);
		break;
	case WM_DELETE:
		DistortionDeleteItems();
		break;
	case WM_PAINT:
		GUI_SetBkColor(GUI_BLACK);
		GUI_Clear();
		GUI_SetTextMode(GUI_TEXTMODE_TRANS);
		GUI_DrawBitmap(&bmEMPTYTITLEBAR, 0, 0);
		x = 222;
		y = bmEMPTYTITLEBAR.YSize;
		GUI_DrawBitmap(&bmDISTYPEAREA, x, y);
		GUI_SetFont(&GUI_Font32B_ASCII);
		x = WM_GetWindowSizeX(pMsg->hWin);
		{
			std::string title("Distortion");
			GUI_DispStringHCenterAt(GetTitleWithPreset(title).c_str(), x / 2, 5);
		}
		y += 20;
		GUI_DispStringHCenterAt(strDistype[disIndex], x / 2, y);
		break;
	case WM_NOTIFY_PARENT:
		if(DispatchCommComponent(pMsg,&hCOMPcomm))
		{
			Id = WM_GetId(pMsg->hWinSrc);
			NCode = pMsg->Data.v;
			switch(NCode)
			{
			case WM_NOTIFICATION_CLICKED:
				DEBUG_STDOUT("Distortion button clicked!");
				break;
			case WM_NOTIFICATION_RELEASED:
				switch(Id)
				{
				case DISTORTION_ID_LEFTARROW:
					--disIndex;
					if(0>disIndex)
					{
						disIndex = sizeof(strDistype)/4-1;
					}
					WM_InvalidateRect(pMsg->hWin, &rectDisType);
					DistortionSetType(DistortionGetFX(),disIndex);
					break;
				case DISTORTION_ID_RIGHTARROW:
					++disIndex;
					if(sizeof(strDistype)/4 <= disIndex)
					{
						disIndex = 0;
					}
					WM_InvalidateRect(pMsg->hWin, &rectDisType);
					DistortionSetType(DistortionGetFX(),disIndex);
					break;
				case COMMON_ID_CHECKON:
					DistortionOn(DistortionGetFX(), MisaCheckbox_GetStatus(hCOMPcomm.hCheckOn)?true:false);
					break;
				case COMMON_ID_FX1:
				case COMMON_ID_FX2:
				case COMMON_ID_CLOSE:
					UpdateSynthSettingEx(MISAMODULE_DISTORTION);
					break;
				case CTL_NONE_ID:
				case CTL_TOUCH_X_ID:
				case CTL_TOUCH_Y_ID:
				case CTL_DRAG_X_ID:
				case CTL_DRAG_Y_ID:
				case CTL_BALL_X_ID:
				case CTL_BALL_Y_ID:
				case CTL_VARIATION_ID:
					DistortionControlMenuProc(Id);
					break;
#if 0
				case DISTORTION_ID_PROGDRIVE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetDrive(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGTONE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetTone(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGLEVEL:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetLevel(DistortionGetFX(),x<127?x:127);
					break;
#endif
				default:
					;
				}
				DEBUG_STDOUT("Distortion button released!");
				break;
			case WM_NOTIFICATION_VALUE_CHANGED:
				switch(Id)
				{
				case DISTORTION_ID_PROGDRIVE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetDrive(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGTONE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetTone(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGLEVEL:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetLevel(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGNOISEREDUCTION:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionNoiseReduction(DistortionGetFX(),x);
					break;
				case DISTORTION_ID_PROGBOOSTER:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetBooster(DistortionGetFX(),x<127?x/32:3);
					break;
				default:
					;
				}
				break;
			case WM_NOTIFICATION_SEL_CHANGED:
				if(hDistortionItems[DISTORTION_PROGNOISEREDUCTION]!=pMsg->hWinSrc && hDistortionItems[DISTORTION_PROGBOOSTER]!=pMsg->hWinSrc)
				{
					std::vector<int> effect;
					x = WM_GetWindowOrgX(pMsg->hWinSrc)+50;
					y = WM_GetWindowOrgY(pMsg->hWinSrc)+340;
					MisaSetcontrolmenu_Popup(pMsg->hWin,pMsg->hWinSrc,x,y);
					effect = SynthFindEffect(SynthTranslateEffect(Id),DistortionGetFX());
					y = effect.size();
					for(x=0;x<y;x++)
					{
						if(-1 != effect[x])
						{
							MisaMenu_SetStatus(AssigneMentMenuTranslate(effect[x]&0x000000FF),2,0,(effect[x]>>8)&0x000000FF);
							MisaMenu_SetStatus(CTL_VARMIN,0,(effect[x]>>16)&0x000000FF,(effect[x]>>8)&0x000000FF);
							MisaMenu_SetStatus(CTL_VARMAX,0,(effect[x]>>24)&0x000000FF,(effect[x]>>8)&0x000000FF);
						}
					}
				}
				break;
			}