Fix vim-7.4 build and cleanup patch for whitespaces

* vim-7.4 recipe and makefile adjusted for building both console and GUI vim binaries;
* patch trailing whitespaces cleanup.

Thanks to Alex von Gluck for initial turning this stuff function.
This commit is contained in:
Siarzhuk Zharski
2013-10-22 20:07:36 +02:00
parent 4a008fe064
commit 2c60e6fe5f
2 changed files with 128 additions and 182 deletions

View File

@@ -1,59 +1,3 @@
diff -Naur vim74/Makefile vim74.haiku/Makefile
--- vim74/Makefile 2013-08-10 14:07:43.062652416 +0200
+++ vim74.haiku/Makefile 2013-09-15 14:01:08.800063488 +0200
@@ -220,6 +220,15 @@
# - Rename the executables to vimos2.exe, xxdos2.exe and teeos2.exe and copy
# them to here.
# - "make os2bin".
+#
+# Haiku OS
+# - Unpack the source archives.
+# - Apply the Haiku patch.
+# - Go to "src" directory and use "make autoconf" to regenerate configure script.
+# - Default "make [install]" will produce GUI version.
+# - To prepare Haiku package use following command:
+# make haiku_package
+# Both gui-less and full versions of vim will be packaged.
VIMVER = vim-$(MAJOR).$(MINOR)
VERSION = $(MAJOR)$(MINOR)
@@ -602,3 +611,36 @@
farsi: dist dist/$(COMMENT_FARSI)
-rm -f dist/farsi$(VERSION).zip
zip -9 -rD -z dist/farsi$(VERSION).zip farsi < dist/$(COMMENT_FARSI)
+
+# Haiku package
+MACHINE=$(shell uname -m)
+ifeq ($(MACHINE), BePC)
+ MACHINE = x86-gcc$(word 1, $(subst -, , $(subst ., , $(shell $(CC) -dumpversion))))
+endif
+DATE = `date +%F`
+PACKAGE_NAME := vim-$(VDOT)-$(MACHINE)-$(DATE)
+COMMENT = .OptionalPackageDescription
+DESCRIPTION = dist/boot/$(COMMENT)
+
+haiku_package: dist
+ -rm -rf dist/boot/
+ ./configure --prefix=/boot/common \
+ --datarootdir=`finddir B_COMMON_DATA_DIRECTORY` \
+ --mandir=`finddir B_COMMON_DOCUMENTATION_DIRECTORY`/man \
+ --with-features=big --with-compiledby="$(COMPILEDBY)" --disable-nls
+ make clean; make install DESTDIR=`pwd`/dist
+ ./configure --prefix=/boot/common \
+ --datarootdir=`finddir B_COMMON_DATA_DIRECTORY` \
+ --mandir=`finddir B_COMMON_DOCUMENTATION_DIRECTORY`/man \
+ --with-features=big --disable-gui --with-compiledby="$(COMPILEDBY)" --disable-nls
+ make clean; make install DESTDIR=`pwd`/dist
+ -mkdir -p dist/boot/common/data/licenses
+ -cp runtime/doc/uganda.txt dist/boot/common/data/licenses/vim
+ ln -s -T vim dist/boot/common/bin/vi
+ echo "Package: Vim" > $(DESCRIPTION)
+ echo "Version: $(VDOT)-$(MACHINE)" >> $(DESCRIPTION)
+ echo "Copyright: Bram Moolenaar et al." >> $(DESCRIPTION)
+ echo "Description: Vi IMproved. Highly configurable text editor." >> $(DESCRIPTION)
+ echo "License: vim" >> $(DESCRIPTION)
+ echo "URL: http://www.vim.org/" >> $(DESCRIPTION)
+ cd dist/boot && zip -9 -r -z -y ../$(PACKAGE_NAME).zip * $(COMMENT) < $(COMMENT)
diff -Naur vim74/runtime/doc/eval.txt vim74.haiku/runtime/doc/eval.txt
--- vim74/runtime/doc/eval.txt 2013-08-10 13:24:53.048234496 +0200
+++ vim74.haiku/runtime/doc/eval.txt 2013-09-08 11:28:37.017825792 +0200
@@ -342,7 +286,7 @@ diff -Naur vim74/runtime/doc/os_haiku.txt vim74.haiku/runtime/doc/os_haiku.txt
+ - Those who contributed, not listed above but not forgotten;
+ - Haiku support by Siarzhuk Zharski <imker@gmx.li> Apr-Mai 2009.
+
+Thank you, all!
+Thank you, all!
+
+
+13. Bugs & things To Do *haiku-bugs*
@@ -467,15 +411,6 @@ diff -Naur vim74/runtime/vimrc_example.vim vim74.haiku/runtime/vimrc_example.vim
diff -Naur vim74/src/configure.in vim74.haiku/src/configure.in
--- vim74/src/configure.in 2013-08-04 20:00:50.049020928 +0200
+++ vim74.haiku/src/configure.in 2013-09-11 21:19:56.428343296 +0200
@@ -79,7 +79,7 @@
OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
-dnl Check for BeOS, which needs an extra source file
+dnl Check for BeOS, which needs an extra source file
AC_MSG_CHECKING(for BeOS)
case `uname` in
BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
@@ -87,6 +87,12 @@
*) BEOS=no; AC_MSG_RESULT(no);;
esac
@@ -603,11 +538,11 @@ diff -Naur vim74/src/feature.h vim74.haiku/src/feature.h
# endif
+/*
+ * +multi_byte_ime Haiku input method support.
+ * +multi_byte_ime Haiku input method support.
+ * Requires +multi_byte.
+ */
+#if defined(FEAT_BIG) && defined(FEAT_GUI_HAIKU) && !defined(FEAT_MBYTE_IME)
+ #define FEAT_MBYTE_IME
+ #define FEAT_MBYTE_IME
+# endif
+
#if defined(FEAT_MBYTE_IME) && !defined(FEAT_MBYTE)
@@ -619,7 +554,7 @@ diff -Naur vim74/src/feature.h vim74.haiku/src/feature.h
&& defined(HAVE_XPM)) \
- || defined(FEAT_GUI_PHOTON))
+ || defined(FEAT_GUI_PHOTON)\
+ || defined(FEAT_GUI_HAIKU))
+ || defined(FEAT_GUI_HAIKU))
# define FEAT_TOOLBAR
#endif
@@ -631,12 +566,13 @@ diff -Naur vim74/src/feature.h vim74.haiku/src/feature.h
|| (defined(FEAT_GUI_MSWIN) && !defined(WIN16) \
&& (!defined(_MSC_VER) || _MSC_VER > 1020)))
# define FEAT_GUI_TABLINE
@@ -793,7 +803,7 @@
@@ -793,7 +803,8 @@
*/
#if defined(FEAT_NORMAL)
# define FEAT_BROWSE_CMD
-# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
+# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_HAIKU) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
+# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \
+ || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_HAIKU) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
# define FEAT_BROWSE
# endif
#endif
@@ -661,7 +597,7 @@ diff -Naur vim74/src/feature.h vim74.haiku/src/feature.h
diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
--- vim74/src/gui_haiku.cc 1970-01-01 01:00:00.000000000 +0100
+++ vim74.haiku/src/gui_haiku.cc 2013-09-15 22:15:47.316145664 +0200
@@ -0,0 +1,5253 @@
@@ -0,0 +1,5252 @@
+/* vi:set ts=8 sts=4 sw=4:
+ *
+ * VIM - Vi IMproved by Bram Moolenaar
@@ -1021,7 +957,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+ VimTabLine(BRect r) : BTabView(r, "vimTabLine", B_WIDTH_FROM_LABEL,
+ B_FOLLOW_LEFT | B_FOLLOW_TOP | B_FOLLOW_RIGHT, B_WILL_DRAW | B_FRAME_EVENTS) {}
+
+
+ float TablineHeight() const;
+ virtual void MouseDown(BPoint point);
+};
@@ -1533,7 +1469,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ {
+ BFilePanel *panel;
+ m->FindPointer("source", (void**)&panel);
+ if(fFilePanelSem != -1 && panel == fFilePanel)
+ if(fFilePanelSem != -1 && panel == fFilePanel)
+ {
+ delete_sem(fFilePanelSem);
+ fFilePanelSem = -1;
@@ -1657,7 +1593,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ menuBar(NULL),
+#ifdef FEAT_TOOLBAR
+ toolBar(NULL),
+#endif
+#endif
+#ifdef FEAT_GUI_TABLINE
+// showingTabLine(false),
+ tabLine(NULL),
@@ -1680,7 +1616,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+#ifdef FEAT_TOOLBAR
+ delete toolBar;
+#endif
+#endif
+
+#ifdef FEAT_GUI_TABLINE
+ delete tabLine;
@@ -1700,18 +1636,18 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ "VimMenuBar");
+
+ AddChild(menuBar);
+
+
+#ifdef FEAT_TOOLBAR
+ toolBar = new VimToolbar(BRect(0,0,0,0), "VimToolBar");
+ toolBar->PrepareButtonBitmaps();
+ AddChild(toolBar);
+#endif
+#endif
+
+#ifdef FEAT_GUI_TABLINE
+ tabLine = new VimTabLine(BRect(0,0,0,0));
+// tabLine->PrepareButtonBitmaps();
+ AddChild(tabLine);
+#endif
+#endif
+
+ BRect remaining = frame;
+ textArea = new VimTextAreaView(remaining);
@@ -1722,18 +1658,18 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+}
+
+#ifdef FEAT_TOOLBAR
+ float
+ float
+VimFormView::ToolbarHeight() const
+{
+ return toolBar ? toolBar->ToolbarHeight() : 0.;
+{
+ return toolBar ? toolBar->ToolbarHeight() : 0.;
+}
+#endif
+
+#ifdef FEAT_GUI_TABLINE
+ float
+ float
+VimFormView::TablineHeight() const
+{
+ return (tabLine && IsShowingTabLine()) ? tabLine->TablineHeight() : 0.;
+ return (tabLine && IsShowingTabLine()) ? tabLine->TablineHeight() : 0.;
+}
+#endif
+
@@ -1766,14 +1702,14 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ toolBar->ResizeTo(remaining.right, ToolbarHeight());
+ remaining.top += ToolbarHeight();
+ gui.toolbar_height = ToolbarHeight();
+#endif
+#endif
+
+#ifdef FEAT_GUI_TABLINE
+ tabLine->MoveTo(remaining.left, remaining.top);
+ tabLine->ResizeTo(remaining.right + 1, TablineHeight());
+ remaining.top += TablineHeight();
+ gui.tabline_height = TablineHeight();
+#endif
+#endif
+
+ textArea->ResizeTo(remaining.Width(), remaining.Height());
+ textArea->MoveTo(remaining.left, remaining.top);
@@ -2310,7 +2246,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ msg.AddFloat("be:height_reply", FILL_Y(1));
+ IMData.messenger->SendMessage(&msg);
+ }
+ break;
+ break;
+ case B_INPUT_METHOD_STOPPED:
+ delete IMData.messenger;
+ delete IMData.message;
@@ -2561,7 +2497,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ IMData.row + IMData.count, W_WIDTH(curwin), GUI_MON_NOCLEAR);
+ bool confirmed = false;
+ msg->FindBool("be:confirmed", &confirmed);
+ if (confirmed)
+ if (confirmed)
+ return;
+ rgb_color hcolor = HighColor(), lcolor = LowColor();
+ msg->FindString("be:string", &str);
@@ -2750,13 +2686,13 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+const unsigned int kVimDialogSpacingY = 10;
+const unsigned int kVimDialogMinimalWidth = 310;
+const unsigned int kVimDialogMinimalHeight = 75;
+const BRect kDefaultRect =
+BRect(0, 0, kVimDialogMinimalWidth, kVimDialogMinimalHeight);
+const BRect kDefaultRect =
+BRect(0, 0, kVimDialogMinimalWidth, kVimDialogMinimalHeight);
+
+VimDialog::VimDialog(int type, const char *title, const char *message,
+ const char *buttons, int dfltbutton, const char *textfield, int ex_cmd)
+: BWindow(kDefaultRect, title, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
+ B_NOT_CLOSABLE | B_NOT_RESIZABLE |
+: BWindow(kDefaultRect, title, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
+ B_NOT_CLOSABLE | B_NOT_RESIZABLE |
+ B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS)
+ , fDialogSem(-1)
+ , fDialogValue(dfltbutton)
@@ -2805,21 +2741,21 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ strButtons.Remove(0, end + 1);
+ } while(true);
+
+ int32 buttonsCount = fButtonsList.CountItems();
+ int32 buttonsCount = fButtonsList.CountItems();
+ buttonsWidth += kVimDialogButtonsSpacingX * (buttonsCount - 1);
+ buttonsHeight += kVimDialogButtonsSpacingY * (buttonsCount - 1);
+ float dialogWidth = buttonsWidth + kVimDialogIconStripeWidth +
+ float dialogWidth = buttonsWidth + kVimDialogIconStripeWidth +
+ kVimDialogSpacingX * 2;
+ float dialogHeight = maxButtonHeight + kVimDialogSpacingY * 3;
+ float dialogHeight = maxButtonHeight + kVimDialogSpacingY * 3;
+
+ /* Check 'v' flag in 'guioptions': vertical button placement. */
+ bool vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL) ||
+ dialogWidth >= gui.vimWindow->Bounds().Width();
+ if(vertical) {
+ dialogWidth -= buttonsWidth;
+ dialogWidth -= buttonsWidth;
+ dialogWidth += maxButtonWidth;
+ dialogHeight -= maxButtonHeight;
+ dialogHeight += buttonsHeight;
+ dialogHeight -= maxButtonHeight;
+ dialogHeight += buttonsHeight;
+ }
+
+ dialogWidth = max_c(dialogWidth, kVimDialogMinimalWidth);
@@ -2854,9 +2790,9 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ rect.bottom += messageHeight + kVimDialogSpacingY;
+ fInputControl = new BTextControl(rect, "_iv_", NULL, fInputValue, NULL,
+ B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE | B_PULSE_NEEDED);
+ fInputControl->TextView()->SetText(fInputValue);
+ fInputControl->TextView()->SetText(fInputValue);
+ fInputControl->TextView()->SetWordWrap(false);
+ AddChild(fInputControl);
+ AddChild(fInputControl);
+
+ float width = 0.f, height = 0.f;
+ fInputControl->GetPreferredSize(&width, &height);
@@ -2871,7 +2807,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ MoveTo((gui.vimWindow->Bounds().Width() - dialogWidth) / 2,
+ (gui.vimWindow->Bounds().Height() - dialogHeight) / 2);
+
+ // adjust layout of buttons
+ // adjust layout of buttons
+ float buttonWidth = max_c(maxButtonWidth, rect.Width() * 0.66);
+ BPoint origin(dialogWidth, dialogHeight);
+ origin.x -= kVimDialogSpacingX + (vertical ? buttonWidth : buttonsWidth);
@@ -2897,7 +2833,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+{
+ if(fDialogSem > B_OK)
+ delete_sem(fDialogSem);
+}
+}
+
+ int
+VimDialog::Go()
@@ -2920,13 +2856,13 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ Quit();
+
+ return retValue;
+}
+}
+
+void VimDialog::MessageReceived(BMessage *msg)
+{
+ int32 which = 0;
+ if(msg->what != kVimDialogButtonMsg ||
+ msg->FindInt32("which", &which) != B_OK)
+ msg->FindInt32("which", &which) != B_OK)
+ return BWindow::MessageReceived(msg);
+
+ fDialogValue = which;
@@ -2946,7 +2882,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ BButton* button = new BButton(rect, name.String(), label, message,
+ B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
+
+ float width = 0.f, height = 0.f;
+ float width = 0.f, height = 0.f;
+ button->GetPreferredSize(&width, &height);
+ button->ResizeTo(width, height);
+
@@ -2996,14 +2932,14 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+ BFile file(path.Path(), O_RDONLY);
+ if(file.InitCheck() != B_OK) {
+ fprintf(stderr, "App file assignment failed:%s\n",
+ fprintf(stderr, "App file assignment failed:%s\n",
+ strerror(file.InitCheck()));
+ return;
+ }
+
+ BResources resources(&file);
+ 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()));
+ return;
+ }
@@ -3020,13 +2956,13 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ int32 iconSize = 32;
+ fIconBitmap = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32);
+ 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()));
+ return;
+ }
+
+ size_t size = 0;
+ const uint8* iconData = NULL;
+ const uint8* iconData = NULL;
+ // try vector icon first?
+ iconData = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, name, &size);
+ if(iconData != NULL && BIconUtils::GetVectorIcon(iconData, size, fIconBitmap) == B_OK)
@@ -3035,7 +2971,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ // try bitmap icon now
+ iconData = (const uint8*)resources.LoadResource(B_LARGE_ICON_TYPE, name, &size);
+ if(iconData == NULL) {
+ fprintf(stderr, "Bitmap icon resource not found\n");
+ fprintf(stderr, "Bitmap icon resource not found\n");
+ delete fIconBitmap;
+ fIconBitmap = NULL;
+ return;
@@ -3053,8 +2989,8 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+const unsigned int kVimDialogSizeSelectMsg = 'MSSZ';
+
+VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, float* size)
+: BWindow(kDefaultRect, "Font Selection", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
+ B_NOT_CLOSABLE | B_NOT_RESIZABLE |
+: BWindow(kDefaultRect, "Font Selection", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
+ B_NOT_CLOSABLE | B_NOT_RESIZABLE |
+ B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS)
+ , fStatus(B_NO_INIT)
+ , fDialogSem(-1)
@@ -3071,7 +3007,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+{
+ strncpy(fFontFamily, *family, B_FONT_FAMILY_LENGTH);
+ strncpy(fFontStyle, *style, B_FONT_STYLE_LENGTH);
+
+
+ // "client" area view
+ BBox *clientBox = new BBox(Bounds(), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
+ B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_PULSE_NEEDED,
@@ -3125,13 +3061,13 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ BScrollView *scrollSizes = new BScrollView("scrollSize",
+ fSizesList, B_FOLLOW_LEFT_RIGHT, 0, false, true);
+ clientBox->AddChild(scrollSizes);
+
+ BButton *buttonOK = new BButton(rc, "buttonOK", "OK",
+
+ BButton *buttonOK = new BButton(rc, "buttonOK", "OK",
+ new BMessage(kVimDialogOKButtonMsg));
+ clientBox->AddChild(buttonOK);
+ buttonOK->ResizeToPreferred();
+
+ BButton *buttonCancel = new BButton(rc, "buttonCancel", "Cancel",
+ BButton *buttonCancel = new BButton(rc, "buttonCancel", "Cancel",
+ new BMessage(kVimDialogCancelButtonMsg));
+ clientBox->AddChild(buttonCancel);
+ buttonCancel->ResizeToPreferred();
@@ -3228,7 +3164,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ fStylesList->SetSelectionMessage(new BMessage(kVimDialogStyleSelectMsg));
+ fSizesList->SetSelectionMessage(new BMessage(kVimDialogSizeSelectMsg));
+ fSizesInput->SetModificationMessage(new BMessage(kVimDialogSizeInputMsg));
+
+
+ _UpdateSizeInputPreview();
+ _UpdateFontPreview();
+
@@ -3243,14 +3179,14 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+ if (fDialogSem > B_OK)
+ delete_sem(fDialogSem);
+}
+}
+
+ void
+VimSelectFontDialog::_CleanList(BListView* list)
+{
+ while(0 < list->CountItems())
+ delete (dynamic_cast<BStringItem*>(list->RemoveItem((int32)0)));
+}
+}
+
+ bool
+VimSelectFontDialog::Go()
@@ -3271,12 +3207,12 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ while(acquire_sem(fDialogSem) == B_INTERRUPTED);
+
+ bool retValue = fDialogValue;
+
+
+ if(Lock())
+ Quit();
+
+ return retValue;
+}
+}
+
+
+void VimSelectFontDialog::_UpdateFontStyles()
@@ -3294,7 +3230,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ selIndex = i;
+ }
+ }
+
+
+ if (selIndex >= 0) {
+ fStylesList->Select(selIndex);
+ fStylesList->ScrollToSelection();
@@ -3409,7 +3345,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+// some forward declaration required by toolbar functions...
+static BMessage * MenuMessage(vimmenu_T *menu);
+
+VimToolbar::VimToolbar(BRect frame, const char *name) :
+VimToolbar::VimToolbar(BRect frame, const char *name) :
+ BBox(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER)
+{
+}
@@ -3418,7 +3354,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+{
+ int32 count = fButtonsList.CountItems();
+ for(int32 i = 0; i < count; i++)
+ delete (BPictureButton*)fButtonsList.ItemAt(i);
+ delete (BPictureButton*)fButtonsList.ItemAt(i);
+ fButtonsList.MakeEmpty();
+
+ delete normalButtonsBitmap;
@@ -3431,11 +3367,11 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+VimToolbar::AttachedToWindow()
+{
+ BBox::AttachedToWindow();
+
+
+ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+}
+
+ float
+
+ float
+VimToolbar::ToolbarHeight() const
+{
+ float size = NULL == normalButtonsBitmap ? 18. : normalButtonsBitmap->Bounds().Height();
@@ -3459,7 +3395,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ return true;
+}
+
+ bool
+ bool
+VimToolbar::PrepareButtonBitmaps()
+{
+ // first try to load potentially customized $VIRUNTIME/bitmaps/builtin-tools.png
@@ -3477,7 +3413,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ grayedButtonsBitmap = new BBitmap(&archive);
+ if(grayedButtonsBitmap == NULL)
+ return false;
+
+
+ // modify grayed bitmap
+ ModifyBitmapToGrayed(grayedButtonsBitmap);
+
@@ -3487,7 +3423,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+BBitmap *VimToolbar::LoadVimBitmap(const char* fileName)
+{
+ BBitmap *bitmap = NULL;
+
+
+ int mustfree = 0;
+ char_u* runtimePath = vim_getenv((char_u*)"VIMRUNTIME", &mustfree);
+ if(runtimePath != NULL && fileName != NULL) {
@@ -3506,7 +3442,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+VimToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed)
+{
+ float size = bitmapFrom->Bounds().Height() + 1.;
+
+
+ BView view(BRect(0, 0, size, size), "", 0, 0);
+
+ AddChild(&view);
@@ -3542,12 +3478,12 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ return true;
+}
+
+ bool
+ bool
+VimToolbar::AddButton(int32 index, vimmenu_T *menu)
+{
+ BPictureButton *button = NULL;
+ if(!menu_is_separator(menu->name)) {
+ float size = normalButtonsBitmap ?
+ float size = normalButtonsBitmap ?
+ normalButtonsBitmap->Bounds().Height() + 1. + ButtonMargin * 2 : 18.;
+ BRect frame(0, 0, size, size);
+ BPicture pictureOn;
@@ -3582,16 +3518,16 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ delete bitmap;
+ }
+
+ button = new BPictureButton(frame, (char*)menu->name,
+ button = new BPictureButton(frame, (char*)menu->name,
+ &pictureOff, &pictureOn, MenuMessage(menu));
+
+
+ button->SetDisabledOn(&pictureGray);
+ button->SetDisabledOff(&pictureGray);
+
+ button->SetTarget(gui.vimTextArea);
+
+ AddChild(button);
+
+
+ menu->button = button;
+ }
+
@@ -3600,7 +3536,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ return result;
+}
+
+ bool
+ bool
+VimToolbar::RemoveButton(vimmenu_T *menu)
+{
+ if(menu->button) {
@@ -3611,7 +3547,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ }
+}
+
+ bool
+ bool
+VimToolbar::GrayButton(vimmenu_T *menu, int grey)
+{
+ if(menu->button) {
@@ -3621,7 +3557,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ }
+}
+
+ void
+ void
+VimToolbar::InvalidateLayout()
+{
+ int32 offset = ToolbarMargin;
@@ -3640,7 +3576,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+#if defined(FEAT_GUI_TABLINE)
+
+ float
+ float
+VimTabLine::TablineHeight() const
+{
+// float size = NULL == normalButtonsBitmap ? 18. : normalButtonsBitmap->Bounds().Height();
@@ -3678,12 +3614,12 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ event = TABLINE_MENU_NEW;
+
+ else if (buttons & B_TERTIARY_MOUSE_BUTTON)
+ // middle button click - close the pointed tab
+ // middle button click - close the pointed tab
+ // or create new one in case empty space
+ event = index > 0 ? TABLINE_MENU_CLOSE : TABLINE_MENU_NEW;
+
+ else if (buttons & B_SECONDARY_MOUSE_BUTTON) {
+ // right button click - show context menu
+ // right button click - show context menu
+ BPopUpMenu* popUpMenu = new BPopUpMenu("tabLineContextMenu", false, false);
+ popUpMenu->AddItem(new BMenuItem(_("Close tabi R"), new BMessage(TABLINE_MENU_CLOSE)));
+ popUpMenu->AddItem(new BMenuItem(_("New tab T"), new BMessage(TABLINE_MENU_NEW)));
@@ -3724,7 +3660,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ for (; i < tabLine->CountTabs(); i++)
+ if(this == tabLine->TabAt(i))
+ break;
+
+
+// printf("%d:%d:%s\n", i, tabLine->CountTabs(), tabLine->TabAt(i)->Label());
+ if(i < tabLine->CountTabs()) {
+ VimTablineMsg tm;
@@ -4491,7 +4427,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ VimSelectFontDialog *dialog = new VimSelectFontDialog(family, style, size);
+ return dialog->Go();
+#else
+ return NOFONT;
+ return NOFONT;
+#endif /* FEAT_GUI_DIALOG */
+}
+
@@ -4502,7 +4438,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ int giveErrorIfMissing)
+{
+ static VimFont *fontList = NULL;
+
+
+ if (!gui.in_use) // can't do this when GUI not running
+ return NOFONT;
+
@@ -4568,7 +4504,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ *new_p_guifont = '_';
+ }
+ }
+
+
+ VimFont *flp;
+ for (flp = fontList; flp; flp = flp->next) {
+ if (STRCMP(font_name, flp->name) == 0) {
@@ -4579,7 +4515,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+
+ VimFont *font = new VimFont();
+ font->name = vim_strsave((char_u*)font_name);
+
+
+ if(count_font_styles(family) <= 0) {
+ if (giveErrorIfMissing)
+ EMSG2("(fe0) Specified font %s is not found", font->name);
@@ -4592,7 +4528,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ fontList = font;
+
+ font->SetFamilyAndStyle(family, style);
+ if(size > 0.f)
+ if(size > 0.f)
+ font->SetSize(size);
+
+ font->SetSpacing(B_FIXED_SPACING);
@@ -4784,7 +4720,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ {"Purple", RGB(0xA0, 0x20, 0xF0)},
+ {"SlateBlue", RGB(0x6A, 0x5A, 0xCD)},
+ {"Violet", RGB(0xEE, 0x82, 0xEE)},
+ // NOTE: some entries are zero-allocated for NDDYNAMIC_COLORS
+ // NOTE: some entries are zero-allocated for NDDYNAMIC_COLORS
+ // in this table!
+ };
+
@@ -4860,7 +4796,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ */
+ guicolor_T gcolour = RGB(r,g,b);
+
+ //NOTE: see note above in table allocation! We are working here with
+ //NOTE: see note above in table allocation! We are working here with
+ // dynamically allocated names, not constant ones!
+ vim_free((char*)table[newColour].name);
+ table[newColour].name = (char *)vim_strsave((char_u *)colour);
@@ -5363,15 +5299,15 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ if (gui.vimWindow->Lock())
+ {
+#ifdef FEAT_TOOLBAR
+ if(menu_is_toolbar(parent->name)) {
+ if(menu_is_toolbar(parent->name)) {
+ VimToolbar *toolbar = gui.vimForm->ToolBar();
+ if(toolbar != NULL) {
+ toolbar->AddButton(idx, menu);
+ }
+ } else
+#endif
+#endif
+
+ if (parent->submenu_id != NULL || menu_is_popup(parent->name)) {
+ if (parent->submenu_id != NULL || menu_is_popup(parent->name)) {
+ if (menu_is_separator(menu->name)) {
+ BSeparatorItem *item = new BSeparatorItem();
+ parent->submenu_id->AddItem(item);
@@ -5667,10 +5603,10 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ char_u *initdir,
+ char_u *filter)
+{
+ gui.vimApp->fFilePanel = new BFilePanel((saving == TRUE) ? B_SAVE_PANEL : B_OPEN_PANEL,
+ NULL, NULL, 0, false,
+ gui.vimApp->fFilePanel = new BFilePanel((saving == TRUE) ? B_SAVE_PANEL : B_OPEN_PANEL,
+ NULL, NULL, 0, false,
+ new BMessage((saving == TRUE) ? 'save' : 'open'), NULL, true);
+
+
+ gui.vimApp->fBrowsedPath.Unset();
+
+ gui.vimApp->fFilePanel->Window()->SetTitle((char*)title);
@@ -5688,7 +5624,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ fileName = vim_strsave((char_u*)gui.vimApp->fBrowsedPath.Path());
+ } else
+ 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));
+ }
+
@@ -5729,7 +5665,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ char_u *textfield,
+ int ex_cmd)
+{
+ VimDialog *dialog = new VimDialog(type, (char*)title, (char*)message,
+ VimDialog *dialog = new VimDialog(type, (char*)title, (char*)message,
+ (char*)buttons, dfltbutton, (char*)textfield, ex_cmd);
+ return dialog->Go();
+}
@@ -5781,7 +5717,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ return;
+}
+
+ int
+ int
+im_get_status()
+{
+ //TODO:
@@ -5796,7 +5732,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ gui.toolbar_height = (toolbar && showit) ? toolbar->ToolbarHeight() : 0.;
+}
+
+ void
+ void
+gui_mch_set_toolbar_pos(int x, int y, int w, int h)
+{
+ VimToolbar *toolbar = gui.vimForm->ToolBar();
@@ -5828,7 +5764,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ }
+}
+
+ void
+ void
+gui_mch_set_tabline_pos(int x, int y, int w, int h)
+{
+ VimTabLine *tabLine = gui.vimForm->TabLine();
@@ -5879,7 +5815,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ tab = new VimTabLine::VimTab();
+ tabLine->AddTab(NULL, tab);
+ }
+
+
+ get_tabline_label(tp, FALSE);
+ tab->SetLabel((const char*)NameBuff);
+ tabLine->Invalidate();
@@ -5888,7 +5824,7 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ /* Remove any old labels. */
+ while (nr < tabLine->CountTabs())
+ tabLine->RemoveTab(nr);
+
+
+ if(tabLine->Selection() != curtabidx)
+ tabLine->Select(curtabidx);
+
@@ -5906,15 +5842,14 @@ diff -Naur vim74/src/gui_haiku.cc vim74.haiku/src/gui_haiku.cc
+ return;
+
+ gui.vimWindow->Lock();
+
+
+ if(tabLine->Selection() != nr -1)
+ tabLine->Select(nr -1);
+
+
+ gui.vimWindow->Unlock();
+}
+
+#endif //FEAT_GUI_TABLINE
+
diff -Naur vim74/src/gui_haiku.h vim74.haiku/src/gui_haiku.h
--- vim74/src/gui_haiku.h 1970-01-01 01:00:00.000000000 +0100
+++ vim74.haiku/src/gui_haiku.h 2013-09-08 11:04:33.028311552 +0200
@@ -5991,7 +5926,7 @@ diff -Naur vim74/src/gui.c vim74.haiku/src/gui.c
if (vim_strchr(p_go, GO_TOOLBAR) != NULL)
{
-# ifdef FEAT_GUI_ATHENA
+# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_HAIKU)
+# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_HAIKU)
gui_mch_set_toolbar_pos(0, text_area_y,
gui.menu_width, gui.toolbar_height);
# endif
@@ -6160,7 +6095,7 @@ diff -Naur vim74/src/Makefile vim74.haiku/src/Makefile
+HAIKUGUI_LIBS2 =
+HAIKUGUI_INSTALL = install_normal install_haiku_extra
+HAIKUGUI_TARGETS = installglinks_haiku
+HAIKUGUI_MAN_TARGETS =
+HAIKUGUI_MAN_TARGETS =
+HAIKUGUI_TESTTARGET = gui
+HAIKUGUI_BUNDLE =
+
@@ -6187,7 +6122,7 @@ diff -Naur vim74/src/Makefile vim74.haiku/src/Makefile
objects/os_qnx.o: os_qnx.c
$(CCC) -o $@ os_qnx.c
@@ -2828,6 +2851,56 @@
@@ -2828,6 +2851,62 @@
###############################################################################
@@ -6201,11 +6136,11 @@ diff -Naur vim74/src/Makefile vim74.haiku/src/Makefile
+### - update system MIME database with info about vim application.
+###
+install_haiku_extra: $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc
+ xres -o $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc
+ xres -o $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc
+ $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(DEST_RT)
+ mimeset $(DEST_BIN)/$(VIMTARGET)
+
+###
+###
+### List of g*-links that should be replaced with shell script equivalents.
+### This solves the problem of them from Tracker.
+###
@@ -6214,12 +6149,13 @@ diff -Naur vim74/src/Makefile vim74.haiku/src/Makefile
+ $(DEST_BIN)/$(GVIMDIFFTARGET) \
+ $(DEST_BIN)/$(RGVIMTARGET) \
+ $(DEST_BIN)/$(RGVIEWTARGET)
+###
+###
+### This rule:
+### - Replace gvim link with copy of vim binary.
+### - Replace g*-links with shell script equivalents to solve the problem
+### - Replace gvim link with copy of vim binary.
+### - Replace g*-links with shell script equivalents to solve the problem
+### of calling them from Tracker,
+### - Add icon resources to mentioned g*-link shell scripts.
+### - Add icon resources to mentioned g*-link shell scripts
+### - in case gui-less vim.con executable available use it.
+###
+installglinks_haiku: $(HAIKU_GLINKS) install_haiku_extra
+ @catattr -r "BEOS:ICON" $(DEST_BIN)/$(GVIMTARGET) > ~icon.attr
@@ -6227,13 +6163,18 @@ diff -Naur vim74/src/Makefile vim74.haiku/src/Makefile
+ rm $$i ; \
+ echo "#!/bin/sh" > $$i ; \
+ case $$i in \
+ $(DEST_BIN)/$(GVIMTARGET)) cp $(DEST_BIN)/$(VIMTARGET) $$i;; \
+ $(DEST_BIN)/$(GVIMTARGET)) \
+ cp $(DEST_BIN)/$(VIMTARGET) $$i ; \
+ if [ -f $(VIMTARGET).con ] ; then \
+ $(STRIP) $(VIMTARGET).con ; \
+ mv $(VIMTARGET).con $(DEST_BIN)/$(VIMTARGET) ; \
+ fi ;; \
+ $(DEST_BIN)/$(GVIEWTARGET)) printf "%s -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \
+ $(DEST_BIN)/$(GVIMDIFFTARGET)) printf "%s -d %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \
+ $(DEST_BIN)/$(RGVIMTARGET)) printf "%s -Z %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \
+ $(DEST_BIN)/$(RGVIEWTARGET)) printf "%s -Z -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \
+ *) printf "%s %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \
+ esac ; \
+ esac ; \
+ chmod $(BINMOD) $$i ; \
+ addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $$i ; \
+ done
@@ -6267,10 +6208,10 @@ diff -Naur vim74/src/misc1.c vim74.haiku/src/misc1.c
+ // special handling for user settings directory...
+ if(STRCMP(name, "BE_USER_SETTINGS") == 0) {
+ static char userSettingsPath[MAXPATHL] = {0};
+ if(B_OK == find_directory(B_USER_SETTINGS_DIRECTORY, 0,
+ false, userSettingsPath, MAXPATHL))
+ if(B_OK == find_directory(B_USER_SETTINGS_DIRECTORY, 0,
+ false, userSettingsPath, MAXPATHL))
+ return userSettingsPath;
+ } else
+ } else
+#endif
+ return NULL;

View File

@@ -18,7 +18,7 @@ COPYRIGHT="Bram Moleenar et al."
LICENSE="Vim"
REVISION="1"
CHECKSUM_MD5="607e135c559be642f210094ad023dc65"
ARCHITECTURES="x86_gcc2 x86"
ARCHITECTURES="x86_gcc2 x86 x86_64"
PROVIDES="
vim = $portVersion
@@ -42,6 +42,7 @@ REQUIRES="
"
BUILD_REQUIRES="
ncurses_devel
gettext
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
@@ -59,7 +60,11 @@ BUILD()
{
cd src
autoconf
runConfigure ./configure --with-features=big
runConfigure ./configure --disable-gui --with-features=big --with-compiledby=$packager
make $jobArgs
cp vim vim.con # preserve gui-less executable
rm objects/*.o
runConfigure ./configure --with-features=big --with-compiledby=$packager
make $jobArgs
}