diff options
Diffstat (limited to 'plugins/pychrysa/gtkext/viewpanel.c')
-rw-r--r-- | plugins/pychrysa/gtkext/viewpanel.c | 252 |
1 files changed, 0 insertions, 252 deletions
diff --git a/plugins/pychrysa/gtkext/viewpanel.c b/plugins/pychrysa/gtkext/viewpanel.c deleted file mode 100644 index b7c6062..0000000 --- a/plugins/pychrysa/gtkext/viewpanel.c +++ /dev/null @@ -1,252 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * viewpanel.c - prototypes pour l'équivalent Python du fichier "gtkext/gtkviewpanel.c" - * - * Copyright (C) 2012 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "viewpanel.h" - - -#include <pygobject.h> - - -#include <gtkext/gtkviewpanel.h> - - -#include "../helpers.h" -#include "../arch/vmpa.h" - - - -/* Crée un nouvel objet Python de type 'ViewPanel'. */ -#if 0 -static PyObject *py_view_panel_new(PyTypeObject *, PyObject *, PyObject *); -#endif - -/* S'assure qu'une adresse donnée est visible à l'écran. */ -static PyObject *py_view_panel_scroll_to_address(PyObject *, PyObject *); - -/* Définit les constantes pour les panneaux de vue. */ -static bool py_view_panel_define_constants(PyTypeObject *); - - - -/****************************************************************************** -* * -* Paramètres : type = type de l'objet à instancier. * -* args = arguments fournis à l'appel. * -* kwds = arguments de type key=val fournis. * -* * -* Description : Crée un nouvel objet Python de type 'ViewPanel'. * -* * -* Retour : Instance Python mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ -#if 0 -static PyObject *py_view_panel_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ -#if 0 - PyObject *result; /* Instance à retourner */ - const char *name; /* Désignation humaine */ - const char *lname; /* Nom version longue */ - PyGObject *widget; /* Composant visuel du panneau */ - const char *path; /* Placement à l'affichage */ - int ret; /* Bilan de lecture des args. */ - GEditorItem *item; /* Version GLib du format */ - - ret = PyArg_ParseTuple(args, "ssOs", &name, &lname, &widget, &path); - if (!ret) Py_RETURN_NONE; - - item = g_view_panel_new(get_internal_ref(), name, lname, - GTK_WIDGET(pygobject_get(widget)), path); - - result = py_view_panel_from_c(G_VIEW_PANEL(item)); - g_object_unref(item); - - return (PyObject *)result; -#endif - - /* FIXME */ - - - Py_RETURN_NONE; - -} -#endif - - -/****************************************************************************** -* * -* 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_view_panel_scroll_to_address(PyObject *self, PyObject *args) -{ - GtkViewPanel *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_VIEW_PANEL(pygobject_get(self)); - - // FIXME - //gtk_view_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_view_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. * -* * -* Retour : Définition d'objet pour Python. * -* * -* Remarques : - * -* * -******************************************************************************/ - -PyTypeObject *get_python_view_panel_type(void) -{ - static PyMethodDef py_view_panel_methods[] = { - { - "scroll_to_address", (PyCFunction)py_view_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 } - }; - - static PyGetSetDef py_view_panel_getseters[] = { - { NULL } - }; - - static PyTypeObject py_view_panel_type = { - - PyVarObject_HEAD_INIT(NULL, 0) - - .tp_name = "pychrysalide.gtkext.ViewPanel", - .tp_basicsize = sizeof(PyGObject), - - .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - - .tp_doc = "PyChrysalide view panel.", - - .tp_methods = py_view_panel_methods, - .tp_getset = py_view_panel_getseters, - //.tp_new = (newfunc)py_view_panel_new, - //.tp_init = (initproc)pychrysalide_allow_args_for_gobjects - - }; - - return &py_view_panel_type; - -} - - -/****************************************************************************** -* * -* Paramètres : module = module dont la définition est à compléter. * -* * -* Description : Prend en charge l'objet 'pychrysalide.gtkext.ViewPanel'. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool register_python_view_panel(PyObject *module) -{ - PyTypeObject *py_view_panel_type; /* Type Python 'ViewPanel' */ - PyObject *parent_mod; /* Module Python Fixed */ - PyObject *fixed; /* Module "GtkFixed" */ - PyObject *dict; /* Dictionnaire du module */ - - py_view_panel_type = get_python_view_panel_type(); - - parent_mod = PyImport_ImportModule("gi.repository.Gtk"); - if (parent_mod == NULL) return false; - - fixed = PyObject_GetAttrString(parent_mod, "Fixed"); - Py_DECREF(parent_mod); - - dict = PyModule_GetDict(module); - - if (!register_class_for_pygobject(dict, GTK_TYPE_VIEW_PANEL, py_view_panel_type, (PyTypeObject *)fixed)) - return false; - - if (!py_view_panel_define_constants(py_view_panel_type)) - return false; - - return true; - -} |