[dia] Bug 586060 - fully enter text edit after drop or F2
- From: Hans Breuer <hans src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dia] Bug 586060 - fully enter text edit after drop or F2
- Date: Tue, 29 Dec 2009 19:32:50 +0000 (UTC)
commit 408bcbc46f4547f63addca58fbc0840e591852db
Author: Hans Breuer <hans breuer org>
Date: Mon Dec 28 19:38:14 2009 +0100
Bug 586060 - fully enter text edit after drop or F2
To allow typing in new text right after the previous action
mess a bit with active window and automatic tool selection.
app/disp_callbacks.c | 9 +++++++--
app/interface.c | 5 ++++-
app/textedit.c | 4 +++-
app/textedit.h | 2 +-
app/textedit_tool.c | 5 ++++-
5 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 920a9c4..22b5729 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -989,6 +989,7 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
DiaObject *obj, *p_obj;
GList *list;
real click_distance;
+ gboolean avoid_reset;
ddisplay_untransform_coords(ddisp, x, y, &droppoint.x, &droppoint.y);
@@ -1075,7 +1076,8 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
diagram_remove_all_selected(ddisp->diagram, TRUE); /* unselect all */
diagram_select(ddisp->diagram, obj);
obj->ops->selectf(obj, &droppoint, ddisp->renderer);
- textedit_activate_object(ddisp, obj, NULL);
+ /* if we entered textedit don't reset */
+ avoid_reset = textedit_activate_object(ddisp, obj, NULL);
/* Connect first handle if possible: */
if ((handle1 != NULL) &&
@@ -1092,7 +1094,10 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
undo_set_transactionpoint(ddisp->diagram->undo);
diagram_modified(ddisp->diagram);
- if (prefs.reset_tools_after_create)
+ if (!avoid_reset && prefs.reset_tools_after_create)
tool_reset();
+ else /* cant use gtk_action_activate (menus_get_action ("ToolsTextedit")); - it's disabled */
+ tool_select (TEXTEDIT_TOOL, NULL, NULL, NULL, 0);
+
return obj;
}
diff --git a/app/interface.c b/app/interface.c
index 1ed45d8..4c21789 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -472,8 +472,11 @@ display_data_received_callback (GtkWidget *widget,
tooldata->user_data);
gtk_drag_finish (context, TRUE, FALSE, time);
- } else
+ } else {
dia_dnd_file_drag_data_received (widget, context, x, y, data, info, time, ddisp);
+ }
+ /* ensure the right window has the focus for text editing */
+ gtk_window_present(ddisp->shell);
}
/**
diff --git a/app/textedit.c b/app/textedit.c
index 2df962f..9e94d50 100644
--- a/app/textedit.c
+++ b/app/textedit.c
@@ -244,7 +244,7 @@ textedit_activate_object(DDisplay *ddisp, DiaObject *obj, Point *clicked)
* Calling this function will put us into text-edit mode if there is
* text to edit, otherwise it will take us out of text-edit mode.
*/
-void
+gboolean
textedit_activate_first(DDisplay *ddisp)
{
Focus *new_focus = NULL;
@@ -265,8 +265,10 @@ textedit_activate_first(DDisplay *ddisp)
give_focus(new_focus);
textedit_begin_edit(ddisp, new_focus);
diagram_flush(ddisp->diagram);
+ return TRUE;
} else {
textedit_exit(ddisp);
+ return FALSE;
}
}
diff --git a/app/textedit.h b/app/textedit.h
index b957538..2e2b63d 100644
--- a/app/textedit.h
+++ b/app/textedit.h
@@ -29,7 +29,7 @@ Focus *textedit_move_focus(DDisplay *ddisp, Focus *focus, gboolean forwards);
gboolean textedit_mode(DDisplay *ddisp);
void textedit_activate_focus(DDisplay *ddisp, Focus *focus, Point *clicked);
gboolean textedit_activate_object(DDisplay *ddisp, DiaObject *obj, Point *clicked);
-void textedit_activate_first(DDisplay *ddisp);
+gboolean textedit_activate_first(DDisplay *ddisp);
void textedit_deactivate_focus(void);
void textedit_remove_focus(DiaObject *obj, Diagram *diagram);
void textedit_remove_focus_all(Diagram *diagram);
diff --git a/app/textedit_tool.c b/app/textedit_tool.c
index 42ee17a..8623947 100644
--- a/app/textedit_tool.c
+++ b/app/textedit_tool.c
@@ -146,7 +146,10 @@ create_textedit_tool(void)
ddisp = ddisplay_active();
if (ddisp) {
- textedit_activate_first (ddisp);
+ if (textedit_activate_first (ddisp)) {
+ /* set the focus to the canvas area */
+ gtk_widget_grab_focus (ddisp->canvas);
+ }
ddisplay_flush(ddisp);
/* the above may have entered the textedit mode, just update in any case */
ddisplay_do_update_menu_sensitivity(ddisp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]