* The RTF-Translator will now convert all command line arguments to plain text
to stdout (mostly for testing). * Removed no longer needed packaging jam rule. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,27 +1,21 @@
|
|||||||
SubDir HAIKU_TOP src add-ons translators rtf ;
|
SubDir HAIKU_TOP src add-ons translators rtf ;
|
||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
|
||||||
|
|
||||||
# It's called RTF-Translator (with a dash) to differentiate it from the
|
# It's called RTF-Translator (with a dash) to differentiate it from the
|
||||||
# RTFTranslator that comes with Gobe Productive (that doesn't support
|
# RTFTranslator that comes with Gobe Productive (that doesn't support
|
||||||
# STXT or plain text files output).
|
# STXT or plain text files output).
|
||||||
|
|
||||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
||||||
|
|
||||||
UsePrivateHeaders shared ;
|
UsePrivateHeaders shared storage ;
|
||||||
|
|
||||||
Translator RTF-Translator :
|
Translator RTF-Translator :
|
||||||
# RTFTranslator classes
|
|
||||||
main.cpp
|
main.cpp
|
||||||
RTFTranslator.cpp
|
|
||||||
ConfigView.cpp
|
ConfigView.cpp
|
||||||
RTF.cpp
|
|
||||||
convert.cpp
|
convert.cpp
|
||||||
|
RTF.cpp
|
||||||
|
RTFTranslator.cpp
|
||||||
|
|
||||||
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
||||||
: true
|
: true
|
||||||
;
|
;
|
||||||
|
|
||||||
Package haiku-translationkit-cvs :
|
|
||||||
RTF-Translator
|
|
||||||
: boot home config add-ons Translators
|
|
||||||
;
|
|
||||||
|
|||||||
@@ -1,28 +1,63 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "RTFTranslator.h"
|
|
||||||
#include "RTF.h"
|
|
||||||
|
|
||||||
#include "TranslatorWindow.h"
|
|
||||||
|
|
||||||
#include <TranslatorRoster.h>
|
|
||||||
#include <Application.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <FileIO.h>
|
||||||
|
#include <TranslatorRoster.h>
|
||||||
|
|
||||||
|
#include "TranslatorWindow.h"
|
||||||
|
|
||||||
|
#include "convert.h"
|
||||||
|
#include "RTF.h"
|
||||||
|
#include "RTFTranslator.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int /*argc*/, char **/*argv*/)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
if (argc > 1) {
|
||||||
|
// Convert input files to plain text directly
|
||||||
|
BFileIO output(stdout);
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
BFile input;
|
||||||
|
status_t status = input.SetTo(argv[i], B_READ_ONLY);
|
||||||
|
if (status != B_OK) {
|
||||||
|
fprintf(stderr, "Could not open file \"%s\": %s\n", argv[i],
|
||||||
|
strerror(status));
|
||||||
|
result = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
RTF::Parser parser(input);
|
||||||
|
RTF::Header header;
|
||||||
|
|
||||||
|
status = parser.Parse(header);
|
||||||
|
if (status != B_OK) {
|
||||||
|
fprintf(stderr, "Could not convert file \"%s\": %s\n", argv[i],
|
||||||
|
strerror(status));
|
||||||
|
result = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
convert_to_plain_text(header, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
BApplication app("application/x-vnd.Haiku-RTFTranslator");
|
BApplication app("application/x-vnd.Haiku-RTFTranslator");
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
result = LaunchTranslatorWindow(new RTFTranslator, "RTF Settings", BRect(0, 0, 225, 175));
|
result = LaunchTranslatorWindow(new RTFTranslator, "RTF Settings",
|
||||||
|
BRect(0, 0, 225, 175));
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user