From ce04e93235f25bc13d3c6f6368815fb297957a85 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Wed, 29 Jul 2009 22:00:37 +0300 Subject: [PATCH] Skeleton for the flowcanvas plain C wrapper --- gui/canvas.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++ gui/canvas.h | 127 ++++++++++++++++++++++++++++++++++++++++++++++ gui/common.h | 35 +++++++++++++ wscript | 1 + 4 files changed, 303 insertions(+) create mode 100644 gui/canvas.c create mode 100644 gui/canvas.h create mode 100644 gui/common.h diff --git a/gui/canvas.c b/gui/canvas.c new file mode 100644 index 00000000..6d00b8b6 --- /dev/null +++ b/gui/canvas.c @@ -0,0 +1,140 @@ +/* -*- Mode: C ; c-basic-offset: 2 -*- */ +/* + * LADI Session Handler (ladish) + * + * Copyright (C) 2009 Nedko Arnaudov + * + ************************************************************************** + * This file contains implements the canvas functionality through flowcanvas + ************************************************************************** + * + * LADI Session Handler 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 2 of the License, or + * (at your option) any later version. + * + * LADI Session Handler 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 LADI Session Handler. If not, see + * or write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "canvas.h" + +bool +canvas_create( + int width, + int height, + canvas_handle * canvas_handle_ptr) +{ + return false; +} + +bool +canvas_destroy( + canvas_handle canvas) +{ + return false; +} + +void +canvas_clear( + canvas_handle canvas) +{ +} + +void +canvas_set_zoom( + canvas_handle canvas, + double pix_per_unit) +{ +} + +void +canvas_arrange( + canvas_handle canvas) +{ +} + +bool +canvas_create_module( + canvas_handle canvas, + const char * name, + double x, + double y, + bool show_title, + bool show_port_labels, + canvas_module_handle * module_handle_ptr) +{ + return false; +} + +bool +canvas_destroy_module( + canvas_handle canvas, + canvas_module_handle module) +{ + return false; +} + +bool +canvas_create_port( + canvas_handle canvas, + canvas_module_handle module, + const char * name, + bool is_input, + int color) +{ + return false; +} + +bool +canvas_destroy_port( + canvas_handle canvas, + canvas_port_handle port) +{ + return false; +} + +bool +canvas_add_connection( + canvas_handle canvas, + canvas_port_handle port1, + canvas_port_handle port2, + uint32_t color) +{ + return false; +} + +bool +canvas_remove_connection( + canvas_handle canvas, + canvas_port_handle port1, + canvas_port_handle port2) +{ + return false; +} + +bool +canvas_enum_modules( + canvas_handle canvas, + void * callback_context, + bool (* callback)(void * context, canvas_module_handle module)) +{ + return false; +} + +bool +canvas_enum_module_ports( + canvas_handle canvas, + canvas_module_handle module, + void * callback_context, + bool (* callback)(void * context, canvas_port_handle port)) +{ + return false; +} diff --git a/gui/canvas.h b/gui/canvas.h new file mode 100644 index 00000000..1a0d024f --- /dev/null +++ b/gui/canvas.h @@ -0,0 +1,127 @@ +/* -*- Mode: C ; c-basic-offset: 2 -*- */ +/* + * LADI Session Handler (ladish) + * + * Copyright (C) 2009 Nedko Arnaudov + * + ************************************************************************** + * This file contains the interface to the canvas functionality + ************************************************************************** + * + * LADI Session Handler 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 2 of the License, or + * (at your option) any later version. + * + * LADI Session Handler 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 LADI Session Handler. If not, see + * or write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef CANVAS_H__BE110B39_CB54_47C2_A5B2_FFB3BA7CDA6D__INCLUDED +#define CANVAS_H__BE110B39_CB54_47C2_A5B2_FFB3BA7CDA6D__INCLUDED + +#include "common.h" + +typedef struct canvas_tag { int unused; } * canvas_handle; +typedef struct canvas_module_tag { int unused; } * canvas_module_handle; +typedef struct canvas_port_tag { int unused; } * canvas_port_handle; + +#ifdef __cplusplus +extern "C" { +#endif +#if 0 +} /* Adjust editor indent */ +#endif + +bool +canvas_create( + int width, + int height, + canvas_handle * canvas_handle_ptr); + +bool +canvas_destroy( + canvas_handle canvas); + +void +canvas_clear( + canvas_handle canvas); + +void +canvas_set_zoom( + canvas_handle canvas, + double pix_per_unit); + +void +canvas_arrange( + canvas_handle canvas); + +bool +canvas_create_module( + canvas_handle canvas, + const char * name, + double x, + double y, + bool show_title, + bool show_port_labels, + canvas_module_handle * module_handle_ptr); + +bool +canvas_destroy_module( + canvas_handle canvas, + canvas_module_handle module); + +bool +canvas_create_port( + canvas_handle canvas, + canvas_module_handle module, + const char * name, + bool is_input, + int color); + +bool +canvas_destroy_port( + canvas_handle canvas, + canvas_port_handle port); + +bool +canvas_add_connection( + canvas_handle canvas, + canvas_port_handle port1, + canvas_port_handle port2, + uint32_t color); + +bool +canvas_remove_connection( + canvas_handle canvas, + canvas_port_handle port1, + canvas_port_handle port2); + +bool +canvas_enum_modules( + canvas_handle canvas, + void * callback_context, + bool (* callback)(void * context, canvas_module_handle module)); + +bool +canvas_enum_module_ports( + canvas_handle canvas, + canvas_module_handle module, + void * callback_context, + bool (* callback)(void * context, canvas_port_handle port)); + +#if 0 +{ /* Adjust editor indent */ +#endif +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* #ifndef CANVAS_H__BE110B39_CB54_47C2_A5B2_FFB3BA7CDA6D__INCLUDED */ diff --git a/gui/common.h b/gui/common.h new file mode 100644 index 00000000..55edfe9a --- /dev/null +++ b/gui/common.h @@ -0,0 +1,35 @@ +/* -*- Mode: C ; c-basic-offset: 2 -*- */ +/* + * LADI Session Handler (ladish) + * + * Copyright (C) 2009 Nedko Arnaudov + * + ************************************************************************** + * This file contains stuff that is needed almost everywhere in the gladish + ************************************************************************** + * + * LADI Session Handler 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 2 of the License, or + * (at your option) any later version. + * + * LADI Session Handler 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 LADI Session Handler. If not, see + * or write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef COMMON_H__15E63B7A_8350_4ABD_B04C_592158354949__INCLUDED +#define COMMON_H__15E63B7A_8350_4ABD_B04C_592158354949__INCLUDED + +#include "config.h" /* configure stage result */ + +#include /* C99 bool */ +#include /* fixed bit size ints */ + +#endif /* #ifndef COMMON_H__15E63B7A_8350_4ABD_B04C_592158354949__INCLUDED */ diff --git a/wscript b/wscript index 981d5d60..041715a2 100644 --- a/wscript +++ b/wscript @@ -266,6 +266,7 @@ def build(bld): 'session.cpp', 'a2j_proxy.cpp', 'dbus_helpers.c', + 'canvas.c', ]: gladish.source.append(os.path.join("gui", source))