diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/pychrysalide/glibext/loadedpanel.c | 89 | ||||
| -rw-r--r-- | plugins/pychrysalide/gtkext/displaypanel.c | 83 | 
2 files changed, 85 insertions, 87 deletions
diff --git a/plugins/pychrysalide/glibext/loadedpanel.c b/plugins/pychrysalide/glibext/loadedpanel.c index f831607..ba4ced0 100644 --- a/plugins/pychrysalide/glibext/loadedpanel.c +++ b/plugins/pychrysalide/glibext/loadedpanel.c @@ -31,6 +31,8 @@  #include <glibext/gloadedpanel.h> +#include "../helpers.h" +  /* Retrouve l'emplacement correspondant à une position donnée. */ @@ -38,6 +40,14 @@ +/* S'assure qu'un emplacement donné est visible à l'écran. */ +static PyObject *py_loaded_panel_scroll_to_cursor(PyObject *, PyObject *); + +/* Définit les constantes pour l'affichage des contenus chargés. */ +static bool py_loaded_panel_define_constants(PyTypeObject *); + + +  #if 0 @@ -84,9 +94,79 @@ static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args) +/****************************************************************************** +*                                                                             * +*  Paramètres  : self = classe représentant un tampon de code.                * +*                args = arguments fournis à l'appel.                          * +*                                                                             * +*  Description : S'assure qu'un emplacement donné est visible à l'écran.      * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static PyObject *py_loaded_panel_scroll_to_cursor(PyObject *self, PyObject *args) +{ +#if 0 + +    GLoadedPanel *panel;                    /* Panneau à manipuler         */ +    PyObject *py_vmpa;                      /* Localisation version Python */ +    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; + +    ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); +    if (!ret) return NULL; + +    addr = get_internal_vmpa(py_vmpa); +    if (addr == NULL) return NULL; + +    panel = G_LOADED_PANEL(pygobject_get(self)); + +    // FIXME +    //gtk_loaded_panel_scroll_to_address(panel, addr, SPT_RAW, true); +#endif + +    Py_RETURN_NONE; + +} + + + + + + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : obj_type = type dont le dictionnaire est à compléter.        * +*                                                                             * +*  Description : Définit les constantes pour l'affichage des contenus chargés.* +*                                                                             * +*  Retour      : true en cas de succès de l'opération, false sinon.           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static bool py_loaded_panel_define_constants(PyTypeObject *obj_type) +{ +    bool result;                            /* Bilan à retourner           */ + +    result = true; +    result &= PyDict_AddIntMacro(obj_type, SPT_RAW); +    result &= PyDict_AddIntMacro(obj_type, SPT_TOP); +    result &= PyDict_AddIntMacro(obj_type, SPT_CENTER); +    result &= PyDict_AddIntMacro(obj_type, SPT_BOTTOM); +    return result; +}  /****************************************************************************** @@ -104,13 +184,11 @@ static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args)  PyTypeObject *get_python_loaded_panel_type(void)  {      static PyMethodDef py_loaded_panel_methods[] = { -        /*          { -            "compute_addr", py_loaded_panel_compute_addr, +            "scroll_to_cursor", (PyCFunction)py_loaded_panel_scroll_to_cursor,              METH_VARARGS, -            "compute_addr($self, x, index, repeat, /)\n--\n\nReturn the position at a given location." +            "scroll_to_cursor($self, cursor, tweak, move, /)\n--\n\nEnsure a given address is displayed in the view panel."          }, -        */          { NULL }      }; @@ -161,6 +239,9 @@ bool register_python_loaded_panel(PyObject *module)      dict = PyModule_GetDict(module);      pyg_register_interface(dict, "LoadedPanel", G_TYPE_LOADED_PANEL, py_loaded_panel_type); +    if (!py_loaded_panel_define_constants(py_loaded_panel_type)) +        return false; +      return true;  } diff --git a/plugins/pychrysalide/gtkext/displaypanel.c b/plugins/pychrysalide/gtkext/displaypanel.c index b75d173..16bd1d9 100644 --- a/plugins/pychrysalide/gtkext/displaypanel.c +++ b/plugins/pychrysalide/gtkext/displaypanel.c @@ -42,12 +42,6 @@  static PyObject *py_display_panel_new(PyTypeObject *, PyObject *, PyObject *);  #endif -/* S'assure qu'une adresse donnée est visible à l'écran. */ -static PyObject *py_display_panel_scroll_to_address(PyObject *, PyObject *); - -/* Définit les constantes pour les panneaux de vue. */ -static bool py_display_panel_define_constants(PyTypeObject *); -  /****************************************************************************** @@ -98,73 +92,6 @@ static PyObject *py_display_panel_new(PyTypeObject *type, PyObject *args, PyObje  /******************************************************************************  *                                                                             * -*  Paramètres  : self = classe représentant un tampon de code.                * -*                args = arguments fournis à l'appel.                          * -*                                                                             * -*  Description : S'assure qu'une adresse donnée est visible à l'écran.        * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static PyObject *py_display_panel_scroll_to_address(PyObject *self, PyObject *args) -{ -    GtkDisplayPanel *panel;                    /* Panneau à manipuler         */ -    PyObject *py_vmpa;                      /* Localisation version Python */ -    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; - -    ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); -    if (!ret) return NULL; - -    addr = get_internal_vmpa(py_vmpa); -    if (addr == NULL) return NULL; - -    panel = GTK_DISPLAY_PANEL(pygobject_get(self)); - -    // FIXME -    //gtk_display_panel_scroll_to_address(panel, addr, SPT_RAW); - -    Py_RETURN_NONE; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : obj_type = type dont le dictionnaire est à compléter.        * -*                                                                             * -*  Description : Définit les constantes pour les panneaux de vue.             * -*                                                                             * -*  Retour      : true en cas de succès de l'opération, false sinon.           * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static bool py_display_panel_define_constants(PyTypeObject *obj_type) -{ -    bool result;                            /* Bilan à retourner           */ - -    result = true; - -    result &= PyDict_AddIntMacro(obj_type, SPT_RAW); -    result &= PyDict_AddIntMacro(obj_type, SPT_TOP); -    result &= PyDict_AddIntMacro(obj_type, SPT_CENTER); -    result &= PyDict_AddIntMacro(obj_type, SPT_BOTTOM); - -    return result; - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : -                                                            *  *                                                                             *  *  Description : Fournit un accès à une définition de type à diffuser.        * @@ -178,11 +105,6 @@ static bool py_display_panel_define_constants(PyTypeObject *obj_type)  PyTypeObject *get_python_display_panel_type(void)  {      static PyMethodDef py_display_panel_methods[] = { -        { -            "scroll_to_address", (PyCFunction)py_display_panel_scroll_to_address, -            METH_VARARGS, -            "scroll_to_address($self, addr, tweak, /)\n--\n\nEnsure a given address is displayed in the view panel." -        },          { NULL }      }; @@ -257,11 +179,6 @@ bool register_python_display_panel(PyObject *module)                                            py_display_panel_type, (PyTypeObject *)fixed);      Py_DECREF(fixed); -    if (!result) -        goto rpdp_exit; - -    result = py_display_panel_define_constants(py_display_panel_type); -   rpdp_exit:      return result;  | 
