Ticket #6064: BaseTranslatorsLocalization.patch
File BaseTranslatorsLocalization.patch, 7.8 KB (added by , 14 years ago) |
---|
-
src/add-ons/translators/shared/TranslatorWindow.cpp
34 34 #include <GroupLayout.h> 35 35 #include "TranslatorWindow.h" 36 36 37 38 #undef B_TRANSLATE_CONTEXT 39 #define B_TRANSLATE_CONTEXT "TranslatorWindow" 40 41 37 42 // --------------------------------------------------------------- 38 43 // Constructor 39 44 // … … 56 61 // Do nothing for a non-layout window 57 62 } 58 63 64 59 65 // --------------------------------------------------------------- 60 66 // Destructor 61 67 // … … 74 80 be_app->PostMessage(B_QUIT_REQUESTED); 75 81 } 76 82 83 77 84 status_t 78 85 LaunchTranslatorWindow(BTranslator *translator, const char *title, BRect rect) 79 86 { 80 87 BView *view = NULL; 81 88 if (translator->MakeConfigurationView(NULL, &view, &rect)) { 82 BAlert *err = new BAlert( "Error",83 "Unable to create the view.", "OK");89 BAlert *err = new BAlert(B_TRANSLATE("Error"), 90 B_TRANSLATE("Unable to create the view."), B_TRANSLATE("OK")); 84 91 err->Go(); 85 92 return B_ERROR; 86 93 } -
src/add-ons/translators/shared/BaseTranslator.cpp
32 32 33 33 #include <string.h> 34 34 #include <stdio.h> 35 36 #include <Catalog.h> 37 #include <Locale.h> 38 35 39 #include "BaseTranslator.h" 36 40 41 #undef B_TRANSLATE_CONTEXT 42 #define B_TRANSLATE_CONTEXT "BaseTranslator" 43 44 37 45 // --------------------------------------------------------------- 38 46 // Constructor 39 47 // … … 53 61 int32 inCount, const translation_format *outFormats, int32 outCount, 54 62 const char *settingsFile, TranSetting *defaults, int32 defCount, 55 63 uint32 tranGroup, uint32 tranType) 56 : BTranslator() 64 : 65 BTranslator() 57 66 { 67 const char* _name = NULL; 68 const char* _info = NULL; 69 58 70 fSettings = new TranslatorSettings(settingsFile, defaults, defCount); 59 71 fSettings->LoadSettings(); 60 72 // load settings from the Base Translator settings file 61 73 62 74 fVersion = version; 63 fName = new char[strlen( name) + 1];64 strcpy(fName, name);65 fInfo = new char[strlen( info) + 41];66 sprintf(fInfo, "%s v%d.%d.%d %s", info,75 fName = new char[strlen(_name) + 1]; 76 strcpy(fName, _name); 77 fInfo = new char[strlen(_info) + 41]; 78 sprintf(fInfo, "%s v%d.%d.%d %s", _info, 67 79 static_cast<int>(B_TRANSLATION_MAJOR_VERSION(fVersion)), 68 80 static_cast<int>(B_TRANSLATION_MINOR_VERSION(fVersion)), 69 81 static_cast<int>(B_TRANSLATION_REVISION_VERSION(fVersion)), … … 77 89 fTranType = tranType; 78 90 } 79 91 92 80 93 // --------------------------------------------------------------- 81 94 // Destructor 82 95 // … … 100 113 delete[] fInfo; 101 114 } 102 115 116 103 117 // --------------------------------------------------------------- 104 118 // TranslatorName 105 119 // … … 119 133 return fName; 120 134 } 121 135 136 122 137 // --------------------------------------------------------------- 123 138 // TranslatorInfo 124 139 // … … 139 154 return fInfo; 140 155 } 141 156 157 142 158 // --------------------------------------------------------------- 143 159 // TranslatorVersion 144 160 // … … 159 175 return fVersion; 160 176 } 161 177 178 162 179 // --------------------------------------------------------------- 163 180 // InputFormats 164 181 // … … 184 201 return NULL; 185 202 } 186 203 204 187 205 // --------------------------------------------------------------- 188 206 // OutputFormats 189 207 // … … 209 227 return NULL; 210 228 } 211 229 230 212 231 // --------------------------------------------------------------- 213 232 // identify_bits_header 214 233 // … … 289 308 outInfo->group = B_TRANSLATOR_BITMAP; 290 309 outInfo->quality = 0.2; 291 310 outInfo->capability = 0.2; 292 strcpy(outInfo->name, "Be Bitmap Format");311 strcpy(outInfo->name, B_TRANSLATE("Be Bitmap Format")); 293 312 strcpy(outInfo->MIME, "image/x-be-bitmap"); 294 313 295 314 // Look for quality / capability info in fInputFormats … … 315 334 return B_OK; 316 335 } 317 336 337 318 338 // --------------------------------------------------------------- 319 339 // BitsCheck 320 340 // … … 386 406 return B_OK + 1; 387 407 } 388 408 409 389 410 status_t 390 411 BaseTranslator::BitsIdentify(BPositionIO *inSource, 391 412 const translation_format *inFormat, BMessage *ioExtension, … … 407 428 return result; 408 429 } 409 430 431 410 432 // --------------------------------------------------------------- 411 433 // Identify 412 434 // … … 460 482 } 461 483 } 462 484 485 463 486 // --------------------------------------------------------------- 464 487 // translate_from_bits_to_bits 465 488 // … … 539 562 return B_NO_TRANSLATOR; 540 563 } 541 564 565 542 566 status_t 543 567 BaseTranslator::BitsTranslate(BPositionIO *inSource, 544 568 const translator_info *inInfo, BMessage *ioExtension, uint32 outType, … … 556 580 return result; 557 581 } 558 582 583 559 584 // --------------------------------------------------------------- 560 585 // Translate 561 586 // … … 603 628 } 604 629 } 605 630 631 606 632 // returns the current translator settings into ioExtension 607 633 status_t 608 634 BaseTranslator::GetConfigurationMessage(BMessage *ioExtension) … … 610 636 return fSettings->GetConfigurationMessage(ioExtension); 611 637 } 612 638 639 613 640 // --------------------------------------------------------------- 614 641 // MakeConfigurationView 615 642 // … … 656 683 outExtent); 657 684 } 658 685 686 659 687 TranslatorSettings * 660 688 BaseTranslator::AcquireSettings() 661 689 { 662 690 return fSettings->Acquire(); 663 691 } 664 692 693 665 694 /////////////////////////////////////////////////////////// 666 695 // Functions to be implemented by derived classes 667 696 … … 673 702 return B_NO_TRANSLATOR; 674 703 } 675 704 705 676 706 status_t 677 707 BaseTranslator::DerivedTranslate(BPositionIO *inSource, 678 708 const translator_info *inInfo, BMessage *ioExtension, uint32 outType, … … 695 725 return NULL; 696 726 } 697 727 728 698 729 void 699 730 translate_direct_copy(BPositionIO *inSource, BPositionIO *outDestination) 700 731 { -
src/add-ons/translators/shared/Jamfile
7 7 StreamBuffer.cpp 8 8 TranslatorSettings.cpp 9 9 TranslatorWindow.cpp 10 ; 10 : $(HAIKU_LOCALE_LIBS) 11 ; 12 13 DoCatalogs libtranslatorsutils.a : 14 : 15 BaseTranslator.cpp 16 TranslatorWindow.cpp 17 ; -
src/add-ons/translators/shared/TranslatorWindow.h
33 33 #define TRANSLATORWINDOW_H 34 34 35 35 #include <Application.h> 36 #include < Window.h>37 #include < View.h>36 #include <Catalog.h> 37 #include <Locale.h> 38 38 #include <Rect.h> 39 39 #include <Translator.h> 40 #include <View.h> 41 #include <Window.h> 40 42 43 41 44 class TranslatorWindow : public BWindow { 42 45 public: 43 46 TranslatorWindow(BRect area, const char *title); … … 47 50 // Posts a quit message so that the application closes properly 48 51 }; 49 52 53 50 54 status_t 51 55 LaunchTranslatorWindow(BTranslator *translator, const char *title, 52 56 BRect rect = BRect(0, 0, 1, 1)); -
src/add-ons/translators/shared/BaseTranslator.h
33 33 #ifndef BASE_TRANSLATOR_H 34 34 #define BASE_TRANSLATOR_H 35 35 36 #include <ByteOrder.h> 37 #include <DataIO.h> 38 #include <GraphicsDefs.h> 39 #include <InterfaceDefs.h> 36 40 #include <Translator.h> 37 41 #include <TranslatorFormats.h> 38 42 #include <TranslationDefs.h> 39 #include <GraphicsDefs.h>40 #include <InterfaceDefs.h>41 #include <DataIO.h>42 #include <ByteOrder.h>43 43 #include <View.h> 44 44 #include "TranslatorSettings.h" 45 45