/** * mouse wheel event. zooms in/out or scrolls when * shift or ctrl is pressed. */ void QG_GraphicView::wheelEvent(QWheelEvent *e) { //RS_DEBUG->print("wheel: %d", e->delta()); //printf("state: %d\n", e->state()); //printf("ctrl: %d\n", Qt::ControlButton); if (container==NULL) { return; } RS_Vector mouse = toGraph(RS_Vector(e->x(), e->y())); #if QT_VERSION >= 0x050200 QPoint numPixels = e->pixelDelta(); // high-resolution scrolling triggers Pan instead of Zoom logic isSmoothScrolling |= !numPixels.isNull(); if (isSmoothScrolling) { if (e->phase() == Qt::ScrollEnd) isSmoothScrolling = false; if (!numPixels.isNull()) { if (e->modifiers()==Qt::ControlModifier) { // Hold ctrl to zoom. 1 % per pixel double v = -numPixels.y() / 100.; RS2::ZoomDirection direction; double factor; if (v < 0) { direction = RS2::Out; factor = 1-v; } else { direction = RS2::In; factor = 1+v; } setCurrentAction(new RS_ActionZoomIn(*container, *this, direction, RS2::Both, mouse, factor)); } else { // otherwise, scroll //scroll by scrollbars: issue #479 hScrollBar->setValue(hScrollBar->value() - numPixels.x()); vScrollBar->setValue(vScrollBar->value() - numPixels.y()); // setCurrentAction(new RS_ActionZoomScroll(numPixels.x(), numPixels.y(), // *container, *this)); } redraw(); } e->accept(); return; } #endif if (e->delta() == 0) { // A zero delta event occurs when smooth scrolling is ended. Ignore this e->accept(); return; } bool scroll = false; RS2::Direction direction = RS2::Up; // scroll up / down: if (e->modifiers()==Qt::ControlModifier) { scroll = true; switch(e->orientation()){ case Qt::Horizontal: direction=(e->delta()>0)?RS2::Left:RS2::Right; break; default: case Qt::Vertical: direction=(e->delta()>0)?RS2::Up:RS2::Down; } } // scroll left / right: else if (e->modifiers()==Qt::ShiftModifier) { scroll = true; switch(e->orientation()){ case Qt::Horizontal: direction=(e->delta()>0)?RS2::Up:RS2::Down; break; default: case Qt::Vertical: direction=(e->delta()>0)?RS2::Left:RS2::Right; } } if (scroll) { //scroll by scrollbars: issue #479 switch(direction){ case RS2::Left: case RS2::Right: hScrollBar->setValue(hScrollBar->value()+e->delta()); break; default: vScrollBar->setValue(vScrollBar->value()+e->delta()); } // setCurrentAction(new RS_ActionZoomScroll(direction, // *container, *this)); } // zoom in / out: else if (e->modifiers()==0) { if (e->delta()>0) { setCurrentAction(new RS_ActionZoomIn(*container, *this, RS2::In, RS2::Both, mouse)); } else { setCurrentAction(new RS_ActionZoomIn(*container, *this, RS2::Out, RS2::Both, mouse)); } } redraw(); e->accept(); }
/** * Show is called automatically when the window is created. */ void WindowMainMenu::show() { redraw(); }
int EnvelopeFreeEdit::handle(int event) { const int x_=Fl::event_x()-x(); const int y_=Fl::event_y()-y(); static Fl_Widget *old_focus; int key; switch(event) { case FL_ENTER: old_focus=Fl::focus(); Fl::focus(this); // Otherwise the underlying window seems to regrab focus, // and I can't see the KEYDOWN action. return 1; case FL_LEAVE: Fl::focus(old_focus); break; case FL_KEYDOWN: case FL_KEYUP: key = Fl::event_key(); if (key==FL_Control_L || key==FL_Control_R){ ctrldown = (event==FL_KEYDOWN); redraw(); if (pair!=NULL) pair->redraw(); } break; case FL_PUSH: currentpoint=getnearest(x_,y_); cpx=x_; cpdt=Penvdt[currentpoint]; lastpoint=currentpoint; redraw(); if (pair) pair->redraw(); return 1; case FL_RELEASE: currentpoint=-1; redraw(); if (pair) pair->redraw(); return 1; case FL_MOUSEWHEEL: if (lastpoint>=0) { if (!ctrldown) { int ny = Penvval[lastpoint] - Fl::event_dy(); ny = ny < 0 ? 0 : ny > 127 ? 127 : ny; Penvval[lastpoint] = ny; oscWrite(to_s("Penvval")+to_s(lastpoint), "c", ny); oscWrite("Penvval",""); } else if (lastpoint > 0) { int newdt = Fl::event_dy() + Penvdt[lastpoint]; newdt = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt; Penvdt[lastpoint] = newdt; oscWrite(to_s("Penvdt")+to_s(lastpoint), "c", newdt); oscWrite("Penvdt",""); } redraw(); if (pair!=NULL) pair->redraw(); return 1; } case FL_DRAG: if (currentpoint>=0){ int ny=limit(127-(int) (y_*127.0/h()), 0, 127); Penvval[currentpoint]=ny; const int dx=(int)((x_-cpx)*0.1); const int newdt=limit(cpdt+dx,0,127); if(currentpoint!=0) Penvdt[currentpoint]=newdt; else Penvdt[currentpoint]=0; oscWrite(to_s("Penvval")+to_s(currentpoint), "c", ny); oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt); oscWrite("Penvdt",""); oscWrite("Penvval",""); redraw(); if(pair) pair->redraw(); return 1; } } // Needed to propagate undo/redo keys. return 0; }
void redraw(bool forceredraw){ redraw(Inter::drawScreen,false,forceredraw); }
void CQuestLog::sliderMoved (int newpos) { recreateQuestList (newpos); //move components redraw(); }
// Handle FLTK events int Fl_Table::handle(int event) { PRINTEVENT; int ret = Fl_Group::handle(event); // let FLTK group handle events first if (ret) { if (Fl::event_inside(hscrollbar) || Fl::event_inside(vscrollbar)) return 1; if (Fl::focus() != this && contains(Fl::focus())) return 1; } // Which row/column are we over? int R, C; // row/column being worked on ResizeFlag resizeflag; // which resizing area are we over? (0=none) TableContext context = cursor2rowcol(R, C, resizeflag); switch ( event ) { case FL_PUSH: if (Fl::event_button() == 1 && !Fl::event_clicks()) { if (Fl::focus() != this) { take_focus(); do_callback(CONTEXT_TABLE, -1, -1); ret = 1; } damage_zone(current_row, current_col, select_row, select_col, R, C); if (context == CONTEXT_CELL) { current_row = select_row = R; current_col = select_col = C; _selecting = CONTEXT_CELL; } else { current_row = select_row = -1; current_col = select_col = -1; } } // Need this for eg. right click to pop up a menu if ( Fl_Widget::callback() && // callback defined? resizeflag == RESIZE_NONE ) // not resizing? { do_callback(context, R, C); } // do callback switch ( context ) { case CONTEXT_CELL: // FL_PUSH on a cell? ret = 1; // express interest in FL_RELEASE break; case CONTEXT_NONE: // FL_PUSH on table corner? if ( Fl::event_button() == 1 && Fl::event_x() < x() + row_header_width()) { current_col = 0; select_col = cols() - 1; current_row = 0; select_row = rows() - 1; damage_zone(current_row, current_col, select_row, select_col); ret = 1; } break; case CONTEXT_COL_HEADER: // FL_PUSH on a column header? if ( Fl::event_button() == 1) { // Resizing? Handle it if ( resizeflag ) { // Start resize if left click on column border. // "ret=1" ensures we get drag events from now on. // (C-1) is used if mouse is over the left hand side // of cell, so we resize the next column on the left. // _resizing_col = ( resizeflag & RESIZE_COL_LEFT ) ? C-1 : C; _resizing_row = -1; _dragging_x = Fl::event_x(); ret = 1; } else { // Not resizing? Select the column current_col = select_col = C; current_row = 0; select_row = rows() - 1; _selecting = CONTEXT_COL_HEADER; damage_zone(current_row, current_col, select_row, select_col); ret = 1; } } break; case CONTEXT_ROW_HEADER: // FL_PUSH on a row header? if ( Fl::event_button() == 1 ) { // Resizing? Handle it if ( resizeflag ) { // Start resize if left mouse clicked on row border. // "ret = 1" ensures we get drag events from now on. // (R-1) is used if mouse is over the top of the cell, // so that we resize the row above. // _resizing_row = ( resizeflag & RESIZE_ROW_ABOVE ) ? R-1 : R; _resizing_col = -1; _dragging_y = Fl::event_y(); ret = 1; } else { // Not resizing? Select the row current_row = select_row = R; current_col = 0; select_col = cols() - 1; _selecting = CONTEXT_ROW_HEADER; damage_zone(current_row, current_col, select_row, select_col); ret = 1; } } break; default: ret = 0; // express disinterest break; } _last_row = R; break; case FL_DRAG: if (_auto_drag == 1) { ret = 1; break; } if ( _resizing_col > -1 ) { // Dragging column? // // Let user drag even /outside/ the row/col widget. // Don't allow column width smaller than 1. // Continue to show FL_CURSOR_WE at all times during drag. // int offset = _dragging_x - Fl::event_x(); int new_w = col_width(_resizing_col) - offset; if ( new_w < _col_resize_min ) new_w = _col_resize_min; col_width(_resizing_col, new_w); _dragging_x = Fl::event_x(); table_resized(); redraw(); change_cursor(FL_CURSOR_WE); ret = 1; if ( Fl_Widget::callback() && when() & FL_WHEN_CHANGED ) { do_callback(CONTEXT_RC_RESIZE, R, C); } } else if ( _resizing_row > -1 ) { // Dragging row? // // Let user drag even /outside/ the row/col widget. // Don't allow row width smaller than 1. // Continue to show FL_CURSOR_NS at all times during drag. // int offset = _dragging_y - Fl::event_y(); int new_h = row_height(_resizing_row) - offset; if ( new_h < _row_resize_min ) new_h = _row_resize_min; row_height(_resizing_row, new_h); _dragging_y = Fl::event_y(); table_resized(); redraw(); change_cursor(FL_CURSOR_NS); ret = 1; if ( Fl_Widget::callback() && when() & FL_WHEN_CHANGED ) { do_callback(CONTEXT_RC_RESIZE, R, C); } } else { if (Fl::event_button() == 1 && _selecting == CONTEXT_CELL && context == CONTEXT_CELL) { if (select_row != R || select_col != C) damage_zone(current_row, current_col, select_row, select_col, R, C); select_row = R; select_col = C; ret = 1; } else if (Fl::event_button() == 1 && _selecting == CONTEXT_ROW_HEADER && context & (CONTEXT_ROW_HEADER|CONTEXT_COL_HEADER|CONTEXT_CELL)) { if (select_row != R) damage_zone(current_row, current_col, select_row, select_col, R, C); select_row = R; ret = 1; } else if (Fl::event_button() == 1 && _selecting == CONTEXT_COL_HEADER && context & (CONTEXT_ROW_HEADER|CONTEXT_COL_HEADER|CONTEXT_CELL)) { if (select_col != C) damage_zone(current_row, current_col, select_row, select_col, R, C); select_col = C; ret = 1; } } // Enable autodrag if not resizing, and mouse has moved off table edge if ( _resizing_row < 0 && _resizing_col < 0 && _auto_drag == 0 && ( Fl::event_x() > x() + w() - 20 || Fl::event_x() < x() + row_header_width() || Fl::event_y() > y() + h() - 20 || Fl::event_y() < y() + col_header_height() ) ) { _start_auto_drag(); } break; case FL_RELEASE: _stop_auto_drag(); switch ( context ) { case CONTEXT_ROW_HEADER: // release on row header case CONTEXT_COL_HEADER: // release on col header case CONTEXT_CELL: // release on a cell case CONTEXT_TABLE: // release on dead zone if ( _resizing_col == -1 && // not resizing a column _resizing_row == -1 && // not resizing a row Fl_Widget::callback() && // callback defined when() & FL_WHEN_RELEASE && // on button release _last_row == R ) // release on same row PUSHed? { // Need this for eg. left clicking on a cell to select it do_callback(context, R, C); } break; default: break; } if ( Fl::event_button() == 1 ) { change_cursor(FL_CURSOR_DEFAULT); _resizing_col = -1; _resizing_row = -1; ret = 1; } break; case FL_MOVE: if ( context == CONTEXT_COL_HEADER && // in column header? resizeflag ) // resize + near boundary? { change_cursor(FL_CURSOR_WE); } // show resize cursor else if ( context == CONTEXT_ROW_HEADER && // in row header? resizeflag ) // resize + near boundary? { change_cursor(FL_CURSOR_NS); } // show resize cursor else { change_cursor(FL_CURSOR_DEFAULT); } // normal cursor ret = 1; break; case FL_ENTER: // See FLTK event docs on the FL_ENTER widget if (!ret) take_focus(); ret = 1; //FALLTHROUGH case FL_LEAVE: // We want to track the mouse if resizing is allowed. if ( resizeflag ) { ret = 1; } if ( event == FL_LEAVE ) { _stop_auto_drag(); change_cursor(FL_CURSOR_DEFAULT); } break; case FL_FOCUS: Fl::focus(this); //FALLTHROUGH case FL_UNFOCUS: _stop_auto_drag(); ret = 1; break; case FL_KEYBOARD: ret = 0; switch(Fl::event_key()) { case FL_Home: ret = move_cursor(0, -1000000); break; case FL_End: ret = move_cursor(0, 1000000); break; case FL_Page_Up: ret = move_cursor(-(botrow - toprow - 1), 0); break; case FL_Page_Down: ret = move_cursor(botrow - toprow - 1 , 0); break; case FL_Left: ret = move_cursor(0, -1); break; case FL_Right: ret = move_cursor(0, 1); break; case FL_Up: ret = move_cursor(-1, 0); break; case FL_Down: ret = move_cursor(1, 0); break; } if (ret && Fl::focus() != this) { do_callback(CONTEXT_TABLE, -1, -1); take_focus(); } if (!ret && Fl_Widget::callback() && when() & FL_WHEN_NOT_CHANGED ) { do_callback(CONTEXT_CELL, select_row, select_col); //damage_zone(current_row, current_col, select_row, select_col); ret = 1; } break; default: change_cursor(FL_CURSOR_DEFAULT); break; } return(ret); }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Empty the shapes vector, then redraw ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ void Scene::clear(){ shapes.clear(); redraw(); }
void Edit::sttitle(String val) { title=val; redraw(); }
void MantaAudioUnitController::loadPreset(string name) { ofXml xml; xml.load(ofToString("presets/"+name+".xml")); xml.setTo("MantaAudioUnitController"); xml.setTo("AudioUnits"); if (xml.exists("AudioUnit[0]")) { xml.setTo("AudioUnit[0]"); do { string synthName = xml.getValue<string>("Name"); synths[synthName]->getSynth().loadCustomPreset(ofToDataPath("presets/"+xml.getValue<string>("Preset"))); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); xml.setTo("Manta"); setKey(xml.getValue<int>("Key")); setMode(xml.getValue<int>("Mode")); setOctave(xml.getValue<int>("Octave")); setPadFreezingEnabled(xml.getValue<int>("FreezeEnabled") == 1 ? true : false); xml.setTo("Pads"); if (xml.exists("PadMapping[0]")) { xml.setTo("PadMapping[0]"); do { int id = xml.getValue<int>("Id"); string synthName = xml.getValue<string>("SynthName"); string parameterName = xml.getValue<string>("ParameterName"); bool toggle = xml.getValue<int>("Toggle") == 1 ? true : false; mapPadToParameter(floor(id / 8), id % 8, *synths[synthName], parameterName, toggle); padMap[id]->min = xml.getValue<float>("Min"); padMap[id]->max = xml.getValue<float>("Max"); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); xml.setTo("Sliders"); if (xml.exists("SliderMapping[0]")) { xml.setTo("SliderMapping[0]"); do { int id = xml.getValue<int>("Id"); string synthName = xml.getValue<string>("SynthName"); string parameterName = xml.getValue<string>("ParameterName"); mapSliderToParameter(id, *synths[synthName], parameterName); sliderMap[id]->min = xml.getValue<float>("Min"); sliderMap[id]->max = xml.getValue<float>("Max"); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); xml.setTo("Buttons"); if (xml.exists("ButtonMapping[0]")) { xml.setTo("ButtonMapping[0]"); do { int id = xml.getValue<int>("Id"); string synthName = xml.getValue<string>("SynthName"); string parameterName = xml.getValue<string>("ParameterName"); bool toggle = xml.getValue<int>("Toggle") == 1 ? true : false; mapButtonToParameter(id, *synths[synthName], parameterName, toggle); buttonMap[id]->min = xml.getValue<float>("Min"); buttonMap[id]->max = xml.getValue<float>("Max"); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); xml.setTo("Stats"); if (xml.exists("StatMapping[0]")) { xml.setTo("StatMapping[0]"); do { int id = xml.getValue<int>("Id"); string synthName = xml.getValue<string>("SynthName"); string parameterName = xml.getValue<string>("ParameterName"); mapStatToParameter(id, *synths[synthName], parameterName); statMap[id]->min = xml.getValue<float>("Min"); statMap[id]->max = xml.getValue<float>("Max"); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); xml.setTo("MidiMap"); if (xml.exists("MidiMapping[0]")) { clearMidiMapping(); xml.setTo("MidiMapping[0]"); do { setMidiMapping(xml.getValue<int>("Id"), synths[xml.getValue<string>("SynthName")]); } while(xml.setToSibling()); xml.setToParent(); } xml.setToParent(); redraw(); }
void Flu_Toggle_Group :: toggleCB() { do_callback(); redraw(); }
int main(int argc, char * argv[]) { if (argc < 2) { fprintf(stderr, "Usage: %s image_file\n", argv[0]); return 1; } file_name = argv[1]; load_sprite_png(&image, argv[1]); yctx = yutani_init(); init_decorations(); win = yutani_window_create(yctx, image.width + decor_width(), image.height + decor_height()); yutani_window_move(yctx, win, center_x(image.width + decor_width()), center_y(image.height + decor_height())); ctx = init_graphics_yutani_double_buffer(win); int stride; stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, win->width); surface_win = cairo_image_surface_create_for_data(ctx->backbuffer, CAIRO_FORMAT_ARGB32, win->width, win->height, stride); cr_win = cairo_create(surface_win); yutani_window_advertise_icon(yctx, win, "Image Viewer", "image-viewer"); redraw(); yutani_focus_window(yctx, win->wid); while (!should_exit) { yutani_msg_t * m = yutani_poll(yctx); if (m) { switch (m->type) { case YUTANI_MSG_KEY_EVENT: { struct yutani_msg_key_event * ke = (void*)m->data; if (ke->event.key == 'q' && ke->event.action == KEY_ACTION_DOWN) { should_exit = 1; } } break; case YUTANI_MSG_WINDOW_FOCUS_CHANGE: { struct yutani_msg_window_focus_change * wf = (void*)m->data; if (wf->wid == win->wid) { win->focused = wf->focused; redraw(); } } break; case YUTANI_MSG_WINDOW_MOUSE_EVENT: { struct yutani_msg_window_mouse_event * me = (void*)m->data; if (me->wid != win->wid) break; int result = decor_handle_event(yctx, m); switch (result) { case DECOR_CLOSE: should_exit = 1; break; default: /* Other actions */ break; } } break; case YUTANI_MSG_SESSION_END: should_exit = 1; break; default: break; } free(m); } } return 0; }
BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { switch (message) { case WM_INITDIALOG : { switchTo(activeText); ::SendDlgItemMessage(_hSelf, IDC_COL_DEC_RADIO, BM_SETCHECK, TRUE, 0); goToCenter(); NppParameters *pNppParam = NppParameters::getInstance(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); if (enableDlgTheme) { enableDlgTheme(_hSelf, ETDT_ENABLETAB); redraw(); } return TRUE; } case WM_COMMAND : { switch (wParam) { case IDCANCEL : // Close display(false); return TRUE; case IDOK : { (*_ppEditView)->execute(SCI_BEGINUNDOACTION); const int stringSize = 1024; TCHAR str[stringSize]; bool isTextMode = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_TEXT_RADIO, BM_GETCHECK, 0, 0)); if (isTextMode) { ::SendDlgItemMessage(_hSelf, IDC_COL_TEXT_EDIT, WM_GETTEXT, stringSize, (LPARAM)str); display(false); if ((*_ppEditView)->execute(SCI_SELECTIONISRECTANGLE) || (*_ppEditView)->execute(SCI_GETSELECTIONS) > 1) { ColumnModeInfos colInfos = (*_ppEditView)->getColumnModeSelectInfo(); std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder()); (*_ppEditView)->columnReplace(colInfos, str); std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder()); (*_ppEditView)->setMultiSelections(colInfos); } else { int cursorPos = (*_ppEditView)->execute(SCI_GETCURRENTPOS); int cursorCol = (*_ppEditView)->execute(SCI_GETCOLUMN, cursorPos); int cursorLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, cursorPos); int endPos = (*_ppEditView)->execute(SCI_GETLENGTH); int endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos); int lineAllocatedLen = 1024; TCHAR *line = new TCHAR[lineAllocatedLen]; for (int i = cursorLine ; i <= endLine ; i++) { int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i); int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i); int lineEndCol = (*_ppEditView)->execute(SCI_GETCOLUMN, lineEnd); int lineLen = lineEnd - lineBegin + 1; if (lineLen > lineAllocatedLen) { delete [] line; line = new TCHAR[lineLen]; } (*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd); generic_string s2r(line); if (lineEndCol < cursorCol) { generic_string s_space(cursorCol - lineEndCol, ' '); s2r.append(s_space); s2r.append(str); } else { int posAbs2Start = (*_ppEditView)->execute(SCI_FINDCOLUMN, i, cursorCol); int posRelative2Start = posAbs2Start - lineBegin; s2r.insert(posRelative2Start, str); } (*_ppEditView)->replaceTarget(s2r.c_str(), lineBegin, lineEnd); } delete [] line; } } else { int initialNumber = ::GetDlgItemInt(_hSelf, IDC_COL_INITNUM_EDIT, NULL, TRUE); int increaseNumber = ::GetDlgItemInt(_hSelf, IDC_COL_INCREASENUM_EDIT, NULL, TRUE); UCHAR format = getFormat(); display(false); if ((*_ppEditView)->execute(SCI_SELECTIONISRECTANGLE) || (*_ppEditView)->execute(SCI_GETSELECTIONS) > 1) { ColumnModeInfos colInfos = (*_ppEditView)->getColumnModeSelectInfo(); std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder()); (*_ppEditView)->columnReplace(colInfos, initialNumber, increaseNumber, format); std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder()); (*_ppEditView)->setMultiSelections(colInfos); } else { int cursorPos = (*_ppEditView)->execute(SCI_GETCURRENTPOS); int cursorCol = (*_ppEditView)->execute(SCI_GETCOLUMN, cursorPos); int cursorLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, cursorPos); int endPos = (*_ppEditView)->execute(SCI_GETLENGTH); int endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos); int lineAllocatedLen = 1024; TCHAR *line = new TCHAR[lineAllocatedLen]; UCHAR f = format & MASK_FORMAT; bool isZeroLeading = (MASK_ZERO_LEADING & format) != 0; int base = 10; if (f == BASE_16) base = 16; else if (f == BASE_08) base = 8; else if (f == BASE_02) base = 2; int nbLine = endLine - cursorLine + 1; int endNumber = initialNumber + increaseNumber * (nbLine - 1); int nbEnd = getNbDigits(endNumber, base); int nbInit = getNbDigits(initialNumber, base); int nb = max(nbInit, nbEnd); for (int i = cursorLine ; i <= endLine ; i++) { int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i); int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i); int lineEndCol = (*_ppEditView)->execute(SCI_GETCOLUMN, lineEnd); int lineLen = lineEnd - lineBegin + 1; if (lineLen > lineAllocatedLen) { delete [] line; line = new TCHAR[lineLen]; } (*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd); generic_string s2r(line); // // Calcule generic_string // int2str(str, stringSize, initialNumber, base, nb, isZeroLeading); initialNumber += increaseNumber; if (lineEndCol < cursorCol) { generic_string s_space(cursorCol - lineEndCol, ' '); s2r.append(s_space); s2r.append(str); } else { int posAbs2Start = (*_ppEditView)->execute(SCI_FINDCOLUMN, i, cursorCol); int posRelative2Start = posAbs2Start - lineBegin; s2r.insert(posRelative2Start, str); } (*_ppEditView)->replaceTarget(s2r.c_str(), lineBegin, lineEnd); } delete [] line; } } (*_ppEditView)->execute(SCI_ENDUNDOACTION); (*_ppEditView)->getFocus(); return TRUE; } case IDC_COL_TEXT_RADIO : case IDC_COL_NUM_RADIO : { switchTo((wParam == IDC_COL_TEXT_RADIO)? activeText : activeNumeric); return TRUE; } default : { switch (HIWORD(wParam)) { case EN_SETFOCUS : case BN_SETFOCUS : //updateLinesNumbers(); return TRUE; default : return TRUE; } break; } } } default : return FALSE; } //return FALSE; }
void MWList::redraw(bool scrollbarShown) { const int _scrollBarWidth = 20; // fetch this from skin? const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0; const int spacing = 3; int viewPosition = -mScrollView->getViewOffset().top; while (mScrollView->getChildCount()) { MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0)); } mItemHeight = 0; int i=0; for (std::vector<std::string>::const_iterator it=mItems.begin(); it!=mItems.end(); ++it) { if (*it != "") { if (mListItemSkin.empty()) return; MyGUI::Button* button = mScrollView->createWidget<MyGUI::Button>( mListItemSkin, MyGUI::IntCoord(0, mItemHeight, mScrollView->getSize().width - scrollBarWidth - 2, 24), MyGUI::Align::Left | MyGUI::Align::Top, getName() + "_item_" + (*it)); button->setCaption((*it)); button->getSubWidgetText()->setWordWrap(true); button->getSubWidgetText()->setTextAlign(MyGUI::Align::Left); button->eventMouseWheel += MyGUI::newDelegate(this, &MWList::onMouseWheel); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWList::onItemSelected); int height = button->getTextSize().height; button->setSize(MyGUI::IntSize(button->getSize().width, height)); button->setUserData(i); mItemHeight += height + spacing; } else { MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>("MW_HLine", MyGUI::IntCoord(2, mItemHeight, mScrollView->getWidth() - scrollBarWidth - 4, 18), MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch); separator->setNeedMouseFocus(false); mItemHeight += 18 + spacing; } ++i; } // Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden mScrollView->setVisibleVScroll(false); mScrollView->setCanvasSize(mClient->getSize().width, std::max(mItemHeight, mClient->getSize().height)); mScrollView->setVisibleVScroll(true); if (!scrollbarShown && mItemHeight > mClient->getSize().height) redraw(true); int viewRange = mScrollView->getCanvasSize().height; if(viewPosition > viewRange) viewPosition = viewRange; mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); }
void MWList::adjustSize() { redraw(); }
/** * performs autozoom * * @param axis include axis in zoom * @param keepAspectRatio true: keep aspect ratio 1:1 * false: factors in x and y are stretched to the max */ void RS_GraphicView::zoomAuto(bool axis, bool keepAspectRatio) { RS_DEBUG->print("RS_GraphicView::zoomAuto"); if (container!=NULL) { container->calculateBorders(); double sx, sy; if (axis) { sx = std::max(container->getMax().x, 0.0) - std::min(container->getMin().x, 0.0); sy = std::max(container->getMax().y, 0.0) - std::min(container->getMin().y, 0.0); } else { sx = container->getSize().x; sy = container->getSize().y; } // std::cout<<" RS_GraphicView::zoomAuto("<<axis<<","<<keepAspectRatio<<")"<<std::endl; double fx=1., fy=1.; unsigned short fFlags=0; if (sx>RS_TOLERANCE) { fx = (getWidth()-borderLeft-borderRight) / sx; } else { fFlags += 1; //invalid x factor } if (sy>RS_TOLERANCE) { fy = (getHeight()-borderTop-borderBottom) / sy; } else { fFlags += 2; //invalid y factor } // std::cout<<"0: fx= "<<fx<<"\tfy="<<fy<<std::endl; RS_DEBUG->print("f: %f/%f", fx, fy); switch(fFlags){ case 1: fx=fy; break; case 2: fy=fx; break; case 3: return; //do not do anything, invalid factors default: if (keepAspectRatio) { fx = fy = std::min(fx, fy); } // break; } // std::cout<<"1: fx= "<<fx<<"\tfy="<<fy<<std::endl; RS_DEBUG->print("f: %f/%f", fx, fy); //exclude invalid factors fFlags=0; if (fx<RS_TOLERANCE||fx>RS_MAXDOUBLE) { fx=1.0; fFlags += 1; } if (fy<RS_TOLERANCE||fy>RS_MAXDOUBLE) { fy=1.0; fFlags += 2; } if(fFlags == 3 ) return; saveView(); // std::cout<<"2: fx= "<<fx<<"\tfy="<<fy<<std::endl; setFactorX(fx); setFactorY(fy); RS_DEBUG->print("f: %f/%f", fx, fy); // RS_DEBUG->print("adjustOffsetControls"); adjustOffsetControls(); // RS_DEBUG->print("adjustZoomControls"); adjustZoomControls(); // RS_DEBUG->print("centerOffsetX"); centerOffsetX(); // RS_DEBUG->print("centerOffsetY"); centerOffsetY(); // RS_DEBUG->print("updateGrid"); // updateGrid(); redraw(); } RS_DEBUG->print("RS_GraphicView::zoomAuto OK"); }
void CtrlDisAsmView::SetNextStatement() { debugger->setPC(selection); redraw(); }
/** * Zooms the area given by v1 and v2. * * @param keepAspectRatio true: keeps the aspect ratio 1:1 * false: zooms exactly the selected range to the * current graphic view */ void RS_GraphicView::zoomWindow(RS_Vector v1, RS_Vector v2, bool keepAspectRatio) { double zoomX=480.0; // Zoom for X-Axis double zoomY=640.0; // Zoom for Y-Axis (Set smaller one) int zoomBorder = 0; // Switch left/right and top/bottom is necessary: if(v1.x>v2.x) { std::swap(v1.x,v2.x); } if(v1.y>v2.y) { std::swap(v1.y,v2.y); } // Get zoom in X and zoom in Y: if(v2.x-v1.x>1.0e-6) { zoomX = getWidth() / (v2.x-v1.x); } if(v2.y-v1.y>1.0e-6) { zoomY = getHeight() / (v2.y-v1.y); } // Take smaller zoom: if (keepAspectRatio) { if(zoomX<zoomY) { if(getWidth()!=0) { zoomX = zoomY = ((double)(getWidth()-2*zoomBorder)) / (double)getWidth()*zoomX; } } else { if(getHeight()!=0) { zoomX = zoomY = ((double)(getHeight()-2*zoomBorder)) / (double)getHeight()*zoomY; } } } zoomX=fabs(zoomX); zoomY=fabs(zoomY); // Borders in pixel after zoom int pixLeft =(int)(v1.x*zoomX); int pixTop =(int)(v2.y*zoomY); int pixRight =(int)(v2.x*zoomX); int pixBottom=(int)(v1.y*zoomY); if( pixLeft == INT_MIN || pixLeft== INT_MAX || pixRight == INT_MIN || pixRight== INT_MAX || pixTop == INT_MIN || pixTop== INT_MAX || pixBottom == INT_MIN || pixBottom== INT_MAX ) { RS_DIALOGFACTORY->commandMessage("Requested zooming factor out of range. Zooming not changed"); return; } saveView(); // Set new offset for zero point: offsetX = - pixLeft + (getWidth() -pixRight +pixLeft)/2; offsetY = - pixTop + (getHeight() -pixBottom +pixTop)/2; factor.x = zoomX; factor.y = zoomY; adjustOffsetControls(); adjustZoomControls(); // updateGrid(); redraw(); }
void CtrlDisAsmView::ToggleBreakpoint() { debugger->toggleBreakpoint(selection); parentWindow->Update(); redraw(); }
// Ctor Fl_Table::Fl_Table(int X, int Y, int W, int H, const char *l) : Fl_Group(X,Y,W,H,l) { _rows = 0; _cols = 0; _row_header_w = 40; _col_header_h = 18; _row_header = 0; _col_header = 0; _row_header_color = color(); _col_header_color = color(); _row_resize = 0; _col_resize = 0; _row_resize_min = 1; _col_resize_min = 1; _redraw_toprow = -1; _redraw_botrow = -1; _redraw_leftcol = -1; _redraw_rightcol = -1; table_w = 0; table_h = 0; toprow = 0; botrow = 0; leftcol = 0; rightcol = 0; toprow_scrollpos = -1; leftcol_scrollpos = -1; _last_cursor = FL_CURSOR_DEFAULT; _resizing_col = -1; _resizing_row = -1; _dragging_x = -1; _dragging_y = -1; _last_row = -1; _auto_drag = 0; current_col = -1; current_row = -1; select_row = -1; select_col = -1; box(FL_THIN_DOWN_FRAME); vscrollbar = new Fl_Scrollbar(x()+w()-SCROLLBAR_SIZE, y(), SCROLLBAR_SIZE, h()-SCROLLBAR_SIZE); vscrollbar->type(FL_VERTICAL); vscrollbar->callback(scroll_cb, (void*)this); hscrollbar = new Fl_Scrollbar(x(), y()+h()-SCROLLBAR_SIZE, w(), SCROLLBAR_SIZE); hscrollbar->type(FL_HORIZONTAL); hscrollbar->callback(scroll_cb, (void*)this); table = new Fl_Scroll(x(), y(), w(), h()); table->box(FL_NO_BOX); table->type(0); // don't show Fl_Scroll's scrollbars -- use our own table->hide(); // hide unless children are present table->end(); table_resized(); redraw(); Fl_Group::end(); // end the group's begin() table->begin(); // leave with fltk children getting added to the scroll }
void CtrlDisAsmView::RunToHere() { debugger->setBreakpoint(selection); debugger->runToBreakpoint(); redraw(); }
int main(int argc, char *argv[]) { int ch, done; char *bspec, *p; if (pledge("stdio rpath tty", NULL) == -1) err(1, "pledge"); batch = debug = reuse = selfuse; bspec = NULL; minlength = -1; tlimit = 180; /* 3 minutes is standard */ while ((ch = getopt(argc, argv, "Bbcdht:w:")) != -1) switch(ch) { case 'B': grid = 5; break; case 'b': batch = 1; break; case 'c': challenge = 1; break; case 'd': debug = 1; break; case 't': if ((tlimit = atoi(optarg)) < 1) errx(1, "bad time limit"); break; case 'w': if ((minlength = atoi(optarg)) < 3) errx(1, "min word length must be > 2"); break; case 'h': default: usage(); } argc -= optind; argv += optind; ncubes = grid * grid; /* process final arguments */ if (argc > 0) { if (strcmp(argv[0], "+") == 0) reuse = 1; else if (strcmp(argv[0], "++") == 0) selfuse = 1; } if (reuse || selfuse) { argc -= 1; argv += 1; } if (argc == 1) { if (strlen(argv[0]) != ncubes) usage(); for (p = argv[0]; *p != '\0'; p++) if (!islower((unsigned char)*p)) errx(1, "only lower case letters are allowed " "in boardspec"); bspec = argv[0]; } else if (argc != 0) usage(); if (batch && bspec == NULL) errx(1, "must give both -b and a board setup"); init(); if (batch) { newgame(bspec); while ((p = batchword(stdin)) != NULL) (void) printf("%s\n", p); return 0; } setup(); prompt("Loading the dictionary..."); if ((dictfp = opendict(DICT)) == NULL) { warn("%s", DICT); cleanup(); return 1; } #ifdef LOADDICT if (loaddict(dictfp) < 0) { warnx("can't load %s", DICT); cleanup(); return 1; } (void)fclose(dictfp); dictfp = NULL; #endif if (loadindex(DICTINDEX) < 0) { warnx("can't load %s", DICTINDEX); cleanup(); return 1; } prompt("Type <space> to begin..."); while (inputch() != ' '); for (done = 0; !done;) { newgame(bspec); bspec = NULL; /* reset for subsequent games */ playgame(); prompt("Type <space> to continue, any cap to quit..."); delay(10); /* wait for user to quit typing */ flushin(stdin); for (;;) { ch = inputch(); if (ch == '\033') findword(); else if (ch == '\014' || ch == '\022') /* ^l or ^r */ redraw(); else { if (isupper(ch)) { done = 1; break; } if (ch == ' ') break; } } } cleanup(); return 0; }
void MSSash::updateBackground(unsigned long oldbg_) { MSWidgetCommon::updateBackground(oldbg_); redraw(); }
BOOL CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG : { HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME); generic_string buildTime = TEXT("Build time : "); #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); buildTime += wmc->char2wchar(__DATE__, CP_ACP); buildTime += TEXT(" - "); buildTime += wmc->char2wchar(__TIME__, CP_ACP); #else buildTime += __DATE__; buildTime += TEXT(" - "); buildTime += __TIME__; #endif ::SendMessage(compileDateHandle, WM_SETTEXT, 0, (LPARAM)buildTime.c_str()); ::EnableWindow(compileDateHandle, FALSE); HWND licenceEditHandle = ::GetDlgItem(_hSelf, IDC_LICENCE_EDIT); ::SendMessage(licenceEditHandle, WM_SETTEXT, 0, (LPARAM)LICENCE_TXT); _emailLink.init(_hInst, _hSelf); //_emailLink.create(::GetDlgItem(_hSelf, IDC_AUTHOR_NAME), TEXT("mailto:[email protected]")); _emailLink.create(::GetDlgItem(_hSelf, IDC_AUTHOR_NAME), TEXT("http://notepad-plus-plus.org/contributors")); _pageLink.init(_hInst, _hSelf); _pageLink.create(::GetDlgItem(_hSelf, IDC_HOME_ADDR), TEXT("http://notepad-plus-plus.org/")); //_onLineHelp.init(_hInst, _hSelf); //_onLineHelp.create(::GetDlgItem(_hSelf, IDC_ONLINEHELP_ADDR), TEXT("http://notepad-plus.sourceforge.net/uk/generalFAQ.php")); getClientRect(_rc); NppParameters *pNppParam = NppParameters::getInstance(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); if (enableDlgTheme) { enableDlgTheme(_hSelf, ETDT_ENABLETAB); redraw(); } return TRUE; } case WM_DRAWITEM : { HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_CHAMELEON), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE); //HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_JESUISCHARLIE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE); DRAWITEMSTRUCT *pdis = (DRAWITEMSTRUCT *)lParam; ::DrawIconEx(pdis->hDC, 0, 0, hIcon, 64, 64, 0, NULL, DI_NORMAL); return TRUE; } case WM_COMMAND : { switch (wParam) { case IDCANCEL : case IDOK : display(false); return TRUE; default : break; } } case WM_DESTROY : { return TRUE; } } return FALSE; }
void StimulusGroup::set_baserate(AurynFloat baserate) { base_rate = baserate; redraw(); logger->parameter("StimulusGroup:: baserate",baserate); }
int MatSysWindow::handleEvent (mxEvent *event) { int iret = 0; if ( HandleToolEvent( event ) ) { return iret; } static float oldrx = 0, oldry = 0, oldtz = 50, oldtx = 0, oldty = 0; static float oldlrx = 0, oldlry = 0; static int oldx, oldy; switch (event->event) { case mxEvent::Idle: { iret = 1; Frame(); CheckForAccleratorKeys(); } break; case mxEvent::MouseDown: { oldrx = g_viewerSettings.rot[0]; oldry = g_viewerSettings.rot[1]; oldtx = g_viewerSettings.trans[0]; oldty = g_viewerSettings.trans[1]; oldtz = g_viewerSettings.trans[2]; oldx = (short)event->x; oldy = (short)event->y; oldlrx = g_viewerSettings.lightrot[0]; oldlry = g_viewerSettings.lightrot[1]; g_viewerSettings.pause = false; float r = 1.0/3.0 * min( w(), h() ); float d = sqrt( (event->x - w()/2) * (event->x - w()/2) + (event->y - h()/2) * (event->y - h()/2) ); if (d < r) g_viewerSettings.rotating = false; else g_viewerSettings.rotating = true; iret = 1; } break; case mxEvent::MouseDrag: { if (event->buttons & mxEvent::MouseLeftButton) { if (event->modifiers & mxEvent::KeyShift) { g_viewerSettings.trans[1] = oldty - (float) ((short)event->x - oldx); g_viewerSettings.trans[2] = oldtz + (float) ((short)event->y - oldy); } else if (event->modifiers & mxEvent::KeyCtrl) { float ry = (float) (event->y - oldy); float rx = (float) (event->x - oldx); oldx = event->x; oldy = event->y; QAngle movement = QAngle( ry, rx, 0 ); matrix3x4_t tmp1, tmp2, tmp3; AngleMatrix( g_viewerSettings.lightrot, tmp1 ); AngleMatrix( movement, tmp2 ); ConcatTransforms( tmp2, tmp1, tmp3 ); MatrixAngles( tmp3, g_viewerSettings.lightrot ); } else { if (!g_viewerSettings.rotating) { float ry = (float) (event->y - oldy); float rx = (float) (event->x - oldx); oldx = event->x; oldy = event->y; QAngle movement; matrix3x4_t tmp1, tmp2, tmp3; movement = QAngle( 0, rx, 0 ); AngleMatrix( g_viewerSettings.rot, tmp1 ); AngleMatrix( movement, tmp2 ); ConcatTransforms( tmp1, tmp2, tmp3 ); MatrixAngles( tmp3, g_viewerSettings.rot ); movement = QAngle( ry, 0, 0 ); AngleMatrix( g_viewerSettings.rot, tmp1 ); AngleMatrix( movement, tmp2 ); ConcatTransforms( tmp2, tmp1, tmp3 ); MatrixAngles( tmp3, g_viewerSettings.rot ); } else { float ang1 = (180 / 3.1415) * atan2( oldx - w()/2.0, oldy - h()/2.0 ); float ang2 = (180 / 3.1415) * atan2( event->x - w()/2.0, event->y - h()/2.0 ); oldx = event->x; oldy = event->y; QAngle movement = QAngle( 0, 0, ang2 - ang1 ); matrix3x4_t tmp1, tmp2, tmp3; AngleMatrix( g_viewerSettings.rot, tmp1 ); AngleMatrix( movement, tmp2 ); ConcatTransforms( tmp2, tmp1, tmp3 ); MatrixAngles( tmp3, g_viewerSettings.rot ); } } } else if (event->buttons & mxEvent::MouseRightButton) { g_viewerSettings.trans[0] = oldtx + (float) ((short)event->y - oldy); g_viewerSettings.trans[0] = clamp( g_viewerSettings.trans[0], 8.0f, 1024.0f ); } redraw (); iret = 1; } break; case mxEvent::KeyDown: { iret = 1; switch (event->key) { default: iret = 0; break; case 116: // F5 { g_MDLViewer->Refresh(); } break; case 32: { int iSeq = models->GetActiveStudioModel()->GetSequence (); if (iSeq == models->GetActiveStudioModel()->SetSequence (iSeq + 1)) { models->GetActiveStudioModel()->SetSequence (0); } } break; case 27: if (!getParent ()) // fullscreen mode ? mx::quit (); break; case 'g': g_viewerSettings.showGround = !g_viewerSettings.showGround; break; case 'h': g_viewerSettings.showHitBoxes = !g_viewerSettings.showHitBoxes; break; case 'o': g_viewerSettings.showBones = !g_viewerSettings.showBones; break; case 'b': g_viewerSettings.showBackground = !g_viewerSettings.showBackground; break; case 'm': g_viewerSettings.showMovement = !g_viewerSettings.showMovement; break; case '1': case '2': case '3': case '4': g_viewerSettings.renderMode = event->key - '1'; break; case '-': g_viewerSettings.speedScale -= 0.1f; if (g_viewerSettings.speedScale < 0.0f) g_viewerSettings.speedScale = 0.0f; break; case '+': g_viewerSettings.speedScale += 0.1f; if (g_viewerSettings.speedScale > 5.0f) g_viewerSettings.speedScale = 5.0f; break; } } break; } // switch (event->event) return iret; }
void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,POPUP_SUBMENU_ID_DISPLAYLISTVIEW),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->Goto(curAddress); break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_COPYINSTRUCTIONDISASM: { int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize) { GPUDebugOp op = gpuDebug->DissassembleOp(pos); p += snprintf(p, end - p, "%s\r\n", op.desc.c_str()); } W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: { gpuDebug->ResetListPC(list.id,curAddress); list.pc = curAddress; redraw(); } break; case ID_GEDBG_SETSTALLADDR: { gpuDebug->ResetListStall(list.id,curAddress); list.stall = curAddress; redraw(); } break; case ID_DISASM_COPYINSTRUCTIONHEX: { int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize) p += snprintf(p, end - p, "%08X\r\n", Memory::ReadUnchecked_U32(pos)); W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_RUNTOHERE: { SendMessage(GetParent(wnd),WM_GEDBG_RUNTOWPARAM,curAddress,0); redraw(); } break; case ID_GEDBG_GOTOPC: setCurAddress(list.pc); scrollAddressIntoView(); redraw(); break; case ID_GEDBG_GOTOADDR: { u32 newAddress = curAddress; if (!InputBox_GetHex(GetModuleHandle(NULL), wnd, L"Address", curAddress, newAddress)) { break; } if (Memory::IsValidAddress(newAddress)) { setCurAddress(newAddress); scrollAddressIntoView(); redraw(); } } break; } return; } redraw(); }
int Fl_Scrollbar::handle(int event) { // area of scrollbar: int X=0; int Y=0; int W=w(); int H=h(); box()->inset(X,Y,W,H); // adjust slider area to be inside the arrow buttons: if (vertical()) { if (H >= 3*W) {Y += W; H -= 2*W;} } else { if (W >= 3*H) {X += H; W -= 2*H;} } // which widget part is highlighted? int mx = Fl::event_x(); int my = Fl::event_y(); int which_part; if (!Fl::event_inside(0, 0, w(), h())) which_part = NOTHING; else if (vertical()) { if (my < Y) which_part = UP_ARROW; else if (my >= Y+H) which_part = DOWN_ARROW; else { int slidery = slider_position(value(), H); if (my < Y+slidery) which_part = ABOVE_SLIDER; else if (my >= Y+slidery+slider_size()) which_part = BELOW_SLIDER; else which_part = SLIDER; } } // horizontal else { if (mx < X) which_part = UP_ARROW; else if (mx >= X+W) which_part = DOWN_ARROW; else { int sliderx = slider_position(value(), W); if (mx < X+sliderx) which_part = ABOVE_SLIDER; else if (mx >= X+sliderx+slider_size()) which_part = BELOW_SLIDER; else which_part = SLIDER; } } switch (event) { case FL_FOCUS: return 0; case FL_ENTER: case FL_MOVE: if (!highlight_color()) return 1; if (which_part != which_highlight) { which_highlight = which_part; redraw(FL_DAMAGE_HIGHLIGHT); } return 1; case FL_LEAVE: if (which_highlight) { which_highlight = 0; redraw(FL_DAMAGE_HIGHLIGHT); } return 1; case FL_PUSH: // Clicking on the slider or middle or right click on the trough // gives us normal slider behavior: if (which_part == SLIDER || Fl::event_button() > 1 && which_part > DOWN_ARROW) { which_pushed = SLIDER; return Fl_Slider::handle(event, X,Y,W,H); } handle_push(); // middle/right click on arrows jumps to that end: if (Fl::event_button()>1) { if (which_part==UP_ARROW) handle_drag(vertical()?maximum():minimum()); else if (which_part==DOWN_ARROW) handle_drag(vertical()?minimum():maximum()); } goto J1; case FL_DRAG: if (which_pushed==SLIDER) return Fl_Slider::handle(event, X,Y,W,H); if (which_part == SLIDER) which_part = NOTHING; // it is okay to switch between arrows and nothing, but no other // changes are allowed: if (!which_pushed && which_part <= DOWN_ARROW) ; else if (!which_part && which_pushed <= DOWN_ARROW) ; else which_part = which_pushed; J1: if (which_part != which_pushed) { Fl::remove_timeout(timeout_cb, this); which_highlight = which_pushed = which_part; redraw(FL_DAMAGE_HIGHLIGHT); if (which_part) { Fl::add_timeout(INITIALREPEAT, timeout_cb, this); increment_cb(); } } return 1; case FL_RELEASE: if (which_pushed == SLIDER) { Fl_Slider::handle(event, X,Y,W,H); } else if (which_pushed) { Fl::remove_timeout(timeout_cb, this); handle_release(); redraw(FL_DAMAGE_HIGHLIGHT); } which_pushed = NOTHING; return 1; case FL_MOUSEWHEEL: { float n = (vertical() ? -Fl::event_dy() : Fl::event_dx()) * Fl_Style::wheel_scroll_lines * linesize(); if (fabs(n) > pagesize()) n = (n<0)?-pagesize():pagesize(); handle_drag(value()+n); return 1; } case FL_KEY: if (vertical()) switch(Fl::event_key()) { case FL_Home: handle_drag(maximum()); return 1; case FL_End: handle_drag(minimum()); return 1; case FL_Page_Up: handle_drag(value()-pagesize()); return 1; case FL_Page_Down: handle_drag(value()+pagesize()); return 1; } // else fall through... default: return Fl_Slider::handle(event); } }
/** * Sets the relative zero coordinate, deletes the old position * on the screen and draws the new one. */ void RS_GraphicView::moveRelativeZero(const RS_Vector& pos) { setRelativeZero(pos); redraw(RS2::RedrawGrid); }
void NpcDialog::buildLayout() { clearLayout(); if (mActionState != NPC_ACTION_INPUT) { if (mActionState == NPC_ACTION_WAIT) { mButton->setCaption(CAPTION_WAITING); } else if (mActionState == NPC_ACTION_NEXT) { mButton->setCaption(CAPTION_NEXT); } else if (mActionState == NPC_ACTION_CLOSE) { mButton->setCaption(CAPTION_CLOSE); } place(0, 0, mScrollArea, 5, 3); place(3, 3, mClearButton); place(4, 3, mButton); } else if (mInputState != NPC_INPUT_NONE) { if (!mLogInteraction) setText(mNewText); mButton->setCaption(CAPTION_SUBMIT); if (mInputState == NPC_INPUT_LIST) { place(0, 0, mScrollArea, 6, 3); place(0, 3, mListScrollArea, 6, 3); place(2, 6, mClearButton, 2); place(4, 6, mButton, 2); mItemList->setSelected(-1); } else if (mInputState == NPC_INPUT_STRING) { place(0, 0, mScrollArea, 6, 3); place(0, 3, mTextField, 6); place(0, 4, mResetButton, 2); place(2, 4, mClearButton, 2); place(4, 4, mButton, 2); } else if (mInputState == NPC_INPUT_INTEGER) { place(0, 0, mScrollArea, 6, 3); place(0, 3, mMinusButton, 1); place(1, 3, mIntField, 4); place(5, 3, mPlusButton, 1); place(0, 4, mResetButton, 2); place(2, 4, mClearButton, 2); place(4, 4, mButton, 2); } } Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); mButton->setEnabled(mActionState != NPC_ACTION_WAIT); redraw(); mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); }
void KiviatView::KiviatData::resizeData(int newSize) { data.resize(newSize); redraw(); }