Fixed all warnings in Shortcuts preflet and enabled -Werror for it
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38186 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1411,7 +1411,7 @@ if $(HAIKU_NO_WERROR) != 1 {
|
|||||||
EnableWerror src preferences print ;
|
EnableWerror src preferences print ;
|
||||||
EnableWerror src preferences screen ;
|
EnableWerror src preferences screen ;
|
||||||
EnableWerror src preferences screensaver ;
|
EnableWerror src preferences screensaver ;
|
||||||
# EnableWerror src preferences shortcuts ;
|
EnableWerror src preferences shortcuts ;
|
||||||
EnableWerror src preferences sounds ;
|
EnableWerror src preferences sounds ;
|
||||||
EnableWerror src preferences time ;
|
EnableWerror src preferences time ;
|
||||||
EnableWerror src preferences touchpad ;
|
EnableWerror src preferences touchpad ;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
#define B_TRANSLATE_CONTEXT "ShortcutsSpec"
|
#define B_TRANSLATE_CONTEXT "ShortcutsSpec"
|
||||||
|
|
||||||
const float _height = 20.0f;
|
const float _height = 20.0f;
|
||||||
|
|
||||||
static MetaKeyStateMap sMetaMaps[ShortcutsSpec::NUM_META_COLUMNS];
|
static MetaKeyStateMap sMetaMaps[ShortcutsSpec::NUM_META_COLUMNS];
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ const char* ShortcutsSpec::sCommandName;
|
|||||||
|
|
||||||
// Returns the (pos)'th char in the string, or '\0' if (pos) if off the end of
|
// Returns the (pos)'th char in the string, or '\0' if (pos) if off the end of
|
||||||
// the string
|
// the string
|
||||||
static char
|
static char
|
||||||
GetLetterAt(const char* str, int pos)
|
GetLetterAt(const char* str, int pos)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pos; i++) {
|
for (int i = 0; i < pos; i++) {
|
||||||
if (str[i] == '\0')
|
if (str[i] == '\0')
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
return str[pos];
|
return str[pos];
|
||||||
@@ -68,25 +68,25 @@ GetLetterAt(const char* str, int pos)
|
|||||||
|
|
||||||
|
|
||||||
// Setup the states in a standard manner for a pair of meta-keys.
|
// Setup the states in a standard manner for a pair of meta-keys.
|
||||||
static void
|
static void
|
||||||
SetupStandardMap(MetaKeyStateMap& map, const char* name, uint32 both,
|
SetupStandardMap(MetaKeyStateMap& map, const char* name, uint32 both,
|
||||||
uint32 left, uint32 right)
|
uint32 left, uint32 right)
|
||||||
{
|
{
|
||||||
map.SetInfo(name);
|
map.SetInfo(name);
|
||||||
|
|
||||||
// In this state, neither key may be pressed.
|
// In this state, neither key may be pressed.
|
||||||
map.AddState("(None)", new HasBitsFieldTester(0, both));
|
map.AddState("(None)", new HasBitsFieldTester(0, both));
|
||||||
|
|
||||||
// Here, either may be pressed. (Remember both is NOT a 2-bit chord, it's
|
// Here, either may be pressed. (Remember both is NOT a 2-bit chord, it's
|
||||||
// another bit entirely)
|
// another bit entirely)
|
||||||
map.AddState("Either", new HasBitsFieldTester(both));
|
map.AddState("Either", new HasBitsFieldTester(both));
|
||||||
|
|
||||||
// Here, only the left may be pressed
|
// Here, only the left may be pressed
|
||||||
map.AddState("Left", new HasBitsFieldTester(left, right));
|
map.AddState("Left", new HasBitsFieldTester(left, right));
|
||||||
|
|
||||||
// Here, only the right may be pressed
|
// Here, only the right may be pressed
|
||||||
map.AddState("Right", new HasBitsFieldTester(right, left));
|
map.AddState("Right", new HasBitsFieldTester(right, left));
|
||||||
|
|
||||||
// Here, both must be pressed.
|
// Here, both must be pressed.
|
||||||
map.AddState("Both", new HasBitsFieldTester(left | right));
|
map.AddState("Both", new HasBitsFieldTester(left | right));
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ GetNthKeyMap(int which)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BBitmap*
|
static BBitmap*
|
||||||
MakeActuatorBitmap(bool lit)
|
MakeActuatorBitmap(bool lit)
|
||||||
{
|
{
|
||||||
BBitmap* map = new BBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE, true);
|
BBitmap* map = new BBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE, true);
|
||||||
@@ -113,7 +113,7 @@ MakeActuatorBitmap(bool lit)
|
|||||||
BPoint(6.2, 5.8) };
|
BPoint(6.2, 5.8) };
|
||||||
|
|
||||||
BView* view = new BView(BRect(0, 0, 16, 16), NULL, B_FOLLOW_ALL_SIDES, 0L);
|
BView* view = new BView(BRect(0, 0, 16, 16), NULL, B_FOLLOW_ALL_SIDES, 0L);
|
||||||
map->AddChild(view);
|
map->AddChild(view);
|
||||||
map->Lock();
|
map->Lock();
|
||||||
view->SetHighColor(B_TRANSPARENT_32_BIT);
|
view->SetHighColor(B_TRANSPARENT_32_BIT);
|
||||||
view->FillRect(ICON_BITMAP_RECT);
|
view->FillRect(ICON_BITMAP_RECT);
|
||||||
@@ -121,7 +121,7 @@ MakeActuatorBitmap(bool lit)
|
|||||||
view->FillPolygon(points, 10);
|
view->FillPolygon(points, 10);
|
||||||
view->SetHighColor(black);
|
view->SetHighColor(black);
|
||||||
view->StrokePolygon(points, 10);
|
view->StrokePolygon(points, 10);
|
||||||
map->Unlock();
|
map->Unlock();
|
||||||
map->RemoveChild(view);
|
map->RemoveChild(view);
|
||||||
delete view;
|
delete view;
|
||||||
return map;
|
return map;
|
||||||
@@ -138,15 +138,15 @@ ShortcutsSpec::InitializeMetaMaps()
|
|||||||
|
|
||||||
_InitModifierNames();
|
_InitModifierNames();
|
||||||
|
|
||||||
SetupStandardMap(sMetaMaps[ShortcutsSpec::SHIFT_COLUMN_INDEX], sShiftName,
|
SetupStandardMap(sMetaMaps[ShortcutsSpec::SHIFT_COLUMN_INDEX], sShiftName,
|
||||||
B_SHIFT_KEY, B_LEFT_SHIFT_KEY, B_RIGHT_SHIFT_KEY);
|
B_SHIFT_KEY, B_LEFT_SHIFT_KEY, B_RIGHT_SHIFT_KEY);
|
||||||
|
|
||||||
SetupStandardMap(sMetaMaps[ShortcutsSpec::CONTROL_COLUMN_INDEX],
|
SetupStandardMap(sMetaMaps[ShortcutsSpec::CONTROL_COLUMN_INDEX],
|
||||||
sControlName, B_CONTROL_KEY, B_LEFT_CONTROL_KEY, B_RIGHT_CONTROL_KEY);
|
sControlName, B_CONTROL_KEY, B_LEFT_CONTROL_KEY, B_RIGHT_CONTROL_KEY);
|
||||||
|
|
||||||
SetupStandardMap(sMetaMaps[ShortcutsSpec::COMMAND_COLUMN_INDEX],
|
SetupStandardMap(sMetaMaps[ShortcutsSpec::COMMAND_COLUMN_INDEX],
|
||||||
sCommandName, B_COMMAND_KEY, B_LEFT_COMMAND_KEY, B_RIGHT_COMMAND_KEY);
|
sCommandName, B_COMMAND_KEY, B_LEFT_COMMAND_KEY, B_RIGHT_COMMAND_KEY);
|
||||||
|
|
||||||
SetupStandardMap(sMetaMaps[ShortcutsSpec::OPTION_COLUMN_INDEX], sOptionName
|
SetupStandardMap(sMetaMaps[ShortcutsSpec::OPTION_COLUMN_INDEX], sOptionName
|
||||||
, B_OPTION_KEY, B_LEFT_OPTION_KEY, B_RIGHT_OPTION_KEY);
|
, B_OPTION_KEY, B_LEFT_OPTION_KEY, B_RIGHT_OPTION_KEY);
|
||||||
|
|
||||||
@@ -155,18 +155,18 @@ ShortcutsSpec::InitializeMetaMaps()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ShortcutsSpec::ShortcutsSpec(const char* cmd)
|
ShortcutsSpec::ShortcutsSpec(const char* cmd)
|
||||||
:
|
:
|
||||||
CLVListItem(0, false, false, _height),
|
CLVListItem(0, false, false, _height),
|
||||||
fCommand(NULL),
|
fCommand(NULL),
|
||||||
fTextOffset(0),
|
fTextOffset(0),
|
||||||
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
||||||
fLastBitmapName(NULL),
|
fLastBitmapName(NULL),
|
||||||
fBitmapValid(false),
|
fBitmapValid(false),
|
||||||
fKey(0),
|
fKey(0),
|
||||||
fCursorPtsValid(false)
|
fCursorPtsValid(false)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
||||||
fMetaCellStateIndex[i] = 0;
|
fMetaCellStateIndex[i] = 0;
|
||||||
SetCommand(cmd);
|
SetCommand(cmd);
|
||||||
}
|
}
|
||||||
@@ -174,18 +174,18 @@ ShortcutsSpec::ShortcutsSpec(const char* cmd)
|
|||||||
|
|
||||||
ShortcutsSpec::ShortcutsSpec(const ShortcutsSpec& from)
|
ShortcutsSpec::ShortcutsSpec(const ShortcutsSpec& from)
|
||||||
:
|
:
|
||||||
CLVListItem(0, false, false, _height),
|
CLVListItem(0, false, false, _height),
|
||||||
fCommand(NULL),
|
fCommand(NULL),
|
||||||
fTextOffset(from.fTextOffset),
|
fTextOffset(from.fTextOffset),
|
||||||
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
||||||
fLastBitmapName(NULL),
|
fLastBitmapName(NULL),
|
||||||
fBitmapValid(false),
|
fBitmapValid(false),
|
||||||
fKey(from.fKey),
|
fKey(from.fKey),
|
||||||
fCursorPtsValid(false)
|
fCursorPtsValid(false)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
||||||
fMetaCellStateIndex[i] = from.fMetaCellStateIndex[i];
|
fMetaCellStateIndex[i] = from.fMetaCellStateIndex[i];
|
||||||
|
|
||||||
SetCommand(from.fCommand);
|
SetCommand(from.fCommand);
|
||||||
SetSelectedColumn(from.GetSelectedColumn());
|
SetSelectedColumn(from.GetSelectedColumn());
|
||||||
}
|
}
|
||||||
@@ -193,15 +193,15 @@ ShortcutsSpec::ShortcutsSpec(const ShortcutsSpec& from)
|
|||||||
|
|
||||||
ShortcutsSpec::ShortcutsSpec(BMessage* from)
|
ShortcutsSpec::ShortcutsSpec(BMessage* from)
|
||||||
:
|
:
|
||||||
CLVListItem(0, false, false, _height),
|
CLVListItem(0, false, false, _height),
|
||||||
fCommand(NULL),
|
fCommand(NULL),
|
||||||
fTextOffset(0),
|
fTextOffset(0),
|
||||||
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
|
||||||
fLastBitmapName(NULL),
|
fLastBitmapName(NULL),
|
||||||
fBitmapValid(false),
|
fBitmapValid(false),
|
||||||
fCursorPtsValid(false)
|
fCursorPtsValid(false)
|
||||||
{
|
{
|
||||||
const char* temp;
|
const char* temp;
|
||||||
if (from->FindString("command", &temp) != B_NO_ERROR) {
|
if (from->FindString("command", &temp) != B_NO_ERROR) {
|
||||||
printf(CLASS);
|
printf(CLASS);
|
||||||
printf(" Error, no command string in archive BMessage!\n");
|
printf(" Error, no command string in archive BMessage!\n");
|
||||||
@@ -216,7 +216,7 @@ ShortcutsSpec::ShortcutsSpec(BMessage* from)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
for (int i = 0; i < NUM_META_COLUMNS; i++)
|
||||||
if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i])
|
if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i])
|
||||||
!= B_NO_ERROR) {
|
!= B_NO_ERROR) {
|
||||||
printf(CLASS);
|
printf(CLASS);
|
||||||
printf(" Error, no modifiers int32 in archive BMessage!\n");
|
printf(" Error, no modifiers int32 in archive BMessage!\n");
|
||||||
@@ -301,14 +301,14 @@ IsValidActuatorName(const char* c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BArchivable*
|
BArchivable*
|
||||||
ShortcutsSpec::Instantiate(BMessage* from)
|
ShortcutsSpec::Instantiate(BMessage* from)
|
||||||
{
|
{
|
||||||
bool validateOK = false;
|
bool validateOK = false;
|
||||||
if (validate_instantiation(from, "ShortcutsSpec"))
|
if (validate_instantiation(from, "ShortcutsSpec"))
|
||||||
validateOK = true;
|
validateOK = true;
|
||||||
else // test the old one.
|
else // test the old one.
|
||||||
if (validate_instantiation(from, "SpicyKeysSpec"))
|
if (validate_instantiation(from, "SpicyKeysSpec"))
|
||||||
validateOK = true;
|
validateOK = true;
|
||||||
|
|
||||||
if (!validateOK)
|
if (!validateOK)
|
||||||
@@ -339,7 +339,7 @@ ShortcutsSpec::_CacheViewFont(BView* owner)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
||||||
int32 column_index, bool columnSelected, bool complete)
|
int32 column_index, bool columnSelected, bool complete)
|
||||||
{
|
{
|
||||||
const float STRING_COLUMN_LEFT_MARGIN = 25.0f; // 16 for the icon,+9 empty
|
const float STRING_COLUMN_LEFT_MARGIN = 25.0f; // 16 for the icon,+9 empty
|
||||||
@@ -359,16 +359,16 @@ ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
|||||||
|
|
||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float textWidth = sViewFont.StringWidth(text);
|
float textWidth = sViewFont.StringWidth(text);
|
||||||
BPoint point;
|
BPoint point;
|
||||||
rgb_color lowColor = color;
|
rgb_color lowColor = color;
|
||||||
|
|
||||||
if (column_index == STRING_COLUMN_INDEX) {
|
if (column_index == STRING_COLUMN_INDEX) {
|
||||||
// left justified
|
// left justified
|
||||||
point.Set(item_column_rect.left + STRING_COLUMN_LEFT_MARGIN,
|
point.Set(item_column_rect.left + STRING_COLUMN_LEFT_MARGIN,
|
||||||
item_column_rect.top + fTextOffset);
|
item_column_rect.top + fTextOffset);
|
||||||
|
|
||||||
item_column_rect.left = point.x;
|
item_column_rect.left = point.x;
|
||||||
// keep text from drawing into icon area
|
// keep text from drawing into icon area
|
||||||
|
|
||||||
@@ -380,12 +380,12 @@ ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
|||||||
} else {
|
} else {
|
||||||
if ((column_index < NUM_META_COLUMNS) && (text[0] == '('))
|
if ((column_index < NUM_META_COLUMNS) && (text[0] == '('))
|
||||||
return; // don't draw for this ...
|
return; // don't draw for this ...
|
||||||
|
|
||||||
if ((column_index <= NUM_META_COLUMNS) && (text[0] == '\0'))
|
if ((column_index <= NUM_META_COLUMNS) && (text[0] == '\0'))
|
||||||
return; // don't draw for this ...
|
return; // don't draw for this ...
|
||||||
|
|
||||||
// centered
|
// centered
|
||||||
point.Set((item_column_rect.left + item_column_rect.right) / 2.0,
|
point.Set((item_column_rect.left + item_column_rect.right) / 2.0,
|
||||||
item_column_rect.top + fTextOffset);
|
item_column_rect.top + fTextOffset);
|
||||||
_CacheViewFont(owner);
|
_CacheViewFont(owner);
|
||||||
point.x -= textWidth / 2.0f;
|
point.x -= textWidth / 2.0f;
|
||||||
@@ -402,12 +402,12 @@ ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
|||||||
// How about I draw a nice "key" background for this one?
|
// How about I draw a nice "key" background for this one?
|
||||||
BRect textRect(point.x - KEY_MARGIN, (point.y-sFontHeight) - KEY_MARGIN
|
BRect textRect(point.x - KEY_MARGIN, (point.y-sFontHeight) - KEY_MARGIN
|
||||||
, point.x + textWidth + KEY_MARGIN - 2.0f, point.y + KEY_MARGIN);
|
, point.x + textWidth + KEY_MARGIN - 2.0f, point.y + KEY_MARGIN);
|
||||||
|
|
||||||
if (column_index == KEY_COLUMN_INDEX)
|
if (column_index == KEY_COLUMN_INDEX)
|
||||||
lowColor = ReallyLightPurple;
|
lowColor = ReallyLightPurple;
|
||||||
else
|
else
|
||||||
lowColor = LightYellow;
|
lowColor = LightYellow;
|
||||||
|
|
||||||
owner->SetHighColor(lowColor);
|
owner->SetHighColor(lowColor);
|
||||||
owner->FillRoundRect(textRect, CORNER_RADIUS, CORNER_RADIUS);
|
owner->FillRoundRect(textRect, CORNER_RADIUS, CORNER_RADIUS);
|
||||||
owner->SetHighColor(Black);
|
owner->SetHighColor(Black);
|
||||||
@@ -444,12 +444,12 @@ ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
|||||||
owner->SetDrawingMode(B_OP_OVER);
|
owner->SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
if ((fCommand != NULL) && (fCommand[0] == '*'))
|
if ((fCommand != NULL) && (fCommand[0] == '*'))
|
||||||
owner->DrawBitmap(sActuatorBitmaps[fBitmapValid ? 1 : 0],
|
owner->DrawBitmap(sActuatorBitmaps[fBitmapValid ? 1 : 0],
|
||||||
ICON_BITMAP_RECT, item_column_rect);
|
ICON_BITMAP_RECT, item_column_rect);
|
||||||
else
|
else
|
||||||
// Draw icon, if any
|
// Draw icon, if any
|
||||||
if (fBitmapValid)
|
if (fBitmapValid)
|
||||||
owner->DrawBitmap(&fBitmap, ICON_BITMAP_RECT,
|
owner->DrawBitmap(&fBitmap, ICON_BITMAP_RECT,
|
||||||
item_column_rect);
|
item_column_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ ShortcutsSpec::Update(BView* owner, const BFont* font)
|
|||||||
CLVListItem::Update(owner, font);
|
CLVListItem::Update(owner, font);
|
||||||
font_height FontAttributes;
|
font_height FontAttributes;
|
||||||
be_plain_font->GetHeight(&FontAttributes);
|
be_plain_font->GetHeight(&FontAttributes);
|
||||||
float fontHeight = ceil(FontAttributes.ascent) +
|
float fontHeight = ceil(FontAttributes.ascent) +
|
||||||
ceil(FontAttributes.descent);
|
ceil(FontAttributes.descent);
|
||||||
fTextOffset = ceil(FontAttributes.ascent) + (Height() - fontHeight) / 2.0;
|
fTextOffset = ceil(FontAttributes.ascent) + (Height() - fontHeight) / 2.0;
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ ShortcutsSpec::GetCellText(int whichColumn) const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ((whichColumn >= 0) && (whichColumn < NUM_META_COLUMNS))
|
if ((whichColumn >= 0) && (whichColumn < NUM_META_COLUMNS))
|
||||||
temp = sMetaMaps[whichColumn].GetNthStateDesc(
|
temp = sMetaMaps[whichColumn].GetNthStateDesc(
|
||||||
fMetaCellStateIndex[whichColumn]);
|
fMetaCellStateIndex[whichColumn]);
|
||||||
break;
|
break;
|
||||||
@@ -530,7 +530,7 @@ ShortcutsSpec::ProcessColumnTextString(int whichColumn, const char* string)
|
|||||||
fKey = FindKeyCode(string);
|
fKey = FindKeyCode(string);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ProcessColumnKeyStroke(whichColumn, string, 0);
|
return ProcessColumnKeyStroke(whichColumn, string, 0);
|
||||||
@@ -562,7 +562,7 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
BList matchList;
|
BList matchList;
|
||||||
int maxEntryLen = 0;
|
int maxEntryLen = 0;
|
||||||
|
|
||||||
// Read in all the files in the directory whose names start
|
// Read in all the files in the directory whose names start
|
||||||
// with our fragment.
|
// with our fragment.
|
||||||
while (dir.GetNextEntry(&nextEnt) == B_NO_ERROR) {
|
while (dir.GetNextEntry(&nextEnt) == B_NO_ERROR) {
|
||||||
if (nextEnt.GetPath(&nextPath) == B_NO_ERROR) {
|
if (nextEnt.GetPath(&nextPath) == B_NO_ERROR) {
|
||||||
@@ -579,7 +579,7 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now slowly extend our keyword to its full length, counting
|
// Now slowly extend our keyword to its full length, counting
|
||||||
// numbers of matches at each step. If the match list length
|
// numbers of matches at each step. If the match list length
|
||||||
// is 1, we can use that whole entry. If it's greater than one
|
// is 1, we can use that whole entry. If it's greater than one
|
||||||
// , we can use just the match length.
|
// , we can use just the match length.
|
||||||
int matchLen = matchList.CountItems();
|
int matchLen = matchList.CountItems();
|
||||||
@@ -595,8 +595,8 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
(char*)matchList.ItemAt(j), i);
|
(char*)matchList.ItemAt(j), i);
|
||||||
if (commonLetter == '\0')
|
if (commonLetter == '\0')
|
||||||
commonLetter = nextLetter;
|
commonLetter = nextLetter;
|
||||||
|
|
||||||
if ((commonLetter != '\0')
|
if ((commonLetter != '\0')
|
||||||
&& (commonLetter != nextLetter)) {
|
&& (commonLetter != nextLetter)) {
|
||||||
commonLetter = '\0';// failed;
|
commonLetter = '\0';// failed;
|
||||||
beep();
|
beep();
|
||||||
@@ -620,7 +620,7 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
wholeLine += argv[l];
|
wholeLine += argv[l];
|
||||||
wholeLine += " ";
|
wholeLine += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
BString file(directoryName);
|
BString file(directoryName);
|
||||||
DoStandardEscapes(file);
|
DoStandardEscapes(file);
|
||||||
|
|
||||||
@@ -636,7 +636,7 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
|
|
||||||
// And re-append it iff the file is a dir.
|
// And re-append it iff the file is a dir.
|
||||||
BDirectory testFileAsDir(file.String());
|
BDirectory testFileAsDir(file.String());
|
||||||
if ((strcmp(file.String(), "/") != 0)
|
if ((strcmp(file.String(), "/") != 0)
|
||||||
&& (testFileAsDir.InitCheck() == B_NO_ERROR))
|
&& (testFileAsDir.InitCheck() == B_NO_ERROR))
|
||||||
file.Append("/");
|
file.Append("/");
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ ShortcutsSpec::_AttemptTabCompletion()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
||||||
int32 key)
|
int32 key)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@@ -672,7 +672,7 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||||||
case STRING_COLUMN_INDEX:
|
case STRING_COLUMN_INDEX:
|
||||||
{
|
{
|
||||||
switch(bytes[0]) {
|
switch(bytes[0]) {
|
||||||
case B_BACKSPACE:
|
case B_BACKSPACE:
|
||||||
case B_DELETE:
|
case B_DELETE:
|
||||||
if (fCommandNul > 0) {
|
if (fCommandNul > 0) {
|
||||||
// trim a char off the string
|
// trim a char off the string
|
||||||
@@ -693,23 +693,23 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
int newCharLen = strlen(bytes);
|
uint32 newCharLen = strlen(bytes);
|
||||||
if ((newCharLen > 0) && (bytes[0] >= ' ')) {
|
if ((newCharLen > 0) && (bytes[0] >= ' ')) {
|
||||||
bool reAllocString = false;
|
bool reAllocString = false;
|
||||||
// Make sure we have enough room in our command string
|
// Make sure we have enough room in our command string
|
||||||
// to add these chars...
|
// to add these chars...
|
||||||
while ((int)fCommandLen - fCommandNul <= newCharLen) {
|
while (fCommandLen - fCommandNul <= newCharLen) {
|
||||||
reAllocString = true;
|
reAllocString = true;
|
||||||
// enough for a while...
|
// enough for a while...
|
||||||
fCommandLen = (fCommandLen + 10) * 2;
|
fCommandLen = (fCommandLen + 10) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reAllocString) {
|
if (reAllocString) {
|
||||||
char* temp = new char[fCommandLen];
|
char* temp = new char[fCommandLen];
|
||||||
strcpy(temp, fCommand);
|
strcpy(temp, fCommand);
|
||||||
delete [] fCommand;
|
delete [] fCommand;
|
||||||
fCommand = temp;
|
fCommand = temp;
|
||||||
// fCommandNul is still valid since it's an offset
|
// fCommandNul is still valid since it's an offset
|
||||||
// and the string length is the same for now
|
// and the string length is the same for now
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||||||
|
|
||||||
switch(bytes[0])
|
switch(bytes[0])
|
||||||
{
|
{
|
||||||
case B_RETURN:
|
case B_RETURN:
|
||||||
// cycle to the previous state
|
// cycle to the previous state
|
||||||
curState = (curState + numStates - 1) % numStates;
|
curState = (curState + numStates - 1) % numStates;
|
||||||
break;
|
break;
|
||||||
@@ -745,16 +745,16 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Go to the state starting with the given letter, if
|
// Go to the state starting with the given letter, if
|
||||||
// any
|
// any
|
||||||
char letter = bytes[0];
|
char letter = bytes[0];
|
||||||
if (islower(letter))
|
if (islower(letter))
|
||||||
letter = toupper(letter); // convert to upper case
|
letter = toupper(letter); // convert to upper case
|
||||||
|
|
||||||
if ((letter == B_BACKSPACE) || (letter == B_DELETE))
|
if ((letter == B_BACKSPACE) || (letter == B_DELETE))
|
||||||
letter = '(';
|
letter = '(';
|
||||||
// so space bar will blank out an entry
|
// so space bar will blank out an entry
|
||||||
|
|
||||||
for (int i = 0; i < numStates; i++) {
|
for (int i = 0; i < numStates; i++) {
|
||||||
const char* desc = map->GetNthStateDesc(i);
|
const char* desc = map->GetNthStateDesc(i);
|
||||||
|
|
||||||
@@ -763,14 +763,14 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||||||
curState = i;
|
curState = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printf(B_TRANSLATE("Error, NULL state description?\n"));
|
printf(B_TRANSLATE("Error, NULL state description?\n"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fMetaCellStateIndex[whichColumn] = curState;
|
fMetaCellStateIndex[whichColumn] = curState;
|
||||||
|
|
||||||
if (curState != origState)
|
if (curState != origState)
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
@@ -788,7 +788,7 @@ ShortcutsSpec::MyCompare(const CLVListItem* a_Item1, const CLVListItem* a_Item2,
|
|||||||
ShortcutsSpec* left = (ShortcutsSpec*) a_Item1;
|
ShortcutsSpec* left = (ShortcutsSpec*) a_Item1;
|
||||||
ShortcutsSpec* right = (ShortcutsSpec*) a_Item2;
|
ShortcutsSpec* right = (ShortcutsSpec*) a_Item2;
|
||||||
|
|
||||||
int ret = strcmp(left->GetCellText(KeyColumn),
|
int ret = strcmp(left->GetCellText(KeyColumn),
|
||||||
right->GetCellText(KeyColumn));
|
right->GetCellText(KeyColumn));
|
||||||
return (ret > 0) ? 1 : ((ret == 0) ? 0 : -1);
|
return (ret > 0) ? 1 : ((ret == 0) ? 0 : -1);
|
||||||
}
|
}
|
||||||
@@ -799,9 +799,9 @@ ShortcutsSpec::Pulse(BView* owner)
|
|||||||
{
|
{
|
||||||
if ((fCursorPtsValid)&&(owner->Window()->IsActive())) {
|
if ((fCursorPtsValid)&&(owner->Window()->IsActive())) {
|
||||||
rgb_color prevColor = owner->HighColor();
|
rgb_color prevColor = owner->HighColor();
|
||||||
rgb_color backgroundColor = (GetSelectedColumn() ==
|
rgb_color backgroundColor = (GetSelectedColumn() ==
|
||||||
STRING_COLUMN_INDEX) ? BeBackgroundGrey : BeListSelectGrey;
|
STRING_COLUMN_INDEX) ? BeBackgroundGrey : BeListSelectGrey;
|
||||||
rgb_color barColor = ((GetSelectedColumn() == STRING_COLUMN_INDEX)
|
rgb_color barColor = ((GetSelectedColumn() == STRING_COLUMN_INDEX)
|
||||||
&& ((system_time() % 1000000) > 500000)) ? Black : backgroundColor;
|
&& ((system_time() % 1000000) > 500000)) ? Black : backgroundColor;
|
||||||
owner->SetHighColor(barColor);
|
owner->SetHighColor(barColor);
|
||||||
owner->StrokeLine(fCursorPt1, fCursorPt2);
|
owner->StrokeLine(fCursorPt1, fCursorPt2);
|
||||||
@@ -822,20 +822,20 @@ ShortcutsSpec::_UpdateIconBitmap()
|
|||||||
fBitmapValid = IsValidActuatorName(&firstWord.String()[1]);
|
fBitmapValid = IsValidActuatorName(&firstWord.String()[1]);
|
||||||
else {
|
else {
|
||||||
fBitmapValid = false; // default till we prove otherwise!
|
fBitmapValid = false; // default till we prove otherwise!
|
||||||
|
|
||||||
if (firstWord.Length() > 0) {
|
if (firstWord.Length() > 0) {
|
||||||
delete [] fLastBitmapName;
|
delete [] fLastBitmapName;
|
||||||
fLastBitmapName = new char[firstWord.Length() + 1];
|
fLastBitmapName = new char[firstWord.Length() + 1];
|
||||||
strcpy(fLastBitmapName, firstWord.String());
|
strcpy(fLastBitmapName, firstWord.String());
|
||||||
|
|
||||||
BEntry progEntry(fLastBitmapName, true);
|
BEntry progEntry(fLastBitmapName, true);
|
||||||
if ((progEntry.InitCheck() == B_NO_ERROR)
|
if ((progEntry.InitCheck() == B_NO_ERROR)
|
||||||
&& (progEntry.Exists())) {
|
&& (progEntry.Exists())) {
|
||||||
BNode progNode(&progEntry);
|
BNode progNode(&progEntry);
|
||||||
if (progNode.InitCheck() == B_NO_ERROR) {
|
if (progNode.InitCheck() == B_NO_ERROR) {
|
||||||
BNodeInfo progNodeInfo(&progNode);
|
BNodeInfo progNodeInfo(&progNode);
|
||||||
if ((progNodeInfo.InitCheck() == B_NO_ERROR)
|
if ((progNodeInfo.InitCheck() == B_NO_ERROR)
|
||||||
&& (progNodeInfo.GetTrackerIcon(&fBitmap, B_MINI_ICON)
|
&& (progNodeInfo.GetTrackerIcon(&fBitmap, B_MINI_ICON)
|
||||||
== B_NO_ERROR)) {
|
== B_NO_ERROR)) {
|
||||||
fBitmapValid = fBitmap.IsValid();
|
fBitmapValid = fBitmap.IsValid();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void CLVColumnLabelView::MouseDown(BPoint Point)
|
|||||||
bool GrabbedResizeTab = false;
|
bool GrabbedResizeTab = false;
|
||||||
int32 NumberOfColumns = fDisplayList->CountItems();
|
int32 NumberOfColumns = fDisplayList->CountItems();
|
||||||
int32 ColumnFind;
|
int32 ColumnFind;
|
||||||
CLVColumn* ThisColumn;
|
CLVColumn* ThisColumn = NULL;
|
||||||
for(ColumnFind = 0; ColumnFind < NumberOfColumns; ColumnFind++)
|
for(ColumnFind = 0; ColumnFind < NumberOfColumns; ColumnFind++)
|
||||||
{
|
{
|
||||||
ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
|
ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
|
||||||
@@ -228,13 +228,13 @@ void CLVColumnLabelView::MouseDown(BPoint Point)
|
|||||||
{
|
{
|
||||||
float ColumnBegin = ThisColumn->fColumnBegin;
|
float ColumnBegin = ThisColumn->fColumnBegin;
|
||||||
float ColumnEnd = ThisColumn->fColumnEnd;
|
float ColumnEnd = ThisColumn->fColumnEnd;
|
||||||
if ((Point.x >= ColumnBegin && Point.x <= ColumnEnd) ||
|
if ((Point.x >= ColumnBegin && Point.x <= ColumnEnd) ||
|
||||||
((ColumnFind == NumberOfColumns-1)&&(Point.x >= ColumnBegin))) // anything after the rightmost column can drag... jaf
|
((ColumnFind == NumberOfColumns-1)&&(Point.x >= ColumnBegin))) // anything after the rightmost column can drag... jaf
|
||||||
{
|
{
|
||||||
const float resizeTolerance = 5.0f; // jaf is too clumsy to click on a 2 pixel space. :)
|
const float resizeTolerance = 5.0f; // jaf is too clumsy to click on a 2 pixel space. :)
|
||||||
|
|
||||||
//User clicked in this column
|
//User clicked in this column
|
||||||
if(Point.x <= ColumnBegin+resizeTolerance)
|
if(Point.x <= ColumnBegin+resizeTolerance)
|
||||||
{
|
{
|
||||||
//User clicked the resize tab preceding this column
|
//User clicked the resize tab preceding this column
|
||||||
for(ColumnFind--; ColumnFind >= 0; ColumnFind--)
|
for(ColumnFind--; ColumnFind >= 0; ColumnFind--)
|
||||||
@@ -312,7 +312,7 @@ void CLVColumnLabelView::MessageReceived(BMessage *message)
|
|||||||
uint32 Buttons;
|
uint32 Buttons;
|
||||||
message->FindInt32("buttons",(int32*)&Buttons);
|
message->FindInt32("buttons",(int32*)&Buttons);
|
||||||
uint32 Modifiers;
|
uint32 Modifiers;
|
||||||
message->FindInt32("modifiers",(int32*)&Modifiers);
|
message->FindInt32("modifiers",(int32*)&Modifiers);
|
||||||
BRect ViewBounds;
|
BRect ViewBounds;
|
||||||
ViewBounds = Bounds();
|
ViewBounds = Bounds();
|
||||||
uint32 ColumnFlags = fColumnClicked->Flags();
|
uint32 ColumnFlags = fColumnClicked->Flags();
|
||||||
@@ -356,9 +356,11 @@ void CLVColumnLabelView::MessageReceived(BMessage *message)
|
|||||||
{
|
{
|
||||||
//Live dragging of columns
|
//Live dragging of columns
|
||||||
ColumnSnapped = false;
|
ColumnSnapped = false;
|
||||||
float ColumnsUpdateLeft,ColumnsUpdateRight;
|
float ColumnsUpdateLeft = 0;
|
||||||
float MainViewUpdateLeft,MainViewUpdateRight;
|
float ColumnsUpdateRight = 0;
|
||||||
CLVColumn* LastSwapColumn;
|
float MainViewUpdateLeft = 0;
|
||||||
|
float MainViewUpdateRight = 0;
|
||||||
|
CLVColumn* LastSwapColumn = NULL;
|
||||||
if(fSnapMin != -1.0 && MousePos.x < fSnapMin)
|
if(fSnapMin != -1.0 && MousePos.x < fSnapMin)
|
||||||
{
|
{
|
||||||
//Shift the group left
|
//Shift the group left
|
||||||
@@ -595,7 +597,7 @@ void CLVColumnLabelView::UpdateDragGroups()
|
|||||||
fDragGroups.MakeEmpty();
|
fDragGroups.MakeEmpty();
|
||||||
int32 NumberOfColumns = fDisplayList->CountItems();
|
int32 NumberOfColumns = fDisplayList->CountItems();
|
||||||
bool ContinueGroup = false;
|
bool ContinueGroup = false;
|
||||||
CLVDragGroup* CurrentGroup;
|
CLVDragGroup* CurrentGroup = NULL;
|
||||||
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
|
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
|
||||||
{
|
{
|
||||||
CLVColumn* CurrentColumn = (CLVColumn*)fDisplayList->ItemAt(Counter);
|
CLVColumn* CurrentColumn = (CLVColumn*)fDisplayList->ItemAt(Counter);
|
||||||
|
|||||||
@@ -77,16 +77,20 @@ ColumnListView::ColumnListView(BRect Frame, BScrollView **ContainerView, const c
|
|||||||
uint32 ResizingMode, uint32 flags, list_view_type Type, bool hierarchical, bool horizontal,
|
uint32 ResizingMode, uint32 flags, list_view_type Type, bool hierarchical, bool horizontal,
|
||||||
bool vertical, border_style border, const BFont *LabelFont)
|
bool vertical, border_style border, const BFont *LabelFont)
|
||||||
: BListView(Frame,Name,Type,B_FOLLOW_ALL_SIDES,flags|B_PULSE_NEEDED),
|
: BListView(Frame,Name,Type,B_FOLLOW_ALL_SIDES,flags|B_PULSE_NEEDED),
|
||||||
|
fHierarchical(hierarchical),
|
||||||
fColumnList(6),
|
fColumnList(6),
|
||||||
fColumnDisplayList(6),
|
fColumnDisplayList(6),
|
||||||
|
fDataWidth(0),
|
||||||
|
fDataHeight(0),
|
||||||
|
fPageWidth(0),
|
||||||
|
fPageHeight(0),
|
||||||
fSortKeyList(6),
|
fSortKeyList(6),
|
||||||
fFullItemList(32),
|
|
||||||
fRightArrow(BRect(0.0,0.0,10.0,10.0),B_COLOR_8_BIT,CLVRightArrowData,false,false),
|
fRightArrow(BRect(0.0,0.0,10.0,10.0),B_COLOR_8_BIT,CLVRightArrowData,false,false),
|
||||||
fDownArrow(BRect(0.0,0.0,10.0,10.0),B_COLOR_8_BIT,CLVDownArrowData,false,false),
|
fDownArrow(BRect(0.0,0.0,10.0,10.0),B_COLOR_8_BIT,CLVDownArrowData,false,false),
|
||||||
_selectedColumn(-1), _editMessage(NULL)
|
fFullItemList(32),
|
||||||
|
_selectedColumn(-1),
|
||||||
|
_editMessage(NULL)
|
||||||
{
|
{
|
||||||
fHierarchical = hierarchical;
|
|
||||||
|
|
||||||
//Create the column titles bar view
|
//Create the column titles bar view
|
||||||
font_height FontAttributes;
|
font_height FontAttributes;
|
||||||
LabelFont->GetHeight(&FontAttributes);
|
LabelFont->GetHeight(&FontAttributes);
|
||||||
@@ -917,7 +921,7 @@ void ColumnListView::SetSorting(int32 NumberOfKeys, int32* SortKeys, CLVSortMode
|
|||||||
void ColumnListView::FrameResized(float width, float height)
|
void ColumnListView::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
UpdateColumnSizesDataRectSizeScrollBars();
|
UpdateColumnSizesDataRectSizeScrollBars();
|
||||||
int32 NumberOfItems = CountItems();
|
uint32 NumberOfItems = CountItems();
|
||||||
BFont Font;
|
BFont Font;
|
||||||
GetFont(&Font);
|
GetFont(&Font);
|
||||||
for(uint32 Counter = 0; Counter < NumberOfItems; Counter++)
|
for(uint32 Counter = 0; Counter < NumberOfItems; Counter++)
|
||||||
@@ -1091,6 +1095,18 @@ bool ColumnListView::AddItem(CLVListItem* item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ColumnListView::AddItem(BListItem* item, int32 fullListIndex)
|
||||||
|
{
|
||||||
|
return BListView::AddItem(item, fullListIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ColumnListView::AddItem(BListItem* item)
|
||||||
|
{
|
||||||
|
return BListView::AddItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ColumnListView::AddItemPrivate(CLVListItem* item, int32 fullListIndex)
|
bool ColumnListView::AddItemPrivate(CLVListItem* item, int32 fullListIndex)
|
||||||
{
|
{
|
||||||
item->_selectedColumn = _selectedColumn;
|
item->_selectedColumn = _selectedColumn;
|
||||||
@@ -1281,6 +1297,12 @@ bool ColumnListView::RemoveItems(int32 fullListIndex, int32 count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ColumnListView::RemoveItem(BListItem* item)
|
||||||
|
{
|
||||||
|
return BListView::RemoveItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CLVListItem* ColumnListView::FullListItemAt(int32 fullListIndex) const
|
CLVListItem* ColumnListView::FullListItemAt(int32 fullListIndex) const
|
||||||
{
|
{
|
||||||
return (CLVListItem*)fFullItemList.ItemAt(fullListIndex);
|
return (CLVListItem*)fFullItemList.ItemAt(fullListIndex);
|
||||||
@@ -1533,7 +1555,6 @@ void ColumnListView::Collapse(CLVListItem* item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Remove the items under it
|
//Remove the items under it
|
||||||
int32 FullListIndex = fFullItemList.IndexOf(item);
|
|
||||||
uint32 ItemLevel = item->fOutlineLevel;
|
uint32 ItemLevel = item->fOutlineLevel;
|
||||||
int32 NextItemIndex = DisplayIndex+1;
|
int32 NextItemIndex = DisplayIndex+1;
|
||||||
while(true)
|
while(true)
|
||||||
@@ -1590,7 +1611,6 @@ void ColumnListView::SortItems()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32 Counter;
|
int32 Counter;
|
||||||
BRect OldBounds;
|
|
||||||
if(!fHierarchical)
|
if(!fHierarchical)
|
||||||
{
|
{
|
||||||
//Plain sort
|
//Plain sort
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class ColumnListView : public BListView
|
|||||||
virtual void SetSortMode(int32 ColumnIndex,CLVSortMode Mode);
|
virtual void SetSortMode(int32 ColumnIndex,CLVSortMode Mode);
|
||||||
int32 Sorting(int32* SortKeys, CLVSortMode* SortModes) const;
|
int32 Sorting(int32* SortKeys, CLVSortMode* SortModes) const;
|
||||||
//Returns the number of used sort keys, and fills the provided arrays with the sort keys
|
//Returns the number of used sort keys, and fills the provided arrays with the sort keys
|
||||||
//by column index and sort modes, in priority order. The pointers should point to an array
|
//by column index and sort modes, in priority order. The pointers should point to an array
|
||||||
//int32 SortKeys[n], and an array CLVSortMode SortModes[n] where n is the number of sortable
|
//int32 SortKeys[n], and an array CLVSortMode SortModes[n] where n is the number of sortable
|
||||||
//columns in the ColumnListView. Note: sorting will only occur if the key column is shown.
|
//columns in the ColumnListView. Note: sorting will only occur if the key column is shown.
|
||||||
void SetSorting(int32 NumberOfKeys, int32* SortKeys, CLVSortMode* SortModes);
|
void SetSorting(int32 NumberOfKeys, int32* SortKeys, CLVSortMode* SortModes);
|
||||||
@@ -104,7 +104,7 @@ class ColumnListView : public BListView
|
|||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void ScrollTo(BPoint point);
|
virtual void ScrollTo(BPoint point);
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint point);
|
||||||
|
|
||||||
//List functions
|
//List functions
|
||||||
virtual bool AddUnder(CLVListItem*, CLVListItem* superitem);
|
virtual bool AddUnder(CLVListItem*, CLVListItem* superitem);
|
||||||
virtual bool AddItem(CLVListItem*, int32 fullListIndex);
|
virtual bool AddItem(CLVListItem*, int32 fullListIndex);
|
||||||
@@ -113,9 +113,12 @@ class ColumnListView : public BListView
|
|||||||
//CLVListItem*'s, NOT BListItem*'s
|
//CLVListItem*'s, NOT BListItem*'s
|
||||||
virtual bool AddList(BList* newItems, int32 fullListIndex); //This must be a BList of
|
virtual bool AddList(BList* newItems, int32 fullListIndex); //This must be a BList of
|
||||||
//CLVListItem*'s, NOT BListItem*'s
|
//CLVListItem*'s, NOT BListItem*'s
|
||||||
|
virtual bool AddItem(BListItem*, int32 fullListIndex); // unhide
|
||||||
|
virtual bool AddItem(BListItem*); // unhide
|
||||||
virtual bool RemoveItem(CLVListItem* item);
|
virtual bool RemoveItem(CLVListItem* item);
|
||||||
virtual BListItem* RemoveItem(int32 fullListIndex); //Actually returns CLVListItem
|
virtual BListItem* RemoveItem(int32 fullListIndex); //Actually returns CLVListItem
|
||||||
virtual bool RemoveItems(int32 fullListIndex, int32 count);
|
virtual bool RemoveItems(int32 fullListIndex, int32 count);
|
||||||
|
virtual bool RemoveItem(BListItem* item); // unhide
|
||||||
virtual void MakeEmpty();
|
virtual void MakeEmpty();
|
||||||
CLVListItem* FullListItemAt(int32 fullListIndex) const;
|
CLVListItem* FullListItemAt(int32 fullListIndex) const;
|
||||||
int32 FullListIndexOf(const CLVListItem* item) const;
|
int32 FullListIndexOf(const CLVListItem* item) const;
|
||||||
@@ -141,13 +144,13 @@ class ColumnListView : public BListView
|
|||||||
void SetEditMessage(BMessage * newMsg, BMessenger target);
|
void SetEditMessage(BMessage * newMsg, BMessenger target);
|
||||||
// Sets a BMessage that will be sent every time a key is pressed, or the mouse
|
// Sets a BMessage that will be sent every time a key is pressed, or the mouse
|
||||||
// is clicked in the active cell. (newMsg) becomes property of this ColumnListView.
|
// is clicked in the active cell. (newMsg) becomes property of this ColumnListView.
|
||||||
// Copies of (newMsg) will be sent to (target).
|
// Copies of (newMsg) will be sent to (target).
|
||||||
|
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
// Used to make the cursor blink on the string column...
|
// Used to make the cursor blink on the string column...
|
||||||
|
|
||||||
int32 GetSelectedColumn() const {return _selectedColumn;}
|
int32 GetSelectedColumn() const {return _selectedColumn;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CLVMainView;
|
friend class CLVMainView;
|
||||||
friend class CLVColumn;
|
friend class CLVColumn;
|
||||||
@@ -156,13 +159,13 @@ class ColumnListView : public BListView
|
|||||||
|
|
||||||
int32 GetActualIndexOf(int32 displayIndex) const;
|
int32 GetActualIndexOf(int32 displayIndex) const;
|
||||||
// Returns the "real" index of the given display index, or -1 if there is none.
|
// Returns the "real" index of the given display index, or -1 if there is none.
|
||||||
|
|
||||||
int32 GetDisplayIndexOf(int32 actualIndex) const;
|
int32 GetDisplayIndexOf(int32 actualIndex) const;
|
||||||
// Returns the display index of the given "real" index, or -1 if there is none.
|
// Returns the display index of the given "real" index, or -1 if there is none.
|
||||||
|
|
||||||
void SetSelectedColumnIndex(int32 selectedColumnIndex);
|
void SetSelectedColumnIndex(int32 selectedColumnIndex);
|
||||||
// Call this to change _selectedColumn to a new value properly.
|
// Call this to change _selectedColumn to a new value properly.
|
||||||
|
|
||||||
void UpdateColumnSizesDataRectSizeScrollBars();
|
void UpdateColumnSizesDataRectSizeScrollBars();
|
||||||
void UpdateScrollBars();
|
void UpdateScrollBars();
|
||||||
void ColumnsChanged();
|
void ColumnsChanged();
|
||||||
@@ -190,7 +193,7 @@ class ColumnListView : public BListView
|
|||||||
BList fFullItemList;
|
BList fFullItemList;
|
||||||
int32 fExpanderColumn;
|
int32 fExpanderColumn;
|
||||||
CLVCompareFuncPtr fCompare;
|
CLVCompareFuncPtr fCompare;
|
||||||
|
|
||||||
// added by jaf
|
// added by jaf
|
||||||
int32 _selectedColumn; // actual index of the column that contains the active cell.
|
int32 _selectedColumn; // actual index of the column that contains the active cell.
|
||||||
BMessage * _editMessage; // if non-NULL, sent on keypress or when active cell is clicked.
|
BMessage * _editMessage; // if non-NULL, sent on keypress or when active cell is clicked.
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ int32 MouseWatcher(void* data)
|
|||||||
{
|
{
|
||||||
BMessenger* TheMessenger = (BMessenger*)data;
|
BMessenger* TheMessenger = (BMessenger*)data;
|
||||||
BPoint PreviousPos;
|
BPoint PreviousPos;
|
||||||
uint32 PreviousButtons;
|
uint32 PreviousButtons = 0xFFFFFFFF;
|
||||||
bool FirstCheck = true;
|
bool FirstCheck = true;
|
||||||
BMessage MessageToSend;
|
BMessage MessageToSend;
|
||||||
MessageToSend.AddPoint("where",BPoint(0,0));
|
MessageToSend.AddPoint("where",BPoint(0,0));
|
||||||
|
|||||||
Reference in New Issue
Block a user