/* * NAME: GuiWorkAreaReorderChildren * FUNCTION: * RETURNS: */ void GuiWorkAreaReorderChildren( Widget parent_subnode, WidgetList subnode_list, int n_subnodes, Widget position) { WorkAreaConstraints workArea_const; if (GuiIsWorkArea(parent_subnode)) parent_subnode = ((WorkAreaWidget)parent_subnode)->workArea.workArea_root; if (GuiIsWorkArea(XtParent(parent_subnode))) { workArea_const = WORKAREA_CONSTRAINT(parent_subnode); XtFree((char *)workArea_const->workArea.sub_nodes); workArea_const->workArea.sub_nodes = (WidgetList) XtMalloc(sizeof(Widget) * n_subnodes); memcpy(workArea_const->workArea.sub_nodes, subnode_list, sizeof(Widget) * n_subnodes); workArea_const->workArea.n_sub_nodes = n_subnodes; NewLayout((WorkAreaWidget)XtParent(parent_subnode)); Redisplay((WorkAreaWidget)XtParent(parent_subnode), NULL, NULL); } else { XmeWarning(parent_subnode, "Cannot ReorderChildren of parent widget of non-subclass of WorkArea"); } }
void UnifiedWindow::Reshape(const int width, const int height) { aspect_ = static_cast<double>(width) / static_cast<double>(height); double fovy; if(aspect_>1.0) fovy = fov_; else fovy = fov_ / aspect_; glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fovy, aspect_, 3.0 * fc->sizeFactor, 100.0 * fc->sizeFactor); glMatrixMode(GL_MODELVIEW); glViewport(0,0,width,height); #if defined(USE_VBO_CUDA) || defined(USE_VBO_CPU) ParticleRenderer *render = myFluid->renderer(); if (render) { render->setWindowSize(width, height); render->setFOV(60.0); } #endif Redisplay(); }
void ecBuildOptionsDialog::OnSelTree(wxTreeEvent& event) { wxTreeItemId item = m_treeCtrl->GetSelection(); if (item.IsOk()) { Redisplay(item); } }
/** * @brief Update any resources necessary after a GUI language change */ void CDirDoc::UpdateResources() { if (m_pDirView) m_pDirView->UpdateResources(); SetTitle(0); Redisplay(); }
/* ARGSUSED */ static void GExpose(Widget w, XtPointer junk, XEvent *event, Boolean *cont) { /* * Graphics exposure events are not currently sent to exposure proc. */ if (event->type == GraphicsExpose) Redisplay(w, event, NULL); } /* ChildExpose */
//Pre-written Draw Function void Player_Gl_Window::draw() { // Upon setup of the window (or when Fl_Gl_Window->invalidate is called), // the set of functions inside the if block are executed. if (!valid()) { GraphicsInit(); } // Redisplay the screen then put the proper buffer on the screen. Redisplay(); }
void ResizeLayersToCanvases() { Canvas *cv; Layer *l; int lx, ly; D_kaablamm = 0; for (cv = D_cvlist; cv; cv = cv->c_next) { l = cv->c_layer; if (l == 0) continue; if (l->l_width == cv->c_xe - cv->c_xs + 1 && l->l_height == cv->c_ye - cv->c_ys + 1) { continue; } if (MayResizeLayer(l)) { ResizeLayer(l, cv->c_xe - cv->c_xs + 1, cv->c_ye - cv->c_ys + 1, display); } /* normalize window, see screen.c */ lx = cv->c_layer->l_x; ly = cv->c_layer->l_y; if (ly + cv->c_yoff < cv->c_ys) { cv->c_yoff = cv->c_ys - ly; RethinkViewportOffsets(cv); } else if (ly + cv->c_yoff > cv->c_ye) { cv->c_yoff = cv->c_ye - ly; RethinkViewportOffsets(cv); } if (lx + cv->c_xoff < cv->c_xs) { int n = cv->c_xs - (lx + cv->c_xoff); if (n < (cv->c_xe - cv->c_xs + 1) / 2) n = (cv->c_xe - cv->c_xs + 1) / 2; if (cv->c_xoff + n > cv->c_xs) n = cv->c_xs - cv->c_xoff; cv->c_xoff += n; RethinkViewportOffsets(cv); } else if (lx + cv->c_xoff > cv->c_xe) { int n = lx + cv->c_xoff - cv->c_xe; if (n < (cv->c_xe - cv->c_xs + 1) / 2) n = (cv->c_xe - cv->c_xs + 1) / 2; if (cv->c_xoff - n + cv->c_layer->l_width - 1 < cv->c_xe) n = cv->c_xoff + cv->c_layer->l_width - 1 - cv->c_xe; cv->c_xoff -= n; RethinkViewportOffsets(cv); } } Redisplay(0); if (D_kaablamm) { kaablamm(); D_kaablamm = 0; } }
static Boolean MainFormHandleEvent(EventPtr event) { Boolean handled = false; int x, y; switch (event->eType) { case frmUpdateEvent: if (event->data.frmUpdate.formID == mainForm) { DIAG (("Call Redisplay\n")); Redisplay (); handled = true; } break; case frmOpenEvent: if (event->data.frmOpen.formID == mainForm) { FrmDrawForm (mainFrm); DamageBoard (); } break; case penDownEvent: if (PenLocation (event->screenX, event->screenY, &x, &y)) { pen_down = true; pen_down_x = x; pen_down_y = y; handled = true; } break; case penUpEvent: if (pen_down && PenLocation (event->screenX, event->screenY, &x, &y)) { HandleBoardPen (pen_down_x, pen_down_y, x, y); handled = true; } pen_down = false; break; case keyDownEvent: RicochetKeyHandleEvent (event); break; case menuEvent: RicochetMenuHandleEvent (event); break; default: break; } return handled; }
/* * NAME: GuiWorkAreaEnableRedisplay * FUNCTION: * RETURNS: */ void GuiWorkAreaEnableRedisplay( Widget w) { WorkAreaWidget workArea = (WorkAreaWidget) w; if (GuiIsWorkArea(w)) { workArea->workArea.delay_layout = FALSE; NewLayout(workArea); Redisplay(workArea, NULL, NULL); } else XmeWarning(w, "Cannot set EnableRedisplay of non-subclass of WorkArea"); }
void GLRenderer::draw() { static float tmp = 0.5; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // use the color specified by glClearColor _root->setRotation(0.0f, tmp, 0.0f); glUniformMatrix4fv(program->transformObjIndex, 1, GL_TRUE, (const GLfloat*) _root->getMatrix()); glUniformMatrix4fv(program->transformCamIndex, 1, GL_TRUE, (const GLfloat*) _root->getCamera()); glUniform3f(program->eyeIndex, 0.0f, 0.0f,0.0f); glEnableVertexAttribArray(POSITION); glEnableVertexAttribArray(COLOR); glEnableVertexAttribArray(TEXTURE_COORDINATE); glEnableVertexAttribArray(NORMAL); glBindBuffer(GL_ARRAY_BUFFER, _root->getVBO()); // let's bind it again to prepare for draw glVertexAttribPointer(POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); glVertexAttribPointer(COLOR, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)sizeof(Vector3f)); glVertexAttribPointer(TEXTURE_COORDINATE, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)(2 * sizeof(Vector3f))); glVertexAttribPointer(NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)((2 * sizeof(Vector3f)) + sizeof(Vector2f))); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _root->getIBO()); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, _root->getTBO()); glDrawElements(GL_TRIANGLES, _root->getNumIndices(), GL_UNSIGNED_INT, 0); glDisableVertexAttribArray(NORMAL); glDisableVertexAttribArray(TEXTURE_COORDINATE); glDisableVertexAttribArray(COLOR); glDisableVertexAttribArray(POSITION); Redisplay(); }
/* * Here when an exposure event occurs. */ void do_exposure(GR_EVENT_EXPOSURE *ep) { if (ep->wid == w->win) Redisplay(w); }
int main(int, char **) { int argc = 2; const char* argv[] = { "main", "-glDebug" }; glutInit(&argc, const_cast<char**>(&argv[0])); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(g_winWidth, g_winHeight); glutInitWindowPosition(0, 0); g_win = glutCreateWindow(argv[0]); #ifndef __APPLE__ glewInit(); if (!glewIsSupported("GL_VERSION_2_0")) { std::cout << "OpenGL 2.0 not supported" << std::endl; exit(1); } #endif // Step 1: Initilize the OpenGL engine glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment #ifndef __APPLE__ glClampColor(GL_CLAMP_READ_COLOR, GL_FALSE); // glClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE); // avoid any kind of clamping glClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE); // #endif glEnable(GL_TEXTURE_2D); glClearColor(0, 0, 0, 0); // background color glClearStencil(0); // clear stencil buffer // Step 2: Allocate the needed textures AllocateImageTexture(); AllocateDefaultLut3D(); // Step 3: Create the frame buffer and render buffer GLuint fboId; // create a framebuffer object, you need to delete them when program exits. glGenFramebuffers(1, &fboId); glBindFramebuffer(GL_FRAMEBUFFER, fboId); GLuint rboId; // create a renderbuffer object to store depth info glGenRenderbuffers(1, &rboId); glBindRenderbuffer(GL_RENDERBUFFER, rboId); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA32F_ARB, g_winWidth, g_winHeight); glBindRenderbuffer(GL_RENDERBUFFER, 0); // attach a texture to FBO color attachement point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, g_imageTexID, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_3D, g_lut3dTexID, 0); // attach a renderbuffer to depth attachment point glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rboId); glBindFramebuffer(GL_FRAMEBUFFER, 0); // Step 4: Execute all the unit tests unsigned failures = 0; const UnitTests & tests = GetUnitTests(); const size_t numTests = tests.size(); for(size_t idx=0; idx<numTests; ++idx) { OCIOGPUTest* test = tests[idx]; test->setup(); const unsigned curr_failures = failures; // Set the rendering destination to FBO glBindFramebuffer(GL_FRAMEBUFFER, fboId); // Clear buffer glClearColor(0.1f, 0.1f, 0.1f, 0.1f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); std::cerr << "Test [" << test->group() << "] [" << test->name() << "] - "; try { // Update the image texture UpdateImageTexture(); // Update the GPU shader program UpdateOCIOGLState(test->getProcessor()); // Enable the shader program, and its textures glUseProgram(g_program); glUniform1i(glGetUniformLocation(g_program, "tex1"), 1); glUniform1i(glGetUniformLocation(g_program, "tex2"), 2); // Process the image texture into the rendering buffer Reshape(); Redisplay(); // Validate the processed image using the rendering buffer ValidateImageTexture(test->getProcessor(), test->getErrorThreshold()); } catch(OCIO::Exception & ex) { ++failures; std::cerr << "FAILED - " << ex.what() << std::endl; } catch(...) { ++failures; std::cerr << "FAILED - Unexpected error" << std::endl; } if(curr_failures==failures) { std::cerr << "PASSED" << std::endl; } glUseProgram(0); glBindFramebuffer(GL_FRAMEBUFFER, 0); } std::cerr << std::endl << failures << " tests failed" << std::endl << std::endl; }
void UnifiedWindow::Motion(const int x, const int y) { if(left_button_ == true) { // we want to rotate int deltaX = x - clickX_; int deltaY = y - clickY_; clickX_ = x; clickY_ = y; if ((deltaX == 0) && (deltaY == 0)) return; double axisX = deltaY; double axisY = deltaX; double axisZ = 0.0; glGetIntegerv(GL_VIEWPORT, (GLint*)window_info_); double angle = 180.0 * sqrt(static_cast<double>(deltaX * deltaX + deltaY * deltaY)) / static_cast<double>(window_info_[2] + 1); // -> calculate axis in world coordinates double wx = rotation_matrix_[0] * axisX + rotation_matrix_[1] * axisY + rotation_matrix_[ 2] * axisZ; double wy = rotation_matrix_[4] * axisX + rotation_matrix_[5] * axisY + rotation_matrix_[ 6] * axisZ; double wz = rotation_matrix_[8] * axisX + rotation_matrix_[9] * axisY + rotation_matrix_[10] * axisZ; glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixd(rotation_matrix_); glRotated(angle, wx, wy, wz); glGetDoublev(GL_MODELVIEW_MATRIX, rotation_matrix_); glPopMatrix(); } if(middle_button_ == true) { int deltaX = x - clickX_; int deltaY = y - clickY_; clickX_ = x; clickY_ = y; glGetIntegerv(GL_VIEWPORT, (GLint*)window_info_); fov_ *= static_cast<double>(window_info_[3] - deltaY) / window_info_[3]; } if(right_button_ == true) { int deltaX = x - clickX_; int deltaY = y - clickY_; clickX_ = x; clickY_ = y; //translation is always camera system double dx = deltaX; double dy = -deltaY; double dz = 0.0; glGetIntegerv(GL_VIEWPORT, (GLint*)window_info_); dx *= fc->sizeFactor * 0.2 * fov_/window_info_[3]; dy *= fc->sizeFactor * 0.2 * fov_/window_info_[3]; dz *= fc->sizeFactor * 0.2 * fov_/window_info_[3]; translation_[0] += dx; translation_[1] += dy; translation_[2] += dz; } Redisplay(); }
static void MarkProcess(char **inbufp, size_t *inlenp) { char *inbuf, *pt; int inlen; int cx, cy, x2, y2, j, yend; int newcopylen = 0, od; int in_mark; int rep_cnt; struct acluser *md_user; /* char *extrap = 0, extrabuf[100]; */ markdata = (struct markdata *)flayer->l_data; fore = markdata->md_window; md_user = markdata->md_user; if (inbufp == 0) { MarkAbort(); return; } LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); inbuf = *inbufp; inlen = *inlenp; pt = inbuf; in_mark = 1; while (in_mark && (inlen /* || extrap */ )) { unsigned char ch = (unsigned char)*pt++; inlen--; if (flayer->l_mouseevent.start) { int r = LayProcessMouse(flayer, ch); if (r == -1) LayProcessMouseSwitch(flayer, 0); else { if (r) ch = 0222; else continue; } } od = mark_key_tab[(int)ch]; rep_cnt = markdata->rep_cnt; if (isdigit(od) && !markdata->f_cmd.flag) { if (rep_cnt < 1001 && (od != '0' || rep_cnt != 0)) { markdata->rep_cnt = 10 * rep_cnt + od - '0'; continue; /* * Now what is that 1001 here? Well, we have a screen with * 25 * 80 = 2000 characters. Movement is at most across the full * screen. This we do with word by word movement, as character by * character movement never steps over line boundaries. The most words * we can place on the screen are 1000 single letter words. Thus 1001 * is sufficient. Users with bigger screens never write in single letter * words, as they should be more advanced. jw. * Oh, wrong. We still give even the experienced user a factor of ten. */ } } cx = markdata->cx; cy = markdata->cy; if (markdata->f_cmd.flag) { markdata->f_cmd.flag = 0; markdata->rep_cnt = 0; if (isgraph(od)) { markdata->f_cmd.target = od; rep_cnt = (rep_cnt) ? rep_cnt : 1; nextchar(&cx, &cy, markdata->f_cmd.direction, od, rep_cnt); revto(cx, cy); continue; } } processchar: switch (od) { case 'f': /* fall through */ case 'F': /* fall through */ case 't': /* fall through */ case 'T': /* fall through */ /* * Set f_cmd to do a search on the next key stroke. * If we break, rep_cnt will be reset, so we * continue instead. It might be cleaner to * store the rep_count in f_cmd and * break here so later followon code will be * hit. */ markdata->f_cmd.flag = 1; markdata->f_cmd.direction = od; continue; case ';': case ',': if (!markdata->f_cmd.target) break; if (!rep_cnt) rep_cnt = 1; nextchar(&cx, &cy, od == ';' ? markdata->f_cmd.direction : (markdata->f_cmd.direction ^ 0x20), markdata->f_cmd.target, rep_cnt); revto(cx, cy); break; case 'o': case 'x': if (!markdata->second) break; markdata->cx = markdata->x1; markdata->cy = markdata->y1; markdata->x1 = cx; markdata->y1 = cy; revto(markdata->cx, markdata->cy); break; case '\014': /* CTRL-L Redisplay */ Redisplay(0); LGotoPos(flayer, cx, W2D(cy)); break; case 0202: /* M-C-b */ case '\010': /* CTRL-H Backspace */ case 'h': if (rep_cnt == 0) rep_cnt = 1; revto(cx - rep_cnt, cy); break; case 0216: /* M-C-p */ case '\016': /* CTRL-N */ case 'j': if (rep_cnt == 0) rep_cnt = 1; revto(cx, cy + rep_cnt); break; case '+': if (rep_cnt == 0) rep_cnt = 1; j = cy + rep_cnt; if (j > fore->w_histheight + fore->w_height - 1) j = fore->w_histheight + fore->w_height - 1; revto(linestart(j), j); break; case '-': if (rep_cnt == 0) rep_cnt = 1; cy -= rep_cnt; if (cy < 0) cy = 0; revto(linestart(cy), cy); break; case '^': revto(linestart(cy), cy); break; case '\n': revto(markdata->left_mar, cy + 1); break; case 0220: /* M-C-p */ case '\020': /* CTRL-P */ case 'k': if (rep_cnt == 0) rep_cnt = 1; revto(cx, cy - rep_cnt); break; case 0206: /* M-C-f */ case 'l': if (rep_cnt == 0) rep_cnt = 1; revto(cx + rep_cnt, cy); break; case '\001': /* CTRL-A from tcsh/emacs */ case '0': revto(markdata->left_mar, cy); break; case '\004': /* CTRL-D down half screen */ if (rep_cnt == 0) rep_cnt = (fore->w_height + 1) >> 1; revto_line(cx, cy + rep_cnt, W2D(cy)); break; case '$': revto(lineend(cy), cy); break; case '\022': /* CTRL-R emacs style backwards search */ ISearch(-1); in_mark = 0; break; case '\023': /* CTRL-S emacs style search */ ISearch(1); in_mark = 0; break; case '\025': /* CTRL-U up half screen */ if (rep_cnt == 0) rep_cnt = (fore->w_height + 1) >> 1; revto_line(cx, cy - rep_cnt, W2D(cy)); break; case '\007': /* CTRL-G show cursorpos */ if (markdata->left_mar == 0 && markdata->right_mar == fore->w_width - 1) LMsg(0, "Column %d Line %d(+%d)", cx + 1, W2D(cy) + 1, markdata->hist_offset); else LMsg(0, "Column %d(%d..%d) Line %d(+%d)", cx + 1, markdata->left_mar + 1, markdata->right_mar + 1, W2D(cy) + 1, markdata->hist_offset); break; case '\002': /* CTRL-B back one page */ if (rep_cnt == 0) rep_cnt = 1; rep_cnt *= fore->w_height; revto(cx, cy - rep_cnt); break; case '\006': /* CTRL-F forward one page */ if (rep_cnt == 0) rep_cnt = 1; rep_cnt *= fore->w_height; revto(cx, cy + rep_cnt); break; case '\005': /* CTRL-E scroll up */ if (rep_cnt == 0) rep_cnt = 1; MarkScrollUpDisplay(rep_cnt); if (cy < D2W(0)) revto(cx, D2W(0)); else LGotoPos(flayer, cx, W2D(cy)); break; case '\031': /* CTRL-Y scroll down */ if (rep_cnt == 0) rep_cnt = 1; MarkScrollDownDisplay(rep_cnt); if (cy > D2W(fore->w_height - 1)) revto(cx, D2W(fore->w_height - 1)); else LGotoPos(flayer, cx, W2D(cy)); break; case '@': /* it may be useful to have a key that does nothing */ break; case '%': rep_cnt--; /* rep_cnt is a percentage for the history buffer */ if (rep_cnt < 0) rep_cnt = 0; if (rep_cnt > 100) rep_cnt = 100; revto_line(markdata->left_mar, (rep_cnt * (fore->w_histheight + fore->w_height)) / 100, (fore->w_height - 1) / 2); break; case 0201: case 'g': rep_cnt = 1; /* FALLTHROUGH */ case 0205: case 'G': /* rep_cnt is here the WIN line number */ if (rep_cnt == 0) rep_cnt = fore->w_histheight + fore->w_height; revto_line(markdata->left_mar, --rep_cnt, (fore->w_height - 1) / 2); break; case 'H': revto(markdata->left_mar, D2W(0)); break; case 'M': revto(markdata->left_mar, D2W((fore->w_height - 1) / 2)); break; case 'L': revto(markdata->left_mar, D2W(fore->w_height - 1)); break; case '|': revto(--rep_cnt, cy); break; case 'w': if (rep_cnt == 0) rep_cnt = 1; nextword(&cx, &cy, NW_MUSTMOVE, rep_cnt); revto(cx, cy); break; case 'e': case 'E': if (rep_cnt == 0) rep_cnt = 1; nextword(&cx, &cy, NW_ENDOFWORD | NW_MUSTMOVE | (od == 'E' ? NW_BIG : 0), rep_cnt); revto(cx, cy); break; case 'b': case 'B': if (rep_cnt == 0) rep_cnt = 1; nextword(&cx, &cy, NW_BACK | NW_ENDOFWORD | NW_MUSTMOVE | (od == 'B' ? NW_BIG : 0), rep_cnt); revto(cx, cy); break; case 'a': markdata->append_mode = 1 - markdata->append_mode; LMsg(0, (markdata->append_mode) ? ":set append" : ":set noappend"); break; case 'v': case 'V': /* this sets start column to column 9 for VI :set nu users */ if (markdata->left_mar == 8) rep_cnt = 1; else rep_cnt = 9; /* FALLTHROUGH */ case 'c': case 'C': /* set start column (c) and end column (C) */ if (markdata->second) { rem(markdata->x1, markdata->y1, cx, cy, 1, (char *)0, fore->w_height - 1); /* Hack */ markdata->second = 1; /* rem turns off second */ } rep_cnt--; if (rep_cnt < 0) rep_cnt = cx; if (od != 'C') { markdata->left_mar = rep_cnt; if (markdata->left_mar > markdata->right_mar) markdata->left_mar = markdata->right_mar; } else { markdata->right_mar = rep_cnt; if (markdata->left_mar > markdata->right_mar) markdata->right_mar = markdata->left_mar; } if (markdata->second) { markdata->cx = markdata->x1; markdata->cy = markdata->y1; revto(cx, cy); } if (od == 'v' || od == 'V') LMsg(0, (markdata->left_mar != 8) ? ":set nonu" : ":set nu"); break; case 'J': /* how do you join lines in VI ? */ markdata->nonl = (markdata->nonl + 1) % 4; switch (markdata->nonl) { case 0: if (join_with_cr) LMsg(0, "Multiple lines (CR/LF)"); else LMsg(0, "Multiple lines (LF)"); break; case 1: LMsg(0, "Lines joined"); break; case 2: LMsg(0, "Lines joined with blanks"); break; case 3: LMsg(0, "Lines joined with comma"); break; } break; case '/': Search(1); in_mark = 0; break; case '?': Search(-1); in_mark = 0; break; case 'n': Search(0); break; case 'N': markdata->isdir = -markdata->isdir; Search(0); markdata->isdir = -markdata->isdir; break; case 'y': case 'Y': if (markdata->second == 0) { revto(linestart(cy), cy); markdata->second++; cx = markdata->x1 = markdata->cx; cy = markdata->y1 = markdata->cy; } if (--rep_cnt > 0) revto(cx, cy + rep_cnt); revto(lineend(markdata->cy), markdata->cy); if (od == 'y') break; /* FALLTHROUGH */ case 'W': if (od == 'W') { if (rep_cnt == 0) rep_cnt = 1; if (!markdata->second) { nextword(&cx, &cy, NW_BACK | NW_ENDOFWORD, 1); revto(cx, cy); markdata->second++; cx = markdata->x1 = markdata->cx; cy = markdata->y1 = markdata->cy; } nextword(&cx, &cy, NW_ENDOFWORD, rep_cnt); revto(cx, cy); } cx = markdata->cx; cy = markdata->cy; /* FALLTHROUGH */ case 'A': if (od == 'A') markdata->append_mode = 1; /* FALLTHROUGH */ case '>': if (od == '>') markdata->write_buffer = 1; /* FALLTHROUGH */ case ' ': case '\r': if (!markdata->second) { markdata->second++; markdata->x1 = cx; markdata->y1 = cy; revto(cx, cy); LMsg(0, "First mark set - Column %d Line %d", cx + 1, W2D(cy) + 1); break; } else { int append_mode = markdata->append_mode; int write_buffer = markdata->write_buffer; x2 = cx; y2 = cy; newcopylen = rem(markdata->x1, markdata->y1, x2, y2, 2, (char *)0, 0); /* count */ if (md_user->u_plop.buf && !append_mode) UserFreeCopyBuffer(md_user); yend = fore->w_height - 1; if (fore->w_histheight - markdata->hist_offset < fore->w_height) { markdata->second = 0; yend -= MarkScrollUpDisplay(fore->w_histheight - markdata->hist_offset); } if (newcopylen > 0) { /* the +3 below is for : cr + lf + \0 */ if (md_user->u_plop.buf) md_user->u_plop.buf = realloc(md_user->u_plop.buf, (unsigned)(md_user->u_plop.len + newcopylen + 3)); else { md_user->u_plop.len = 0; md_user->u_plop.buf = malloc((unsigned)(newcopylen + 3)); } if (!md_user->u_plop.buf) { MarkAbort(); in_mark = 0; LMsg(0, "Not enough memory... Sorry."); md_user->u_plop.len = 0; md_user->u_plop.buf = 0; break; } if (append_mode) { switch (markdata->nonl) { /* * this code defines, what glues lines together */ case 0: if (join_with_cr) { md_user->u_plop.buf[md_user->u_plop.len] = '\r'; md_user->u_plop.len++; } md_user->u_plop.buf[md_user->u_plop.len] = '\n'; md_user->u_plop.len++; break; case 1: break; case 2: md_user->u_plop.buf[md_user->u_plop.len] = ' '; md_user->u_plop.len++; break; case 3: md_user->u_plop.buf[md_user->u_plop.len] = ','; md_user->u_plop.len++; break; } } md_user->u_plop.len += rem(markdata->x1, markdata->y1, x2, y2, markdata->hist_offset == fore->w_histheight, md_user->u_plop.buf + md_user->u_plop.len, yend); md_user->u_plop.enc = fore->w_encoding; } if (markdata->hist_offset != fore->w_histheight) { LAY_CALL_UP(LRefreshAll(flayer, 0)); } ExitOverlayPage(); WindowChanged(fore, 'P'); if (append_mode) LMsg(0, "Appended %d characters to buffer", newcopylen); else LMsg(0, "Copied %d characters into buffer", md_user->u_plop.len); if (write_buffer) WriteFile(md_user, (char *)0, DUMP_EXCHANGE); in_mark = 0; break; } case 0222: if (flayer->l_mouseevent.start) { int button = flayer->l_mouseevent.buffer[0]; if (button == 'a') { /* Scroll down */ od = 'j'; } else if (button == '`') { /* Scroll up */ od = 'k'; } else if (button == ' ') { /* Left click */ cx = flayer->l_mouseevent.buffer[1]; cy = D2W(flayer->l_mouseevent.buffer[2]); revto(cx, cy); od = ' '; } else od = 0; LayProcessMouseSwitch(flayer, 0); if (od) goto processchar; } else LayProcessMouseSwitch(flayer, 1); break; default: MarkAbort(); LMsg(0, "Copy mode aborted"); in_mark = 0; break; } if (in_mark) /* markdata may be freed */ markdata->rep_cnt = 0; } if (in_mark) { flayer->l_x = markdata->cx; flayer->l_y = W2D(markdata->cy); } *inbufp = pt; *inlenp = inlen; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(512, 512); glutInitWindowPosition (100, 100); g_win = glutCreateWindow(argv[0]); #ifndef __APPLE__ glewInit(); if (!glewIsSupported("GL_VERSION_2_0")) { printf("OpenGL 2.0 not supported\n"); exit(1); } #endif glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(SpecialKey); glutDisplayFunc(Redisplay); const char * filename = 0; if(argc>1) filename = argv[1]; std::cout << USAGE_TEXT << std::endl; // TODO: switch profiles based on shading language // std::cout << "GL_SHADING_LANGUAGE_VERSION: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl; AllocateLut3D(); InitImageTexture(filename); try { InitOCIO(filename); } catch(OCIO::Exception & e) { std::cerr << e.what() << std::endl; exit(1); } PopulateOCIOMenus(); Reshape(1024, 512); UpdateOCIOGLState(); Redisplay(); /* if (Anim) { glutIdleFunc(Idle); } */ glutMainLoop(); return 0; }