Commit 690160a8 authored by Pierre Huyghebaert's avatar Pierre Huyghebaert

ajout cover tot later pierre h

parents b4daade4 0bbec0fe
Pipeline #313 failed with stages
<editorsettings description="osp" icon="lilypond.png">
<executable command="/Users/pierre/System/src/osp/baron/tolily-build-desktop/tolily" />
<imagefile extension=".pdf"/>
<empty-frame-text>
ici
</empty-frame-text>
<preamble>
</preamble>
<postamble></postamble>
</editorsettings>
File added
File added
This diff is collapsed.
---Generic Booklet (A4)
---
---It is said generic as it will try to determine
---automatically how to fit the booklet onto A4
---paper sheets, scaling pages if necessary.
---it is well suited for office documents for
---which you do not care too much about resulting
---imposition artefacts since it manages to save
---paper!
---
-- print("Booklet")
-- We output an A4 booklet
PageWidth = 595.27559
PageHeight = 841.88976
print("PageCount",PageCount)
-- We assume that H > W
-- Argh, we now can do better since we have "if" ;-)
-- Scale = PageHeight / (2*SourceWidth)
if(SourceWidth <= SourceHeight)
then
Scale = PageHeight / (2*SourceWidth)
rot = 90
xof = SourceHeight
yofRA = 0
yofRB = SourceWidth
yofVA = 0
yofVB = SourceWidth
else
Scale = PageHeight / (2*SourceHeight)
rot = 0
xof = 0;
yofRA = 0
yofRB = SourceHeight
yofVA = SourceHeight
yofVB = 0
end
do
rest = PageCount % 4
totp = PageCount
if rest ~= 0
then
totp = totp + ( 4 - rest)
end
inc = 0
count = 0
imax = totp/4
while count < imax
do
-- We assume that podofoimpose will discard invalid records
-- such as those with source page greater than PageCount
-- print(totp, inc, rot, xof,yofRA, yofRA, yofVA, yofVB)
-- Recto
PushRecord(totp - inc , inc + 1 , rot, xof , yofRA)
PushRecord(inc + 1 , inc + 1 , rot, xof , yofRB)
-- Verso
PushRecord(inc + 2 , inc + 2 , rot, xof , yofVA)
PushRecord(totp-(inc + 1) , inc + 2 , rot, xof, yofVB)
count = count + 1
inc = inc + 2
end
end
--- Brochure 8 poses
---
--- In8 provided by Ludi
---
-- print("PageCount",PageCount);
Scale = PageHeight / (4*SourceWidth)
xof = SourceHeight
yofRA = 0
yofRB = SourceWidth
yofVA = 0
yofVB = SourceWidth
rot1 = 90;
rot2 = 270;
tw = (PageHeight / 4) / Scale;
th = (PageWidth / 2) / Scale;
pgroup = 16;
do
rest = PageCount % 16
totp = PageCount
if rest ~= 0
then
totp = totp + ( 16 - rest)
end
inc = 0
count = 0
imax = totp/16
while count < imax
do
-- We assume that podofoimpose will discard invalid records
-- such as those with source page greater than PageCount
-- print(totp, inc, rot, xof,yofRA, yofRA, yofVA, yofVB)
-- Recto
PushRecord((pgroup*count)+9, (count*2)+1, rot2, 0, tw)
PushRecord((pgroup*count)+16, (count*2)+1, rot1, 2*th, 0)
PushRecord((pgroup*count)+13, (count*2)+1, rot1, 2*th, 3*tw)
PushRecord((pgroup*count)+12, (count*2)+1, rot2, 0, 4*tw)
PushRecord((pgroup*count)+1, (count*2)+1, rot1, 2*th, tw)
PushRecord((pgroup*count)+8, (count*2)+1, rot2, 0, 2*tw)
PushRecord((pgroup*count)+4, (count*2)+1, rot1, 2*th, 2*tw)
PushRecord((pgroup*count)+5, (count*2)+1, rot2, 0, 3*tw)
-- Verso
PushRecord((pgroup*count)+10, (count*2)+2, rot1, 2*th, 0)
PushRecord((pgroup*count)+15, (count*2)+2, rot2, 0, tw)
PushRecord((pgroup*count)+11, (count*2)+2, rot1, 2*th, 3*tw)
PushRecord((pgroup*count)+14, (count*2)+2, rot2, 0, 4*tw)
PushRecord((pgroup*count)+7, (count*2)+2, rot1, 2*th, tw)
PushRecord((pgroup*count)+2, (count*2)+2, rot2, 0, 2*tw)
PushRecord((pgroup*count)+6, (count*2)+2, rot1, 2*th, 2*tw)
PushRecord((pgroup*count)+3, (count*2)+2, rot2, 0, 3*tw)
count = count + 1
inc = inc + 8
end
end
try:
import scribus
except ImportError:
print "Unable to import the 'scribus' module. This script will only run within"
print "the Python interpreter embedded in Scribus. Try Script->Execute Script."
sys.exit(1)
lastName=""
for p in range(scribus.pageCount()):
if(p % 2 == 0):
scribus.gotoPage(p)
top,left,right,bottom = scribus.getPageNMargins(p)
pw, ph = scribus.getPageSize()
# print top, left, right, bottom
newName = scribus.createText(left, top, pw - (right + left), ph - (bottom + top))
if(len(lastName) > 0):
try:
scribus.linkTextFrames(lastName, newName)
except ScribusException:
print "CANT LINK", lastName, newName
lastName = newName
\ No newline at end of file
File added
File added
File added
#############################################################################
# Makefile for building: tolily
# Generated by qmake (2.01a) (Qt 4.7.0) on: Mon Jan 3 18:42:06 2011
# Project: tolily.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile tolily.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I.
LINK = g++
LFLAGS = -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp
OBJECTS = main.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
tolily.pro
QMAKE_TARGET = tolily
DESTDIR =
TARGET = tolily
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: tolily.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtCore.prl
$(QMAKE) -o Makefile tolily.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile tolily.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/tolily1.0.0 || $(MKDIR) .tmp/tolily1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/tolily1.0.0/ && $(COPY_FILE) --parents main.cpp .tmp/tolily1.0.0/ && (cd `dirname .tmp/tolily1.0.0` && $(TAR) tolily1.0.0.tar tolily1.0.0 && $(COMPRESS) tolily1.0.0.tar) && $(MOVE) `dirname .tmp/tolily1.0.0`/tolily1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/tolily1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
check: first
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
#include <QtCore/QCoreApplication>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include <QMap>
#include <QChar>
#include <QProcess>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString infilePath(a.arguments().at(1));
QString outfilePath(QString("blabla.tmpfile%1.ly" ).arg(qrand()));
// QFileInfo finfo(infilePath);
QString pdfFile(infilePath);
QFile infile(infilePath);
QFile outfile(outfilePath);
infile.open(QIODevice::ReadOnly);
outfile.open(QIODevice::WriteOnly);
QMap<QChar, QString> m;
m.insert('a', "a");
m.insert('b', "b");
m.insert('c', "c");
m.insert('d', "d");
m.insert('e', "e");
m.insert('f', "f");
m.insert('g', "g");
m.insert('h', "a'");
m.insert('i', "b'");
m.insert('j', "c'");
m.insert('k', "d'");
m.insert('l', "e'");
m.insert('m', "f'");
m.insert('n', "g'");
m.insert('o', "a''");
m.insert('p', "b''");
m.insert('q', "c''");
m.insert('r', "d''");
m.insert('s', "e''");
m.insert('t', "f''");
m.insert('u', "g''");
m.insert('v', "ais");
m.insert('w', "bes");
m.insert('x', "cis");
m.insert('y', "des");
m.insert('z', "eis");
QString s(infile.readAll());
QTextStream os(&outfile);
os << "\\version \"2.12.3\"\n";
os << "\\paper{\n";
os << " paper-width = 300\\pt\n";
os << " paper-height = 420\\pt\n";
os << " left-margin = 0\n";
os << " right-margin = 0\n";
os << " line-width = 300\\pt\n";
os << " indent = 0\n";
os << " top-margin = 0\n";
os << " page-top-space = 0\n";
os << " head-separation = 0\n";
os << " bottom-margin = 0\n";
os << " }\n";
os << "{\n";
int counter(0);
foreach(const QChar& c, s)
{
if(m.contains(c))
{
os << m.value(c) << " ";
}
if(counter == 8)
{
os << "\n";
counter = -1;
}
++counter;
}
os << "\n}\n";
os << "\\addlyrics {\n";
os << s ;
os << "\n}\n";
os.flush();
outfile.close();
outfile.open(QIODevice::ReadOnly);
qDebug()<<outfile.readAll();
QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
QStringList pArgs;
pArgs << "--verbose"<< "-o" << pdfFile << outfilePath;
qDebug()<<"lilypond"<< pArgs.join(" ");
proc.start("lilypond", pArgs);
if(proc.waitForStarted())
qDebug()<< "SUCCESSFULY STARTED!!!!!";
if(proc.waitForFinished())
qDebug()<< "SUCCESSFULY FINISHED!!!!!";
outfile.remove();
// return a.exec();
}
File added
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment