removed duplicate 'DataTranslations' application
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12521 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ecbc8ec9c2
commit
6c723eebfc
@ -21,6 +21,5 @@ SubInclude OBOS_TOP src prefs screensaver ;
|
||||
SubInclude OBOS_TOP src prefs scrollbar ;
|
||||
SubInclude OBOS_TOP src prefs sounds ;
|
||||
SubInclude OBOS_TOP src prefs time ;
|
||||
#SubInclude OBOS_TOP src prefs translation ;
|
||||
SubInclude OBOS_TOP src prefs virtualmemory ;
|
||||
SubInclude OBOS_TOP src prefs workspaces ;
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#define DRAG_TO_TRACKER 'drat'
|
||||
|
||||
#endif
|
@ -1,88 +0,0 @@
|
||||
|
||||
resource(101, "BEOS:L:STD_ICON") #'ICON' array
|
||||
{
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000232323230000FFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00232320202020232300FFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002320ACACACAC202300FFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002320ACAC3FACAC20232300FF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002320AC3F3FACAC20232300FF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002320ACACACACAC20232300FF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002320ACACACAC2020232300FF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000020202020232300FFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF003F7B7B7B7B7B7B7B7B0023232323232300FFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF002B3F7B7B7B7B7B7B7B002323232300000F0FFF"
|
||||
$"FFFFFFFFFFFF00FFFFFFFFFF002B2B007B7B7B7B7B7B00000000000F0F0F0F0F"
|
||||
$"FFFFFFFFFF00F90000FFFFFFFF00007B7B7B7B3F7B7B000F0F0F00000F0F0FFF"
|
||||
$"FFFFFFFF00F9F9F9F90000FFFF007B7B7B7B2F2B3F7B000F0F007B7B00FFFFFF"
|
||||
$"FFFFFF00F9F9F9F9F9F9F900007B7B7B7B2F2F2B2B3F000F0F00DA7B7B00FFFF"
|
||||
$"FFFF00F9F9F9F9F9F9F9F9F9F9007B7B2F2F2F002B2B290F002B2CDA7B00FFFF"
|
||||
$"FF00F9F9F9F9F9F9F9F9F9F95D007B2F2F2F000F002B290F002B2F2F00FFFFFF"
|
||||
$"00FAF9F9F9F9F9F9F9F9F95D5D002F2F2F000F0FFF0000002B2CEB2F00FFFFFF"
|
||||
$"00FAFAFAF9F9F9F9F9F95D5D5D002F2F000F0FFFFFFFFF002B2F2F00FFFFFFFF"
|
||||
$"00FAFAFAFAFAF9F9F95D5D5D5D0000000F0FFFFFFFFF002B2CEB2F00FFFFFFFF"
|
||||
$"00FAFAFAFAFAFAFA5D5D5D5D5D00FFFF000000FFFFFF002B2F2F00FFFFFFFFFF"
|
||||
$"00FAFAFAFAFAFAFA5D5D5D5D5D000F007B7B7B00FF002B2CEB2F00FFFFFFFFFF"
|
||||
$"00FAFAFAFAFAFAFA5D5D5D5D5D00007B7B7BDA00FF002B2F2F00FFFFFFFFFFFF"
|
||||
$"00FAFAFAFAFAFAFA5D5D5D5D5D00002B2CDA7B7B002B2CEB2F00FFFFFFFFFFFF"
|
||||
$"00FAFAFAFAFAFAFA5D5D5D5D000E0E002B2CDA7B2B2CEB2F00FFFFFFFFFFFFFF"
|
||||
$"0000FAFAFAFAFAFA5D5D5D000E0E0E002B2CDA7B2B2CEB2F00FFFFFFFFFFFFFF"
|
||||
$"FFFF0000FAFAFAFA5D5D000E0E0EFFFF002B2C2B2B2F2F00FFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFF0000FAFA5D000E0E0EFFFFFF002B2C2B2B2F2F00FFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFF0000000F0F0FFFFFFFFFFF002B2CEB2F00FFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002B2CEB2F00FFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF002B2F000E0F0F0F0F0F0F0F0F0F"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000E0F0F0F0F0F0F0F0F0F0F"
|
||||
};
|
||||
|
||||
resource(101, "BEOS:M:STD_ICON") #'MICN' array
|
||||
{
|
||||
$"FFFFFFFFFFFFFFFFFFFFFF000000FFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFF0023232300FF"
|
||||
$"FFFFFFFFFFFFFFFFFF00233FAC202300"
|
||||
$"FFFFFFFFFFFFFFFFFF0023ACAC202300"
|
||||
$"FFFFFFFFFF0000000000022020202300"
|
||||
$"FFFFFF00FF337B7B7B7B0023232300FF"
|
||||
$"FFFF00F90000007B7B7B00000000FFFF"
|
||||
$"FF00F9F9F9F9F77B2F7B000F007B00FF"
|
||||
$"00F9F9F9F9F9982F0033290F002F00FF"
|
||||
$"00FAFAF9F9989800000FFF002F00FFFF"
|
||||
$"00FAFAFA9898980000FF00002F00FFFF"
|
||||
$"00FAFAFA989898002B00002F00FFFFFF"
|
||||
$"00FAFAFA989800002B7B2CEB00FFFFFF"
|
||||
$"FF00D7FA98000E0E002B2F00FFFFFFFF"
|
||||
$"FFFFFF00000E0EFF002B2F00FFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFF00000E0F0F0F0F"
|
||||
};
|
||||
|
||||
resource(1, "BEOS:FILE_TYPES") message;
|
||||
|
||||
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Be-prefs-translations";
|
||||
|
||||
resource(1, "BEOS:APP_VERSION") #'APPV' array
|
||||
{
|
||||
$"0100000000000000000000000000000001000000312E302E3064310000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"00000000000000000000000000000000000000004F70656E42654F5320312E30"
|
||||
$"2C20C2A92032303031204F70656E42654F532E20416C6C205269676874732052"
|
||||
$"657365727665642E000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000050000000000000001000000"
|
||||
$"050000000100000052352E302E31000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"000000000000000042654F5320352E302E3120C2A9313939312D323030302042"
|
||||
$"6520496E636F72706F7261746564000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
$"0000000000000000"
|
||||
};
|
||||
|
||||
resource(1, "BEOS:APP_FLAGS") #'APPF' $"00000000";
|
@ -1,10 +0,0 @@
|
||||
SubDir OBOS_TOP src prefs translation ;
|
||||
|
||||
AddResources DataTranslations2 : DataTranslations.FileTypes.rdef ;
|
||||
|
||||
Preference DataTranslations2 :
|
||||
LView.cpp
|
||||
transwin.cpp
|
||||
datatrans.cpp ;
|
||||
|
||||
LinkSharedOSLibs DataTranslations2 : be libtranslation.so ;
|
@ -1,42 +0,0 @@
|
||||
#include "LView.h"
|
||||
#include "Common.h"
|
||||
|
||||
#ifndef _APPLICATION_H
|
||||
#include <Application.h>
|
||||
#endif
|
||||
|
||||
LView::LView(BRect rect, const char *name, list_view_type type = B_SINGLE_SELECTION_LIST) :
|
||||
BListView(rect, name, B_SINGLE_SELECTION_LIST) {
|
||||
|
||||
message_from_tracker = NULL;
|
||||
messagerunner = NULL;
|
||||
SetViewColor(217,217,217);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LView::MessageReceived(BMessage *message) {
|
||||
|
||||
uint32 type;
|
||||
int32 count;
|
||||
|
||||
switch (message->what) {
|
||||
case B_SIMPLE_DATA:
|
||||
message->GetInfo("refs", &type, &count);
|
||||
if ( count>0 && type == B_REF_TYPE )
|
||||
{
|
||||
message->what = B_REFS_RECEIVED;
|
||||
be_app->PostMessage(message);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LView::~LView()
|
||||
{
|
||||
if (messagerunner != NULL) delete messagerunner;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#ifndef LVIEW_H
|
||||
#define LVIEW_H
|
||||
|
||||
#include <interface/View.h>
|
||||
#include <interface/ListView.h>
|
||||
#include <app/MessageRunner.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class LView : public BListView {
|
||||
public:
|
||||
LView(BRect rect,
|
||||
const char *name, list_view_type type = B_SINGLE_SELECTION_LIST );
|
||||
|
||||
~LView();
|
||||
void MessageReceived(BMessage *message);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
const BMessage *message_from_tracker;
|
||||
|
||||
BMessageRunner *messagerunner;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,159 +0,0 @@
|
||||
/**
|
||||
* DataTranslations2
|
||||
*
|
||||
* This is to become the OBOS-replacement for the original BeOS
|
||||
* DataTranslations Preferences App. This App is not doing a lot,
|
||||
* basically it just shows all installed Translators, and helps you
|
||||
* installing new ones. (Drag em on the ListBox; Drop; done)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Alert.h>
|
||||
|
||||
|
||||
#ifndef _APPLICATION_H
|
||||
#include <Application.h>
|
||||
#endif
|
||||
|
||||
#ifndef DATATRANS_H
|
||||
#include "datatrans.h"
|
||||
#endif
|
||||
|
||||
#ifndef TRANS_WIN_H
|
||||
#include "transwin.h"
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
DATApp myApplication;
|
||||
|
||||
myApplication.Run();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
DATApp::DATApp():BApplication("application/x-vnd.Be-prefs-translations2")
|
||||
{
|
||||
DATWindow *aWindow;
|
||||
BRect aRect;
|
||||
|
||||
// set up a rectangle and instantiate a new window
|
||||
aRect.Set(40, 40, 440, 340);
|
||||
aWindow = new DATWindow(aRect);
|
||||
|
||||
|
||||
// make window visible
|
||||
aWindow->Show();
|
||||
|
||||
}
|
||||
|
||||
void DATApp :: RefsReceived(BMessage *message)
|
||||
{
|
||||
|
||||
uint32 type;
|
||||
int32 count;
|
||||
entry_ref ref;
|
||||
BPath path;
|
||||
BString newfile;
|
||||
|
||||
char e_name[B_FILE_NAME_LENGTH];
|
||||
char mbuf[256];
|
||||
|
||||
|
||||
message->GetInfo("refs", &type, &count);
|
||||
if ( type != B_REF_TYPE ) return;
|
||||
|
||||
|
||||
if ( message->FindRef("refs", &ref) == B_OK )
|
||||
{
|
||||
BEntry entry(&ref, true);
|
||||
if ( entry.IsFile() && entry.GetPath(&path)==B_OK)
|
||||
{
|
||||
entry.GetName(e_name);
|
||||
BNode node (&entry);
|
||||
BNodeInfo info (&node);
|
||||
info.GetType (mbuf);
|
||||
string.SetTo(mbuf);
|
||||
|
||||
if (string.FindFirst("application/x-vnd.Be-elfexecutable") != B_ERROR )
|
||||
{
|
||||
BDirectory dirt("/boot/home/config/add-ons/Translators/");
|
||||
newfile.SetTo("/boot/home/config/add-ons/Translators/");
|
||||
newfile << e_name; // Newfile with full path.
|
||||
|
||||
// Find out wether we need to copy it
|
||||
string.SetTo("");
|
||||
string << "The item '" << e_name << "' is now copied into the right place.\nWhat do you want to do with the original?";
|
||||
BAlert *keep = new BAlert("keep", string.String() , "Remove", "Keep");
|
||||
keep->SetShortcut(1, B_ESCAPE);
|
||||
|
||||
if (keep->Go() == 0) // Just a quick move
|
||||
{
|
||||
if (dirt.Contains(newfile.String()))
|
||||
{
|
||||
string.SetTo("");
|
||||
string << "An item named '" << e_name <<"' already is in the \nTranslators folder";
|
||||
BAlert *myAlert = new BAlert("title", string.String() , "Overwrite", "Stop");
|
||||
myAlert->SetShortcut(1, B_ESCAPE);
|
||||
|
||||
if (myAlert->Go() != 0)
|
||||
return;
|
||||
// File exists, we are still here. Kill it.
|
||||
BEntry dele;
|
||||
dirt.FindEntry(e_name, &dele);
|
||||
dele.Remove();
|
||||
}
|
||||
entry.MoveTo(&dirt);
|
||||
(new BAlert("", "You have to quit and restart running applications\nfor the installed Translators to be available in them.", "OK"))->Go();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dirt.Contains(newfile.String()))
|
||||
{
|
||||
// File exists, What are we supposed to do now (Overwrite/_Stopp_?)
|
||||
string.SetTo("");
|
||||
string << "An item named '" << e_name <<"' already is in the \nTranslators folder";
|
||||
BAlert *myAlert = new BAlert("title", string.String() , "Overwrite", "Stop");
|
||||
myAlert->SetShortcut(1, B_ESCAPE);
|
||||
|
||||
if (myAlert->Go() != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
string.SetTo(path.Path()); // Fullpath+Filename
|
||||
|
||||
BString
|
||||
command = "copyattr -d -r ";
|
||||
command << string.String() << " " << newfile.String(); // Prepare Copy
|
||||
|
||||
system(command.String()); // Execute copy command
|
||||
|
||||
string.SetTo("");
|
||||
string << "Filename: " << e_name << "\nPath: " << path.Path() ;
|
||||
|
||||
// The new Translator has been installed by now.
|
||||
(new BAlert("", "You have to quit and restart running applications\nfor the installed Translators to be available in them.", "OK"))->Go();
|
||||
// And done we are
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a Translator
|
||||
entry.GetName(e_name);
|
||||
string.SetTo("");
|
||||
string << "The item '" << e_name << "' does not appear to be a Translator and will not be installed";
|
||||
(new BAlert("", string.String(), "Stop"))->Go();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not even a file...
|
||||
entry.GetName(e_name);
|
||||
string.SetTo("");
|
||||
string << "The item '" << e_name << "' does not appear to be a Translator and will not be installed";
|
||||
(new BAlert("", string.String(), "Stop"))->Go();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
|
||||
datatrans.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DATATRANS_H //DATATRANS_H
|
||||
|
||||
#define DATATRANS_H
|
||||
|
||||
#ifndef _APPLICATION_H
|
||||
#include <Application.h>
|
||||
#endif
|
||||
|
||||
#ifndef LVIEW_H
|
||||
#include "LView.h"
|
||||
#endif
|
||||
|
||||
#include <String.h>
|
||||
|
||||
class DATApp : public BApplication
|
||||
{
|
||||
public:
|
||||
DATApp();
|
||||
|
||||
virtual void RefsReceived(BMessage *message);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
BString string;
|
||||
|
||||
};
|
||||
|
||||
#endif //DATATRANS_H
|
@ -1,244 +0,0 @@
|
||||
/*
|
||||
|
||||
transwin.cpp
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _APPLICATION_H
|
||||
#include <Application.h>
|
||||
#endif
|
||||
#ifndef TRANS_WIN_H
|
||||
#include "transwin.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
DATWindow::DATWindow(BRect frame)
|
||||
: BWindow(frame, "Data Translations2", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE )
|
||||
{
|
||||
newIcon = false;
|
||||
|
||||
BRect r( 300, 250, 380, 270 ); // Pos: Info-Button
|
||||
BRect all( 0, 0, 400, 300); // Fenster-Groesse
|
||||
BRect cv( 150, 13, 387, 245); // ConfigView & hosting Box
|
||||
BRect mau( 146, 8, 390, 290); // Grenz-Box around ConfView
|
||||
BRect DTN_pos( 195 , 245, 298 , 265); // Pos: Dateiname
|
||||
BRect ic ( 156 , 245, 188 , 277); // Pos: TrackerIcon
|
||||
|
||||
Konf = new BView(cv, "KONF", B_NOT_RESIZABLE, B_WILL_DRAW );
|
||||
// Konf->SetViewColor(217,217,217);
|
||||
|
||||
rBox = new BBox(cv, "Right_Side");
|
||||
gBox = new BBox(mau, "Grau");
|
||||
|
||||
Icon = new BView(ic, "Ikon", B_NOT_RESIZABLE, B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
|
||||
Icon->SetDrawingMode(B_OP_OVER);
|
||||
Icon->SetViewColor(217,217,217);
|
||||
Icon->SetHighColor(217,217,217);
|
||||
Icon_bit = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8, true, false);
|
||||
|
||||
dButton = new BButton(r, "STD", "Info. . .", new BMessage(BUTTON_MSG));
|
||||
|
||||
fBox = new BBox(all, "All_Window", B_FOLLOW_ALL_SIDES,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
|
||||
B_PLAIN_BORDER);
|
||||
|
||||
r.Set( 10, 10, 120, 288); // List View
|
||||
|
||||
liste = new LView(r, "Transen", B_SINGLE_SELECTION_LIST);
|
||||
liste->SetSelectionMessage(new BMessage(SEL_CHANGE));
|
||||
|
||||
DTN = new BStringView(DTN_pos, "DataName", "Test", B_NOT_RESIZABLE);
|
||||
DTN->SetViewColor(217,217,217);
|
||||
|
||||
// Here we add the names of all installed translators
|
||||
WriteTrans();
|
||||
|
||||
// Setting up the Box around my LView
|
||||
r.Set( 8, 8, 123, 288); // Box around the List
|
||||
lBox = new BBox(r, "List-Box");
|
||||
lBox->SetBorder(B_NO_BORDER);
|
||||
lBox->SetViewColor(255,255,255);
|
||||
|
||||
// Put list into a BScrollView, to get that nice srcollbar
|
||||
tListe = new BScrollView("scroll_trans", liste, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
|
||||
|
||||
|
||||
rBox->SetBorder(B_NO_BORDER);
|
||||
rBox->AddChild(Konf);
|
||||
rBox->SetFlags(B_NAVIGABLE_JUMP);
|
||||
|
||||
// Attach Views to my Window
|
||||
AddChild(dButton);
|
||||
AddChild(tListe);
|
||||
AddChild(rBox);
|
||||
|
||||
AddChild(fBox);
|
||||
AddChild(Icon);
|
||||
AddChild(DTN);
|
||||
AddChild(lBox);
|
||||
AddChild(gBox);
|
||||
|
||||
// Set the focus
|
||||
liste->MakeFocus();
|
||||
|
||||
// Select the first Translator in list
|
||||
liste->Select(0, false);
|
||||
showInfo = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool DATWindow::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return(true);
|
||||
}
|
||||
|
||||
// Reads the installed translators and adds them to our BListView
|
||||
int DATWindow::WriteTrans()
|
||||
{
|
||||
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
||||
|
||||
int32 num_translators, i;
|
||||
translator_id *translators;
|
||||
const char *tname, *tinfo;
|
||||
|
||||
int32 tversion;
|
||||
|
||||
// Get all Translators on the system. Gives us the number of translators
|
||||
// installed in num_translators and a reference to the first one, so
|
||||
// we can use translators like any normal array
|
||||
|
||||
roster->GetAllTranslators(&translators, &num_translators);
|
||||
|
||||
for (i=0;i<num_translators;i++) {
|
||||
// Getting the first three Infos: Name, Info & Version
|
||||
roster->GetTranslatorInfo(translators[i], &tname,&tinfo, &tversion);
|
||||
liste->AddItem(new BStringItem(tname));
|
||||
}
|
||||
|
||||
delete [] translators; // clean up our droppings
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Finds a specific translator by it´s id
|
||||
void DATWindow::Trans_by_ID(int32 id)
|
||||
{
|
||||
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
||||
|
||||
int32 num_translators;
|
||||
translator_id *translators;
|
||||
// const char *translator_name, *translator_info;
|
||||
|
||||
|
||||
roster->GetAllTranslators(&translators, &num_translators);
|
||||
|
||||
// Getting the first three Infos: Name, Info & Version
|
||||
roster->GetTranslatorInfo(translators[id], &translator_name,&translator_info, &translator_version);
|
||||
roster->Archive(&archiv, true);
|
||||
|
||||
rBox->RemoveChild(Konf);
|
||||
if (roster->MakeConfigurationView( translators[id], new BMessage() , &Konf, new BRect( 0, 0, 200, 233)) != B_OK )
|
||||
{
|
||||
BString text;
|
||||
text << "The translator '" << translator_name << "' has no settings";
|
||||
Konf = new BStringView(BRect(0, 0, 200, 233), "no_settings", text.String());
|
||||
};
|
||||
|
||||
// ( 171, 11, 391, 284)
|
||||
Konf->SetViewColor(217,217,217);
|
||||
Konf->ResizeTo(230, 233);
|
||||
Konf->SetFlags(B_WILL_DRAW | B_NAVIGABLE);
|
||||
rBox->AddChild(Konf);
|
||||
|
||||
UpdateIfNeeded(); // Fixes that one Icon problem
|
||||
|
||||
delete [] translators; // clean up our droppings
|
||||
}
|
||||
|
||||
void DATWindow::DrawIcon()
|
||||
{
|
||||
if (newIcon)
|
||||
{
|
||||
entry.SetTo(pfad);
|
||||
node.SetTo(&entry);
|
||||
info.SetTo(&node);
|
||||
Icon->FillRect(BRect(0, 0, 31, 31));
|
||||
newIcon = false;
|
||||
}
|
||||
if (info.GetTrackerIcon(Icon_bit) != B_OK) QuitRequested();
|
||||
Icon->DrawBitmap(Icon_bit);
|
||||
}
|
||||
|
||||
void DATWindow::WindowActivated(bool state)
|
||||
{
|
||||
if (showInfo) DrawIcon();
|
||||
}
|
||||
|
||||
void DATWindow::FrameMoved(BPoint origin)
|
||||
{
|
||||
if (showInfo) DrawIcon();
|
||||
}
|
||||
|
||||
void DATWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
int32 selected;
|
||||
|
||||
switch(message->what)
|
||||
{
|
||||
case BUTTON_MSG:
|
||||
selected=liste->CurrentSelection(0);
|
||||
|
||||
// Should we show translator info?
|
||||
if (!showInfo)
|
||||
{
|
||||
// No => Show standard box
|
||||
(new BAlert("yo!", "Translation Settings\n\nUse this control panel to set values that various\ntranslators use when no other settings are specified\nin the application.", "OK"))->Go();
|
||||
break;
|
||||
}
|
||||
// Yes => Show Translator info.
|
||||
Trans_by_ID(selected);
|
||||
archiv.FindString("be:translator_path", selected, &pfad);
|
||||
tex.SetTo("");
|
||||
tex << "Name: " << translator_name << "\nVersion: " << (int32)translator_version << "\nInfo: " << translator_info << "\nPath: " << pfad << "\n";
|
||||
(new BAlert("yo!", tex.String(), "OK"))->Go();
|
||||
tex.SetTo("");
|
||||
DrawIcon();
|
||||
break;
|
||||
|
||||
case SEL_CHANGE:
|
||||
// Now we have to update Filename and Icon
|
||||
// First we find the selected Translator
|
||||
selected=liste->CurrentSelection(0);
|
||||
|
||||
// If none selected, clear the old one
|
||||
if (selected < 0)
|
||||
{
|
||||
Icon->FillRect(BRect(0, 0, 31, 31));
|
||||
DTN->SetText("");
|
||||
showInfo = false;
|
||||
rBox->RemoveChild(Konf);
|
||||
break;
|
||||
}
|
||||
|
||||
newIcon = true;
|
||||
showInfo = true;
|
||||
Trans_by_ID(selected);
|
||||
// Now we find the path, and update filename
|
||||
archiv.FindString("be:translator_path", selected, &pfad);
|
||||
tex.SetTo(pfad);
|
||||
tex.Remove(0,tex.FindLast("/")+1);
|
||||
DTN->SetText(tex.String());
|
||||
DrawIcon();
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
|
||||
transwin.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TRANS_WIN_H
|
||||
#define TRANS_WIN_H
|
||||
|
||||
#ifndef _WINDOW_H
|
||||
#include <Window.h>
|
||||
#endif
|
||||
|
||||
#ifndef LVIEW_H
|
||||
#include "LView.h"
|
||||
#endif
|
||||
|
||||
#define BUTTON_MSG 'PRES'
|
||||
const uint32 SEL_CHANGE = 'SEch';
|
||||
|
||||
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <ListView.h>
|
||||
#include <string.h>
|
||||
#include <TranslatorRoster.h>
|
||||
#include <TranslationDefs.h>
|
||||
#include <ScrollView.h>
|
||||
#include <Alert.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <Bitmap.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <storage/Path.h>
|
||||
#include <storage/Directory.h>
|
||||
#include <storage/Entry.h>
|
||||
|
||||
|
||||
class DATWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
DATWindow(BRect frame);
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void FrameMoved(BPoint origin);
|
||||
|
||||
void DrawIcon();
|
||||
|
||||
private:
|
||||
const char *translator_name, *translator_info;
|
||||
int32 translator_version;
|
||||
const char* pfad;
|
||||
BString tex;
|
||||
bool showInfo;
|
||||
bool newIcon;
|
||||
|
||||
BButton* dButton; // Default-Button
|
||||
BBox* fBox; // Full-Window Box
|
||||
BScrollView* tListe; // To get that fancy scrollbar
|
||||
BBox* lBox; // Box around list
|
||||
BBox* rBox; // Box hosting Config View
|
||||
BBox* gBox; // Box around Config View, funny border
|
||||
|
||||
// BListView* list; // My lovely List of Translators no longer needed
|
||||
|
||||
LView* liste; // Improved list of Translators
|
||||
|
||||
BStringView* DTN; // Display the DataTranslatorName
|
||||
BMessage archiv; // My Message
|
||||
BView* Icon; // The Icon and Config - Views
|
||||
BBitmap* Icon_bit;
|
||||
BView* Konf;
|
||||
|
||||
|
||||
BEntry entry;
|
||||
BNode node;
|
||||
BNodeInfo info;
|
||||
|
||||
void GetDrop(BMessage *message);
|
||||
void Trans_by_ID(int32 id);
|
||||
int WriteTrans();
|
||||
|
||||
};
|
||||
|
||||
#endif //TRANS_WIN_H
|
Loading…
Reference in New Issue
Block a user