Skip to content

Commit d6d6ed0

Browse files
author
Brian Stafford
committed
PocPlot initial github commit.
1 parent c628d72 commit d6d6ed0

29 files changed

+6808
-2
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.o
2+
*.so
3+
*.gir
4+
*.typelib
5+
build*/
6+
7+
# it's better to unpack these files and commit the raw source
8+
# git has its own built in compression methods
9+
*.7z
10+
*.dmg
11+
*.gz
12+
*.iso
13+
*.jar
14+
*.rar
15+
*.tar
16+
*.zip
17+
18+
*.log
19+
*.sqlite

README.md

+59-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,59 @@
1-
# pocplot
2-
Simple GTK3/GObject Graph Plotting
1+
# PocPlot
2+
3+
A simple GTK3/GObject graph plotting library.
4+
5+
This project was born from the need for making some nice looking plots in
6+
another project I was working on. Many years ago I had used the plotting
7+
facilities from GtkExtra but this module was never ported to GTK3. Having
8+
looked into porting the GtkExtra modules from GTK2 I decided it was too complex
9+
a task, given my requirements, so I started looking around for something else.
10+
I found Goat Plot but this had issues with recent GTK3. However it was almost
11+
what I wanted. Ultimately after a false start at fixing the issues there I
12+
decided to sketch out some ideas and write my own.
13+
14+
PocPlot is the result of that effort. I've been using this with no problems
15+
other than occasional bug-fixes for about ten months at the time of writing
16+
(September 2020).
17+
18+
## Installation
19+
20+
PocPlot uses the
21+
[Meson build system](https://mesonbuild.com/Getting-meson.html).
22+
Refer to the Meson manual for standard configuration options.
23+
24+
Meson supports multiple build system backends. To build with
25+
[Ninja](https://ninja-build.org/) do the following:
26+
27+
``` sh
28+
$ meson [options] --buildtype=release builddir
29+
$ ninja -C builddir install
30+
```
31+
32+
The following build options are supported (defaults in bold text):
33+
* -Ddocs=true/**false** - build and install the documentation.
34+
* -Dintrospection=**true**/false - enable GObject introspection.
35+
* -Dvapi=true/**false** - use `vapigen` to build Vala support.
36+
37+
A catalogue file, `poc-catalog.xml` is installed for use with Glade.
38+
39+
Note that the meson/ninja installer does not require an explicit `sudo`,
40+
instead it will prompt for a password during install.
41+
42+
## Dependencies
43+
44+
PocPlot depends only on recent gtk3 and glib.
45+
46+
## Documentation
47+
48+
Documentation is built during installation and is accessible using Devhelp.
49+
Usage should be fairly straightforward.
50+
51+
## Why PocPlot?
52+
53+
The name PocPlot is an hommage to GoatPlot (poc is Irish for a he-goat).
54+
Being short, `poc` is also a convenient GObject namespace.
55+
56+
## Licence
57+
58+
PocPlot is licensed under the GNU Lesser General Public License version 2.1.
59+
Please refer to LICENSE for full details.

docs/meson.build

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
2+
3+
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
4+
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
5+
6+
poc_ignore = [
7+
'pocbag.c',
8+
'pocbag.h',
9+
'mathextra.h',
10+
'mathextra.h.in',
11+
]
12+
13+
gnome.gtkdoc('poc',
14+
dependencies : [declare_dependency(link_with : lib), gtkdep],
15+
ignore_headers : poc_ignore,
16+
gobject_typesfile : ['poc.types'],
17+
main_xml : meson.project_name() + '-docs.xml',
18+
src_dir : [meson.source_root(), meson.build_root()],
19+
mkdb_args: [
20+
'--default-includes=poc.h',
21+
],
22+
fixxref_args: [
23+
'--html-dir=@0@'.format(docpath),
24+
'--extra-dir=@0@'.format(glib_docpath),
25+
],
26+
install : true
27+
)

docs/poc-docs.xml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0"?>
2+
<book xmlns="http://docbook.org/ns/docbook" version="5.0"
3+
xmlns:xi="http://www.w3.org/2003/XInclude"
4+
id="index">
5+
<info>
6+
<title>PocPlot Reference Manual</title>
7+
<releaseinfo>
8+
This document is for the PocPlot library.
9+
</releaseinfo>
10+
<copyright>
11+
<year>2020</year>
12+
<holder>Brian Stafford</holder>
13+
</copyright>
14+
</info>
15+
16+
<part>
17+
<title>PocPlot Overview</title>
18+
19+
<xi:include href="overview.xml"><xi:fallback /></xi:include>
20+
21+
<chapter>
22+
<title>Object Hierarchy</title>
23+
<xi:include href="xml/tree_index.sgml"/>
24+
</chapter>
25+
</part>
26+
27+
<part>
28+
<title>PocPlot Objects and Types</title>
29+
30+
<chapter id="Plot">
31+
<title>PocPlot Plot Objects</title>
32+
<xi:include href="xml/pocplot.xml" />
33+
<xi:include href="xml/pocdataset.xml" />
34+
<xi:include href="xml/pocdatasetspline.xml" />
35+
<xi:include href="xml/pocaxis.xml" />
36+
</chapter>
37+
38+
<chapter id="Legend">
39+
<title>PocPlot Additional Objects</title>
40+
<xi:include href="xml/poclegend.xml" />
41+
<xi:include href="xml/pocsample.xml" />
42+
</chapter>
43+
44+
<chapter id="Types">
45+
<title>PocPlot Types</title>
46+
<xi:include href="xml/poctypes.xml" />
47+
</chapter>
48+
49+
<chapter id="Other">
50+
<title>PocPlot Internals</title>
51+
<xi:include href="xml/pocspline.xml" />
52+
</chapter>
53+
</part>
54+
55+
<part>
56+
<title>Symbols</title>
57+
<index id="api-index-full">
58+
<title>API Index</title>
59+
<xi:include href="xml/api-index-full.xml"><xi:fallback/></xi:include>
60+
</index>
61+
<index id="api-index-deprecated">
62+
<title>Index of deprecated symbols</title>
63+
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback/></xi:include>
64+
</index>
65+
</part>
66+
67+
<part>
68+
<title>License</title>
69+
<para>
70+
PocPlot is free software; you can redistribute it and/or modify it under
71+
the terms of the <citetitle>GNU Lesser General Public License</citetitle>
72+
as published by the Free Software Foundation; either version 2.1 of the
73+
License, or (at your option) any later version.
74+
</para>
75+
76+
<para>
77+
PocPlot is distributed in the hope that it will be useful, but WITHOUT
78+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
79+
FITNESS FOR A PARTICULAR PURPOSE. See the <citetitle>GNU Lesser General
80+
Public License</citetitle> for more details.
81+
</para>
82+
83+
<para>
84+
You should have received a copy of the <citetitle>GNU Lesser General
85+
Public License</citetitle> along with PocPlot; if not, see <ulink
86+
type="http"
87+
url="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</ulink>.
88+
</para>
89+
</part>
90+
91+
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
92+
</book>

docs/poc.types

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
poc_axis_get_type
2+
poc_axis_mode_get_type
3+
poc_dataset_get_type
4+
poc_dataset_spline_get_type
5+
poc_double_array_get_type
6+
poc_legend_get_type
7+
poc_line_style_get_type
8+
poc_plot_get_type
9+
poc_point_array_get_type
10+
poc_point_get_type
11+
poc_sample_get_type

mathextra.h.in

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* This file is part of PocPlot.
2+
*
3+
* PocPlot is free software; you can redistribute it and/or modify it
4+
* under the terms of the GNU Lesser General Public License as published
5+
* by the Free Software Foundation; either version 2.1 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* PocPlot is distributed in the hope that it will be useful, but
9+
* WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
* Lesser General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU Lesser General Public
14+
* License along with PocPlot; if not, see
15+
* <https://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2020 Brian Stafford
18+
*/
19+
#ifndef _mathextra_h
20+
#define _mathextra_h
21+
22+
#mesondefine HAVE_EXP10
23+
24+
#ifndef HAVE_EXP10
25+
# define exp10(x) exp ((x) * M_LN10)
26+
# define exp10f(x) expf ((x) * (float) M_LN10)
27+
#endif
28+
29+
#endif

meson.build

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
project('poc', 'c', version : '0.1.0', default_options: ['c_std=c11'])
2+
pkg = import('pkgconfig')
3+
gnome = import('gnome')
4+
5+
pocsource = [
6+
'poc.h',
7+
'pocaxis.c',
8+
'pocaxis.h',
9+
'pocbag.c',
10+
'pocbag.h',
11+
'pocdataset.c',
12+
'pocdataset.h',
13+
'pocdatasetspline.c',
14+
'pocdatasetspline.h',
15+
'poclegend.c',
16+
'poclegend.h',
17+
'pocplot.c',
18+
'pocplot.h',
19+
'pocsample.c',
20+
'pocsample.h',
21+
'pocspline.c',
22+
'pocspline.h',
23+
'poctypes.c',
24+
'poctypes.h',
25+
]
26+
27+
cflags = [
28+
'-D__poc_compile__=1',
29+
'-DGSEAL_ENABLE',
30+
'-DG_DISABLE_DEPRECATED',
31+
'-DG_DISABLE_SINGLE_INCLUDES',
32+
'-DGDK_DISABLE_DEPRECATED',
33+
'-DGTK_DISABLE_DEPRECATED',
34+
'-DGDK_DISABLE_SINGLE_INCLUDES',
35+
'-DGTK_DISABLE_SINGLE_INCLUDES',
36+
'-DGTK_MULTIDEVICE_SAFE=1',
37+
]
38+
39+
cflags_warnings = [
40+
'-Wstrict-prototypes',
41+
'-Wmissing-prototypes',
42+
'-Wnested-externs',
43+
'-Walloc-zero',
44+
'-Wduplicated-branches',
45+
'-Wpointer-arith',
46+
'-Wcast-align',
47+
'-Wwrite-strings',
48+
'-Wdeclaration-after-statement',
49+
'-Wshadow',
50+
'-Wredundant-decls',
51+
'-Wpacked',
52+
'-Wbad-function-cast',
53+
]
54+
55+
cc = meson.get_compiler('c')
56+
if get_option('warning_level') == '3'
57+
cflags += cflags_warnings
58+
endif
59+
add_project_arguments(cc.get_supported_arguments(cflags), language: 'c')
60+
61+
mdep = cc.find_library('m', required: false)
62+
gtkdep = dependency('gtk+-3.0')
63+
64+
mapfile = 'pocplot.map'
65+
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
66+
67+
lib = library('poc', pocsource,
68+
link_args : vflag,
69+
link_depends : mapfile,
70+
dependencies : [gtkdep, mdep],
71+
soversion : meson.project_version(),
72+
install : true)
73+
74+
host_os = host_machine.system()
75+
os_win32 = host_os.contains('mingw') or host_os.contains('windows')
76+
77+
if get_option('introspection')
78+
gir = gnome.generate_gir(lib,
79+
sources : pocsource,
80+
nsversion : '0.1',
81+
namespace : 'Poc',
82+
identifier_prefix: 'Poc',
83+
symbol_prefix: 'poc',
84+
includes: ['GLib-2.0', 'GObject-2.0', 'Gtk-3.0'],
85+
install: true
86+
)
87+
88+
if get_option('vapi')
89+
vapi = gnome.generate_vapi('poc-0.1',
90+
sources: gir[0],
91+
packages: [ 'gtk+-3.0' ],
92+
install: true,
93+
metadata_dirs: [ meson.current_source_dir() ],
94+
)
95+
endif
96+
endif
97+
98+
if get_option('docs')
99+
subdir ('docs')
100+
endif
101+
102+
mathextra = configuration_data()
103+
mathextra.set('HAVE_EXP10', cc.has_function('exp10', prefix : '#include <math.h>'))
104+
configure_file(input : 'mathextra.h.in',
105+
output : 'mathextra.h',
106+
configuration : mathextra)
107+
108+
install_headers(['poc.h', 'pocplot.h', 'pocdataset.h', 'pocaxis.h', 'pocsample.h',
109+
'pocdatasetspline.h', 'poclegend.h', 'pocspline.h', 'poctypes.h'])
110+
pkg.generate(lib)
111+
112+
install_data(['poc-catalog.xml'], install_dir: 'share/glade/catalogs')

meson_options.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
option('docs', type: 'boolean', value: 'false')
2+
option('introspection', type: 'boolean', value: 'true')
3+
option('vapi', type: 'boolean', value: 'false')

0 commit comments

Comments
 (0)