Merge branch 'master' into sam460ex

This commit is contained in:
François Revol
2012-11-05 15:42:03 +01:00
94 changed files with 2274 additions and 1258 deletions
+1 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010 Haiku Inc. All Rights Reserved.
* Copyright 2006-2012 Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BSD_SYS_CDEFS_H_
@@ -12,10 +12,6 @@
#define __FBSDID(x)
#define __unused
#ifndef __cplusplus
# define protected
#endif
#define __printflike(a, b) __attribute__ ((format (__printf__, (a), (b))))
#define __printf0like(a, b)
+97 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010, Haiku, Inc. All rights reserved.
* Copyright 2009-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_BUILDER_H
@@ -108,6 +108,11 @@ public:
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline ThisBuilder& SetExplicitMinSize(BSize size);
inline ThisBuilder& SetExplicitMaxSize(BSize size);
inline ThisBuilder& SetExplicitPreferredSize(BSize size);
inline ThisBuilder& SetExplicitAlignment(BAlignment alignment);
inline operator BGroupLayout*();
private:
@@ -188,6 +193,9 @@ public:
int32 row, int32 columnCount = 1,
int32 rowCount = 1);
inline ThisBuilder& AddGlue(int32 column, int32 row,
int32 columnCount = 1, int32 rowCount = 1);
inline ThisBuilder& SetColumnWeight(int32 column, float weight);
inline ThisBuilder& SetRowWeight(int32 row, float weight);
@@ -196,6 +204,11 @@ public:
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline ThisBuilder& SetExplicitMinSize(BSize size);
inline ThisBuilder& SetExplicitMaxSize(BSize size);
inline ThisBuilder& SetExplicitPreferredSize(BSize size);
inline ThisBuilder& SetExplicitAlignment(BAlignment alignment);
inline operator BGridLayout*();
private:
@@ -604,6 +617,42 @@ Group<ParentBuilder>::SetInsets(float insets)
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetExplicitMinSize(BSize size)
{
fLayout->SetExplicitMinSize(size);
return *this;
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetExplicitMaxSize(BSize size)
{
fLayout->SetExplicitMaxSize(size);
return *this;
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetExplicitPreferredSize(BSize size)
{
fLayout->SetExplicitPreferredSize(size);
return *this;
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetExplicitAlignment(BAlignment alignment)
{
fLayout->SetExplicitAlignment(alignment);
return *this;
}
template<typename ParentBuilder>
Group<ParentBuilder>::operator BGroupLayout*()
{
@@ -833,6 +882,17 @@ Grid<ParentBuilder>::AddSplit(BSplitView* splitView, int32 column, int32 row,
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::AddGlue(int32 column, int32 row, int32 columnCount,
int32 rowCount)
{
fLayout->AddItem(BSpaceLayoutItem::CreateGlue(), column, row, columnCount,
rowCount);
return *this;
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetColumnWeight(int32 column, float weight)
@@ -879,6 +939,42 @@ Grid<ParentBuilder>::SetInsets(float insets)
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetExplicitMinSize(BSize size)
{
fLayout->SetExplicitMinSize(size);
return *this;
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetExplicitMaxSize(BSize size)
{
fLayout->SetExplicitMaxSize(size);
return *this;
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetExplicitPreferredSize(BSize size)
{
fLayout->SetExplicitPreferredSize(size);
return *this;
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetExplicitAlignment(BAlignment alignment)
{
fLayout->SetExplicitAlignment(alignment);
return *this;
}
template<typename ParentBuilder>
Grid<ParentBuilder>::operator BGridLayout*()
{
+1
View File
@@ -32,6 +32,7 @@ public:
virtual void SetExplicitMinSize(BSize size) = 0;
virtual void SetExplicitMaxSize(BSize size) = 0;
virtual void SetExplicitPreferredSize(BSize size) = 0;
void SetExplicitSize(BSize size);
virtual void SetExplicitAlignment(BAlignment alignment) = 0;
virtual bool IsVisible() = 0;
+10 -10
View File
@@ -1,16 +1,16 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _RECT_H
#define _RECT_H
#include <math.h>
#include <Point.h>
#include <Size.h>
#include <math.h>
class BRect {
public:
@@ -54,16 +54,16 @@ public:
// Expression transformations
BRect& InsetBySelf(BPoint inset);
BRect& InsetBySelf(float dx, float dy);
BRect InsetByCopy(BPoint inset);
BRect InsetByCopy(float dx, float dy);
BRect InsetByCopy(BPoint inset) const;
BRect InsetByCopy(float dx, float dy) const;
BRect& OffsetBySelf(BPoint offset);
BRect& OffsetBySelf(float dx, float dy);
BRect OffsetByCopy(BPoint offset);
BRect OffsetByCopy(float dx, float dy);
BRect OffsetByCopy(BPoint offset) const;
BRect OffsetByCopy(float dx, float dy) const;
BRect& OffsetToSelf(BPoint offset);
BRect& OffsetToSelf(float dx, float dy);
BRect OffsetToCopy(BPoint offset);
BRect OffsetToCopy(float dx, float dy);
BRect OffsetToCopy(BPoint offset) const;
BRect OffsetToCopy(float dx, float dy) const;
// Comparison
bool operator==(BRect r) const;
@@ -120,7 +120,7 @@ inline
BRect::BRect()
:
left(0),
top(0),
top(0),
right(-1),
bottom(-1)
{
-7
View File
@@ -19,13 +19,6 @@
#define DISABLES_ON_WINDOW_DEACTIVATION 1
enum {
B_KNOB_STYLE_NONE = 0,
B_KNOB_STYLE_DOTS,
B_KNOB_STYLE_LINES
};
class BScrollBar : public BView {
public:
BScrollBar(BRect frame, const char* name,
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
* Copyright 2006-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TEXT_CONTROL_H
@@ -9,6 +9,7 @@
#include <Control.h>
#include <TextView.h>
class BLayoutItem;
namespace BPrivate {
class _BTextInput_;
@@ -22,14 +23,14 @@ public:
BMessage* message,
uint32 resizeMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BTextControl(const char* name,
const char* label, const char* initialText,
BMessage* message,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BTextControl(const char* label,
const char* initialText,
BMessage* message);
BMessage* message);
virtual ~BTextControl();
BTextControl(BMessage* archive);
+7 -3
View File
@@ -294,9 +294,11 @@ private:
void _ResetTextRect();
void _HandleBackspace();
void _HandleArrowKey(uint32 inArrowKey);
void _HandleArrowKey(uint32 inArrowKey,
bool commandKeyDown = false);
void _HandleDelete();
void _HandlePageKey(uint32 inPageKey);
void _HandlePageKey(uint32 inPageKey,
bool commandKeyDown = false);
void _HandleAlphaKey(const char* bytes,
int32 numBytes);
@@ -451,8 +453,10 @@ private:
float fMinTextRectWidth;
LayoutData* fLayoutData;
int32 fLastClickOffset;
bool fInstalledNavigateWordwiseShortcuts;
bool fInstalledNavigateToTopOrBottomShortcuts;
uint32 _reserved[7];
uint32 _reserved[6];
};
#endif // _TEXTVIEW_H
+3 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _VIEW_H
@@ -537,6 +537,7 @@ public:
void SetExplicitMinSize(BSize size);
void SetExplicitMaxSize(BSize size);
void SetExplicitPreferredSize(BSize size);
void SetExplicitSize(BSize size);
void SetExplicitAlignment(BAlignment alignment);
BSize ExplicitMinSize() const;
@@ -753,4 +754,5 @@ BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
SetLowColor(color);
}
#endif // _VIEW_H
+1
View File
@@ -132,6 +132,7 @@ public:
BMessage* message);
void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message, BHandler* target);
bool HasShortcut(uint32 key, uint32 modifiers);
void RemoveShortcut(uint32 key, uint32 modifiers);
void SetDefaultButton(BButton* button);
+4 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PATH_H
@@ -25,7 +25,7 @@ public:
BPath(const BEntry* entry);
BPath(const char* dir, const char* leaf = NULL,
bool normalize = false);
BPath(const BDirectory* dir,
BPath(const BDirectory* dir,
const char* leaf = NULL,
bool normalize = false);
@@ -37,7 +37,7 @@ public:
status_t SetTo(const BEntry* entry);
status_t SetTo(const char* path, const char* leaf = NULL,
bool normalize = false);
status_t SetTo(const BDirectory* dir,
status_t SetTo(const BDirectory* dir,
const char* leaf = NULL,
bool normalize = false);
void Unset();
@@ -47,6 +47,7 @@ public:
const char* Path() const;
const char* Leaf() const;
status_t GetParent(BPath* path) const;
bool IsAbsolute() const;
bool operator==(const BPath& item) const;
bool operator==(const char* path) const;
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2010, Haiku, Inc. All rights reserved.
* Copyright 2004-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -23,7 +23,7 @@
static void
print_key(char* chars, int32 offset)
print_key(char* chars, int32 offset, bool last = false)
{
int size = chars[offset++];
@@ -53,7 +53,8 @@ print_key(char* chars, int32 offset)
}
}
fputs("\t", stdout);
if (!last)
fputs("\t", stdout);
}
@@ -91,7 +92,7 @@ Keymap::DumpKeymap()
print_key(fChars, fKeys.caps_map[i]);
print_key(fChars, fKeys.caps_shift_map[i]);
print_key(fChars, fKeys.option_caps_map[i]);
print_key(fChars, fKeys.option_caps_shift_map[i]);
print_key(fChars, fKeys.option_caps_shift_map[i], true);
fputs("\n", stdout);
}
}
+53 -2
View File
@@ -76,6 +76,7 @@ char bigbuffer[BIGBUFFSZ];
#define BIT_FROM_LETTER(l) (0x1 << (l - 'a'))
status_t init_words(char *from);
status_t init_words_from_threadnames(void);
void print_hangman(int fails);
void display_word(int current, uint32 tried_letters);
int play_hangman(void);
@@ -169,6 +170,51 @@ init_words(char *from)
}
status_t
init_words_from_threadnames(void)
{
size_t sz, got;
int current, beg, end, i;
thread_info ti;
memset((void *)words, 0, sizeof(words));
srand((unsigned int)(system_time() & 0x0ffffffff));
for (current = 0; current < MAX_CACHED_WORDS; ) {
int offset;
char *p;
if (get_thread_info(rand() % 200, &ti) != B_OK)
continue;
sz = strnlen(ti.name, B_OS_NAME_LENGTH);
if (sz <= MIN_LETTERS)
continue;
offset = (rand() % (sz - MIN_LETTERS));
//dprintf("thread '%-.32s' + %d\n", ti.name, offset);
p = ti.name + offset;
got = sz - offset;
for (beg = 0; beg < got && isalpha(p[beg]); beg++);
for (; beg < got && !isalpha(p[beg]); beg++);
if (beg + 1 < got && isalpha(p[beg])) {
for (end = beg; end < got && isalpha(p[end]); end++);
if (end < got && !isalpha(p[end]) && beg + MIN_LETTERS < end) {
/* got one */
/* tolower */
for (i = beg; i < end; i++)
p[i] = tolower(p[i]);
strncpy(&(words[current][0]), &(p[beg]), end - beg);
} else
continue;
} else
continue;
current++;
}
/*
for (current = 0; current < MAX_CACHED_WORDS; current++)
dprintf("%s\n", words[current]);
*/
return B_OK;
}
void
print_hangman(int fails)
{
@@ -456,7 +502,12 @@ std_ops(int32 op, ...)
if (err < B_OK) {
dprintf("hangman: error reading fortune file: %s\n",
strerror(err));
return B_ERROR;
err = init_words_from_threadnames();
if (err < B_OK) {
dprintf("hangman: error getting thread names: %s\n",
strerror(err));
return B_ERROR;
}
}
add_debugger_command("kdlhangman", kdlhangman, KCMD_HELP);
return B_OK;
@@ -497,7 +548,7 @@ kdl_trip(void)
fd = open("/dev/misc/hangman", O_WRONLY);
if (fd < B_OK) {
puts("hey, you're pissing me off, no /dev/"DEV_ENTRY" !!!");
system("/bin/alert --stop 'It would work better with the hangman driver enabled...\nyou really deserves a forced reboot :P'");
system("/bin/alert --stop 'It would work better with the hangman driver enabled...\nyou really deserve a forced reboot :P'");
return;
}
write(fd, "hangme!", 7);
@@ -34,6 +34,34 @@
#define ALIGN(size, align) (((size) + align - 1) & ~(align - 1))
#define PAGE_ALIGN(size) (((size) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1))
#define PCI_VENDOR_AMD 0x1002
#define PCI_VENDOR_INTEL 0x8086
#define PCI_VENDOR_NVIDIA 0x10de
#define PCI_ALL_DEVICES 0xffffffff
#define HDA_QUIRK_SNOOP 0x0001
static const struct {
uint32 vendor_id, device_id;
uint32 quirks;
} kControllerQuirks[] = {
{ PCI_VENDOR_INTEL, 0x1c20, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x1d20, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x1e20, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x8c20, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x9c20, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x9c21, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x0c0c, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x811b, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_INTEL, 0x080a, HDA_QUIRK_SNOOP },
// Enable snooping for ATI and Nvidia, right now for all their hda-devices,
// but only based on guessing.
{ PCI_VENDOR_AMD, PCI_ALL_DEVICES, HDA_QUIRK_SNOOP },
{ PCI_VENDOR_NVIDIA, PCI_ALL_DEVICES, HDA_QUIRK_SNOOP },
};
static const struct {
uint32 multi_rate;
uint32 hw_rate;
@@ -54,9 +82,24 @@ static const struct {
// {B_SR_384000, MAKE_RATE(44100, ??, ??), 384000},
};
static pci_x86_module_info* sPCIx86Module;
static uint32
get_controller_quirks(pci_info& info)
{
for (size_t i = 0;
i < sizeof(kControllerQuirks) / sizeof(kControllerQuirks[0]); i++) {
if (info.vendor_id == kControllerQuirks[i].vendor_id
&& (kControllerQuirks[i].device_id == PCI_ALL_DEVICES
|| kControllerQuirks[i].device_id == info.device_id))
return kControllerQuirks[i].quirks;
}
return 0;
}
static inline void
update_pci_register(hda_controller* controller, uint8 reg, uint32 mask,
uint32 value, uint8 size)
@@ -798,8 +841,11 @@ hda_verb_read(hda_codec* codec, uint32 nid, uint32 vid, uint32* response)
status_t
hda_hw_init(hda_controller* controller)
{
uint16 capabilities, stateStatus, cmd;
uint16 capabilities;
uint16 stateStatus;
uint16 cmd;
status_t status;
uint32 quirks;
// Map MMIO registers
controller->regs_area = map_physical_memory("hda_hw_regs",
@@ -830,6 +876,9 @@ hda_hw_init(hda_controller* controller)
controller->irq = controller->pci_info.u.h0.interrupt_line;
controller->msi = false;
// TODO: temporarily disabled, as at least on my hardware audio becomes
// flaky after this.
/*
if (sPCIx86Module != NULL && sPCIx86Module->get_msi_count(
controller->pci_info.bus, controller->pci_info.device,
controller->pci_info.function) >= 1) {
@@ -846,6 +895,7 @@ hda_hw_init(hda_controller* controller)
controller->msi = true;
}
}
*/
status = install_io_interrupt_handler(controller->irq,
(interrupt_handler)hda_interrupt_handler, controller, 0);
@@ -855,27 +905,26 @@ hda_hw_init(hda_controller* controller)
// TCSEL is reset to TC0 (clear 0-2 bits)
update_pci_register(controller, PCI_HDA_TCSEL, PCI_HDA_TCSEL_MASK, 0, 1);
// Enable snooping for ATI and Nvidia, right now for all their hda-devices,
// but only based on guessing.
switch (controller->pci_info.vendor_id) {
case NVIDIA_VENDORID:
update_pci_register(controller, NVIDIA_HDA_TRANSREG,
NVIDIA_HDA_TRANSREG_MASK, NVIDIA_HDA_ENABLE_COHBITS, 1);
update_pci_register(controller, NVIDIA_HDA_ISTRM_COH,
~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1);
update_pci_register(controller, NVIDIA_HDA_OSTRM_COH,
~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1);
break;
case ATI_VENDORID:
update_pci_register(controller, ATI_HDA_MISC_CNTR2,
ATI_HDA_MISC_CNTR2_MASK, ATI_HDA_ENABLE_SNOOP, 1);
break;
case INTEL_VENDORID:
if (controller->pci_info.device_id == INTEL_SCH_DEVICEID) {
quirks = get_controller_quirks(controller->pci_info);
if ((quirks & HDA_QUIRK_SNOOP) != 0) {
switch (controller->pci_info.vendor_id) {
case PCI_VENDOR_NVIDIA:
update_pci_register(controller, NVIDIA_HDA_TRANSREG,
NVIDIA_HDA_TRANSREG_MASK, NVIDIA_HDA_ENABLE_COHBITS, 1);
update_pci_register(controller, NVIDIA_HDA_ISTRM_COH,
~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1);
update_pci_register(controller, NVIDIA_HDA_OSTRM_COH,
~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1);
break;
case PCI_VENDOR_AMD:
update_pci_register(controller, ATI_HDA_MISC_CNTR2,
ATI_HDA_MISC_CNTR2_MASK, ATI_HDA_ENABLE_SNOOP, 1);
break;
case PCI_VENDOR_INTEL:
update_pci_register(controller, INTEL_SCH_HDA_DEVC,
~INTEL_SCH_HDA_DEVC_SNOOP, 0, 2);
}
break;
break;
}
}
capabilities = controller->Read16(HDAC_GLOBAL_CAP);
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2008, Haiku, Inc. All Rights Reserved.
* Copyright 2007-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -135,24 +135,18 @@
#define PCI_HDA_TCSEL 0x44
#define PCI_HDA_TCSEL_MASK 0xf8
#define ATI_HDA_MISC_CNTR2 0x42
#define ATI_HDA_MISC_CNTR2 0x42
#define ATI_HDA_MISC_CNTR2_MASK 0xf8
#define ATI_HDA_ENABLE_SNOOP 0x02
#define NVIDIA_HDA_OSTRM_COH 0x4c
#define NVIDIA_HDA_ISTRM_COH 0x4d
#define NVIDIA_HDA_ENABLE_COHBIT 0x01
#define NVIDIA_HDA_TRANSREG 0x4e
#define NVIDIA_HDA_TRANSREG 0x4e
#define NVIDIA_HDA_TRANSREG_MASK 0xf0
#define NVIDIA_HDA_ENABLE_COHBITS 0x0f
#define INTEL_SCH_HDA_DEVC 0x78
#define INTEL_SCH_HDA_DEVC 0x78
#define INTEL_SCH_HDA_DEVC_SNOOP 0x800
#define ATI_VENDORID 0x1002
#define INTEL_VENDORID 0x8086
#define INTEL_SCH_DEVICEID 0x811b
#define NVIDIA_VENDORID 0x10de
typedef uint32 corb_t;
typedef struct {
+1 -1
View File
@@ -16,6 +16,6 @@ Application SerialConnect :
state.c
unicode.c
vterm.c
: be device $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
: be device tracker $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
;
+151 -7
View File
@@ -4,16 +4,21 @@
*/
#include <stdio.h>
#include "SerialApp.h"
#include <stdio.h>
#include <string.h>
#include <Directory.h>
#include <Entry.h>
#include <File.h>
#include "SerialWindow.h"
SerialApp::SerialApp()
:
BApplication(SerialApp::kApplicationSignature)
: BApplication(SerialApp::kApplicationSignature)
, fLogFile(NULL)
{
fWindow = new SerialWindow();
@@ -24,6 +29,12 @@ SerialApp::SerialApp()
}
SerialApp::~SerialApp()
{
delete fLogFile;
}
void SerialApp::ReadyToRun()
{
fWindow->Show();
@@ -37,9 +48,13 @@ void SerialApp::MessageReceived(BMessage* message)
case kMsgOpenPort:
{
const char* portName;
message->FindString("port name", &portName);
fSerialPort.Open(portName);
release_sem(fSerialLock);
if(message->FindString("port name", &portName) == B_OK)
{
fSerialPort.Open(portName);
release_sem(fSerialLock);
} else {
fSerialPort.Close();
}
break;
}
case kMsgDataRead:
@@ -47,6 +62,19 @@ void SerialApp::MessageReceived(BMessage* message)
// forward the message to the window, which will display the
// incoming data
fWindow->PostMessage(message);
if (fLogFile)
{
const char* bytes;
ssize_t length;
message->FindData("data", B_RAW_TYPE, (const void**)&bytes,
&length);
if(fLogFile->Write(bytes, length) != length)
{
// TODO error handling
}
}
break;
}
case kMsgDataWrite:
@@ -55,7 +83,123 @@ void SerialApp::MessageReceived(BMessage* message)
ssize_t size;
message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size);
if (bytes[0] == '\n') {
size = 2;
bytes = "\r\n";
}
fSerialPort.Write(bytes, size);
break;
}
case kMsgLogfile:
{
entry_ref parent;
const char* filename;
if (message->FindRef("directory", &parent) == B_OK
&& message->FindString("name", &filename) == B_OK)
{
delete fLogFile;
BDirectory directory(&parent);
fLogFile = new BFile(&directory, filename,
B_WRITE_ONLY | B_CREATE_FILE | B_OPEN_AT_END);
status_t error = fLogFile->InitCheck();
if(error != B_OK)
{
puts(strerror(error));
}
} else {
debugger("Invalid BMessage received");
}
}
case kMsgSettings:
{
int32 baudrate;
stop_bits stopBits;
data_bits dataBits;
parity_mode parity;
uint32 flowcontrol;
if(message->FindInt32("databits", (int32*)&dataBits) == B_OK)
fSerialPort.SetDataBits(dataBits);
if(message->FindInt32("stopbits", (int32*)&stopBits) == B_OK)
fSerialPort.SetStopBits(stopBits);
if(message->FindInt32("parity", (int32*)&parity) == B_OK)
fSerialPort.SetParityMode(parity);
if(message->FindInt32("flowcontrol", (int32*)&flowcontrol) == B_OK)
fSerialPort.SetFlowControl(flowcontrol);
if(message->FindInt32("baudrate", &baudrate) == B_OK) {
data_rate rate;
switch(baudrate) {
case 50:
rate = B_50_BPS;
break;
case 75:
rate = B_75_BPS;
break;
case 110:
rate = B_110_BPS;
break;
case 134:
rate = B_134_BPS;
break;
case 150:
rate = B_150_BPS;
break;
case 200:
rate = B_200_BPS;
break;
case 300:
rate = B_300_BPS;
break;
case 600:
rate = B_600_BPS;
break;
case 1200:
rate = B_1200_BPS;
break;
case 1800:
rate = B_1800_BPS;
break;
case 2400:
rate = B_2400_BPS;
break;
case 4800:
rate = B_4800_BPS;
break;
case 9600:
rate = B_9600_BPS;
break;
case 19200:
rate = B_19200_BPS;
break;
case 31250:
rate = B_31250_BPS;
break;
case 38400:
rate = B_38400_BPS;
break;
case 57600:
rate = B_57600_BPS;
break;
case 115200:
rate = B_115200_BPS;
break;
case 230400:
rate = B_230400_BPS;
break;
default:
rate = B_0_BPS;
break;
}
fSerialPort.SetDataRate(rate);
}
break;
}
default:
BApplication::MessageReceived(message);
+11 -1
View File
@@ -4,10 +4,15 @@
*/
#ifndef _SERIALAPP_H_
#define _SERIALAPP_H_
#include <Application.h>
#include <SerialPort.h>
class BFile;
class SerialWindow;
@@ -15,6 +20,7 @@ class SerialApp: public BApplication
{
public:
SerialApp();
~SerialApp();
void ReadyToRun();
void MessageReceived(BMessage* message);
@@ -22,6 +28,7 @@ class SerialApp: public BApplication
BSerialPort fSerialPort;
sem_id fSerialLock;
SerialWindow* fWindow;
BFile* fLogFile;
static status_t PollSerial(void*);
@@ -30,8 +37,11 @@ class SerialApp: public BApplication
enum messageConstants {
kMsgOpenPort = 'open',
kMsgDataRead = 'dare',
kMsgDataWrite = 'dawr',
kMsgLogfile = 'logf',
kMsgOpenPort = 'open',
kMsgSettings = 'stty',
};
#endif
+184 -70
View File
@@ -6,6 +6,9 @@
#include "SerialWindow.h"
#include <stdio.h>
#include <FilePanel.h>
#include <GroupLayout.h>
#include <Menu.h>
#include <MenuBar.h>
@@ -17,9 +20,9 @@
SerialWindow::SerialWindow()
:
BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle,
: BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle,
B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS)
, fLogFilePanel(NULL)
{
SetLayout(new BGroupLayout(B_VERTICAL, 0.0f));
@@ -29,18 +32,160 @@ SerialWindow::SerialWindow()
AddChild(menuBar);
AddChild(fTermView);
BMenu* connectionMenu = new BMenu("Connections");
BMenu* editMenu = new BMenu("Edit");
fConnectionMenu = new BMenu("Connection");
BMenu* fileMenu = new BMenu("File");
BMenu* settingsMenu = new BMenu("Settings");
menuBar->AddItem(connectionMenu);
menuBar->AddItem(editMenu);
fConnectionMenu->SetRadioMode(true);
menuBar->AddItem(fConnectionMenu);
menuBar->AddItem(fileMenu);
menuBar->AddItem(settingsMenu);
// TODO messages
BMenu* connect = new BMenu("Connect");
connectionMenu->AddItem(connect);
// TODO edit menu - what's in it ?
//BMenu* editMenu = new BMenu("Edit");
//menuBar->AddItem(editMenu);
BMenuItem* logFile = new BMenuItem("Log to file" B_UTF8_ELLIPSIS,
new BMessage(kMsgLogfile));
fileMenu->AddItem(logFile);
BMenuItem* xmodemSend = new BMenuItem("X/Y/ZModem send" B_UTF8_ELLIPSIS,
NULL);
fileMenu->AddItem(xmodemSend);
BMenuItem* xmodemReceive = new BMenuItem(
"X/Y/Zmodem receive" B_UTF8_ELLIPSIS, NULL);
fileMenu->AddItem(xmodemReceive);
// Configuring all this by menus may be a bit unhandy. Make a setting
// window instead ?
BMenu* baudRate = new BMenu("Baud rate");
baudRate->SetRadioMode(true);
settingsMenu->AddItem(baudRate);
BMenu* parity = new BMenu("Parity");
parity->SetRadioMode(true);
settingsMenu->AddItem(parity);
BMenu* stopBits = new BMenu("Stop bits");
stopBits->SetRadioMode(true);
settingsMenu->AddItem(stopBits);
BMenu* flowControl = new BMenu("Flow control");
flowControl->SetRadioMode(true);
settingsMenu->AddItem(flowControl);
BMenu* dataBits = new BMenu("Data bits");
dataBits->SetRadioMode(true);
settingsMenu->AddItem(dataBits);
BMessage* message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_NO_PARITY);
BMenuItem* parityNone = new BMenuItem("None", message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_ODD_PARITY);
BMenuItem* parityOdd = new BMenuItem("Odd", message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_EVEN_PARITY);
BMenuItem* parityEven = new BMenuItem("Even", message);
parityNone->SetMarked(true);
parity->AddItem(parityNone);
parity->AddItem(parityOdd);
parity->AddItem(parityEven);
parity->SetTargetForItems(be_app);
message = new BMessage(kMsgSettings);
message->AddInt32("databits", B_DATA_BITS_7);
BMenuItem* data7 = new BMenuItem("7", message);
message = new BMessage(kMsgSettings);
message->AddInt32("databits", B_DATA_BITS_8);
BMenuItem* data8 = new BMenuItem("8", message);
data8->SetMarked(true);
dataBits->AddItem(data7);
dataBits->AddItem(data8);
dataBits->SetTargetForItems(be_app);
message = new BMessage(kMsgSettings);
message->AddInt32("stopbits", B_STOP_BITS_1);
BMenuItem* stop1 = new BMenuItem("1", NULL);
message = new BMessage(kMsgSettings);
message->AddInt32("stopbits", B_STOP_BITS_2);
BMenuItem* stop2 = new BMenuItem("2", NULL);
stop1->SetMarked(true);
stopBits->AddItem(stop1);
stopBits->AddItem(stop2);
stopBits->SetTargetForItems(be_app);
static const int baudrates[] = { 50, 75, 110, 134, 150, 200, 300, 600,
1200, 1800, 2400, 4800, 9600, 19200, 31250, 38400, 57600, 115200,
230400
};
// Loop backwards to add fastest rates at top of menu
for (int i = sizeof(baudrates) / sizeof(char*); --i >= 0;)
{
message = new BMessage(kMsgSettings);
message->AddInt32("baudrate", baudrates[i]);
char buffer[7];
sprintf(buffer,"%d", baudrates[i]);
BMenuItem* item = new BMenuItem(buffer, message);
if (baudrates[i] == 19200)
item->SetMarked(true);
baudRate->AddItem(item);
}
baudRate->SetTargetForItems(be_app);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_HARDWARE_CONTROL);
BMenuItem* hardware = new BMenuItem("Hardware", message);
hardware->SetMarked(true);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_SOFTWARE_CONTROL);
BMenuItem* software = new BMenuItem("Software", message);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_HARDWARE_CONTROL | B_SOFTWARE_CONTROL);
BMenuItem* both = new BMenuItem("Both", message);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", 0);
BMenuItem* noFlow = new BMenuItem("None", message);
flowControl->AddItem(hardware);
flowControl->AddItem(software);
flowControl->AddItem(both);
flowControl->AddItem(noFlow);
flowControl->SetTargetForItems(be_app);
CenterOnScreen();
}
SerialWindow::~SerialWindow()
{
delete fLogFilePanel;
}
void SerialWindow::MenusBeginning()
{
// remove all items from the menu
while(fConnectionMenu->RemoveItem(0L));
// fill it with the (updated) serial port list
BSerialPort serialPort;
int deviceCount = serialPort.CountDevices();
@@ -52,78 +197,36 @@ SerialWindow::SerialWindow()
BMessage* message = new BMessage(kMsgOpenPort);
message->AddString("port name", buffer);
BMenuItem* portItem = new BMenuItem(buffer, message);
connect->AddItem(portItem);
portItem->SetTarget(be_app);
fConnectionMenu->AddItem(portItem);
}
#if SUPPORTS_MODEM
BMenuItem* connectModem = new BMenuItem(
"Connect via modem" B_UTF8_ELLIPSIS, NULL, 'M', 0);
connectionMenu->AddItem(connectModem);
#endif
BMenuItem* Disconnect = new BMenuItem("Disconnect", NULL,
'Z', B_OPTION_KEY);
connectionMenu->AddItem(Disconnect);
if (deviceCount > 0) {
fConnectionMenu->AddSeparatorItem();
// TODO edit menu - what's in it ?
// Configuring all this by menus may be a bit unhandy. Make a setting
// window instead ?
BMenu* parity = new BMenu("Parity");
settingsMenu->AddItem(parity);
BMenu* dataBits = new BMenu("Data bits");
settingsMenu->AddItem(dataBits);
BMenu* stopBits = new BMenu("Stop bits");
settingsMenu->AddItem(stopBits);
BMenu* baudRate = new BMenu("Baud rate");
settingsMenu->AddItem(baudRate);
BMenu* flowControl = new BMenu("Flow control");
settingsMenu->AddItem(flowControl);
BMenuItem* parityNone = new BMenuItem("None", NULL);
parity->AddItem(parityNone);
BMenuItem* parityOdd = new BMenuItem("Odd", NULL);
parity->AddItem(parityOdd);
BMenuItem* parityEven = new BMenuItem("Even", NULL);
parity->AddItem(parityEven);
BMenuItem* data7 = new BMenuItem("7", NULL);
dataBits->AddItem(data7);
BMenuItem* data8 = new BMenuItem("8", NULL);
dataBits->AddItem(data8);
BMenuItem* stop1 = new BMenuItem("1", NULL);
stopBits->AddItem(stop1);
BMenuItem* stop2 = new BMenuItem("2", NULL);
stopBits->AddItem(stop2);
static const char* baudrates[] = { "50", "75", "110", "134", "150", "200",
"300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "31250",
"38400", "57600", "115200", "230400"
};
// Loop backwards to add fastest rates at top of menu
for (int i = sizeof(baudrates) / sizeof(char*); --i >= 0;)
{
BMenuItem* item = new BMenuItem(baudrates[i], NULL);
baudRate->AddItem(item);
BMenuItem* disconnect = new BMenuItem("Disconnect",
new BMessage(kMsgOpenPort), 'Z', B_OPTION_KEY);
fConnectionMenu->AddItem(disconnect);
} else {
BMenuItem* noDevices = new BMenuItem("<no serial port available>", NULL);
noDevices->SetEnabled(false);
fConnectionMenu->AddItem(noDevices);
}
BMenuItem* rtsCts = new BMenuItem("RTS/CTS", NULL);
flowControl->AddItem(rtsCts);
BMenuItem* noFlow = new BMenuItem("None", NULL);
flowControl->AddItem(noFlow);
CenterOnScreen();
}
void SerialWindow::MessageReceived(BMessage* message)
{
switch(message->what)
{
case kMsgOpenPort:
{
BMenuItem* disconnectMenu;
if(message->FindPointer("source", (void**)&disconnectMenu) == B_OK)
disconnectMenu->SetMarked(false);
be_app->PostMessage(new BMessage(*message));
break;
}
case kMsgDataRead:
{
const char* bytes;
@@ -132,6 +235,17 @@ void SerialWindow::MessageReceived(BMessage* message)
fTermView->PushBytes(bytes, length);
break;
}
case kMsgLogfile:
{
// Let's lazy init the file panel
if(fLogFilePanel == NULL) {
fLogFilePanel = new BFilePanel(B_SAVE_PANEL, &be_app_messenger,
NULL, B_FILE_NODE, false);
fLogFilePanel->SetMessage(message);
}
fLogFilePanel->Show();
break;
}
default:
BWindow::MessageReceived(message);
}
+5
View File
@@ -7,6 +7,7 @@
#include <Window.h>
class BMenu;
class TermView;
@@ -14,11 +15,15 @@ class SerialWindow: public BWindow
{
public:
SerialWindow();
~SerialWindow();
void MenusBeginning();
void MessageReceived(BMessage* message);
private:
TermView* fTermView;
BMenu* fConnectionMenu;
BFilePanel* fLogFilePanel;
static const char* kWindowTitle;
};
+62 -3
View File
@@ -8,6 +8,8 @@
#include <stdio.h>
#include <Entry.h>
#include <File.h>
#include <Layout.h>
#include "SerialApp.h"
@@ -15,7 +17,7 @@
TermView::TermView()
:
BView("TermView", B_WILL_DRAW)
BView("TermView", B_WILL_DRAW | B_FRAME_EVENTS)
{
font_height height;
GetFontHeight(&height);
@@ -52,6 +54,10 @@ void TermView::Draw(BRect updateRect)
VTermPos pos;
font_height height;
GetFontHeight(&height);
int availableRows, availableCols;
vterm_get_size(fTerm, &availableRows, &availableCols);
for (pos.row = updatedChars.start_row; pos.row <= updatedChars.end_row;
pos.row++) {
float x = updatedChars.start_col * fFontWidth + kBorderSpacing;
@@ -60,14 +66,36 @@ void TermView::Draw(BRect updateRect)
for (pos.col = updatedChars.start_col;
pos.col <= updatedChars.end_col;) {
if (pos.col < 0 || pos.row < 0 || pos.col >= kDefaultWidth
|| pos.row >= kDefaultHeight) {
if (pos.col < 0 || pos.row < 0 || pos.col >= availableCols
|| pos.row >= availableRows) {
DrawString(" ");
pos.col ++;
} else {
VTermScreenCell cell;
vterm_screen_get_cell(fTermScreen, pos, &cell);
rgb_color foreground, background;
foreground.red = cell.fg.red;
foreground.green = cell.fg.green;
foreground.blue = cell.fg.blue;
background.red = cell.bg.red;
background.green = cell.bg.green;
background.blue = cell.bg.blue;
if(cell.attrs.reverse) {
SetLowColor(foreground);
SetViewColor(foreground);
SetHighColor(background);
} else {
SetLowColor(background);
SetViewColor(background);
SetHighColor(foreground);
}
BPoint penLocation = PenLocation();
FillRect(BRect(penLocation.x, penLocation.y - height.ascent,
penLocation.x + cell.width * fFontWidth, penLocation.y), B_SOLID_LOW);
if (cell.chars[0] == 0) {
DrawString(" ");
pos.col ++;
@@ -85,6 +113,14 @@ void TermView::Draw(BRect updateRect)
}
void TermView::FrameResized(float width, float height)
{
VTermRect newSize = PixelsToGlyphs(BRect(0, 0, width - 2 * kBorderSpacing,
height - 2 * kBorderSpacing));
vterm_set_size(fTerm, newSize.end_row, newSize.end_col);
}
void TermView::GetPreferredSize(float* width, float* height)
{
if (width != NULL)
@@ -102,12 +138,35 @@ void TermView::KeyDown(const char* bytes, int32 numBytes)
}
void TermView::MessageReceived(BMessage* message)
{
switch(message->what)
{
case 'DATA':
{
entry_ref ref;
if(message->FindRef("refs", &ref) == B_OK)
{
// The user just dropped a file on us
// TODO send it by XMODEM or so
}
break;
}
default:
BView::MessageReceived(message);
}
}
void TermView::PushBytes(const char* bytes, size_t length)
{
vterm_push_bytes(fTerm, bytes, length);
}
//#pragma mark -
VTermRect TermView::PixelsToGlyphs(BRect pixels) const
{
pixels.OffsetBy(-kBorderSpacing, -kBorderSpacing);
+2
View File
@@ -18,8 +18,10 @@ class TermView: public BView
void AttachedToWindow();
void Draw(BRect updateRect);
void FrameResized(float width, float height);
void GetPreferredSize(float* width, float* height);
void KeyDown(const char* bytes, int32 numBytes);
void MessageReceived(BMessage* message);
void PushBytes(const char* bytes, const size_t length);
private:
+16
View File
@@ -80,6 +80,10 @@ AppearancePrefView::AppearancePrefView(const char* name,
NULL
};
fBlinkCursor = new BCheckBox(
B_TRANSLATE("Blink the cursor"),
new BMessage(MSG_BLINK_CURSOR_CHANGED));
fWarnOnExit = new BCheckBox(
B_TRANSLATE("Confirm exit if active programs exist"),
new BMessage(MSG_WARN_ON_EXIT_CHANGED));
@@ -141,6 +145,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
.AddGlue()
.Add(fColorControl = new BColorControl(BPoint(10, 10),
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
.Add(fBlinkCursor)
.Add(fWarnOnExit);
fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
@@ -157,6 +162,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
fColorControl->SetValue(
PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
fBlinkCursor->SetValue(PrefHandler::Default()->getBool(PREF_BLINK_CURSOR));
fWarnOnExit->SetValue(PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT));
BTextControl* redInput = (BTextControl*)fColorControl->ChildAt(0);
@@ -205,6 +211,7 @@ AppearancePrefView::AttachedToWindow()
{
fTabTitle->SetTarget(this);
fWindowTitle->SetTarget(this);
fBlinkCursor->SetTarget(this);
fWarnOnExit->SetTarget(this);
fFontSize->Menu()->SetTargetForItems(this);
@@ -293,6 +300,15 @@ AppearancePrefView::MessageReceived(BMessage* msg)
fColorField->Menu()->FindMarked()->Label()));
break;
case MSG_BLINK_CURSOR_CHANGED:
if (PrefHandler::Default()->getBool(PREF_BLINK_CURSOR)
!= fBlinkCursor->Value()) {
PrefHandler::Default()->setBool(PREF_BLINK_CURSOR,
fBlinkCursor->Value());
modified = true;
}
break;
case MSG_WARN_ON_EXIT_CHANGED:
if (PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT)
!= fWarnOnExit->Value()) {
+3 -1
View File
@@ -23,10 +23,11 @@ static const uint32 MSG_COLOR_SCHEMA_CHANGED = 'mccs';
static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts';
static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts';
static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc';
static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec';
static const uint32 MSG_COLS_CHANGED = 'mccl';
static const uint32 MSG_ROWS_CHANGED = 'mcrw';
static const uint32 MSG_HISTORY_CHANGED = 'mhst';
static const uint32 MSG_HISTORY_CHANGED = 'mhst';
static const uint32 MSG_PREF_MODIFIED = 'mpmo';
@@ -71,6 +72,7 @@ private:
const color_schema** schemas,
const color_schema* defaultItemName);
BCheckBox* fBlinkCursor;
BCheckBox* fWarnOnExit;
BMenuField* fFont;
BMenuField* fFontSize;
+1
View File
@@ -61,6 +61,7 @@ static const pref_defaults kTermDefaults[] = {
{ PREF_TAB_TITLE, "%1d: %p" },
{ PREF_WINDOW_TITLE, "Terminal %i: %t" },
{ PREF_BLINK_CURSOR, PREF_TRUE },
{ PREF_WARN_ON_EXIT, PREF_TRUE },
{ NULL, NULL},
+1
View File
@@ -131,6 +131,7 @@ static const char* const PREF_SHELL = "Shell";
static const char* const PREF_TEXT_ENCODING = "Text encoding";
static const char* const PREF_GUI_LANGUAGE = "Language";
static const char* const PREF_BLINK_CURSOR = "Blink the cursor";
static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
static const char* const PREF_TAB_TITLE = "Tab title";
+4 -1
View File
@@ -54,6 +54,7 @@
#include <Window.h>
#include "InlineInput.h"
#include "PrefHandler.h"
#include "Shell.h"
#include "ShellParameters.h"
#include "TermConst.h"
@@ -1096,9 +1097,11 @@ TermView::_DetachShell()
void
TermView::_Activate()
{
bool blinkCursor = PrefHandler::Default()->getBool(PREF_BLINK_CURSOR);
fActive = true;
if (fCursorBlinkRunner == NULL) {
if (fCursorBlinkRunner == NULL && blinkCursor) {
BMessage blinkMessage(kBlinkCursor);
fCursorBlinkRunner = new (std::nothrow) BMessageRunner(
BMessenger(this), &blinkMessage, kCursorBlinkInterval);
+217 -217
View File
@@ -37,11 +37,11 @@ NumLock = 0x22
LShift = 0x4b
RShift = 0x56
LCommand = 0x5d
RCommand = 0x5f
RCommand = 0x00
LControl = 0x5c
RControl = 0x60
LOption = 0x66
ROption = 0x67
ROption = 0x5f
Menu = 0x68
#
# Lock settings
@@ -51,224 +51,224 @@ Menu = 0x68
# To set everything, do the following:
# LockSettings = CapsLock NumLock ScrollLock
#
LockSettings =
LockSettings =
# Legend:
# n = Normal
# s = Shift
# c = Control
# C = CapsLock
# o = Option
# Key n s c o os C Cs Co Cos
Key 0x00 = '' '' '' '' '' '' '' '' ''
Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b
Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x03 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x04 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x05 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x06 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x07 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x08 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x09 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0a = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0b = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0c = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x11 = '`' '~' '' '`' '~' '`' '~' '`' '~'
Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2b9 0xc2a1
Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2ba 0xc2b2
Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2aa 0xc2b3
Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a3 0xc2a4
Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' '' 0xe282ac
Key 0x17 = '6' '^' 0x1e 0xc2bc '^' '6' '^' 0xc2bc '^'
Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' '' 0xc2bd
Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' '' 0xc2be
Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' '' 0xe28098
Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xc2b1 0xe28099
Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2af 0xc2a5
Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc3b7 0xc397
Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08
Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05
Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
Key 0x21 = 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b
Key 0x22 = '' '' '' '' '' '' '' '' ''
Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' '/'
Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*'
Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-'
Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' '' 0xc384 0xc3a4
Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' '' 0xc385 0xc3a5
Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' '' 0xc389 0xc3a9
Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' '' '' 0xc2ae
Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' '' 0xc39e 0xc3be
Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' '' 0xc39c 0xc3bc
Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' '' 0xc39a 0xc3ba
Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' '' 0xc38d 0xc3ad
Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' '' 0xc393 0xc3b3
Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' '' 0xc396 0xc3b6
Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '' '' 0xc2ab
Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '' '' 0xc2bb
Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '' 0xc2a6 0xc2ac
Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f
Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04
Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c
Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01
Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e
Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b
Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+'
Key 0x3b = '' '' '' '' '' '' '' '' ''
Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' '' 0xc381 0xc3a1
Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' '' 0xc2a7 0xc39f
Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' '' 0xc390 0xc3b0
Key 0x3f = 'f' 'F' 0x06 '' '' 'F' '' '' ''
Key 0x40 = 'g' 'G' 0x07 '' '' 'G' '' '' ''
Key 0x41 = 'h' 'H' 0x08 '' '' 'H' '' '' ''
Key 0x42 = 'j' 'J' 0x0a '' '' 'J' '' '' ''
Key 0x43 = 'k' 'K' 0x0b '' '' 'K' '' '' ''
Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' '' 0xc398 0xc3b8
Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' '' 0xc2b0 0xc2b6
Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '' 0xc2b4 0xc2a8
Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a
Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c
Key 0x49 = '' '5' '' '' '5' '' '5' '5' ''
Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d
Key 0x4b = '' '' '' '' '' '' '' '' ''
Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' '' 0xc386 0xc3a6
Key 0x4d = 'x' 'X' 0x18 '' '' 'X' '' '' ''
Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' '' 0xc2a9 0xc2a2
Key 0x4f = 'v' 'V' 0x16 0xe2889a '' 'V' '' '' 0xe2889a
Key 0x50 = 'b' 'B' 0x02 '' '' 'B' '' '' ''
Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' '' 0xc391 0xc3b1
Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' '' '' 0xc2b5
Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '' 0xc387 0xc3a7
Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '' 0xc2b8 0xc2b7
Key 0x55 = '/' '?' '' '' '' '/' '' '' ''
Key 0x56 = '' '' '' '' '' '' '' '' ''
Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e
Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04
Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f
Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c
Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a
Key 0x5c = '' '' '' '' '' '' '' '' ''
Key 0x5d = '' '' '' '' '' '' '' '' ''
Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' '' ' '
Key 0x5f = '' '' '' '' '' '' '' '' ''
Key 0x60 = '' '' '' '' '' '' '' '' ''
Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c
Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f
Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d
Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05
Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f
Key 0x66 = '' '' '' '' '' '' '' '' ''
Key 0x67 = '' '' '' '' '' '' '' '' ''
Key 0x68 = '' '' '' '' '' '' '' '' ''
Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2a6 0xc2ac
Key 0x6a = '' '' '' '' '' '' '' '' ''
Key 0x6b = '' '' '' '' '' '' '' '' ''
Key 0x6c = '' '' '' '' '' '' '' '' ''
Key 0x6d = '' '' '' '' '' '' '' '' ''
Key 0x6e = '' '' '' '' '' '' '' '' ''
Key 0x6f = '' '' '' '' '' '' '' '' ''
Key 0x70 = '' '' '' '' '' '' '' '' ''
Key 0x71 = '' '' '' '' '' '' '' '' ''
Key 0x72 = '' '' '' '' '' '' '' '' ''
Key 0x73 = '' '' '' '' '' '' '' '' ''
Key 0x74 = '' '' '' '' '' '' '' '' ''
Key 0x75 = '' '' '' '' '' '' '' '' ''
Key 0x76 = '' '' '' '' '' '' '' '' ''
Key 0x77 = '' '' '' '' '' '' '' '' ''
Key 0x78 = '' '' '' '' '' '' '' '' ''
Key 0x79 = '' '' '' '' '' '' '' '' ''
Key 0x7a = '' '' '' '' '' '' '' '' ''
Key 0x7b = '' '' '' '' '' '' '' '' ''
Key 0x7c = '' '' '' '' '' '' '' '' ''
Key 0x7d = '' '' '' '' '' '' '' '' ''
Key 0x7e = '' '' '' '' '' '' '' '' ''
Key 0x7f = '' '' '' '' '' '' '' '' ''
Acute ' ' = 0xc2b4
Acute 'A' = 0xc381
Acute 'C' = 0xc387
Acute 'E' = 0xc389
Acute 'I' = 0xc38d
Acute 'O' = 0xc393
Acute 'U' = 0xc39a
Acute 'Y' = 0xc39d
Acute 'a' = 0xc3a1
Acute 'c' = 0xc3a7
Acute 'e' = 0xc3a9
Acute 'i' = 0xc3ad
Acute 'o' = 0xc3b3
Acute 'u' = 0xc3ba
Acute 'y' = 0xc3bd
Acute '' = ''
AcuteTab = Option CapsLock-Option
Grave ' ' = '`'
Grave 'A' = 0xc380
Grave 'E' = 0xc388
Grave 'I' = 0xc38c
Grave 'O' = 0xc392
Grave 'U' = 0xc399
Grave 'a' = 0xc3a0
Grave 'e' = 0xc3a8
Grave 'i' = 0xc3ac
Grave 'o' = 0xc3b2
Grave 'u' = 0xc3b9
Grave '' = ''
Grave '' = ''
Grave '' = ''
Grave '' = ''
Grave '' = ''
GraveTab = Option CapsLock-Option
Circumflex ' ' = '^'
Circumflex 'A' = 0xc382
Circumflex 'E' = 0xc38a
Circumflex 'I' = 0xc38e
Circumflex 'O' = 0xc394
Circumflex 'U' = 0xc39b
Circumflex 'a' = 0xc3a2
Circumflex 'e' = 0xc3aa
Circumflex 'i' = 0xc3ae
Circumflex 'o' = 0xc3b4
Circumflex 'u' = 0xc3bb
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
CircumflexTab = Option-Shift CapsLock-Shift-Option
Diaeresis ' ' = 0xc2a8
Diaeresis 'A' = 0xc384
Diaeresis 'E' = 0xc38b
Diaeresis 'I' = 0xc38f
Diaeresis 'O' = 0xc396
Diaeresis 'U' = 0xc39c
Diaeresis 'Y' = 0xc5b8
Diaeresis 'a' = 0xc3a4
Diaeresis 'e' = 0xc3ab
Diaeresis 'i' = 0xc3af
Diaeresis 'o' = 0xc3b6
Diaeresis 'u' = 0xc3bc
Diaeresis 'y' = 0xc3bf
Diaeresis '' = ''
Diaeresis '' = ''
Diaeresis '' = ''
DiaeresisTab = Option-Shift CapsLock-Shift-Option
Tilde ' ' = '~'
Tilde 'A' = 0xc383
Tilde 'O' = 0xc395
Tilde 'N' = 0xc391
Tilde 'a' = 0xc3a3
Tilde 'o' = 0xc3b5
Tilde 'n' = 0xc3b1
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
TildeTab = Option-Shift CapsLock-Shift-Option
# Key n s c o os C Cs Co Cos
Key 0x00 = '' '' '' '' '' '' '' '' ''
Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b
Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x03 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x04 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x05 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x06 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x07 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x08 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x09 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0a = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0b = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0c = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10
Key 0x11 = '`' '~' '' '`' '~' '`' '~' '`' '~'
Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2b9 0xc2a1
Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2ba 0xc2b2
Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2aa 0xc2b3
Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a3 0xc2a4
Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' '' 0xe282ac
Key 0x17 = '6' '^' 0x1e 0xc2bc '^' '6' '^' 0xc2bc '^'
Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' '' 0xc2bd
Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' '' 0xc2be
Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' '' 0xe28098
Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xc2b1 0xe28099
Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2af 0xc2a5
Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc3b7 0xc397
Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08
Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05
Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
Key 0x21 = 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b
Key 0x22 = '' '' '' '' '' '' '' '' ''
Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' '/'
Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*'
Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-'
Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' '' 0xc384 0xc3a4
Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' '' 0xc385 0xc3a5
Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' '' 0xc389 0xc3a9
Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' '' '' 0xc2ae
Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' '' 0xc39e 0xc3be
Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' '' 0xc39c 0xc3bc
Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' '' 0xc39a 0xc3ba
Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' '' 0xc38d 0xc3ad
Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' '' 0xc393 0xc3b3
Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' '' 0xc396 0xc3b6
Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '' '' 0xc2ab
Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '' '' 0xc2bb
Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '' 0xc2a6 0xc2ac
Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f
Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04
Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c
Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01
Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e
Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b
Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+'
Key 0x3b = '' '' '' '' '' '' '' '' ''
Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' '' 0xc381 0xc3a1
Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' '' 0xc2a7 0xc39f
Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' '' 0xc390 0xc3b0
Key 0x3f = 'f' 'F' 0x06 '' '' 'F' '' '' ''
Key 0x40 = 'g' 'G' 0x07 '' '' 'G' '' '' ''
Key 0x41 = 'h' 'H' 0x08 '' '' 'H' '' '' ''
Key 0x42 = 'j' 'J' 0x0a '' '' 'J' '' '' ''
Key 0x43 = 'k' 'K' 0x0b '' '' 'K' '' '' ''
Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' '' 0xc398 0xc3b8
Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' '' 0xc2b0 0xc2b6
Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '' 0xc2b4 0xc2a8
Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a
Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c
Key 0x49 = '' '5' '' '' '5' '' '5' '5' ''
Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d
Key 0x4b = '' '' '' '' '' '' '' '' ''
Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' '' 0xc386 0xc3a6
Key 0x4d = 'x' 'X' 0x18 '' '' 'X' '' '' ''
Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' '' 0xc2a9 0xc2a2
Key 0x4f = 'v' 'V' 0x16 0xe2889a '' 'V' '' '' 0xe2889a
Key 0x50 = 'b' 'B' 0x02 '' '' 'B' '' '' ''
Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' '' 0xc391 0xc3b1
Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' '' '' 0xc2b5
Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '' 0xc387 0xc3a7
Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '' 0xc2b8 0xc2b7
Key 0x55 = '/' '?' '' '' '' '/' '' '' ''
Key 0x56 = '' '' '' '' '' '' '' '' ''
Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e
Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04
Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f
Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c
Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a
Key 0x5c = '' '' '' '' '' '' '' '' ''
Key 0x5d = '' '' '' '' '' '' '' '' ''
Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' '' ' '
Key 0x5f = '' '' '' '' '' '' '' '' ''
Key 0x60 = '' '' '' '' '' '' '' '' ''
Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c
Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f
Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d
Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05
Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f
Key 0x66 = '' '' '' '' '' '' '' '' ''
Key 0x67 = '' '' '' '' '' '' '' '' ''
Key 0x68 = '' '' '' '' '' '' '' '' ''
Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2a6 0xc2ac
Key 0x6a = '' '' '' '' '' '' '' '' ''
Key 0x6b = '' '' '' '' '' '' '' '' ''
Key 0x6c = '' '' '' '' '' '' '' '' ''
Key 0x6d = '' '' '' '' '' '' '' '' ''
Key 0x6e = '' '' '' '' '' '' '' '' ''
Key 0x6f = '' '' '' '' '' '' '' '' ''
Key 0x70 = '' '' '' '' '' '' '' '' ''
Key 0x71 = '' '' '' '' '' '' '' '' ''
Key 0x72 = '' '' '' '' '' '' '' '' ''
Key 0x73 = '' '' '' '' '' '' '' '' ''
Key 0x74 = '' '' '' '' '' '' '' '' ''
Key 0x75 = '' '' '' '' '' '' '' '' ''
Key 0x76 = '' '' '' '' '' '' '' '' ''
Key 0x77 = '' '' '' '' '' '' '' '' ''
Key 0x78 = '' '' '' '' '' '' '' '' ''
Key 0x79 = '' '' '' '' '' '' '' '' ''
Key 0x7a = '' '' '' '' '' '' '' '' ''
Key 0x7b = '' '' '' '' '' '' '' '' ''
Key 0x7c = '' '' '' '' '' '' '' '' ''
Key 0x7d = '' '' '' '' '' '' '' '' ''
Key 0x7e = '' '' '' '' '' '' '' '' ''
Key 0x7f = '' '' '' '' '' '' '' '' ''
Acute ' ' = 0xc2b4
Acute 'A' = 0xc381
Acute 'C' = 0xc387
Acute 'E' = 0xc389
Acute 'I' = 0xc38d
Acute 'O' = 0xc393
Acute 'U' = 0xc39a
Acute 'Y' = 0xc39d
Acute 'a' = 0xc3a1
Acute 'c' = 0xc3a7
Acute 'e' = 0xc3a9
Acute 'i' = 0xc3ad
Acute 'o' = 0xc3b3
Acute 'u' = 0xc3ba
Acute 'y' = 0xc3bd
Acute '' = ''
AcuteTab = Option CapsLock-Option
Grave ' ' = '`'
Grave 'A' = 0xc380
Grave 'E' = 0xc388
Grave 'I' = 0xc38c
Grave 'O' = 0xc392
Grave 'U' = 0xc399
Grave 'a' = 0xc3a0
Grave 'e' = 0xc3a8
Grave 'i' = 0xc3ac
Grave 'o' = 0xc3b2
Grave 'u' = 0xc3b9
Grave '' = ''
Grave '' = ''
Grave '' = ''
Grave '' = ''
Grave '' = ''
GraveTab = Option CapsLock-Option
Circumflex ' ' = '^'
Circumflex 'A' = 0xc382
Circumflex 'E' = 0xc38a
Circumflex 'I' = 0xc38e
Circumflex 'O' = 0xc394
Circumflex 'U' = 0xc39b
Circumflex 'a' = 0xc3a2
Circumflex 'e' = 0xc3aa
Circumflex 'i' = 0xc3ae
Circumflex 'o' = 0xc3b4
Circumflex 'u' = 0xc3bb
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
Circumflex '' = ''
CircumflexTab = Option-Shift CapsLock-Shift-Option
Diaeresis ' ' = 0xc2a8
Diaeresis 'A' = 0xc384
Diaeresis 'E' = 0xc38b
Diaeresis 'I' = 0xc38f
Diaeresis 'O' = 0xc396
Diaeresis 'U' = 0xc39c
Diaeresis 'Y' = 0xc5b8
Diaeresis 'a' = 0xc3a4
Diaeresis 'e' = 0xc3ab
Diaeresis 'i' = 0xc3af
Diaeresis 'o' = 0xc3b6
Diaeresis 'u' = 0xc3bc
Diaeresis 'y' = 0xc3bf
Diaeresis '' = ''
Diaeresis '' = ''
Diaeresis '' = ''
DiaeresisTab = Option-Shift CapsLock-Shift-Option
Tilde ' ' = '~'
Tilde 'A' = 0xc383
Tilde 'O' = 0xc395
Tilde 'N' = 0xc391
Tilde 'a' = 0xc3a3
Tilde 'o' = 0xc3b5
Tilde 'n' = 0xc3b1
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
Tilde '' = ''
TildeTab = Option-Shift CapsLock-Shift-Option
+5 -4
View File
@@ -2729,16 +2729,17 @@ BMessage::Append(const BMessage &other)
size_t size = field->data_size / field->count;
for (uint32 j = 0; j < field->count; j++) {
if (!isFixed)
if (!isFixed) {
size = *(uint32 *)data;
data = (const void *)((const char *)data + sizeof(uint32));
}
status_t status = AddData(name, field->type, data, size,
isFixed != 0, 1);
isFixed, 1);
if (status != B_OK)
return status;
data = (const void *)((const char *)data + size
+ (isFixed ? 0 : sizeof(uint32)));
data = (const void *)((const char *)data + size);
}
}
return B_OK;
+13 -3
View File
@@ -1,9 +1,10 @@
/*
* Copyright 2010, Haiku, Inc.
* Copyright 2010-2012, Haiku, Inc.
* Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include <LayoutItem.h>
#include <Layout.h>
@@ -46,6 +47,15 @@ BLayoutItem::Layout() const
}
void
BLayoutItem::SetExplicitSize(BSize size)
{
SetExplicitMinSize(size);
SetExplicitMaxSize(size);
SetExplicitPreferredSize(size);
}
bool
BLayoutItem::HasHeightForWidth()
{
@@ -122,7 +132,7 @@ BLayoutItem::AlignInFrame(BRect frame)
float minHeight;
GetHeightForWidth(frame.Width(), &minHeight, NULL, NULL);
frame.bottom = frame.top + max_c(frame.Height(), minHeight);
maxSize.height = minHeight;
}
@@ -178,7 +188,7 @@ BLayoutItem::SetLayout(BLayout* layout)
BView::Private(view).RegisterLayoutItem(this);
}
}
if (fLayout)
AttachedToLayout();
}
+78 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2001-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -80,7 +80,7 @@ BRect::InsetBySelf(float dx, float dy)
BRect
BRect::InsetByCopy(BPoint point)
BRect::InsetByCopy(BPoint point) const
{
BRect copy(*this);
copy.InsetBy(point);
@@ -89,7 +89,7 @@ BRect::InsetByCopy(BPoint point)
BRect
BRect::InsetByCopy(float dx, float dy)
BRect::InsetByCopy(float dx, float dy) const
{
BRect copy(*this);
copy.InsetBy(dx, dy);
@@ -134,7 +134,7 @@ BRect::OffsetBySelf(float dx, float dy)
BRect
BRect::OffsetByCopy(BPoint point)
BRect::OffsetByCopy(BPoint point) const
{
BRect copy(*this);
copy.OffsetBy(point);
@@ -143,7 +143,7 @@ BRect::OffsetByCopy(BPoint point)
BRect
BRect::OffsetByCopy(float dx, float dy)
BRect::OffsetByCopy(float dx, float dy) const
{
BRect copy(*this);
copy.OffsetBy(dx, dy);
@@ -188,7 +188,7 @@ BRect::OffsetToSelf(float dx, float dy)
BRect
BRect::OffsetToCopy(BPoint point)
BRect::OffsetToCopy(BPoint point) const
{
BRect copy(*this);
copy.OffsetTo(point);
@@ -197,7 +197,7 @@ BRect::OffsetToCopy(BPoint point)
BRect
BRect::OffsetToCopy(float dx, float dy)
BRect::OffsetToCopy(float dx, float dy) const
{
BRect copy(*this);
copy.OffsetTo(dx, dy);
@@ -215,31 +215,31 @@ BRect::PrintToStream() const
bool
BRect::operator==(BRect rect) const
{
return left == rect.left && right == rect.right &&
top == rect.top && bottom == rect.bottom;
return left == rect.left && right == rect.right &&
top == rect.top && bottom == rect.bottom;
}
bool
BRect::operator!=(BRect rect) const
{
return !(*this == rect);
return !(*this == rect);
}
BRect
BRect::operator&(BRect rect) const
{
return BRect(max_c(left, rect.left), max_c(top, rect.top),
min_c(right, rect.right), min_c(bottom, rect.bottom));
return BRect(max_c(left, rect.left), max_c(top, rect.top),
min_c(right, rect.right), min_c(bottom, rect.bottom));
}
BRect
BRect::operator|(BRect rect) const
{
return BRect(min_c(left, rect.left), min_c(top, rect.top),
max_c(right, rect.right), max_c(bottom, rect.bottom));
return BRect(min_c(left, rect.left), min_c(top, rect.top),
max_c(right, rect.right), max_c(bottom, rect.bottom));
}
@@ -250,7 +250,7 @@ BRect::Intersects(BRect rect) const
return false;
return !(rect.left > right || rect.right < left
|| rect.top > bottom || rect.bottom < top);
|| rect.top > bottom || rect.bottom < top);
}
@@ -258,7 +258,7 @@ bool
BRect::Contains(BPoint point) const
{
return point.x >= left && point.x <= right
&& point.y >= top && point.y <= bottom;
&& point.y >= top && point.y <= bottom;
}
@@ -266,5 +266,66 @@ bool
BRect::Contains(BRect rect) const
{
return rect.left >= left && rect.right <= right
&& rect.top >= top && rect.bottom <= bottom;
&& rect.top >= top && rect.bottom <= bottom;
}
// #pragma mark - BeOS compatibility only
#if __GNUC__ == 2
extern "C" BRect
InsetByCopy__5BRectG6BPoint(BRect* self, BPoint point)
{
BRect copy(*self);
copy.InsetBy(point);
return copy;
}
extern "C" BRect
InsetByCopy__5BRectff(BRect* self, float dx, float dy)
{
BRect copy(*self);
copy.InsetBy(dx, dy);
return copy;
}
extern "C" BRect
OffsetByCopy__5BRectG6BPoint(BRect* self, BPoint point)
{
BRect copy(*self);
copy.OffsetBy(point);
return copy;
}
extern "C" BRect
OffsetByCopy__5BRectff(BRect* self, float dx, float dy)
{
BRect copy(*self);
copy.OffsetBy(dx, dy);
return copy;
}
extern "C" BRect
OffsetToCopy__5BRectG6BPoint(BRect* self, BPoint point)
{
BRect copy(*self);
copy.OffsetTo(point);
return copy;
}
extern "C" BRect
OffsetToCopy__5BRectff(BRect* self, float dx, float dy)
{
BRect copy(*self);
copy.OffsetTo(dx, dy);
return copy;
}
#endif // __GNUC__ == 2
+9 -67
View File
@@ -701,19 +701,24 @@ BScrollBar::MouseDown(BPoint where)
// hit test for arrows or empty area
float scrollValue = 0.0;
// pressing the shift key scrolls faster
float buttonStepSize
= (modifiers() & B_SHIFT_KEY) != 0 ? fLargeStep : fSmallStep;
fPrivateData->fButtonDown = _ButtonFor(where);
switch (fPrivateData->fButtonDown) {
case ARROW1:
scrollValue = -fSmallStep;
scrollValue = -buttonStepSize;
break;
case ARROW2:
scrollValue = fSmallStep;
scrollValue = buttonStepSize;
break;
case ARROW3:
scrollValue = -fSmallStep;
scrollValue = -buttonStepSize;
break;
case ARROW4:
scrollValue = fSmallStep;
scrollValue = buttonStepSize;
break;
case NOARROW:
// we hit the empty area, figure out which side of the thumb
@@ -1153,69 +1158,6 @@ BScrollBar::Draw(BRect updateRect)
FillRect(rect);
}
}
if (fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_NONE)
return;
// draw the scrollbar thumb knobs
bool square = fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_DOTS;
int32 knobWidth = 0;
int32 knobHeight = 0;
if (square) {
knobWidth = 2;
knobHeight = 2;
} else {
knobWidth = 1;
knobHeight = 3;
}
int32 flags = 0;
if (!enabled)
flags |= BControlLook::B_DISABLED;
float hmiddle = rect.Width() / 2;
float vmiddle = rect.Height() / 2;
BRect middleKnob = BRect(
rect.left + hmiddle
- (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight),
rect.top + vmiddle
- (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth),
rect.left + hmiddle
+ (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight),
rect.top + vmiddle
+ (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth));
if (fOrientation == B_HORIZONTAL) {
BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0);
if (leftKnob.left > rect.left + knobWidth) {
be_control_look->DrawButtonBackground(this, leftKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
}
BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0);
if (rightKnob.right < rect.right - knobWidth) {
be_control_look->DrawButtonBackground(this, rightKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
}
} else {
BRect topKnob = middleKnob.OffsetByCopy(0, knobWidth * -4);
if (topKnob.top > rect.top + knobHeight) {
be_control_look->DrawButtonBackground(this, topKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
}
BRect bottomKnob = middleKnob.OffsetByCopy(0, knobWidth * 4);
if (bottomKnob.bottom < rect.bottom - knobHeight) {
be_control_look->DrawButtonBackground(this, bottomKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
}
}
// draw middle knob last because it modifies middleKnob
be_control_look->DrawButtonBackground(this, middleKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
}
+80 -34
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku Inc.
* Copyright 2001-2012, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,12 +8,14 @@
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
*/
/*! BTextControl displays text that can act like a control. */
#include <string.h>
#include <TextControl.h>
#include <string.h>
#include <AbstractLayoutItem.h>
#include <ControlLook.h>
#include <LayoutUtils.h>
@@ -82,8 +84,11 @@ public:
virtual BSize BasePreferredSize();
virtual BAlignment BaseAlignment();
BRect FrameInParent() const;
virtual status_t Archive(BMessage* into, bool deep = true) const;
static BArchivable* Instantiate(BMessage* from);
private:
BTextControl* fParent;
BRect fFrame;
@@ -109,6 +114,8 @@ public:
virtual BSize BasePreferredSize();
virtual BAlignment BaseAlignment();
BRect FrameInParent() const;
virtual status_t Archive(BMessage* into, bool deep = true) const;
static BArchivable* Instantiate(BMessage* from);
private:
@@ -425,13 +432,17 @@ BTextControl::Draw(BRect updateRect)
be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
flags);
rect = Bounds();
rect.right = fDivider - kLabelInputSpacing;
// rect.right = fText->Frame().left - 2;
// rect.right -= 3;//be_control_look->DefaultLabelSpacing();
be_control_look->DrawLabel(this, Label(), rect, updateRect,
base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
if (Label() != NULL) {
if (fLayoutData->label_layout_item != NULL) {
rect = fLayoutData->label_layout_item->FrameInParent();
} else {
rect = Bounds();
rect.right = fDivider - kLabelInputSpacing;
}
be_control_look->DrawLabel(this, Label(), rect, updateRect,
base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
}
return;
}
@@ -524,9 +535,8 @@ BTextControl::Draw(BRect updateRect)
void
BTextControl::MouseDown(BPoint where)
{
if (!fText->IsFocus()) {
if (!fText->IsFocus())
fText->MakeFocus(true);
}
}
@@ -892,23 +902,28 @@ BTextControl::DoLayout()
if (size.height < fLayoutData->min.height)
size.height = fLayoutData->min.height;
BRect dirty(fText->Frame());
BRect textFrame;
// divider
float divider = 0;
if (fLayoutData->label_layout_item && fLayoutData->text_view_layout_item) {
// We have layout items. They define the divider location.
divider = fLayoutData->text_view_layout_item->Frame().left
- fLayoutData->label_layout_item->Frame().left;
if (fLayoutData->text_view_layout_item != NULL) {
if (fLayoutData->label_layout_item != NULL) {
// We have layout items. They define the divider location.
divider = fabs(fLayoutData->text_view_layout_item->Frame().left
- fLayoutData->label_layout_item->Frame().left);
}
textFrame = fLayoutData->text_view_layout_item->FrameInParent();
} else {
if (fLayoutData->label_width > 0)
divider = fLayoutData->label_width + 5;
if (fLayoutData->label_width > 0) {
divider = fLayoutData->label_width
+ be_control_look->DefaultLabelSpacing();
}
textFrame.Set(divider, 0, size.width, size.height);
}
// text view
BRect dirty(fText->Frame());
BRect textFrame(divider + kFrameMargin, kFrameMargin,
size.width - kFrameMargin, size.height - kFrameMargin);
// place the text view and set the divider
textFrame.InsetBy(kFrameMargin, kFrameMargin);
BLayoutUtils::AlignInFrame(fText, textFrame);
fDivider = divider;
@@ -1071,7 +1086,6 @@ BTextControl::_InitData(const char* label, const BMessage* archive)
if (label)
fDivider = floorf(bounds.Width() / 2.0f);
}
@@ -1139,8 +1153,14 @@ BTextControl::_LayoutTextView()
{
CALLED();
BRect frame = Bounds();
frame.left = fDivider;
BRect frame;
if (fLayoutData->text_view_layout_item != NULL) {
frame = fLayoutData->text_view_layout_item->FrameInParent();
} else {
frame = Bounds();
frame.left = fDivider;
}
// we are stroking the frame around the text view, which
// is 2 pixels wide
frame.InsetBy(kFrameMargin, kFrameMargin);
@@ -1160,17 +1180,26 @@ BTextControl::_UpdateFrame()
{
CALLED();
if (fLayoutData->label_layout_item && fLayoutData->text_view_layout_item) {
BRect labelFrame = fLayoutData->label_layout_item->Frame();
if (fLayoutData->text_view_layout_item != NULL) {
BRect textFrame = fLayoutData->text_view_layout_item->Frame();
BRect labelFrame;
if (fLayoutData->label_layout_item != NULL)
labelFrame = fLayoutData->label_layout_item->Frame();
// update divider
fDivider = textFrame.left - labelFrame.left;
BRect frame;
if (labelFrame.IsValid()) {
frame = textFrame | labelFrame;
MoveTo(labelFrame.left, labelFrame.top);
// update divider
fDivider = fabs(textFrame.left - labelFrame.left);
} else {
frame = textFrame;
fDivider = 0;
}
MoveTo(frame.left, frame.top);
BSize oldSize = Bounds().Size();
ResizeTo(textFrame.left + textFrame.Width() - labelFrame.left,
textFrame.top + textFrame.Height() - labelFrame.top);
ResizeTo(frame.Width(), frame.Height());
BSize newSize = Bounds().Size();
// If the size changes, ResizeTo() will trigger a relayout, otherwise
@@ -1203,8 +1232,10 @@ BTextControl::_ValidateLayoutData()
// compute the minimal divider
float divider = 0;
if (fLayoutData->label_width > 0)
divider = fLayoutData->label_width + 5;
if (fLayoutData->label_width > 0) {
divider = fLayoutData->label_width
+ be_control_look->DefaultLabelSpacing();
}
// If we shan't do real layout, we let the current divider take influence.
if (!(Flags() & B_SUPPORTS_LAYOUT))
@@ -1306,7 +1337,8 @@ BTextControl::LabelLayoutItem::BaseMinSize()
if (!fParent->Label())
return BSize(-1, -1);
return BSize(fParent->fLayoutData->label_width + 5,
return BSize(fParent->fLayoutData->label_width
+ be_control_look->DefaultLabelSpacing(),
fParent->fLayoutData->label_height);
}
@@ -1332,6 +1364,13 @@ BTextControl::LabelLayoutItem::BaseAlignment()
}
BRect
BTextControl::LabelLayoutItem::FrameInParent() const
{
return fFrame.OffsetByCopy(-fParent->Frame().left, -fParent->Frame().top);
}
status_t
BTextControl::LabelLayoutItem::Archive(BMessage* into, bool deep) const
{
@@ -1459,6 +1498,13 @@ BTextControl::TextViewLayoutItem::BaseAlignment()
}
BRect
BTextControl::TextViewLayoutItem::FrameInParent() const
{
return fFrame.OffsetByCopy(-fParent->Frame().left, -fParent->Frame().top);
}
status_t
BTextControl::TextViewLayoutItem::Archive(BMessage* into, bool deep) const
{
+63 -8
View File
@@ -194,6 +194,14 @@ static const float kHorizontalScrollBarStep = 10.0;
static const float kVerticalScrollBarStep = 12.0;
enum {
NAVIGATE_TO_PREVIOUS_WORD = '_NVP',
NAVIGATE_TO_NEXT_WORD = '_NVN',
NAVIGATE_TO_TOP = '_NVT',
NAVIGATE_TO_BOTTOM = '_NVB',
};
static property_info sPropertyList[] = {
{
"selection",
@@ -1032,6 +1040,20 @@ BTextView::MessageReceived(BMessage *message)
_TrackDrag(fWhere);
break;
case NAVIGATE_TO_PREVIOUS_WORD:
_HandleArrowKey(B_LEFT_ARROW, true);
break;
case NAVIGATE_TO_NEXT_WORD:
_HandleArrowKey(B_RIGHT_ARROW, true);
break;
case NAVIGATE_TO_TOP:
_HandlePageKey(B_HOME, true);
break;
case NAVIGATE_TO_BOTTOM:
_HandlePageKey(B_END, true);
break;
default:
BView::MessageReceived(message);
break;
@@ -3216,6 +3238,9 @@ BTextView::_InitObject(BRect textRect, const BFont *initialFont,
fLines = new LineBuffer;
fStyles = new StyleBuffer(&font, initialColor);
fInstalledNavigateWordwiseShortcuts = false;
fInstalledNavigateToTopOrBottomShortcuts = false;
// We put these here instead of in the constructor initializer list
// to have less code duplication, and a single place where to do changes
// if needed.
@@ -3298,7 +3323,7 @@ BTextView::_HandleBackspace()
\param inArrowKey The code for the pressed key.
*/
void
BTextView::_HandleArrowKey(uint32 inArrowKey)
BTextView::_HandleArrowKey(uint32 inArrowKey, bool commandKeyDown)
{
// return if there's nowhere to go
if (fText->Length() == 0)
@@ -3313,7 +3338,6 @@ BTextView::_HandleArrowKey(uint32 inArrowKey)
message->FindInt32("modifiers", &modifiers);
bool shiftDown = modifiers & B_SHIFT_KEY;
bool ctrlDown = modifiers & B_CONTROL_KEY;
int32 lastClickOffset = fCaretOffset;
switch (inArrowKey) {
@@ -3324,7 +3348,7 @@ BTextView::_HandleArrowKey(uint32 inArrowKey)
fCaretOffset = fSelStart;
else {
fCaretOffset
= ctrlDown
= commandKeyDown
? _PreviousWordStart(fCaretOffset - 1)
: _PreviousInitialByte(fCaretOffset);
if (shiftDown && fCaretOffset != lastClickOffset) {
@@ -3350,7 +3374,7 @@ BTextView::_HandleArrowKey(uint32 inArrowKey)
fCaretOffset = fSelEnd;
else {
fCaretOffset
= ctrlDown
= commandKeyDown
? _NextWordEnd(fCaretOffset)
: _NextInitialByte(fCaretOffset);
if (shiftDown && fCaretOffset != lastClickOffset) {
@@ -3475,7 +3499,7 @@ BTextView::_HandleDelete()
\param inPageKey The page key which has been pressed.
*/
void
BTextView::_HandlePageKey(uint32 inPageKey)
BTextView::_HandlePageKey(uint32 inPageKey, bool commandKeyDown)
{
int32 mods = 0;
BMessage *currentMessage = Window()->CurrentMessage();
@@ -3483,7 +3507,6 @@ BTextView::_HandlePageKey(uint32 inPageKey)
currentMessage->FindInt32("modifiers", &mods);
bool shiftDown = mods & B_SHIFT_KEY;
bool ctrlDown = mods & B_CONTROL_KEY;
STELine* line = NULL;
int32 selStart = fSelStart;
int32 selEnd = fSelEnd;
@@ -3496,7 +3519,7 @@ BTextView::_HandlePageKey(uint32 inPageKey)
break;
}
if (ctrlDown) {
if (commandKeyDown) {
_ScrollTo(0, 0);
fCaretOffset = 0;
} else {
@@ -3529,7 +3552,7 @@ BTextView::_HandlePageKey(uint32 inPageKey)
break;
}
if (ctrlDown) {
if (commandKeyDown) {
_ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset);
fCaretOffset = fText->Length();
} else {
@@ -5044,6 +5067,25 @@ BTextView::_Activate()
GetMouse(&where, &buttons, false);
if (Bounds().Contains(where))
_TrackMouse(where, NULL);
if (Window() != NULL) {
if (!Window()->HasShortcut(B_LEFT_ARROW, B_COMMAND_KEY)
&& !Window()->HasShortcut(B_RIGHT_ARROW, B_COMMAND_KEY)) {
Window()->AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY,
new BMessage(NAVIGATE_TO_PREVIOUS_WORD), this);
Window()->AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY,
new BMessage(NAVIGATE_TO_NEXT_WORD), this);
fInstalledNavigateWordwiseShortcuts = true;
}
if (!Window()->HasShortcut(B_HOME, B_COMMAND_KEY)
&& !Window()->HasShortcut(B_END, B_COMMAND_KEY)) {
Window()->AddShortcut(B_HOME, B_COMMAND_KEY,
new BMessage(NAVIGATE_TO_TOP), this);
Window()->AddShortcut(B_END, B_COMMAND_KEY,
new BMessage(NAVIGATE_TO_BOTTOM), this);
fInstalledNavigateToTopOrBottomShortcuts = true;
}
}
}
@@ -5062,6 +5104,19 @@ BTextView::_Deactivate()
Highlight(fSelStart, fSelEnd);
} else
_HideCaret();
if (Window() != NULL) {
if (fInstalledNavigateWordwiseShortcuts) {
Window()->RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY);
Window()->RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY);
fInstalledNavigateWordwiseShortcuts = false;
}
if (fInstalledNavigateToTopOrBottomShortcuts) {
Window()->RemoveShortcut(B_HOME, B_COMMAND_KEY);
Window()->RemoveShortcut(B_END, B_COMMAND_KEY);
fInstalledNavigateToTopOrBottomShortcuts = false;
}
}
}
+14 -4
View File
@@ -4586,6 +4586,16 @@ BView::SetExplicitPreferredSize(BSize size)
}
void
BView::SetExplicitSize(BSize size)
{
fLayoutData->fMinSize = size;
fLayoutData->fMaxSize = size;
fLayoutData->fPreferredSize = size;
InvalidateLayout();
}
void
BView::SetExplicitAlignment(BAlignment alignment)
{
@@ -5711,11 +5721,11 @@ BView::ScrollWithMouseWheelDelta(BScrollBar* scrollBar, float delta)
float smallStep, largeStep;
scrollBar->GetSteps(&smallStep, &largeStep);
// pressing the option/command/control key scrolls faster
if (modifiers()
& (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) {
// pressing the shift key scrolls faster (following the pseudo-standard set
// by other desktop environments).
if ((modifiers() & B_SHIFT_KEY) != 0)
delta *= largeStep;
} else
else
delta *= smallStep * 3;
scrollBar->SetValue(scrollBar->Value() + delta);
+7
View File
@@ -1859,6 +1859,13 @@ BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message,
}
bool
BWindow::HasShortcut(uint32 key, uint32 modifiers)
{
return _FindShortcut(key, modifiers) != NULL;
}
void
BWindow::RemoveShortcut(uint32 key, uint32 modifiers)
{
+13 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Haiku Inc.
* Copyright 2002-2012, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,11 +7,13 @@
* Ingo Weinhold, bonefish@users.sf.net
*/
/*!
\file Path.cpp
BPath implementation.
*/
#include <Path.h>
#include <new>
@@ -402,6 +404,16 @@ BPath::GetParent(BPath* path) const
}
bool
BPath::IsAbsolute() const
{
if (InitCheck() != B_OK)
return false;
return fName[0] == '/';
}
/*! \brief Performs a simple (string-wise) comparison of paths.
No normalization takes place! Uninitialized BPath objects are considered
to be equal.
+24 -24
View File
@@ -54,7 +54,7 @@ private void ch__clearmacro(EditLine *);
/* cv_undo():
* Handle state for the vi undo command
*/
protected void
void
cv_undo(EditLine *el)
{
c_undo_t *vu = &el->el_chared.c_undo;
@@ -78,7 +78,7 @@ cv_undo(EditLine *el)
/* cv_yank():
* Save yank/delete data for paste
*/
protected void
void
cv_yank(EditLine *el, const char *ptr, int size)
{
c_kill_t *k = &el->el_chared.c_kill;
@@ -91,7 +91,7 @@ cv_yank(EditLine *el, const char *ptr, int size)
/* c_insert():
* Insert num characters
*/
protected void
void
c_insert(EditLine *el, int num)
{
char *cp;
@@ -113,7 +113,7 @@ c_insert(EditLine *el, int num)
/* c_delafter():
* Delete num characters after the cursor
*/
protected void
void
c_delafter(EditLine *el, int num)
{
@@ -139,7 +139,7 @@ c_delafter(EditLine *el, int num)
/* c_delafter1():
* Delete the character after the cursor, do not yank
*/
protected void
void
c_delafter1(EditLine *el)
{
char *cp;
@@ -154,7 +154,7 @@ c_delafter1(EditLine *el)
/* c_delbefore():
* Delete num characters before the cursor
*/
protected void
void
c_delbefore(EditLine *el, int num)
{
@@ -182,7 +182,7 @@ c_delbefore(EditLine *el, int num)
/* c_delbefore1():
* Delete the character before the cursor, do not yank
*/
protected void
void
c_delbefore1(EditLine *el)
{
char *cp;
@@ -197,7 +197,7 @@ c_delbefore1(EditLine *el)
/* ce__isword():
* Return if p is part of a word according to emacs
*/
protected int
int
ce__isword(int p)
{
return (isalnum(p) || strchr("*?_-.[]~=", p) != NULL);
@@ -207,7 +207,7 @@ ce__isword(int p)
/* cv__isword():
* Return if p is part of a word according to vi
*/
protected int
int
cv__isword(int p)
{
if (isalnum(p) || p == '_')
@@ -221,7 +221,7 @@ cv__isword(int p)
/* cv__isWord():
* Return if p is part of a big word according to vi
*/
protected int
int
cv__isWord(int p)
{
return (!isspace(p));
@@ -231,7 +231,7 @@ cv__isWord(int p)
/* c__prev_word():
* Find the previous word
*/
protected char *
char *
c__prev_word(char *p, char *low, int n, int (*wtest)(int))
{
p--;
@@ -255,7 +255,7 @@ c__prev_word(char *p, char *low, int n, int (*wtest)(int))
/* c__next_word():
* Find the next word
*/
protected char *
char *
c__next_word(char *p, char *high, int n, int (*wtest)(int))
{
while (n--) {
@@ -273,7 +273,7 @@ c__next_word(char *p, char *high, int n, int (*wtest)(int))
/* cv_next_word():
* Find the next word vi style
*/
protected char *
char *
cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int))
{
int test;
@@ -302,7 +302,7 @@ cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int))
/* cv_prev_word():
* Find the previous word vi style
*/
protected char *
char *
cv_prev_word(char *p, char *low, int n, int (*wtest)(int))
{
int test;
@@ -331,7 +331,7 @@ cv_prev_word(char *p, char *low, int n, int (*wtest)(int))
* A '$' by itself means a big number; "$-" is for negative; '^' means 1.
* Return p pointing to last char used.
*/
protected char *
char *
c__number(
char *p, /* character position */
int *num, /* Return value */
@@ -362,7 +362,7 @@ c__number(
/* cv_delfini():
* Finish vi delete action
*/
protected void
void
cv_delfini(EditLine *el)
{
int size;
@@ -401,7 +401,7 @@ cv_delfini(EditLine *el)
/* ce__endword():
* Go to the end of this word according to emacs
*/
protected char *
char *
ce__endword(char *p, char *high, int n)
{
p++;
@@ -422,7 +422,7 @@ ce__endword(char *p, char *high, int n)
/* cv__endword():
* Go to the end of this word according to vi
*/
protected char *
char *
cv__endword(char *p, char *high, int n, int (*wtest)(int))
{
int test;
@@ -444,7 +444,7 @@ cv__endword(char *p, char *high, int n, int (*wtest)(int))
/* ch_init():
* Initialize the character editor
*/
protected int
int
ch_init(EditLine *el)
{
c_macro_t *ma = &el->el_chared.c_macro;
@@ -500,7 +500,7 @@ ch_init(EditLine *el)
/* ch_reset():
* Reset the character editor
*/
protected void
void
ch_reset(EditLine *el, int mclear)
{
el->el_line.cursor = el->el_line.buffer;
@@ -541,7 +541,7 @@ ch__clearmacro(el)
* Enlarge line buffer to be able to hold twice as much characters.
* Returns 1 if successful, 0 if not.
*/
protected int
int
ch_enlargebufs(el, addlen)
EditLine *el;
size_t addlen;
@@ -627,7 +627,7 @@ ch_enlargebufs(el, addlen)
/* ch_end():
* Free the data structures used by the editor
*/
protected void
void
ch_end(EditLine *el)
{
el_free((ptr_t) el->el_line.buffer);
@@ -691,7 +691,7 @@ el_deletestr(EditLine *el, int n)
/* c_gets():
* Get a string
*/
protected int
int
c_gets(EditLine *el, char *buf, const char *prompt)
{
char ch;
@@ -756,7 +756,7 @@ c_gets(EditLine *el, char *buf, const char *prompt)
/* c_hpos():
* Return the current horizontal position of the cursor
*/
protected int
int
c_hpos(EditLine *el)
{
char *ptr;
+22 -22
View File
@@ -141,28 +141,28 @@ typedef struct el_chared_t {
#include "fcns.h"
protected int cv__isword(int);
protected int cv__isWord(int);
protected void cv_delfini(EditLine *);
protected char *cv__endword(char *, char *, int, int (*)(int));
protected int ce__isword(int);
protected void cv_undo(EditLine *);
protected void cv_yank(EditLine *, const char *, int);
protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int));
protected char *cv_prev_word(char *, char *, int, int (*)(int));
protected char *c__next_word(char *, char *, int, int (*)(int));
protected char *c__prev_word(char *, char *, int, int (*)(int));
protected void c_insert(EditLine *, int);
protected void c_delbefore(EditLine *, int);
protected void c_delbefore1(EditLine *);
protected void c_delafter(EditLine *, int);
protected void c_delafter1(EditLine *);
protected int c_gets(EditLine *, char *, const char *);
protected int c_hpos(EditLine *);
int cv__isword(int);
int cv__isWord(int);
void cv_delfini(EditLine *);
char *cv__endword(char *, char *, int, int (*)(int));
int ce__isword(int);
void cv_undo(EditLine *);
void cv_yank(EditLine *, const char *, int);
char *cv_next_word(EditLine*, char *, char *, int, int (*)(int));
char *cv_prev_word(char *, char *, int, int (*)(int));
char *c__next_word(char *, char *, int, int (*)(int));
char *c__prev_word(char *, char *, int, int (*)(int));
void c_insert(EditLine *, int);
void c_delbefore(EditLine *, int);
void c_delbefore1(EditLine *);
void c_delafter(EditLine *, int);
void c_delafter1(EditLine *);
int c_gets(EditLine *, char *, const char *);
int c_hpos(EditLine *);
protected int ch_init(EditLine *);
protected void ch_reset(EditLine *, int);
protected int ch_enlargebufs(EditLine *, size_t);
protected void ch_end(EditLine *);
int ch_init(EditLine *);
void ch_reset(EditLine *, int);
int ch_enlargebufs(EditLine *, size_t);
void ch_end(EditLine *);
#endif /* _h_el_chared */
+35 -35
View File
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/common.c,v 1.11 2005/08/09 13:37:59 stefanf
* Indicate end of file
* [^D]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_end_of_file(EditLine *el, int c __unused)
{
@@ -63,7 +63,7 @@ ed_end_of_file(EditLine *el, int c __unused)
* Add character to the line
* Insert a character [bound to all insert keys]
*/
protected el_action_t
el_action_t
ed_insert(EditLine *el, int c)
{
int count = el->el_state.argument;
@@ -105,7 +105,7 @@ ed_insert(EditLine *el, int c)
* Delete from beginning of current word to cursor
* [M-^?] [^W]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_delete_prev_word(EditLine *el, int c __unused)
{
@@ -133,7 +133,7 @@ ed_delete_prev_word(EditLine *el, int c __unused)
* Delete character under cursor
* [^D] [x]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_delete_next_char(EditLine *el, int c __unused)
{
@@ -184,7 +184,7 @@ ed_delete_next_char(EditLine *el, int c __unused)
* Cut to the end of line
* [^K] [^K]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_kill_line(EditLine *el, int c __unused)
{
@@ -205,7 +205,7 @@ ed_kill_line(EditLine *el, int c __unused)
* Move cursor to the end of line
* [^E] [^E]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_move_to_end(EditLine *el, int c __unused)
{
@@ -228,7 +228,7 @@ ed_move_to_end(EditLine *el, int c __unused)
* Move cursor to the beginning of line
* [^A] [^A]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_move_to_beg(EditLine *el, int c __unused)
{
@@ -252,7 +252,7 @@ ed_move_to_beg(EditLine *el, int c __unused)
* Exchange the character to the left of the cursor with the one under it
* [^T] [^T]
*/
protected el_action_t
el_action_t
ed_transpose_chars(EditLine *el, int c)
{
@@ -277,7 +277,7 @@ ed_transpose_chars(EditLine *el, int c)
* Move to the right one character
* [^F] [^F]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_next_char(EditLine *el, int c __unused)
{
@@ -306,7 +306,7 @@ ed_next_char(EditLine *el, int c __unused)
* Move to the beginning of the current word
* [M-b] [b]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_prev_word(EditLine *el, int c __unused)
{
@@ -332,7 +332,7 @@ ed_prev_word(EditLine *el, int c __unused)
* Move to the left one character
* [^B] [^B]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_prev_char(EditLine *el, int c __unused)
{
@@ -357,7 +357,7 @@ ed_prev_char(EditLine *el, int c __unused)
* Add the next character typed verbatim
* [^V] [^V]
*/
protected el_action_t
el_action_t
ed_quoted_insert(EditLine *el, int c)
{
int num;
@@ -377,7 +377,7 @@ ed_quoted_insert(EditLine *el, int c)
/* ed_digit():
* Adds to argument or enters a digit
*/
protected el_action_t
el_action_t
ed_digit(EditLine *el, int c)
{
@@ -405,7 +405,7 @@ ed_digit(EditLine *el, int c)
* Digit that starts argument
* For ESC-n
*/
protected el_action_t
el_action_t
ed_argument_digit(EditLine *el, int c)
{
@@ -429,7 +429,7 @@ ed_argument_digit(EditLine *el, int c)
* Indicates unbound character
* Bound to keys that are not assigned
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_unassigned(EditLine *el, int c __unused)
{
@@ -446,7 +446,7 @@ ed_unassigned(EditLine *el, int c __unused)
* Tty interrupt character
* [^C]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_sigint(EditLine *el __unused,
int c __unused)
@@ -460,7 +460,7 @@ ed_tty_sigint(EditLine *el __unused,
* Tty delayed suspend character
* [^Y]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_dsusp(EditLine *el __unused,
int c __unused)
@@ -474,7 +474,7 @@ ed_tty_dsusp(EditLine *el __unused,
* Tty flush output characters
* [^O]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_flush_output(EditLine *el __unused,
int c __unused)
@@ -488,7 +488,7 @@ ed_tty_flush_output(EditLine *el __unused,
* Tty quit character
* [^\]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_sigquit(EditLine *el __unused,
int c __unused)
@@ -502,7 +502,7 @@ ed_tty_sigquit(EditLine *el __unused,
* Tty suspend character
* [^Z]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_sigtstp(EditLine *el __unused,
int c __unused)
@@ -516,7 +516,7 @@ ed_tty_sigtstp(EditLine *el __unused,
* Tty disallow output characters
* [^S]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_stop_output(EditLine *el __unused,
int c __unused)
@@ -530,7 +530,7 @@ ed_tty_stop_output(EditLine *el __unused,
* Tty allow output characters
* [^Q]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_tty_start_output(EditLine *el __unused,
int c __unused)
@@ -544,7 +544,7 @@ ed_tty_start_output(EditLine *el __unused,
* Execute command
* [^J]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_newline(EditLine *el, int c __unused)
{
@@ -560,7 +560,7 @@ ed_newline(EditLine *el, int c __unused)
* Delete the character to the left of the cursor
* [^?]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_delete_prev_char(EditLine *el, int c __unused)
{
@@ -580,7 +580,7 @@ ed_delete_prev_char(EditLine *el, int c __unused)
* Clear screen leaving current line at the top
* [^L]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_clear_screen(EditLine *el, int c __unused)
{
@@ -595,7 +595,7 @@ ed_clear_screen(EditLine *el, int c __unused)
* Redisplay everything
* ^R
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_redisplay(EditLine *el __unused,
int c __unused)
@@ -609,7 +609,7 @@ ed_redisplay(EditLine *el __unused,
* Erase current line and start from scratch
* [^G]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_start_over(EditLine *el, int c __unused)
{
@@ -623,7 +623,7 @@ ed_start_over(EditLine *el, int c __unused)
* First character in a bound sequence
* Placeholder for external keys
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_sequence_lead_in(EditLine *el __unused,
int c __unused)
@@ -637,7 +637,7 @@ ed_sequence_lead_in(EditLine *el __unused,
* Move to the previous history line
* [^P] [k]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_prev_history(EditLine *el, int c __unused)
{
@@ -675,7 +675,7 @@ ed_prev_history(EditLine *el, int c __unused)
* Move to the next history line
* [^N] [j]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_next_history(EditLine *el, int c __unused)
{
@@ -702,7 +702,7 @@ ed_next_history(EditLine *el, int c __unused)
* Search previous in history for a line matching the current
* next search history [M-P] [K]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_search_prev_history(EditLine *el, int c __unused)
{
@@ -770,7 +770,7 @@ ed_search_prev_history(EditLine *el, int c __unused)
* Search next in history for a line matching the current
* [M-N] [J]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_search_next_history(EditLine *el, int c __unused)
{
@@ -824,7 +824,7 @@ ed_search_next_history(EditLine *el, int c __unused)
* Move up one line
* Could be [k] [^p]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_prev_line(EditLine *el, int c __unused)
{
@@ -867,7 +867,7 @@ ed_prev_line(EditLine *el, int c __unused)
* Move down one line
* Could be [j] [^n]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_next_line(EditLine *el, int c __unused)
{
@@ -901,7 +901,7 @@ ed_next_line(EditLine *el, int c __unused)
* Editline extended command
* [M-X] [:]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
ed_command(EditLine *el, int c __unused)
{
+35 -35
View File
@@ -1,39 +1,39 @@
/* Automatically generated file, do not edit */
#ifndef _h_common_c
#define _h_common_c
protected el_action_t ed_end_of_file (EditLine *, int);
protected el_action_t ed_insert (EditLine *, int);
protected el_action_t ed_delete_prev_word (EditLine *, int);
protected el_action_t ed_delete_next_char (EditLine *, int);
protected el_action_t ed_kill_line (EditLine *, int);
protected el_action_t ed_move_to_end (EditLine *, int);
protected el_action_t ed_move_to_beg (EditLine *, int);
protected el_action_t ed_transpose_chars (EditLine *, int);
protected el_action_t ed_next_char (EditLine *, int);
protected el_action_t ed_prev_word (EditLine *, int);
protected el_action_t ed_prev_char (EditLine *, int);
protected el_action_t ed_quoted_insert (EditLine *, int);
protected el_action_t ed_digit (EditLine *, int);
protected el_action_t ed_argument_digit (EditLine *, int);
protected el_action_t ed_unassigned (EditLine *, int);
protected el_action_t ed_tty_sigint (EditLine *, int);
protected el_action_t ed_tty_dsusp (EditLine *, int);
protected el_action_t ed_tty_flush_output (EditLine *, int);
protected el_action_t ed_tty_sigquit (EditLine *, int);
protected el_action_t ed_tty_sigtstp (EditLine *, int);
protected el_action_t ed_tty_stop_output (EditLine *, int);
protected el_action_t ed_tty_start_output (EditLine *, int);
protected el_action_t ed_newline (EditLine *, int);
protected el_action_t ed_delete_prev_char (EditLine *, int);
protected el_action_t ed_clear_screen (EditLine *, int);
protected el_action_t ed_redisplay (EditLine *, int);
protected el_action_t ed_start_over (EditLine *, int);
protected el_action_t ed_sequence_lead_in (EditLine *, int);
protected el_action_t ed_prev_history (EditLine *, int);
protected el_action_t ed_next_history (EditLine *, int);
protected el_action_t ed_search_prev_history (EditLine *, int);
protected el_action_t ed_search_next_history (EditLine *, int);
protected el_action_t ed_prev_line (EditLine *, int);
protected el_action_t ed_next_line (EditLine *, int);
protected el_action_t ed_command (EditLine *, int);
el_action_t ed_end_of_file (EditLine *, int);
el_action_t ed_insert (EditLine *, int);
el_action_t ed_delete_prev_word (EditLine *, int);
el_action_t ed_delete_next_char (EditLine *, int);
el_action_t ed_kill_line (EditLine *, int);
el_action_t ed_move_to_end (EditLine *, int);
el_action_t ed_move_to_beg (EditLine *, int);
el_action_t ed_transpose_chars (EditLine *, int);
el_action_t ed_next_char (EditLine *, int);
el_action_t ed_prev_word (EditLine *, int);
el_action_t ed_prev_char (EditLine *, int);
el_action_t ed_quoted_insert (EditLine *, int);
el_action_t ed_digit (EditLine *, int);
el_action_t ed_argument_digit (EditLine *, int);
el_action_t ed_unassigned (EditLine *, int);
el_action_t ed_tty_sigint (EditLine *, int);
el_action_t ed_tty_dsusp (EditLine *, int);
el_action_t ed_tty_flush_output (EditLine *, int);
el_action_t ed_tty_sigquit (EditLine *, int);
el_action_t ed_tty_sigtstp (EditLine *, int);
el_action_t ed_tty_stop_output (EditLine *, int);
el_action_t ed_tty_start_output (EditLine *, int);
el_action_t ed_newline (EditLine *, int);
el_action_t ed_delete_prev_char (EditLine *, int);
el_action_t ed_clear_screen (EditLine *, int);
el_action_t ed_redisplay (EditLine *, int);
el_action_t ed_start_over (EditLine *, int);
el_action_t ed_sequence_lead_in (EditLine *, int);
el_action_t ed_prev_history (EditLine *, int);
el_action_t ed_next_history (EditLine *, int);
el_action_t ed_search_prev_history (EditLine *, int);
el_action_t ed_search_next_history (EditLine *, int);
el_action_t ed_prev_line (EditLine *, int);
el_action_t ed_next_line (EditLine *, int);
el_action_t ed_command (EditLine *, int);
#endif /* _h_common_c */
+1 -1
View File
@@ -531,7 +531,7 @@ el_beep(EditLine *el)
/* el_editmode()
* Set the state of EDIT_DISABLED from the `edit' command.
*/
protected int
int
/*ARGSUSED*/
el_editmode(EditLine *el, int argc, const char **argv)
{
+1 -1
View File
@@ -134,7 +134,7 @@ struct editline {
el_read_t el_read; /* Character reading stuff */
};
protected int el_editmode(EditLine *, int, const char **);
int el_editmode(EditLine *, int, const char **);
#ifdef DEBUG
#define EL_ABORT(a) do { \
+20 -20
View File
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/emacs.c,v 1.10 2005/08/09 13:37:59 stefanf E
* Delete character under cursor or list completions if at end of line
* [^D]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_delete_or_list(EditLine *el, int c __unused)
{
@@ -82,7 +82,7 @@ em_delete_or_list(EditLine *el, int c __unused)
* Cut from cursor to end of current word
* [M-d]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_delete_next_word(EditLine *el, int c __unused)
{
@@ -111,7 +111,7 @@ em_delete_next_word(EditLine *el, int c __unused)
* Paste cut buffer at cursor position
* [^Y]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_yank(EditLine *el, int c __unused)
{
@@ -146,7 +146,7 @@ em_yank(EditLine *el, int c __unused)
* Cut the entire line and save in cut buffer
* [^U]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_kill_line(EditLine *el, int c __unused)
{
@@ -168,7 +168,7 @@ em_kill_line(EditLine *el, int c __unused)
* Cut area between mark and cursor and save in cut buffer
* [^W]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_kill_region(EditLine *el, int c __unused)
{
@@ -201,7 +201,7 @@ em_kill_region(EditLine *el, int c __unused)
* Copy area between mark and cursor to cut buffer
* [M-W]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_copy_region(EditLine *el, int c __unused)
{
@@ -231,7 +231,7 @@ em_copy_region(EditLine *el, int c __unused)
* Exchange the two characters before the cursor
* Gosling emacs transpose chars [^T]
*/
protected el_action_t
el_action_t
em_gosmacs_transpose(EditLine *el, int c)
{
@@ -250,7 +250,7 @@ em_gosmacs_transpose(EditLine *el, int c)
* Move next to end of current word
* [M-f]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_next_word(EditLine *el, int c __unused)
{
@@ -275,7 +275,7 @@ em_next_word(EditLine *el, int c __unused)
* Uppercase the characters from cursor to end of current word
* [M-u]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_upper_case(EditLine *el, int c __unused)
{
@@ -299,7 +299,7 @@ em_upper_case(EditLine *el, int c __unused)
* Capitalize the characters from cursor to end of current word
* [M-c]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_capitol_case(EditLine *el, int c __unused)
{
@@ -331,7 +331,7 @@ em_capitol_case(EditLine *el, int c __unused)
* Lowercase the characters from cursor to end of current word
* [M-l]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_lower_case(EditLine *el, int c __unused)
{
@@ -355,7 +355,7 @@ em_lower_case(EditLine *el, int c __unused)
* Set the mark at cursor
* [^@]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_set_mark(EditLine *el, int c __unused)
{
@@ -369,7 +369,7 @@ em_set_mark(EditLine *el, int c __unused)
* Exchange the cursor and mark
* [^X^X]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_exchange_mark(EditLine *el, int c __unused)
{
@@ -386,7 +386,7 @@ em_exchange_mark(EditLine *el, int c __unused)
* Universal argument (argument times 4)
* [^U]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_universal_argument(EditLine *el, int c __unused)
{ /* multiply current argument by 4 */
@@ -403,7 +403,7 @@ em_universal_argument(EditLine *el, int c __unused)
* Add 8th bit to next character typed
* [<ESC>]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_meta_next(EditLine *el, int c __unused)
{
@@ -416,7 +416,7 @@ em_meta_next(EditLine *el, int c __unused)
/* em_toggle_overwrite():
* Switch from insert to overwrite mode or vice versa
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_toggle_overwrite(EditLine *el, int c __unused)
{
@@ -430,7 +430,7 @@ em_toggle_overwrite(EditLine *el, int c __unused)
/* em_copy_prev_word():
* Copy current word to cursor
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_copy_prev_word(EditLine *el, int c __unused)
{
@@ -457,7 +457,7 @@ em_copy_prev_word(EditLine *el, int c __unused)
/* em_inc_search_next():
* Emacs incremental next search
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_inc_search_next(EditLine *el, int c __unused)
{
@@ -470,7 +470,7 @@ em_inc_search_next(EditLine *el, int c __unused)
/* em_inc_search_prev():
* Emacs incremental reverse search
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_inc_search_prev(EditLine *el, int c __unused)
{
@@ -484,7 +484,7 @@ em_inc_search_prev(EditLine *el, int c __unused)
* Delete the character to the left of the cursor
* [^?]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
em_delete_prev_char(EditLine *el, int c __unused)
{
+20 -20
View File
@@ -1,24 +1,24 @@
/* Automatically generated file, do not edit */
#ifndef _h_emacs_c
#define _h_emacs_c
protected el_action_t em_delete_or_list (EditLine *, int);
protected el_action_t em_delete_next_word (EditLine *, int);
protected el_action_t em_yank (EditLine *, int);
protected el_action_t em_kill_line (EditLine *, int);
protected el_action_t em_kill_region (EditLine *, int);
protected el_action_t em_copy_region (EditLine *, int);
protected el_action_t em_gosmacs_transpose (EditLine *, int);
protected el_action_t em_next_word (EditLine *, int);
protected el_action_t em_upper_case (EditLine *, int);
protected el_action_t em_capitol_case (EditLine *, int);
protected el_action_t em_lower_case (EditLine *, int);
protected el_action_t em_set_mark (EditLine *, int);
protected el_action_t em_exchange_mark (EditLine *, int);
protected el_action_t em_universal_argument (EditLine *, int);
protected el_action_t em_meta_next (EditLine *, int);
protected el_action_t em_toggle_overwrite (EditLine *, int);
protected el_action_t em_copy_prev_word (EditLine *, int);
protected el_action_t em_inc_search_next (EditLine *, int);
protected el_action_t em_inc_search_prev (EditLine *, int);
protected el_action_t em_delete_prev_char (EditLine *, int);
el_action_t em_delete_or_list (EditLine *, int);
el_action_t em_delete_next_word (EditLine *, int);
el_action_t em_yank (EditLine *, int);
el_action_t em_kill_line (EditLine *, int);
el_action_t em_kill_region (EditLine *, int);
el_action_t em_copy_region (EditLine *, int);
el_action_t em_gosmacs_transpose (EditLine *, int);
el_action_t em_next_word (EditLine *, int);
el_action_t em_upper_case (EditLine *, int);
el_action_t em_capitol_case (EditLine *, int);
el_action_t em_lower_case (EditLine *, int);
el_action_t em_set_mark (EditLine *, int);
el_action_t em_exchange_mark (EditLine *, int);
el_action_t em_universal_argument (EditLine *, int);
el_action_t em_meta_next (EditLine *, int);
el_action_t em_toggle_overwrite (EditLine *, int);
el_action_t em_copy_prev_word (EditLine *, int);
el_action_t em_inc_search_next (EditLine *, int);
el_action_t em_inc_search_prev (EditLine *, int);
el_action_t em_delete_prev_char (EditLine *, int);
#endif /* _h_emacs_c */
+1 -1
View File
@@ -55,4 +55,4 @@ private const el_func_t el_func[] = {
vi_yank_end, vi_zero,
};
protected const el_func_t* func__get() { return el_func; }
const el_func_t* func__get() { return el_func; }
+1 -1
View File
@@ -105,5 +105,5 @@
#define VI_ZERO 101
#define EL_NUM_FCNS 102
typedef el_action_t (*el_func_t)(EditLine *, int);
protected const el_func_t* func__get(void);
const el_func_t* func__get(void);
#endif /* _h_fcns_c */
+1 -1
View File
@@ -208,4 +208,4 @@ private const struct el_bindings_t el_func_help[] = {
"Editline extended command" },
};
protected const el_bindings_t* help__get(){ return el_func_help; }
const el_bindings_t* help__get(){ return el_func_help; }
+1 -1
View File
@@ -1,5 +1,5 @@
/* Automatically generated file, do not edit */
#ifndef _h_help_c
#define _h_help_c
protected const el_bindings_t *help__get(void);
const el_bindings_t *help__get(void);
#endif /* _h_help_c */
+6 -6
View File
@@ -42,7 +42,7 @@
/* hist_init():
* Initialization function.
*/
protected int
int
hist_init(EditLine *el)
{
@@ -60,7 +60,7 @@ hist_init(EditLine *el)
/* hist_end():
* clean up history;
*/
protected void
void
hist_end(EditLine *el)
{
@@ -72,7 +72,7 @@ hist_end(EditLine *el)
/* hist_set():
* Set new history interface
*/
protected int
int
hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr)
{
@@ -86,7 +86,7 @@ hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr)
* Get a history line and update it in the buffer.
* eventno tells us the event to get.
*/
protected el_action_t
el_action_t
hist_get(EditLine *el)
{
const char *hp;
@@ -144,7 +144,7 @@ hist_get(EditLine *el)
/* hist_command()
* process a history command
*/
protected int
int
hist_command(EditLine *el, int argc, const char **argv)
{
const char *str;
@@ -181,7 +181,7 @@ hist_command(EditLine *el, int argc, const char **argv)
* Enlarge history buffer to specified value. Called from el_enlargebufs().
* Return 0 for failure, 1 for success.
*/
protected int
int
/*ARGSUSED*/
hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz)
{
+6 -6
View File
@@ -67,11 +67,11 @@ typedef struct el_history_t {
#define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname)
#define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname)
protected int hist_init(EditLine *);
protected void hist_end(EditLine *);
protected el_action_t hist_get(EditLine *);
protected int hist_set(EditLine *, hist_fun_t, ptr_t);
protected int hist_command(EditLine *, int, const char **);
protected int hist_enlargebuf(EditLine *, size_t, size_t);
int hist_init(EditLine *);
void hist_end(EditLine *);
el_action_t hist_get(EditLine *);
int hist_set(EditLine *, hist_fun_t, ptr_t);
int hist_command(EditLine *, int, const char **);
int hist_enlargebuf(EditLine *, size_t, size_t);
#endif /* _h_el_hist */
+12 -12
View File
@@ -93,7 +93,7 @@ private int key__decode_char(char *, int, int);
/* key_init():
* Initialize the key maps
*/
protected int
int
key_init(EditLine *el)
{
@@ -108,7 +108,7 @@ key_init(EditLine *el)
/* key_end():
* Free the key maps
*/
protected void
void
key_end(EditLine *el)
{
@@ -121,7 +121,7 @@ key_end(EditLine *el)
/* key_map_cmd():
* Associate cmd with a key value
*/
protected key_value_t *
key_value_t *
key_map_cmd(EditLine *el, int cmd)
{
@@ -133,7 +133,7 @@ key_map_cmd(EditLine *el, int cmd)
/* key_map_str():
* Associate str with a key value
*/
protected key_value_t *
key_value_t *
key_map_str(EditLine *el, char *str)
{
@@ -147,7 +147,7 @@ key_map_str(EditLine *el, char *str)
* initializes el->el_key.map with arrow keys
* [Always bind the ansi arrow keys?]
*/
protected void
void
key_reset(EditLine *el)
{
@@ -165,7 +165,7 @@ key_reset(EditLine *el)
* Returns NULL in val.str and XK_STR for no match.
* The last character read is returned in *ch.
*/
protected int
int
key_get(EditLine *el, char *ch, key_value_t *val)
{
@@ -179,7 +179,7 @@ key_get(EditLine *el, char *ch, key_value_t *val)
* existing key. Ntype specifies if code is a command, an
* out str or a unix command.
*/
protected void
void
key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
{
@@ -207,7 +207,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
/* key_clear():
*
*/
protected void
void
key_clear(EditLine *el, el_action_t *map, const char *in)
{
@@ -224,7 +224,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
* Delete the key and all longer keys staring with key, if
* they exists.
*/
protected int
int
key_delete(EditLine *el, const char *key)
{
@@ -245,7 +245,7 @@ key_delete(EditLine *el, const char *key)
* Print the binding associated with key key.
* Print entire el->el_key.map if null
*/
protected void
void
key_print(EditLine *el, const char *key)
{
@@ -565,7 +565,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
* Print the specified key and its associated
* function specified by val
*/
protected void
void
key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
{
el_bindings_t *fp;
@@ -643,7 +643,7 @@ key__decode_char(char *buf, int cnt, int ch)
/* key__decode_str():
* Make a printable version of the ey
*/
protected char *
char *
key__decode_str(const char *str, char *buf, const char *sep)
{
char *b;
+12 -12
View File
@@ -64,18 +64,18 @@ typedef struct el_key_t {
#undef key_clear
#undef key_print
protected int key_init(EditLine *);
protected void key_end(EditLine *);
protected key_value_t *key_map_cmd(EditLine *, int);
protected key_value_t *key_map_str(EditLine *, char *);
protected void key_reset(EditLine *);
protected int key_get(EditLine *, char *, key_value_t *);
protected void key_add(EditLine *, const char *, key_value_t *, int);
protected void key_clear(EditLine *, el_action_t *, const char *);
protected int key_delete(EditLine *, const char *);
protected void key_print(EditLine *, const char *);
protected void key_kprint(EditLine *, const char *, key_value_t *,
int key_init(EditLine *);
void key_end(EditLine *);
key_value_t *key_map_cmd(EditLine *, int);
key_value_t *key_map_str(EditLine *, char *);
void key_reset(EditLine *);
int key_get(EditLine *, char *, key_value_t *);
void key_add(EditLine *, const char *, key_value_t *, int);
void key_clear(EditLine *, el_action_t *, const char *);
int key_delete(EditLine *, const char *);
void key_print(EditLine *, const char *);
void key_kprint(EditLine *, const char *, key_value_t *,
int);
protected char *key__decode_str(const char *, char *, const char *);
char *key__decode_str(const char *, char *, const char *);
#endif /* _h_el_key */
+8 -8
View File
@@ -884,7 +884,7 @@ private const el_action_t el_map_vi_command[] = {
/* map_init():
* Initialize and allocate the maps
*/
protected int
int
map_init(EditLine *el)
{
@@ -934,7 +934,7 @@ map_init(EditLine *el)
/* map_end():
* Free the space taken by the editor maps
*/
protected void
void
map_end(EditLine *el)
{
@@ -1012,7 +1012,7 @@ map_init_meta(EditLine *el)
/* map_init_vi():
* Initialize the vi bindings
*/
protected void
void
map_init_vi(EditLine *el)
{
int i;
@@ -1042,7 +1042,7 @@ map_init_vi(EditLine *el)
/* map_init_emacs():
* Initialize the emacs bindings
*/
protected void
void
map_init_emacs(EditLine *el)
{
int i;
@@ -1076,7 +1076,7 @@ map_init_emacs(EditLine *el)
/* map_set_editor():
* Set the editor
*/
protected int
int
map_set_editor(EditLine *el, char *editor)
{
@@ -1095,7 +1095,7 @@ map_set_editor(EditLine *el, char *editor)
/* map_get_editor():
* Retrieve the editor
*/
protected int
int
map_get_editor(EditLine *el, const char **editor)
{
@@ -1231,7 +1231,7 @@ map_print_all_keys(EditLine *el)
/* map_bind():
* Add/remove/change bindings
*/
protected int
int
map_bind(EditLine *el, int argc, const char **argv)
{
el_action_t *map;
@@ -1381,7 +1381,7 @@ map_bind(EditLine *el, int argc, const char **argv)
/* map_addfunc():
* add a user defined function
*/
protected int
int
map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
{
void *p;
+8 -8
View File
@@ -63,13 +63,13 @@ typedef struct el_map_t {
#define MAP_EMACS 0
#define MAP_VI 1
protected int map_bind(EditLine *, int, const char **);
protected int map_init(EditLine *);
protected void map_end(EditLine *);
protected void map_init_vi(EditLine *);
protected void map_init_emacs(EditLine *);
protected int map_set_editor(EditLine *, char *);
protected int map_get_editor(EditLine *, const char **);
protected int map_addfunc(EditLine *, const char *, const char *, el_func_t);
int map_bind(EditLine *, int, const char **);
int map_init(EditLine *);
void map_end(EditLine *);
void map_init_vi(EditLine *);
void map_init_emacs(EditLine *);
int map_set_editor(EditLine *, char *);
int map_get_editor(EditLine *, const char **);
int map_addfunc(EditLine *, const char *, const char *, el_func_t);
#endif /* _h_el_map */
+4 -4
View File
@@ -73,7 +73,7 @@ private const struct {
/* parse_line():
* Parse a line and dispatch it
*/
protected int
int
parse_line(EditLine *el, const char *line)
{
const char **argv;
@@ -133,7 +133,7 @@ el_parse(EditLine *el, int argc, const char *argv[])
* Parse a string of the form ^<char> \<odigit> \<char> and return
* the appropriate character or -1 if the escape is not valid
*/
protected int
int
parse__escape(const char **ptr)
{
const char *p;
@@ -211,7 +211,7 @@ parse__escape(const char **ptr)
/* parse__string():
* Parse the escapes from in and put the raw string out
*/
protected char *
char *
parse__string(char *out, const char *in)
{
char *rv = out;
@@ -249,7 +249,7 @@ parse__string(char *out, const char *in)
* Return the command number for the command string given
* or -1 if one is not found
*/
protected int
int
parse_cmd(EditLine *el, const char *cmd)
{
el_bindings_t *b;
+4 -4
View File
@@ -40,9 +40,9 @@
#ifndef _h_el_parse
#define _h_el_parse
protected int parse_line(EditLine *, const char *);
protected int parse__escape(const char **);
protected char *parse__string(char *, const char *);
protected int parse_cmd(EditLine *, const char *);
int parse_line(EditLine *, const char *);
int parse__escape(const char **);
char *parse__string(char *, const char *);
int parse_cmd(EditLine *, const char *);
#endif /* _h_el_parse */
+5 -5
View File
@@ -77,7 +77,7 @@ prompt_default_r(EditLine *el __unused)
* literal escape sequences in the prompt and we want a
* bit to flag them
*/
protected void
void
prompt_print(EditLine *el, int op)
{
el_prompt_t *elp;
@@ -99,7 +99,7 @@ prompt_print(EditLine *el, int op)
/* prompt_init():
* Initialize the prompt stuff
*/
protected int
int
prompt_init(EditLine *el)
{
@@ -116,7 +116,7 @@ prompt_init(EditLine *el)
/* prompt_end():
* Clean up the prompt stuff
*/
protected void
void
/*ARGSUSED*/
prompt_end(EditLine *el __unused)
{
@@ -126,7 +126,7 @@ prompt_end(EditLine *el __unused)
/* prompt_set():
* Install a prompt printing function
*/
protected int
int
prompt_set(EditLine *el, el_pfunc_t prf, int op)
{
el_prompt_t *p;
@@ -151,7 +151,7 @@ prompt_set(EditLine *el, el_pfunc_t prf, int op)
/* prompt_get():
* Retrieve the prompt printing function
*/
protected int
int
prompt_get(EditLine *el, el_pfunc_t *prf, int op)
{
+5 -5
View File
@@ -49,10 +49,10 @@ typedef struct el_prompt_t {
coord_t p_pos; /* position in the line after prompt */
} el_prompt_t;
protected void prompt_print(EditLine *, int);
protected int prompt_set(EditLine *, el_pfunc_t, int);
protected int prompt_get(EditLine *, el_pfunc_t *, int);
protected int prompt_init(EditLine *);
protected void prompt_end(EditLine *);
void prompt_print(EditLine *, int);
int prompt_set(EditLine *, el_pfunc_t, int);
int prompt_get(EditLine *, el_pfunc_t *, int);
int prompt_init(EditLine *);
void prompt_end(EditLine *);
#endif /* _h_el_prompt */
+5 -5
View File
@@ -59,7 +59,7 @@ private int read_getcmd(EditLine *, el_action_t *, char *);
/* read_init():
* Initialize the read stuff
*/
protected int
int
read_init(EditLine *el)
{
/* builtin read_char */
@@ -72,7 +72,7 @@ read_init(EditLine *el)
* Set the read char function to the one provided.
* If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one.
*/
protected int
int
el_read_setfn(EditLine *el, el_rfunc_t rc)
{
el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
@@ -84,7 +84,7 @@ el_read_setfn(EditLine *el, el_rfunc_t rc)
* return the current read char function, or EL_BUILTIN_GETCFN
* if it is the default one
*/
protected el_rfunc_t
el_rfunc_t
el_read_getfn(EditLine *el)
{
return (el->el_read.read_char == read_char) ?
@@ -348,7 +348,7 @@ el_getc(EditLine *el, char *cp)
return (num_read);
}
protected void
void
read_prepare(EditLine *el)
{
if (el->el_flags & HANDLE_SIGNALS)
@@ -369,7 +369,7 @@ read_prepare(EditLine *el)
term__flush();
}
protected void
void
read_finish(EditLine *el)
{
if ((el->el_flags & UNBUFFERED) == 0)
+5 -5
View File
@@ -49,10 +49,10 @@ typedef struct el_read_t {
el_rfunc_t read_char; /* Function to read a character */
} el_read_t;
protected int read_init(EditLine *);
protected void read_prepare(EditLine *);
protected void read_finish(EditLine *);
protected int el_read_setfn(EditLine *, el_rfunc_t);
protected el_rfunc_t el_read_getfn(EditLine *);
int read_init(EditLine *);
void read_prepare(EditLine *);
void read_finish(EditLine *);
int el_read_setfn(EditLine *, el_rfunc_t);
el_rfunc_t el_read_getfn(EditLine *);
#endif /* _h_el_read */
+7 -7
View File
@@ -132,7 +132,7 @@ re_addc(EditLine *el, int c)
/* re_putc():
* Draw the character given
*/
protected void
void
re_putc(EditLine *el, int c, int shift)
{
@@ -180,7 +180,7 @@ re_putc(EditLine *el, int c, int shift)
* virtual image. The routine to re-draw a line can be replaced
* easily in hopes of a smarter one being placed there.
*/
protected void
void
re_refresh(EditLine *el)
{
int i, rhdiff;
@@ -316,7 +316,7 @@ re_refresh(EditLine *el)
/* re_goto_bottom():
* used to go to last used screen line
*/
protected void
void
re_goto_bottom(EditLine *el)
{
@@ -952,7 +952,7 @@ re__copy_and_pad(char *dst, const char *src, size_t width)
/* re_refresh_cursor():
* Move to the new cursor position
*/
protected void
void
re_refresh_cursor(EditLine *el)
{
char *cp, c;
@@ -1062,7 +1062,7 @@ re_fastputc(EditLine *el, int c)
* we added just one char, handle it fast.
* Assumes that screen cursor == real cursor
*/
protected void
void
re_fastaddc(EditLine *el)
{
char c;
@@ -1099,7 +1099,7 @@ re_fastaddc(EditLine *el)
/* re_clear_display():
* clear the screen buffers so that new new prompt starts fresh.
*/
protected void
void
re_clear_display(EditLine *el)
{
int i;
@@ -1115,7 +1115,7 @@ re_clear_display(EditLine *el)
/* re_clear_lines():
* Make sure all lines are *really* blank
*/
protected void
void
re_clear_lines(EditLine *el)
{
+7 -7
View File
@@ -48,12 +48,12 @@ typedef struct {
int r_newcv;
} el_refresh_t;
protected void re_putc(EditLine *, int, int);
protected void re_clear_lines(EditLine *);
protected void re_clear_display(EditLine *);
protected void re_refresh(EditLine *);
protected void re_refresh_cursor(EditLine *);
protected void re_fastaddc(EditLine *);
protected void re_goto_bottom(EditLine *);
void re_putc(EditLine *, int, int);
void re_clear_lines(EditLine *);
void re_clear_display(EditLine *);
void re_refresh(EditLine *);
void re_refresh_cursor(EditLine *);
void re_fastaddc(EditLine *);
void re_goto_bottom(EditLine *);
#endif /* _h_el_refresh */
+10 -10
View File
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD: src/lib/libedit/search.c,v 1.10 2005/08/07 20:51:52 stefanf
/* search_init():
* Initialize the search stuff
*/
protected int
int
search_init(EditLine *el)
{
@@ -79,7 +79,7 @@ search_init(EditLine *el)
/* search_end():
* Initialize the search stuff
*/
protected void
void
search_end(EditLine *el)
{
@@ -103,7 +103,7 @@ regerror(const char *msg)
/* el_match():
* Return if string matches pattern
*/
protected int
int
el_match(const char *str, const char *pat)
{
#if defined (REGEX)
@@ -148,7 +148,7 @@ el_match(const char *str, const char *pat)
/* c_hmatch():
* return True if the pattern matches the prefix
*/
protected int
int
c_hmatch(EditLine *el, const char *str)
{
#ifdef SDEBUG
@@ -163,7 +163,7 @@ c_hmatch(EditLine *el, const char *str)
/* c_setpat():
* Set the history seatch pattern
*/
protected void
void
c_setpat(EditLine *el)
{
if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY &&
@@ -194,7 +194,7 @@ c_setpat(EditLine *el)
/* ce_inc_search():
* Emacs incremental search
*/
protected el_action_t
el_action_t
ce_inc_search(EditLine *el, int dir)
{
static const char STRfwd[] = {'f', 'w', 'd', '\0'},
@@ -440,7 +440,7 @@ ce_inc_search(EditLine *el, int dir)
/* cv_search():
* Vi search.
*/
protected el_action_t
el_action_t
cv_search(EditLine *el, int dir)
{
char ch;
@@ -514,7 +514,7 @@ cv_search(EditLine *el, int dir)
/* ce_search_line():
* Look for a pattern inside a line
*/
protected el_action_t
el_action_t
ce_search_line(EditLine *el, int dir)
{
char *cp = el->el_line.cursor;
@@ -556,7 +556,7 @@ ce_search_line(EditLine *el, int dir)
/* cv_repeat_srch():
* Vi repeat search
*/
protected el_action_t
el_action_t
cv_repeat_srch(EditLine *el, int c)
{
@@ -582,7 +582,7 @@ cv_repeat_srch(EditLine *el, int c)
/* cv_csearch():
* Vi character search
*/
protected el_action_t
el_action_t
cv_csearch(EditLine *el, int direction, int ch, int count, int tflag)
{
char *cp;
+10 -10
View File
@@ -52,15 +52,15 @@ typedef struct el_search_t {
} el_search_t;
protected int el_match(const char *, const char *);
protected int search_init(EditLine *);
protected void search_end(EditLine *);
protected int c_hmatch(EditLine *, const char *);
protected void c_setpat(EditLine *);
protected el_action_t ce_inc_search(EditLine *, int);
protected el_action_t cv_search(EditLine *, int);
protected el_action_t ce_search_line(EditLine *, int);
protected el_action_t cv_repeat_srch(EditLine *, int);
protected el_action_t cv_csearch(EditLine *, int, int, int, int);
int el_match(const char *, const char *);
int search_init(EditLine *);
void search_end(EditLine *);
int c_hmatch(EditLine *, const char *);
void c_setpat(EditLine *);
el_action_t ce_inc_search(EditLine *, int);
el_action_t cv_search(EditLine *, int);
el_action_t ce_search_line(EditLine *, int);
el_action_t cv_repeat_srch(EditLine *, int);
el_action_t cv_csearch(EditLine *, int, int, int, int);
#endif /* _h_el_search */
+4 -4
View File
@@ -103,7 +103,7 @@ sig_handler(int signo)
/* sig_init():
* Initialize all signal stuff
*/
protected int
int
sig_init(EditLine *el)
{
int i;
@@ -132,7 +132,7 @@ sig_init(EditLine *el)
/* sig_end():
* Clear all signal stuff
*/
protected void
void
sig_end(EditLine *el)
{
@@ -144,7 +144,7 @@ sig_end(EditLine *el)
/* sig_set():
* set all the signal handlers
*/
protected void
void
sig_set(EditLine *el)
{
int i;
@@ -170,7 +170,7 @@ sig_set(EditLine *el)
/* sig_clr():
* clear all the signal handlers
*/
protected void
void
sig_clr(EditLine *el)
{
int i;
+4 -4
View File
@@ -61,9 +61,9 @@
typedef void (*el_signalhandler_t)(int);
typedef el_signalhandler_t *el_signal_t;
protected void sig_end(EditLine*);
protected int sig_init(EditLine*);
protected void sig_set(EditLine*);
protected void sig_clr(EditLine*);
void sig_end(EditLine*);
int sig_init(EditLine*);
void sig_set(EditLine*);
void sig_clr(EditLine*);
#endif /* _h_el_sig */
+24 -24
View File
@@ -310,7 +310,7 @@ term_setflags(EditLine *el)
/* term_init():
* Initialize the terminal stuff
*/
protected int
int
term_init(EditLine *el)
{
@@ -341,7 +341,7 @@ term_init(EditLine *el)
/* term_end():
* Clean up the terminal stuff
*/
protected void
void
term_end(EditLine *el)
{
@@ -507,7 +507,7 @@ term_free_display(EditLine *el)
* move to line <where> (first line == 0)
* as efficiently as possible
*/
protected void
void
term_move_to_line(EditLine *el, int where)
{
int del;
@@ -563,7 +563,7 @@ term_move_to_line(EditLine *el, int where)
/* term_move_to_char():
* Move to the character position specified
*/
protected void
void
term_move_to_char(EditLine *el, int where)
{
int del, i;
@@ -652,7 +652,7 @@ mc_again:
/* term_overwrite():
* Overstrike num characters
*/
protected void
void
term_overwrite(EditLine *el, const char *cp, int n)
{
if (n <= 0)
@@ -694,7 +694,7 @@ term_overwrite(EditLine *el, const char *cp, int n)
/* term_deletechars():
* Delete num characters
*/
protected void
void
term_deletechars(EditLine *el, int num)
{
if (num <= 0)
@@ -736,7 +736,7 @@ term_deletechars(EditLine *el, int num)
* Puts terminal in insert character mode or inserts num
* characters in the line
*/
protected void
void
term_insertwrite(EditLine *el, char *cp, int num)
{
if (num <= 0)
@@ -797,7 +797,7 @@ term_insertwrite(EditLine *el, char *cp, int num)
/* term_clear_EOL():
* clear to end of line. There are num characters to clear
*/
protected void
void
term_clear_EOL(EditLine *el, int num)
{
int i;
@@ -815,7 +815,7 @@ term_clear_EOL(EditLine *el, int num)
/* term_clear_screen():
* Clear the screen
*/
protected void
void
term_clear_screen(EditLine *el)
{ /* clear the whole screen and home */
@@ -836,7 +836,7 @@ term_clear_screen(EditLine *el)
/* term_beep():
* Beep the way the terminal wants us
*/
protected void
void
term_beep(EditLine *el)
{
if (GoodStr(T_bl))
@@ -851,7 +851,7 @@ term_beep(EditLine *el)
/* term_clear_to_bottom():
* Clear to the bottom of the screen
*/
protected void
void
term_clear_to_bottom(EditLine *el)
{
if (GoodStr(T_cd))
@@ -861,7 +861,7 @@ term_clear_to_bottom(EditLine *el)
}
#endif
protected void
void
term_get(EditLine *el, const char **term)
{
*term = el->el_term.t_name;
@@ -871,7 +871,7 @@ term_get(EditLine *el, const char **term)
/* term_set():
* Read in the terminal capabilities from the requested terminal
*/
protected int
int
term_set(EditLine *el, const char *term)
{
int i;
@@ -960,7 +960,7 @@ term_set(EditLine *el, const char *term)
* Return the new window size in lines and cols, and
* true if the size was changed.
*/
protected int
int
term_get_size(EditLine *el, int *lins, int *cols)
{
@@ -996,7 +996,7 @@ term_get_size(EditLine *el, int *lins, int *cols)
/* term_change_size():
* Change the size of the terminal
*/
protected int
int
term_change_size(EditLine *el, int lins, int cols)
{
/*
@@ -1112,7 +1112,7 @@ term_reset_arrow(EditLine *el)
/* term_set_arrow():
* Set an arrow key binding
*/
protected int
int
term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type)
{
fkey_t *arrow = el->el_term.t_fkey;
@@ -1131,7 +1131,7 @@ term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type)
/* term_clear_arrow():
* Clear an arrow key binding
*/
protected int
int
term_clear_arrow(EditLine *el, const char *name)
{
fkey_t *arrow = el->el_term.t_fkey;
@@ -1149,7 +1149,7 @@ term_clear_arrow(EditLine *el, const char *name)
/* term_print_arrow():
* Print the arrow key bindings
*/
protected void
void
term_print_arrow(EditLine *el, const char *name)
{
int i;
@@ -1166,7 +1166,7 @@ term_print_arrow(EditLine *el, const char *name)
/* term_bind_arrow():
* Bind the arrow keys
*/
protected void
void
term_bind_arrow(EditLine *el)
{
el_action_t *map;
@@ -1223,7 +1223,7 @@ term_bind_arrow(EditLine *el)
/* term__putc():
* Add a character
*/
protected int
int
term__putc(int c)
{
@@ -1234,7 +1234,7 @@ term__putc(int c)
/* term__flush():
* Flush output
*/
protected void
void
term__flush(void)
{
@@ -1245,7 +1245,7 @@ term__flush(void)
/* term_telltc():
* Print the current termcap characteristics
*/
protected int
int
/*ARGSUSED*/
term_telltc(EditLine *el, int argc __unused,
const char **argv __unused)
@@ -1281,7 +1281,7 @@ term_telltc(EditLine *el, int argc __unused,
/* term_settc():
* Change the current terminal characteristics
*/
protected int
int
/*ARGSUSED*/
term_settc(EditLine *el, int argc __unused,
const char **argv)
@@ -1358,7 +1358,7 @@ term_settc(EditLine *el, int argc __unused,
/* term_echotc():
* Print the termcap string out with variable substitution
*/
protected int
int
/*ARGSUSED*/
term_echotc(EditLine *el, int argc __unused,
const char **argv)
+23 -23
View File
@@ -81,29 +81,29 @@ typedef struct {
#define A_K_EN 5
#define A_K_NKEYS 6
protected void term_move_to_line(EditLine *, int);
protected void term_move_to_char(EditLine *, int);
protected void term_clear_EOL(EditLine *, int);
protected void term_overwrite(EditLine *, const char *, int);
protected void term_insertwrite(EditLine *, char *, int);
protected void term_deletechars(EditLine *, int);
protected void term_clear_screen(EditLine *);
protected void term_beep(EditLine *);
protected int term_change_size(EditLine *, int, int);
protected int term_get_size(EditLine *, int *, int *);
protected int term_init(EditLine *);
protected void term_bind_arrow(EditLine *);
protected void term_print_arrow(EditLine *, const char *);
protected int term_clear_arrow(EditLine *, const char *);
protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
protected void term_end(EditLine *);
protected void term_get(EditLine *, const char **);
protected int term_set(EditLine *, const char *);
protected int term_settc(EditLine *, int, const char **);
protected int term_telltc(EditLine *, int, const char **);
protected int term_echotc(EditLine *, int, const char **);
protected int term__putc(int);
protected void term__flush(void);
void term_move_to_line(EditLine *, int);
void term_move_to_char(EditLine *, int);
void term_clear_EOL(EditLine *, int);
void term_overwrite(EditLine *, const char *, int);
void term_insertwrite(EditLine *, char *, int);
void term_deletechars(EditLine *, int);
void term_clear_screen(EditLine *);
void term_beep(EditLine *);
int term_change_size(EditLine *, int, int);
int term_get_size(EditLine *, int *, int *);
int term_init(EditLine *);
void term_bind_arrow(EditLine *);
void term_print_arrow(EditLine *, const char *);
int term_clear_arrow(EditLine *, const char *);
int term_set_arrow(EditLine *, const char *, key_value_t *, int);
void term_end(EditLine *);
void term_get(EditLine *, const char **);
int term_set(EditLine *, const char *);
int term_settc(EditLine *, int, const char **);
int term_telltc(EditLine *, int, const char **);
int term_echotc(EditLine *, int, const char **);
int term__putc(int);
void term__flush(void);
/*
* Easy access macros
+8 -8
View File
@@ -522,7 +522,7 @@ tty_setup(EditLine *el)
return (0);
}
protected int
int
tty_init(EditLine *el)
{
@@ -537,7 +537,7 @@ tty_init(EditLine *el)
/* tty_end():
* Restore the tty to its original settings
*/
protected void
void
/*ARGSUSED*/
tty_end(EditLine *el __unused)
{
@@ -834,7 +834,7 @@ tty__setchar(struct termios *td, unsigned char *s)
/* tty_bind_char():
* Rebind the editline functions
*/
protected void
void
tty_bind_char(EditLine *el, int force)
{
@@ -880,7 +880,7 @@ tty_bind_char(EditLine *el, int force)
/* tty_rawmode():
* Set terminal into 1 character at a time mode.
*/
protected int
int
tty_rawmode(EditLine *el)
{
@@ -1008,7 +1008,7 @@ tty_rawmode(EditLine *el)
/* tty_cookedmode():
* Set the tty back to normal mode
*/
protected int
int
tty_cookedmode(EditLine *el)
{ /* set tty in normal setup */
@@ -1034,7 +1034,7 @@ tty_cookedmode(EditLine *el)
/* tty_quotemode():
* Turn on quote mode
*/
protected int
int
tty_quotemode(EditLine *el)
{
if (el->el_tty.t_mode == QU_IO)
@@ -1069,7 +1069,7 @@ tty_quotemode(EditLine *el)
/* tty_noquotemode():
* Turn off quote mode
*/
protected int
int
tty_noquotemode(EditLine *el)
{
@@ -1090,7 +1090,7 @@ tty_noquotemode(EditLine *el)
/* tty_stty():
* Stty builtin
*/
protected int
int
/*ARGSUSED*/
tty_stty(EditLine *el, int argc __unused, const char **argv)
{
+8 -8
View File
@@ -456,14 +456,14 @@ typedef struct {
typedef unsigned char ttychar_t[NN_IO][C_NCC];
protected int tty_init(EditLine *);
protected void tty_end(EditLine *);
protected int tty_stty(EditLine *, int, const char **);
protected int tty_rawmode(EditLine *);
protected int tty_cookedmode(EditLine *);
protected int tty_quotemode(EditLine *);
protected int tty_noquotemode(EditLine *);
protected void tty_bind_char(EditLine *, int);
int tty_init(EditLine *);
void tty_end(EditLine *);
int tty_stty(EditLine *, int, const char **);
int tty_rawmode(EditLine *);
int tty_cookedmode(EditLine *);
int tty_quotemode(EditLine *);
int tty_noquotemode(EditLine *);
void tty_bind_char(EditLine *, int);
typedef struct {
ttyperm_t t_t;
+47 -47
View File
@@ -113,7 +113,7 @@ cv_paste(EditLine *el, int c)
* Vi paste previous deletion to the right of the cursor
* [p]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_paste_next(EditLine *el, int c __unused)
{
@@ -126,7 +126,7 @@ vi_paste_next(EditLine *el, int c __unused)
* Vi paste previous deletion to the left of the cursor
* [P]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_paste_prev(EditLine *el, int c __unused)
{
@@ -139,7 +139,7 @@ vi_paste_prev(EditLine *el, int c __unused)
* Vi move to the previous space delimited word
* [B]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_prev_big_word(EditLine *el, int c)
{
@@ -164,7 +164,7 @@ vi_prev_big_word(EditLine *el, int c)
* Vi move to the previous word
* [b]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_prev_word(EditLine *el, int c __unused)
{
@@ -189,7 +189,7 @@ vi_prev_word(EditLine *el, int c __unused)
* Vi move to the next space delimited word
* [W]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_next_big_word(EditLine *el, int c)
{
@@ -213,7 +213,7 @@ vi_next_big_word(EditLine *el, int c)
* Vi move to the next word
* [w]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_next_word(EditLine *el, int c __unused)
{
@@ -237,7 +237,7 @@ vi_next_word(EditLine *el, int c __unused)
* Vi change case of character under the cursor and advance one character
* [~]
*/
protected el_action_t
el_action_t
vi_change_case(EditLine *el, int c)
{
int i;
@@ -268,7 +268,7 @@ vi_change_case(EditLine *el, int c)
* Vi change prefix command
* [c]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_change_meta(EditLine *el, int c __unused)
{
@@ -285,7 +285,7 @@ vi_change_meta(EditLine *el, int c __unused)
* Vi enter insert mode at the beginning of line
* [I]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_insert_at_bol(EditLine *el, int c __unused)
{
@@ -301,7 +301,7 @@ vi_insert_at_bol(EditLine *el, int c __unused)
* Vi replace character under the cursor with the next character typed
* [r]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_replace_char(EditLine *el, int c __unused)
{
@@ -320,7 +320,7 @@ vi_replace_char(EditLine *el, int c __unused)
* Vi enter replace mode
* [R]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_replace_mode(EditLine *el, int c __unused)
{
@@ -336,7 +336,7 @@ vi_replace_mode(EditLine *el, int c __unused)
* Vi replace character under the cursor and enter insert mode
* [s]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_substitute_char(EditLine *el, int c __unused)
{
@@ -351,7 +351,7 @@ vi_substitute_char(EditLine *el, int c __unused)
* Vi substitute entire line
* [S]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_substitute_line(EditLine *el, int c __unused)
{
@@ -369,7 +369,7 @@ vi_substitute_line(EditLine *el, int c __unused)
* Vi change to end of line
* [C]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_change_to_eol(EditLine *el, int c __unused)
{
@@ -387,7 +387,7 @@ vi_change_to_eol(EditLine *el, int c __unused)
* Vi enter insert mode
* [i]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_insert(EditLine *el, int c __unused)
{
@@ -402,7 +402,7 @@ vi_insert(EditLine *el, int c __unused)
* Vi enter insert mode after the cursor
* [a]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_add(EditLine *el, int c __unused)
{
@@ -427,7 +427,7 @@ vi_add(EditLine *el, int c __unused)
* Vi enter insert mode at end of line
* [A]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_add_at_eol(EditLine *el, int c __unused)
{
@@ -443,7 +443,7 @@ vi_add_at_eol(EditLine *el, int c __unused)
* Vi delete prefix command
* [d]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_delete_meta(EditLine *el, int c __unused)
{
@@ -456,7 +456,7 @@ vi_delete_meta(EditLine *el, int c __unused)
* Vi move to the end of the current space delimited word
* [E]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_end_big_word(EditLine *el, int c)
{
@@ -480,7 +480,7 @@ vi_end_big_word(EditLine *el, int c)
* Vi move to the end of the current word
* [e]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_end_word(EditLine *el, int c __unused)
{
@@ -504,7 +504,7 @@ vi_end_word(EditLine *el, int c __unused)
* Vi undo last change
* [u]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_undo(EditLine *el, int c __unused)
{
@@ -530,7 +530,7 @@ vi_undo(EditLine *el, int c __unused)
* Vi enter command mode (use alternative key bindings)
* [<ESC>]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_command_mode(EditLine *el, int c __unused)
{
@@ -555,7 +555,7 @@ vi_command_mode(EditLine *el, int c __unused)
* Vi move to the beginning of line
* [0]
*/
protected el_action_t
el_action_t
vi_zero(EditLine *el, int c)
{
@@ -575,7 +575,7 @@ vi_zero(EditLine *el, int c)
* Vi move to previous character (backspace)
* [^H] in insert mode only
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_delete_prev_char(EditLine *el, int c __unused)
{
@@ -593,7 +593,7 @@ vi_delete_prev_char(EditLine *el, int c __unused)
* Vi list choices for completion or indicate end of file if empty line
* [^D]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_list_or_eof(EditLine *el, int c __unused)
{
@@ -631,7 +631,7 @@ vi_list_or_eof(EditLine *el, int c __unused)
* Vi cut from beginning of line to cursor
* [^U]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_kill_line_prev(EditLine *el, int c __unused)
{
@@ -652,7 +652,7 @@ vi_kill_line_prev(EditLine *el, int c __unused)
* Vi search history previous
* [?]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_search_prev(EditLine *el, int c __unused)
{
@@ -665,7 +665,7 @@ vi_search_prev(EditLine *el, int c __unused)
* Vi search history next
* [/]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_search_next(EditLine *el, int c __unused)
{
@@ -678,7 +678,7 @@ vi_search_next(EditLine *el, int c __unused)
* Vi repeat current search in the same search direction
* [n]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_repeat_search_next(EditLine *el, int c __unused)
{
@@ -695,7 +695,7 @@ vi_repeat_search_next(EditLine *el, int c __unused)
* [N]
*/
/*ARGSUSED*/
protected el_action_t
el_action_t
vi_repeat_search_prev(EditLine *el, int c __unused)
{
@@ -712,7 +712,7 @@ vi_repeat_search_prev(EditLine *el, int c __unused)
* Vi move to the character specified next
* [f]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_next_char(EditLine *el, int c __unused)
{
@@ -724,7 +724,7 @@ vi_next_char(EditLine *el, int c __unused)
* Vi move to the character specified previous
* [F]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_prev_char(EditLine *el, int c __unused)
{
@@ -736,7 +736,7 @@ vi_prev_char(EditLine *el, int c __unused)
* Vi move up to the character specified next
* [t]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_to_next_char(EditLine *el, int c __unused)
{
@@ -748,7 +748,7 @@ vi_to_next_char(EditLine *el, int c __unused)
* Vi move up to the character specified previous
* [T]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_to_prev_char(EditLine *el, int c __unused)
{
@@ -760,7 +760,7 @@ vi_to_prev_char(EditLine *el, int c __unused)
* Vi repeat current character search in the same search direction
* [;]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_repeat_next_char(EditLine *el, int c __unused)
{
@@ -774,7 +774,7 @@ vi_repeat_next_char(EditLine *el, int c __unused)
* Vi repeat current character search in the opposite search direction
* [,]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_repeat_prev_char(EditLine *el, int c __unused)
{
@@ -792,7 +792,7 @@ vi_repeat_prev_char(EditLine *el, int c __unused)
* Vi go to matching () {} or []
* [%]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_match(EditLine *el, int c)
{
@@ -839,7 +839,7 @@ vi_match(EditLine *el, int c)
* Vi undo all changes to line
* [U]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_undo_line(EditLine *el, int c)
{
@@ -853,7 +853,7 @@ vi_undo_line(EditLine *el, int c)
* [|]
* NB netbsd vi goes to screen column 'n', posix says nth character
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_to_column(EditLine *el, int c)
{
@@ -867,7 +867,7 @@ vi_to_column(EditLine *el, int c)
* Vi yank to end of line
* [Y]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_yank_end(EditLine *el, int c)
{
@@ -881,7 +881,7 @@ vi_yank_end(EditLine *el, int c)
* Vi yank
* [y]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_yank(EditLine *el, int c)
{
@@ -893,7 +893,7 @@ vi_yank(EditLine *el, int c)
* Vi comment out current command
* [#]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_comment_out(EditLine *el, int c)
{
@@ -911,7 +911,7 @@ vi_comment_out(EditLine *el, int c)
* NB: posix implies that we should enter insert mode, however
* this is against historical precedent...
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_alias(EditLine *el, int c)
{
@@ -943,7 +943,7 @@ vi_alias(EditLine *el, int c)
* Vi go to specified history file line.
* [G]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_to_history_line(EditLine *el, int c)
{
@@ -988,7 +988,7 @@ vi_to_history_line(EditLine *el, int c)
* Vi edit history line with vi
* [v]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_histedit(EditLine *el, int c)
{
@@ -1044,7 +1044,7 @@ vi_histedit(EditLine *el, int c)
* Who knows where this one came from!
* '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_'
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_history_word(EditLine *el, int c)
{
@@ -1093,7 +1093,7 @@ vi_history_word(EditLine *el, int c)
* Vi redo last non-motion command
* [.]
*/
protected el_action_t
el_action_t
/*ARGSUSED*/
vi_redo(EditLine *el, int c)
{
+47 -47
View File
@@ -1,51 +1,51 @@
/* Automatically generated file, do not edit */
#ifndef _h_vi_c
#define _h_vi_c
protected el_action_t vi_paste_next (EditLine *, int);
protected el_action_t vi_paste_prev (EditLine *, int);
protected el_action_t vi_prev_big_word (EditLine *, int);
protected el_action_t vi_prev_word (EditLine *, int);
protected el_action_t vi_next_big_word (EditLine *, int);
protected el_action_t vi_next_word (EditLine *, int);
protected el_action_t vi_change_case (EditLine *, int);
protected el_action_t vi_change_meta (EditLine *, int);
protected el_action_t vi_insert_at_bol (EditLine *, int);
protected el_action_t vi_replace_char (EditLine *, int);
protected el_action_t vi_replace_mode (EditLine *, int);
protected el_action_t vi_substitute_char (EditLine *, int);
protected el_action_t vi_substitute_line (EditLine *, int);
protected el_action_t vi_change_to_eol (EditLine *, int);
protected el_action_t vi_insert (EditLine *, int);
protected el_action_t vi_add (EditLine *, int);
protected el_action_t vi_add_at_eol (EditLine *, int);
protected el_action_t vi_delete_meta (EditLine *, int);
protected el_action_t vi_end_big_word (EditLine *, int);
protected el_action_t vi_end_word (EditLine *, int);
protected el_action_t vi_undo (EditLine *, int);
protected el_action_t vi_command_mode (EditLine *, int);
protected el_action_t vi_zero (EditLine *, int);
protected el_action_t vi_delete_prev_char (EditLine *, int);
protected el_action_t vi_list_or_eof (EditLine *, int);
protected el_action_t vi_kill_line_prev (EditLine *, int);
protected el_action_t vi_search_prev (EditLine *, int);
protected el_action_t vi_search_next (EditLine *, int);
protected el_action_t vi_repeat_search_next (EditLine *, int);
protected el_action_t vi_repeat_search_prev (EditLine *, int);
protected el_action_t vi_next_char (EditLine *, int);
protected el_action_t vi_prev_char (EditLine *, int);
protected el_action_t vi_to_next_char (EditLine *, int);
protected el_action_t vi_to_prev_char (EditLine *, int);
protected el_action_t vi_repeat_next_char (EditLine *, int);
protected el_action_t vi_repeat_prev_char (EditLine *, int);
protected el_action_t vi_match (EditLine *, int);
protected el_action_t vi_undo_line (EditLine *, int);
protected el_action_t vi_to_column (EditLine *, int);
protected el_action_t vi_yank_end (EditLine *, int);
protected el_action_t vi_yank (EditLine *, int);
protected el_action_t vi_comment_out (EditLine *, int);
protected el_action_t vi_alias (EditLine *, int);
protected el_action_t vi_to_history_line (EditLine *, int);
protected el_action_t vi_histedit (EditLine *, int);
protected el_action_t vi_history_word (EditLine *, int);
protected el_action_t vi_redo (EditLine *, int);
el_action_t vi_paste_next (EditLine *, int);
el_action_t vi_paste_prev (EditLine *, int);
el_action_t vi_prev_big_word (EditLine *, int);
el_action_t vi_prev_word (EditLine *, int);
el_action_t vi_next_big_word (EditLine *, int);
el_action_t vi_next_word (EditLine *, int);
el_action_t vi_change_case (EditLine *, int);
el_action_t vi_change_meta (EditLine *, int);
el_action_t vi_insert_at_bol (EditLine *, int);
el_action_t vi_replace_char (EditLine *, int);
el_action_t vi_replace_mode (EditLine *, int);
el_action_t vi_substitute_char (EditLine *, int);
el_action_t vi_substitute_line (EditLine *, int);
el_action_t vi_change_to_eol (EditLine *, int);
el_action_t vi_insert (EditLine *, int);
el_action_t vi_add (EditLine *, int);
el_action_t vi_add_at_eol (EditLine *, int);
el_action_t vi_delete_meta (EditLine *, int);
el_action_t vi_end_big_word (EditLine *, int);
el_action_t vi_end_word (EditLine *, int);
el_action_t vi_undo (EditLine *, int);
el_action_t vi_command_mode (EditLine *, int);
el_action_t vi_zero (EditLine *, int);
el_action_t vi_delete_prev_char (EditLine *, int);
el_action_t vi_list_or_eof (EditLine *, int);
el_action_t vi_kill_line_prev (EditLine *, int);
el_action_t vi_search_prev (EditLine *, int);
el_action_t vi_search_next (EditLine *, int);
el_action_t vi_repeat_search_next (EditLine *, int);
el_action_t vi_repeat_search_prev (EditLine *, int);
el_action_t vi_next_char (EditLine *, int);
el_action_t vi_prev_char (EditLine *, int);
el_action_t vi_to_next_char (EditLine *, int);
el_action_t vi_to_prev_char (EditLine *, int);
el_action_t vi_repeat_next_char (EditLine *, int);
el_action_t vi_repeat_prev_char (EditLine *, int);
el_action_t vi_match (EditLine *, int);
el_action_t vi_undo_line (EditLine *, int);
el_action_t vi_to_column (EditLine *, int);
el_action_t vi_yank_end (EditLine *, int);
el_action_t vi_yank (EditLine *, int);
el_action_t vi_comment_out (EditLine *, int);
el_action_t vi_alias (EditLine *, int);
el_action_t vi_to_history_line (EditLine *, int);
el_action_t vi_histedit (EditLine *, int);
el_action_t vi_history_word (EditLine *, int);
el_action_t vi_redo (EditLine *, int);
#endif /* _h_vi_c */
+2 -2
View File
@@ -37,8 +37,8 @@ static const uint32 kMsgRevert = 'rvrt';
APRWindow::APRWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE_SYSTEM_NAME("Appearance"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_QUIT_ON_WINDOW_CLOSE,
B_ALL_WORKSPACES)
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS
| B_QUIT_ON_WINDOW_CLOSE, B_ALL_WORKSPACES)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
+2 -39
View File
@@ -29,12 +29,11 @@ typedef enum {
FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows,
int32 knobStyle, BMessage* message)
BMessage* message)
:
BControl("FakeScrollBar", NULL, message, B_WILL_DRAW | B_NAVIGABLE),
fDrawArrows(drawArrows),
fDoubleArrows(doubleArrows),
fKnobStyle(knobStyle)
fDoubleArrows(doubleArrows)
{
SetExplicitMinSize(BSize(160, 20));
SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 20));
@@ -142,42 +141,6 @@ FakeScrollBar::Draw(BRect updateRect)
// fill the clickable surface of the thumb
be_control_look->DrawButtonBackground(this, bgRect, updateRect,
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
if (fKnobStyle == B_KNOB_STYLE_NONE)
return;
// draw the scrollbar thumb knobs
bool square = fKnobStyle == B_KNOB_STYLE_DOTS;
int32 knobWidth = 0;
int32 knobHeight = 0;
if (square) {
knobWidth = 2;
knobHeight = 2;
} else {
knobWidth = 1;
knobHeight = 3;
}
float hmiddle = bgRect.Width() / 2;
float vmiddle = bgRect.Height() / 2;
BRect middleKnob = BRect(bgRect.left + hmiddle - knobWidth,
bgRect.top + vmiddle - knobHeight,
bgRect.left + hmiddle + knobWidth,
bgRect.top + vmiddle + knobHeight);
BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0);
be_control_look->DrawButtonBackground(this, leftKnob, updateRect,
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0);
be_control_look->DrawButtonBackground(this, rightKnob, updateRect,
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
// draw middle knob last because it modifies middleKnob
be_control_look->DrawButtonBackground(this, middleKnob, updateRect,
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
}
+1 -1
View File
@@ -16,7 +16,7 @@
class FakeScrollBar : public BControl {
public:
FakeScrollBar(bool drawArrows, bool doubleArrows,
int32 knobStyle, BMessage* message);
BMessage* message);
~FakeScrollBar(void);
virtual void MouseDown(BPoint point);
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <Alert.h>
#include <Alignment.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
@@ -28,7 +29,6 @@
#include <MenuField.h>
#include <MenuItem.h>
#include <PopUpMenu.h>
#include <RadioButton.h>
#include <ScrollBar.h>
#include <StringView.h>
#include <Size.h>
@@ -79,15 +79,15 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
new BMessage(kMsgDecorInfo));
// scrollbar arrow style
// scroll bar arrow style
BBox* arrowStyleBox = new BBox("arrow style");
arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style"));
fSavedDoubleArrowsValue = _DoubleScrollBarArrows();
fArrowStyleSingle = new FakeScrollBar(true, false, B_KNOB_STYLE_LINES,
fArrowStyleSingle = new FakeScrollBar(true, false,
new BMessage(kMsgArrowStyleSingle));
fArrowStyleDouble = new FakeScrollBar(true, true, B_KNOB_STYLE_LINES,
fArrowStyleDouble = new FakeScrollBar(true, true,
new BMessage(kMsgArrowStyleDouble));
BView* arrowStyleView;
@@ -98,39 +98,18 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
.Add(new BStringView("spacer", ""))
.Add(new BStringView("double", B_TRANSLATE("Double:")))
.Add(fArrowStyleDouble)
.Add(BSpaceLayoutItem::CreateVerticalStrut(0))
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.End()
.View();
arrowStyleBox->AddChild(arrowStyleView);
arrowStyleBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
// scrollbar knob style
fSavedKnobStyleValue = _ScrollBarKnobStyle();
BBox* knobStyleBox = new BBox("knob style");
knobStyleBox->SetLabel(B_TRANSLATE("Knob style"));
fKnobStyleNone = new FakeScrollBar(false, false, B_KNOB_STYLE_NONE,
new BMessage(kMsgKnobStyleNone));
fKnobStyleDots = new FakeScrollBar(false, false, B_KNOB_STYLE_DOTS,
new BMessage(kMsgKnobStyleDots));
fKnobStyleLines = new FakeScrollBar(false, false, B_KNOB_STYLE_LINES,
new BMessage(kMsgKnobStyleLines));
BView* knobStyleView;
knobStyleView = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, 0)
.Add(fKnobStyleNone)
.Add(new BStringView("spacer", ""))
.Add(fKnobStyleDots)
.Add(new BStringView("spacer", ""))
.Add(fKnobStyleLines)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.End()
.View();
knobStyleBox->AddChild(knobStyleView);
BStringView* scrollBarLabel
= new BStringView("scroll bar", "Scroll bar:");
scrollBarLabel->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
SetLayout(new BGroupLayout(B_VERTICAL));
@@ -143,10 +122,9 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fDecorInfoButton, 2, 0)
)
.Add(new BStringView("label", B_TRANSLATE("Scroll bars:")))
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.Add(scrollBarLabel)
.Add(arrowStyleBox)
.Add(knobStyleBox)
.End()
.AddGlue()
.End()
@@ -174,28 +152,11 @@ LookAndFeelSettingsView::AttachedToWindow()
fDecorInfoButton->SetTarget(this);
fArrowStyleSingle->SetTarget(this);
fArrowStyleDouble->SetTarget(this);
fKnobStyleNone->SetTarget(this);
fKnobStyleDots->SetTarget(this);
fKnobStyleLines->SetTarget(this);
if (fSavedDoubleArrowsValue)
fArrowStyleDouble->SetValue(B_CONTROL_ON);
else
fArrowStyleSingle->SetValue(B_CONTROL_ON);
switch (fSavedKnobStyleValue) {
case B_KNOB_STYLE_NONE:
fKnobStyleNone->SetValue(B_CONTROL_ON);
break;
case B_KNOB_STYLE_DOTS:
fKnobStyleDots->SetValue(B_CONTROL_ON);
break;
case B_KNOB_STYLE_LINES:
fKnobStyleLines->SetValue(B_CONTROL_ON);
break;
}
}
@@ -248,18 +209,6 @@ LookAndFeelSettingsView::MessageReceived(BMessage *msg)
_SetDoubleScrollBarArrows(true);
break;
case kMsgKnobStyleNone:
_SetScrollBarKnobStyle(B_KNOB_STYLE_NONE);
break;
case kMsgKnobStyleDots:
_SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS);
break;
case kMsgKnobStyleLines:
_SetScrollBarKnobStyle(B_KNOB_STYLE_LINES);
break;
default:
BView::MessageReceived(msg);
break;
@@ -359,49 +308,11 @@ LookAndFeelSettingsView::_SetDoubleScrollBarArrows(bool doubleArrows)
}
int32
LookAndFeelSettingsView::_ScrollBarKnobStyle()
{
scroll_bar_info info;
get_scroll_bar_info(&info);
return info.knob;
}
void
LookAndFeelSettingsView::_SetScrollBarKnobStyle(int32 knobStyle)
{
scroll_bar_info info;
get_scroll_bar_info(&info);
info.knob = knobStyle;
set_scroll_bar_info(&info);
switch (knobStyle) {
case B_KNOB_STYLE_NONE:
fKnobStyleNone->SetValue(B_CONTROL_ON);
break;
case B_KNOB_STYLE_DOTS:
fKnobStyleDots->SetValue(B_CONTROL_ON);
break;
case B_KNOB_STYLE_LINES:
fKnobStyleLines->SetValue(B_CONTROL_ON);
break;
}
Window()->PostMessage(kMsgUpdate);
}
bool
LookAndFeelSettingsView::IsDefaultable()
{
return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name()
|| _DoubleScrollBarArrows() != false
|| _ScrollBarKnobStyle() != B_KNOB_STYLE_DOTS;
|| _DoubleScrollBarArrows() != false;
}
@@ -410,7 +321,6 @@ LookAndFeelSettingsView::SetDefaults()
{
_SetDecor(fDecorUtility.DefaultDecorator());
_SetDoubleScrollBarArrows(false);
_SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS);
}
@@ -418,8 +328,7 @@ bool
LookAndFeelSettingsView::IsRevertable()
{
return fCurrentDecor != fSavedDecor
|| _DoubleScrollBarArrows() != fSavedDoubleArrowsValue
|| _ScrollBarKnobStyle() != fSavedKnobStyleValue;
|| _DoubleScrollBarArrows() != fSavedDoubleArrowsValue;
}
@@ -427,6 +336,5 @@ void
LookAndFeelSettingsView::Revert()
{
_SetDecor(fSavedDecor);
_SetScrollBarKnobStyle(fSavedKnobStyleValue);
_SetDoubleScrollBarArrows(fSavedDoubleArrowsValue);
}
@@ -48,9 +48,6 @@ private:
bool _DoubleScrollBarArrows();
void _SetDoubleScrollBarArrows(bool doubleArrows);
int32 _ScrollBarKnobStyle();
void _SetScrollBarKnobStyle(int32 knobStyle);
private:
DecorInfoUtility fDecorUtility;
@@ -61,15 +58,10 @@ private:
FakeScrollBar* fArrowStyleSingle;
FakeScrollBar* fArrowStyleDouble;
FakeScrollBar* fKnobStyleNone;
FakeScrollBar* fKnobStyleDots;
FakeScrollBar* fKnobStyleLines;
BString fSavedDecor;
BString fCurrentDecor;
bool fSavedDoubleArrowsValue;
int32 fSavedKnobStyleValue;
};
#endif // LOOK_AND_FEEL_SETTINGS_VIEW_H
+4 -3
View File
@@ -26,7 +26,7 @@ static const uint32 kModifierKeys = B_SHIFT_KEY | B_CAPS_LOCK | B_CONTROL_KEY
static void
print_key(char *chars, int32 offset)
print_key(char *chars, int32 offset, bool last = false)
{
int size = chars[offset++];
@@ -53,7 +53,8 @@ print_key(char *chars, int32 offset)
}
}
fputs("\t", stdout);
if (!last)
fputs("\t", stdout);
}
@@ -110,7 +111,7 @@ Keymap::DumpKeymap()
print_key(fChars, fKeys.caps_map[i]);
print_key(fChars, fKeys.caps_shift_map[i]);
print_key(fChars, fKeys.option_caps_map[i]);
print_key(fChars, fKeys.option_caps_shift_map[i]);
print_key(fChars, fKeys.option_caps_shift_map[i], true);
fputs("\n", stdout);
}
}
@@ -21,16 +21,19 @@
class ArchFBArm920 : public ArchFramebuffer {
public:
ArchFBArm920(addr_t base);
~ArchFBArm920();
ArchFBArm920(addr_t base)
: ArchFramebuffer(base) {}
~ArchFBArm920() {}
status_t Init();
status_t Probe();
status_t SetDefaultMode();
status_t SetVideoMode(int width, int height, int depth);
};
ArchFBArm920 *arch_get_fb_arm_920(addr_t base);
extern "C" ArchFramebuffer *arch_get_fb_arm_920(addr_t base)
{
return new ArchFBArm920(base);
}
status_t
ArchFBArm920::Init()
@@ -40,15 +40,20 @@ extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size,
class ArchFBArmOmap3 : public ArchFramebuffer {
public:
ArchFBArmOmap3(addr_t base);
~ArchFBArmOmap3();
ArchFBArmOmap3(addr_t base)
: ArchFramebuffer(base) {}
~ArchFBArmOmap3() {}
status_t Init();
status_t Probe();
status_t SetDefaultMode();
status_t SetVideoMode(int width, int height, int depth);
};
ArchFBArmOmap3 *arch_get_fb_arm_omap3(addr_t base);
extern "C" ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base)
{
return new ArchFBArmOmap3(base);
}
// #pragma mark -
@@ -32,15 +32,19 @@ extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size,
class ArchFBArmPxa270 : public ArchFramebuffer {
public:
ArchFBArmPxa270(addr_t base);
~ArchFBArmPxa270();
ArchFBArmPxa270(addr_t base)
: ArchFramebuffer(base) {}
~ArchFBArmPxa270() {}
status_t Init();
status_t Probe();
status_t SetDefaultMode();
status_t SetVideoMode(int width, int height, int depth);
};
ArchFBArmPxa270 *arch_get_fb_arm_pxa270(addr_t base);
extern "C" ArchFramebuffer *arch_get_fb_arm_pxa270(addr_t base)
{
return new ArchFBArmPxa270(base);
}
// #pragma mark -
@@ -97,8 +101,13 @@ dprintf("error %08x\n", err);
struct pxa27x_lcd_dma_descriptor *dma;
// check if LCD controller is enabled
if (!(read_io_32(LCCR0) | 0x00000001))
if (!(read_io_32(LCCR0) & 0x00000001)) {
// not enabled, so return suggested mode
gKernelArgs.frame_buffer.depth = 32;
gKernelArgs.frame_buffer.width = 640;
gKernelArgs.frame_buffer.height = 480;
return B_NO_INIT;
}
pixelFormat = bppCode = read_io_32(LCCR3);
bppCode = ((bppCode >> 26) & 0x08) | ((bppCode >> 24) & 0x07);
@@ -126,7 +135,7 @@ dprintf("error %08x\n", err);
return B_ERROR;
}
gKernelArgs.frame_buffer.physical_buffer.start = (dma->fdadr & ~0x0f);
gKernelArgs.frame_buffer.physical_buffer.start = (dma->fsadr & ~0x0f);
gKernelArgs.frame_buffer.width = (read_io_32(LCCR1) & ((1 << 10) - 1)) + 1;
gKernelArgs.frame_buffer.height = (read_io_32(LCCR2) & ((1 << 10) - 1)) + 1;
gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width
@@ -150,12 +159,6 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth)
void *fb;
uint32 fbSize = width * height * depth / 8;
//fb = malloc(800 * 600 * 4 + 16 - 1);
//fb = (void *)(((uint32)fb) & ~(0x0f));
//fb = scratch - 800;
//fb = (void *)0xa0000000;
// fBase = scratch - 800;
fb = (void*)fBase;
@@ -168,8 +171,8 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth)
// if not already enabled, set a default mode
if (!(read_io_32(LCCR0) & 0x00000001)) {
int bpp = 0x09; // 24 bpp
int pdfor = 0x3; // Format 4: RGB888 (no alpha bit)
int bpp;
int pdfor;
dprintf("Setting video mode\n");
switch (depth) {
case 4:
@@ -201,7 +204,7 @@ ArchFBArmPxa270::SetVideoMode(int width, int height, int depth)
dumpr(LCCR3);
dumpr(LCCR4);
} else
return EALREADY; // for now
return B_OK; // assume we're already setup
// clear the video memory
memset((void *)fb, 0, fbSize);
+5 -14
View File
@@ -14,6 +14,7 @@
#include <boot/platform/generic/video.h>
#include <util/list.h>
#include <drivers/driver_settings.h>
#include <board_config.h>
#include <stdio.h>
#include <stdlib.h>
@@ -76,14 +77,10 @@ platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width,
extern "C" void
platform_switch_to_logo(void)
{
CALLED();
// in debug mode, we'll never show the logo
if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
return;
//XXX: not yet, DISABLED
return;
status_t err;
if (gFramebuffer != NULL) {
@@ -95,30 +92,28 @@ platform_switch_to_logo(void)
err = video_display_splash(gFramebuffer->Base());
}
#warning U-Boot:TODO
}
extern "C" void
platform_switch_to_text_mode(void)
{
CALLED();
#warning U-Boot:TODO
}
extern "C" status_t
platform_init_video(void)
{
CALLED();
#ifdef __ARM__
#if defined(BOARD_CPU_ARM920T)
extern ArchFramebuffer *arch_get_fb_arm_920(addr_t base);
gFramebuffer = arch_get_fb_arm_920(0x88000000);
#elif defined(BOARD_CPU_OMAP3)
extern ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base);
gFramebuffer = arch_get_fb_arm_omap3(0x88000000);
#elif defined(BOARD_CPU_PXA270)
gFramebuffer = arch_get_fb_arm_pxa270(0xA4000000);
ArchFramebuffer *arch_get_fb_arm_pxa270(addr_t base);
gFramebuffer = arch_get_fb_arm_pxa270(0xA3000000);
#endif
#endif
@@ -127,9 +122,5 @@ platform_init_video(void)
gFramebuffer->Init();
}
//XXX for testing
//platform_switch_to_logo();
//return arch_probe_video_mode();
return B_OK;
}
+1 -1
View File
@@ -17,7 +17,7 @@ KernelMergeObject kernel_arch_arm.o :
arch_debug_console.cpp
arch_debug.cpp
arch_elf.cpp
# arch_exceptions.S
arch_exceptions.S
arch_int.cpp
arch_platform.cpp
arch_real_time_clock.cpp
+16 -7
View File
@@ -27,8 +27,8 @@ FUNCTION_END(arch_int_enable_interrupts)
*/
FUNCTION(arch_int_disable_interrupts):
mrs r0, cpsr
orr r0, r0, #(1<<7)
msr cpsr_c, r0
orr r1, r0, #(1<<7)
msr cpsr_c, r1
bx lr
FUNCTION_END(arch_int_disable_interrupts)
@@ -37,8 +37,8 @@ FUNCTION_END(arch_int_disable_interrupts)
*/
FUNCTION(arch_int_restore_interrupts):
mrs r1, cpsr
orr r0,r0, #(1<<7)
bic r1, r1,#(1<<7)
and r0, r0, #(1<<7)
bic r1, r1, #(1<<7)
orr r1, r1, r0
msr cpsr_c, r1
bx lr
@@ -49,10 +49,19 @@ FUNCTION_END(arch_int_restore_interrupts)
FUNCTION(arch_int_are_interrupts_enabled):
mrs r0, cpsr
and r0, r0, #(1<<7) /*read the I bit*/
cmp r0,#0
moveq r0,#1
movne r0,#0
cmp r0, #0
moveq r0, #1
movne r0, #0
bx lr
FUNCTION_END(arch_int_are_interrupts_enabled)
/* void arm_context_switch(struct arch_thread* oldState,
struct arch_thread* newState); */
FUNCTION(arm_context_switch):
stmfd sp!, { r0-r12, lr }
str sp, [r0]
ldr sp, [r1]
ldmfd sp!, { r0-r12, lr }
bx lr
FUNCTION_END(arm_context_switch)
@@ -0,0 +1,176 @@
/*
* Copyright 2012, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ithamar R. Adema <ithamar@upgrade-android.com>
*
*/
#include <asm_defs.h>
.text
.globl _vectors_start
_vectors_start:
ldr pc, _arm_reset
ldr pc, _arm_undefined
ldr pc, _arm_syscall
ldr pc, _arm_prefetch_abort
ldr pc, _arm_data_abort
ldr pc, _arm_reserved
ldr pc, _arm_irq
ldr pc, _arm_fiq
_arm_reset:
.word arm_reserved // actually reset, but not used when mapped
_arm_undefined:
.word arm_undefined
_arm_syscall:
.word arm_syscall
_arm_prefetch_abort:
.word arm_prefetch_abort
_arm_data_abort:
.word arm_data_abort
_arm_reserved:
.word arm_reserved
_arm_irq:
.word arm_irq
_arm_fiq:
.word arm_fiq
.globl _vectors_end
_vectors_end:
.rept 64
.word 0xaabbccdd
.endr
abort_stack:
.word .
FUNCTION(arm_undefined):
stmfd sp!, { r0-r12, r14 }
sub sp, sp, #12
mov r0, sp
mrs r1, spsr
stmia r0, { r1, r13-r14 }
b arch_arm_undefined
b .
FUNCTION(arm_syscall):
stmfd sp!, { r0-r12, r14 }
sub sp, sp, #12
mov r0, sp
mrs r1, spsr
stmia r0, { r1, r13-r14 }
b arch_arm_syscall
b .
FUNCTION(arm_prefetch_abort):
ldr sp, abort_stack
stmfd sp!, { r0-r12, r14 }
sub sp, sp, #12
mov r0, sp
mrs r1, spsr
stmia r0, { r1, r13-r14 }
b arch_arm_prefetch_abort
b .
FUNCTION(arm_data_abort):
ldr sp, abort_stack
/* XXX only deals with interrupting supervisor mode */
/* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */
stmia r13, { r4-r6 }
mov r4, r13
sub r5, lr, #8
mrs r6, spsr
/* move into supervisor mode. irq/fiq disabled */
msr cpsr_c, #0x13
/* save the return address */
stmfd sp!, { r5 }
/* save C trashed regs, supervisor lr */
stmfd sp!, { r0-r3, r12, lr }
/* save spsr */
stmfd sp!, { r6 }
/* restore r4-r6 */
ldmia r4, { r4-r6 }
/* call into higher level code */
mrc p15, 0, r2, c5, c0, 0 @ get FSR
mrc p15, 0, r3, c6, c0, 0 @ get FAR
sub sp, sp, #20
mov r0, sp /* iframe */
stmia r0, { r6,r2,r3,r4,r5 }
bl arch_arm_data_abort
add sp, sp, #20
/* restore spsr */
ldmfd sp!, { r0 }
msr spsr_cxsf, r0
/* restore back to where we came from */
ldmfd sp!, { r0-r3, r12, lr, pc }^
FUNCTION(arm_reserved):
b .
FUNCTION(arm_irq):
ldr sp, abort_stack
/* XXX only deals with interrupting supervisor mode */
/* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */
stmia r13, { r4-r6 }
mov r4, r13
sub r5, lr, #4
mrs r6, spsr
/* move into supervisor mode. irq/fiq disabled */
msr cpsr_c, #(3<<6 | 0x13)
/* save the return address */
stmfd sp!, { r5 }
/* save C trashed regs, supervisor lr */
stmfd sp!, { r0-r3, r12, lr }
/* save spsr */
stmfd sp!, { r6 }
/* restore r4-r6 */
ldmia r4, { r4-r6 }
/* call into higher level code */
mov r0, sp /* iframe */
bl arch_arm_irq
/* restore spsr */
ldmfd sp!, { r0 }
msr spsr_cxsf, r0
/* restore back to where we came from */
ldmfd sp!, { r0-r3, r12, lr, pc }^
.bss
.align 2
.global irq_save_spot
irq_save_spot:
.word 0 /* r4 */
.word 0 /* r5 */
.word 0 /* r6 */
.text
FUNCTION(arm_fiq):
ldr sp, abort_stack
sub lr, lr, #4
stmfd sp!, { r0-r3, r12, lr }
bl arch_arm_fiq
ldmfd sp!, { r0-r3, r12, pc }^
+143 -69
View File
@@ -1,11 +1,12 @@
/*
* Copyright 2003-2010, Haiku Inc. All rights reserved.
* Copyright 2003-2012, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <axeld@pinc-software.de>
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
* François Revol <revol@free.fr>
* Ithamar R. Adema <ithamar@upgrade-android.com>
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
@@ -30,27 +31,35 @@
#include <string.h>
//#define TRACE_ARCH_INT
#define TRACE_ARCH_INT
#ifdef TRACE_ARCH_INT
# define TRACE(x) dprintf x
#else
# define TRACE(x) ;
#endif
/*typedef void (*m68k_exception_handler)(void);
#define M68K_EXCEPTION_VECTOR_COUNT 256
#warning M68K: align on 4 ?
//m68k_exception_handler gExceptionVectors[M68K_EXCEPTION_VECTOR_COUNT];
m68k_exception_handler *gExceptionVectors;
#define VECTORPAGE_SIZE 64
#define USER_VECTOR_ADDR_LOW 0x00000000
#define USER_VECTOR_ADDR_HIGH 0xffff0000
// defined in arch_exceptions.S
extern "C" void __m68k_exception_noop(void);
extern "C" void __m68k_exception_common(void);
*/
extern int __irqvec_start;
extern int __irqvec_end;
#define PXA_INTERRUPT_PHYS_BASE 0x40D00000
#define PXA_INTERRUPT_SIZE 0x00000034
//extern"C" void m68k_exception_tail(void);
#define PXA_ICIP 0x00
#define PXA_ICMR 0x01
#define PXA_ICFP 0x03
#define PXA_ICMR2 0x28
static area_id sPxaInterruptArea;
static uint32 *sPxaInterruptBase;
extern int _vectors_start;
extern int _vectors_end;
static area_id sVectorPageArea;
static void *sVectorPageAddress;
static area_id sUserVectorPageArea;
static void *sUserVectorPageAddress;
// current fault handler
addr_t gFaultHandler;
@@ -59,35 +68,48 @@ addr_t gFaultHandler;
// threads yet.
struct iframe_stack gBootFrameStack;
// interrupt controller interface (initialized
// in arch_int_init_post_device_manager())
//static struct interrupt_controller_module_info *sPIC;
//static void *sPICCookie;
uint32
mmu_read_c1()
{
uint32 controlReg = 0;
asm volatile("MRC p15, 0, %[c1out], c1, c0, 0":[c1out] "=r" (controlReg));
return controlReg;
}
void
mmu_write_c1(uint32 value)
{
asm volatile("MCR p15, 0, %[c1in], c1, c0, 0"::[c1in] "r" (value));
}
void
arch_int_enable_io_interrupt(int irq)
{
#warning ARM WRITEME
//if (!sPIC)
// return;
TRACE(("arch_int_enable_io_interrupt(%d)\n", irq));
// TODO: I have no idea, what IRQ type is appropriate.
//sPIC->enable_io_interrupt(sPICCookie, irq, IRQ_TYPE_LEVEL);
// M68KPlatform::Default()->EnableIOInterrupt(irq);
if (irq <= 31) {
sPxaInterruptBase[PXA_ICMR] |= 1 << irq;
return;
}
sPxaInterruptBase[PXA_ICMR2] |= 1 << (irq - 32);
}
void
arch_int_disable_io_interrupt(int irq)
{
#warning ARM WRITEME
TRACE(("arch_int_disable_io_interrupt(%d)\n", irq));
//if (!sPIC)
// return;
if (irq <= 31) {
sPxaInterruptBase[PXA_ICMR] &= ~(1 << irq);
return;
}
//sPIC->disable_io_interrupt(sPICCookie, irq);
// M68KPlatform::Default()->DisableIOInterrupt(irq);
sPxaInterruptBase[PXA_ICMR2] &= ~(1 << (irq - 32));
}
@@ -97,60 +119,67 @@ arch_int_disable_io_interrupt(int irq)
static void
print_iframe(struct iframe *frame)
{
#if 0
dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, frame->r1,
frame->r2, frame->r3);
dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, frame->r5,
frame->r6, frame->r7);
dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, frame->r9,
frame->r10, frame->r11);
dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, frame->r13,
frame->a6, frame->a7);
dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr);
#endif
#warning ARM WRITEME
}
status_t
arch_int_init(kernel_args *args)
{
#if 0
status_t err;
addr_t vbr;
int i;
// see if high vectors are enabled
if (mmu_read_c1() & (1<<13))
dprintf("High vectors already enabled\n");
else {
mmu_write_c1(mmu_read_c1() | (1<<13));
gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr;
if (!(mmu_read_c1() & (1<<13)))
dprintf("Unable to enable high vectors!\n");
else
dprintf("Enabled high vectors\n");
}
/* fill in the vector table */
for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++)
gExceptionVectors[i] = &__m68k_exception_common;
return B_OK;
}
vbr = args->arch_args.phys_vbr;
/* point VBR to the new table */
asm volatile ("movec %0,%%vbr" : : "r"(vbr):);
#endif
#warning ARM WRITEME
status_t
arch_int_init_post_vm(kernel_args *args)
{
// create a read/write kernel area
sVectorPageArea = create_area("vectorpage", (void **)&sVectorPageAddress,
B_ANY_ADDRESS, VECTORPAGE_SIZE, B_FULL_LOCK,
B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA);
if (sVectorPageArea < 0)
panic("vector page could not be created!");
// clone it at a fixed address with user read/only permissions
sUserVectorPageAddress = (addr_t*)USER_VECTOR_ADDR_HIGH;
sUserVectorPageArea = clone_area("user_vectorpage",
(void **)&sUserVectorPageAddress, B_EXACT_ADDRESS,
B_READ_AREA | B_EXECUTE_AREA, sVectorPageArea);
if (sUserVectorPageArea < 0)
panic("user vector page @ %p could not be created (%lx)!", sVectorPageAddress, sUserVectorPageArea);
// copy vectors into the newly created area
memcpy(sVectorPageAddress, &_vectors_start, VECTORPAGE_SIZE);
sPxaInterruptArea = map_physical_memory("pxa_intc", PXA_INTERRUPT_PHYS_BASE,
PXA_INTERRUPT_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaInterruptBase);
if (sPxaInterruptArea < 0)
return sPxaInterruptArea;
sPxaInterruptBase[PXA_ICMR] = 0;
sPxaInterruptBase[PXA_ICMR2] = 0;
return B_OK;
}
status_t
arch_int_init_post_vm(kernel_args *args)
{
status_t err;
// err = M68KPlatform::Default()->InitPIC(args);
#warning ARM WRITEME
return err;
}
status_t
arch_int_init_io(kernel_args* args)
{
TRACE(("arch_int_init_io(%p)\n", args));
return B_OK;
}
@@ -158,8 +187,53 @@ arch_int_init_io(kernel_args* args)
status_t
arch_int_init_post_device_manager(struct kernel_args *args)
{
// no PIC found
panic("arch_int_init_post_device_manager(): Found no supported PIC!");
return B_ENTRY_NOT_FOUND;
}
extern "C" void arch_arm_undefined(struct iframe *iframe)
{
panic("Undefined instruction!");
}
extern "C" void arch_arm_syscall(struct iframe *iframe)
{
panic("Software interrupt!\n");
}
extern "C" void arch_arm_data_abort(struct iframe *iframe)
{
addr_t newip;
status_t res = vm_page_fault(iframe->r2 /* FAR */, iframe->r4 /* lr */,
true /* TODO how to determine read/write? */,
false /* only kernelspace for now */,
&newip);
if (res != B_HANDLED_INTERRUPT) {
panic("Data Abort: %08x %08x %08x %08x (res=%lx)", iframe->r0 /* spsr */,
iframe->r1 /* FSR */, iframe->r2 /* FAR */,
iframe->r4 /* lr */,
res);
} else {
//panic("vm_page_fault was ok (%08lx/%08lx)!", iframe->r2 /* FAR */, iframe->r0 /* spsr */);
}
}
extern "C" void arch_arm_prefetch_abort(struct iframe *iframe)
{
panic("Prefetch Abort: %08x %08x %08x", iframe->r0, iframe->r1, iframe->r2);
}
extern "C" void arch_arm_irq(struct iframe *iframe)
{
for (int i=0; i < 32; i++)
if (sPxaInterruptBase[PXA_ICIP] & (1 << i))
int_io_interrupt_handler(i, true);
}
extern "C" void arch_arm_fiq(struct iframe *iframe)
{
for (int i=0; i < 32; i++)
if (sPxaInterruptBase[PXA_ICIP] & (1 << i))
dprintf("arch_arm_fiq: help me, FIQ %d was triggered but no FIQ support!\n", i);
}
+43 -18
View File
@@ -20,13 +20,20 @@
#include <boot/stage2.h>
#include <kernel.h>
#include <thread.h>
#include <tls.h>
#include <vm/vm_types.h>
#include <vm/VMAddressSpace.h>
#include <arch_vm.h>
//#include <arch/vm_translation_map.h>
#include <arch/vm_translation_map.h>
#include <string.h>
#define TRACE_ARCH_THREAD
#ifdef TRACE_ARCH_THREAD
# define TRACE(x) dprintf x
#else
# define TRACE(x) ;
#endif
// Valid initial arch_thread state. We just memcpy() it when initializing
// a new thread structure.
@@ -67,35 +74,53 @@ void
arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop,
void (*function)(void*), const void* data)
{
#warning ARM:WRITEME
addr_t* stackTop = (addr_t*)_stackTop;
TRACE(("arch_thread_init_kthread_stack(%s): stack top %p, function %p, data: "
"%p\n", thread->name, stackTop, function, data));
// push the function address -- that's the return address used after the
// context switch (lr/r14 register)
*--stackTop = (addr_t)function;
// simulate storing registers r1-r12
for (int i = 1; i <= 12; i++)
*--stackTop = 0;
// push the function argument as r0
*--stackTop = (addr_t)data;
// save the stack position
thread->arch_info.sp = stackTop;
}
status_t
arch_thread_init_tls(Thread *thread)
{
// TODO: Implement!
return B_OK;
uint32 tls[TLS_USER_THREAD_SLOT + 1];
thread->user_local_storage = thread->user_stack_base
+ thread->user_stack_size;
// initialize default TLS fields
memset(tls, 0, sizeof(tls));
tls[TLS_BASE_ADDRESS_SLOT] = thread->user_local_storage;
tls[TLS_THREAD_ID_SLOT] = thread->id;
tls[TLS_USER_THREAD_SLOT] = (addr_t)thread->user_thread;
return user_memcpy((void *)thread->user_local_storage, tls, sizeof(tls));
}
extern "C" void arm_context_switch(void *from, void *to);
void
arch_thread_context_switch(Thread *from, Thread *to)
{
#if 0
addr_t newPageDirectory;
newPageDirectory = (addr_t)m68k_next_page_directory(from, to);
if ((newPageDirectory % B_PAGE_SIZE) != 0)
panic("arch_thread_context_switch: bad pgdir 0x%lx\n",
newPageDirectory);
#warning M68K: export from arch_vm.c
m68k_set_pgdir(newPageDirectory);
m68k_context_switch(&from->arch_info.sp, to->arch_info.sp);
#endif
#warning ARM:WRITEME
TRACE(("arch_thread_context_switch: %p(%s/%p) -> %p(%s/%p)\n",
from, from->name, from->arch_info.sp, to, to->name, to->arch_info.sp));
arm_context_switch(&from->arch_info, &to->arch_info);
TRACE(("arch_thread_context_switch %p %p\n", to, from));
}
+53 -10
View File
@@ -1,9 +1,10 @@
/*
* Copyright 2007, Haiku Inc. All rights reserved.
* Copyright 2007-2012, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* François Revol <revol@free.fr>
* Ithamar R. Adema <ithamar@upgrade-android.com>
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
@@ -16,30 +17,72 @@
#include <timer.h>
#include <arch/timer.h>
//#include <arch_platform.h>
#include <arch/cpu.h>
#define PXA_TIMERS_PHYS_BASE 0x40A00000
#define PXA_TIMERS_SIZE 0x000000C0
#define PXA_TIMERS_INTERRUPT 7 /* OST_4_11 */
#define PXA_OSSR 0x05
#define PXA_OIER 0x07
#define PXA_OSCR4 0x10
#define PXA_OSMR4 0x20
#define PXA_OMCR4 0x30
#define TRACE(x) //dprintf x
static area_id sPxaTimersArea;
static uint32 *sPxaTimersBase;
static int32
pxa_timer_interrupt(void *data)
{
int32 ret = timer_interrupt();
sPxaTimersBase[PXA_OSSR] |= (1 << 4);
return ret;
}
void
arch_timer_set_hardware_timer(bigtime_t timeout)
{
#warning ARM:WRITEME
// M68KPlatform::Default()->SetHardwareTimer(timeout);
TRACE(("arch_timer_set_hardware_timer(%lld): %p\n", timeout, sPxaTimersBase));
if (sPxaTimersBase) {
sPxaTimersBase[PXA_OIER] |= (1 << 4);
sPxaTimersBase[PXA_OMCR4] = 4; // set to exactly single milisecond resolution
sPxaTimersBase[PXA_OSMR4] = timeout;
sPxaTimersBase[PXA_OSCR4] = 0; // start counting from 0 again
}
}
void
arch_timer_clear_hardware_timer()
{
#warning ARM:WRITEME
// M68KPlatform::Default()->ClearHardwareTimer();
TRACE(("arch_timer_clear_hardware_timer: %p\n", sPxaTimersBase));
if (sPxaTimersBase) {
sPxaTimersBase[PXA_OMCR4] = 0; // disable our timer
sPxaTimersBase[PXA_OIER] &= ~(4 << 1);
}
}
int
arch_init_timer(kernel_args *args)
{
#warning ARM:WRITEME
// M68KPlatform::Default()->InitTimer(args);
return 0;
}
sPxaTimersArea = map_physical_memory("pxa_timers", PXA_TIMERS_PHYS_BASE,
PXA_TIMERS_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaTimersBase);
if (sPxaTimersArea < 0)
return sPxaTimersArea;
sPxaTimersBase[PXA_OMCR4] = 0; // disable our timer
install_io_interrupt_handler(PXA_TIMERS_INTERRUPT, &pxa_timer_interrupt, NULL, 0);
return B_OK;
}
+3 -3
View File
@@ -97,8 +97,8 @@ arch_vm_unset_memory_type(VMArea *area)
status_t
arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type)
{
if (type == 0)
return B_OK;
if (type != 0)
dprintf("%s: undefined type %lx!\n", __PRETTY_FUNCTION__, type);
return B_ERROR;
return B_OK;
}
@@ -594,6 +594,8 @@ ARMVMTranslationMap32Bit::Query(addr_t va, phys_addr_t *_physical,
| ((entry & ARM_PTE_PRESENT) != 0 ? PAGE_PRESENT : 0);
#else
*_flags = B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA;
if (*_physical != 0)
*_flags |= PAGE_PRESENT;
#endif
pinner.Unlock();
+1 -1
View File
@@ -317,7 +317,7 @@ arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop,
{
addr_t* stackTop = (addr_t*)_stackTop;
TRACE(("arch_thread_init_kthread_stack: stack top %p, function %, data: "
TRACE(("arch_thread_init_kthread_stack: stack top %p, function %p, data: "
"%p\n", stackTop, function, data));
// push the function argument, a pointer to the data
@@ -151,7 +151,7 @@ VMKernelAddressSpace::CreateArea(const char* name, uint32 wiring,
void
VMKernelAddressSpace::DeleteArea(VMArea* _area, uint32 allocationFlags)
{
TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", area);
TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", _area);
VMKernelArea* area = static_cast<VMKernelArea*>(_area);
object_cache_delete(fAreaObjectCache, area);
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2003-2012, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2002, Manuel J. Petit. All rights reserved.
@@ -80,7 +80,7 @@ count_regions(const char* imagePath, char const* buff, int phnum, int phentsize)
default:
FATAL("%s: Unhandled pheader type in count 0x%lx\n",
imagePath, pheaders->p_type);
return B_BAD_DATA;
break;
}
}
+133 -3
View File
@@ -534,12 +534,12 @@ test_strftime(const char* locale, const strftime_data data[])
setlocale(LC_TIME, locale);
printf("strftime for '%s'\n", locale);
time_t nowSecs = 1279391169; // pure magic
tm* now = localtime(&nowSecs);
time_t testTimeInSecs = 1279391169; // Sat Jul 17 18:26:09 2010 UTC
tm* testTime = localtime(&testTimeInSecs);
int problemCount = 0;
for(int i = 0; data[i].format != NULL; ++i) {
char buf[100];
strftime(buf, 100, data[i].format, now);
strftime(buf, 100, data[i].format, testTime);
if (strcmp(buf, data[i].result) != 0) {
printf("\tPROBLEM: strftime(\"%s\") = \"%s\" (expected \"%s\")\n",
data[i].format, buf, data[i].result);
@@ -644,6 +644,135 @@ test_strftime()
}
// #pragma mark - strftime -----------------------------------------------------
struct strptime_data {
const char* format;
const char* dateString;
};
void
test_strptime(const char* locale, const strptime_data data[])
{
setlocale(LC_TIME, locale);
printf("strptime for '%s'\n", locale);
time_t expectedTimeInSecs = 1279391169; // Sat Jul 17 18:26:09 2010 UTC
int problemCount = 0;
for(int i = 0; data[i].format != NULL; ++i) {
struct tm resultTime;
if (strptime(data[i].dateString, data[i].format, &resultTime) == NULL) {
printf("\tPROBLEM: strptime(\"%s\", \"%s\") failed\n",
data[i].dateString, data[i].format);
problemCount++;
} else {
time_t resultTimeInSecs = mktime(&resultTime);
if (resultTimeInSecs != expectedTimeInSecs) {
printf("\tPROBLEM: strptime(\"%s\", \"%s\") = \"%d\" (expected \"%d\")\n",
data[i].dateString, data[i].format, resultTimeInSecs, expectedTimeInSecs);
problemCount++;
}
}
}
if (problemCount)
printf("\t%d problem(s) found!\n", problemCount);
else
printf("\tall fine\n");
}
void
test_strptime()
{
setenv("TZ", "GMT", 1);
const strptime_data strptime_posix[] = {
{ "%c", "Sat Jul 17 18:26:09 2010" },
{ "%x", "07/17/10" },
{ "%X", "18:26:09" },
{ "%a", "Sat" },
{ "%A", "Saturday" },
{ "%b", "Jul" },
{ "%B", "July" },
{ NULL, NULL }
};
test_strptime("POSIX", strptime_posix);
const strptime_data strptime_de[] = {
{ "%c", "Samstag, 17. Juli 2010 18:26:09 GMT" },
{ "%x", "17.07.2010" },
{ "%X", "18:26:09" },
{ "%a", "Sa." },
{ "%A", "Samstag" },
{ "%b", "Jul" },
{ "%B", "Juli" },
{ NULL, NULL }
};
test_strptime("de_DE.UTF-8", strptime_de);
const strptime_data strptime_hr[] = {
{ "%c", "subota, 17. srpnja 2010. 18:26:09 GMT" },
{ "%x", "17. 07. 2010." },
{ "%X", "18:26:09" },
{ "%a", "sub" },
{ "%A", "subota" },
{ "%b", "srp" },
{ "%B", "srpnja" },
{ NULL, NULL }
};
test_strptime("hr_HR.ISO8859-2", strptime_hr);
const strptime_data strptime_gu[] = {
{ "%c", "શનિવાર, 17 જુલાઈ, 2010 06:26:09 PM GMT" },
{ "%x", "17 જુલાઈ, 2010" },
{ "%X", "06:26:09 PM" },
{ "%a", "શનિ" },
{ "%A", "શનિવાર" },
{ "%b", "જુલાઈ" },
{ "%B", "જુલાઈ" },
{ NULL, NULL }
};
test_strptime("gu_IN", strptime_gu);
const strptime_data strptime_it[] = {
{ "%c", "sabato 17 luglio 2010 18:26:09 GMT" },
{ "%x", "17/lug/2010" },
{ "%X", "18:26:09" },
{ "%a", "sab" },
{ "%A", "sabato" },
{ "%b", "lug" },
{ "%B", "luglio" },
{ NULL, NULL }
};
test_strptime("it_IT", strptime_it);
const strptime_data strptime_nl[] = {
{ "%c", "zaterdag 17 juli 2010 18:26:09 GMT" },
{ "%x", "17 jul. 2010" },
{ "%X", "18:26:09" },
{ "%a", "za" },
{ "%A", "zaterdag" },
{ "%b", "jul." },
{ "%B", "juli" },
{ NULL, NULL }
};
test_strptime("nl_NL", strptime_nl);
const strptime_data strptime_nb[] = {
{ "%c", "kl. 18:26:09 GMT lørdag 17. juli 2010" },
{ "%x", "17. juli 2010" },
{ "%X", "18:26:09" },
{ "%a", "lør." },
{ "%A", "lørdag" },
{ "%b", "juli" },
{ "%B", "juli" },
{ NULL, NULL }
};
test_strptime("nb_NO", strptime_nb);
}
// #pragma mark - ctype --------------------------------------------------------
@@ -2087,6 +2216,7 @@ main(void)
test_setlocale();
test_localeconv();
test_strftime();
test_strptime();
test_ctype();
test_wctype();
test_wctrans();