void rotaryDriverStartCM(uint16_t cm) { rotaryDriverReset(); set_forward(MOTOR_DEFAULT_TURN_SPEED, MOTOR_DEFAULT_TURN_SPEED); MP._rotary_driver_state |= ROTARY_DRIVER_ACTIVE; MP.rotary_driver_target_ticks = 9.71*(cm)-37.47; setChange(1); }
void rotaryDriverStart(uint16_t ticks) { rotaryDriverReset(); set_forward(MP._originalLspeed, MP._originalLspeed); MP._rotary_driver_state |= ROTARY_DRIVER_ACTIVE; MP.rotary_driver_target_ticks = ticks; setChange(1); }
INT_PTR TquantTablesPageBase::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: if (HIWORD(wParam)==EN_CHANGE && !isSetWindowText) { HWND hed=GetDlgItem(m_hwnd,LOWORD(wParam)); if (hed!=GetFocus()) { return FALSE; } repaint(hed); TwidgetMatrix *item=(TwidgetMatrix*)Twidget::getDlgItem(hed); if (item->id) { int valI; if (eval(hed,1,255,&valI)) { uint8_t *intra8,*inter8,*intra4Y,*inter4Y,*intra4C,*inter4C; getCustomQuantMatrixes(&intra8,&inter8,&intra4Y,&inter4Y,&intra4C,&inter4C); uint8_t *intra,*inter; switch (cbxGetCurSel(IDC_CBX_QUANT_TABLE)) { case 1: intra=intra4Y; inter=inter4Y; break; case 2: intra=intra4C; inter=inter4C; break; default: intra=intra8; inter=inter8; break; } (item->intra?intra:inter)[item->id-1]=(uint8_t)valI; setChange(); } } return TRUE; } break; case WM_CTLCOLOREDIT: { HWND hwnd=HWND(lParam); if (hwnd==GetDlgItem(m_hwnd,IDC_CBX_QUANT_TABLE)) { break; } bool ok=eval(hwnd,1,255); if (!ok) { HDC dc=HDC(wParam); SetBkColor(dc,RGB(255,0,0)); return INT_PTR(getRed()); } else { return FALSE; } } } return Twindow::msgProc(uMsg,wParam,lParam); }
void TffdshowPageDec::onReset(void) { bool wasreset = false; if (page->filterID) if (page->filterPageID) { wasreset |= deciD->resetFilterEx(page->filterID, page->filterPageID) == S_OK; } else { wasreset |= deciD->resetFilter(page->filterID) == S_OK; } wasreset |= page->reset(); page->cfg2dlg(); setChange(); }
void platformFineAdjust(void) { float diff = 0.0; uint16_t ticks = getOrderCurrentTicks(); if(checkRightWall()) { //_stop(); process_sensors(); diff = getIRSensorReadingCM(IR_SENSOR_RF)-getIRSensorReadingCM(IR_SENSOR_RB); if(diff <= -MOTOR_ADJUSTMENT_CM || diff >= MOTOR_ADJUSTMENT_CM) { while(diff <= -MOTOR_ADJUSTMENT_CM || diff >= MOTOR_ADJUSTMENT_CM) { process_sensors(); if(!checkRightWall()) { break; } diff = getIRSensorReadingCM(IR_SENSOR_RF)-getIRSensorReadingCM(IR_SENSOR_RB); if(diff >= MOTOR_ADJUSTMENT_CM ) { _stop(); PWM_SetDC(PLATFORM_LEFT_FORWARD ,PLATFORM_PERIOD_PERCENTAGE*MOTOR_ADJUSTMENT_SPEED*MP._left_side._calibrate_speed); PWM_SetDC(PLATFORM_RIGHT_BACKWARD ,PLATFORM_PERIOD_PERCENTAGE*MOTOR_ADJUSTMENT_SPEED*MP._right_side._calibrate_speed); } else if ( diff <= -MOTOR_ADJUSTMENT_CM) { _stop(); PWM_SetDC(PLATFORM_LEFT_BACKWARD ,PLATFORM_PERIOD_PERCENTAGE*MOTOR_ADJUSTMENT_SPEED*MP._left_side._calibrate_speed); PWM_SetDC(PLATFORM_RIGHT_FORWARD ,PLATFORM_PERIOD_PERCENTAGE*MOTOR_ADJUSTMENT_SPEED*MP._right_side._calibrate_speed); } else { break; } } MP.adjust_state |= PLATFORM_ADJUST_DONE; setOrderCurrentTicks(ticks); resetPIDIntergrator(); _stop(); setChange(1); deactivatePID(); } } }
void TquantTablesPageBase::onLoad(void) { if (dlgGetFile(false,m_hwnd,_(-IDD_QUANT_TABLES,_l("Load quantization matrices")),_l("All matrix files (*.xcm;*.qmatrix;*.cqm;*.txt)\0*.xcm;*.qmatrix;*.txt\0XviD quantization matrices file (*.xcm)\0*.xcm\0ffdshow quantization matrices file (*.qmatrix;*.txt)\0*.qmatrix;*.txt\0Custom quantization matrix (*.cqm)\0*.cqm\0All files (*.*)\0*.*\0"),_l("*.xcm"),matrixflnm,firstdir?matrixdir:_l("."),0)) { firstdir=false; const char_t *error=NULL; size_t readed=0; FILE *f=fopen(matrixflnm,_l("rb")); if (f) { uint8_t *qmatrix_intra_custom,*qmatrix_inter_custom; getCustomQuantMatrixes(&qmatrix_intra_custom,&qmatrix_inter_custom,NULL,NULL,NULL,NULL); if (qmatrix_intra_custom) { readed+=fread(qmatrix_intra_custom,1,64,f); } else { fseek(f,64,SEEK_CUR); readed+=64; } if (qmatrix_inter_custom) { readed+=fread(qmatrix_inter_custom,1,64,f); } else { fseek(f,64,SEEK_CUR); readed+=64; } fclose(f); if (readed!=128) { error=_l("Error while loading quantization matrices"); } } if (error) { err(_(-IDD_QUANT_TABLES,error)); } else { if (readed) { setChange(); } cfg2dlg(); } } }
void pdsp::ScoreSection::setOneShot( int index ) { setChange(index, Behavior::OneShot); }
void pdsp::ScoreSection::setLooping( int index ) { setChange(index, Behavior::Loop); }
void TffdshowPageEnc::showPresets(void) { if (!presets) { presets = new TpresetsEnc; presets->init(); } enum { IDI_MNI_LOAD_ALL = 1000, IDI_MNI_LOAD_PAGE = 2000, IDI_MNI_SAVE_ALL = 3000, IDI_MNI_SAVE_PAGE = 4000, IDI_MNI_MANAGE = 5000 }; HMENU hm = CreatePopupMenu(); int ord = 0; insertSubmenu(hm, ord, _(IDC_BT_PRESET, _l("Load all")), createPresetsSubmenu(IDI_MNI_LOAD_ALL, false)); insertSubmenu(hm, ord, _(IDC_BT_PRESET, _l("Load page")), createPresetsSubmenu(IDI_MNI_LOAD_PAGE, false)); enable(hm, 1, pageIs && page->propsIDs ? true : false); insertSeparator(hm, ord); HMENU hmPresets = createPresetsSubmenu(IDI_MNI_SAVE_ALL, true); enable(hmPresets, 0, false); insertSubmenu(hm, ord, _(IDC_BT_PRESET, _l("Save all")), hmPresets); hmPresets = createPresetsSubmenu(IDI_MNI_SAVE_PAGE, true); enable(hmPresets, 0, false); insertSubmenu(hm, ord, _(IDC_BT_PRESET, _l("Save page")), hmPresets); enable(hm, 4, pageIs && page->propsIDs ? true : false); insertSeparator(hm, ord); insertMenuItem(hm, ord, IDI_MNI_MANAGE, _(IDC_BT_PRESET, _l("Manage presets...")), false); enable(hm, 6, presets->size() >= 2); RECT r; GetWindowRect(GetDlgItem(m_hwnd, IDC_BT_PRESET), &r); POINT p = {0, r.bottom - r.top}; ClientToScreen(GetDlgItem(m_hwnd, IDC_BT_PRESET), &p); int cmd = TrackPopupMenu(hm, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, p.x, p.y, 0, m_hwnd, NULL); PostMessage(m_hwnd, WM_NULL, 0, 0); if (cmd != 0) if (cmd == 5000) { TpresetsEncDlg pdlg(m_hwnd, deci, *presets); } else { int presetnum = cmd % 1000; TpresetEnc *preset = NULL; if (presetnum == 999) { char_t presetName[MAX_PATH] = _l(""); if (inputString(_(IDC_BT_PRESET, _l("Save as new preset")), _(IDC_BT_PRESET, _l("Preset name")), presetName, MAX_PATH) && presetName[0]) { preset = presets->getPreset(presetName); if (!preset) { preset = presets->createPreset(presetName); } } } else { preset = &(*presets)[presetnum]; } if (preset) switch (cmd = cmd / 1000) { case 1: case 2: preset->apply(&localCfg, cmd == 1 ? &*allPropsIDs.begin() : page->propsIDs); setChange(); if (cmd == 1) { codec2dlg(); } selectPage(page); break; case 3: case 4: preset->store(&localCfg, cmd == 3 ? &*allPropsIDs.begin() : page->propsIDs); selectPage(page); presets->save(); break; } } DestroyMenu(hm); }
void RotaryKnob::setChangeString(QString ch) { bool ok = false; double chDouble = ch.toDouble(&ok); if(ok) setChange(chDouble); }
void RotaryKnob::loadSettings(QSettings &settings) { PanelItem::loadSettings(settings); setRef(settings.value("dataref", "").toString()); setChange(settings.value("change", 1).toDouble()); }
INT_PTR TffdshowPageBase::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: { for (ThtiPages::const_iterator htiPage = htiPages.begin(); htiPage != htiPages.end(); htiPage++) { delete *htiPage; } htiPages.clear(); page = NULL; if (arrowsFont) { DeleteObject(arrowsFont); } arrowsFont = NULL; if (hil) { ImageList_Destroy(hil); } hil = NULL; for (int i = 0; i < countof(bmp1); i++) { DeleteObject(bmp1[i]); DeleteObject(bmp2[i]); } break; } case WM_FFONCHANGE: DPRINTF(_l("onChangeParam")); if (wParam == IDFF_alwaysOnTop && IsWindow(dlg)) { SetWindowPos(dlg, lParam ? HWND_TOPMOST : HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if (wParam != 0) { setChange(); } return TRUE; case WM_FFONFRAME: { MSG msg; if (PeekMessage(&msg, m_hwnd, WM_FFONFRAME, WM_FFONFRAME, PM_NOREMOVE)) { return TRUE; // drop msg when next WM_FFONFRAME is already in the message queue. } for (ThtiPages::const_iterator hp = htiPages.begin(); hp != htiPages.end(); hp++) for (TconfPages::const_iterator i = (*hp)->begin(); i != (*hp)->end(); i++) if ((*i)->m_hwnd) { (*i)->onFrame(); } return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BT_HELP: if (HIWORD(wParam) == BN_CLICKED) { onHelp(); return TRUE; } break; } break; case WM_CONTEXTMENU: if (translateTV()) { return TRUE; } break; case WM_NOTIFY: { NMHDR *nmhdr = LPNMHDR(lParam); if (nmhdr->hwndFrom == htv && nmhdr->idFrom == IDC_TV_TREE) switch (nmhdr->code) { case TVN_SELCHANGED: { NMTREEVIEW *nmtv = LPNMTREEVIEW(lParam); if (nmtv->itemNew.hItem) { selectPage(hti2page(nmtv->itemNew.hItem)); return TRUE; } break; } case TVN_ITEMEXPANDING: { NMTREEVIEW *nmtv = LPNMTREEVIEW(lParam); if (nmtv->action == TVE_COLLAPSE) { setDlgResult(TRUE); } return TRUE; } } break; } } return Twindow::msgProc(uMsg, wParam, lParam); }