int do_logical_FunctionBoxChannel(int fx,int fy, int flarg, int fhaut, int space) { for (int df=0;df<5;df++) { if (mouse_x>=fx && mouse_x<=fx+flarg && mouse_y>=(fy + (df*fhaut)+ (space*df)) && mouse_y<=(fy+fhaut + (df*fhaut)+ (space*df)) && mouse_released==0 ) { switch (df) { case 0: //select all if( Midi_Faders_Affectation_Type!=0)//config midi { switch(miditable[0][682]) { case 0: sprintf(thetypinfo,"Note");break; case 1: sprintf(thetypinfo,"Key On");break; case 2: sprintf(thetypinfo,"Key Off");break; case 4: sprintf(thetypinfo,"Ctrl Change");break; } sprintf(string_last_midi_id,"NumPad ALL is Ch: %d Pitch: %d Typ: %s" ,miditable[1][682],miditable[2][682],thetypinfo); attribute_midi_solo_affectation(682,Midi_Faders_Affectation_Mode); } else { simulate_keypress(KEY_Y<<8); } break; case 1://inverse sel if( Midi_Faders_Affectation_Type!=0)//config midi { switch(miditable[0][683]) { case 0: sprintf(thetypinfo,"Note");break; case 1: sprintf(thetypinfo,"Key On");break; case 2: sprintf(thetypinfo,"Key Off");break; case 4: sprintf(thetypinfo,"Ctrl Change");break; } sprintf(string_last_midi_id,"NumPad INV is Ch: %d Pitch: %d Typ: %s" ,miditable[1][683],miditable[2][683],thetypinfo); attribute_midi_solo_affectation(683,Midi_Faders_Affectation_Mode); } else { simulate_keypress(KEY_U<<8); } break; case 2: //to channel funct if(Midi_Faders_Affectation_Type!=0)//config midi { switch(miditable[0][684]) { case 0: sprintf(thetypinfo,"Note");break; case 1: sprintf(thetypinfo,"Key On");break; case 2: sprintf(thetypinfo,"Key Off");break; case 4: sprintf(thetypinfo,"Ctrl Change");break; } sprintf(string_last_midi_id,"NumPad Thru is Ch: %d Pitch: %d Typ: %s" ,miditable[1][684],miditable[2][684],thetypinfo); attribute_midi_solo_affectation(684,Midi_Faders_Affectation_Mode); } else { simulate_keypress(KEY_TAB<<8); } break; case 3: channel_copy(); break; case 4: channel_paste(); break; } mouse_released=1; } } return(0); }
int DoMouseLevel() { if (mouse_z>last_scroll_mouse_for_chan ) { simulate_keypress(KEY_UP << 8); last_scroll_mouse_for_chan= mouse_z; } else if (mouse_z<last_scroll_mouse_for_chan ) { simulate_keypress(KEY_DOWN << 8); last_scroll_mouse_for_chan= mouse_z; } if (window_focus_id==W_BANGER && mouse_x>=X_banger && mouse_x<=X_banger+480 && mouse_y>=Y_banger && mouse_y<=Y_banger+300 )//banger { switch(over_family) { case 0: if(editing_banger_family ==1 && over_banger_event>0) { if(mouse_z>mouse_level_for_event) { bangers_type[index_banger_selected][ over_banger_event-1]++; reset_banger_event(index_banger_selected, over_banger_event-1); constrain_banger_type( over_banger_event-1); position_mouse_z(0); //reset mouse_level_for_event=mouse_z; mouse_level_for_banger=mouse_z; editing_banger_family=0;editing_banger_action=0; } if(mouse_z<mouse_level_for_event) { bangers_type[index_banger_selected][ over_banger_event-1]--; if(bangers_type[index_banger_selected][ over_banger_event-1]<0){bangers_type[index_banger_selected][ over_banger_event-1]=0;}; reset_banger_event(index_banger_selected, over_banger_event-1); position_mouse_z(0); //reset mouse_level_for_event=mouse_z; mouse_level_for_banger=mouse_z; editing_banger_family=0;editing_banger_action=0; } } break; case 1: if(editing_banger_action==1 && over_banger_action>0) { if(mouse_z>mouse_level_for_banger) { position_mouse_z(0);//reset mouse_level_for_banger=mouse_z; mouse_level_for_event=mouse_z; editing_banger_family=0;editing_banger_action=0; bangers_action[index_banger_selected][over_banger_action-1]++; reset_banger_params(index_banger_selected,over_banger_action-1); constrain_banger_param(over_banger_action-1); } if(mouse_z<mouse_level_for_banger) { position_mouse_z(0);//reset mouse_level_for_banger=mouse_z; mouse_level_for_event=mouse_z; bangers_action[index_banger_selected][over_banger_action-1]--; if(bangers_action[index_banger_selected][over_banger_action]<0){bangers_action[index_banger_selected][over_banger_action-1]=0;} reset_banger_params(index_banger_selected,over_banger_action-1); } } break; default: break; } } else { mouse_level_for_event=mouse_z; mouse_level_for_banger=mouse_z; editing_banger_family=0;editing_banger_action=0; } return(0); }
/* * Update the GUI. * Passes all input to the relevant widgets. * Must be called frequently after a GUI is created. * Returns 0 normally, or if a widget requests, * it returns that widget. It's up to the caller to * query the widget as to why it wanted to return. */ TGUIWidget* tguiUpdate() { long currTime = tguiCurrentTimeMillis(); long elapsed = currTime - tguiLastUpdate; tguiLastUpdate = currTime; tguiClearDirtyRectangle(); if (tguiActiveWidget) { int key; while (keypressed()) { key = readkey(); keyBuffer.push_back(key); } for (unsigned int i = 0; i < keyBuffer.size(); i++) { key = keyBuffer[i]; if (!tguiActiveWidget->handleKey(key)) { simulate_keypress(key); } } keyBuffer.clear(); } for (unsigned int i = 0; i < activeGUI->widgets.size(); i++) { TGUIWidget* widget = activeGUI->widgets[i]; unsigned int retVal = widget->update(elapsed); switch (retVal) { case TGUI_CONTINUE: break; case TGUI_RETURN: return widget; } std::vector<int>* hotkeys = widget->getHotkeys(); if (hotkeys) { for (unsigned int j = 0; j < hotkeys->size(); j++) { int hotkey = (*hotkeys)[j]; if (tguiHotkeyPressed(hotkey)) widget->handleHotkey(hotkey); } } } if (tguiMouseReleased) { int saved_mouse_b = mouse_b; int saved_mouse_x = mouse_x; int saved_mouse_y = mouse_y; if (saved_mouse_b) { TGUIWidget* widget = tguiFindPixelOwner(saved_mouse_x, saved_mouse_y); if (widget) { tguiSetFocus(widget); tguiActiveWidgetClickedPoint.x = saved_mouse_x - widget->getX(); tguiActiveWidgetClickedPoint.y = saved_mouse_y - widget->getY(); tguiMouseButton = saved_mouse_b; if (!widget->getParent()) tguiRaiseWidget(widget); widget->mouseDown(); tguiClickedWidget = widget; } tguiMouseReleased = false; } } else { int saved_mouse_b = mouse_b; int saved_mouse_x = mouse_x; int saved_mouse_y = mouse_y; if (!saved_mouse_b) { if (tguiClickedWidget) { tguiMouseReleasePoint.x = saved_mouse_x; tguiMouseReleasePoint.y = saved_mouse_y; int relativeX; int relativeY; if (tguiPointOnWidget(tguiActiveWidget, saved_mouse_x, saved_mouse_y)) { relativeX = saved_mouse_x - tguiActiveWidget->getX(); relativeY = saved_mouse_y - tguiActiveWidget->getY(); } else { relativeX = -1; relativeY = -1; } tguiActiveWidget->mouseUp(relativeX, relativeY); tguiClickedWidget = 0; int x1 = tguiActiveWidget->getX(); int y1 = tguiActiveWidget->getY(); int x2 = tguiActiveWidget->getX()+tguiActiveWidget->getWidth(); int y2 = tguiActiveWidget->getY()+tguiActiveWidget->getHeight(); tguiUpdateDirtyRectangle(x1, y1, x2, y2); } tguiMouseReleased = true; } } TGUIWidget* hoverWidget = tguiFindPixelOwner(mouse_x, mouse_y); if (hoverWidget) { if (tguiHoverWidget && hoverWidget != tguiHoverWidget) { tguiHoverWidget->draw(); tguiMakeDirty(tguiHoverWidget); } if (hoverWidget->acceptsHover()) { hoverWidget->draw(); tguiMakeDirty(hoverWidget); } tguiHoverWidget = hoverWidget; } return 0; }