void SheetView::redraw(bool full){ if(full){ clear(); } int i,j; move(0,0); addstr(" "); attron(A_REVERSE); for(i=0;i<COLS/8-1;i++){ string label=centreString(columnLabel(i+scroll.column),8); mvaddstr(0,columnToX(i+scroll.column),label.data()); } for(i=0;i<LINES-2;i++){ string label=centreString(to_string(i+1+scroll.row),8); mvaddstr(rowToY(i+scroll.row),0,label.data()); } attroff(A_REVERSE); for(i=0;i<COLS/8-1;i++){ for(j=0;j<LINES-2;j++){ if(CellAddress(j+scroll.row,i+scroll.column)==cursor)continue; redrawCell(CellAddress(j+scroll.row,i+scroll.column),false); } } redrawCell(cursor,true); }
gint redrawGL2PS() { GLdouble m[4][4]; GtkWidget *widget = GLArea; if(!GTK_IS_WIDGET(widget)) return TRUE; if(!GTK_WIDGET_REALIZED(widget)) return TRUE; glMatrixMode(GL_PROJECTION); glLoadIdentity(); addFog(); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); set_background_color(); mYPerspective(45,(GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height,1,100); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(optcol==-1) drawChecker(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(perspective) mYPerspective(Zoom,(GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height,zNear,zFar); else { gdouble fw = (GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height; gdouble fh = 1.0; glOrtho(-fw,fw,-fh,fh,-1,1); } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(perspective) glTranslatef(Trans[0],Trans[1],Trans[2]); else { glTranslatef(Trans[0]/10,Trans[1]/10,0); glScalef(1/Zoom*2,1/Zoom*2,1/Zoom*2); } SetLight(); build_rotmatrix(m,Quat); glMultMatrixd(&m[0][0]); redrawGeometry(); redrawSurfaces(); redrawCell(); redrawContours(); redrawPlanesMapped(); if(get_show_symbols() || get_show_numbers() || get_show_charges()) showLabelSymbolsNumbersCharges(); if(get_show_dipole()) showLabelDipole(); if(get_show_distances()) showLabelDistances(); if(get_show_axes()) showLabelAxes(); if(get_show_axes()) showLabelPrincipalAxes(); showLabelTitle(GLArea->allocation.width,GLArea->allocation.height); /* Swap backbuffer to front */ glFlush(); return TRUE; }
void SheetView::setCursorPosition(CellAddress addr){ sheet.ensureSheetSize(addr.column+1,addr.row+1); bool didscroll=false; if(addr.column>=scroll.column+COLS/8-1){ scroll.column=addr.column-(COLS/8-1)+1; didscroll=true; } if(addr.row>=scroll.row+LINES-2){ scroll.row=addr.row-(LINES-2)+1; didscroll=true; } if(addr.column<scroll.column){ scroll.column=addr.column; didscroll=true; } if(addr.row<scroll.row){ scroll.row=addr.row; didscroll=true; } if(didscroll){ cursor=addr; redraw(); } else { CellAddress oldcursor=cursor; cursor=addr; redrawCell(oldcursor,false); //redraw left&right too, since the cell value might have leaked there if((int)oldcursor.column-(int)scroll.column<COLS/8-2){ //right redrawCell(CellAddress(oldcursor.row,oldcursor.column+1)); } if((int)oldcursor.column-(int)scroll.column>0){ //left redrawCell(CellAddress(oldcursor.row,oldcursor.column-1)); } displayStatusString(""); redrawCell(cursor,true); } }
void SheetView::redrawCell(CellAddress addr){ redrawCell(addr,true); }
static gint redraw(GtkWidget *widget, gpointer data) { GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); GLdouble m[4][4]; if(!GTK_IS_WIDGET(widget)) return TRUE; if(!GTK_WIDGET_REALIZED(widget)) return TRUE; if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) return FALSE; glMatrixMode(GL_PROJECTION); glLoadIdentity(); addFog(); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); set_background_color(); mYPerspective(45,(GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height,1,100); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(optcol==-1) drawChecker(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(perspective) mYPerspective(Zoom,(GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height,zNear,zFar); else { gdouble fw = (GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height; gdouble fh = 1.0; glOrtho(-fw,fw,-fh,fh,-1,1); } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(perspective) glTranslatef(Trans[0],Trans[1],Trans[2]); else { glTranslatef(Trans[0]/10,Trans[1]/10,0); glScalef(1/Zoom*2,1/Zoom*2,1/Zoom*2); } SetLight(); build_rotmatrix(m,Quat); glMultMatrixd(&m[0][0]); redrawGeometry(); redrawSurfaces(); redrawCell(); redrawContours(); redrawPlanesMapped(); if(get_show_symbols() || get_show_numbers() || get_show_charges()) showLabelSymbolsNumbersCharges(); if(get_show_dipole()) showLabelDipole(); if(get_show_distances()) showLabelDistances(); if(get_show_axes()) showLabelAxes(); if(get_show_axes()) showLabelPrincipalAxes(); showLabelTitle(GLArea->allocation.width,GLArea->allocation.height); /* glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glDepthRange(0.0f,1.0f); */ if (gdk_gl_drawable_is_double_buffered (gldrawable)) gdk_gl_drawable_swap_buffers (gldrawable); else glFlush (); gdk_gl_drawable_gl_end (gldrawable); while( gtk_events_pending() ) gtk_main_iteration(); createImagesFiles(); /* gtk_widget_queue_draw(PrincipalWindow);*/ return TRUE; }