Started new FileTypes preferences application, so that you can at least see
it's supposed to do nothing at the moment :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16302 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FileTypes.h"
|
||||||
|
#include "FileTypesWindow.h"
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
//#include <Screen.h>
|
||||||
|
//#include <Autolock.h>
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <TextView.h>
|
||||||
|
#include <FilePanel.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Entry.h>
|
||||||
|
#include <Path.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
const char *kSignature = "application/x-vnd.Haiku-FileTypes";
|
||||||
|
|
||||||
|
class FileTypes : public BApplication {
|
||||||
|
public:
|
||||||
|
FileTypes();
|
||||||
|
virtual ~FileTypes();
|
||||||
|
|
||||||
|
virtual void ReadyToRun();
|
||||||
|
|
||||||
|
virtual void RefsReceived(BMessage* message);
|
||||||
|
virtual void ArgvReceived(int32 argc, char** argv);
|
||||||
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
|
virtual void AboutRequested();
|
||||||
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BFilePanel *fFilePanel;
|
||||||
|
BWindow *fTypesWindow;
|
||||||
|
uint32 fWindowCount;
|
||||||
|
BPoint fTypesWindowPosition;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FileTypes::FileTypes()
|
||||||
|
: BApplication(kSignature),
|
||||||
|
fTypesWindow(NULL),
|
||||||
|
fWindowCount(0)
|
||||||
|
{
|
||||||
|
fFilePanel = new BFilePanel();
|
||||||
|
fTypesWindowPosition = BPoint(100.0f, 100.0f);
|
||||||
|
// TODO: read from settings
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileTypes::~FileTypes()
|
||||||
|
{
|
||||||
|
delete fFilePanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypes::ReadyToRun()
|
||||||
|
{
|
||||||
|
// are there already windows open?
|
||||||
|
if (CountWindows() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// if not, open the FileTypes window
|
||||||
|
PostMessage(kMsgOpenTypesWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypes::RefsReceived(BMessage *message)
|
||||||
|
{
|
||||||
|
bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;
|
||||||
|
|
||||||
|
int32 index = 0;
|
||||||
|
entry_ref ref;
|
||||||
|
while (message->FindRef("refs", index++, &ref) == B_OK) {
|
||||||
|
BEntry entry;
|
||||||
|
status_t status = entry.SetTo(&ref, traverseLinks);
|
||||||
|
if (status == B_OK) {
|
||||||
|
// TODO: open FileType window
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != B_OK) {
|
||||||
|
char buffer[1024];
|
||||||
|
snprintf(buffer, sizeof(buffer),
|
||||||
|
"Could not open \"%s\":\n"
|
||||||
|
"%s",
|
||||||
|
ref.name, strerror(status));
|
||||||
|
|
||||||
|
(new BAlert("FileTypes request",
|
||||||
|
buffer, "Ok", NULL, NULL,
|
||||||
|
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypes::ArgvReceived(int32 argc, char **argv)
|
||||||
|
{
|
||||||
|
BMessage *message = CurrentMessage();
|
||||||
|
|
||||||
|
BDirectory currentDirectory;
|
||||||
|
if (message)
|
||||||
|
currentDirectory.SetTo(message->FindString("cwd"));
|
||||||
|
|
||||||
|
BMessage refs;
|
||||||
|
|
||||||
|
for (int i = 1 ; i < argc ; i++) {
|
||||||
|
BPath path;
|
||||||
|
if (argv[i][0] == '/')
|
||||||
|
path.SetTo(argv[i]);
|
||||||
|
else
|
||||||
|
path.SetTo(¤tDirectory, argv[i]);
|
||||||
|
|
||||||
|
status_t status;
|
||||||
|
entry_ref ref;
|
||||||
|
BEntry entry;
|
||||||
|
|
||||||
|
if ((status = entry.SetTo(path.Path(), false)) != B_OK
|
||||||
|
|| (status = entry.GetRef(&ref)) != B_OK) {
|
||||||
|
fprintf(stderr, "Could not open file \"%s\": %s\n",
|
||||||
|
path.Path(), strerror(status));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
refs.AddRef("refs", &ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefsReceived(&refs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypes::MessageReceived(BMessage *message)
|
||||||
|
{
|
||||||
|
switch (message->what) {
|
||||||
|
case kMsgOpenTypesWindow:
|
||||||
|
if (fTypesWindow == NULL) {
|
||||||
|
fTypesWindow = new FileTypesWindow(fTypesWindowPosition);
|
||||||
|
fTypesWindow->Show();
|
||||||
|
fWindowCount++;
|
||||||
|
} else
|
||||||
|
fTypesWindow->Activate(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgTypesWindowClosed:
|
||||||
|
fTypesWindow = NULL;
|
||||||
|
// supposed to fall through
|
||||||
|
case kMsgWindowClosed:
|
||||||
|
if (--fWindowCount == 0 && !fFilePanel->IsShowing())
|
||||||
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgOpenFilePanel:
|
||||||
|
fFilePanel->Show();
|
||||||
|
break;
|
||||||
|
case B_CANCEL:
|
||||||
|
if (fWindowCount == 0)
|
||||||
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BApplication::MessageReceived(message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypes::AboutRequested()
|
||||||
|
{
|
||||||
|
BAlert *alert = new BAlert("about", "FileTypes\n"
|
||||||
|
"\twritten by Axel Dörfler\n"
|
||||||
|
"\tCopyright 2006, Haiku.\n", "Ok");
|
||||||
|
BTextView *view = alert->TextView();
|
||||||
|
BFont font;
|
||||||
|
|
||||||
|
view->SetStylable(true);
|
||||||
|
|
||||||
|
view->GetFont(&font);
|
||||||
|
font.SetSize(18);
|
||||||
|
font.SetFace(B_BOLD_FACE);
|
||||||
|
view->SetFontAndColor(0, 9, &font);
|
||||||
|
|
||||||
|
alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FileTypes::QuitRequested()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
FileTypes probe;
|
||||||
|
|
||||||
|
probe.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef FILE_TYPES_H
|
||||||
|
#define FILE_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern const char* kSignature;
|
||||||
|
|
||||||
|
static const uint32 kMsgOpenFilePanel = 'opFp';
|
||||||
|
static const uint32 kMsgOpenTypesWindow = 'opTw';
|
||||||
|
static const uint32 kMsgTypesWindowClosed = 'clTw';
|
||||||
|
static const uint32 kMsgWindowClosed = 'WiCl';
|
||||||
|
|
||||||
|
#endif // FILE_TYPES_H
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** FileTypes.icons.rdef
|
* FileTypes.icons.rdef
|
||||||
**
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
resource(0, "BEOS:L:application/x-be-resource") #'ICON' array {
|
resource(0, "BEOS:L:application/x-be-resource") #'ICON' array {
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02020008FFFFFFFFFFFFFFFFFFFF"
|
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02020008FFFFFFFFFFFFFFFFFFFF"
|
||||||
@@ -73,41 +72,6 @@ resource(1, "BEOS:L:application/octet-stream") #'ICON' array {
|
|||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
$"FFFFFFFFFFFFFFFFFFFFFFFFAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource large_icon array {
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02020000FFFFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B17110802FFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B3F3F1B150800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF021B3F3F1B150A00FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFF003F00FFFFFFFFFF04151B1B17110800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF003FFD00FFFFFFFFFF02081515150A0800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFF003FFDFDFD00FFFFFF00F9000A0A080A00FFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFF003FFDFDFDFD00FFFF003FF97D000000007D0000FFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFF003FFDFDFDFDFDFD00FF00F93F3F7D7D7D7D7D7DF900FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDFDFD62FDFD00FF00F9F9F93F3FF9F9F9F97D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEFDFDFD62FDFDFDFA0000F9F9F9F9F93F3FF97D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEFEFDFD89FDFDFDFDFA0000F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"003FFEFEFEFDB0FD62FD62FD000000F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEFEB0FD89FD62FD007B7B00F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEB0FDB0FDB0FD6200DA7B7B00F9F90000F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEB0FDB0FDB0002B2CDA7B000000606000007D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEFDFDFD89FD002B2F2F00FA00606060606000007D00FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDB0FD002B2CEB2F000060606060606060600000FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDFDB0002B2F2F0000606060606060606060606000FFFFFFFFFF"
|
|
||||||
$"FFFFFFFF003FFDB0002B2CEB2F006060606060606060606060D5000EFFFFFFFF"
|
|
||||||
$"FFFF0000003FFDFD002B2F2F003F60606060606060606060D5D5000EFFFFFFFF"
|
|
||||||
$"FF007B7B7B003F002B2CEB2F00AC3F3F60606060606060D5D5D5000E0E0EFFFF"
|
|
||||||
$"007B7B7BDA003F002B2F2F0000ACACAC3F3F60606060D5D5D5D5000E0E0E0E0E"
|
|
||||||
$"002B2CDA7B7B002B2CEB2F0000ACACACACAC3F3F60D5D5D5D5D5000E0E0E0E0E"
|
|
||||||
$"FF002B2CDA7B2B2CEB2F000E00ACACACACACACACD5D5D5D5D5D5000E0E0E0EFF"
|
|
||||||
$"FF002B2CDA7B2B2CEB2F000E00ACACACACACACACD5D5D5D5D5D5000E0E0EFFFF"
|
|
||||||
$"FFFF002B2C2B2B2F2F000E0E00ACACACACACACACD5D5D5D5D5000E0E0EFFFFFF"
|
|
||||||
$"FFFF002B2C2B2B2F2F00FFFF00ACACACACACACACD5D5D5D5000E0E0EFFFFFFFF"
|
|
||||||
$"FFFFFF002B2CEB2F00FFFFFFFF0000ACACACACACD5D5D5000E0E0EFFFFFFFFFF"
|
|
||||||
$"FFFFFF002B2CEB2F00FFFFFFFFFFFF0000ACACACD5D5000E0E0EFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFF002B2F000E0F0F0F0F0F0F0F0F0000ACD5000E0E0EFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFF0000000E0F0F0F0F0F0F0F0F0F0F0F00000E0E0EFFFFFFFFFFFFFFFF"
|
|
||||||
};
|
|
||||||
|
|
||||||
resource(0, "BEOS:M:application/x-be-resource") #'MICN' array {
|
resource(0, "BEOS:M:application/x-be-resource") #'MICN' array {
|
||||||
$"FFFFFFFFFFFFFFFF020200FFFFFFFFFF"
|
$"FFFFFFFFFFFFFFFF020200FFFFFFFFFF"
|
||||||
$"FFFFFFFFFFFFFF04151E1500FFFFFFFF"
|
$"FFFFFFFFFFFFFF04151E1500FFFFFFFF"
|
||||||
@@ -145,22 +109,3 @@ resource(1, "BEOS:M:application/octet-stream") #'MICN' array {
|
|||||||
$"FFFFFFFFAE00000000AEAEFFFFFFFFFF"
|
$"FFFFFFFFAE00000000AEAEFFFFFFFFFF"
|
||||||
$"FFFFFFFFFFAE00AEFFAEFFFFFFFFFFFF"
|
$"FFFFFFFFFFAE00AEFFAEFFFFFFFFFFFF"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource mini_icon array {
|
|
||||||
$"FFFFFFFFFFFFFFFF020200FFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF04151E1500FFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF021D1E1C00FFFFFFFF"
|
|
||||||
$"FFFFFFFF00FFFF00151B1600FFFFFFFF"
|
|
||||||
$"FFFFFF003F0000FA0000000000FFFFFF"
|
|
||||||
$"FFFF003FFD0000F9F9FAFAFAFA00FFFF"
|
|
||||||
$"FF003FFEFDFD00F9F9F9F97D7D00FFFF"
|
|
||||||
$"003F62FE89007B00F9F900007D00FFFF"
|
|
||||||
$"FF003FB0FD002F00F90060600000FFFF"
|
|
||||||
$"FF003FFE002F000000606060606000FF"
|
|
||||||
$"FF000000002F00003F3F606060D500FF"
|
|
||||||
$"002B00002F00FA00ACAC3F3FD5D500FF"
|
|
||||||
$"002B7B2CEB000000ACACACACD5D5000E"
|
|
||||||
$"FF002B2F00000E00ACACACACD5D5000E"
|
|
||||||
$"FF002B2F000E0E0F0000ACACD5000E0E"
|
|
||||||
$"FFFF00000E0F0F0F0F0F0000000E0EFF"
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
** FileTypes.rdef
|
* FileTypes.rdef
|
||||||
**
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
resource app_signature "application/x-vnd.obos.file-types";
|
resource app_signature "application/x-vnd.Haiku-FileTypes";
|
||||||
|
|
||||||
resource app_flags B_SINGLE_LAUNCH;
|
resource app_flags B_SINGLE_LAUNCH;
|
||||||
|
|
||||||
@@ -11,3 +10,72 @@ resource file_types message {
|
|||||||
"types" = "application/x-be-resource",
|
"types" = "application/x-be-resource",
|
||||||
"types" = "application/octet-stream"
|
"types" = "application/octet-stream"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resource app_version {
|
||||||
|
major = 1,
|
||||||
|
middle = 0,
|
||||||
|
minor = 0,
|
||||||
|
|
||||||
|
/* 0 = development 1 = alpha 2 = beta
|
||||||
|
3 = gamma 4 = golden master 5 = final */
|
||||||
|
variety = 0,
|
||||||
|
|
||||||
|
internal = 1,
|
||||||
|
|
||||||
|
short_info = "FileTypes",
|
||||||
|
long_info = "FileTypes, Copyright 2006 Haiku Inc."
|
||||||
|
};
|
||||||
|
|
||||||
|
resource mini_icon array {
|
||||||
|
$"FFFFFFFFFFFFFFFF020200FFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFF04151E1500FFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFF021D1E1C00FFFFFFFF"
|
||||||
|
$"FFFFFFFF00FFFF00151B1600FFFFFFFF"
|
||||||
|
$"FFFFFF003F0000FA0000000000FFFFFF"
|
||||||
|
$"FFFF003FFD0000F9F9FAFAFAFA00FFFF"
|
||||||
|
$"FF003FFEFDFD00F9F9F9F97D7D00FFFF"
|
||||||
|
$"003F62FE89007B00F9F900007D00FFFF"
|
||||||
|
$"FF003FB0FD002F00F90060600000FFFF"
|
||||||
|
$"FF003FFE002F000000606060606000FF"
|
||||||
|
$"FF000000002F00003F3F606060D500FF"
|
||||||
|
$"002B00002F00FA00ACAC3F3FD5D500FF"
|
||||||
|
$"002B7B2CEB000000ACACACACD5D5000E"
|
||||||
|
$"FF002B2F00000E00ACACACACD5D5000E"
|
||||||
|
$"FF002B2F000E0E0F0000ACACD5000E0E"
|
||||||
|
$"FFFF00000E0F0F0F0F0F0000000E0EFF"
|
||||||
|
};
|
||||||
|
|
||||||
|
resource large_icon array {
|
||||||
|
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02020000FFFFFFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B17110802FFFFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B3F3F1B150800FFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF021B3F3F1B150A00FFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFFFF003F00FFFFFFFFFF04151B1B17110800FFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFFFF003FFD00FFFFFFFFFF02081515150A0800FFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFFFF003FFDFDFD00FFFFFF00F9000A0A080A00FFFFFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFFFF003FFDFDFDFD00FFFF003FF97D000000007D0000FFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFF003FFDFDFDFDFDFD00FF00F93F3F7D7D7D7D7D7DF900FFFFFFFFFFFF"
|
||||||
|
$"FFFFFF003FFDFDFDFD62FDFD00FF00F9F9F93F3FF9F9F9F97D00FFFFFFFFFFFF"
|
||||||
|
$"FFFF003FFEFDFDFD62FDFDFDFA0000F9F9F9F9F93F3FF97D7D00FFFFFFFFFFFF"
|
||||||
|
$"FF003FFEFEFDFD89FDFDFDFDFA0000F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
||||||
|
$"003FFEFEFEFDB0FD62FD62FD000000F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
||||||
|
$"FF003FFEFEB0FD89FD62FD007B7B00F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
||||||
|
$"FF003FFEB0FDB0FDB0FD6200DA7B7B00F9F90000F9F97D7D7D00FFFFFFFFFFFF"
|
||||||
|
$"FFFF003FFEB0FDB0FDB0002B2CDA7B000000606000007D7D7D00FFFFFFFFFFFF"
|
||||||
|
$"FFFF003FFEFDFDFD89FD002B2F2F00FA00606060606000007D00FFFFFFFFFFFF"
|
||||||
|
$"FFFFFF003FFDFDB0FD002B2CEB2F000060606060606060600000FFFFFFFFFFFF"
|
||||||
|
$"FFFFFF003FFDFDFDB0002B2F2F0000606060606060606060606000FFFFFFFFFF"
|
||||||
|
$"FFFFFFFF003FFDB0002B2CEB2F006060606060606060606060D5000EFFFFFFFF"
|
||||||
|
$"FFFF0000003FFDFD002B2F2F003F60606060606060606060D5D5000EFFFFFFFF"
|
||||||
|
$"FF007B7B7B003F002B2CEB2F00AC3F3F60606060606060D5D5D5000E0E0EFFFF"
|
||||||
|
$"007B7B7BDA003F002B2F2F0000ACACAC3F3F60606060D5D5D5D5000E0E0E0E0E"
|
||||||
|
$"002B2CDA7B7B002B2CEB2F0000ACACACACAC3F3F60D5D5D5D5D5000E0E0E0E0E"
|
||||||
|
$"FF002B2CDA7B2B2CEB2F000E00ACACACACACACACD5D5D5D5D5D5000E0E0E0EFF"
|
||||||
|
$"FF002B2CDA7B2B2CEB2F000E00ACACACACACACACD5D5D5D5D5D5000E0E0EFFFF"
|
||||||
|
$"FFFF002B2C2B2B2F2F000E0E00ACACACACACACACD5D5D5D5D5000E0E0EFFFFFF"
|
||||||
|
$"FFFF002B2C2B2B2F2F00FFFF00ACACACACACACACD5D5D5D5000E0E0EFFFFFFFF"
|
||||||
|
$"FFFFFF002B2CEB2F00FFFFFFFF0000ACACACACACD5D5D5000E0E0EFFFFFFFFFF"
|
||||||
|
$"FFFFFF002B2CEB2F00FFFFFFFFFFFF0000ACACACD5D5000E0E0EFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFF002B2F000E0F0F0F0F0F0F0F0F0000ACD5000E0E0EFFFFFFFFFFFFFF"
|
||||||
|
$"FFFFFFFF0000000E0F0F0F0F0F0F0F0F0F0F0F00000E0E0EFFFFFFFFFFFFFFFF"
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
** FileTypes.version.rdef
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
resource app_version {
|
|
||||||
|
|
||||||
major = 1,
|
|
||||||
middle = 0,
|
|
||||||
minor = 0,
|
|
||||||
|
|
||||||
/* 0 = development 1 = alpha 2 = beta
|
|
||||||
3 = gamma 4 = golden master 5 = final */
|
|
||||||
variety = 0,
|
|
||||||
|
|
||||||
internal = 1,
|
|
||||||
|
|
||||||
short_info = "R1.0.0d1",
|
|
||||||
long_info = "OpenBeOS 1.0.0d1 ©2002 OpenBeOS Project"
|
|
||||||
};
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
#include <Path.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <FileTypesConstants.h>
|
|
||||||
#include <FileTypesApp.h>
|
|
||||||
#include <FileTypesWindow.h>
|
|
||||||
|
|
||||||
BRect windowRect(7,26,507,426);
|
|
||||||
|
|
||||||
FileTypesApp * file_types_app = 0;
|
|
||||||
|
|
||||||
FileTypesApp::FileTypesApp()
|
|
||||||
: BApplication(APP_SIGNATURE)
|
|
||||||
{
|
|
||||||
fOpenPanel = new BFilePanel();
|
|
||||||
file_types_app = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileTypesApp::DispatchMessage(BMessage *msg, BHandler *handler)
|
|
||||||
{
|
|
||||||
if ( msg->what == B_ARGV_RECEIVED ) {
|
|
||||||
int32 argc;
|
|
||||||
if (msg->FindInt32("argc",&argc) != B_OK) {
|
|
||||||
argc=0;
|
|
||||||
}
|
|
||||||
const char ** argv = new const char*[argc];
|
|
||||||
for (int arg = 0; (arg < argc) ; arg++) {
|
|
||||||
if (msg->FindString("argv",arg,&argv[arg]) != B_OK) {
|
|
||||||
argv[arg] = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const char * cwd;
|
|
||||||
if (msg->FindString("cwd",&cwd) != B_OK) {
|
|
||||||
cwd = "";
|
|
||||||
}
|
|
||||||
ArgvReceived(argc, argv, cwd);
|
|
||||||
} else {
|
|
||||||
BApplication::DispatchMessage(msg,handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
FileTypesApp::MessageReceived(BMessage *message)
|
|
||||||
{
|
|
||||||
switch (message->what) {
|
|
||||||
case FILE_OPEN:
|
|
||||||
fOpenPanel->Show();
|
|
||||||
break;
|
|
||||||
case B_SILENT_RELAUNCH:
|
|
||||||
fWindow->Show();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BApplication::MessageReceived(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FileTypesApp::RefsReceived(BMessage *message)
|
|
||||||
{
|
|
||||||
int32 refNum = 0;
|
|
||||||
entry_ref ref;
|
|
||||||
while (message->FindRef("refs", refNum++, &ref) == B_OK) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FileTypesApp::ArgvReceived(int32 argc, const char *argv[], const char * cwd)
|
|
||||||
{
|
|
||||||
BMessage refsReceived(B_REFS_RECEIVED);
|
|
||||||
for (int i = 1 ; (i < argc) ; i++) {
|
|
||||||
BPath path;
|
|
||||||
if (argv[i][0] == '/') {
|
|
||||||
path.SetTo(argv[i]);
|
|
||||||
} else {
|
|
||||||
path.SetTo(cwd,argv[i]);
|
|
||||||
}
|
|
||||||
if (path.InitCheck() != B_OK) {
|
|
||||||
printf("path.InitCheck failed: \"");
|
|
||||||
if (argv[i][0] == '/') {
|
|
||||||
printf("%s",argv[i]);
|
|
||||||
} else {
|
|
||||||
printf("%s/%s",cwd,argv[i]);
|
|
||||||
}
|
|
||||||
printf("\".\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
entry_ref ref;
|
|
||||||
if (get_ref_for_path(path.Path(), &ref) != B_OK) {
|
|
||||||
printf("get_ref_for_path failed: \"");
|
|
||||||
printf("%s",path.Path());
|
|
||||||
printf("\".\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FileTypesApp::ReadyToRun()
|
|
||||||
{
|
|
||||||
if (!fArgvOkay) {
|
|
||||||
Quit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (fWindow == 0) {
|
|
||||||
OpenPanel()->Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BFilePanel *
|
|
||||||
FileTypesApp::OpenPanel()
|
|
||||||
{
|
|
||||||
if (fOpenPanel == 0) {
|
|
||||||
fOpenPanel = new BFilePanel(B_OPEN_PANEL);
|
|
||||||
}
|
|
||||||
return fOpenPanel;
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#ifndef FILE_TYPES_APP
|
|
||||||
#define FILE_TYPES_APP
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <FilePanel.h>
|
|
||||||
|
|
||||||
class FileTypesWindow;
|
|
||||||
|
|
||||||
class FileTypesApp
|
|
||||||
: public BApplication
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FileTypesApp();
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
|
||||||
virtual void ArgvReceived(int32 argc, char ** argv) { BApplication::ArgvReceived(argc, argv); }
|
|
||||||
virtual void ArgvReceived(int32 argc, const char *argv[], const char * cwd);
|
|
||||||
virtual void RefsReceived(BMessage *message);
|
|
||||||
virtual void ReadyToRun();
|
|
||||||
|
|
||||||
virtual void DispatchMessage(BMessage *an_event, BHandler *handler);
|
|
||||||
|
|
||||||
private:
|
|
||||||
BFilePanel * OpenPanel();
|
|
||||||
|
|
||||||
FileTypesWindow * fWindow;
|
|
||||||
BFilePanel * fOpenPanel;
|
|
||||||
|
|
||||||
bool fArgvOkay;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern FileTypesApp * file_types_app;
|
|
||||||
|
|
||||||
#endif // FILE_TYPES_APP
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef FILE_TYPES_CONSTANTS_H
|
|
||||||
#define FILE_TYPES_CONSTANTS_H
|
|
||||||
|
|
||||||
#define APP_SIGNATURE "application/x-vnd.obos.file-types"
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
|
|
||||||
// File menu
|
|
||||||
const uint32 FILE_NEW_RESOURCE_FILE = 'Fnrf' ;
|
|
||||||
const uint32 FILE_OPEN = 'Fopn' ;
|
|
||||||
|
|
||||||
// Settings menu
|
|
||||||
const uint32 SETTINGS_SHOW_ITERNAL_TYPES = 'Ssit' ;
|
|
||||||
|
|
||||||
#endif // FILE_TYPES_CONSTANTS_H
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#include <FileTypesView.h>
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef FILE_TYPES_VIEW_H
|
|
||||||
#define FILE_TYPES_VIEW_H
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
class FileTypesView : public BView {
|
|
||||||
public:
|
|
||||||
FileTypesView(BRect viewframe);
|
|
||||||
~FileTypesView();
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FILE_TYPES_VIEW_H
|
|
||||||
@@ -1 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FileTypes.h"
|
||||||
|
#include "FileTypesWindow.h"
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <MenuBar.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
|
|
||||||
|
#include <be_apps/Tracker/RecentItems.h>
|
||||||
|
|
||||||
|
|
||||||
|
FileTypesWindow::FileTypesWindow(BPoint position)
|
||||||
|
: BWindow(BRect(position.x, position.y, position.x + 300, position.y + 200),
|
||||||
|
"FileTypes", B_TITLED_WINDOW,
|
||||||
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
||||||
|
{
|
||||||
|
// add the menu
|
||||||
|
|
||||||
|
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
||||||
|
AddChild(menuBar);
|
||||||
|
|
||||||
|
BMenu* menu = new BMenu("File");
|
||||||
|
menu->AddItem(new BMenuItem("New Resource File" B_UTF8_ELLIPSIS,
|
||||||
|
NULL, 'N', B_COMMAND_KEY));
|
||||||
|
|
||||||
|
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu("Open" B_UTF8_ELLIPSIS,
|
||||||
|
NULL, NULL, be_app, 10, false, NULL, kSignature);
|
||||||
|
BMenuItem* item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
|
||||||
|
item->SetShortcut('O', B_COMMAND_KEY);
|
||||||
|
menu->AddItem(item);
|
||||||
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
|
menu->AddItem(new BMenuItem("About FileTypes" B_UTF8_ELLIPSIS,
|
||||||
|
new BMessage(B_ABOUT_REQUESTED)));
|
||||||
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
|
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
|
||||||
|
'Q', B_COMMAND_KEY));
|
||||||
|
menu->SetTargetForItems(be_app);
|
||||||
|
item->SetTarget(this);
|
||||||
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
|
BRect rect = Bounds();
|
||||||
|
rect.top = menuBar->Bounds().Height() + 1;
|
||||||
|
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
|
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
AddChild(topView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileTypesWindow::~FileTypesWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileTypesWindow::MessageReceived(BMessage* message)
|
||||||
|
{
|
||||||
|
BWindow::MessageReceived(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FileTypesWindow::QuitRequested()
|
||||||
|
{
|
||||||
|
be_app->PostMessage(kMsgTypesWindowClosed);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
#ifndef FILE_TYPES_WINDOW_H
|
#ifndef FILE_TYPES_WINDOW_H
|
||||||
#define FILE_TYPES_WINDOW_H
|
#define FILE_TYPES_WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
class FileTypesView;
|
|
||||||
|
|
||||||
class FileTypesWindow
|
class FileTypesWindow : public BWindow {
|
||||||
: public BWindow
|
public:
|
||||||
{
|
FileTypesWindow(BPoint position);
|
||||||
public:
|
virtual ~FileTypesWindow();
|
||||||
FileTypesWindow(BRect frame);
|
|
||||||
~FileTypesWindow();
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
virtual void Quit();
|
virtual bool QuitRequested();
|
||||||
virtual bool QuitRequested();
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
private:
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILE_TYPES_WINDOW_H
|
#endif // FILE_TYPES_WINDOW_H
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
SubDir HAIKU_TOP src preferences filetypes ;
|
SubDir HAIKU_TOP src preferences filetypes ;
|
||||||
|
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
SubDirSysHdrs $(SUBDIR) ;
|
SubDirSysHdrs $(SUBDIR) ;
|
||||||
|
|
||||||
Preference FileTypes :
|
Preference FileTypes :
|
||||||
main.cpp
|
FileTypes.cpp
|
||||||
FileTypesApp.cpp
|
|
||||||
FileTypesView.cpp
|
|
||||||
FileTypesWindow.cpp
|
FileTypesWindow.cpp
|
||||||
: libbe.so libtracker.so
|
: be tracker
|
||||||
: FileTypes.rdef FileTypes.icons.rdef FileTypes.version.rdef
|
: FileTypes.rdef FileTypes.icons.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if $(TARGET_PLATFORM) = libbe_test {
|
||||||
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : FileTypes
|
||||||
|
: tests!apps ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#include <FileTypesApp.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
FileTypesApp fileTypes;
|
|
||||||
fileTypes.Run();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user