void gdk_draw_segments (GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs) { int i; gi_point_t pts[2]; PRINTFILE("gdk_draw_segments"); // not used by any exists widget if (nsegs <= 0) return; g_return_if_fail (drawable != NULL); g_return_if_fail (segs != NULL); g_return_if_fail (gc != NULL); if(GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); for (i = 0; i < nsegs; i++) { pts[0].x = segs[i].x1; pts[0].y = segs[i].y1; pts[1].x = segs[i].x2; pts[1].y = segs[i].y2; gi_draw_lines( GDK_GC_XGC (gc), pts,2); } }
void gdk_draw_rectangle (GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height) { g_return_if_fail (drawable != NULL); g_return_if_fail (gc != NULL); if (GDK_DRAWABLE_DESTROYED(drawable)) return; if (width == -1) width = ((GdkWindowPrivate*)drawable)->width; if (height == -1) height = ((GdkWindowPrivate*)drawable)->height; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); if (filled){ gi_fill_rect( GDK_GC_XGC(gc), x, y, width, height); } else gi_draw_rect(GDK_GC_XGC(gc),x,y,width,height); //For some reason, nano-X draw wider and higher }
void gdk_draw_lines (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints) { gi_point_t *nanoPoints; gint i; PRINTFILE("gdk_draw_lines"); // only used by gtkctree widget if (npoints <= 0) return; g_return_if_fail (drawable != NULL); g_return_if_fail (points != NULL); g_return_if_fail (gc != NULL); if(GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); nanoPoints = g_new(gi_point_t,npoints); for (i=0;i<npoints;i++) { nanoPoints[i].x = points[i].x; nanoPoints[i].y = points[i].y; } gi_draw_lines( GDK_GC_XGC(gc), npoints, nanoPoints); g_free(nanoPoints); }
void gdk_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints) { gi_point_t *nanoPoints; guint i; g_return_if_fail (drawable != NULL); g_return_if_fail ((points != NULL) && (npoints > 0)); g_return_if_fail (gc != NULL); if (GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); nanoPoints = g_new(gi_point_t,npoints); // GdkPoint (gint16) to gi_point_t (int) for (i=0;i<npoints;i++) { nanoPoints[i].x = points[i].x; nanoPoints[i].y = points[i].y; } gi_draw_points(GDK_GC_XGC(gc), npoints, nanoPoints); g_free(nanoPoints); }
void gdk_draw_point (GdkDrawable *drawable, GdkGC *gc, gint x, gint y) { g_return_if_fail (drawable != NULL); g_return_if_fail (gc != NULL); gi_point_t tmp_points[1]; if (GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); //GrPoint (GDK_DRAWABLE_XID(drawable), GDK_GC_XGC(gc), x, y); tmp_points[0].x =x; tmp_points[0].y = y; gi_draw_points ( GDK_GC_XGC (gc), tmp_points, 1); }
gint gdk_selection_property_get(GdkWindow * requestor, guchar ** data, GdkAtom * ret_type, gint * ret_format) { GdkSelProp *prop; g_return_val_if_fail(requestor != NULL, 0); g_return_val_if_fail(GDK_IS_WINDOW(requestor), 0); if (GDK_DRAWABLE_DESTROYED(requestor)) return 0; GDK_NOTE(DND, g_print("gdk_selection_property_get: %#x", GDK_DRAWABLE_XID(requestor))); prop = g_hash_table_lookup(sel_prop_table, &GDK_DRAWABLE_XID(requestor)); if (prop == NULL) { GDK_NOTE(DND, g_print(": NULL\n")); *data = NULL; return 0; } GDK_NOTE(DND, g_print(": %d bytes\n", prop->length)); *data = g_malloc(prop->length); if (prop->length > 0) memmove(*data, prop->data, prop->length); if (ret_type) *ret_type = prop->type; if (ret_format) *ret_format = prop->format; return prop->length; }
void gdk_draw_line (GdkDrawable *drawable, GdkGC *gc, gint x1, gint y1, gint x2, gint y2) { g_return_if_fail (drawable != NULL); g_return_if_fail (gc != NULL); if( GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); gi_draw_line(GDK_GC_XGC(gc),x1,y1,x2,y2); }
void gdk_draw_arc (GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2) { g_return_if_fail (drawable != NULL); g_return_if_fail (gc != NULL); PRINTFILE("gdk_draw_arc"); // only used by gtkctree widget if (GDK_DRAWABLE_DESTROYED(drawable)) return; gi_gc_attch_window(GDK_GC_XGC(gc), GDK_DRAWABLE_XID(drawable)); if (width == -1) width = ((GdkWindowPrivate*)drawable)->width; if (height == -1) height = ((GdkWindowPrivate*)drawable)->height; if (filled) { gi_fill_arc(GDK_DRAWABLE_XID(drawable),GDK_GC_XGC(gc), x, y, width, height, angle1, angle2); } else{ gi_draw_arc(GDK_DRAWABLE_XID(drawable),GDK_GC_XGC(gc), x, y, width, height, angle1, angle2); } //GrArcAngle(GDK_DRAWABLE_XID(drawable), GDK_GC_XGC(gc), x, y, // width, height, angle1, angle2, filled); }
void gdk_selection_convert(GdkWindow * requestor, GdkAtom selection, GdkAtom target, guint32 time) { HGLOBAL hdata; GdkSelProp *prop; guchar *ptr, *data, *datap, *p; guint i, length, slength; gchar *sel_name, *tgt_name; g_return_if_fail(requestor != NULL); if (GDK_DRAWABLE_DESTROYED(requestor)) return; GDK_NOTE(DND, (sel_name = gdk_atom_name(selection), tgt_name = gdk_atom_name(target), g_print("gdk_selection_convert: %#x %#x (%s) %#x (%s)\n", GDK_DRAWABLE_XID(requestor), selection, sel_name, target, tgt_name), g_free(sel_name), g_free(tgt_name))); if (selection == gdk_clipboard_atom) { /* Converting the CLIPBOARD selection means he wants the * contents of the clipboard. Get the clipboard data, * and store it for later. */ GDK_NOTE(DND, g_print("...OpenClipboard(%#x)\n", GDK_DRAWABLE_XID(requestor))); if (!OpenClipboard(GDK_DRAWABLE_XID(requestor))) { WIN32_API_FAILED("OpenClipboard"); return; } GDK_NOTE(DND, g_print("...GetClipboardData(CF_TEXT)\n")); if ((hdata = GetClipboardData(CF_TEXT)) != NULL) { if ((ptr = GlobalLock(hdata)) != NULL) { length = GlobalSize(hdata); GDK_NOTE(DND, g_print("...got data: %d bytes: %.10s\n", length, ptr)); slength = 0; p = ptr; for (i = 0; i < length; i++) { if (*p == '\0') break; else if (*p != '\r') slength++; p++; } data = datap = g_malloc(slength + 1); p = ptr; for (i = 0; i < length; i++) { if (*p == '\0') break; else if (*p != '\r') *datap++ = *p; p++; } *datap++ = '\0'; gdk_sel_prop_store(requestor, GDK_TARGET_STRING, 8, data, strlen(data) + 1); GlobalUnlock(hdata); } } GDK_NOTE(DND, g_print("...CloseClipboard()\n")); CloseClipboard(); /* Send ourselves an ersatz selection notify message so that we actually * fetch the data. */ SendMessage(GDK_DRAWABLE_XID(requestor), gdk_selection_notify_msg, selection, target); } else if (selection == gdk_win32_dropfiles_atom) { /* This means he wants the names of the dropped files. * gdk_dropfiles_filter already has stored the text/uri-list * data, tempoarily on gdk_root_parent's selection "property". */ GdkSelProp *prop; prop = g_hash_table_lookup(sel_prop_table, &GDK_DRAWABLE_XID(gdk_parent_root)); if (prop != NULL) { g_hash_table_remove(sel_prop_table, &GDK_DRAWABLE_XID(gdk_parent_root)); gdk_sel_prop_store(requestor, prop->type, prop->format, prop->data, prop->length); g_free(prop); SendMessage(GDK_DRAWABLE_XID(requestor), gdk_selection_notify_msg, selection, target); } } else { g_warning("gdk_selection_convert: General case not implemented"); } }