* 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:
parent
91f74b0c02
commit
db90422897
@ -1,27 +1,21 @@
|
||||
SubDir HAIKU_TOP src add-ons translators rtf ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
# It's called RTF-Translator (with a dash) to differentiate it from the
|
||||
# RTFTranslator that comes with Gobe Productive (that doesn't support
|
||||
# STXT or plain text files output).
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
||||
|
||||
UsePrivateHeaders shared ;
|
||||
UsePrivateHeaders shared storage ;
|
||||
|
||||
Translator RTF-Translator :
|
||||
# RTFTranslator classes
|
||||
main.cpp
|
||||
RTFTranslator.cpp
|
||||
ConfigView.cpp
|
||||
RTF.cpp
|
||||
|
||||
convert.cpp
|
||||
RTF.cpp
|
||||
RTFTranslator.cpp
|
||||
|
||||
: be translation libtranslatorsutils.a $(TARGET_LIBSUPC++)
|
||||
: true
|
||||
;
|
||||
|
||||
Package haiku-translationkit-cvs :
|
||||
RTF-Translator
|
||||
: boot home config add-ons Translators
|
||||
;
|
||||
|
@ -1,28 +1,63 @@
|
||||
/*
|
||||
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Copyright 2004-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* 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 <string.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <FileIO.h>
|
||||
#include <TranslatorRoster.h>
|
||||
|
||||
#include "TranslatorWindow.h"
|
||||
|
||||
#include "convert.h"
|
||||
#include "RTF.h"
|
||||
#include "RTFTranslator.h"
|
||||
|
||||
|
||||
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");
|
||||
|
||||
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)
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user