diff options
Diffstat (limited to 'plugins/pychrysalide/glibext/loadedpanel.c')
-rw-r--r-- | plugins/pychrysalide/glibext/loadedpanel.c | 83 |
1 files changed, 13 insertions, 70 deletions
diff --git a/plugins/pychrysalide/glibext/loadedpanel.c b/plugins/pychrysalide/glibext/loadedpanel.c index ce94b27..949ed1c 100644 --- a/plugins/pychrysalide/glibext/loadedpanel.c +++ b/plugins/pychrysalide/glibext/loadedpanel.c @@ -28,19 +28,16 @@ #include <pygobject.h> +#include <i18n.h> #include <glibext/gloadedpanel.h> +#include "linecursor.h" #include "../access.h" #include "../helpers.h" -/* Retrouve l'emplacement correspondant à une position donnée. */ -//static PyObject *py_loaded_panel_compute_addr(PyObject *, PyObject *); - - - /* S'assure qu'un emplacement donné est visible à l'écran. */ static PyObject *py_loaded_panel_scroll_to_cursor(PyObject *, PyObject *); @@ -49,52 +46,6 @@ static bool py_loaded_panel_define_constants(PyTypeObject *); - -#if 0 - - -/****************************************************************************** -* * -* Paramètres : self = classe représentant un générateur à manipuler. * -* args = arguments fournis à l'appel. * -* * -* Description : Retrouve l'emplacement correspondant à une position donnée. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args) -{ - PyObject *result; /* Localisation à retourner */ - GLineGenerator *generator; /* Version native */ - gint x; /* Position géographique */ - size_t index; /* Indice dans le tampon */ - size_t repeat; /* Utilisations successives */ - int ret; /* Bilan de lecture des args. */ - vmpa2t addr; /* Adresse visée par l'opérat° */ - - generator = G_LOADED_PANEL(pygobject_get(self)); - - ret = PyArg_ParseTuple(args, "ikk", &x, &index, &repeat); - if (!ret) return NULL; - - g_loaded_panel_compute_addr(generator, x, &addr, index, repeat); - - result = build_from_internal_vmpa(&addr); - - return result; - -} - -#endif - - - - - /****************************************************************************** * * * Paramètres : self = classe représentant un tampon de code. * @@ -110,38 +61,30 @@ static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args) static PyObject *py_loaded_panel_scroll_to_cursor(PyObject *self, PyObject *args) { -#if 0 - - GLoadedPanel *panel; /* Panneau à manipuler */ - PyObject *py_vmpa; /* Localisation version Python */ + GLineCursor *cursor; /* Emplacement à cibler */ + unsigned long tweak; /* Adapation à effectuer */ + int move; /* Déplacement à l'écran ? */ int ret; /* Bilan de lecture des args. */ - vmpa2t *addr; /* Adresse visée par l'opérat° */ - - ret = PyArg_ParseTuple(args, "O", &py_vmpa); - if (!ret) return NULL; + GLoadedPanel *panel; /* Panneau à manipuler */ - ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); + ret = PyArg_ParseTuple(args, "O&kp", convert_to_line_cursor, &cursor, &tweak, &move); if (!ret) return NULL; - addr = get_internal_vmpa(py_vmpa); - if (addr == NULL) return NULL; + if (!IS_VALID_STP(tweak)) + { + PyErr_SetString(PyExc_ValueError, _("invalid position tweak")); + return NULL; + } panel = G_LOADED_PANEL(pygobject_get(self)); - // FIXME - //gtk_loaded_panel_scroll_to_address(panel, addr, SPT_RAW, true); -#endif + g_loaded_panel_scroll_to_cursor(panel, cursor, tweak, move); Py_RETURN_NONE; } - - - - - /****************************************************************************** * * * Paramètres : obj_type = type dont le dictionnaire est à compléter. * |