static int dtor( GEM_PLOTTER self ) { int i=0; LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__)); if( VIEW(self).mem ) free( VIEW(self).mem ); #ifdef WITH_8BPP_SUPPORT if( DUMMY_PRIV(self)->vfmt.indexed ){ for( i=OFFSET_WEB_PAL; i<OFFSET_CUST_PAL+16; i++){ vs_color( self->vdi_handle, i, &sys_pal[i][0] ); } } #endif /* close Hermes stuff: */ Hermes_ConverterReturn( hermes_cnv_h ); Hermes_Done(); if( self->priv_data != NULL ){ if( DUMMY_PRIV(self)->buf_packed ) free( DUMMY_PRIV(self)->buf_packed ); if( DUMMY_PRIV(self)->buf_planar ) free( DUMMY_PRIV(self)->buf_planar ); free( self->priv_data ); } snapshot_destroy( self ); return( 1 ); }
/* Get current visible coords */ static inline void plotter_get_visible_grect( GEM_PLOTTER self, GRECT * out ) { out->g_x = VIEW( self ).vis_x; out->g_y = VIEW( self ).vis_y; out->g_w = VIEW( self ).vis_w; out->g_h = VIEW( self ).vis_h; }
static int get_clip( GEM_PLOTTER self, struct rect * out ) { out->x0 = VIEW( self ).clipping.x0; out->y0 = VIEW( self ).clipping.y0; out->x1 = VIEW( self ).clipping.x1; out->y1 = VIEW( self ).clipping.y1; return( 1 ); }
static int set_clip(GEM_PLOTTER self, const struct rect * clip) { // FIXME: consider the canvas size VIEW( self ).clipping.x0 = clip->x0; VIEW( self ).clipping.y0 = clip->y0; VIEW( self ).clipping.x1 = clip->x1; VIEW( self ).clipping.y1 = clip->y1; return ( 1 ); }
static enum request blame_request(struct view *view, enum request request, struct line *line) { enum open_flags flags = view_is_displayed(view) ? OPEN_SPLIT : OPEN_DEFAULT; struct blame *blame = line->data; switch (request) { case REQ_VIEW_BLAME: case REQ_PARENT: if (!check_blame_commit(blame, TRUE)) break; blame_go_forward(view, blame, request == REQ_PARENT); break; case REQ_BACK: blame_go_back(view); break; case REQ_ENTER: if (!check_blame_commit(blame, FALSE)) break; if (view_is_displayed(VIEW(REQ_VIEW_DIFF)) && !strcmp(blame->commit->id, VIEW(REQ_VIEW_DIFF)->ref)) break; if (string_rev_is_null(blame->commit->id)) { struct view *diff = VIEW(REQ_VIEW_DIFF); const char *diff_parent_argv[] = { GIT_DIFF_BLAME(encoding_arg, opt_diff_context_arg, opt_ignore_space_arg, view->vid) }; const char *diff_no_parent_argv[] = { GIT_DIFF_BLAME_NO_PARENT(encoding_arg, opt_diff_context_arg, opt_ignore_space_arg, view->vid) }; const char **diff_index_argv = *blame->commit->parent_id ? diff_parent_argv : diff_no_parent_argv; open_argv(view, diff, diff_index_argv, NULL, flags); if (diff->pipe) string_copy_rev(diff->ref, NULL_ID); } else { open_view(view, REQ_VIEW_DIFF, flags); } break; default: return request; } return REQ_NONE; }
static int move( GEM_PLOTTER self,short x, short y ) { bool upd; if(x == VIEW(self).x && y == VIEW(self).y ){ return 1; } LOG(("%s: x: %d, y: %d\n",(char*)__FUNCTION__, x, y)); VIEW(self).x = x; VIEW(self).y = y; update_visible_rect( self ); return( 1 ); }
static int resize( GEM_PLOTTER self, int w, int h ) { if( w == VIEW(self).w && h == VIEW(self).h ) return( 1 ); struct rect newclip = { 0, 0, w-1, h-1 }; VIEW(self).w = w; VIEW(self).h = h; update_visible_rect( self ); set_clip( self, &newclip); LOG(("%s: %s\n", (char*)__FILE__, (char*)__FUNCTION__)); return( 1 ); }
void FUNCTION (test, binary_noncontiguous) (const size_t M, const size_t N) { TYPE (gsl_matrix) * l = FUNCTION (gsl_matrix, calloc) (M+1, N+1); VIEW (gsl_matrix, view) m = FUNCTION (gsl_matrix, submatrix) (l, 0, 0, M, N); size_t i, j; size_t k = 0; { FILE *f = fopen ("test.dat", "wb"); k = 0; for (i = 0; i < M; i++) { for (j = 0; j < N; j++) { k++; FUNCTION (gsl_matrix, set) (&m.matrix, i, j, (BASE) k); } } FUNCTION (gsl_matrix, fwrite) (f, &m.matrix); fclose (f); } { FILE *f = fopen ("test.dat", "rb"); TYPE (gsl_matrix) * ll = FUNCTION (gsl_matrix, alloc) (M+1, N+1); VIEW (gsl_matrix, view) mm = FUNCTION (gsl_matrix, submatrix) (ll, 0, 0, M, N); status = 0; FUNCTION (gsl_matrix, fread) (f, &mm.matrix); k = 0; for (i = 0; i < M; i++) { for (j = 0; j < N; j++) { k++; if (FUNCTION (gsl_matrix, get) (&mm.matrix, i, j) != (BASE) k) status = 1; } } gsl_test (status, NAME (gsl_matrix) "_write and read (noncontiguous)"); fclose (f); FUNCTION (gsl_matrix, free) (ll); } FUNCTION (gsl_matrix, free) (l); }
/* Returns the visible parts of the box (relative coords within framebuffer), relative to screen coords (normally starting at 0,0 ) */ static inline bool fbrect_to_screen( GEM_PLOTTER self, GRECT box, GRECT * ret ) { GRECT out, vis, screen; screen.g_x = 0; screen.g_y = 0; screen.g_w = vdi_sysinfo.scr_w; screen.g_h = vdi_sysinfo.scr_h; /* get visible region: */ vis.g_x = VIEW(self).x; vis.g_y = VIEW(self).y; vis.g_w = VIEW(self).w; vis.g_h = VIEW(self).h; if ( !rc_intersect( &screen, &vis ) ) { return( false ); } vis.g_x = VIEW(self).w - vis.g_w; vis.g_y = VIEW(self).h - vis.g_h; /* clip box to visible region: */ if( !rc_intersect(&vis, &box) ) { return( false ); } out.g_x = box.g_x + VIEW(self).x; out.g_y = box.g_y + VIEW(self).y; out.g_w = box.g_w; out.g_h = box.g_h; *ret = out; return ( true ); }
/* because this is an on-screen plotter, this is an screen to screen copy. */ static int copy_rect( GEM_PLOTTER self, GRECT src, GRECT dst ) { MFDB devmf; MFDB scrmf; short pxy[8]; GRECT vis; /* clip to visible rect, only needed for onscreen renderer: */ plotter_get_visible_grect( self, &vis ); if( !rc_intersect(&vis, &src) ) return 1; if( !rc_intersect(&vis, &dst) ) return 1; src.g_x = VIEW(self).x + src.g_x; src.g_y = VIEW(self).y + src.g_y; dst.g_x = VIEW(self).x + dst.g_x; dst.g_y = VIEW(self).y + dst.g_y; devmf.fd_addr = NULL; devmf.fd_w = src.g_w; devmf.fd_h = src.g_h; devmf.fd_wdwidth = 0; devmf.fd_stand = 0; devmf.fd_nplanes = 0; devmf.fd_r1 = devmf.fd_r2 = devmf.fd_r3 = 0; scrmf.fd_addr = NULL; scrmf.fd_w = dst.g_w; scrmf.fd_h = dst.g_h; scrmf.fd_wdwidth = 0 ; scrmf.fd_stand = 0; scrmf.fd_nplanes = 0; scrmf.fd_r1 = scrmf.fd_r2 = scrmf.fd_r3 = 0; pxy[0] = src.g_x; pxy[1] = src.g_y; pxy[2] = pxy[0] + src.g_w-1; pxy[3] = pxy[1] + src.g_h-1; pxy[4] = dst.g_x; pxy[5] = dst.g_y; pxy[6] = pxy[4] + dst.g_w-1; pxy[7] = pxy[5] + dst.g_h-1; self->lock( self ); vro_cpyfm( self->vdi_handle, S_ONLY, (short*)&pxy, &devmf, &scrmf); self->unlock( self ); return( 1 ); }
static GList * find_webview(JSObjectRef o) { if (dwb.state.fview == NULL) { return NULL; } for (GList *r = dwb.state.fview; r; r=r->next) if (VIEW(r)->script_wv == o) return r; for (GList *r = dwb.state.fview->prev; r; r=r->prev) if (VIEW(r)->script_wv == o) return r; return NULL; }
GtkWidget* view_new (Scene *scene, GLDrawingArea *context) { View *view = VIEW (g_object_new (view_get_type (), NULL)); GtkWidget *box, *window; view->xml = glade_xml_new (GLADEDIR "/view.glade", NULL, NULL); if (!view->xml) return NULL; box = glade_xml_get_widget (view->xml, "view vbox"); window = glade_xml_get_widget (view->xml, "window"); gtk_widget_ref (box); gtk_container_remove (GTK_CONTAINER (window), box); gtk_box_pack_start (GTK_BOX (view), GTK_WIDGET (box), TRUE, TRUE, 0); gtk_widget_unref (box); gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (context), TRUE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (box), GTK_WIDGET (context), 0); if (scene == NULL) scene = scene_new (); view->scene = scene; view->context = context; g_signal_connect_after (G_OBJECT (context), "realize", G_CALLBACK (on_gl_context_realize), (gpointer) view); return GTK_WIDGET (view); }
static void subcolumnview_destroy( GtkObject *object ) { Subcolumnview *sview; #ifdef DEBUG printf( "subcolumnview_destroy\n" ); #endif /*DEBUG*/ g_return_if_fail( object != NULL ); g_return_if_fail( IS_SUBCOLUMNVIEW( object ) ); sview = SUBCOLUMNVIEW( object ); UNREF( sview->group ); /* Destroying us won't automatically destroy our rowviews, since they * are not true child-widgets. Do it by hand. */ (void) view_map( VIEW( sview ), (view_map_fn) subcolumnview_destroy_sub, sview, NULL ); DESTROY_GTK( sview->table ); GTK_OBJECT_CLASS( parent_class )->destroy( object ); }
static gboolean plugins_before_unload_cb(WebKitDOMDOMWindow *win, WebKitDOMEvent *event, GList *gl) { plugins_remove_all(gl); plugins_free_elements(VIEW(gl)->plugins); return true; }
static void expressionview_set_edit( Expressionview *expressionview, gboolean edit ) { formula_set_edit( expressionview->formula, edit ); if( edit ) view_resettable_register( VIEW( expressionview ) ); }
static int disc(GEM_PLOTTER self,int x, int y, int radius, const plot_style_t * pstyle) { plotter_vdi_clip( self, 1); if( pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsf_rgbcolor( self->vdi_handle, pstyle->stroke_colour ); vsf_perimeter( self->vdi_handle, 1); vsf_interior( self->vdi_handle, 0 ); v_circle( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius ); } else { vsf_rgbcolor( self->vdi_handle, pstyle->fill_colour ); vsf_perimeter( self->vdi_handle, 0); vsf_interior( self->vdi_handle, FIS_SOLID ); v_circle( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius ); } plotter_vdi_clip( self, 0); return ( 1 ); }
/* session_save(const char *) {{{*/ gboolean session_save(const char *name, int flags) { if (!name) { if (s_session_name) name = s_session_name; else if (flags & SESSION_FORCE) name = "default"; } if (!s_has_marked && (flags & SESSION_FORCE) == 0) return false; GString *buffer = g_string_new(NULL); for (GList *l = g_list_first(dwb.state.views); l; l=l->next) { WebKitWebView *web = WEBVIEW(l); WebKitWebBackForwardList *bf_list = webkit_web_view_get_back_forward_list(web); if (VIEW(l)->status->deferred) { g_string_append_printf(buffer, "0|%d %s unknown\n", VIEW(l)->status->lockprotect, VIEW(l)->status->deferred_uri); continue; } for (int i= -webkit_web_back_forward_list_get_back_length(bf_list); i<=webkit_web_back_forward_list_get_forward_length(bf_list); i++) { WebKitWebHistoryItem *item = webkit_web_back_forward_list_get_nth_item(bf_list, i); if (item) { g_string_append_printf(buffer, "%d", i); if (i == 0) g_string_append_printf(buffer, "|%d", VIEW(l)->status->lockprotect); g_string_append_printf(buffer, " %s %s\n", webkit_web_history_item_get_uri(item), webkit_web_history_item_get_title(item)); } } } session_save_file(name, buffer->str, (flags & SESSION_SYNC) != 0); if (! (flags & SESSION_SYNC)) g_free(s_session_name); g_string_free(buffer, true); return true; }/*}}}*/
void plugins_disconnect(GList *gl) { View *v = VIEW(gl); if (v->plugins->status & PLUGIN_STATUS_DISCONNECTED) return; for (int i=SIG_PLUGINS_FIRST+1; i<SIG_PLUGINS_LAST; i++) { if (VIEW(gl)->status->signals[i] > 0) { g_signal_handler_disconnect(WEBVIEW(gl), VIEW(gl)->status->signals[i]); v->status->signals[i] = 0; } } plugins_remove_all(gl); v->plugins->status ^= (v->plugins->status & PLUGIN_STATUS_CONNECTED) | PLUGIN_STATUS_DISCONNECTED; }
int Graphics::lock() { status_t res; view = VIEW(this); // dirty // return view->LockLooper(); res = view->LockLooperWithTimeout(5e6); // !!! TIMING OUT, SIR DBG(AWT_GRA, if (res!=B_OK) printf("AWT_GRA LOCK FAILED\n") ); return res == B_OK; }
void FUNCTION (matrix, set_view_and_push) (lua_State *L, int index, double *data, size_t n1, size_t n2, const double *src) { VIEW (gsl_matrix) *view = FUNCTION (matrix, check_view) (L, index); *view = FUNCTION (gsl_matrix, view_array) (data, n1, n2); if (src) memcpy (data, src, n1 * n2 * sizeof(BASE)); lua_pushvalue (L, index); }
void workspaceview_set_cursor( Workspaceview *wview, iWindowShape shape ) { if( !wview->context ) wview->context = iwindow_cursor_context_new( IWINDOW( view_get_toplevel( VIEW( wview ) ) ), 0, "workspaceview" ); iwindow_cursor_context_set_cursor( wview->context, shape ); }
static void workspaceview_child_size_cb( Columnview *cview, GtkAllocation *allocation, Workspaceview *wview ) { Workspace *ws = WORKSPACE( VOBJECT( wview )->iobject ); Workspacegroup *wsg = workspace_get_workspacegroup( ws ); int right, bottom; g_assert( IS_WORKSPACEVIEW( wview ) ); /* Compute a new bounding box for our children. */ wview->bounding.left = 0; wview->bounding.top = 0; wview->bounding.width = 0; wview->bounding.height = 0; (void) view_map( VIEW( wview ), (view_map_fn) workspaceview_child_size_sub, &wview->bounding, NULL ); wview->bounding.width += 1000; wview->bounding.height += 1000; #ifdef DEBUG { Column *col = COLUMN( VOBJECT( cview )->iobject ); printf( "workspaceview_child_size_cb: cview %s " "bb left=%d, top=%d, width=%d, height=%d\n", IOBJECT( col )->name, wview->bounding.left, wview->bounding.top, wview->bounding.width, wview->bounding.height ); } #endif /*DEBUG*/ /* Resize our fixed if necessary. */ right = IM_RECT_RIGHT( &wview->bounding ); bottom = IM_RECT_BOTTOM( &wview->bounding ); if( right != wview->width || bottom != wview->height ) { gtk_widget_set_size_request( GTK_WIDGET( wview->fixed ), right, bottom ); /* Update the model hints ... it uses bounding to position * loads and saves. */ ws->area = wview->bounding; filemodel_set_offset( FILEMODEL( wsg ), ws->area.left, ws->area.top ); } }
static int line(GEM_PLOTTER self,int x0, int y0, int x1, int y1, const plot_style_t * pstyle) { short pxy[4]; uint32_t lt; int sw = pstyle->stroke_width; pxy[0] = VIEW(self).x + x0; pxy[1] = VIEW(self).y + y0; pxy[2] = VIEW(self).x + x1; pxy[3] = VIEW(self).y + y1; plotter_vdi_clip( self, 1); if( sw == 0) sw = 1; NSLT2VDI(lt, pstyle) vsl_type( self->vdi_handle, (lt&0x0F) ); /* if the line style is not available within VDI system,define own style: */ if( (lt&0x0F) == 7 ){ vsl_udsty(self->vdi_handle, ((lt&0xFFFF00) >> 8) ); }
void plugins_create_click_element(WebKitDOMElement *element, GList *gl) { WebKitDOMNode *parent = webkit_dom_node_get_parent_node(WEBKIT_DOM_NODE(element)); View *v = VIEW(gl); WebKitDOMElement *div; if (parent == NULL) return; WebKitDOMDocument *doc = webkit_dom_node_get_owner_document(WEBKIT_DOM_NODE(element)); WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc); WebKitDOMCSSStyleDeclaration *style = webkit_dom_dom_window_get_computed_style(win, element, ""); char *width = webkit_dom_css_style_declaration_get_property_value(style, "width"); char *height = webkit_dom_css_style_declaration_get_property_value(style, "height"); char *top = webkit_dom_css_style_declaration_get_property_value(style, "top"); char *left = webkit_dom_css_style_declaration_get_property_value(style, "left"); char *position = webkit_dom_css_style_declaration_get_property_value(style, "position"); int w, h; if (sscanf(width, "%dpx", &w) == 1 && w<72) w = 72; if (sscanf(height, "%dpx", &h) == 1 && h<24) h = 24; if (v->plugins->max <= v->plugins->created) { div = webkit_dom_document_create_element(doc, "div", NULL); v->plugins->clicks = g_slist_prepend(v->plugins->clicks, div); v->plugins->max++; } else div = g_slist_nth_data(v->plugins->clicks, v->plugins->created); webkit_dom_html_element_set_inner_html(WEBKIT_DOM_HTML_ELEMENT(div), "<div style='display:table-cell;vertical-align:middle;text-align:center;color:#fff;background:#000;border:1px solid #666;font:11px monospace bold'>click to enable flash</div>", NULL); char *new_style = g_strdup_printf("position:%s;width:%dpx;height:%dpx;top:%s;left:%s;display:table;z-index:37000;", position, w, h, top, left); webkit_dom_element_set_attribute(div, "style", new_style, NULL); g_free(new_style); webkit_dom_element_set_attribute(div, "onclick", "return", NULL); g_object_set_data((gpointer)div, "dwb-plugin-element", element); webkit_dom_node_remove_child(parent, WEBKIT_DOM_NODE(element), NULL); webkit_dom_node_append_child(parent, WEBKIT_DOM_NODE(div), NULL); v->plugins->elements = g_slist_prepend(v->plugins->elements, element); webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(div), "click", G_CALLBACK(plugins_onclick_cb), true, gl); g_object_unref(style); g_object_unref(parent); v->plugins->created++; }
static int arc(GEM_PLOTTER self,int x, int y, int radius, int angle1, int angle2, const plot_style_t * pstyle) { //plotter_vdi_clip( self, 1); vswr_mode( self->vdi_handle, MD_REPLACE ); if( pstyle->fill_type == PLOT_OP_TYPE_NONE ) return 1; if( pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsl_rgbcolor( self->vdi_handle, pstyle->stroke_colour); vsf_perimeter( self->vdi_handle, 1); vsf_interior( self->vdi_handle, 1 ); v_arc( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius, angle1*10, angle2*10 ); } else { vsf_rgbcolor( self->vdi_handle, pstyle->fill_colour); vsl_width( self->vdi_handle, 1 ); vsf_perimeter( self->vdi_handle, 1); v_arc( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius, angle1*10, angle2*10 ); } //plotter_vdi_clip( self, 0); return ( 1 ); }
void plugins_connect(GList *gl) { View *v = VIEW(gl); if (v->plugins->status & PLUGIN_STATUS_CONNECTED) return; v->status->signals[SIG_PLUGINS_LOAD] = g_signal_connect(WEBVIEW(gl), "notify::load-status", G_CALLBACK(plugins_load_status_cb), gl); v->status->signals[SIG_PLUGINS_FRAME_CREATED] = g_signal_connect(WEBVIEW(gl), "frame-created", G_CALLBACK(plugins_frame_created_cb), gl); v->plugins->status ^= (v->plugins->status & PLUGIN_STATUS_DISCONNECTED) | PLUGIN_STATUS_CONNECTED; }
static void plugins_remove_all(GList *gl) { if (ALLOWED(gl) != NULL) { ALLOWED(gl) = g_slist_remove_all(ALLOWED(gl), ALLOWED(gl)->data); ALLOWED(gl) = NULL; } View *v = VIEW(gl); v->plugins->created = 0; }
void subScreenJump(SubScreen *s) { assert(s); XWarpPointer(subtle->dpy, None, ROOT, 0, 0, s->geom.x, s->geom.y, s->geom.x + s->geom.width / 2, s->geom.y + s->geom.height / 2); subViewFocus(VIEW(subArrayGet(subtle->views, s->vid)), True); subSharedLogDebugSubtle("Jump: type=screen\n"); } /* }}} */
void session_load_status_callback(WebKitWebView *wv, GParamSpec *p, SessionTab *tab) { WebKitLoadStatus status = webkit_web_view_get_load_status(wv); switch (status) { case WEBKIT_LOAD_FINISHED: VIEW(tab->gl)->status->lockprotect = tab->lock; dwb_tab_label_set_text(tab->gl, NULL); case WEBKIT_LOAD_FAILED: g_signal_handlers_disconnect_by_func(wv, (GFunc)session_load_status_callback, tab); g_free(tab); break; default: return; } }
static void prefs_build( GtkWidget *widget ) { Prefs *prefs = PREFS( widget ); GtkWidget *work; #ifdef DEBUG printf( "prefs_build: %p\n", prefs ); #endif /*DEBUG*/ /* Call all builds in superclasses. */ IWINDOW_CLASS( parent_class )->build( widget ); work = IDIALOG( prefs )->work; prefs->pwview = PREFWORKSPACEVIEW( prefworkspaceview_new() ); prefworkspaceview_set_caption_filter( prefs->pwview, prefs->caption_filter ); view_link( VIEW( prefs->pwview ), MODEL( prefs->ws ), NULL ); if( prefs->caption_filter ) { gtk_box_pack_start( GTK_BOX( work ), GTK_WIDGET( prefs->pwview ), TRUE, TRUE, 0 ); gtk_widget_show( GTK_WIDGET( prefs->pwview ) ); } else { /* No caption_filter set, so this is probably a big prefs * window. Build a scrolledwindow for the content. */ GtkWidget *window; window = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( window ), GTK_WIDGET( prefs->pwview ) ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( GTK_BIN( window )->child ), GTK_SHADOW_NONE ); gtk_box_pack_start( GTK_BOX( work ), GTK_WIDGET( window ), TRUE, TRUE, 0 ); gtk_widget_show( GTK_WIDGET( prefs->pwview ) ); gtk_widget_show( window ); } }