0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.0631: Haiku file formatted with wrong tabstop

Problem:    Haiku file formatted with wrong tabstop.
Solution:   Use normal tabstop. Fix white space.
This commit is contained in:
Bram Moolenaar
2020-04-24 22:16:13 +02:00
parent 7714d7b31f
commit b52575f9cf
2 changed files with 3351 additions and 3349 deletions

View File

@@ -863,7 +863,7 @@ VimApp::MessageReceived(BMessage *m)
{ {
BFilePanel *panel; BFilePanel *panel;
m->FindPointer("source", (void**)&panel); m->FindPointer("source", (void**)&panel);
if(fFilePanelSem != -1 && panel == fFilePanel) if (fFilePanelSem != -1 && panel == fFilePanel)
{ {
delete_sem(fFilePanelSem); delete_sem(fFilePanelSem);
fFilePanelSem = -1; fFilePanelSem = -1;
@@ -1593,7 +1593,7 @@ VimTextAreaView::MessageReceived(BMessage *m)
switch(opcode) switch(opcode)
{ {
case B_INPUT_METHOD_STARTED: case B_INPUT_METHOD_STARTED:
if(!IMData.messenger) delete IMData.messenger; if (!IMData.messenger) delete IMData.messenger;
IMData.messenger = new BMessenger(); IMData.messenger = new BMessenger();
m->FindMessenger("be:reply_to", IMData.messenger); m->FindMessenger("be:reply_to", IMData.messenger);
break; break;
@@ -1601,7 +1601,7 @@ VimTextAreaView::MessageReceived(BMessage *m)
{ {
BString str; BString str;
bool confirmed; bool confirmed;
if(IMData.message) *(IMData.message) = *m; if (IMData.message) *(IMData.message) = *m;
else IMData.message = new BMessage(*m); else IMData.message = new BMessage(*m);
DrawIMString(); DrawIMString();
m->FindBool("be:confirmed", &confirmed); m->FindBool("be:confirmed", &confirmed);
@@ -1660,7 +1660,7 @@ VimTextAreaView::MessageReceived(BMessage *m)
VimTextAreaView::mchInitFont(char_u *name) VimTextAreaView::mchInitFont(char_u *name)
{ {
VimFont *newFont = (VimFont *)gui_mch_get_font(name, 1); VimFont *newFont = (VimFont *)gui_mch_get_font(name, 1);
if(newFont != NOFONT) { if (newFont != NOFONT) {
gui.norm_font = (GuiFont)newFont; gui.norm_font = (GuiFont)newFont;
gui_mch_set_font((GuiFont)newFont); gui_mch_set_font((GuiFont)newFont);
if (name && STRCMP(name, "*") != 0) if (name && STRCMP(name, "*") != 0)
@@ -1691,9 +1691,9 @@ VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags)
if (!(flags & DRAW_TRANSP)) { if (!(flags & DRAW_TRANSP)) {
int cells; int cells;
cells = 0; cells = 0;
for(int i=0; i<len; i++) { for (int i=0; i<len; i++) {
int cn = utf_ptr2cells((char_u *)(s+i)); int cn = utf_ptr2cells((char_u *)(s+i));
if(cn<4) cells += cn; if (cn<4) cells += cn;
} }
BRect r(FILL_X(col), FILL_Y(row), BRect r(FILL_X(col), FILL_Y(row),
@@ -1703,13 +1703,13 @@ VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags)
BFont font; BFont font;
this->GetFont(&font); this->GetFont(&font);
if(!font.IsFixed()) if (!font.IsFixed())
{ {
char* p = (char*)s; char* p = (char*)s;
int32 clen, lastpos = 0; int32 clen, lastpos = 0;
BPoint where; BPoint where;
int cells; int cells;
while((p - (char*)s) < len) { while ((p - (char*)s) < len) {
clen = utf_ptr2len((u_char*)p); clen = utf_ptr2len((u_char*)p);
where.Set(TEXT_X(col+lastpos), TEXT_Y(row)); where.Set(TEXT_X(col+lastpos), TEXT_Y(row));
DrawString(p, clen, where); DrawString(p, clen, where);
@@ -1720,7 +1720,7 @@ VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags)
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
} }
cells = utf_ptr2cells((char_u *)p); cells = utf_ptr2cells((char_u *)p);
if(cells<4) lastpos += cells; if (cells<4) lastpos += cells;
else lastpos++; else lastpos++;
p += clen; p += clen;
} }
@@ -1740,9 +1740,9 @@ VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags)
if (flags & DRAW_UNDERL) { if (flags & DRAW_UNDERL) {
int cells; int cells;
cells = 0; cells = 0;
for(int i=0; i<len; i++) { for (int i=0; i<len; i++) {
int cn = utf_ptr2cells((char_u *)(s+i)); int cn = utf_ptr2cells((char_u *)(s+i));
if(cn<4) cells += cn; if (cn<4) cells += cn;
} }
BPoint start(FILL_X(col), FILL_Y(row + 1) - PEN_WIDTH); BPoint start(FILL_X(col), FILL_Y(row + 1) - PEN_WIDTH);
@@ -2073,10 +2073,10 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
{ {
// master view // master view
VimDialog::View* view = new VimDialog::View(Bounds()); VimDialog::View* view = new VimDialog::View(Bounds());
if(view == NULL) if (view == NULL)
return; return;
if(title == NULL) if (title == NULL)
SetTitle("Vim " VIM_VERSION_MEDIUM); SetTitle("Vim " VIM_VERSION_MEDIUM);
AddChild(view); AddChild(view);
@@ -2094,7 +2094,7 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
strButtons.RemoveAll("&"); strButtons.RemoveAll("&");
do { do {
int32 end = strButtons.FindFirst('\n'); int32 end = strButtons.FindFirst('\n');
if(end != B_ERROR) if (end != B_ERROR)
strButtons.SetByteAt(end, '\0'); strButtons.SetByteAt(end, '\0');
BButton *button = _CreateButton(which++, strButtons.String()); BButton *button = _CreateButton(which++, strButtons.String());
@@ -2106,11 +2106,11 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
buttonsWidth += button->Bounds().Width(); buttonsWidth += button->Bounds().Width();
buttonsHeight += button->Bounds().Height(); buttonsHeight += button->Bounds().Height();
if(end == B_ERROR) if (end == B_ERROR)
break; break;
strButtons.Remove(0, end + 1); strButtons.Remove(0, end + 1);
} while(true); } while (true);
int32 buttonsCount = fButtonsList.CountItems(); int32 buttonsCount = fButtonsList.CountItems();
buttonsWidth += kVimDialogButtonsSpacingX * (buttonsCount - 1); buttonsWidth += kVimDialogButtonsSpacingX * (buttonsCount - 1);
@@ -2122,7 +2122,7 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
// Check 'v' flag in 'guioptions': vertical button placement. // Check 'v' flag in 'guioptions': vertical button placement.
bool vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL) || bool vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL) ||
dialogWidth >= gui.vimWindow->Bounds().Width(); dialogWidth >= gui.vimWindow->Bounds().Width();
if(vertical) { if (vertical) {
dialogWidth -= buttonsWidth; dialogWidth -= buttonsWidth;
dialogWidth += maxButtonWidth; dialogWidth += maxButtonWidth;
dialogHeight -= maxButtonHeight; dialogHeight -= maxButtonHeight;
@@ -2156,7 +2156,7 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
dialogHeight += messageHeight; dialogHeight += messageHeight;
// input view // input view
if(fInputValue != NULL) { if (fInputValue != NULL) {
rect.top = rect.top =
rect.bottom += messageHeight + kVimDialogSpacingY; rect.bottom += messageHeight + kVimDialogSpacingY;
fInputControl = new BTextControl(rect, "_iv_", NULL, fInputValue, NULL, fInputControl = new BTextControl(rect, "_iv_", NULL, fInputValue, NULL,
@@ -2184,16 +2184,16 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
origin.x -= kVimDialogSpacingX + (vertical ? buttonWidth : buttonsWidth); origin.x -= kVimDialogSpacingX + (vertical ? buttonWidth : buttonsWidth);
origin.y -= kVimDialogSpacingY + (vertical ? buttonsHeight : maxButtonHeight); origin.y -= kVimDialogSpacingY + (vertical ? buttonsHeight : maxButtonHeight);
for(int32 i = 0 ; i < buttonsCount; i++) { for (int32 i = 0 ; i < buttonsCount; i++) {
BButton *button = (BButton*)fButtonsList.ItemAt(i); BButton *button = (BButton*)fButtonsList.ItemAt(i);
button->MoveTo(origin); button->MoveTo(origin);
if(vertical) { if (vertical) {
origin.y += button->Frame().Height() + kVimDialogButtonsSpacingY; origin.y += button->Frame().Height() + kVimDialogButtonsSpacingY;
button->ResizeTo(buttonWidth, button->Frame().Height()); button->ResizeTo(buttonWidth, button->Frame().Height());
} else } else
origin.x += button->Frame().Width() + kVimDialogButtonsSpacingX; origin.x += button->Frame().Width() + kVimDialogButtonsSpacingX;
if(dfltbutton == i + 1) { if (dfltbutton == i + 1) {
button->MakeDefault(true); button->MakeDefault(true);
button->MakeFocus(fInputControl == NULL); button->MakeFocus(fInputControl == NULL);
} }
@@ -2202,7 +2202,7 @@ VimDialog::VimDialog(int type, const char *title, const char *message,
VimDialog::~VimDialog() VimDialog::~VimDialog()
{ {
if(fDialogSem > B_OK) if (fDialogSem > B_OK)
delete_sem(fDialogSem); delete_sem(fDialogSem);
} }
@@ -2210,20 +2210,20 @@ VimDialog::~VimDialog()
VimDialog::Go() VimDialog::Go()
{ {
fDialogSem = create_sem(0, "VimDialogSem"); fDialogSem = create_sem(0, "VimDialogSem");
if(fDialogSem < B_OK) { if (fDialogSem < B_OK) {
Quit(); Quit();
return fDialogValue; return fDialogValue;
} }
Show(); Show();
while(acquire_sem(fDialogSem) == B_INTERRUPTED); while (acquire_sem(fDialogSem) == B_INTERRUPTED);
int retValue = fDialogValue; int retValue = fDialogValue;
if(fInputValue != NULL) if (fInputValue != NULL)
vim_strncpy((char_u*)fInputValue, (char_u*)fInputControl->Text(), IOSIZE - 1); vim_strncpy((char_u*)fInputValue, (char_u*)fInputControl->Text(), IOSIZE - 1);
if(Lock()) if (Lock())
Quit(); Quit();
return retValue; return retValue;
@@ -2232,7 +2232,7 @@ VimDialog::Go()
void VimDialog::MessageReceived(BMessage *msg) void VimDialog::MessageReceived(BMessage *msg)
{ {
int32 which = 0; int32 which = 0;
if(msg->what != kVimDialogButtonMsg || if (msg->what != kVimDialogButtonMsg ||
msg->FindInt32("which", &which) != B_OK) msg->FindInt32("which", &which) != B_OK)
return BWindow::MessageReceived(msg); return BWindow::MessageReceived(msg);
@@ -2279,7 +2279,7 @@ void VimDialog::View::Draw(BRect updateRect)
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
FillRect(stripeRect); FillRect(stripeRect);
if(fIconBitmap == NULL) if (fIconBitmap == NULL)
return; return;
SetDrawingMode(B_OP_ALPHA); SetDrawingMode(B_OP_ALPHA);
@@ -2289,12 +2289,12 @@ void VimDialog::View::Draw(BRect updateRect)
void VimDialog::View::InitIcon(int32 type) void VimDialog::View::InitIcon(int32 type)
{ {
if(type == VIM_GENERIC) if (type == VIM_GENERIC)
return; return;
BPath path; BPath path;
status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path); status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path);
if(status != B_OK) { if (status != B_OK) {
fprintf(stderr, "Cannot retrieve app info:%s\n", strerror(status)); fprintf(stderr, "Cannot retrieve app info:%s\n", strerror(status));
return; return;
} }
@@ -2302,14 +2302,14 @@ void VimDialog::View::InitIcon(int32 type)
path.Append("app_server"); path.Append("app_server");
BFile file(path.Path(), O_RDONLY); BFile file(path.Path(), O_RDONLY);
if(file.InitCheck() != B_OK) { if (file.InitCheck() != B_OK) {
fprintf(stderr, "App file assignment failed:%s\n", fprintf(stderr, "App file assignment failed:%s\n",
strerror(file.InitCheck())); strerror(file.InitCheck()));
return; return;
} }
BResources resources(&file); BResources resources(&file);
if(resources.InitCheck() != B_OK) { if (resources.InitCheck() != B_OK) {
fprintf(stderr, "App server resources assignment failed:%s\n", fprintf(stderr, "App server resources assignment failed:%s\n",
strerror(resources.InitCheck())); strerror(resources.InitCheck()));
return; return;
@@ -2326,7 +2326,7 @@ void VimDialog::View::InitIcon(int32 type)
int32 iconSize = 32; int32 iconSize = 32;
fIconBitmap = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32); fIconBitmap = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32);
if(fIconBitmap == NULL || fIconBitmap->InitCheck() != B_OK) { if (fIconBitmap == NULL || fIconBitmap->InitCheck() != B_OK) {
fprintf(stderr, "Icon bitmap allocation failed:%s\n", fprintf(stderr, "Icon bitmap allocation failed:%s\n",
(fIconBitmap == NULL) ? "null" : strerror(fIconBitmap->InitCheck())); (fIconBitmap == NULL) ? "null" : strerror(fIconBitmap->InitCheck()));
return; return;
@@ -2336,19 +2336,19 @@ void VimDialog::View::InitIcon(int32 type)
const uint8* iconData = NULL; const uint8* iconData = NULL;
// try vector icon first? // try vector icon first?
iconData = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, name, &size); iconData = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, name, &size);
if(iconData != NULL && BIconUtils::GetVectorIcon(iconData, size, fIconBitmap) == B_OK) if (iconData != NULL && BIconUtils::GetVectorIcon(iconData, size, fIconBitmap) == B_OK)
return; return;
// try bitmap icon now // try bitmap icon now
iconData = (const uint8*)resources.LoadResource(B_LARGE_ICON_TYPE, name, &size); iconData = (const uint8*)resources.LoadResource(B_LARGE_ICON_TYPE, name, &size);
if(iconData == NULL) { if (iconData == NULL) {
fprintf(stderr, "Bitmap icon resource not found\n"); fprintf(stderr, "Bitmap icon resource not found\n");
delete fIconBitmap; delete fIconBitmap;
fIconBitmap = NULL; fIconBitmap = NULL;
return; return;
} }
if(fIconBitmap->ColorSpace() != B_CMAP8) if (fIconBitmap->ColorSpace() != B_CMAP8)
BIconUtils::ConvertFromCMAP8(iconData, iconSize, iconSize, iconSize, fIconBitmap); BIconUtils::ConvertFromCMAP8(iconData, iconSize, iconSize, iconSize, fIconBitmap);
} }
@@ -2555,7 +2555,7 @@ VimSelectFontDialog::~VimSelectFontDialog()
void void
VimSelectFontDialog::_CleanList(BListView* list) VimSelectFontDialog::_CleanList(BListView* list)
{ {
while(0 < list->CountItems()) while (0 < list->CountItems())
delete (dynamic_cast<BStringItem*>(list->RemoveItem((int32)0))); delete (dynamic_cast<BStringItem*>(list->RemoveItem((int32)0)));
} }
@@ -2568,18 +2568,18 @@ VimSelectFontDialog::Go()
} }
fDialogSem = create_sem(0, "VimFontSelectDialogSem"); fDialogSem = create_sem(0, "VimFontSelectDialogSem");
if(fDialogSem < B_OK) { if (fDialogSem < B_OK) {
Quit(); Quit();
return fDialogValue; return fDialogValue;
} }
Show(); Show();
while(acquire_sem(fDialogSem) == B_INTERRUPTED); while (acquire_sem(fDialogSem) == B_INTERRUPTED);
bool retValue = fDialogValue; bool retValue = fDialogValue;
if(Lock()) if (Lock())
Quit(); Quit();
return retValue; return retValue;
@@ -2724,7 +2724,7 @@ VimToolbar::VimToolbar(BRect frame, const char *name) :
VimToolbar::~VimToolbar() VimToolbar::~VimToolbar()
{ {
int32 count = fButtonsList.CountItems(); int32 count = fButtonsList.CountItems();
for(int32 i = 0; i < count; i++) for (int32 i = 0; i < count; i++)
delete (BPictureButton*)fButtonsList.ItemAt(i); delete (BPictureButton*)fButtonsList.ItemAt(i);
fButtonsList.MakeEmpty(); fButtonsList.MakeEmpty();
@@ -2757,7 +2757,7 @@ VimToolbar::ModifyBitmapToGrayed(BBitmap *bitmap)
rgb_color *bits = (rgb_color*)bitmap->Bits(); rgb_color *bits = (rgb_color*)bitmap->Bits();
int32 pixels = bitmap->BitsLength() / 4; int32 pixels = bitmap->BitsLength() / 4;
for(int32 i = 0; i < pixels; i++) { for (int32 i = 0; i < pixels; i++) {
bits[i].red = bits[i].green = bits[i].red = bits[i].green =
bits[i].blue = ((uint32)bits[i].red + bits[i].green + bits[i].blue) / 3; bits[i].blue = ((uint32)bits[i].red + bits[i].green + bits[i].blue) / 3;
bits[i].alpha /= 4; bits[i].alpha /= 4;
@@ -2771,18 +2771,18 @@ VimToolbar::PrepareButtonBitmaps()
{ {
// first try to load potentially customized $VIRUNTIME/bitmaps/builtin-tools.png // first try to load potentially customized $VIRUNTIME/bitmaps/builtin-tools.png
normalButtonsBitmap = LoadVimBitmap("builtin-tools.png"); normalButtonsBitmap = LoadVimBitmap("builtin-tools.png");
if(normalButtonsBitmap == NULL) if (normalButtonsBitmap == NULL)
// customized not found? dig application resources for "builtin-tools" one // customized not found? dig application resources for "builtin-tools" one
normalButtonsBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "builtin-tools"); normalButtonsBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "builtin-tools");
if(normalButtonsBitmap == NULL) if (normalButtonsBitmap == NULL)
return false; return false;
BMessage archive; BMessage archive;
normalButtonsBitmap->Archive(&archive); normalButtonsBitmap->Archive(&archive);
grayedButtonsBitmap = new BBitmap(&archive); grayedButtonsBitmap = new BBitmap(&archive);
if(grayedButtonsBitmap == NULL) if (grayedButtonsBitmap == NULL)
return false; return false;
// modify grayed bitmap // modify grayed bitmap
@@ -2797,13 +2797,13 @@ BBitmap *VimToolbar::LoadVimBitmap(const char* fileName)
int mustfree = 0; int mustfree = 0;
char_u* runtimePath = vim_getenv((char_u*)"VIMRUNTIME", &mustfree); char_u* runtimePath = vim_getenv((char_u*)"VIMRUNTIME", &mustfree);
if(runtimePath != NULL && fileName != NULL) { if (runtimePath != NULL && fileName != NULL) {
BString strPath((char*)runtimePath); BString strPath((char*)runtimePath);
strPath << "/bitmaps/" << fileName; strPath << "/bitmaps/" << fileName;
bitmap = BTranslationUtils::GetBitmap(strPath.String()); bitmap = BTranslationUtils::GetBitmap(strPath.String());
} }
if(mustfree) if (mustfree)
vim_free(runtimePath); vim_free(runtimePath);
return bitmap; return bitmap;
@@ -2831,7 +2831,7 @@ VimToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitm
view.DrawBitmap(bitmapFrom, source, destination); view.DrawBitmap(bitmapFrom, source, destination);
if(pressed) { if (pressed) {
rgb_color shineColor = ui_color(B_SHINE_COLOR); rgb_color shineColor = ui_color(B_SHINE_COLOR);
rgb_color shadowColor = ui_color(B_SHADOW_COLOR); rgb_color shadowColor = ui_color(B_SHADOW_COLOR);
size += ButtonMargin * 2 - 1; size += ButtonMargin * 2 - 1;
@@ -2853,7 +2853,7 @@ VimToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitm
VimToolbar::AddButton(int32 index, vimmenu_T *menu) VimToolbar::AddButton(int32 index, vimmenu_T *menu)
{ {
BPictureButton *button = NULL; BPictureButton *button = NULL;
if(!menu_is_separator(menu->name)) { if (!menu_is_separator(menu->name)) {
float size = normalButtonsBitmap ? float size = normalButtonsBitmap ?
normalButtonsBitmap->Bounds().Height() + 1. + ButtonMargin * 2 : 18.; normalButtonsBitmap->Bounds().Height() + 1. + ButtonMargin * 2 : 18.;
BRect frame(0, 0, size, size); BRect frame(0, 0, size, size);
@@ -2861,7 +2861,7 @@ VimToolbar::AddButton(int32 index, vimmenu_T *menu)
BPicture pictureOff; BPicture pictureOff;
BPicture pictureGray; BPicture pictureGray;
if(menu->iconfile == NULL && menu->iconidx >= 0 && normalButtonsBitmap) { if (menu->iconfile == NULL && menu->iconidx >= 0 && normalButtonsBitmap) {
GetPictureFromBitmap(&pictureOn, menu->iconidx, normalButtonsBitmap, true); GetPictureFromBitmap(&pictureOn, menu->iconidx, normalButtonsBitmap, true);
GetPictureFromBitmap(&pictureOff, menu->iconidx, normalButtonsBitmap, false); GetPictureFromBitmap(&pictureOff, menu->iconidx, normalButtonsBitmap, false);
GetPictureFromBitmap(&pictureGray, menu->iconidx, grayedButtonsBitmap, false); GetPictureFromBitmap(&pictureGray, menu->iconidx, grayedButtonsBitmap, false);
@@ -2870,15 +2870,15 @@ VimToolbar::AddButton(int32 index, vimmenu_T *menu)
char_u buffer[MAXPATHL] = {0}; char_u buffer[MAXPATHL] = {0};
BBitmap *bitmap = NULL; BBitmap *bitmap = NULL;
if(menu->iconfile) { if (menu->iconfile) {
gui_find_iconfile(menu->iconfile, buffer, (char*)"png"); gui_find_iconfile(menu->iconfile, buffer, (char*)"png");
bitmap = BTranslationUtils::GetBitmap((char*)buffer); bitmap = BTranslationUtils::GetBitmap((char*)buffer);
} }
if(bitmap == NULL && gui_find_bitmap(menu->name, buffer, (char*)"png") == OK) if (bitmap == NULL && gui_find_bitmap(menu->name, buffer, (char*)"png") == OK)
bitmap = BTranslationUtils::GetBitmap((char*)buffer); bitmap = BTranslationUtils::GetBitmap((char*)buffer);
if(bitmap == NULL) if (bitmap == NULL)
bitmap = new BBitmap(BRect(0, 0, size, size), B_RGB32); bitmap = new BBitmap(BRect(0, 0, size, size), B_RGB32);
GetPictureFromBitmap(&pictureOn, 0, bitmap, true); GetPictureFromBitmap(&pictureOn, 0, bitmap, true);
@@ -2910,8 +2910,8 @@ VimToolbar::AddButton(int32 index, vimmenu_T *menu)
bool bool
VimToolbar::RemoveButton(vimmenu_T *menu) VimToolbar::RemoveButton(vimmenu_T *menu)
{ {
if(menu->button) { if (menu->button) {
if(fButtonsList.RemoveItem(menu->button)) { if (fButtonsList.RemoveItem(menu->button)) {
delete menu->button; delete menu->button;
menu->button = NULL; menu->button = NULL;
} }
@@ -2922,9 +2922,9 @@ VimToolbar::RemoveButton(vimmenu_T *menu)
bool bool
VimToolbar::GrayButton(vimmenu_T *menu, int grey) VimToolbar::GrayButton(vimmenu_T *menu, int grey)
{ {
if(menu->button) { if (menu->button) {
int32 index = fButtonsList.IndexOf(menu->button); int32 index = fButtonsList.IndexOf(menu->button);
if(index >= 0) if (index >= 0)
menu->button->SetEnabled(grey ? false : true); menu->button->SetEnabled(grey ? false : true);
} }
return true; return true;
@@ -2935,9 +2935,9 @@ VimToolbar::InvalidateLayout()
{ {
int32 offset = ToolbarMargin; int32 offset = ToolbarMargin;
int32 count = fButtonsList.CountItems(); int32 count = fButtonsList.CountItems();
for(int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
BPictureButton *button = (BPictureButton *)fButtonsList.ItemAt(i); BPictureButton *button = (BPictureButton *)fButtonsList.ItemAt(i);
if(button) { if (button) {
button->MoveTo(offset, ToolbarMargin); button->MoveTo(offset, ToolbarMargin);
offset += button->Bounds().Width() + ToolbarMargin; offset += button->Bounds().Width() + ToolbarMargin;
} else } else
@@ -2960,7 +2960,7 @@ VimTabLine::TablineHeight() const
void void
VimTabLine::MouseDown(BPoint point) VimTabLine::MouseDown(BPoint point)
{ {
if(!gui_mch_showing_tabline()) if (!gui_mch_showing_tabline())
return; return;
BMessage *m = Window()->CurrentMessage(); BMessage *m = Window()->CurrentMessage();
@@ -2974,7 +2974,7 @@ VimTabLine::MouseDown(BPoint point)
int index = 0; // 0 means here - no tab found int index = 0; // 0 means here - no tab found
for (int i = 0; i < CountTabs(); i++) { for (int i = 0; i < CountTabs(); i++) {
if(TabFrame(i).Contains(point)) { if (TabFrame(i).Contains(point)) {
index = i + 1; // indexes are 1-based index = i + 1; // indexes are 1-based
break; break;
} }
@@ -3027,15 +3027,15 @@ VimTabLine::VimTab::Select(BView* owner)
BTab::Select(owner); BTab::Select(owner);
VimTabLine *tabLine = gui.vimForm->TabLine(); VimTabLine *tabLine = gui.vimForm->TabLine();
if(tabLine != NULL) { if (tabLine != NULL) {
int32 i = 0; int32 i = 0;
for (; i < tabLine->CountTabs(); i++) for (; i < tabLine->CountTabs(); i++)
if(this == tabLine->TabAt(i)) if (this == tabLine->TabAt(i))
break; break;
// printf("%d:%d:%s\n", i, tabLine->CountTabs(), tabLine->TabAt(i)->Label()); // printf("%d:%d:%s\n", i, tabLine->CountTabs(), tabLine->TabAt(i)->Label());
if(i < tabLine->CountTabs()) { if (i < tabLine->CountTabs()) {
VimTablineMsg tm; VimTablineMsg tm;
tm.index = i + 1; tm.index = i + 1;
write_port(gui.vdcmp, VimMsg::Tabline, &tm, sizeof(tm)); write_port(gui.vdcmp, VimMsg::Tabline, &tm, sizeof(tm));
@@ -3566,7 +3566,7 @@ gui_mch_set_text_area_pos(
gui.vimTextArea->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH); gui.vimTextArea->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH);
#ifdef FEAT_GUI_TABLINE #ifdef FEAT_GUI_TABLINE
if(gui.vimForm->TabLine() != NULL) { if (gui.vimForm->TabLine() != NULL) {
gui.vimForm->TabLine()->ResizeTo(w, gui.vimForm->TablineHeight()); gui.vimForm->TabLine()->ResizeTo(w, gui.vimForm->TablineHeight());
} }
#endif // FEAT_GUI_TABLINE #endif // FEAT_GUI_TABLINE
@@ -3658,7 +3658,7 @@ gui_mch_set_scrollbar_pos(
float vsbx = x, vsby = y; float vsbx = x, vsby = y;
VimScrollBar *vsb = sb->id; VimScrollBar *vsb = sb->id;
vsb->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH); vsb->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH);
if(winb.right-(x+w)<w) vsbx = winb.right - (w - PEN_WIDTH); if (winb.right-(x+w)<w) vsbx = winb.right - (w - PEN_WIDTH);
vsb->MoveTo(vsbx, vsby); vsb->MoveTo(vsbx, vsby);
gui.vimWindow->Unlock(); gui.vimWindow->Unlock();
} }
@@ -3829,7 +3829,7 @@ gui_mch_get_font(
float size = 0.f; float size = 0.f;
if (name == 0 && be_fixed_font == 0) { if (name == 0 && be_fixed_font == 0) {
if(giveErrorIfMissing) if (giveErrorIfMissing)
semsg(_(e_font), name); semsg(_(e_font), name);
return NOFONT; return NOFONT;
} }
@@ -3864,7 +3864,7 @@ gui_mch_get_font(
size = atof((style_s != 0) ? strtok(0, "/\0") : "0"); size = atof((style_s != 0) ? strtok(0, "/\0") : "0");
if (useSelectGUI) { if (useSelectGUI) {
if(gui_mch_font_dialog(&family, &style, &size) == NOFONT) if (gui_mch_font_dialog(&family, &style, &size) == NOFONT)
return FAIL; return FAIL;
// compose for further processing // compose for further processing
vim_snprintf(font_name, buff_size, vim_snprintf(font_name, buff_size,
@@ -3895,7 +3895,7 @@ gui_mch_get_font(
VimFont *font = new VimFont(); VimFont *font = new VimFont();
font->name = vim_strsave((char_u*)font_name); font->name = vim_strsave((char_u*)font_name);
if(count_font_styles(family) <= 0) { if (count_font_styles(family) <= 0) {
if (giveErrorIfMissing) if (giveErrorIfMissing)
semsg(_(e_font), font->name); semsg(_(e_font), font->name);
delete font; delete font;
@@ -3907,7 +3907,7 @@ gui_mch_get_font(
fontList = font; fontList = font;
font->SetFamilyAndStyle(family, style); font->SetFamilyAndStyle(family, style);
if(size > 0.f) if (size > 0.f)
font->SetSize(size); font->SetSize(size);
font->SetSpacing(B_FIXED_SPACING); font->SetSpacing(B_FIXED_SPACING);
@@ -3944,7 +3944,7 @@ void
gui_mch_free_font( gui_mch_free_font(
GuiFont font) GuiFont font)
{ {
if(font == NOFONT) if (font == NOFONT)
return; return;
VimFont *f = (VimFont *)font; VimFont *f = (VimFont *)font;
if (--f->refcount <= 0) { if (--f->refcount <= 0) {
@@ -4401,7 +4401,7 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
r.left = FILL_X(gui.col); r.left = FILL_X(gui.col);
r.top = FILL_Y(gui.row); r.top = FILL_Y(gui.row);
int cells = utf_off2cells(LineOffset[gui.row] + gui.col, 100); // TODO-TODO int cells = utf_off2cells(LineOffset[gui.row] + gui.col, 100); // TODO-TODO
if(cells>=4) cells = 1; if (cells>=4) cells = 1;
r.right = r.left + cells*gui.char_width - PEN_WIDTH; r.right = r.left + cells*gui.char_width - PEN_WIDTH;
r.bottom = r.top + gui.char_height - PEN_WIDTH; r.bottom = r.top + gui.char_height - PEN_WIDTH;
@@ -4711,9 +4711,9 @@ gui_mch_add_menu_item(
if (gui.vimWindow->Lock()) if (gui.vimWindow->Lock())
{ {
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
if(menu_is_toolbar(parent->name)) { if (menu_is_toolbar(parent->name)) {
VimToolbar *toolbar = gui.vimForm->ToolBar(); VimToolbar *toolbar = gui.vimForm->ToolBar();
if(toolbar != NULL) { if (toolbar != NULL) {
toolbar->AddButton(idx, menu); toolbar->AddButton(idx, menu);
} }
} else } else
@@ -4750,9 +4750,9 @@ gui_mch_destroy_menu(
if (gui.vimWindow->Lock()) if (gui.vimWindow->Lock())
{ {
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
if(menu->parent && menu_is_toolbar(menu->parent->name)) { if (menu->parent && menu_is_toolbar(menu->parent->name)) {
VimToolbar *toolbar = gui.vimForm->ToolBar(); VimToolbar *toolbar = gui.vimForm->ToolBar();
if(toolbar != NULL) { if (toolbar != NULL) {
toolbar->RemoveButton(menu); toolbar->RemoveButton(menu);
} }
} else } else
@@ -4798,10 +4798,10 @@ gui_mch_menu_grey(
int grey) int grey)
{ {
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
if(menu->parent && menu_is_toolbar(menu->parent->name)) { if (menu->parent && menu_is_toolbar(menu->parent->name)) {
if (gui.vimWindow->Lock()) { if (gui.vimWindow->Lock()) {
VimToolbar *toolbar = gui.vimForm->ToolBar(); VimToolbar *toolbar = gui.vimForm->ToolBar();
if(toolbar != NULL) { if (toolbar != NULL) {
toolbar->GrayButton(menu, grey); toolbar->GrayButton(menu, grey);
} }
gui.vimWindow->Unlock(); gui.vimWindow->Unlock();
@@ -4844,7 +4844,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
return; return;
BPoint point; BPoint point;
if(gui.vimWindow->Lock()) { if (gui.vimWindow->Lock()) {
uint32 buttons = 0; uint32 buttons = 0;
gui.vimTextArea->GetMouse(&point, &buttons); gui.vimTextArea->GetMouse(&point, &buttons);
gui.vimTextArea->ConvertToScreen(&point); gui.vimTextArea->ConvertToScreen(&point);
@@ -5028,14 +5028,14 @@ gui_mch_browse(
gui.vimApp->fFilePanelSem = create_sem(0, "FilePanelSem"); gui.vimApp->fFilePanelSem = create_sem(0, "FilePanelSem");
while(acquire_sem(gui.vimApp->fFilePanelSem) == B_INTERRUPTED); while (acquire_sem(gui.vimApp->fFilePanelSem) == B_INTERRUPTED);
char_u *fileName = NULL; char_u *fileName = NULL;
status_t result = gui.vimApp->fBrowsedPath.InitCheck(); status_t result = gui.vimApp->fBrowsedPath.InitCheck();
if(result == B_OK) { if (result == B_OK) {
fileName = vim_strsave((char_u*)gui.vimApp->fBrowsedPath.Path()); fileName = vim_strsave((char_u*)gui.vimApp->fBrowsedPath.Path());
} else } else
if(result != B_NO_INIT) { if (result != B_NO_INIT) {
fprintf(stderr, "gui_mch_browse: BPath error: %#08x (%s)\n", fprintf(stderr, "gui_mch_browse: BPath error: %#08x (%s)\n",
result, strerror(result)); result, strerror(result));
} }
@@ -5108,7 +5108,7 @@ gui_mch_setmouse(int x, int y)
void void
im_set_position(int row, int col) im_set_position(int row, int col)
{ {
if(gui.vimWindow->Lock()) if (gui.vimWindow->Lock())
{ {
gui.vimTextArea->DrawIMString(); gui.vimTextArea->DrawIMString();
gui.vimWindow->Unlock(); gui.vimWindow->Unlock();
@@ -5128,7 +5128,7 @@ gui_mch_show_toolbar(int showit)
gui_mch_set_toolbar_pos(int x, int y, int w, int h) gui_mch_set_toolbar_pos(int x, int y, int w, int h)
{ {
VimToolbar *toolbar = gui.vimForm->ToolBar(); VimToolbar *toolbar = gui.vimForm->ToolBar();
if(toolbar != NULL) { if (toolbar != NULL) {
if (gui.vimWindow->Lock()) { if (gui.vimWindow->Lock()) {
toolbar->MoveTo(x, y); toolbar->MoveTo(x, y);
toolbar->ResizeTo(w - 1, h - 1); toolbar->ResizeTo(w - 1, h - 1);
@@ -5160,7 +5160,7 @@ gui_mch_show_tabline(int showit)
gui_mch_set_tabline_pos(int x, int y, int w, int h) gui_mch_set_tabline_pos(int x, int y, int w, int h)
{ {
VimTabLine *tabLine = gui.vimForm->TabLine(); VimTabLine *tabLine = gui.vimForm->TabLine();
if(tabLine != NULL) { if (tabLine != NULL) {
if (gui.vimWindow->Lock()) { if (gui.vimWindow->Lock()) {
tabLine->MoveTo(x, y); tabLine->MoveTo(x, y);
tabLine->ResizeTo(w - 1, h - 1); tabLine->ResizeTo(w - 1, h - 1);
@@ -5217,7 +5217,7 @@ gui_mch_update_tabline()
while (nr < tabLine->CountTabs()) while (nr < tabLine->CountTabs())
tabLine->RemoveTab(nr); tabLine->RemoveTab(nr);
if(tabLine->Selection() != curtabidx) if (tabLine->Selection() != curtabidx)
tabLine->Select(curtabidx); tabLine->Select(curtabidx);
gui.vimWindow->Unlock(); gui.vimWindow->Unlock();
@@ -5230,12 +5230,12 @@ gui_mch_update_tabline()
gui_mch_set_curtab(int nr) gui_mch_set_curtab(int nr)
{ {
VimTabLine *tabLine = gui.vimForm->TabLine(); VimTabLine *tabLine = gui.vimForm->TabLine();
if(tabLine == NULL) if (tabLine == NULL)
return; return;
gui.vimWindow->Lock(); gui.vimWindow->Lock();
if(tabLine->Selection() != nr -1) if (tabLine->Selection() != nr -1)
tabLine->Select(nr -1); tabLine->Select(nr -1);
gui.vimWindow->Unlock(); gui.vimWindow->Unlock();

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
631,
/**/ /**/
630, 630,
/**/ /**/