XmFile stub
This commit is contained in:
parent
37f0d6d0ae
commit
d34e7fdc88
2
xmfile/build.sh
Executable file
2
xmfile/build.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
../scripts/buildapp.sh xmpackage "$@"
|
9
xmfile/src/icons/block-small.xbm
Normal file
9
xmfile/src/icons/block-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define block_small_width 24
|
||||
#define block_small_height 24
|
||||
static unsigned char block_small_bits[] = {
|
||||
0xff, 0xff, 0x0f, 0x01, 0x00, 0x10, 0x01, 0x3c, 0x20, 0x81, 0xc3, 0x41,
|
||||
0xc1, 0x00, 0x83, 0x21, 0x00, 0x84, 0x11, 0x00, 0x88, 0x19, 0x00, 0x99,
|
||||
0x09, 0x80, 0x90, 0x09, 0x40, 0x90, 0xe5, 0x00, 0xa0, 0x05, 0x1b, 0xa0,
|
||||
0x05, 0xd8, 0xa0, 0x05, 0x00, 0xa7, 0x09, 0x02, 0x90, 0x09, 0x01, 0x90,
|
||||
0x99, 0x0c, 0x98, 0x11, 0xf8, 0x88, 0x21, 0xe0, 0x8f, 0xc1, 0x80, 0xbf,
|
||||
0x81, 0xc3, 0xbf, 0x01, 0x3c, 0xbc, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff };
|
27
xmfile/src/icons/block.xbm
Normal file
27
xmfile/src/icons/block.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define block_width 48
|
||||
#define block_height 48
|
||||
static unsigned char block_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02,
|
||||
0xf4, 0xff, 0xff, 0xff, 0xff, 0x04, 0x14, 0x00, 0xf0, 0x0f, 0x00, 0x09,
|
||||
0xf4, 0xff, 0xff, 0xff, 0xff, 0x13, 0x14, 0x80, 0x0f, 0xf0, 0x01, 0x24,
|
||||
0xf4, 0xff, 0x01, 0x80, 0xff, 0x2f, 0x14, 0x70, 0x00, 0x00, 0x0e, 0x28,
|
||||
0xf4, 0x3f, 0x00, 0x00, 0xfc, 0x2f, 0x14, 0x0c, 0x00, 0x00, 0x30, 0x28,
|
||||
0xf4, 0x07, 0x00, 0x00, 0xe0, 0x2f, 0x14, 0x07, 0x00, 0x00, 0xe4, 0x28,
|
||||
0xf4, 0x03, 0x00, 0x00, 0xc2, 0x2f, 0x94, 0x01, 0x00, 0x00, 0x81, 0x29,
|
||||
0xf4, 0x01, 0x00, 0x80, 0x80, 0x2f, 0xd4, 0x00, 0x00, 0x40, 0x00, 0x2b,
|
||||
0xf4, 0x00, 0x00, 0x20, 0x30, 0x2f, 0xd4, 0x00, 0x00, 0x10, 0x0c, 0x2b,
|
||||
0x74, 0x00, 0xc0, 0x03, 0x03, 0x2e, 0x74, 0x00, 0x60, 0xc5, 0x00, 0x2e,
|
||||
0x74, 0x00, 0x30, 0x0a, 0x00, 0x2e, 0x74, 0x00, 0x90, 0x0d, 0x00, 0x2e,
|
||||
0x74, 0x00, 0xb0, 0x09, 0x00, 0x2e, 0x74, 0x00, 0x50, 0x0c, 0x00, 0x2e,
|
||||
0x74, 0x00, 0xa6, 0x06, 0x00, 0x2e, 0x74, 0xe0, 0xc1, 0x03, 0x00, 0x2e,
|
||||
0xf4, 0x1c, 0x08, 0x00, 0x00, 0x2f, 0xd4, 0x00, 0x04, 0x00, 0x00, 0x2b,
|
||||
0xf4, 0x00, 0x02, 0x00, 0x00, 0x2f, 0x94, 0x01, 0x01, 0x00, 0x80, 0x29,
|
||||
0xf4, 0x81, 0xc0, 0x01, 0x80, 0x2f, 0x14, 0x43, 0x80, 0x0f, 0xc0, 0x28,
|
||||
0xf4, 0x27, 0x00, 0xf6, 0xe0, 0x2f, 0x14, 0x06, 0x00, 0x18, 0x6f, 0x28,
|
||||
0xf4, 0x0f, 0x00, 0x20, 0xf0, 0x2f, 0x14, 0x38, 0x00, 0xc0, 0x00, 0x2b,
|
||||
0xf4, 0x7f, 0x00, 0x00, 0x43, 0x2e, 0x14, 0xe0, 0x01, 0x80, 0x87, 0x2a,
|
||||
0xf4, 0xff, 0x0f, 0xf0, 0x1f, 0x2e, 0x14, 0x00, 0xfe, 0x7f, 0xe0, 0x29,
|
||||
0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/character-small.xbm
Normal file
9
xmfile/src/icons/character-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define character_small_width 24
|
||||
#define character_small_height 24
|
||||
static unsigned char character_small_bits[] = {
|
||||
0x80, 0xff, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x02, 0xf8, 0xff, 0x1f,
|
||||
0x44, 0x00, 0x22, 0x44, 0x00, 0x22, 0xfc, 0xaa, 0x3e, 0x4c, 0x00, 0x32,
|
||||
0x4c, 0x00, 0x32, 0x48, 0xff, 0x12, 0x48, 0x81, 0x12, 0x68, 0xff, 0x16,
|
||||
0x68, 0x81, 0x16, 0xf8, 0x7e, 0x1f, 0x80, 0x81, 0x01, 0x00, 0xff, 0x00,
|
||||
0x00, 0x3e, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x32, 0x00, 0x00, 0x26, 0x00,
|
||||
0x00, 0x08, 0x00, 0x00, 0x32, 0x00, 0x00, 0x26, 0x00, 0x00, 0x14, 0x00 };
|
27
xmfile/src/icons/character.xbm
Normal file
27
xmfile/src/icons/character.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define character_width 48
|
||||
#define character_height 48
|
||||
static unsigned char character_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xe0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00,
|
||||
0x00, 0x30, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x30, 0x00, 0x20, 0x0d, 0x00,
|
||||
0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||
0x30, 0x20, 0x00, 0x00, 0x04, 0x0c, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08,
|
||||
0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08,
|
||||
0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08,
|
||||
0x10, 0xf0, 0xff, 0xff, 0x0f, 0x08, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x0b,
|
||||
0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x70, 0x18, 0x00, 0x00, 0x18, 0x0e,
|
||||
0x70, 0x18, 0x00, 0x00, 0x18, 0x0e, 0x60, 0x98, 0xff, 0xff, 0x19, 0x06,
|
||||
0x40, 0x98, 0x00, 0x00, 0x19, 0x02, 0x40, 0x98, 0xff, 0xff, 0x19, 0x02,
|
||||
0xc0, 0x9c, 0x00, 0x00, 0x39, 0x03, 0xc0, 0x9c, 0xff, 0xff, 0x39, 0x03,
|
||||
0xc0, 0x9c, 0x00, 0x00, 0x39, 0x03, 0x80, 0x34, 0xff, 0xff, 0x2c, 0x01,
|
||||
0x80, 0x74, 0x02, 0x40, 0x2e, 0x01, 0x80, 0xe7, 0xfc, 0x3f, 0xe7, 0x01,
|
||||
0x80, 0xc7, 0x01, 0x80, 0xe3, 0x01, 0x00, 0x83, 0xff, 0xff, 0xc1, 0x00,
|
||||
0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x58, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x98, 0x1c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x19, 0x00, 0x00, 0x00, 0x00, 0x58, 0x1a, 0x00, 0x00,
|
||||
0x00, 0x00, 0x98, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x19, 0x00, 0x00,
|
||||
0x00, 0x00, 0x58, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x90, 0x14, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x19, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x00, 0x90, 0x14, 0x00, 0x00, 0x00, 0x00, 0x28, 0x09, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/directory-small.xbm
Normal file
9
xmfile/src/icons/directory-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define directory_small_width 24
|
||||
#define directory_small_height 24
|
||||
static unsigned char directory_small_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x56, 0xff, 0x1f,
|
||||
0xaa, 0xaa, 0x2a, 0xfe, 0xff, 0x7f, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
|
||||
0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
|
||||
0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
|
||||
0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0xfa, 0xff, 0x5f,
|
||||
0x02, 0x00, 0x40, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmfile/src/icons/directory.xbm
Normal file
27
xmfile/src/icons/directory.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define directory_width 48
|
||||
#define directory_height 48
|
||||
static unsigned char directory_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00,
|
||||
0xf8, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xb8, 0xaa, 0xfe, 0xff, 0xff, 0x0f,
|
||||
0x58, 0x55, 0xfd, 0xff, 0xff, 0x1f, 0xb8, 0xaa, 0xaa, 0xaa, 0xaa, 0x1a,
|
||||
0xf8, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0xec, 0xff, 0xff, 0xff, 0xff, 0x37,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0xec, 0xff, 0xff, 0xff, 0xff, 0x37,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f,
|
||||
0xf8, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/file-small.xbm
Normal file
9
xmfile/src/icons/file-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define file_small_width 24
|
||||
#define file_small_height 24
|
||||
static unsigned char file_small_bits[] = {
|
||||
0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x10, 0x80, 0x01, 0x10, 0x80, 0x02,
|
||||
0x90, 0xaf, 0x04, 0x10, 0x80, 0x0f, 0x90, 0x3b, 0x08, 0x10, 0x00, 0x08,
|
||||
0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08,
|
||||
0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08,
|
||||
0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0x10, 0x00, 0x08,
|
||||
0x10, 0x00, 0x08, 0x10, 0x00, 0x08, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00 };
|
27
xmfile/src/icons/file.xbm
Normal file
27
xmfile/src/icons/file.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define file_width 48
|
||||
#define file_height 48
|
||||
static unsigned char file_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0d, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0x19, 0x00, 0x00, 0x03, 0x00, 0x00, 0x31, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0x61, 0x00, 0x00, 0xc3, 0xff, 0x2b, 0xff, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xc3, 0xf7, 0x3f, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc3, 0xfb, 0x37, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00,
|
||||
0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmfile/src/icons/icon.xbm
Normal file
27
xmfile/src/icons/icon.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define icon_width 48
|
||||
#define icon_height 48
|
||||
static unsigned char icon_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00,
|
||||
0x00, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x00,
|
||||
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00,
|
||||
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00,
|
||||
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00,
|
||||
0x00, 0x1e, 0x00, 0x00, 0x78, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/link-small.xbm
Normal file
9
xmfile/src/icons/link-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define link_small_width 24
|
||||
#define link_small_height 24
|
||||
static unsigned char link_small_bits[] = {
|
||||
0x00, 0x00, 0x0c, 0x00, 0x00, 0x33, 0x00, 0x80, 0x4c, 0x00, 0x40, 0x52,
|
||||
0x00, 0x20, 0xa1, 0x00, 0x90, 0xa0, 0x00, 0x48, 0xa0, 0x00, 0x24, 0x90,
|
||||
0x00, 0x12, 0x48, 0x00, 0x79, 0x24, 0x80, 0x95, 0x12, 0x40, 0xa5, 0x09,
|
||||
0x20, 0x45, 0x05, 0x90, 0x4a, 0x03, 0x48, 0xb2, 0x01, 0x24, 0x9c, 0x00,
|
||||
0x12, 0x48, 0x00, 0x0a, 0x24, 0x00, 0x05, 0x12, 0x00, 0x05, 0x09, 0x00,
|
||||
0x8a, 0x04, 0x00, 0x72, 0x02, 0x00, 0x0c, 0x01, 0x00, 0xf0, 0x00, 0x00 };
|
27
xmfile/src/icons/link.xbm
Normal file
27
xmfile/src/icons/link.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define link_width 48
|
||||
#define link_height 48
|
||||
static unsigned char link_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x87, 0x07, 0x00, 0x00, 0x00, 0x80, 0x01, 0x0e,
|
||||
0x00, 0x00, 0x00, 0xc0, 0x70, 0x18, 0x00, 0x00, 0x00, 0x60, 0xdc, 0x31,
|
||||
0x00, 0x00, 0x00, 0x30, 0x06, 0x33, 0x00, 0x00, 0x00, 0x18, 0x03, 0x66,
|
||||
0x00, 0x00, 0x00, 0x8c, 0x01, 0x64, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xcc,
|
||||
0x00, 0x00, 0x00, 0x63, 0x00, 0xc8, 0x00, 0x00, 0x80, 0x31, 0x00, 0xcc,
|
||||
0x00, 0x00, 0xc0, 0x18, 0x00, 0xc4, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x66,
|
||||
0x00, 0x00, 0x30, 0x06, 0x00, 0x63, 0x00, 0x00, 0x18, 0x03, 0x80, 0x31,
|
||||
0x00, 0x00, 0x8c, 0x03, 0xc0, 0x18, 0x00, 0x00, 0xc6, 0x0f, 0x60, 0x0c,
|
||||
0x00, 0x00, 0xe3, 0x1d, 0x30, 0x06, 0x00, 0x80, 0xf3, 0x30, 0x18, 0x03,
|
||||
0x00, 0xc0, 0xb1, 0x63, 0x8c, 0x01, 0x00, 0xe0, 0x19, 0x66, 0xc6, 0x00,
|
||||
0x00, 0xb0, 0x09, 0xcc, 0x63, 0x00, 0x00, 0x98, 0x19, 0xc8, 0x31, 0x00,
|
||||
0x00, 0x8c, 0x13, 0x98, 0x19, 0x00, 0x00, 0xc6, 0x33, 0x90, 0x0f, 0x00,
|
||||
0x00, 0x63, 0x66, 0x98, 0x07, 0x00, 0x80, 0x31, 0xc6, 0x89, 0x03, 0x00,
|
||||
0xc0, 0x18, 0x0c, 0xcf, 0x01, 0x00, 0x60, 0x0c, 0x38, 0xc7, 0x00, 0x00,
|
||||
0x30, 0x06, 0xf0, 0x63, 0x00, 0x00, 0x18, 0x03, 0xc0, 0x31, 0x00, 0x00,
|
||||
0x8c, 0x01, 0xc0, 0x18, 0x00, 0x00, 0xc6, 0x00, 0x60, 0x0c, 0x00, 0x00,
|
||||
0x66, 0x00, 0x30, 0x06, 0x00, 0x00, 0x23, 0x00, 0x18, 0x03, 0x00, 0x00,
|
||||
0x33, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x13, 0x00, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x33, 0x00, 0x63, 0x00, 0x00, 0x00, 0x26, 0x80, 0x31, 0x00, 0x00, 0x00,
|
||||
0x66, 0xc0, 0x18, 0x00, 0x00, 0x00, 0xcc, 0x60, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x8c, 0x3b, 0x06, 0x00, 0x00, 0x00, 0x18, 0x0e, 0x03, 0x00, 0x00, 0x00,
|
||||
0x70, 0x80, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/pipe-small.xbm
Normal file
9
xmfile/src/icons/pipe-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define pipe_small_width 24
|
||||
#define pipe_small_height 24
|
||||
static unsigned char pipe_small_bits[] = {
|
||||
0x00, 0x00, 0xff, 0x00, 0x00, 0x81, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x81,
|
||||
0x00, 0x00, 0xff, 0x00, 0x00, 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x52,
|
||||
0x00, 0x7e, 0x52, 0xe0, 0xc3, 0x51, 0x18, 0x42, 0x40, 0x04, 0x42, 0x28,
|
||||
0x84, 0x52, 0x23, 0x22, 0x5a, 0x18, 0x82, 0xc3, 0x07, 0x52, 0x7e, 0x00,
|
||||
0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||
0x81, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x81, 0x00, 0x00, 0xff, 0x00, 0x00 };
|
27
xmfile/src/icons/pipe.xbm
Normal file
27
xmfile/src/icons/pipe.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define pipe_width 48
|
||||
#define pipe_height 48
|
||||
static unsigned char pipe_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f,
|
||||
0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x01, 0x60,
|
||||
0x00, 0x00, 0x00, 0x80, 0x01, 0x6d, 0x00, 0x00, 0x00, 0x80, 0x01, 0x6e,
|
||||
0x00, 0x00, 0x00, 0x80, 0x41, 0x6d, 0x00, 0x00, 0x00, 0x80, 0x01, 0x60,
|
||||
0x00, 0x00, 0x00, 0x80, 0x57, 0x7d, 0x00, 0x00, 0x00, 0x80, 0x03, 0x70,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x34, 0x00, 0x00, 0x00, 0x00, 0x03, 0x34,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x34, 0x00, 0x00, 0x00, 0x00, 0x03, 0x34,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x34, 0x00, 0x00, 0x00, 0x00, 0x03, 0x34,
|
||||
0x00, 0x00, 0xf8, 0x1f, 0x03, 0x34, 0x00, 0xf8, 0xff, 0xff, 0x03, 0x34,
|
||||
0x00, 0xff, 0x1f, 0xf8, 0x01, 0x34, 0xc0, 0x07, 0x18, 0x18, 0x00, 0x34,
|
||||
0xe0, 0x00, 0x10, 0x08, 0x00, 0x34, 0x70, 0x00, 0x18, 0x18, 0x00, 0x32,
|
||||
0x30, 0x00, 0x10, 0x08, 0x00, 0x1a, 0x18, 0x00, 0x18, 0x18, 0x00, 0x18,
|
||||
0x18, 0x00, 0x10, 0x0a, 0x00, 0x19, 0x18, 0x00, 0x58, 0x19, 0x80, 0x0c,
|
||||
0x0c, 0x00, 0x90, 0x0a, 0x30, 0x0e, 0x0c, 0x80, 0xdf, 0xfb, 0x0f, 0x07,
|
||||
0x0c, 0x20, 0xd0, 0x0b, 0xe0, 0x03, 0x0c, 0x80, 0x1f, 0xf8, 0xff, 0x00,
|
||||
0x0c, 0xd0, 0xff, 0xff, 0x1f, 0x00, 0x0c, 0xd0, 0xf8, 0x1f, 0x00, 0x00,
|
||||
0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd0, 0x00, 0x00, 0x00, 0x00,
|
||||
0xee, 0xff, 0x01, 0x00, 0x00, 0x00, 0x5e, 0xf5, 0x01, 0x00, 0x00, 0x00,
|
||||
0x06, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0xb4, 0x01, 0x00, 0x00, 0x00,
|
||||
0x06, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x06, 0xb5, 0x01, 0x00, 0x00, 0x00,
|
||||
0x06, 0x80, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||
0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
9
xmfile/src/icons/socket-small.xbm
Normal file
9
xmfile/src/icons/socket-small.xbm
Normal file
@ -0,0 +1,9 @@
|
||||
#define socket_small_width 24
|
||||
#define socket_small_height 24
|
||||
static unsigned char socket_small_bits[] = {
|
||||
0x00, 0x41, 0x00, 0x00, 0x51, 0x00, 0x00, 0x41, 0x00, 0x00, 0x51, 0x00,
|
||||
0x00, 0x51, 0x00, 0x00, 0x51, 0x00, 0x00, 0x51, 0x00, 0x80, 0xd1, 0x00,
|
||||
0xc0, 0xc1, 0x01, 0xc0, 0xa2, 0x01, 0x40, 0x5d, 0x01, 0x40, 0x3e, 0x01,
|
||||
0x80, 0x80, 0x00, 0x00, 0x51, 0x00, 0x00, 0x41, 0x00, 0x00, 0x51, 0x00,
|
||||
0x00, 0x51, 0x00, 0x00, 0x51, 0x00, 0x00, 0x41, 0x00, 0x80, 0xff, 0x00,
|
||||
0x80, 0x80, 0x00, 0x80, 0xb8, 0x00, 0x80, 0x80, 0x00, 0x80, 0xff, 0x00 };
|
27
xmfile/src/icons/socket.xbm
Normal file
27
xmfile/src/icons/socket.xbm
Normal file
@ -0,0 +1,27 @@
|
||||
#define socket_width 48
|
||||
#define socket_height 48
|
||||
static unsigned char socket_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x28, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x00, 0x00, 0x04, 0x48, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x07, 0xe8, 0x00, 0x00, 0x00, 0x80, 0x06, 0x68, 0x01, 0x00,
|
||||
0x00, 0xc0, 0x07, 0xe8, 0x03, 0x00, 0x00, 0xe0, 0x06, 0x68, 0x07, 0x00,
|
||||
0x00, 0xb0, 0x07, 0xe4, 0x0d, 0x00, 0x00, 0xb0, 0x0c, 0x32, 0x0d, 0x00,
|
||||
0x00, 0x30, 0x1f, 0xf8, 0x0c, 0x00, 0x00, 0x30, 0xf3, 0xcf, 0x0c, 0x00,
|
||||
0x00, 0x60, 0xfe, 0x7f, 0x06, 0x00, 0x00, 0x60, 0x0c, 0x30, 0x06, 0x00,
|
||||
0x00, 0xc0, 0xf0, 0x0f, 0x03, 0x00, 0x00, 0x80, 0x01, 0x80, 0x03, 0x00,
|
||||
0x00, 0x00, 0x03, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x68, 0x00, 0x00, 0x00, 0x00, 0x06, 0x68, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf7, 0xff, 0x00, 0x00, 0x00, 0x00, 0xaf, 0xfa, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xda, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x83, 0xda, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
386
xmfile/src/main.c
Normal file
386
xmfile/src/main.c
Normal file
@ -0,0 +1,386 @@
|
||||
#define _XOPEN_SOURCE 700
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <Xm/MainW.h>
|
||||
#include <Xm/IconG.h>
|
||||
#include <Xm/Container.h>
|
||||
#include <Xm/ScrolledW.h>
|
||||
|
||||
#include <Xmd/Icon.h>
|
||||
#include <Xmd/Exec.h>
|
||||
#include <Xmd/Buffer.h>
|
||||
#include <Xmd/StringMap.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "icons/icon.xbm"
|
||||
#include "icons/directory.xbm"
|
||||
#include "icons/directory-small.xbm"
|
||||
#include "icons/file.xbm"
|
||||
#include "icons/file-small.xbm"
|
||||
#include "icons/link.xbm"
|
||||
#include "icons/link-small.xbm"
|
||||
#include "icons/block.xbm"
|
||||
#include "icons/block-small.xbm"
|
||||
#include "icons/character.xbm"
|
||||
#include "icons/character-small.xbm"
|
||||
#include "icons/socket.xbm"
|
||||
#include "icons/socket-small.xbm"
|
||||
#include "icons/pipe.xbm"
|
||||
#include "icons/pipe-small.xbm"
|
||||
|
||||
static XtAppContext application;
|
||||
static XmdStringMap *trailFiles;
|
||||
static XmdStringMap *viewFiles;
|
||||
static Widget topLevel;
|
||||
static Widget viewContainer;
|
||||
static Widget trailContainer;
|
||||
static Pixmap iconPixmap;
|
||||
static Pixmap iconsLarge[7] = { 0 };
|
||||
static Pixmap iconsSmall[7] = { 0 };
|
||||
|
||||
typedef enum {
|
||||
FileKindFile,
|
||||
FileKindDirectory,
|
||||
FileKindLink,
|
||||
FileKindBlock,
|
||||
FileKindCharacter,
|
||||
FileKindSocket,
|
||||
FileKindPipe
|
||||
} FileKind;
|
||||
|
||||
typedef struct {
|
||||
Widget widget;
|
||||
FileKind kind;
|
||||
String name;
|
||||
String label;
|
||||
String path;
|
||||
} File;
|
||||
|
||||
void loadIconPixmaps (void);
|
||||
int refreshDirectory ();
|
||||
int makeTrailIn (ConstString path);
|
||||
int makeFilesIn (ConstString directory, Bool showHidden);
|
||||
int changeDirectory (ConstString path);
|
||||
void handleActivate (Widget, XtPointer, XtPointer);
|
||||
FileKind fileKind (ConstString path);
|
||||
File * FileNew (XmdStringMap *set, Widget container, String name, ConstString path);
|
||||
File * FileOfWidget (Widget widget);
|
||||
void FileDelete (XmdStringMap *set, ConstString name);
|
||||
void FileFree (File *this);
|
||||
void FileSetLabel (File *this, ConstString label);
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
trailFiles = XmdStringMapNew();
|
||||
viewFiles = XmdStringMapNew();
|
||||
|
||||
topLevel = XtVaAppInitialize (
|
||||
&application, "FileBrowser",
|
||||
NULL, 0,
|
||||
&argc, argv,
|
||||
NULL,
|
||||
XmNtitle, "File Browser",
|
||||
XmNiconName, "File Browser",
|
||||
XmNwidth, 400,
|
||||
XmNheight, 300,
|
||||
NULL);
|
||||
Widget window = XtVaCreateManagedWidget (
|
||||
"window", xmMainWindowWidgetClass, topLevel,
|
||||
NULL);
|
||||
|
||||
/* menu bar */
|
||||
XmString fileString = XmStringCreateLocalized("File");
|
||||
XmString helpString = XmStringCreateLocalized("Help");
|
||||
Widget menuBar = XmVaCreateSimpleMenuBar (
|
||||
window, "menuBar",
|
||||
XmVaCASCADEBUTTON, fileString, 'F',
|
||||
XmVaCASCADEBUTTON, helpString, 'H',
|
||||
NULL);
|
||||
XmStringFree(fileString);
|
||||
XmStringFree(helpString);
|
||||
XtManageChild(menuBar);
|
||||
|
||||
/* layout form */
|
||||
Widget layout = XtVaCreateWidget (
|
||||
"layout", xmFormWidgetClass, window,
|
||||
XmNorientation, XmVERTICAL,
|
||||
NULL);
|
||||
iconPixmap = XmdLoadBitmapIcon(layout, icon);
|
||||
XtVaSetValues (
|
||||
topLevel,
|
||||
XmNiconPixmap, iconPixmap,
|
||||
NULL);
|
||||
|
||||
/* trail container */
|
||||
Widget trailScroller = XtVaCreateWidget (
|
||||
"trailScroller", xmScrolledWindowWidgetClass, layout,
|
||||
XmNscrollingPolicy, XmAUTOMATIC,
|
||||
XmNscrolledWindowChildType, XmSCROLL_HOR,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
trailContainer = XtVaCreateManagedWidget (
|
||||
"trailContainer", xmContainerWidgetClass, trailScroller,
|
||||
XmNlayoutType, XmOUTLINE,
|
||||
XmNentryViewType, XmSMALL_ICON,
|
||||
NULL);
|
||||
XtAddCallback (
|
||||
trailContainer, XmNdefaultActionCallback,
|
||||
handleActivate,
|
||||
NULL);
|
||||
|
||||
/* file object container */
|
||||
Widget viewScroller = XtVaCreateWidget (
|
||||
"viewScroller", xmScrolledWindowWidgetClass, layout,
|
||||
XmNscrollingPolicy, XmAUTOMATIC,
|
||||
XmNscrolledWindowChildType, XmSCROLL_VERT,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, trailScroller,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
viewContainer = XtVaCreateManagedWidget (
|
||||
"viewContainer", xmContainerWidgetClass, viewScroller,
|
||||
XmNlayoutType, XmSPATIAL,
|
||||
XmNspatialStyle, XmGRID,
|
||||
XmNspatialIncludeModel, XmFIRST_FIT,
|
||||
XmNspatialResizeModel, XmGROW_MINOR,
|
||||
NULL);
|
||||
XtAddCallback (
|
||||
viewContainer, XmNdefaultActionCallback,
|
||||
handleActivate,
|
||||
NULL);
|
||||
|
||||
loadIconPixmaps();
|
||||
refreshDirectory();
|
||||
|
||||
XtManageChild(viewScroller);
|
||||
XtManageChild(trailScroller);
|
||||
XtManageChild(layout);
|
||||
|
||||
XtVaSetValues (
|
||||
window,
|
||||
XmNmenuBar, menuBar,
|
||||
XmNworkWindow, layout,
|
||||
NULL);
|
||||
|
||||
XtRealizeWidget(topLevel);
|
||||
XtAppMainLoop(application);
|
||||
}
|
||||
|
||||
void loadIconPixmaps (void) {
|
||||
#define kind(kind, name) \
|
||||
iconsLarge[FileKind##kind] = XmdLoadBitmapIcon(viewContainer, name); \
|
||||
iconsSmall[FileKind##kind] = XmdLoadBitmapIcon(viewContainer, name##_small)
|
||||
kind(File, file);
|
||||
kind(Directory, directory);
|
||||
kind(Link, link);
|
||||
kind(Block, block);
|
||||
kind(Character, character);
|
||||
kind(Socket, socket);
|
||||
kind(Pipe, pipe);
|
||||
}
|
||||
|
||||
Bool freeFile (XmdStringMap *map, ConstString key, void *value, void *data) {
|
||||
(void)(map);
|
||||
(void)(key);
|
||||
(void)(data);
|
||||
File *this = value;
|
||||
FileFree(this);
|
||||
return True;
|
||||
}
|
||||
|
||||
int refreshDirectory () {
|
||||
char directory[PATH_MAX];
|
||||
getcwd(directory, XtNumber(directory));
|
||||
XtVaSetValues (
|
||||
topLevel,
|
||||
XmNtitle, directory,
|
||||
XmNiconName, directory,
|
||||
NULL);
|
||||
|
||||
int err = 0;
|
||||
XtUnmanageChild(trailContainer); {
|
||||
XmdStringMapIterate(trailFiles, freeFile, NULL);
|
||||
XmdStringMapFree(trailFiles);
|
||||
trailFiles = XmdStringMapNew();
|
||||
err |= makeTrailIn(directory);
|
||||
} XtManageChild(trailContainer);
|
||||
|
||||
XtUnmanageChild(viewContainer); {
|
||||
XmdStringMapIterate(viewFiles, freeFile, NULL);
|
||||
XmdStringMapFree(viewFiles);
|
||||
viewFiles = XmdStringMapNew();
|
||||
err |= makeFilesIn(directory, True);
|
||||
} XtManageChild(viewContainer);
|
||||
return err;
|
||||
}
|
||||
|
||||
int changeDirectory (ConstString path) {
|
||||
int err = chdir(path);
|
||||
if (err) return err;
|
||||
refreshDirectory();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handleActivate (Widget container, XtPointer clientData, XtPointer callData) {
|
||||
(void)(container);
|
||||
(void)(clientData);
|
||||
XmContainerSelectCallbackStruct *event = callData;
|
||||
if (event->selected_item_count < 1) return;
|
||||
|
||||
/* first, if a directory is selected, try to go into it */
|
||||
for (int index = 0; index < event->selected_item_count; index ++) {
|
||||
File *file = FileOfWidget(event->selected_items[index]);
|
||||
if (file == NULL) continue;
|
||||
if (file->kind == FileKindDirectory) {
|
||||
changeDirectory(file->path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* if not, we worry about opening files and stuff */
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
FileKind fileKind (ConstString path) {
|
||||
struct stat info = { 0 };
|
||||
stat(path, &info);
|
||||
if (S_ISDIR (info.st_mode)) return FileKindDirectory;
|
||||
if (S_ISCHR (info.st_mode)) return FileKindCharacter;
|
||||
if (S_ISBLK (info.st_mode)) return FileKindBlock;
|
||||
if (S_ISFIFO(info.st_mode)) return FileKindPipe;
|
||||
if (S_ISLNK (info.st_mode)) return FileKindLink;
|
||||
if (S_ISSOCK(info.st_mode)) return FileKindSocket;
|
||||
return FileKindFile;
|
||||
}
|
||||
|
||||
int makeTrailIn (ConstString cwd) {
|
||||
char name[PATH_MAX] = { 0 }; Cardinal nameIndex = 0;
|
||||
char path[PATH_MAX] = { 0 }; Cardinal pathIndex = 0;
|
||||
|
||||
while (True) {
|
||||
char ch = *(cwd ++);
|
||||
|
||||
if (nameIndex >= XtNumber(name)) return -1;
|
||||
if (pathIndex >= XtNumber(path)) return -1;
|
||||
|
||||
name[ nameIndex] = ch;
|
||||
name[++ nameIndex] = 0;
|
||||
path[ pathIndex] = ch;
|
||||
path[++ pathIndex] = 0;
|
||||
|
||||
if (ch == '/' || ch == 0) {
|
||||
if (nameIndex == 0) {
|
||||
name[0] = '/';
|
||||
name[1] = 0;
|
||||
}
|
||||
|
||||
FileNew(trailFiles, trailContainer, name, path);
|
||||
name[(nameIndex = 0)] = 0;
|
||||
if (ch == 0) return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int makeFilesIn (ConstString directory, Bool showHidden) {
|
||||
struct dirent **entries = NULL;
|
||||
int entriesCount = scandir(directory, &entries, NULL, alphasort);
|
||||
if (entriesCount < 0) {
|
||||
return -1;
|
||||
}
|
||||
for (int index = 0; index < entriesCount; index ++) {
|
||||
struct dirent *entry = entries[index];
|
||||
if (entry->d_name[0] == '.' && !showHidden) {
|
||||
XtFree((char *)(entry));
|
||||
continue;
|
||||
}
|
||||
char filePath[PATH_MAX];
|
||||
snprintf (
|
||||
filePath, XtNumber(filePath),
|
||||
"%s/%s", directory, entry->d_name);
|
||||
|
||||
String fileName = XtNewString(entry->d_name);
|
||||
XtFree((char *)(entry));
|
||||
|
||||
FileNew(viewFiles, viewContainer, fileName, filePath);
|
||||
XtFree(fileName);
|
||||
}
|
||||
XtFree((char *)(entries));
|
||||
return 0;
|
||||
}
|
||||
|
||||
File *FileNew (XmdStringMap *set, Widget container, String name, ConstString path) {
|
||||
File *this = XtNew(File);
|
||||
this->label = NULL;
|
||||
this->name = XtNewString(name);
|
||||
this->path = XtNewString(path);
|
||||
XmString string = XmStringCreateLocalized(name);
|
||||
this->widget = XtVaCreateManagedWidget (
|
||||
"file", xmIconGadgetClass, container,
|
||||
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||
XmNlabelString, string,
|
||||
XmNuserData, (XtPointer)(this),
|
||||
NULL);
|
||||
XmStringFree(string);
|
||||
|
||||
FileKind kind = fileKind(path);
|
||||
XtVaSetValues (
|
||||
this->widget,
|
||||
XmNlargeIconPixmap, iconsLarge[kind],
|
||||
XmNsmallIconPixmap, iconsSmall[kind],
|
||||
NULL);
|
||||
this->kind = kind;
|
||||
|
||||
XmdStringMapSet(set, name, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
File *FileOfWidget (Widget widget) {
|
||||
File *file = NULL;
|
||||
XtVaGetValues(widget, XmNuserData, &file, NULL);
|
||||
return file;
|
||||
}
|
||||
|
||||
void FileDelete (XmdStringMap *set, ConstString name) {
|
||||
FileFree(XmdStringMapSet(set, name, NULL));
|
||||
}
|
||||
|
||||
void FileFree (File *this) {
|
||||
if (this == NULL) return;
|
||||
XtUnmanageChild(this->widget);
|
||||
XtDestroyWidget(this->widget);
|
||||
XtFree((char *)(this->name));
|
||||
XtFree((char *)(this->label));
|
||||
XtFree((char *)(this->path));
|
||||
XtFree((char *)(this));
|
||||
}
|
||||
|
||||
void FileSetLabel (File *this, ConstString label) {
|
||||
XtFree(this->label);
|
||||
this->label = XtNewString(label);
|
||||
|
||||
XmString string = NULL;
|
||||
if (label == NULL) {
|
||||
string = XmStringCreateLocalized(this->name);
|
||||
} else {
|
||||
string = XmStringCreateLocalized(this->label);
|
||||
}
|
||||
XtVaSetValues (
|
||||
this->widget,
|
||||
XmNlabelString, string,
|
||||
NULL);
|
||||
XmStringFree(string);
|
||||
}
|
Loading…
Reference in New Issue
Block a user