textview enhancements, still need to have mouse working
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8398 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,4 +7,5 @@ Preference Keymap :
|
|||||||
KeymapWindow.cpp
|
KeymapWindow.cpp
|
||||||
KeymapListItem.cpp
|
KeymapListItem.cpp
|
||||||
Keymap.cpp
|
Keymap.cpp
|
||||||
|
KeymapTextView.cpp
|
||||||
: be ;
|
: be ;
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004, Haiku
|
||||||
|
//
|
||||||
|
// This software is part of the Haiku distribution and is covered
|
||||||
|
// by the Haiku license.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// File: KeymapTextView.cpp
|
||||||
|
// Author: Jérôme Duval
|
||||||
|
// Description: Keymap Preferences
|
||||||
|
// Created : July 14, 2004
|
||||||
|
//
|
||||||
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
|
||||||
|
#include "KeymapTextView.h"
|
||||||
|
|
||||||
|
|
||||||
|
KeymapTextView::KeymapTextView(BRect frame,
|
||||||
|
const char *name,
|
||||||
|
BRect textRect,
|
||||||
|
uint32 resizeMask,
|
||||||
|
uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED) :
|
||||||
|
BTextView(frame, name, textRect, resizeMask, flags)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
KeymapTextView::KeyDown(const char *bytes, int32 numBytes)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
KeymapTextView::FakeKeyDown(const char *bytes, int32 numBytes)
|
||||||
|
{
|
||||||
|
BTextView::KeyDown(bytes, numBytes);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004, Haiku
|
||||||
|
//
|
||||||
|
// This software is part of the Haiku distribution and is covered
|
||||||
|
// by the Haiku license.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// File: KeymapTextView.h
|
||||||
|
// Author: Jérôme Duval
|
||||||
|
// Description: Keymap Preferences
|
||||||
|
// Created : July 14, 2004
|
||||||
|
//
|
||||||
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
|
||||||
|
#ifndef KEYMAPTEXTVIEW_H
|
||||||
|
#define KEYMAPTEXTVIEW_H
|
||||||
|
|
||||||
|
#include <TextView.h>
|
||||||
|
|
||||||
|
class KeymapTextView : public BTextView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KeymapTextView(BRect frame,
|
||||||
|
const char *name,
|
||||||
|
BRect textRect,
|
||||||
|
uint32 resizeMask,
|
||||||
|
uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
|
||||||
|
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||||
|
virtual void FakeKeyDown(const char *bytes, int32 numBytes);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //KEYMAPTEXTVIEW_H
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Clipboard.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -57,9 +58,9 @@ KeymapWindow::KeymapWindow( BRect frame )
|
|||||||
// The view to hold all but the menu bar
|
// The view to hold all but the menu bar
|
||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
bounds.top = menubar->Bounds().bottom + 1;
|
bounds.top = menubar->Bounds().bottom + 1;
|
||||||
BView *placeholderView = new BView( bounds, "placeholderView",
|
BBox *placeholderView = new BBox(bounds, "placeholderView",
|
||||||
B_FOLLOW_NONE, 0 );
|
B_FOLLOW_ALL);
|
||||||
placeholderView->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
placeholderView->SetBorder(B_NO_BORDER);
|
||||||
AddChild( placeholderView );
|
AddChild( placeholderView );
|
||||||
|
|
||||||
// Create the Maps box and contents
|
// Create the Maps box and contents
|
||||||
@@ -708,7 +709,7 @@ MapView::MapView(BRect rect, const char *name, Keymap* keymap)
|
|||||||
BRect textRect = frameRect;
|
BRect textRect = frameRect;
|
||||||
textRect.OffsetTo(B_ORIGIN);
|
textRect.OffsetTo(B_ORIGIN);
|
||||||
textRect.InsetBy(1,1);
|
textRect.InsetBy(1,1);
|
||||||
fTextView = new BTextView(frameRect, "testzone", textRect,
|
fTextView = new KeymapTextView(frameRect, "testzone", textRect,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS);
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
fTextView->MakeEditable(true);
|
fTextView->MakeEditable(true);
|
||||||
fTextView->MakeSelectable(true);
|
fTextView->MakeSelectable(true);
|
||||||
@@ -1208,16 +1209,25 @@ MapView::MessageReceived(BMessage *msg)
|
|||||||
fOldKeyInfo.key_states[i] = states[i];
|
fOldKeyInfo.key_states[i] = states[i];
|
||||||
Invalidate();
|
Invalidate();
|
||||||
} else {
|
} else {
|
||||||
|
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]) {
|
||||||
uint8 stbits = fOldKeyInfo.key_states[i] ^ states[i];
|
uint8 stbits = fOldKeyInfo.key_states[i] ^ states[i];
|
||||||
fOldKeyInfo.key_states[i] = states[i];
|
fOldKeyInfo.key_states[i] = states[i];
|
||||||
for (int8 j=7; stbits; j--,stbits>>=1)
|
for (int8 j=7; stbits; j--,stbits>>=1)
|
||||||
if (stbits & 1)
|
if (stbits & 1) {
|
||||||
DrawKey(i*8 + j);
|
keyCode = i*8 + j;
|
||||||
|
DrawKey(keyCode);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (Window()->IsActive() && keyCode >= 0
|
||||||
|
&& msg->what == B_KEY_DOWN) {
|
||||||
|
fTextView->MakeFocus();
|
||||||
|
char *str;
|
||||||
|
fCurrentMap->GetChars(keyCode, fOldKeyInfo.modifiers, &str);
|
||||||
|
fTextView->FakeKeyDown(str, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <interface/Window.h>
|
#include <interface/Window.h>
|
||||||
#include <support/List.h>
|
#include <support/List.h>
|
||||||
#include <interface/MenuBar.h>
|
#include <interface/MenuBar.h>
|
||||||
|
#include "KeymapTextView.h"
|
||||||
#include "Keymap.h"
|
#include "Keymap.h"
|
||||||
|
|
||||||
#define WINDOW_TITLE "Keymap"
|
#define WINDOW_TITLE "Keymap"
|
||||||
@@ -48,7 +49,7 @@ private:
|
|||||||
BFont fCurrentFont;
|
BFont fCurrentFont;
|
||||||
|
|
||||||
Keymap *fCurrentMap;
|
Keymap *fCurrentMap;
|
||||||
BTextView *fTextView;
|
KeymapTextView *fTextView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user