summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-16 22:18:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-16 22:18:25 (GMT)
commitacac24dbaae205b389c81132939280295b6a5d34 (patch)
tree3bc91706e0d455ebadb19e1d25efb1bc554a9788 /plugins/pychrysalide/glibext
parentf6e56cebfa878dd32a2405fd0c916a40140a1ff0 (diff)
Cleaned code.
Diffstat (limited to 'plugins/pychrysalide/glibext')
-rw-r--r--plugins/pychrysalide/glibext/loadedpanel.c89
1 files changed, 85 insertions, 4 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;
}