diff options
Diffstat (limited to 'plugins/pychrysalide/gui/editem.c')
-rw-r--r-- | plugins/pychrysalide/gui/editem.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/editem.c index 68962ae..71bf316 100644 --- a/plugins/pychrysalide/gui/editem.c +++ b/plugins/pychrysalide/gui/editem.c @@ -51,6 +51,12 @@ static void py_editor_item_change_view_wrapper(GEditorItem *, GLoadedPanel *, GL /* Réagit à une modification de la vue du contenu analysé. */ static void py_editor_item_update_view_wrapper(GEditorItem *, GLoadedPanel *); +/* Réagit à une modification de la vue du contenu analysé. */ +static void py_editor_item_track_cursor_wrapper(GEditorItem *, GLoadedPanel *, const GLineCursor *); + +/* Réagit à une modification de la vue du contenu analysé. */ +static void py_editor_item_focus_cursor_wrapper(GEditorItem *, GLoadedContent *, const GLineCursor *); + /* ---------------------------------------------------------------------------------- */ @@ -77,6 +83,9 @@ void py_editor_item_init_gclass(GEditorItemClass *class, gpointer unused) class->change_view = py_editor_item_change_view_wrapper; class->update_view = py_editor_item_update_view_wrapper; + class->track_cursor = py_editor_item_track_cursor_wrapper; + class->focus_cursor = py_editor_item_focus_cursor_wrapper; + } @@ -255,6 +264,100 @@ static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel * } +/****************************************************************************** +* * +* Paramètres : item = instance à consulter. * +* panel = composant d'affichage parcouru. * +* cursor = nouvel emplacement du curseur courant. * +* * +* Description : Réagit à une modification de la vue du contenu analysé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel *panel, const GLineCursor *cursor) +{ + PyObject *pyobj; /* Objet Python concerné */ + PyThreadState *tstate; /* Contexte d'environnement */ + PyObject *args; /* Arguments pour l'appel */ + PyObject *pyret; /* Retour de Python */ + + pyobj = pygobject_new(G_OBJECT(item)); + + tstate = get_pychrysalide_main_tstate(); + + if (tstate != NULL) + PyEval_RestoreThread(tstate); + + if (has_python_method(pyobj, "_track_cursor")) + { + args = PyTuple_New(2); + PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(panel))); + PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor))); + + pyret = run_python_method(pyobj, "_track_cursor", args); + + Py_DECREF(args); + Py_DECREF(pyret); + + } + + if (tstate != NULL) + PyEval_SaveThread(); + +} + + +/****************************************************************************** +* * +* Paramètres : item = instance à consulter. * +* content = contenu contenant le curseur à représenter. * +* cursor = nouvel emplacement du curseur courant. * +* * +* Description : Réagit à une modification de la vue du contenu analysé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedContent *content, const GLineCursor *cursor) +{ + PyObject *pyobj; /* Objet Python concerné */ + PyThreadState *tstate; /* Contexte d'environnement */ + PyObject *args; /* Arguments pour l'appel */ + PyObject *pyret; /* Retour de Python */ + + pyobj = pygobject_new(G_OBJECT(item)); + + tstate = get_pychrysalide_main_tstate(); + + if (tstate != NULL) + PyEval_RestoreThread(tstate); + + if (has_python_method(pyobj, "_focus_cursor")) + { + args = PyTuple_New(2); + PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(content))); + PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor))); + + pyret = run_python_method(pyobj, "_focus_cursor", args); + + Py_DECREF(args); + Py_DECREF(pyret); + + } + + if (tstate != NULL) + PyEval_SaveThread(); + +} + + /* ---------------------------------------------------------------------------------- */ /* FONCTIONNALITES D'UN ELEMENT */ |