Work in progress
This commit is contained in:
parent
49489bd6e3
commit
42a9f92da2
17
Makefile
17
Makefile
|
@ -1,6 +1,6 @@
|
|||
PACKAGE = Presenter
|
||||
VERSION = 0.0.0
|
||||
SUBDIRS = data doc po src
|
||||
SUBDIRS = data doc include po src
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
TAR = tar -czvf
|
||||
|
@ -28,16 +28,31 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/doc/docbook.sh \
|
||||
$(PACKAGE)-$(VERSION)/doc/presenter.xml \
|
||||
$(PACKAGE)-$(VERSION)/doc/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/include/Presenter.h \
|
||||
$(PACKAGE)-$(VERSION)/include/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/include/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/include/Presenter/presenter.h \
|
||||
$(PACKAGE)-$(VERSION)/include/Presenter/slide.h \
|
||||
$(PACKAGE)-$(VERSION)/include/Presenter/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/include/Presenter/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/po/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/po/gettext.sh \
|
||||
$(PACKAGE)-$(VERSION)/po/POTFILES \
|
||||
$(PACKAGE)-$(VERSION)/po/fr.po \
|
||||
$(PACKAGE)-$(VERSION)/po/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/src/document.c \
|
||||
$(PACKAGE)-$(VERSION)/src/presenter.c \
|
||||
$(PACKAGE)-$(VERSION)/src/slide.c \
|
||||
$(PACKAGE)-$(VERSION)/src/main.c \
|
||||
$(PACKAGE)-$(VERSION)/src/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/src/document.h \
|
||||
$(PACKAGE)-$(VERSION)/src/presenter.h \
|
||||
$(PACKAGE)-$(VERSION)/src/slide.h \
|
||||
$(PACKAGE)-$(VERSION)/src/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/src/slides/embed.c \
|
||||
$(PACKAGE)-$(VERSION)/src/slides/title.c \
|
||||
$(PACKAGE)-$(VERSION)/src/slides/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/src/slides/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/config.h \
|
||||
$(PACKAGE)-$(VERSION)/config.sh \
|
||||
|
|
10
config.h
Normal file
10
config.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#define PACKAGE "Presenter"
|
||||
#define VERSION "0.0.0"
|
||||
|
||||
#ifndef PREFIX
|
||||
# define PREFIX "/usr/local"
|
||||
#endif
|
||||
|
||||
#ifndef LIBDIR
|
||||
# define LIBDIR PREFIX "/lib"
|
||||
#endif
|
5
config.sh
Normal file
5
config.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
PACKAGE="Presenter"
|
||||
VERSION="0.0.0"
|
||||
|
||||
PREFIX="/usr/local"
|
||||
LIBDIR="${PREFIX}/lib"
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
#variables
|
||||
PREFIX="/usr/local"
|
||||
. "../config.sh"
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
#executables
|
||||
DEBUG="_debug"
|
||||
INSTALL="install -m 0644"
|
||||
|
@ -44,6 +44,14 @@ _debug()
|
|||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "docbook.sh: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
|
@ -84,6 +92,12 @@ if [ $# -eq 0 ]; then
|
|||
exit $?
|
||||
fi
|
||||
|
||||
#check the variables
|
||||
if [ -z "$PACKAGE" ]; then
|
||||
_error "The PACKAGE variable needs to be set"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
||||
|
||||
|
@ -123,7 +137,7 @@ while [ $# -gt 0 ]; do
|
|||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
$DEBUG $MKDIR -- "$instdir" || exit 2
|
||||
$DEBUG $INSTALL -- "$target" "$instdir/$target" || exit 2
|
||||
$DEBUG $INSTALL "$target" "$instdir/$target" || exit 2
|
||||
continue
|
||||
fi
|
||||
|
||||
|
|
31
include/Makefile
Normal file
31
include/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
|||
SUBDIRS = Presenter
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
INCLUDEDIR= $(PREFIX)/include
|
||||
|
||||
|
||||
all: subdirs
|
||||
|
||||
subdirs:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE)) || exit; done
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) clean) || exit; done
|
||||
|
||||
distclean:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) distclean) || exit; done
|
||||
|
||||
install:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) install) || exit; done
|
||||
$(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop
|
||||
$(INSTALL) -m 0644 Presenter.h $(DESTDIR)$(PREFIX)/include/Desktop/Presenter.h
|
||||
|
||||
uninstall:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) uninstall) || exit; done
|
||||
$(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/Presenter.h
|
||||
|
||||
.PHONY: all subdirs clean distclean install uninstall
|
24
include/Presenter.h
Normal file
24
include/Presenter.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Deskto Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#ifndef DESKTOP_PRESENTER_H
|
||||
# define DESKTOP_PRESENTER_H
|
||||
|
||||
# include "Presenter/presenter.h"
|
||||
# include "Presenter/slide.h"
|
||||
|
||||
#endif /* !DESKTOP_PRESENTER_H */
|
26
include/Presenter/Makefile
Normal file
26
include/Presenter/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
|||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
INCLUDEDIR= $(PREFIX)/include
|
||||
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
distclean: clean
|
||||
|
||||
install:
|
||||
$(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop/Presenter
|
||||
$(INSTALL) -m 0644 presenter.h $(DESTDIR)$(PREFIX)/include/Desktop/Presenter/presenter.h
|
||||
$(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop/Presenter
|
||||
$(INSTALL) -m 0644 slide.h $(DESTDIR)$(PREFIX)/include/Desktop/Presenter/slide.h
|
||||
|
||||
uninstall:
|
||||
$(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/Presenter/presenter.h
|
||||
$(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/Presenter/slide.h
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
29
include/Presenter/presenter.h
Normal file
29
include/Presenter/presenter.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#ifndef DESKTOP_PRESENTER_PRESENTER_H
|
||||
# define DESKTOP_PRESENTER_PRESENTER_H
|
||||
|
||||
|
||||
/* Presenter */
|
||||
/* public */
|
||||
/* types */
|
||||
typedef struct _Presenter Presenter;
|
||||
|
||||
typedef struct _PresenterSlide PresenterSlide;
|
||||
|
||||
# endif /* !DESKTOP_PRESENTER_PRESENTER_H */
|
8
include/Presenter/project.conf
Normal file
8
include/Presenter/project.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
includes=presenter.h,slide.h
|
||||
dist=Makefile
|
||||
|
||||
[presenter.h]
|
||||
install=$(PREFIX)/include/Desktop/Presenter
|
||||
|
||||
[slide.h]
|
||||
install=$(PREFIX)/include/Desktop/Presenter
|
49
include/Presenter/slide.h
Normal file
49
include/Presenter/slide.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#ifndef DESKTOP_PRESENTER_SLIDE_H
|
||||
# define DESKTOP_PRESENTER_SLIDE_H
|
||||
|
||||
# include <gtk/gtk.h>
|
||||
# include "presenter.h"
|
||||
|
||||
|
||||
/* PresenterSlide */
|
||||
/* public */
|
||||
/* types */
|
||||
typedef struct _PresenterSlidePlugin PresenterSlidePlugin;
|
||||
|
||||
typedef struct _PresenterSlideHelper
|
||||
{
|
||||
Presenter * presenter;
|
||||
GdkColor background;
|
||||
GdkColor foreground;
|
||||
int (*error)(Presenter * presenter, char const * message, int ret);
|
||||
} PresenterSlideHelper;
|
||||
|
||||
typedef struct _PresenterSlideDefinition
|
||||
{
|
||||
char const * name;
|
||||
char const * icon;
|
||||
char const * description;
|
||||
PresenterSlidePlugin * (*init)(PresenterSlideHelper * helper);
|
||||
void (*destroy)(PresenterSlidePlugin * plugin);
|
||||
GtkWidget * (*get_widget)(PresenterSlidePlugin * plugin,
|
||||
PresenterSlide * slide);
|
||||
} PresenterSlideDefinition;
|
||||
|
||||
#endif /* !DESKTOP_PRESENTER_SLIDE_H */
|
6
include/project.conf
Normal file
6
include/project.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
subdirs=Presenter
|
||||
includes=Presenter.h
|
||||
dist=Makefile
|
||||
|
||||
[Presenter.h]
|
||||
install=$(PREFIX)/include/Desktop
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2010-2013 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2010-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
#variables
|
||||
PREFIX="/usr/local"
|
||||
. "../config.sh"
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
LOCALEDIR="$PREFIX/share/locale"
|
||||
POTFILES="POTFILES"
|
||||
#executables
|
||||
|
@ -49,6 +49,14 @@ _debug()
|
|||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "gettext.sh: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
|
@ -125,6 +133,12 @@ if [ $# -eq 0 ]; then
|
|||
exit $?
|
||||
fi
|
||||
|
||||
#check the variables
|
||||
if [ -z "$PACKAGE" ]; then
|
||||
_error "The PACKAGE variable needs to be set"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
LOCALEDIR="$PREFIX/share/locale"
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
|
|
|
@ -2,5 +2,5 @@ package=Presenter
|
|||
version=0.0.0
|
||||
config=h,sh
|
||||
|
||||
subdirs=data,doc,po,src
|
||||
subdirs=data,doc,include,po,src
|
||||
dist=Makefile,config.h,config.sh
|
||||
|
|
27
src/Makefile
27
src/Makefile
|
@ -1,10 +1,11 @@
|
|||
SUBDIRS = slides
|
||||
TARGETS = presenter
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
BINDIR = $(PREFIX)/bin
|
||||
SBINDIR = $(PREFIX)/sbin
|
||||
CC = cc
|
||||
CPPFLAGSF=
|
||||
CPPFLAGSF= -I ../include
|
||||
CPPFLAGS=
|
||||
CFLAGSF = -W `pkg-config --cflags libDesktop`
|
||||
CFLAGS = -Wall -g -O2
|
||||
|
@ -15,32 +16,46 @@ MKDIR = mkdir -m 0755 -p
|
|||
INSTALL = install
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
all: subdirs $(TARGETS)
|
||||
|
||||
presenter_OBJS = presenter.o main.o
|
||||
subdirs:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE)) || exit; done
|
||||
|
||||
presenter_OBJS = document.o presenter.o slide.o main.o
|
||||
presenter_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
presenter_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
|
||||
presenter: $(presenter_OBJS)
|
||||
$(CC) -o presenter $(presenter_OBJS) $(presenter_LDFLAGS)
|
||||
|
||||
presenter.o: presenter.c presenter.h ../config.h
|
||||
document.o: document.c document.h slide.h ../config.h
|
||||
$(CC) $(presenter_CFLAGS) -c document.c
|
||||
|
||||
presenter.o: presenter.c document.h presenter.h slide.h ../config.h
|
||||
$(CC) -D PREFIX=\"$(PREFIX)\" $(presenter_CFLAGS) -c presenter.c
|
||||
|
||||
slide.o: slide.c slide.h ../config.h
|
||||
$(CC) $(presenter_CFLAGS) -c slide.c
|
||||
|
||||
main.o: main.c presenter.h ../config.h
|
||||
$(CC) $(presenter_CFLAGS) -c main.c
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) clean) || exit; done
|
||||
$(RM) -- $(presenter_OBJS)
|
||||
|
||||
distclean: clean
|
||||
distclean:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) distclean) || exit; done
|
||||
$(RM) -- $(presenter_OBJS)
|
||||
$(RM) -- $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) install) || exit; done
|
||||
$(MKDIR) $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL) -m 0755 presenter $(DESTDIR)$(BINDIR)/presenter
|
||||
|
||||
uninstall:
|
||||
@for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) uninstall) || exit; done
|
||||
$(RM) -- $(DESTDIR)$(BINDIR)/presenter
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
||||
.PHONY: all subdirs clean distclean install uninstall
|
||||
|
|
122
src/document.c
Normal file
122
src/document.c
Normal file
|
@ -0,0 +1,122 @@
|
|||
/* $Id$ */
|
||||
/* Copyright © 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* This program is free software: you can redistribute it and/or modify\n"
|
||||
* it under the terms of the GNU General Public License as published by\n"
|
||||
* the Free Software Foundation, version 3 of the License.\n"
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <System.h>
|
||||
#include "document.h"
|
||||
|
||||
|
||||
/* PresenterDocument */
|
||||
/* private */
|
||||
/* types */
|
||||
struct _PresenterDocument
|
||||
{
|
||||
char * filename;
|
||||
Config * config;
|
||||
};
|
||||
|
||||
|
||||
/* prototypes */
|
||||
|
||||
|
||||
/* public */
|
||||
/* functions */
|
||||
/* essential */
|
||||
/* presenterdocument_new */
|
||||
PresenterDocument * presenterdocument_new(char const * filename)
|
||||
{
|
||||
PresenterDocument * document;
|
||||
|
||||
if((document = object_new(sizeof(*document))) == NULL)
|
||||
return NULL;
|
||||
document->filename = (filename != NULL) ? strdup(filename) : NULL;
|
||||
document->config = config_new();
|
||||
/* check for errors */
|
||||
if((filename != NULL && document->filename == NULL)
|
||||
|| document->config == NULL)
|
||||
{
|
||||
object_delete(document);
|
||||
return NULL;
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
|
||||
/* presenterdocument_delete */
|
||||
void presenterdocument_delete(PresenterDocument * document)
|
||||
{
|
||||
free(document->filename);
|
||||
if(document->config != NULL)
|
||||
config_delete(document->config);
|
||||
object_delete(document);
|
||||
}
|
||||
|
||||
|
||||
/* accessors */
|
||||
/* presenterdocument_get_filename */
|
||||
char const * presenterdocument_get_filename(PresenterDocument * document)
|
||||
{
|
||||
return document->filename;
|
||||
}
|
||||
|
||||
|
||||
/* presenterdocument_get_property */
|
||||
char const * presenterdocument_get_property(PresenterDocument * document,
|
||||
char const * property)
|
||||
{
|
||||
return config_get(document->config, NULL, property);
|
||||
}
|
||||
|
||||
|
||||
/* presenterdocument_get_slide_property */
|
||||
char const * presenterdocument_get_slide_property(PresenterDocument * document,
|
||||
unsigned int slide, char const * property)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Slide %u", slide);
|
||||
return config_get(document->config, buf, property);
|
||||
}
|
||||
|
||||
|
||||
/* useful */
|
||||
/* presenterdocument_save */
|
||||
int presenterdocument_save(PresenterDocument * document)
|
||||
{
|
||||
return config_save(document->config, document->filename);
|
||||
}
|
||||
|
||||
|
||||
/* presenterdocument_save_as */
|
||||
int presenterdocument_save_as(PresenterDocument * document,
|
||||
char const * filename)
|
||||
{
|
||||
String * p;
|
||||
|
||||
if((p = string_new(filename)) == NULL)
|
||||
return -1;
|
||||
if(config_save(document->config, filename) != 0)
|
||||
{
|
||||
string_delete(p);
|
||||
return -1;
|
||||
}
|
||||
free(document->filename);
|
||||
document->filename = p;
|
||||
return 0;
|
||||
}
|
47
src/document.h
Normal file
47
src/document.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef PRESENTER_DOCUMENT_H
|
||||
# define PRESENTER_DOCUMENT_H
|
||||
|
||||
# include "Presenter/presenter.h"
|
||||
# include "slide.h"
|
||||
|
||||
|
||||
/* public */
|
||||
/* types */
|
||||
typedef struct _PresenterDocument PresenterDocument;
|
||||
|
||||
|
||||
/* functions */
|
||||
/* essential */
|
||||
PresenterDocument * presenterdocument_new(char const * filename);
|
||||
void presenterdocument_delete(PresenterDocument * document);
|
||||
|
||||
/* accessors */
|
||||
char const * presenterdocument_get_filename(PresenterDocument * document);
|
||||
|
||||
char const * presenterdocument_get_property(PresenterDocument * document,
|
||||
char const * property);
|
||||
char const * presenterdocument_get_slide_property(PresenterDocument * document,
|
||||
unsigned int slide, char const * property);
|
||||
|
||||
/* useful */
|
||||
int presenterdocument_save(PresenterDocument * document);
|
||||
int presenterdocument_save_as(PresenterDocument * document,
|
||||
char const * filename);
|
||||
|
||||
#endif /* !PRESENTER_DOCUMENT_H */
|
233
src/presenter.c
233
src/presenter.c
|
@ -1,6 +1,6 @@
|
|||
/* $Id$ */
|
||||
static char const _copyright[] =
|
||||
"Copyright © 2013 Pierre Pronchery <khorben@defora.org>";
|
||||
"Copyright © 2013-2014 Pierre Pronchery <khorben@defora.org>";
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
static char const _license[] =
|
||||
"This program is free software: you can redistribute it and/or modify\n"
|
||||
|
@ -16,30 +16,69 @@ static char const _license[] =
|
|||
"along with this program. If not, see <http://www.gnu.org/licenses/>.\n";
|
||||
|
||||
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <System.h>
|
||||
#include <Desktop.h>
|
||||
#include "document.h"
|
||||
#include "presenter.h"
|
||||
#include "../config.h"
|
||||
#define _(string) gettext(string)
|
||||
#define N_(string) (string)
|
||||
|
||||
/* constants */
|
||||
#ifndef PROGNAME
|
||||
# define PROGNAME "presenter"
|
||||
#endif
|
||||
#ifndef PREFIX
|
||||
# define PREFIX "/usr/local"
|
||||
#endif
|
||||
#ifndef LIBDIR
|
||||
# define LIBDIR PREFIX "/lib"
|
||||
#endif
|
||||
#ifndef PLUGINDIR
|
||||
# define PLUGINDIR LIBDIR "/" PACKAGE
|
||||
#endif
|
||||
#ifndef SLIDESDIR
|
||||
# define SLIDESDIR PLUGINDIR "/slides"
|
||||
#endif
|
||||
|
||||
|
||||
/* Presenter */
|
||||
/* private */
|
||||
/* types */
|
||||
struct _PresenterSlidePlugin
|
||||
{
|
||||
String * type;
|
||||
Plugin * plugin;
|
||||
PresenterSlideDefinition * definition;
|
||||
PresenterSlidePlugin * slide;
|
||||
};
|
||||
|
||||
struct _Presenter
|
||||
{
|
||||
char * filename;
|
||||
PresenterDocument * document;
|
||||
|
||||
/* preferences */
|
||||
Config * config;
|
||||
int monitor;
|
||||
|
||||
/* slides */
|
||||
PresenterSlideHelper s_helper;
|
||||
PresenterSlidePlugin * s_plugins;
|
||||
size_t s_plugins_cnt;
|
||||
|
||||
/* internal */
|
||||
guint source;
|
||||
|
||||
/* widgets */
|
||||
GtkWidget * window;
|
||||
GtkWidget * view;
|
||||
|
@ -83,6 +122,7 @@ static void _presenter_on_contents(gpointer data);
|
|||
static void _presenter_on_copy(gpointer data);
|
||||
static void _presenter_on_cut(gpointer data);
|
||||
static void _presenter_on_find(gpointer data);
|
||||
static gboolean _presenter_on_idle(gpointer data);
|
||||
static void _presenter_on_insert_file(gpointer data);
|
||||
static void _presenter_on_new(gpointer data);
|
||||
static void _presenter_on_open(gpointer data);
|
||||
|
@ -276,20 +316,30 @@ Presenter * presenter_new(void)
|
|||
GtkAccelGroup * group;
|
||||
GtkWidget * vbox;
|
||||
GtkWidget * widget;
|
||||
const GdkColor black = { 0x0, 0x0000, 0x0000, 0x0000 };
|
||||
const GdkColor white = { 0x0, 0xffff, 0xffff, 0xffff };
|
||||
|
||||
if((presenter = object_new(sizeof(*presenter))) == NULL)
|
||||
return NULL;
|
||||
presenter->filename = NULL;
|
||||
presenter->document = presenterdocument_new(NULL);
|
||||
presenter->config = config_new();
|
||||
presenter->window = NULL;
|
||||
/* check for errors */
|
||||
if(presenter->config == NULL)
|
||||
if(presenter->document == NULL || presenter->config == NULL)
|
||||
{
|
||||
object_delete(presenter);
|
||||
return NULL;
|
||||
}
|
||||
/* FIXME load the configuration */
|
||||
presenter->monitor = -1;
|
||||
/* slides */
|
||||
presenter->s_helper.presenter = presenter;
|
||||
presenter->s_helper.background = black;
|
||||
presenter->s_helper.foreground = white;
|
||||
presenter->s_plugins = NULL;
|
||||
presenter->s_plugins_cnt = 0;
|
||||
/* internal */
|
||||
presenter->source = 0;
|
||||
/* widgets */
|
||||
group = gtk_accel_group_new();
|
||||
/* window */
|
||||
|
@ -349,16 +399,18 @@ Presenter * presenter_new(void)
|
|||
presenter->pr_window = NULL;
|
||||
/* slideshow */
|
||||
presenter->sl_window = NULL;
|
||||
presenter->source = g_idle_add(_presenter_on_idle, presenter);
|
||||
return presenter;
|
||||
}
|
||||
|
||||
static void _new_set_title(Presenter * presenter)
|
||||
{
|
||||
char const * filename;
|
||||
char buf[256];
|
||||
|
||||
filename = presenterdocument_get_filename(presenter->document);
|
||||
snprintf(buf, sizeof(buf), "%s%s", _("Presenter - "),
|
||||
(presenter->filename == NULL) ? _("(Untitled)")
|
||||
: presenter->filename);
|
||||
(filename == NULL) ? _("(Untitled)") : filename);
|
||||
gtk_window_set_title(GTK_WINDOW(presenter->window), buf);
|
||||
}
|
||||
|
||||
|
@ -366,6 +418,21 @@ static void _new_set_title(Presenter * presenter)
|
|||
/* presenter_delete */
|
||||
void presenter_delete(Presenter * presenter)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* internal */
|
||||
if(presenter->source != 0)
|
||||
g_source_remove(presenter->source);
|
||||
/* slides */
|
||||
for(i = 0; i < presenter->s_plugins_cnt; i++)
|
||||
{
|
||||
presenter->s_plugins[i].definition->destroy(
|
||||
presenter->s_plugins[i].slide);
|
||||
plugin_delete(presenter->s_plugins[i].plugin);
|
||||
string_delete(presenter->s_plugins[i].type);
|
||||
}
|
||||
free(presenter->s_plugins);
|
||||
/* widgets */
|
||||
if(presenter->window != NULL)
|
||||
gtk_widget_destroy(presenter->window);
|
||||
if(presenter->config != NULL)
|
||||
|
@ -485,8 +552,12 @@ int presenter_confirm(Presenter * presenter, char const * message, ...)
|
|||
|
||||
|
||||
/* presenter_error */
|
||||
static int _error_text(char const * message, int ret);
|
||||
|
||||
int presenter_error(Presenter * presenter, char const * message, int ret)
|
||||
{
|
||||
if(presenter == NULL)
|
||||
return _error_text(message, ret);
|
||||
#if GTK_CHECK_VERSION(2, 18, 0)
|
||||
gtk_label_set_text(GTK_LABEL(presenter->infobar_label), message);
|
||||
gtk_widget_show(presenter->infobar);
|
||||
|
@ -509,14 +580,25 @@ int presenter_error(Presenter * presenter, char const * message, int ret)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int _error_text(char const * message, int ret)
|
||||
{
|
||||
fprintf(stderr, "%s: %s\n", PROGNAME, message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* presenter_open */
|
||||
int presenter_open(Presenter * presenter, char const * filename)
|
||||
{
|
||||
PresenterDocument * document;
|
||||
|
||||
if(filename == NULL)
|
||||
return presenter_open_dialog(presenter);
|
||||
/* FIXME implement */
|
||||
return -1;
|
||||
if((document = presenterdocument_new(filename)) == NULL)
|
||||
return -presenter_error(presenter, error_get(), 1);
|
||||
presenter_close(presenter);
|
||||
presenter->document = document;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -556,10 +638,12 @@ int presenter_open_dialog(Presenter * presenter)
|
|||
/* presenter_save */
|
||||
int presenter_save(Presenter * presenter)
|
||||
{
|
||||
if(presenter->filename == NULL)
|
||||
char const * filename;
|
||||
|
||||
if((filename = presenterdocument_get_filename(presenter->document))
|
||||
== NULL)
|
||||
return presenter_save_as_dialog(presenter);
|
||||
/* FIXME implement */
|
||||
return -1;
|
||||
return presenterdocument_save(presenter->document);
|
||||
}
|
||||
|
||||
|
||||
|
@ -568,8 +652,7 @@ int presenter_save_as(Presenter * presenter, char const * filename)
|
|||
{
|
||||
if(filename == NULL)
|
||||
return presenter_save_as_dialog(presenter);
|
||||
/* FIXME implement */
|
||||
return -1;
|
||||
return presenterdocument_save_as(presenter->document, filename);
|
||||
}
|
||||
|
||||
|
||||
|
@ -808,6 +891,8 @@ static void _properties_on_response(GtkWidget * widget, gint response,
|
|||
/* useful */
|
||||
/* presenter_present */
|
||||
static void _present_window(Presenter * presenter);
|
||||
static PresenterSlidePlugin * _present_window_slide_plugin(
|
||||
Presenter * presenter, char const * type);
|
||||
|
||||
static void _presenter_present(Presenter * presenter)
|
||||
{
|
||||
|
@ -834,10 +919,14 @@ static void _present_window(Presenter * presenter)
|
|||
{
|
||||
PangoFontDescription * font;
|
||||
GtkAccelGroup * group;
|
||||
GdkColor black = { 0x0, 0x0000, 0x0000, 0x0000 };
|
||||
GdkColor white = { 0x0, 0xffff, 0xffff, 0xffff };
|
||||
GtkWidget * vbox;
|
||||
GtkToolItem * toolitem;
|
||||
#if 1
|
||||
const char const * slides[] = { "title", "embed" };
|
||||
size_t i;
|
||||
PresenterSlidePlugin * sp;
|
||||
GtkWidget * widget;
|
||||
#endif
|
||||
|
||||
/* font */
|
||||
font = pango_font_description_new();
|
||||
|
@ -850,7 +939,8 @@ static void _present_window(Presenter * presenter)
|
|||
desktop_accel_create(_presenter_accel_slideshow, presenter, group);
|
||||
g_object_unref(group);
|
||||
gtk_window_set_keep_above(GTK_WINDOW(presenter->sl_window), TRUE);
|
||||
gtk_widget_modify_bg(presenter->sl_window, GTK_STATE_NORMAL, &black);
|
||||
gtk_widget_modify_bg(presenter->sl_window, GTK_STATE_NORMAL,
|
||||
&presenter->s_helper.background);
|
||||
g_signal_connect_swapped(presenter->sl_window, "delete-event",
|
||||
G_CALLBACK(_presenter_on_slideshow_closex), presenter);
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
|
@ -872,6 +962,21 @@ static void _present_window(Presenter * presenter)
|
|||
gtk_toolbar_insert(GTK_TOOLBAR(presenter->sl_toolbar), toolitem, -1);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), presenter->sl_toolbar, FALSE, TRUE,
|
||||
0);
|
||||
#if 1
|
||||
/* slides */
|
||||
for(i = 0; i < sizeof(slides) / sizeof(*slides); i++)
|
||||
{
|
||||
if((sp = _present_window_slide_plugin(presenter, slides[i]))
|
||||
== NULL)
|
||||
/* XXX report error */
|
||||
break;
|
||||
if((widget = sp->definition->get_widget(sp->slide, NULL))
|
||||
== NULL)
|
||||
/* XXX report error */
|
||||
break;
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
|
||||
}
|
||||
#else
|
||||
/* title */
|
||||
/* FIXME really implement */
|
||||
presenter->sl_title = gtk_label_new("<Insert title here>");
|
||||
|
@ -879,11 +984,96 @@ static void _present_window(Presenter * presenter)
|
|||
gtk_widget_modify_font(presenter->sl_title, font);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), presenter->sl_title, FALSE, TRUE,
|
||||
0);
|
||||
#endif
|
||||
gtk_container_add(GTK_CONTAINER(presenter->sl_window), vbox);
|
||||
gtk_widget_show_all(vbox);
|
||||
pango_font_description_free(font);
|
||||
}
|
||||
|
||||
static PresenterSlidePlugin * _present_window_slide_plugin(
|
||||
Presenter * presenter, char const * type)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if(presenter_slide_load(presenter, type) != 0)
|
||||
return NULL;
|
||||
/* XXX optimize (don't look for the proper type twice) */
|
||||
for(i = 0; i < presenter->s_plugins_cnt; i++)
|
||||
if(strcmp(presenter->s_plugins[i].type, type) == 0)
|
||||
return &presenter->s_plugins[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* presenter_slide_load */
|
||||
int presenter_slide_load(Presenter * presenter, char const * type)
|
||||
{
|
||||
size_t i;
|
||||
PresenterSlidePlugin * q;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, type);
|
||||
#endif
|
||||
for(i = 0; i < presenter->s_plugins_cnt; i++)
|
||||
if(strcmp(presenter->s_plugins[i].type, type) == 0)
|
||||
/* this plug-in was already loaded */
|
||||
return 0;
|
||||
if((q = realloc(presenter->s_plugins, sizeof(*q)
|
||||
* (presenter->s_plugins_cnt + 1)))
|
||||
== NULL)
|
||||
return -presenter_error(NULL, strerror(errno), 1);
|
||||
presenter->s_plugins = q;
|
||||
q = &presenter->s_plugins[presenter->s_plugins_cnt];
|
||||
if((q->plugin = plugin_new(LIBDIR, PACKAGE, "slides", type)) == NULL)
|
||||
return -presenter_error(NULL, error_get(), 1);
|
||||
if((q->type = string_new(type)) == NULL
|
||||
|| (q->definition = plugin_lookup(q->plugin, "slide"))
|
||||
== NULL
|
||||
|| q->definition->init == NULL
|
||||
|| q->definition->destroy == NULL
|
||||
|| (q->slide = q->definition->init(
|
||||
&presenter->s_helper)) == NULL)
|
||||
{
|
||||
/* FIXME the error may not have been set */
|
||||
string_delete(q->type);
|
||||
plugin_delete(q->plugin);
|
||||
return -presenter_error(NULL, error_get(), 1);
|
||||
}
|
||||
presenter->s_plugins_cnt++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* presenter_slide_load_all */
|
||||
int presenter_slide_load_all(Presenter * presenter)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef __APPLE__
|
||||
const char ext[] = ".dylib";
|
||||
#else
|
||||
const char ext[] = ".so";
|
||||
#endif
|
||||
DIR * dir;
|
||||
struct dirent * de;
|
||||
size_t len;
|
||||
|
||||
if((dir = opendir(SLIDESDIR)) == NULL)
|
||||
return -presenter_error(NULL, strerror(errno), 1);
|
||||
while((de = readdir(dir)) != NULL)
|
||||
{
|
||||
if(de->d_name[0] == '.'
|
||||
|| (len = strlen(de->d_name)) < sizeof(ext)
|
||||
|| strncmp(&de->d_name[len - sizeof(ext) + 1],
|
||||
ext, sizeof(ext)) != 0)
|
||||
continue;
|
||||
de->d_name[len - sizeof(ext) + 1] = '\0';
|
||||
if(presenter_slide_load(presenter, de->d_name) != 0)
|
||||
ret = -1;
|
||||
}
|
||||
closedir(dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* callbacks */
|
||||
/* presenter_on_about */
|
||||
|
@ -942,6 +1132,17 @@ static void _presenter_on_find(gpointer data)
|
|||
}
|
||||
|
||||
|
||||
/* presenter_on_idle */
|
||||
static gboolean _presenter_on_idle(gpointer data)
|
||||
{
|
||||
Presenter * presenter = data;
|
||||
|
||||
presenter->source = 0;
|
||||
presenter_slide_load_all(presenter);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* presenter_on_insert_file */
|
||||
static void _presenter_on_insert_file(gpointer data)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2013-2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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
|
||||
|
@ -17,12 +17,10 @@
|
|||
#ifndef PRESENTER_PRESENTER_H
|
||||
# define PRESENTER_PRESENTER_H
|
||||
|
||||
# include "Presenter.h"
|
||||
|
||||
|
||||
/* public */
|
||||
/* types */
|
||||
typedef struct _Presenter Presenter;
|
||||
|
||||
|
||||
/* functions */
|
||||
/* essential */
|
||||
Presenter * presenter_new(void);
|
||||
|
@ -42,4 +40,8 @@ int presenter_save(Presenter * presenter);
|
|||
int presenter_save_as(Presenter * presenter, char const * filename);
|
||||
int presenter_save_as_dialog(Presenter * presenter);
|
||||
|
||||
/* slide plug-ins */
|
||||
int presenter_slide_load(Presenter * presenter, char const * type);
|
||||
int presenter_slide_load_all(Presenter * presenter);
|
||||
|
||||
#endif /* !PRESENTER_PRESENTER_H */
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
subdirs=slides
|
||||
targets=presenter
|
||||
cppflags_force=-I ../include
|
||||
#cppflags=-DEMBEDDED
|
||||
cflags_force=-W `pkg-config --cflags libDesktop`
|
||||
cflags=-Wall -g -O2
|
||||
ldflags_force=`pkg-config --libs libDesktop`
|
||||
dist=Makefile,presenter.h
|
||||
dist=Makefile,document.h,presenter.h,slide.h
|
||||
|
||||
[presenter]
|
||||
type=binary
|
||||
sources=presenter.c,main.c
|
||||
sources=document.c,presenter.c,slide.c,main.c
|
||||
install=$(BINDIR)
|
||||
|
||||
[document.c]
|
||||
depends=document.h,slide.h,../config.h
|
||||
|
||||
[main.c]
|
||||
depends=presenter.h,../config.h
|
||||
|
||||
[presenter.c]
|
||||
depends=presenter.h,../config.h
|
||||
depends=document.h,presenter.h,slide.h,../config.h
|
||||
cppflags=-D PREFIX=\"$(PREFIX)\"
|
||||
|
||||
[presenter.c]
|
||||
depends=presenter.h,../config.h
|
||||
[slide.c]
|
||||
depends=slide.h,../config.h
|
||||
|
|
1
src/slide.c
Normal file
1
src/slide.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "slide.h"
|
35
src/slide.h
Normal file
35
src/slide.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef PRESENTER_SLIDE_H
|
||||
# define PRESENTER_SLIDE_H
|
||||
|
||||
# include "Presenter/presenter.h"
|
||||
# include "Presenter/slide.h"
|
||||
|
||||
|
||||
/* public */
|
||||
/* types */
|
||||
|
||||
|
||||
/* functions */
|
||||
/* essential */
|
||||
PresenterSlide * presenterslide_new(void);
|
||||
void presenterslide_delete(PresenterSlide * slide);
|
||||
|
||||
/* accessors */
|
||||
|
||||
#endif /* !PRESENTER_SLIDE_H */
|
58
src/slides/Makefile
Normal file
58
src/slides/Makefile
Normal file
|
@ -0,0 +1,58 @@
|
|||
TARGETS = embed.so title.so
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
CC = cc
|
||||
CPPFLAGSF= -I ../../include
|
||||
CPPFLAGS=
|
||||
CFLAGSF = -W `pkg-config --cflags libDesktop`
|
||||
CFLAGS = -Wall -g -O2 -pedantic -fPIC
|
||||
LDFLAGSF= -W `pkg-config --libs libDesktop`
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
CCSHARED= $(CC) -shared
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
embed_OBJS = embed.o
|
||||
embed_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
embed_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
|
||||
embed.so: $(embed_OBJS)
|
||||
$(CCSHARED) -o embed.so $(embed_OBJS) $(embed_LDFLAGS)
|
||||
|
||||
title_OBJS = title.o
|
||||
title_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
title_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
|
||||
title.so: $(title_OBJS)
|
||||
$(CCSHARED) -o title.so $(title_OBJS) $(title_LDFLAGS)
|
||||
|
||||
embed.o: embed.c
|
||||
$(CC) $(embed_CFLAGS) -c embed.c
|
||||
|
||||
title.o: title.c
|
||||
$(CC) $(title_CFLAGS) -c title.c
|
||||
|
||||
clean:
|
||||
$(RM) -- $(embed_OBJS) $(title_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/Presenter/slides
|
||||
$(INSTALL) -m 0644 embed.so $(DESTDIR)$(LIBDIR)/Presenter/slides/embed.so
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/Presenter/slides
|
||||
$(INSTALL) -m 0644 title.so $(DESTDIR)$(LIBDIR)/Presenter/slides/title.so
|
||||
|
||||
uninstall:
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/Presenter/slides/embed.so
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/Presenter/slides/title.so
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
101
src/slides/embed.c
Normal file
101
src/slides/embed.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <System.h>
|
||||
#include "Presenter/slide.h"
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
# include <gtk/gtkx.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Embed */
|
||||
/* private */
|
||||
/* types */
|
||||
typedef struct _PresenterSlidePlugin
|
||||
{
|
||||
PresenterSlideHelper * helper;
|
||||
} Embed;
|
||||
|
||||
|
||||
/* prototypes */
|
||||
/* plug-in */
|
||||
static Embed * _embed_init(PresenterSlideHelper * helper);
|
||||
static void _embed_destroy(Embed * embed);
|
||||
|
||||
static GtkWidget * _embed_get_widget(Embed * embed, PresenterSlide * slide);
|
||||
|
||||
|
||||
/* public */
|
||||
/* variables */
|
||||
PresenterSlideDefinition slide =
|
||||
{
|
||||
"Embed",
|
||||
NULL,
|
||||
NULL,
|
||||
_embed_init,
|
||||
_embed_destroy,
|
||||
_embed_get_widget
|
||||
};
|
||||
|
||||
|
||||
/* protected */
|
||||
/* functions */
|
||||
/* plug-in */
|
||||
/* embed_init */
|
||||
static Embed * _embed_init(PresenterSlideHelper * helper)
|
||||
{
|
||||
Embed * embed;
|
||||
|
||||
if((embed = object_new(sizeof(*embed))) == NULL)
|
||||
return NULL;
|
||||
/* initialization */
|
||||
embed->helper = helper;
|
||||
return embed;
|
||||
}
|
||||
|
||||
|
||||
/* embed_destroy */
|
||||
static void _embed_destroy(Embed * embed)
|
||||
{
|
||||
/* FIXME implement the rest */
|
||||
object_delete(embed);
|
||||
}
|
||||
|
||||
|
||||
/* embed_get_widget */
|
||||
static GtkWidget * _embed_get_widget(Embed * embed, PresenterSlide * slide)
|
||||
{
|
||||
GtkWidget * ret;
|
||||
GtkWidget * widget;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
|
||||
#else
|
||||
ret = gtk_vbox_new(FALSE, 4);
|
||||
#endif
|
||||
/* FIXME really implement */
|
||||
widget = gtk_label_new("<Insert title here>");
|
||||
gtk_widget_modify_fg(widget, GTK_STATE_NORMAL,
|
||||
&embed->helper->foreground);
|
||||
gtk_box_pack_start(GTK_BOX(ret), widget, FALSE, TRUE, 0);
|
||||
widget = gtk_socket_new();
|
||||
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL,
|
||||
&embed->helper->background);
|
||||
gtk_box_pack_start(GTK_BOX(ret), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all(ret);
|
||||
return ret;
|
||||
}
|
17
src/slides/project.conf
Normal file
17
src/slides/project.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
targets=embed,title
|
||||
cppflags_force=-I ../../include
|
||||
cppflags=
|
||||
cflags_force=-W `pkg-config --cflags libDesktop`
|
||||
cflags=-Wall -g -O2 -pedantic -fPIC
|
||||
ldflags_force=-W `pkg-config --libs libDesktop`
|
||||
dist=Makefile
|
||||
|
||||
[embed]
|
||||
type=plugin
|
||||
sources=embed.c
|
||||
install=$(LIBDIR)/Presenter/slides
|
||||
|
||||
[title]
|
||||
type=plugin
|
||||
sources=title.c
|
||||
install=$(LIBDIR)/Presenter/slides
|
94
src/slides/title.c
Normal file
94
src/slides/title.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Presenter */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <System.h>
|
||||
#include "Presenter/slide.h"
|
||||
|
||||
|
||||
/* Title */
|
||||
/* private */
|
||||
/* types */
|
||||
typedef struct _PresenterSlidePlugin
|
||||
{
|
||||
PresenterSlideHelper * helper;
|
||||
} Title;
|
||||
|
||||
|
||||
/* prototypes */
|
||||
/* plug-in */
|
||||
static Title * _title_init(PresenterSlideHelper * helper);
|
||||
static void _title_destroy(Title * title);
|
||||
|
||||
static GtkWidget * _title_get_widget(Title * title, PresenterSlide * slide);
|
||||
|
||||
|
||||
/* public */
|
||||
/* variables */
|
||||
PresenterSlideDefinition slide =
|
||||
{
|
||||
"Title",
|
||||
NULL,
|
||||
NULL,
|
||||
_title_init,
|
||||
_title_destroy,
|
||||
_title_get_widget
|
||||
};
|
||||
|
||||
|
||||
/* protected */
|
||||
/* functions */
|
||||
/* plug-in */
|
||||
/* title_init */
|
||||
static Title * _title_init(PresenterSlideHelper * helper)
|
||||
{
|
||||
Title * title;
|
||||
|
||||
if((title = object_new(sizeof(*title))) == NULL)
|
||||
return NULL;
|
||||
/* initialization */
|
||||
title->helper = helper;
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
/* title_destroy */
|
||||
static void _title_destroy(Title * title)
|
||||
{
|
||||
/* FIXME implement the rest (if necessary) */
|
||||
object_delete(title);
|
||||
}
|
||||
|
||||
|
||||
/* title_get_widget */
|
||||
static GtkWidget * _title_get_widget(Title * title, PresenterSlide * slide)
|
||||
{
|
||||
GtkWidget * ret;
|
||||
GtkWidget * widget;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
|
||||
#else
|
||||
ret = gtk_vbox_new(FALSE, 4);
|
||||
#endif
|
||||
/* FIXME really implement */
|
||||
widget = gtk_label_new("<Insert title here>");
|
||||
gtk_widget_modify_fg(widget, GTK_STATE_NORMAL,
|
||||
&title->helper->foreground);
|
||||
gtk_box_pack_start(GTK_BOX(ret), widget, FALSE, TRUE, 0);
|
||||
gtk_widget_show_all(ret);
|
||||
return ret;
|
||||
}
|
Loading…
Reference in New Issue
Block a user