本文整理汇总了C++中redraw函数的典型用法代码示例。如果您正苦于以下问题:C++ redraw函数的具体用法?C++ redraw怎么用?C++ redraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redraw函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: toGraph
/**
* 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());
//.........这里部分代码省略.........
开发者ID:SkipUFO,项目名称:LibreCAD,代码行数:101,代码来源:qg_graphicview.cpp
示例2: redraw
/**
* Show is called automatically when the window is created.
*/
void WindowMainMenu::show() {
redraw();
}
开发者ID:jluttine,项目名称:ipag,代码行数:6,代码来源:WindowMainMenu.cpp
示例3: switch
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;
}
开发者ID:fundamental,项目名称:Carla,代码行数:88,代码来源:EnvelopeFreeEdit.cpp
示例4: redraw
void redraw(bool forceredraw){
redraw(Inter::drawScreen,false,forceredraw);
}
开发者ID:Abdillah,项目名称:editor,代码行数:3,代码来源:screen.cpp
示例5: recreateQuestList
void CQuestLog::sliderMoved (int newpos)
{
recreateQuestList (newpos); //move components
redraw();
}
开发者ID:andrew889,项目名称:vcmi,代码行数:5,代码来源:CQuestLog.cpp
示例6: cursor2rowcol
//.........这里部分代码省略.........
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;
开发者ID:benschneider,项目名称:Spyview,代码行数:67,代码来源:Fl_Table.C
示例7: redraw
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Empty the shapes vector, then redraw
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
void Scene::clear(){
shapes.clear();
redraw();
}
开发者ID:moogar0880,项目名称:Graphics,代码行数:7,代码来源:Scene.cpp
示例8: redraw
void Edit::sttitle(String val)
{
title=val;
redraw();
}
开发者ID:ayourtch,项目名称:joes-sandbox,代码行数:5,代码来源:edit.c
示例9: while
//.........这里部分代码省略.........
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();
}
开发者ID:genekogan,项目名称:Manta,代码行数:101,代码来源:MantaAudioUnitController.cpp
示例10: toggleCB
void Flu_Toggle_Group :: toggleCB()
{
do_callback();
redraw();
}
开发者ID:BlitzMaxModules,项目名称:maxgui.mod,代码行数:5,代码来源:Flu_Toggle_Group.cpp
示例11: main
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;
}
开发者ID:Saruta,项目名称:ToyOS,代码行数:80,代码来源:imgviewer.c
示例12: switch
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);
//.........这里部分代码省略.........
开发者ID:Loreia,项目名称:UDL2,代码行数:101,代码来源:columnEditor.cpp
示例13: while
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));
}
开发者ID:CyrodiilSavior,项目名称:openmw,代码行数:61,代码来源:list.cpp
示例14: redraw
void MWList::adjustSize()
{
redraw();
}
开发者ID:CyrodiilSavior,项目名称:openmw,代码行数:4,代码来源:list.cpp
示例15: switch
/**
* 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");
}
开发者ID:DevinderKaur,项目名称:LibreCAD-1,代码行数:97,代码来源:rs_graphicview.cpp
示例16: redraw
void CtrlDisAsmView::SetNextStatement()
{
debugger->setPC(selection);
redraw();
}
开发者ID:716Girl,项目名称:ppsspp,代码行数:5,代码来源:ctrldisasmview.cpp
示例17: getWidth
/**
* 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();
}
开发者ID:DevinderKaur,项目名称:LibreCAD-1,代码行数:76,代码来源:rs_graphicview.cpp
示例18: Fl_Group
// 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
}
开发者ID:benschneider,项目名称:Spyview,代码行数:64,代码来源:Fl_Table.C
示例19: main
//.........这里部分代码省略.........
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;
}
开发者ID:Bluerise,项目名称:openbsd-src,代码行数:101,代码来源:bog.c
示例20: redraw
void MSSash::updateBackground(unsigned long oldbg_)
{
MSWidgetCommon::updateBackground(oldbg_);
redraw();
}
开发者ID:PlanetAPL,项目名称:a-plus,代码行数:5,代码来源:MSPane.C
注:本文中的redraw函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论