Open/Save As completed
Dead keys handled, even if it can be improved Key character change still not implemented git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8454 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,4 +8,4 @@ Preference Keymap :
|
|||||||
KeymapListItem.cpp
|
KeymapListItem.cpp
|
||||||
Keymap.cpp
|
Keymap.cpp
|
||||||
KeymapTextView.cpp
|
KeymapTextView.cpp
|
||||||
: be ;
|
: be tracker ;
|
||||||
|
|||||||
+234
-6
@@ -56,7 +56,6 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, char **chars, int32 *numBytes
|
|||||||
{
|
{
|
||||||
int32 offset = 0;
|
int32 offset = 0;
|
||||||
switch (modifiers & 0xff) {
|
switch (modifiers & 0xff) {
|
||||||
case 0: offset = fKeys.normal_map[keyCode]; break;
|
|
||||||
case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; break;
|
case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; break;
|
||||||
case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; break;
|
case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; break;
|
||||||
case B_CAPS_LOCK|B_SHIFT_KEY: offset = fKeys.caps_shift_map[keyCode]; break;
|
case B_CAPS_LOCK|B_SHIFT_KEY: offset = fKeys.caps_shift_map[keyCode]; break;
|
||||||
@@ -65,6 +64,7 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, char **chars, int32 *numBytes
|
|||||||
case B_OPTION_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_map[keyCode]; break;
|
case B_OPTION_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_map[keyCode]; break;
|
||||||
case B_OPTION_KEY|B_SHIFT_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_shift_map[keyCode]; break;
|
case B_OPTION_KEY|B_SHIFT_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_shift_map[keyCode]; break;
|
||||||
case B_CONTROL_KEY: offset = fKeys.control_map[keyCode]; break;
|
case B_CONTROL_KEY: offset = fKeys.control_map[keyCode]; break;
|
||||||
|
default: offset = fKeys.normal_map[keyCode]; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*numBytes = fChars[offset++];
|
*numBytes = fChars[offset++];
|
||||||
@@ -127,16 +127,51 @@ Keymap::Load(entry_ref &ref)
|
|||||||
for (uint32 i=0; i<sizeof(fKeys)/4; i++)
|
for (uint32 i=0; i<sizeof(fKeys)/4; i++)
|
||||||
((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]);
|
((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]);
|
||||||
|
|
||||||
uint32 chars_size;
|
if (file.Read(&fCharsSize, sizeof(uint32)) < (ssize_t)sizeof(uint32)) {
|
||||||
if (file.Read(&chars_size, sizeof(uint32)) < (ssize_t)sizeof(uint32)) {
|
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
chars_size = B_BENDIAN_TO_HOST_INT32(chars_size);
|
fCharsSize = B_BENDIAN_TO_HOST_INT32(fCharsSize);
|
||||||
if (!fChars)
|
if (!fChars)
|
||||||
delete[] fChars;
|
delete[] fChars;
|
||||||
fChars = new char[chars_size];
|
fChars = new char[fCharsSize];
|
||||||
file.Read(fChars, chars_size);
|
err = file.Read(fChars, fCharsSize);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Keymap::Save(entry_ref &ref)
|
||||||
|
{
|
||||||
|
status_t err;
|
||||||
|
|
||||||
|
BFile file(&ref, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE );
|
||||||
|
if ((err = file.InitCheck()) != B_OK) {
|
||||||
|
printf("error %s\n", strerror(err));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32 i=0; i<sizeof(fKeys)/4; i++)
|
||||||
|
((uint32*)&fKeys)[i] = B_HOST_TO_BENDIAN_INT32(((uint32*)&fKeys)[i]);
|
||||||
|
|
||||||
|
if ((err = file.Write(&fKeys, sizeof(fKeys))) < (ssize_t)sizeof(fKeys)) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32 i=0; i<sizeof(fKeys)/4; i++)
|
||||||
|
((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]);
|
||||||
|
|
||||||
|
fCharsSize = B_HOST_TO_BENDIAN_INT32(fCharsSize);
|
||||||
|
|
||||||
|
if ((err = file.Write(&fCharsSize, sizeof(uint32))) < (ssize_t)sizeof(uint32)) {
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fCharsSize = B_BENDIAN_TO_HOST_INT32(fCharsSize);
|
||||||
|
|
||||||
|
if ((err = file.Write(fChars, fCharsSize)) < (ssize_t)fCharsSize)
|
||||||
|
return err;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -159,3 +194,196 @@ Keymap::IsModifierKey(uint32 keyCode)
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8
|
||||||
|
Keymap::IsDeadKey(uint32 keyCode, uint32 modifiers)
|
||||||
|
{
|
||||||
|
int32 offset;
|
||||||
|
uint32 tableMask = 0;
|
||||||
|
|
||||||
|
switch (modifiers & 0xff) {
|
||||||
|
case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; tableMask = B_SHIFT_TABLE; break;
|
||||||
|
case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; tableMask = B_CAPS_TABLE; break;
|
||||||
|
case B_CAPS_LOCK|B_SHIFT_KEY: offset = fKeys.caps_shift_map[keyCode]; tableMask = B_CAPS_SHIFT_TABLE; break;
|
||||||
|
case B_OPTION_KEY: offset = fKeys.option_map[keyCode]; tableMask = B_OPTION_TABLE; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY: offset = fKeys.option_shift_map[keyCode]; tableMask = B_OPTION_SHIFT_TABLE; break;
|
||||||
|
case B_OPTION_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_map[keyCode]; tableMask = B_OPTION_CAPS_TABLE; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_shift_map[keyCode]; tableMask = B_OPTION_CAPS_SHIFT_TABLE; break;
|
||||||
|
case B_CONTROL_KEY: offset = fKeys.control_map[keyCode]; tableMask = B_CONTROL_TABLE; break;
|
||||||
|
default: offset = fKeys.normal_map[keyCode]; tableMask = B_NORMAL_TABLE; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset<=0)
|
||||||
|
return 0;
|
||||||
|
uint32 numBytes = fChars[offset];
|
||||||
|
|
||||||
|
if (!numBytes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
char chars[4];
|
||||||
|
strncpy(chars, &(fChars[offset+1]), numBytes );
|
||||||
|
chars[numBytes] = 0;
|
||||||
|
|
||||||
|
int32 deadOffsets[] = {
|
||||||
|
fKeys.acute_dead_key[1],
|
||||||
|
fKeys.grave_dead_key[1],
|
||||||
|
fKeys.circumflex_dead_key[1],
|
||||||
|
fKeys.dieresis_dead_key[1],
|
||||||
|
fKeys.tilde_dead_key[1]
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32 deadTables[] = {
|
||||||
|
fKeys.acute_tables,
|
||||||
|
fKeys.grave_tables,
|
||||||
|
fKeys.circumflex_tables,
|
||||||
|
fKeys.dieresis_tables,
|
||||||
|
fKeys.tilde_tables
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int32 i=0; i<5; i++) {
|
||||||
|
if ((deadTables[i] & tableMask) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (offset == deadOffsets[i])
|
||||||
|
return i+1;
|
||||||
|
|
||||||
|
uint32 deadNumBytes = fChars[deadOffsets[i]];
|
||||||
|
|
||||||
|
if (!deadNumBytes)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp(chars, &(fChars[deadOffsets[i]+1]), deadNumBytes ) == 0) {
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Keymap::IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey)
|
||||||
|
{
|
||||||
|
if (!activeDeadKey)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int32 offset;
|
||||||
|
|
||||||
|
switch (modifiers & 0xff) {
|
||||||
|
case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; break;
|
||||||
|
case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; break;
|
||||||
|
case B_CAPS_LOCK|B_SHIFT_KEY: offset = fKeys.caps_shift_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY: offset = fKeys.option_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY: offset = fKeys.option_shift_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_shift_map[keyCode]; break;
|
||||||
|
case B_CONTROL_KEY: offset = fKeys.control_map[keyCode]; break;
|
||||||
|
default: offset = fKeys.normal_map[keyCode]; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 numBytes = fChars[offset];
|
||||||
|
|
||||||
|
if (!numBytes)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char chars[4];
|
||||||
|
strncpy(chars, &(fChars[offset+1]), numBytes );
|
||||||
|
chars[numBytes] = 0;
|
||||||
|
|
||||||
|
int32* deadOffsets[] = {
|
||||||
|
fKeys.acute_dead_key,
|
||||||
|
fKeys.grave_dead_key,
|
||||||
|
fKeys.circumflex_dead_key,
|
||||||
|
fKeys.dieresis_dead_key,
|
||||||
|
fKeys.tilde_dead_key
|
||||||
|
};
|
||||||
|
|
||||||
|
int32 *deadOffset = deadOffsets[activeDeadKey-1];
|
||||||
|
|
||||||
|
for (int32 i=0; i<32; i++) {
|
||||||
|
if (offset == deadOffset[i])
|
||||||
|
return i+1;
|
||||||
|
|
||||||
|
uint32 deadNumBytes = fChars[deadOffset[i]+1];
|
||||||
|
|
||||||
|
if (!deadNumBytes)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp(chars, &(fChars[deadOffset[i]]), deadNumBytes ) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Keymap::DeadKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes)
|
||||||
|
{
|
||||||
|
int32 offset;
|
||||||
|
|
||||||
|
*numBytes = 0;
|
||||||
|
|
||||||
|
switch (modifiers & 0xff) {
|
||||||
|
case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; break;
|
||||||
|
case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; break;
|
||||||
|
case B_CAPS_LOCK|B_SHIFT_KEY: offset = fKeys.caps_shift_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY: offset = fKeys.option_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY: offset = fKeys.option_shift_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_map[keyCode]; break;
|
||||||
|
case B_OPTION_KEY|B_SHIFT_KEY|B_CAPS_LOCK: offset = fKeys.option_caps_shift_map[keyCode]; break;
|
||||||
|
case B_CONTROL_KEY: offset = fKeys.control_map[keyCode]; break;
|
||||||
|
default: offset = fKeys.normal_map[keyCode]; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 numBytes2 = fChars[offset];
|
||||||
|
|
||||||
|
if (!numBytes2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char chars2[4];
|
||||||
|
strncpy(chars2, &(fChars[offset+1]), numBytes2 );
|
||||||
|
chars2[numBytes2] = 0;
|
||||||
|
|
||||||
|
int32 *dead_key;
|
||||||
|
switch(activeDeadKey) {
|
||||||
|
case 1: dead_key = fKeys.acute_dead_key; break;
|
||||||
|
case 2: dead_key = fKeys.grave_dead_key; break;
|
||||||
|
case 3: dead_key = fKeys.circumflex_dead_key; break;
|
||||||
|
case 4: dead_key = fKeys.dieresis_dead_key; break;
|
||||||
|
case 5: dead_key = fKeys.tilde_dead_key; break;
|
||||||
|
//default: return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32 i=0; i<32; i++) {
|
||||||
|
if (strncmp(chars2, &(fChars[dead_key[i]+1]), numBytes2 ) == 0) {
|
||||||
|
*numBytes = fChars[dead_key[i+1]];
|
||||||
|
|
||||||
|
switch( *numBytes ) {
|
||||||
|
case 0:
|
||||||
|
// Not mapped
|
||||||
|
*chars = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 1-, 2-, 3-, or 4-byte UTF-8 character
|
||||||
|
{
|
||||||
|
char *str = *chars = new char[*numBytes + 1];
|
||||||
|
strncpy(str, &fChars[dead_key[i+1]+1], *numBytes );
|
||||||
|
str[*numBytes] = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t _restore_key_map_();
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Keymap::Use()
|
||||||
|
{
|
||||||
|
return _restore_key_map_();
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,12 +23,18 @@ class Keymap
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
status_t Load(entry_ref &ref);
|
status_t Load(entry_ref &ref);
|
||||||
|
status_t Save(entry_ref &ref);
|
||||||
void DumpKeymap();
|
void DumpKeymap();
|
||||||
void GetChars(uint32 keyCode, uint32 modifiers, char **chars, int32 *numBytes);
|
void GetChars(uint32 keyCode, uint32 modifiers, char **chars, int32 *numBytes);
|
||||||
bool IsModifierKey(uint32 keyCode);
|
bool IsModifierKey(uint32 keyCode);
|
||||||
|
uint8 IsDeadKey(uint32 keyCode, uint32 modifiers);
|
||||||
|
bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey);
|
||||||
|
void DeadKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes);
|
||||||
|
status_t Use();
|
||||||
private:
|
private:
|
||||||
char *fChars;
|
char *fChars;
|
||||||
key_map fKeys;
|
key_map fKeys;
|
||||||
|
uint32 fCharsSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,11 +116,11 @@ resource file_types message
|
|||||||
"types" = "application/x-vnd.Be-kmap"
|
"types" = "application/x-vnd.Be-kmap"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource app_signature "application/x-vnd.OBOS.Keymap";
|
resource app_signature "application/x-vnd.haiku-Keymap";
|
||||||
|
|
||||||
resource app_version
|
resource app_version
|
||||||
{
|
{
|
||||||
short_info = "OBOS-Keymap",
|
short_info = "Haiku-Keymap",
|
||||||
long_info = "Haiku version of Keymap"
|
long_info = "Haiku version of Keymap"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <storage/Entry.h>
|
#include <storage/Entry.h>
|
||||||
|
|
||||||
#define APP_SIGNATURE "application/x-vnd.OpenBeOS-Keymap"
|
#define APP_SIGNATURE "application/x-vnd.haiku-Keymap"
|
||||||
|
|
||||||
class KeymapWindow;
|
class KeymapWindow;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <string.h>
|
||||||
#include "KeymapWindow.h"
|
#include "KeymapWindow.h"
|
||||||
#include "KeymapListItem.h"
|
#include "KeymapListItem.h"
|
||||||
#include "KeymapApplication.h"
|
#include "KeymapApplication.h"
|
||||||
@@ -68,6 +69,7 @@ KeymapWindow::KeymapWindow( BRect frame )
|
|||||||
|
|
||||||
fMapView = new MapView(BRect(150,9,600,189), "mapView", &fCurrentMap);
|
fMapView = new MapView(BRect(150,9,600,189), "mapView", &fCurrentMap);
|
||||||
placeholderView->AddChild(fMapView);
|
placeholderView->AddChild(fMapView);
|
||||||
|
SetPulseRate(10000);
|
||||||
|
|
||||||
BMenuItem *item = fFontMenu->FindMarked();
|
BMenuItem *item = fFontMenu->FindMarked();
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -84,9 +86,26 @@ KeymapWindow::KeymapWindow( BRect frame )
|
|||||||
new BMessage( REVERT ));
|
new BMessage( REVERT ));
|
||||||
placeholderView->AddChild( fRevertButton );
|
placeholderView->AddChild( fRevertButton );
|
||||||
|
|
||||||
|
BPath path;
|
||||||
|
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||||
|
path.Append("Keymap");
|
||||||
|
|
||||||
|
entry_ref ref;
|
||||||
|
get_ref_for_path(path.Path(), &ref);
|
||||||
|
|
||||||
|
fOpenPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), &ref,
|
||||||
|
B_FILE_NODE, false, NULL);
|
||||||
|
fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), &ref,
|
||||||
|
B_FILE_NODE, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeymapWindow::~KeymapWindow(void)
|
||||||
|
{
|
||||||
|
delete fOpenPanel;
|
||||||
|
delete fSavePanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BMenuBar *
|
BMenuBar *
|
||||||
KeymapWindow::AddMenuBar()
|
KeymapWindow::AddMenuBar()
|
||||||
@@ -198,9 +217,6 @@ KeymapWindow::AddMaps(BView *placeholderView)
|
|||||||
FillSystemMaps();
|
FillSystemMaps();
|
||||||
|
|
||||||
FillUserMaps();
|
FillUserMaps();
|
||||||
|
|
||||||
fUserListView->Select(0);
|
|
||||||
fCurrentMap.Load(((KeymapListItem*)fUserListView->FirstItem())->KeymapEntry());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,23 +234,50 @@ void
|
|||||||
KeymapWindow::MessageReceived( BMessage* message )
|
KeymapWindow::MessageReceived( BMessage* message )
|
||||||
{
|
{
|
||||||
switch( message->what ) {
|
switch( message->what ) {
|
||||||
|
case B_SIMPLE_DATA:
|
||||||
|
case B_REFS_RECEIVED:
|
||||||
|
{
|
||||||
|
entry_ref ref;
|
||||||
|
int32 i = 0;
|
||||||
|
while (message->FindRef("refs", i++, &ref) == B_OK) {
|
||||||
|
fCurrentMap.Load(ref);
|
||||||
|
}
|
||||||
|
fMapView->Invalidate();
|
||||||
|
fSystemListView->DeselectAll();
|
||||||
|
fUserListView->DeselectAll();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case B_SAVE_REQUESTED:
|
||||||
|
{
|
||||||
|
entry_ref ref;
|
||||||
|
const char *name;
|
||||||
|
if ((message->FindRef("directory", &ref) == B_OK)
|
||||||
|
&& (message->FindString("name", &name) == B_OK)) {
|
||||||
|
|
||||||
|
BDirectory directory(&ref);
|
||||||
|
BEntry entry(&directory, name);
|
||||||
|
entry.GetRef(&ref);
|
||||||
|
fCurrentMap.Save(ref);
|
||||||
|
|
||||||
|
FillUserMaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case MENU_FILE_OPEN:
|
case MENU_FILE_OPEN:
|
||||||
|
fOpenPanel->Show();
|
||||||
break;
|
break;
|
||||||
case MENU_FILE_SAVE:
|
case MENU_FILE_SAVE:
|
||||||
break;
|
break;
|
||||||
case MENU_FILE_SAVE_AS:
|
case MENU_FILE_SAVE_AS:
|
||||||
|
fSavePanel->Show();
|
||||||
break;
|
break;
|
||||||
case MENU_EDIT_UNDO:
|
case MENU_EDIT_UNDO:
|
||||||
break;
|
|
||||||
case MENU_EDIT_CUT:
|
case MENU_EDIT_CUT:
|
||||||
break;
|
|
||||||
case MENU_EDIT_COPY:
|
case MENU_EDIT_COPY:
|
||||||
break;
|
|
||||||
case MENU_EDIT_PASTE:
|
case MENU_EDIT_PASTE:
|
||||||
break;
|
|
||||||
case MENU_EDIT_CLEAR:
|
case MENU_EDIT_CLEAR:
|
||||||
break;
|
|
||||||
case MENU_EDIT_SELECT_ALL:
|
case MENU_EDIT_SELECT_ALL:
|
||||||
|
fMapView->MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
case MENU_FONT_CHANGED:
|
case MENU_FONT_CHANGED:
|
||||||
{
|
{
|
||||||
@@ -286,13 +329,33 @@ KeymapWindow::MessageReceived( BMessage* message )
|
|||||||
void
|
void
|
||||||
KeymapWindow::UseKeymap()
|
KeymapWindow::UseKeymap()
|
||||||
{
|
{
|
||||||
//TODO
|
BPath path;
|
||||||
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
path.Append("Key_map");
|
||||||
|
|
||||||
|
entry_ref ref;
|
||||||
|
get_ref_for_path(path.Path(), &ref);
|
||||||
|
|
||||||
|
status_t err;
|
||||||
|
if ((err = fCurrentMap.Save(ref)) != B_OK) {
|
||||||
|
printf("error when saving : %s", strerror(err));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fCurrentMap.Use();
|
||||||
|
|
||||||
|
fUserListView->Select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KeymapWindow::FillSystemMaps()
|
KeymapWindow::FillSystemMaps()
|
||||||
{
|
{
|
||||||
|
BListItem *item;
|
||||||
|
while ((item = fSystemListView->RemoveItem((int32)0)))
|
||||||
|
delete item;
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_BEOS_ETC_DIRECTORY, &path)!=B_OK)
|
if (find_directory(B_BEOS_ETC_DIRECTORY, &path)!=B_OK)
|
||||||
return;
|
return;
|
||||||
@@ -312,6 +375,10 @@ KeymapWindow::FillSystemMaps()
|
|||||||
void
|
void
|
||||||
KeymapWindow::FillUserMaps()
|
KeymapWindow::FillUserMaps()
|
||||||
{
|
{
|
||||||
|
BListItem *item;
|
||||||
|
while ((item = fUserListView->RemoveItem((int32)0)))
|
||||||
|
delete item;
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK)
|
||||||
return;
|
return;
|
||||||
@@ -334,6 +401,8 @@ KeymapWindow::FillUserMaps()
|
|||||||
while( directory.GetNextRef(&ref) == B_OK ) {
|
while( directory.GetNextRef(&ref) == B_OK ) {
|
||||||
fUserListView->AddItem(new KeymapListItem(ref));
|
fUserListView->AddItem(new KeymapListItem(ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fUserListView->Select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -345,7 +414,7 @@ KeymapWindow::CurrentMap()
|
|||||||
|
|
||||||
|
|
||||||
MapView::MapView(BRect rect, const char *name, Keymap* keymap)
|
MapView::MapView(BRect rect, const char *name, Keymap* keymap)
|
||||||
: BControl(rect, name, NULL, NULL, B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW),
|
: BControl(rect, name, NULL, NULL, B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW|B_PULSE_NEEDED),
|
||||||
fCurrentFont(*be_plain_font),
|
fCurrentFont(*be_plain_font),
|
||||||
fCurrentMap(keymap),
|
fCurrentMap(keymap),
|
||||||
fCurrentMouseKey(0)
|
fCurrentMouseKey(0)
|
||||||
@@ -716,17 +785,15 @@ MapView::MapView(BRect rect, const char *name, Keymap* keymap)
|
|||||||
|
|
||||||
fKeysVertical[0x5e] = true;
|
fKeysVertical[0x5e] = true;
|
||||||
|
|
||||||
|
fActiveDeadKey = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MapView::AttachedToWindow()
|
MapView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
SetEventMask(B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
|
SetEventMask(B_KEYBOARD_EVENTS, 0);
|
||||||
fTextView->SetViewColor(255,255,255);
|
fTextView->SetViewColor(255,255,255);
|
||||||
fTextView->SetStylable(true);
|
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,43 +1116,56 @@ MapView::DrawKey(uint32 keyCode)
|
|||||||
|
|
||||||
bool pressed = (fOldKeyInfo.key_states[keyCode>>3] & (1 << (7 - keyCode%8))) || (keyCode == fCurrentMouseKey);
|
bool pressed = (fOldKeyInfo.key_states[keyCode>>3] & (1 << (7 - keyCode%8))) || (keyCode == fCurrentMouseKey);
|
||||||
bool vertical = fKeysVertical[keyCode];
|
bool vertical = fKeysVertical[keyCode];
|
||||||
|
int32 deadKey = fCurrentMap->IsDeadKey(keyCode, fOldKeyInfo.modifiers);
|
||||||
|
bool secondDeadKey = fCurrentMap->IsDeadSecondKey(keyCode, fOldKeyInfo.modifiers, fActiveDeadKey);
|
||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
r.InsetBySelf(1,1);
|
r.InsetBySelf(1,1);
|
||||||
|
if (secondDeadKey) {
|
||||||
|
SetHighColor(255,0,0);
|
||||||
|
StrokeRect(r);
|
||||||
|
r.InsetBySelf(1,1);
|
||||||
|
StrokeRect(r);
|
||||||
|
} else if (deadKey>0) {
|
||||||
|
SetHighColor(255,255,0);
|
||||||
|
StrokeRect(r);
|
||||||
|
r.InsetBySelf(1,1);
|
||||||
|
StrokeRect(r);
|
||||||
|
} else {
|
||||||
|
|
||||||
SetHighColor(64,64,64);
|
SetHighColor(64,64,64);
|
||||||
StrokeRect(r);
|
StrokeRect(r);
|
||||||
SetHighColor(200,200,200);
|
|
||||||
StrokeLine(BPoint(r.left, r.bottom-1), r.LeftTop());
|
BeginLineArray(14);
|
||||||
StrokeLine(BPoint(r.left+3, r.top));
|
rgb_color color1 = {200,200,200};
|
||||||
SetHighColor(184,184,184);
|
AddLine(BPoint(r.left, r.bottom-1), r.LeftTop(), color1);
|
||||||
StrokeLine(BPoint(r.left+6, r.top));
|
AddLine(r.LeftTop(), BPoint(r.left+3, r.top), color1);
|
||||||
SetHighColor(168,168,168);
|
rgb_color color2 = {184,184,184};
|
||||||
StrokeLine(BPoint(r.left+9, r.top));
|
AddLine(BPoint(r.left+3, r.top), BPoint(r.left+6, r.top), color2);
|
||||||
SetHighColor(152,152,152);
|
rgb_color color3 = {168,168,168};
|
||||||
StrokeLine(BPoint(r.right-1, r.top));
|
AddLine(BPoint(r.left+6, r.top), BPoint(r.left+9, r.top), color3);
|
||||||
|
rgb_color color4 = {152,152,152};
|
||||||
|
AddLine(BPoint(r.left+9, r.top), BPoint(r.right-1, r.top), color4);
|
||||||
|
|
||||||
r.InsetBySelf(1,1);
|
r.InsetBySelf(1,1);
|
||||||
SetHighColor(255,255,255);
|
SetHighColor(255,255,255);
|
||||||
StrokeRect(r);
|
StrokeRect(r);
|
||||||
SetHighColor(160,160,160);
|
|
||||||
StrokeLine(r.LeftBottom(), r.LeftBottom());
|
|
||||||
SetHighColor(96,96,96);
|
|
||||||
StrokeLine(r.RightBottom());
|
|
||||||
SetHighColor(64,64,64);
|
|
||||||
StrokeLine(BPoint(r.right, r.bottom-1));
|
|
||||||
SetHighColor(96,96,96);
|
|
||||||
StrokeLine(BPoint(r.right, r.top-1));
|
|
||||||
SetHighColor(160,160,160);
|
|
||||||
StrokeLine(r.RightTop());
|
|
||||||
|
|
||||||
SetHighColor(255,255,255);
|
rgb_color color6 = {96,96,96};
|
||||||
StrokeLine(BPoint(r.left+1, r.bottom-1), BPoint(r.left+2, r.bottom-1));
|
AddLine(r.LeftBottom(), r.RightBottom(), color6);
|
||||||
SetHighColor(200,200,200);
|
rgb_color color5 = {160,160,160};
|
||||||
StrokeLine(BPoint(r.right-1, r.bottom-1));
|
AddLine(r.LeftBottom(), r.LeftBottom(), color5);
|
||||||
SetHighColor(160,160,160);
|
rgb_color color7 = {64,64,64};
|
||||||
StrokeLine(BPoint(r.right-1, r.bottom-2));
|
AddLine(r.RightBottom(), BPoint(r.right, r.bottom-1), color7);
|
||||||
SetHighColor(200,200,200);
|
AddLine(BPoint(r.right, r.bottom-1), BPoint(r.right, r.top-1), color6);
|
||||||
StrokeLine(BPoint(r.right-1, r.top+1));
|
AddLine(BPoint(r.right, r.top-1), r.RightTop(), color5);
|
||||||
|
rgb_color color8 = {255,255,255};
|
||||||
|
AddLine(BPoint(r.left+1, r.bottom-1), BPoint(r.left+2, r.bottom-1), color8);
|
||||||
|
AddLine(BPoint(r.left+2, r.bottom-1), BPoint(r.right-1, r.bottom-1), color1);
|
||||||
|
AddLine(BPoint(r.right-1, r.bottom-1), BPoint(r.right-1, r.bottom-2), color5);
|
||||||
|
AddLine(BPoint(r.right-1, r.bottom-2), BPoint(r.right-1, r.top+1), color1);
|
||||||
|
EndLineArray();
|
||||||
|
}
|
||||||
|
|
||||||
r.InsetBySelf(1,1);
|
r.InsetBySelf(1,1);
|
||||||
r.bottom -= 1;
|
r.bottom -= 1;
|
||||||
@@ -1127,6 +1207,18 @@ MapView::DrawKey(uint32 keyCode)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r.InsetBySelf(1,1);
|
r.InsetBySelf(1,1);
|
||||||
|
|
||||||
|
if (secondDeadKey) {
|
||||||
|
SetHighColor(255,0,0);
|
||||||
|
StrokeRect(r);
|
||||||
|
r.InsetBySelf(1,1);
|
||||||
|
StrokeRect(r);
|
||||||
|
} else if (deadKey>0) {
|
||||||
|
SetHighColor(255,255,0);
|
||||||
|
StrokeRect(r);
|
||||||
|
r.InsetBySelf(1,1);
|
||||||
|
StrokeRect(r);
|
||||||
|
} else {
|
||||||
SetHighColor(48,48,48);
|
SetHighColor(48,48,48);
|
||||||
StrokeRect(r);
|
StrokeRect(r);
|
||||||
|
|
||||||
@@ -1149,6 +1241,7 @@ MapView::DrawKey(uint32 keyCode)
|
|||||||
rgb_color color4 = {160,160,160};
|
rgb_color color4 = {160,160,160};
|
||||||
AddLine(r.RightTop(), r.RightTop(), color4);
|
AddLine(r.RightTop(), r.RightTop(), color4);
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
|
}
|
||||||
|
|
||||||
r.InsetBySelf(1,1);
|
r.InsetBySelf(1,1);
|
||||||
SetHighColor(112,112,112);
|
SetHighColor(112,112,112);
|
||||||
@@ -1163,7 +1256,19 @@ MapView::DrawKey(uint32 keyCode)
|
|||||||
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, &str, &numBytes);
|
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, &str, &numBytes);
|
||||||
if (str) {
|
if (str) {
|
||||||
bool hasGlyphs;
|
bool hasGlyphs;
|
||||||
|
if (deadKey>0) {
|
||||||
|
delete str;
|
||||||
|
hasGlyphs = true;
|
||||||
|
switch (deadKey) {
|
||||||
|
case 1: str = strdup("'"); break;
|
||||||
|
case 2: str = strdup("`"); break;
|
||||||
|
case 3: str = strdup("^"); break;
|
||||||
|
case 4: str = strdup("\""); break;
|
||||||
|
case 5: str = strdup("~"); break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
fCurrentFont.GetHasGlyphs(str, 1, &hasGlyphs);
|
fCurrentFont.GetHasGlyphs(str, 1, &hasGlyphs);
|
||||||
|
|
||||||
if (hasGlyphs) {
|
if (hasGlyphs) {
|
||||||
SetFont(&fCurrentFont);
|
SetFont(&fCurrentFont);
|
||||||
SetDrawingMode(B_OP_COPY);
|
SetDrawingMode(B_OP_COPY);
|
||||||
@@ -1175,6 +1280,7 @@ MapView::DrawKey(uint32 keyCode)
|
|||||||
DrawString(str, point);
|
DrawString(str, point);
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
}
|
}
|
||||||
|
delete str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1198,6 +1304,24 @@ void
|
|||||||
MapView::MessageReceived(BMessage *msg)
|
MapView::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
|
case MENU_EDIT_UNDO:
|
||||||
|
fTextView->Undo(be_clipboard);
|
||||||
|
break;
|
||||||
|
case MENU_EDIT_CUT:
|
||||||
|
fTextView->Cut(be_clipboard);
|
||||||
|
break;
|
||||||
|
case MENU_EDIT_COPY:
|
||||||
|
fTextView->Copy(be_clipboard);
|
||||||
|
break;
|
||||||
|
case MENU_EDIT_PASTE:
|
||||||
|
fTextView->Paste(be_clipboard);
|
||||||
|
break;
|
||||||
|
case MENU_EDIT_CLEAR:
|
||||||
|
fTextView->Clear();
|
||||||
|
break;
|
||||||
|
case MENU_EDIT_SELECT_ALL:
|
||||||
|
fTextView->SelectAll();
|
||||||
|
break;
|
||||||
case B_KEY_DOWN:
|
case B_KEY_DOWN:
|
||||||
case B_KEY_UP:
|
case B_KEY_UP:
|
||||||
case B_UNMAPPED_KEY_DOWN:
|
case B_UNMAPPED_KEY_DOWN:
|
||||||
@@ -1207,14 +1331,19 @@ MapView::MessageReceived(BMessage *msg)
|
|||||||
const uint8 *states;
|
const uint8 *states;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
|
||||||
if ((msg->FindData("states", 'UBYT', (const void **)&states, &size)==B_OK)
|
//msg->PrintToStream();
|
||||||
&& (msg->FindInt32("modifiers", (int32 *)&info.modifiers) == B_OK)) {
|
|
||||||
|
if ((msg->FindData("states", 'UBYT', (const void **)&states, &size)!=B_OK)
|
||||||
|
|| (msg->FindInt32("modifiers", (int32 *)&info.modifiers)!=B_OK))
|
||||||
|
break;
|
||||||
|
|
||||||
if (fOldKeyInfo.modifiers != info.modifiers) {
|
if (fOldKeyInfo.modifiers != info.modifiers) {
|
||||||
fOldKeyInfo.modifiers = info.modifiers;
|
fOldKeyInfo.modifiers = info.modifiers;
|
||||||
for (int8 i=0; i<16; i++)
|
for (int8 i=0; i<16; i++)
|
||||||
fOldKeyInfo.key_states[i] = states[i];
|
fOldKeyInfo.key_states[i] = states[i];
|
||||||
Invalidate();
|
Invalidate();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int32 keyCode = -1;
|
int32 keyCode = -1;
|
||||||
for (int8 i=0; i<16; i++)
|
for (int8 i=0; i<16; i++)
|
||||||
if (fOldKeyInfo.key_states[i] != states[i]) {
|
if (fOldKeyInfo.key_states[i] != states[i]) {
|
||||||
@@ -1228,6 +1357,12 @@ MapView::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fActiveDeadKey) {
|
||||||
|
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
if (keyCode<0)
|
if (keyCode<0)
|
||||||
for (int8 i=0; i<16; i++) {
|
for (int8 i=0; i<16; i++) {
|
||||||
uint8 stbits = states[i];
|
uint8 stbits = states[i];
|
||||||
@@ -1241,16 +1376,32 @@ MapView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Window()->IsActive()
|
if (Window()->IsActive()
|
||||||
&& msg->what == B_KEY_DOWN) {
|
&& msg->what == B_KEY_DOWN) {
|
||||||
fTextView->MakeFocus();
|
fTextView->MakeFocus();
|
||||||
char *str;
|
char *str;
|
||||||
int32 numBytes;
|
int32 numBytes;
|
||||||
|
if (fActiveDeadKey) {
|
||||||
|
fCurrentMap->DeadKey(keyCode, fOldKeyInfo.modifiers, fActiveDeadKey, &str, &numBytes);
|
||||||
|
if (numBytes>0) {
|
||||||
|
fTextView->FakeKeyDown(str, numBytes);
|
||||||
|
}
|
||||||
|
fActiveDeadKey = 0;
|
||||||
|
Invalidate();
|
||||||
|
} else {
|
||||||
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, &str, &numBytes);
|
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, &str, &numBytes);
|
||||||
if (numBytes>0)
|
fActiveDeadKey = fCurrentMap->IsDeadKey(keyCode, fOldKeyInfo.modifiers);
|
||||||
|
if (fActiveDeadKey)
|
||||||
|
Invalidate();
|
||||||
|
else if (numBytes>0) {
|
||||||
fTextView->FakeKeyDown(str, numBytes);
|
fTextView->FakeKeyDown(str, numBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete str;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1287,11 +1438,13 @@ MapView::MouseDown(BPoint point)
|
|||||||
if (fKeysRect[i].Contains(point)) {
|
if (fKeysRect[i].Contains(point)) {
|
||||||
fCurrentMouseKey = i;
|
fCurrentMouseKey = i;
|
||||||
DrawKey(fCurrentMouseKey);
|
DrawKey(fCurrentMouseKey);
|
||||||
char *str;
|
char *str = NULL;
|
||||||
int32 numBytes;
|
int32 numBytes;
|
||||||
fCurrentMap->GetChars(fCurrentMouseKey, fOldKeyInfo.modifiers, &str, &numBytes);
|
fCurrentMap->GetChars(fCurrentMouseKey, fOldKeyInfo.modifiers, &str, &numBytes);
|
||||||
if (numBytes>0)
|
if (numBytes>0) {
|
||||||
fTextView->FakeKeyDown(str, numBytes);
|
fTextView->FakeKeyDown(str, numBytes);
|
||||||
|
delete str;
|
||||||
|
}
|
||||||
SetTracking(true);
|
SetTracking(true);
|
||||||
SetMouseEventMask(B_POINTER_EVENTS,
|
SetMouseEventMask(B_POINTER_EVENTS,
|
||||||
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
||||||
@@ -1321,11 +1474,13 @@ MapView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
|
|||||||
fCurrentMouseKey = i;
|
fCurrentMouseKey = i;
|
||||||
DrawKey(value);
|
DrawKey(value);
|
||||||
DrawKey(fCurrentMouseKey);
|
DrawKey(fCurrentMouseKey);
|
||||||
char *str;
|
char *str = NULL;
|
||||||
int32 numBytes;
|
int32 numBytes;
|
||||||
fCurrentMap->GetChars(fCurrentMouseKey, fOldKeyInfo.modifiers, &str, &numBytes);
|
fCurrentMap->GetChars(fCurrentMouseKey, fOldKeyInfo.modifiers, &str, &numBytes);
|
||||||
if (numBytes>0)
|
if (numBytes>0) {
|
||||||
fTextView->FakeKeyDown(str, numBytes);
|
fTextView->FakeKeyDown(str, numBytes);
|
||||||
|
delete str;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1333,9 +1488,10 @@ MapView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
|
|||||||
BControl::MouseMoved(point, transit, msg);
|
BControl::MouseMoved(point, transit, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MapView::SetFontFamily(const font_family family)
|
MapView::SetFontFamily(const font_family family)
|
||||||
{
|
{
|
||||||
fCurrentFont.SetFamilyAndStyle(family, NULL);
|
fCurrentFont.SetFamilyAndStyle(family, NULL);
|
||||||
fTextView->SetFont(&fCurrentFont);
|
fTextView->SetFontAndColor(&fCurrentFont);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define KEYMAP_WINDOW_H
|
#define KEYMAP_WINDOW_H
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
|
#include <FilePanel.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include "KeymapTextView.h"
|
#include "KeymapTextView.h"
|
||||||
@@ -44,6 +45,7 @@ public:
|
|||||||
void MouseDown(BPoint point);
|
void MouseDown(BPoint point);
|
||||||
void MouseUp(BPoint point);
|
void MouseUp(BPoint point);
|
||||||
void MouseMoved(BPoint point, uint32 transit, const BMessage *msg);
|
void MouseMoved(BPoint point, uint32 transit, const BMessage *msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
key_info fOldKeyInfo;
|
key_info fOldKeyInfo;
|
||||||
BRect fKeysRect[128];
|
BRect fKeysRect[128];
|
||||||
@@ -54,13 +56,14 @@ private:
|
|||||||
Keymap *fCurrentMap;
|
Keymap *fCurrentMap;
|
||||||
KeymapTextView *fTextView;
|
KeymapTextView *fTextView;
|
||||||
uint32 fCurrentMouseKey;
|
uint32 fCurrentMouseKey;
|
||||||
|
uint8 fActiveDeadKey; // 0 : none, 1 : acute , ...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class KeymapWindow : public BWindow {
|
class KeymapWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
KeymapWindow( BRect frame );
|
KeymapWindow( BRect frame );
|
||||||
|
~KeymapWindow();
|
||||||
bool QuitRequested();
|
bool QuitRequested();
|
||||||
void MessageReceived( BMessage* message );
|
void MessageReceived( BMessage* message );
|
||||||
|
|
||||||
@@ -84,6 +87,9 @@ protected:
|
|||||||
BEntry* CurrentMap();
|
BEntry* CurrentMap();
|
||||||
|
|
||||||
Keymap fCurrentMap;
|
Keymap fCurrentMap;
|
||||||
|
|
||||||
|
BFilePanel *fOpenPanel; // the file panel to open
|
||||||
|
BFilePanel *fSavePanel; // the file panel to save
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEYMAP_WINDOW_H
|
#endif // KEYMAP_WINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user