Verified Commit 216ba0d4 authored by Zander's avatar Zander 💥

Drop outdated sozi integration, fixes #398

parent d7fd3c78
# TODO: This depends on WITH_SOZI compilation option.
if false
sources = files(
'sozi.c',
'sozi-object.c',
'sozi-frame.c',
'sozi-media.c'
)
dia_object_desc += {
'name': 'sozi_objects',
'sources': sources,
}
endif
/* XPM */
static const char * sozi_frame_xpm[] = {
"22 22 171 2",
" c #FFFFFF",
". c #FEFEFE",
"+ c #FDFDFD",
"@ c #F7F7F8",
"# c #D2D2D2",
"$ c #939393",
"% c #8A8A8A",
"& c #BEBEBE",
"* c #F2F2F2",
"= c #FCFCFC",
"- c #F3F3F3",
"; c #FBFBFB",
"> c #FEFEFF",
", c #FCFCFB",
"' c #FAF4F1",
") c #FAF1EB",
"! c #F8F5F2",
"~ c #BFBFBF",
"{ c #E4E4E4",
"] c #F1F1F1",
"^ c #ADADAD",
"/ c #F5F5F5",
"( c #BEBABE",
"_ c #99909A",
": c #EDEAED",
"< c #ECDCD2",
"[ c #C3682D",
"} c #C64500",
"| c #98562A",
"1 c #BBB6B2",
"2 c #F8F8F9",
"3 c #FBFCFB",
"4 c #FBFCFC",
"5 c #E8BC9E",
"6 c #F55A00",
"7 c #F05F00",
"8 c #E4BCA1",
"9 c #F3F8FC",
"0 c #F6F6F6",
"a c #DCDCDC",
"b c #CACACA",
"c c #CDCDCD",
"d c #CBCBC9",
"e c #D8D8D7",
"f c #FBFBFC",
"g c #E7B99A",
"h c #F25600",
"i c #DD7A39",
"j c #E7DDD6",
"k c #D0D0D0",
"l c #C8C8C8",
"m c #989898",
"n c #CACBCC",
"o c #A3A298",
"p c #BFB483",
"q c #EEE8D1",
"r c #FBFBFA",
"s c #FAFBFC",
"t c #E6BA9E",
"u c #EB5400",
"v c #ECA372",
"w c #F8FBFD",
"x c #ECECEC",
"y c #FBFCFE",
"z c #D3D1C7",
"A c #DDB617",
"B c #C4A423",
"C c #EFECE1",
"D c #FBFDFF",
"E c #E5C3AD",
"F c #DD5A03",
"G c #E8AD85",
"H c #F9FFFF",
"I c #E6E6E6",
"J c #E9E9EA",
"K c #CFCECD",
"L c #DEBF2D",
"M c #C99E00",
"N c #EDE9D1",
"O c #E4D5CC",
"P c #AE6636",
"Q c #E2BCA3",
"R c #FFFFFE",
"S c #E5E5E5",
"T c #C8C8C9",
"U c #D9DBE5",
"V c #DBBD39",
"W c #B79A21",
"X c #EDEADF",
"Y c #ECEAE9",
"Z c #A98C7A",
"` c #D3B8A6",
" . c #E3E3E3",
".. c #C7C7C7",
"+. c #F1F3FC",
"@. c #A5965C",
"#. c #BDB496",
"$. c #BEBBB8",
"%. c #B3ACA7",
"&. c #E9E7E7",
"*. c #B6B4B4",
"=. c #92939A",
"-. c #DFDFE3",
";. c #ADAEAF",
">. c #CCCDCE",
",. c #7D898D",
"'. c #DCDBDA",
"). c #EDEDED",
"!. c #DADADA",
"~. c #9B9B9B",
"{. c #DEDEDE",
"]. c #FFFEFE",
"^. c #B4CBD2",
"/. c #389CB5",
"(. c #6E9CA8",
"_. c #DDDDDD",
":. c #EAEAEA",
"<. c #CECECE",
"[. c #B6B6B6",
"}. c #E7E7E7",
"|. c #B2D0D8",
"1. c #1BB6DE",
"2. c #00A7D3",
"3. c #82AFBB",
"4. c #EEEEEE",
"5. c #999999",
"6. c #F0F0F0",
"7. c #E0E0E0",
"8. c #F9FCFC",
"9. c #1194B5",
"0. c #00CEFF",
"a. c #23BAE1",
"b. c #C3D0D4",
"c. c #D4D4D4",
"d. c #FAFCFC",
"e. c #2E8FA8",
"f. c #00BDEF",
"g. c #3AB4D3",
"h. c #F8F2F1",
"i. c #EBEBEB",
"j. c #C6C6C6",
"k. c #A8A8A8",
"l. c #F4F4F4",
"m. c #DBE7EB",
"n. c #6894A0",
"o. c #6C8288",
"p. c #A3A1A0",
"q. c #949494",
"r. c #8F8F8F",
"s. c #E2E2E2",
"t. c #BABABA",
"u. c #CBCACA",
"v. c #9A9898",
"w. c #F3F2F1",
"x. c #E9E9E9",
"y. c #E8E8E8",
"z. c #F9F9F9",
"A. c #F7F7F7",
"B. c #A9A9A9",
"C. c #C1C1C1",
"D. c #D7D7D7",
"E. c #F7F6F6",
"F. c #FAFAFA",
"G. c #5F5F5F",
"H. c #B2B2B2",
"I. c #F8F8F8",
"J. c #D8D8D8",
"K. c #909090",
"L. c #7D7D7D",
"M. c #858585",
"N. c #B4B4B4",
" . . . . . + + . . . . . ",
" . @ # $ % & * . = - ; . ",
" > , ' ) ! ~ { ] ^ / ( _ : ",
" < [ } | 1 2 . . * ~ 3 . . ",
" 4 5 6 7 8 9 = . 0 a b c ; d e > . ",
" f g h i j . 0 k l m n o p q r . . ",
" s t u v w . x y z A B C > . ",
" D E F G H . . = I J K L M N ",
" O P Q R . S T U V W X > ",
" . Y Z ` > . . ...+.@.#.2 ",
" R $.%. . . . . &.*.c =.-. ",
" . n ;.= . . >.,.'.a ). . . ",
" . !.~.{. . . ].^./.(. . # _. ",
" . :.<.[.}. . + |.1.2.3. 4...5.= ",
" * 6.c 7.+ 8.9.0.a.b. . 6.<.+ ",
" . c.7.# - . . d.e.f.g.h. ",
" . i.j.k.l. > m.n.o.p.$ q.r.s.. ",
" . . I & t.0 ; ] u.v.w.).x.x.y.z.. . ",
" . + A.B.c C.<.D.E. . . ",
"F.G.H.i.I. 4.C./ z.; ; . . ",
". / J.~ K.L.M.N.l.. . . ",
" . . + + + . . . . . "};
/* XPM */
static const char * sozi_media_xpm[] = {
"22 22 189 2",
" c None",
". c #000000",
"+ c #030303",
"@ c #060606",
"# c #050505",
"$ c #040404",
"% c #EBEBEB",
"& c #5D5D5D",
"* c #6C6C6C",
"= c #ECECEC",
"- c #E3E3E3",
"; c #1C1C1C",
"> c #989898",
", c #888888",
"' c #6E6E6E",
") c #0A0A0A",
"! c #DDDDDD",
"~ c #A6A6A6",
"{ c #212121",
"] c #EAEAEA",
"^ c #595959",
"/ c #6A6A6A",
"( c #E7E1DF",
"_ c #DED6D1",
": c #1B1A1A",
"< c #A5A5A5",
"[ c #CCCCCC",
"} c #070707",
"| c #D3D3D3",
"1 c #151315",
"2 c #D6D3D6",
"3 c #FFFFFF",
"4 c #FBFCFC",
"5 c #E8BC9E",
"6 c #F55A00",
"7 c #F05F00",
"8 c #E4BCA1",
"9 c #F3F8FC",
"0 c #FCFCFC",
"a c #FEFEFE",
"b c #F6F6F6",
"c c #DCDCDC",
"d c #CACACA",
"e c #CDCDCD",
"f c #FBFBFB",
"g c #CBCBC9",
"h c #D8D8D7",
"i c #FEFEFF",
"j c #F7F7F7",
"k c #FDFDFD",
"l c #FBFBFC",
"m c #E7B99A",
"n c #F25600",
"o c #DD7A39",
"p c #E7DDD6",
"q c #D0D0D0",
"r c #C8C8C8",
"s c #CACBCC",
"t c #A3A298",
"u c #BFB483",
"v c #EEE8D1",
"w c #FBFBFA",
"x c #FAFBFC",
"y c #E6BA9E",
"z c #EB5400",
"A c #ECA372",
"B c #F8FBFD",
"C c #FBFCFE",
"D c #D3D1C7",
"E c #DDB617",
"F c #C4A423",
"G c #EFECE1",
"H c #FBFDFF",
"I c #E5C3AD",
"J c #DD5A03",
"K c #E8AD85",
"L c #F9FFFF",
"M c #E6E6E6",
"N c #E9E9EA",
"O c #CFCECD",
"P c #DEBF2D",
"Q c #C99E00",
"R c #EDE9D1",
"S c #E4D5CC",
"T c #AE6636",
"U c #E2BCA3",
"V c #FFFFFE",
"W c #E5E5E5",
"X c #C8C8C9",
"Y c #D9DBE5",
"Z c #DBBD39",
"` c #B79A21",
" . c #EDEADF",
".. c #ECEAE9",
"+. c #A98C7A",
"@. c #D3B8A6",
"#. c #C7C7C7",
"$. c #F1F3FC",
"%. c #A5965C",
"&. c #BDB496",
"*. c #F8F8F9",
"=. c #BEBBB8",
"-. c #B3ACA7",
";. c #E9E7E7",
">. c #B6B4B4",
",. c #92939A",
"'. c #DFDFE3",
"). c #ADAEAF",
"!. c #CCCDCE",
"~. c #7D898D",
"{. c #DCDBDA",
"]. c #EDEDED",
"^. c #DADADA",
"/. c #9B9B9B",
"(. c #DEDEDE",
"_. c #FFFEFE",
":. c #B4CBD2",
"<. c #389CB5",
"[. c #6E9CA8",
"}. c #D2D2D2",
"|. c #CECECE",
"1. c #B6B6B6",
"2. c #E7E7E7",
"3. c #B2D0D8",
"4. c #1BB6DE",
"5. c #00A7D3",
"6. c #82AFBB",
"7. c #EEEEEE",
"8. c #999999",
"9. c #F2F2F2",
"0. c #F0F0F0",
"a. c #E0E0E0",
"b. c #F9FCFC",
"c. c #1194B5",
"d. c #00CEFF",
"e. c #23BAE1",
"f. c #C3D0D4",
"g. c #D4D4D4",
"h. c #F3F3F3",
"i. c #FAFCFC",
"j. c #2E8FA8",
"k. c #00BDEF",
"l. c #3AB4D3",
"m. c #F8F2F1",
"n. c #C6C6C6",
"o. c #A8A8A8",
"p. c #F4F4F4",
"q. c #DBE7EB",
"r. c #6894A0",
"s. c #6C8288",
"t. c #A3A1A0",
"u. c #939393",
"v. c #949494",
"w. c #8F8F8F",
"x. c #E2E2E2",
"y. c #BEBEBE",
"z. c #BABABA",
"A. c #F1F1F1",
"B. c #CBCACA",
"C. c #9A9898",
"D. c #F3F2F1",
"E. c #E9E9E9",
"F. c #E8E8E8",
"G. c #F9F9F9",
"H. c #181818",
"I. c #2D2D2D",
"J. c #2C2C2C",
"K. c #ACACAC",
"L. c #1F1F1F",
"M. c #AAAAAA",
"N. c #ADADAD",
"O. c #242424",
"P. c #3C3C3C",
"Q. c #9D9D9D",
"R. c #8B8B8B",
"S. c #AFAFAF",
"T. c #AEAEAE",
"U. c #5A5A5A",
"V. c #474747",
"W. c #909090",
"X. c #7D7D7D",
"Y. c #3A3A3A",
"Z. c #B4B4B4",
"`. c #101010",
" + c #F8F8F8",
".+ c #0C0C0C",
"++ c #080808",
"@+ c #0D0D0D",
"#+ c #010101",
". + @ + . . @ # . . . # $ . . . # $ . . $ @ ",
"% & . * = - ; . > , ' . ) ! % ~ . { - ] ^ . ",
"% & . / ( _ : . < = [ . } | % ~ . 1 2 ] ^ . ",
". . . . . . . . . . . . . . . . . . . . . . ",
"3 3 4 5 6 7 8 9 0 a 3 b c d e f g h 3 i j k ",
"3 3 l m n o p 3 3 3 a b q r > s t u v w a a ",
"3 3 x y z A B 3 3 3 a 3 3 3 = C D E F G i a ",
"3 3 H I J K L 3 3 a 3 a 3 0 M N O P Q R 3 3 ",
"3 3 3 S T U 3 V 3 3 3 3 a 3 W X Y Z ` .3 i ",
"3 a 3 ..+.@.3 i a 3 3 3 a 3 - #.$.%.&.*.3 3 ",
"3 3 V 3 =.-.3 a 3 a 3 a a 3 ;.>.e ,.'.3 3 3 ",
"3 3 a 3 s ).0 3 a 3 a 3 3 3 !.~.{.c ].3 a a ",
"3 a 3 3 ^./.(.3 a 3 3 a _.:.<.[.3 a }.! 3 3 ",
"3 3 a 3 ] |.1.2.3 a 3 k 3.4.5.6.3 3 7.#.8.0 ",
"3 3 3 3 9.0.e a.k 3 3 b.c.d.e.f.3 a 3 0.|.k ",
"3 3 3 3 a g.a.}.h.a a i.j.k.l.m.3 3 3 3 3 3 ",
"3 3 a 3 3 % n.o.p.3 3 i q.r.s.t.u.v.w.x.a 3 ",
"3 a 3 3 a 3 M y.z.b f A.B.C.D.].E.E.F.G.p.f ",
". . . . . . . . . . . . . . . H.I.I.I.I.J.J.",
"K.L.. { M.N.O.. P.M.Q.. . R.S., . # < T.U.. ",
"a S.. V.W.X.Y.. Z.a 3 `.@ a 3 +. .+3 3 | . ",
".+. # . ++++. # . @++ @ @ . @+. @ # #+.+. @ "};
This is a front end for the integration of the Sozi player (see [1])
to the Dia's SVG exports. Sozi is a zooming UI for presentation, a
bit like Prezi. Some examples of Sozi presentations are available on
the page [2].
This implementation supports Sozi strictly less than 14. The old
(<=13) "API" can be found at [3], but will probably be obsolete when
you will read this doc.
Additional information can be found on the Sozi web site, particularly
helps about the usage of the player [4].
The implementation splits in several files :
sozi-object : the base object that control placement of the object.
sozi-frame : the frame that represent a view of the presentation.
sozi-media : a video or audio to insert in the presentation
sozi-player : the minified javascript/css code of the Sozi player,
generated from the Sozi source code, taken from the
commit of the Sep 22, 2014 [5].
As an alternative to the embedded Sozi player version, you can provide
your own Sozi player with the "--with-sozi-path" configure option that
should point to a path containing the Sozi player files (sozi.version,
sozi.js, sozi.css, ...).
Some issues still need to be addressed to improve this module:
- the problem of the frame title/sequence display :
- should we display something ?
- what : sequence number, title, both ?
- should it be editable in interactive rendering ?
- placement : inside, outside ?
- size : dynamic re-sizing ?
- the problem of the frame title/sequence management :
- the automatic sequence numbering is screwed after frame
deletion or undo command.
- is the automatic sequence management the good solution ?
- how to redraw all objects after changing sequence numbering ?
- display a preview of the media ?
[1] http://sozi.baierouge.fr/
[2] http://sozi.wikidot.com/presentations
[3] https://web.archive.org/web/20130527164221/http://sozi.baierouge.fr/wiki/en:format
[4] http://sozi.baierouge.fr/pages/40-play.html
[5] https://github.com/senshu/Sozi/commit/e6598642ae6f06e87b689839fb0229ccf1f1130c
This diff is collapsed.
/* -*- c-basic-offset:4; -*- */
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1999 Alexander Larsson
*
* Sozi objects support
* Copyright (C) 2015 Paul Chavent
*
* This program 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.
*
* This program 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.
*/
/* standard libs*/
#include <assert.h>
/* xpath for searching in the svg doc */
#include <libxml/xpath.h>
/* dia stuff */
#include "object.h"
#include "diarenderer.h"
#include "diasvgrenderer.h"
#include "properties.h"
/* sozi stuff */
#include "pixmaps/sozi-media.xpm"
#include "sozi-object.h"
/******************************************************************************
*
*****************************************************************************/
typedef enum
{
MEDIA_TYPE_UNDEFINED ,
MEDIA_TYPE_VIDEO_MP4 ,
MEDIA_TYPE_VIDEO_WEBM,
MEDIA_TYPE_VIDEO_OGG ,
MEDIA_TYPE_AUDIO_MPEG,
MEDIA_TYPE_AUDIO_OGG ,
MEDIA_TYPE_AUDIO_WAV ,
} MediaType;
/******************************************************************************
*
*****************************************************************************/
typedef struct _SoziMedia
{
/* sozi object inheritance */
SoziObject sozi_object;
/* sozi media specific stuff */
MediaType type;
gchar * file;
int start_frame;
int stop_frame;
} SoziMedia;
/******************************************************************************
* Dia object type operations
*****************************************************************************/
static DiaObject * sozi_media_create(Point *startpoint,
void *user_data,
Handle **handle1,
Handle **handle2);
static DiaObject * sozi_media_load(ObjectNode obj_node, int version, DiaContext *ctx);
static ObjectTypeOps sozi_media_type_ops =
{
(CreateFunc) sozi_media_create, /* create */
(LoadFunc) sozi_media_load, /* load (== object_load_using_properties ?) */
(SaveFunc) object_save_using_properties, /* save */
(GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL,
};
DiaObjectType sozi_media_type =
{
"Sozi - Media", /* name */
0, /* version */
sozi_media_xpm, /* pixmap */
&sozi_media_type_ops, /* ops */
NULL, /* pixmap_file */
0 /* default_user_data */
};
/******************************************************************************
* Dia object operations
*****************************************************************************/
static void sozi_media_destroy(SoziMedia *sozi_media);
static void sozi_media_draw(SoziMedia *sozi_media, DiaRenderer *renderer);
static real sozi_media_distance_from(SoziMedia *sozi_media, Point *point);
static void sozi_media_select(SoziMedia *sozi_media, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* sozi_media_move(SoziMedia *sozi_media, Point *to);
static ObjectChange* sozi_media_move_handle(SoziMedia *sozi_media, Handle *handle,
Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers);
static PropDescription * sozi_media_describe_props(SoziMedia *sozi_media);
static void sozi_media_get_props(SoziMedia *sozi_media, GPtrArray *props);
static void sozi_media_set_props(SoziMedia *sozi_media, GPtrArray *props);
static ObjectOps sozi_media_ops =
{
(DestroyFunc) sozi_media_destroy,
(DrawFunc) sozi_media_draw,
(DistanceFunc) sozi_media_distance_from,
(SelectFunc) sozi_media_select,
(CopyFunc) object_copy_using_properties,
(MoveFunc) sozi_media_move,
(MoveHandleFunc) sozi_media_move_handle,
(GetPropertiesFunc) object_create_props_dialog,
(ApplyPropertiesDialogFunc) object_apply_props_from_dialog,
(ObjectMenuFunc) 0,
(DescribePropsFunc) sozi_media_describe_props,
(GetPropsFunc) sozi_media_get_props,
(SetPropsFunc) sozi_media_set_props,
(TextEditFunc) 0,
(ApplyPropertiesListFunc) object_apply_props,
};
/******************************************************************************
* Functions for managing Sozi media
*****************************************************************************/
static void
sozi_media_update(SoziMedia *sozi_media)
{
char legend[32];
int nb_char;
/* update legend */
nb_char = g_snprintf(legend, sizeof(legend), "%s", sozi_media->file);
if(sizeof(legend) < nb_char)
{
legend[sizeof(legend) - 1] = 0;
legend[sizeof(legend) - 2] = '.';
legend[sizeof(legend) - 3] = '.';
legend[sizeof(legend) - 4] = '.';
}
text_set_string(sozi_media->sozi_object.legend.text, legend);
}
/******************************************************************************
* Functions for managing the Sozi object life managment (init, copy, kill)
*****************************************************************************/
static void
sozi_media_init(SoziMedia *sozi_media)
{
sozi_media->type = MEDIA_TYPE_UNDEFINED;
if(sozi_media->file == NULL) {
sozi_media->file = g_strdup("");
}
}
static void
sozi_media_kill(SoziMedia *sozi_media)
{
if(sozi_media->file != NULL) {
g_free(sozi_media->file);
}
}
/******************************************************************************
* Functions that implement the Dia fops
*****************************************************************************/
static DiaObject *
sozi_media_create(Point *startpoint,
void *user_data,
Handle **handle1,
Handle **handle2)
{
SoziMedia *sozi_media;
sozi_media = g_new0(SoziMedia, 1);
/* init dia object */
sozi_media->sozi_object.dia_object.type = &sozi_media_type;
sozi_media->sozi_object.dia_object.ops = &sozi_media_ops;
/* init sozi object : that is also the place where the dia object
* geometry (position, handles, ...) will be initialized
*/
sozi_object_init(&sozi_media->sozi_object, startpoint);
/* init sozi media */
sozi_media_init(sozi_media);
/* update sozi object geometry */
sozi_object_update(&sozi_media->sozi_object);
*handle1 = NULL; /* not connectable ... */
g_assert (sozi_media->sozi_object.dia_object.handles[2]->id == HANDLE_RESIZE_SE);
*handle2 = sozi_media->sozi_object.dia_object.handles[2]; /* ... but resizable */
return &sozi_media->sozi_object.dia_object;
}
/******************************************************************************
*
*****************************************************************************/
static void
sozi_media_destroy(SoziMedia *sozi_media)
{
/* kill sozi media */
sozi_media_kill(sozi_media);
/* kill sozi object */
sozi_object_kill(&sozi_media->sozi_object);
/* do NOT free sozi_media, caller will take care about that */
}
/******************************************************************************
*
*****************************************************************************/
static void
sozi_media_draw_svg(SoziMedia *sozi_media, DiaSvgRenderer *svg_renderer)
{
xmlNs *sozi_name_space;
xmlNodePtr root;
xmlNodePtr node;
xmlNodePtr rect;
/* buffers for storing attributes */
gchar * type;
gchar * src;
gchar * start_frame;
gchar * stop_frame;
/* format attributes */
switch(sozi_media->type) {
case MEDIA_TYPE_VIDEO_MP4 : type = g_strdup("video/mp4" ); break;
case MEDIA_TYPE_VIDEO_WEBM: type = g_strdup("video/webm"); break;
case MEDIA_TYPE_VIDEO_OGG : type = g_strdup("video/ogg" ); break;
case MEDIA_TYPE_AUDIO_MPEG: type = g_strdup("audio/mpeg"); break;
case MEDIA_TYPE_AUDIO_OGG : type = g_strdup("audio/ogg" ); break;
case MEDIA_TYPE_AUDIO_WAV : type = g_strdup("audio/wav" ); break;
default: return;
}
src = g_strdup(sozi_media->file);
start_frame = g_strdup_printf("%d", sozi_media->start_frame);
stop_frame = g_strdup_printf("%d", sozi_media->stop_frame);
/* draw the sozi base object and get a reference to the sozi
namespace and document root */
sozi_object_draw_svg(&sozi_media->sozi_object, svg_renderer, 0, &sozi_name_space, &root, &rect);
assert(sozi_name_space != NULL);
/* add a "custom" media for sozi */
switch(sozi_media->type) {
case MEDIA_TYPE_VIDEO_MP4 :