[dia] Remove unused NEW_TEXT_EDIT (that approach not touched in 5 years)
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Remove unused NEW_TEXT_EDIT (that approach not touched in 5 years)
- Date: Wed, 20 Oct 2010 19:28:18 +0000 (UTC)
commit d08ec5a0a7fed604dbf56c4a848e8a728f5c5772
Author: Hans Breuer <hans breuer org>
Date: Sun Oct 17 19:23:53 2010 +0200
Remove unused NEW_TEXT_EDIT (that approach not touched in 5 years)
app/disp_callbacks.c | 6 +--
app/modify_tool.c | 144 --------------------------------------------------
2 files changed, 1 insertions(+), 149 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index e1b3e47..3391ec5 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -949,11 +949,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
tool_select_former();
} else if ((kevent->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0 &&
kevent->length != 0) {
- /* Find first editable */
-#ifdef NEW_TEXT_EDIT
- modify_edit_first_text(ddisp);
- return_val = FALSE;
-#endif
+ /* Find first editable? */
}
}
}
diff --git a/app/modify_tool.c b/app/modify_tool.c
index c82892f..f9dd9bb 100644
--- a/app/modify_tool.c
+++ b/app/modify_tool.c
@@ -171,10 +171,6 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
diagram_unselect_object(diagram, (DiaObject *)already->data);
diagram_flush(ddisp->diagram);
} else {
- /* Maybe start editing text */
-#ifdef NEW_TEXT_EDIT
- modify_make_text_edit(ddisp, obj, clickedpoint);
-#endif
return obj;
}
}
@@ -856,143 +852,3 @@ modify_edit_end(GtkWidget *widget, GdkEventFocus *event, gpointer data)
}
return FALSE;
}
-
-void
-modify_start_text_edit(DDisplay *ddisp, Text *text, DiaObject *obj, Point *clickedpoint)
-{
- GtkWidget *view = gtk_text_view_new();
- int x, y, i;
- GtkTextBuffer *buf;
- GtkTextTag *fonttag;
- GtkTextIter start, end;
- Rectangle text_bbox;
-
- printf("modify_start_text_edit\n");
- /* This might need to account for zoom factor. */
- text_calc_boundingbox(text, &text_bbox);
- ddisplay_transform_coords(ddisp,
- text_bbox.left,
- text_bbox.top,
- &x, &y);
- dia_canvas_put(DIA_CANVAS(ddisp->canvas), view,
- x-EDIT_BORDER_WIDTH, y-EDIT_BORDER_WIDTH);
- buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
- for (i = 0; i < text->numlines; i++) {
- gtk_text_buffer_insert_at_cursor(buf, text_get_line(text, i), -1);
- }
- fonttag =
- gtk_text_buffer_create_tag(buf,
- NULL,
- "font-desc",
- dia_font_get_description(text->font),
- NULL);
- gtk_text_buffer_get_bounds(buf, &start, &end);
- gtk_text_buffer_apply_tag(buf, fonttag, &start, &end);
-
- printf("Above lines %d below %d\n",
- gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(view)),
- gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(view)));
-
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_LEFT,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_RIGHT,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_TOP,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_BOTTOM,
- EDIT_BORDER_WIDTH);
- /* Using deprecated function because the fucking gobject documentation
- * fucking sucks. */
-#ifdef NEW_TEXT_EDIT
- gtk_signal_connect(GTK_OBJECT(view), "focus-out-event",
- modify_edit_end, obj);
-#endif
- gtk_widget_grab_focus(view);
- gtk_widget_show(view);
-}
-
-void
-modify_make_text_edit(DDisplay *ddisp, DiaObject *obj, Point *clickedpoint)
-{
- const PropDescription *props = obj->ops->describe_props(obj);
- int i;
- for (i = 0; props[i].name != NULL; i++) {
- GQuark type = g_quark_from_string(PROP_TYPE_TEXT);
- printf("Testing %s\n", props[i].type);
- if (props[i].type_quark == type) {
- GtkWidget *view = gtk_text_view_new();
- GPtrArray *textprops = g_ptr_array_sized_new(1);
- TextProperty *textprop;
- Property *prop = props[i].ops->new_prop(&props[i], pdtpp_true);
- int x, y;
- GtkTextBuffer *buf;
- GtkTextTag *fonttag;
- GtkTextIter start, end;
- real ascent;
- int ascent_pixels;
- TextLine *temp_line;
-
- g_ptr_array_add(textprops, prop);
-
- printf("Found text prop %d\n", i);
- obj->ops->get_props(obj, textprops);
- textprop = (TextProperty*)prop;
- ddisplay_transform_coords(ddisp,
- textprop->attr.position.x,
- textprop->attr.position.y,
- &x, &y);
- temp_line = text_line_new(textprop->text_data,
- textprop->attr.font,
- textprop->attr.height);
- /* This might need to account for zoom factor. */
- ascent = ddisplay_transform_length(ddisp,
- text_line_get_ascent(temp_line));
- text_line_destroy(temp_line);
- printf("Text prop string %s pos %d, %d ascent %f\n",
- textprop->text_data, x, y, ascent);
- ascent_pixels = ddisplay_transform_length(ddisp, ascent);
- y -= ascent_pixels;
- dia_canvas_put(DIA_CANVAS(ddisp->canvas), view,
- x-EDIT_BORDER_WIDTH, y-EDIT_BORDER_WIDTH);
- buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
- gtk_text_buffer_insert_at_cursor(buf, textprop->text_data, -1);
- fonttag =
- gtk_text_buffer_create_tag(buf,
- NULL,
- "font-desc",
- dia_font_get_description(textprop->attr.font),
- NULL);
- gtk_text_buffer_get_bounds(buf, &start, &end);
- gtk_text_buffer_apply_tag(buf, fonttag, &start, &end);
-
- printf("Above lines %d below %d\n",
- gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(view)),
- gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(view)));
-
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_LEFT,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_RIGHT,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_TOP,
- EDIT_BORDER_WIDTH);
- gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(view),
- GTK_TEXT_WINDOW_BOTTOM,
- EDIT_BORDER_WIDTH);
- /* Using deprecated function because the fucking gobject documentation
- * fucking sucks. */
-#ifdef NEW_TEXT_EDIT
- gtk_signal_connect(GTK_OBJECT(view), "focus-out-event",
- modify_edit_end, obj);
-#endif
- gtk_widget_grab_focus(view);
- gtk_widget_show(view);
- }
- }
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]