mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 11:40:06 +02:00
- implemented support for GUI tabline.
This commit is contained in:
@@ -336,7 +336,15 @@ diff -Naur vim73/src/feature.h vim73.haiku/src/feature.h
|
||||
# define FEAT_TOOLBAR
|
||||
#endif
|
||||
|
||||
@@ -795,7 +804,7 @@
|
||||
@@ -784,6 +793,7 @@
|
||||
&& (defined(FEAT_GUI_GTK) \
|
||||
|| (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \
|
||||
|| defined(FEAT_GUI_MAC) \
|
||||
+ || defined(FEAT_GUI_BEOS) \
|
||||
|| (defined(FEAT_GUI_MSWIN) && !defined(WIN16) \
|
||||
&& (!defined(_MSC_VER) || _MSC_VER > 1020)))
|
||||
# define FEAT_GUI_TABLINE
|
||||
@@ -795,7 +805,7 @@
|
||||
*/
|
||||
#if defined(FEAT_NORMAL)
|
||||
# define FEAT_BROWSE_CMD
|
||||
@@ -345,7 +353,7 @@ diff -Naur vim73/src/feature.h vim73.haiku/src/feature.h
|
||||
# define FEAT_BROWSE
|
||||
# endif
|
||||
#endif
|
||||
@@ -810,6 +819,7 @@
|
||||
@@ -810,6 +820,7 @@
|
||||
&& defined(HAVE_X11_XPM_H)) \
|
||||
|| defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_PHOTON) \
|
||||
@@ -353,7 +361,7 @@ diff -Naur vim73/src/feature.h vim73.haiku/src/feature.h
|
||||
|| defined(FEAT_GUI_MSWIN) \
|
||||
|| defined(FEAT_GUI_MAC)
|
||||
# define FEAT_CON_DIALOG
|
||||
@@ -827,7 +837,8 @@
|
||||
@@ -827,7 +838,8 @@
|
||||
#if defined(FEAT_GUI_DIALOG) && \
|
||||
(defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \
|
||||
|| defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) \
|
||||
@@ -397,7 +405,30 @@ diff -Naur vim73/src/gui.c vim73.haiku/src/gui.c
|
||||
gui_mch_set_toolbar_pos(0, text_area_y,
|
||||
gui.menu_width, gui.toolbar_height);
|
||||
# endif
|
||||
@@ -1292,7 +1292,11 @@
|
||||
@@ -1178,6 +1178,13 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+# if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_BEOS))
|
||||
+ gui_mch_set_tabline_pos(0, text_area_y,
|
||||
+ gui.menu_width, gui.tabline_height);
|
||||
+ if (gui_has_tabline())
|
||||
+ text_area_y += gui.tabline_height;
|
||||
+#endif
|
||||
+
|
||||
text_area_width = gui.num_cols * gui.char_width + gui.border_offset * 2;
|
||||
text_area_height = gui.num_rows * gui.char_height + gui.border_offset * 2;
|
||||
|
||||
@@ -1249,7 +1256,7 @@
|
||||
# endif
|
||||
# endif
|
||||
# if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) \
|
||||
- || defined(FEAT_GUI_MOTIF))
|
||||
+ || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_BEOS))
|
||||
if (gui_has_tabline())
|
||||
base_height += gui.tabline_height;
|
||||
# endif
|
||||
@@ -1292,7 +1299,11 @@
|
||||
again:
|
||||
busy = TRUE;
|
||||
|
||||
@@ -410,7 +441,7 @@ diff -Naur vim73/src/gui.c vim73.haiku/src/gui.c
|
||||
out_flush();
|
||||
|
||||
gui.num_cols = (pixel_width - gui_get_base_width()) / gui.char_width;
|
||||
@@ -1314,7 +1318,11 @@
|
||||
@@ -1314,7 +1325,11 @@
|
||||
|| gui.num_rows != Rows || gui.num_cols != Columns)
|
||||
shell_resized();
|
||||
|
||||
@@ -423,7 +454,7 @@ diff -Naur vim73/src/gui.c vim73.haiku/src/gui.c
|
||||
gui_update_cursor(FALSE, TRUE);
|
||||
#if defined(FEAT_XIM) && !defined(FEAT_GUI_GTK)
|
||||
xim_set_status_area();
|
||||
@@ -4055,9 +4063,9 @@
|
||||
@@ -4055,9 +4070,9 @@
|
||||
y += gui.menu_height;
|
||||
#endif
|
||||
|
||||
@@ -435,7 +466,17 @@ diff -Naur vim73/src/gui.c vim73.haiku/src/gui.c
|
||||
y += gui.toolbar_height;
|
||||
# else
|
||||
# ifdef FEAT_GUI_MSWIN
|
||||
@@ -4811,7 +4819,8 @@
|
||||
@@ -4066,7 +4081,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
-#if defined(FEAT_GUI_TABLINE) && defined(FEAT_GUI_MSWIN)
|
||||
+ //XXX
|
||||
+#if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_BEOS))
|
||||
if (gui_has_tabline())
|
||||
y += gui.tabline_height;
|
||||
#endif
|
||||
@@ -4811,7 +4827,8 @@
|
||||
}
|
||||
|
||||
#if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \
|
||||
@@ -478,6 +519,15 @@ diff -Naur vim73/src/gui.h vim73.haiku/src/gui.h
|
||||
#ifdef FEAT_GUI_MAC
|
||||
ControlHandle id; /* A handle to the scrollbar */
|
||||
#endif
|
||||
@@ -412,7 +419,7 @@
|
||||
|
||||
#if defined(FEAT_GUI_TABLINE) \
|
||||
&& (defined(FEAT_GUI_W32) || defined(FEAT_GUI_MOTIF) \
|
||||
- || defined(FEAT_GUI_MAC))
|
||||
+ || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_BEOS))
|
||||
int tabline_height;
|
||||
#endif
|
||||
|
||||
@@ -421,7 +428,7 @@
|
||||
#endif
|
||||
|
||||
@@ -505,7 +555,7 @@ diff -Naur vim73/src/gui.h vim73.haiku/src/gui.h
|
||||
diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
--- vim73/src/gui_beos.cc 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ vim73.haiku/src/gui_beos.cc 2010-08-20 23:43:35.727711744 +0000
|
||||
@@ -0,0 +1,4574 @@
|
||||
@@ -0,0 +1,4868 @@
|
||||
+/* vi:set ts=8 sts=4 sw=4:
|
||||
+ *
|
||||
+ * VIM - Vi IMproved by Bram Moolenaar
|
||||
@@ -577,6 +627,7 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ * This locking protocol consists of locking Vim's window. This is both
|
||||
+ * convenient and necessary.
|
||||
+ */
|
||||
+
|
||||
+extern "C" {
|
||||
+
|
||||
+#include <float.h>
|
||||
@@ -598,8 +649,10 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+#include <be/interface/View.h>
|
||||
+#include <be/interface/Window.h>
|
||||
+#include <be/interface/Box.h>
|
||||
+#include <be/interface/TabView.h>
|
||||
+#include <be/interface/MenuBar.h>
|
||||
+#include <be/interface/MenuItem.h>
|
||||
+#include <be/interface/PopUpMenu.h>
|
||||
+#include <be/interface/ScrollBar.h>
|
||||
+#include <be/interface/Region.h>
|
||||
+#include <be/interface/Screen.h>
|
||||
@@ -635,6 +688,7 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+class VimTextAreaView;
|
||||
+class VimWindow;
|
||||
+class VimToolbar;
|
||||
+class VimTabLine;
|
||||
+
|
||||
+extern key_map *keyMap;
|
||||
+extern char *keyMapChars;
|
||||
@@ -727,6 +781,16 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ VimToolbar *toolBar;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+ public:
|
||||
+ VimTabLine *TabLine() const { return tabLine; }
|
||||
+ bool IsShowingTabLine() const { return showingTabLine; }
|
||||
+ void SetShowingTabLine(bool showing) { showingTabLine = showing; }
|
||||
+ float TablineHeight() const;
|
||||
+ private:
|
||||
+ VimTabLine *tabLine;
|
||||
+ int showingTabLine;
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+class VimTextAreaView: public BView
|
||||
@@ -835,14 +899,31 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+
|
||||
+const float ToolbarMargin = 3.;
|
||||
+const float ButtonMargin = 3.;
|
||||
+/*
|
||||
+class VimToolbarButton : public BPictureButton
|
||||
+{
|
||||
+
|
||||
+};
|
||||
+*/
|
||||
+#endif /*FEAT_TOOLBAR*/
|
||||
+
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+
|
||||
+class VimTabLine : public BTabView
|
||||
+{
|
||||
+ public:
|
||||
+ class VimTab : public BTab {
|
||||
+ public:
|
||||
+ VimTab() : BTab(new BView(BRect(), "-Empty-", 0, 0)) {}
|
||||
+
|
||||
+ virtual void Select(BView* owner);
|
||||
+ };
|
||||
+
|
||||
+ 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);
|
||||
+};
|
||||
+
|
||||
+#endif //FEAT_GUI_TABLINE
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * For caching the fonts that are used;
|
||||
+ * Vim seems rather sloppy in this regard.
|
||||
@@ -971,9 +1052,18 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ bool changedir;
|
||||
+};
|
||||
+
|
||||
+struct VimTablineMsg {
|
||||
+ int index;
|
||||
+};
|
||||
+
|
||||
+struct VimTablineMenuMsg {
|
||||
+ int index;
|
||||
+ int event;
|
||||
+};
|
||||
+
|
||||
+struct VimMsg {
|
||||
+ enum VimMsgType {
|
||||
+ Key, Resize, ScrollBar, Menu, Mouse, MouseMoved, Focus, Refs
|
||||
+ Key, Resize, ScrollBar, Menu, Mouse, MouseMoved, Focus, Refs, Tabline, TablineMenu
|
||||
+ };
|
||||
+
|
||||
+ union {
|
||||
@@ -985,6 +1075,8 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ struct VimMouseMovedMsg MouseMoved;
|
||||
+ struct VimFocusMsg Focus;
|
||||
+ struct VimRefsMsg Refs;
|
||||
+ struct VimTablineMsg Tabline;
|
||||
+ struct VimTablineMenuMsg TablineMenu;
|
||||
+ } u;
|
||||
+};
|
||||
+
|
||||
@@ -1424,6 +1516,10 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+#ifdef FEAT_TOOLBAR
|
||||
+ toolBar(NULL),
|
||||
+#endif
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+// showingTabLine(false),
|
||||
+ tabLine(NULL),
|
||||
+#endif
|
||||
+ textArea(NULL)
|
||||
+{
|
||||
+ init(frame);
|
||||
@@ -1444,6 +1540,10 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ delete toolBar;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+ delete tabLine;
|
||||
+#endif
|
||||
+
|
||||
+ if (textArea) {
|
||||
+ RemoveChild(textArea);
|
||||
+ delete textArea;
|
||||
@@ -1465,6 +1565,12 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ AddChild(toolBar);
|
||||
+#endif
|
||||
+
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+ tabLine = new VimTabLine(BRect(0,0,0,0));
|
||||
+// tabLine->PrepareButtonBitmaps();
|
||||
+ AddChild(tabLine);
|
||||
+#endif
|
||||
+
|
||||
+ BRect remaining = frame;
|
||||
+ textArea = new VimTextAreaView(remaining);
|
||||
+ AddChild(textArea);
|
||||
@@ -1481,6 +1587,14 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#ifdef FEAT_GUI_TABLINE
|
||||
+ float
|
||||
+VimFormView::TablineHeight() const
|
||||
+{
|
||||
+ return (tabLine && IsShowingTabLine()) ? tabLine->TablineHeight() : 0.;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+ void
|
||||
+VimFormView::AllAttached()
|
||||
+{
|
||||
@@ -1511,6 +1625,14 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ remaining.top += ToolbarHeight();
|
||||
+ gui.toolbar_height = ToolbarHeight();
|
||||
+#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
|
||||
+
|
||||
+ textArea->ResizeTo(remaining.Width(), remaining.Height());
|
||||
+ textArea->MoveTo(remaining.left, remaining.top);
|
||||
+ }
|
||||
@@ -3044,6 +3166,104 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+
|
||||
+#endif /*FEAT_TOOLBAR*/
|
||||
+
|
||||
+#if defined(FEAT_GUI_TABLINE)
|
||||
+
|
||||
+ float
|
||||
+VimTabLine::TablineHeight() const
|
||||
+{
|
||||
+// float size = NULL == normalButtonsBitmap ? 18. : normalButtonsBitmap->Bounds().Height();
|
||||
+// return size + ToolbarMargin * 2 + ButtonMargin * 2 + 1;
|
||||
+ return TabHeight();// + ToolbarMargin;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+VimTabLine::MouseDown(BPoint point)
|
||||
+{
|
||||
+ if(!gui_mch_showing_tabline())
|
||||
+ return;
|
||||
+
|
||||
+ BMessage *m = Window()->CurrentMessage();
|
||||
+ assert(m);
|
||||
+
|
||||
+ int32 buttons = 0;
|
||||
+ m->FindInt32("buttons", &buttons);
|
||||
+
|
||||
+ int32 clicks = 0;
|
||||
+ m->FindInt32("clicks", &clicks);
|
||||
+
|
||||
+ int index = 0; // 0 means here - no tab found
|
||||
+ for (int i = 0; i < CountTabs(); i++) {
|
||||
+ if(TabFrame(i).Contains(point)) {
|
||||
+ index = i + 1; // indexes are 1-based
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int event = -1;
|
||||
+
|
||||
+ if ((buttons & B_PRIMARY_MOUSE_BUTTON) && clicks > 1) {
|
||||
+ // left button double click on - create new tab
|
||||
+ event = TABLINE_MENU_NEW;
|
||||
+
|
||||
+ } else if (buttons & B_TERTIARY_MOUSE_BUTTON) {
|
||||
+ // 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
|
||||
+ 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)));
|
||||
+ popUpMenu->AddItem(new BMenuItem(_("Open tab..."), new BMessage(TABLINE_MENU_OPEN)));
|
||||
+
|
||||
+ ConvertToScreen(&point);
|
||||
+ BMenuItem* item = popUpMenu->Go(point);
|
||||
+ if (item != NULL) {
|
||||
+ event = item->Command();
|
||||
+ }
|
||||
+
|
||||
+ delete popUpMenu;
|
||||
+
|
||||
+ } else {
|
||||
+ // default processing
|
||||
+ BTabView::MouseDown(point);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event < 0)
|
||||
+ return;
|
||||
+
|
||||
+ VimTablineMenuMsg tmm;
|
||||
+ tmm.index = index;
|
||||
+ tmm.event = event;
|
||||
+ write_port(gui.vdcmp, VimMsg::TablineMenu, &tmm, sizeof(tmm));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+VimTabLine::VimTab::Select(BView* owner)
|
||||
+{
|
||||
+ BTab::Select(owner);
|
||||
+
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+ if(tabLine != NULL) {
|
||||
+
|
||||
+ int32 i = 0;
|
||||
+ 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;
|
||||
+ tm.index = i + 1;
|
||||
+ write_port(gui.vdcmp, VimMsg::Tabline, &tm, sizeof(tm));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#endif // defined(FEAT_GUI_TABLINE)
|
||||
+
|
||||
+/* ---------------- ---------------- */
|
||||
+
|
||||
@@ -3157,6 +3377,12 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ case VimMsg::Refs:
|
||||
+ ::RefsReceived(vm.u.Refs.message, vm.u.Refs.changedir);
|
||||
+ break;
|
||||
+ case VimMsg::Tabline:
|
||||
+ send_tabline_event(vm.u.Tabline.index);
|
||||
+ break;
|
||||
+ case VimMsg::TablineMenu:
|
||||
+ send_tabline_menu_event(vm.u.TablineMenu.index, vm.u.TablineMenu.event);
|
||||
+ break;
|
||||
+ default:
|
||||
+ // unrecognised message, ignore it
|
||||
+ break;
|
||||
@@ -3585,6 +3811,13 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ if (gui.vimWindow->Lock()) {
|
||||
+ gui.vimTextArea->MoveTo(x, y);
|
||||
+ gui.vimTextArea->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH);
|
||||
+
|
||||
+/*#ifdef FEAT_GUI_TABLINE
|
||||
+ if(gui.vimForm->TabLine() != NULL) {
|
||||
+ gui.vimForm->TabLine()->ResizeTo(w, gui.vimForm->TablineHeight());
|
||||
+ }
|
||||
+#endif //FEAT_GUI_TABLINE*/
|
||||
+
|
||||
+ gui.vimWindow->Unlock();
|
||||
+ }
|
||||
+}
|
||||
@@ -4556,6 +4789,14 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+{
|
||||
+ vimmenu_T *parent = menu->parent;
|
||||
+
|
||||
+ // popup menu - just create it unattached
|
||||
+ if (menu_is_popup(menu->name) && parent == NULL) {
|
||||
+ BPopUpMenu* popUpMenu = new BPopUpMenu((const char*)menu->name, false, false);
|
||||
+ menu->submenu_id = popUpMenu;
|
||||
+ menu->id = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!menu_is_menubar(menu->name)
|
||||
+ || (parent != NULL && parent->submenu_id == NULL))
|
||||
+ return;
|
||||
@@ -4623,21 +4864,6 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ int mnemonic = 0;
|
||||
+ vimmenu_T *parent = menu->parent;
|
||||
+
|
||||
+// printf("parent:%s:%#010x\n", parent->name, parent->submenu_id);
|
||||
+// if (parent->submenu_id == NULL)
|
||||
+// return;
|
||||
+
|
||||
+// printf("parent:%s\n", parent->name);
|
||||
+
|
||||
+//#ifdef never
|
||||
+ /* why not add separators ?
|
||||
+ * richard
|
||||
+ */
|
||||
+ /* Don't add menu separator */
|
||||
+// if (menu_is_separator(menu->name))
|
||||
+// return;
|
||||
+//#endif
|
||||
+
|
||||
+ /* TODO: use menu->actext */
|
||||
+ /* This is difficult, since on Be, an accelerator must be a single char
|
||||
+ * and a lot of Vim ones are the standard VI commands.
|
||||
@@ -4655,9 +4881,9 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ }
|
||||
+ } else
|
||||
+#endif
|
||||
+
|
||||
+ if (parent->submenu_id != NULL) {
|
||||
+ if ( menu_is_separator(menu->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);
|
||||
+ menu->id = item;
|
||||
@@ -4770,6 +4996,26 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ /* Nothing to do in BeOS */
|
||||
+}
|
||||
+
|
||||
+ void
|
||||
+gui_mch_show_popupmenu(vimmenu_T *menu)
|
||||
+{
|
||||
+ if (!menu_is_popup(menu->name) || menu->submenu_id == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ BPopUpMenu* popupMenu = dynamic_cast<BPopUpMenu*>(menu->submenu_id);
|
||||
+ if (popupMenu == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ BPoint point;
|
||||
+ if(gui.vimWindow->Lock()) {
|
||||
+ uint32 buttons = 0;
|
||||
+ gui.vimTextArea->GetMouse(&point, &buttons);
|
||||
+ gui.vimTextArea->ConvertToScreen(&point);
|
||||
+ gui.vimWindow->Unlock();
|
||||
+ }
|
||||
+ popupMenu->Go(point, true);
|
||||
+}
|
||||
+
|
||||
+#endif /* FEAT_MENU */
|
||||
+
|
||||
+/* Mouse stuff */
|
||||
@@ -5020,13 +5266,6 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ /* TODO */
|
||||
+}
|
||||
+
|
||||
+ void
|
||||
+gui_mch_show_popupmenu(vimmenu_T *menu)
|
||||
+{
|
||||
+ TRACE();
|
||||
+ /* TODO */
|
||||
+}
|
||||
+
|
||||
+#ifdef FEAT_MBYTE_IME
|
||||
+ void
|
||||
+im_set_position(int row, int col)
|
||||
@@ -5079,7 +5318,113 @@ diff -Naur vim73/src/gui_beos.cc vim73.haiku/src/gui_beos.cc
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+//} /* extern "C" */
|
||||
+
|
||||
+#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
|
||||
+
|
||||
+/*
|
||||
+ * Show or hide the tabline.
|
||||
+ */
|
||||
+ void
|
||||
+gui_mch_show_tabline(int showit)
|
||||
+{
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+
|
||||
+ if (tabLine == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if (!showit != !gui.vimForm->IsShowingTabLine()) {
|
||||
+ gui.vimForm->SetShowingTabLine(showit != 0);
|
||||
+ gui.tabline_height = gui.vimForm->TablineHeight();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+ void
|
||||
+gui_mch_set_tabline_pos(int x, int y, int w, int h)
|
||||
+{
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+ if(tabLine != NULL) {
|
||||
+ if (gui.vimWindow->Lock()) {
|
||||
+ tabLine->MoveTo(x, y);
|
||||
+ tabLine->ResizeTo(w - 1, h - 1);
|
||||
+ gui.vimWindow->Unlock();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Return TRUE when tabline is displayed.
|
||||
+ */
|
||||
+ int
|
||||
+gui_mch_showing_tabline()
|
||||
+{
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+ return tabLine != NULL && gui.vimForm->IsShowingTabLine();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Update the labels of the tabline.
|
||||
+ */
|
||||
+ void
|
||||
+gui_mch_update_tabline()
|
||||
+{
|
||||
+ tabpage_T *tp;
|
||||
+ int nr = 0;
|
||||
+ int curtabidx = 0;
|
||||
+
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+
|
||||
+ if (tabLine == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ gui.vimWindow->Lock();
|
||||
+
|
||||
+ /* Add a label for each tab page. They all contain the same text area. */
|
||||
+ for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) {
|
||||
+ if (tp == curtab)
|
||||
+ curtabidx = nr;
|
||||
+
|
||||
+ BTab* tab = tabLine->TabAt(nr);
|
||||
+
|
||||
+ if (tab == NULL) {
|
||||
+ tab = new VimTabLine::VimTab();
|
||||
+ tabLine->AddTab(NULL, tab);
|
||||
+ }
|
||||
+
|
||||
+ get_tabline_label(tp, FALSE);
|
||||
+ tab->SetLabel((const char*)NameBuff);
|
||||
+ tabLine->Invalidate();
|
||||
+ }
|
||||
+
|
||||
+ /* Remove any old labels. */
|
||||
+ while (nr < tabLine->CountTabs())
|
||||
+ tabLine->RemoveTab(nr);
|
||||
+
|
||||
+ if(tabLine->Selection() != curtabidx)
|
||||
+ tabLine->Select(curtabidx);
|
||||
+
|
||||
+ gui.vimWindow->Unlock();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Set the current tab to "nr". First tab is 1.
|
||||
+ */
|
||||
+ void
|
||||
+gui_mch_set_curtab(int nr)
|
||||
+{
|
||||
+ VimTabLine *tabLine = gui.vimForm->TabLine();
|
||||
+ if(tabLine == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ gui.vimWindow->Lock();
|
||||
+
|
||||
+ if(tabLine->Selection() != nr -1)
|
||||
+ tabLine->Select(nr -1);
|
||||
+
|
||||
+ gui.vimWindow->Unlock();
|
||||
+}
|
||||
+
|
||||
+#endif //FEAT_GUI_TABLINE
|
||||
+
|
||||
diff -Naur vim73/src/gui_beos.h vim73.haiku/src/gui_beos.h
|
||||
--- vim73/src/gui_beos.h 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ vim73.haiku/src/gui_beos.h 2010-08-20 22:25:02.562298880 +0000
|
||||
@@ -5172,7 +5517,32 @@ diff -Naur vim73/src/misc1.c vim73.haiku/src/misc1.c
|
||||
diff -Naur vim73/src/normal.c vim73.haiku/src/normal.c
|
||||
--- vim73/src/normal.c 2010-07-31 13:25:19.021233664 +0000
|
||||
+++ vim73.haiku/src/normal.c 2010-08-20 22:44:36.301203456 +0000
|
||||
@@ -5385,7 +5385,8 @@
|
||||
@@ -2599,6 +2599,7 @@
|
||||
* shift-left button -> right button
|
||||
* alt-left button -> alt-right button
|
||||
*/
|
||||
+
|
||||
if (mouse_model_popup())
|
||||
{
|
||||
if (which_button == MOUSE_RIGHT
|
||||
@@ -2613,13 +2614,14 @@
|
||||
if (!is_click)
|
||||
return FALSE;
|
||||
#endif
|
||||
-#if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN)
|
||||
+#if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_BEOS)
|
||||
if (is_click || is_drag)
|
||||
return FALSE;
|
||||
#endif
|
||||
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
|
||||
- || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON)
|
||||
+ || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \
|
||||
+ || defined(FEAT_GUI_BEOS)
|
||||
if (gui.in_use)
|
||||
{
|
||||
jump_flags = 0;
|
||||
@@ -5385,7 +5387,8 @@
|
||||
{
|
||||
if (!checkclearop(cap->oap))
|
||||
{
|
||||
@@ -5182,7 +5552,7 @@ diff -Naur vim73/src/normal.c vim73.haiku/src/normal.c
|
||||
/*
|
||||
* Right now, the BeBox doesn't seem to have an easy way to detect
|
||||
* window resizing, so we cheat and make the user detect it
|
||||
@@ -5393,6 +5394,7 @@
|
||||
@@ -5393,6 +5396,7 @@
|
||||
*/
|
||||
ui_get_shellsize();
|
||||
#endif
|
||||
@@ -5619,7 +5989,7 @@ diff -Naur vim73/src/os_unix.h vim73.haiku/src/os_unix.h
|
||||
diff -Naur vim73/src/proto/gui_beos.pro vim73.haiku/src/proto/gui_beos.pro
|
||||
--- vim73/src/proto/gui_beos.pro 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ vim73.haiku/src/proto/gui_beos.pro 2010-08-20 23:42:00.825229312 +0000
|
||||
@@ -0,0 +1,84 @@
|
||||
@@ -0,0 +1,90 @@
|
||||
+/* gui_beos.cc - hand crafted */
|
||||
+void gui_mch_prepare __ARGS((int *argc, char **argv));
|
||||
+int gui_mch_init __ARGS((void));
|
||||
@@ -5704,6 +6074,12 @@ diff -Naur vim73/src/proto/gui_beos.pro vim73.haiku/src/proto/gui_beos.pro
|
||||
+
|
||||
+void gui_mch_show_toolbar __ARGS((int showit));
|
||||
+void gui_mch_set_toolbar_pos __ARGS((int x, int y, int w, int h));
|
||||
+
|
||||
+void gui_mch_show_tabline __ARGS((int showit));
|
||||
+void gui_mch_set_tabline_pos __ARGS((int x, int y, int w, int h));
|
||||
+int gui_mch_showing_tabline __ARGS((void));
|
||||
+void gui_mch_update_tabline __ARGS((void));
|
||||
+void gui_mch_set_curtab __ARGS((int nr));
|
||||
diff -Naur vim73/src/proto/os_beos.pro vim73.haiku/src/proto/os_beos.pro
|
||||
--- vim73/src/proto/os_beos.pro 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ vim73.haiku/src/proto/os_beos.pro 2009-05-16 16:18:36.066846720 +0000
|
||||
@@ -5856,6 +6232,15 @@ diff -Naur vim73/src/ui.c vim73.haiku/src/ui.c
|
||||
/*
|
||||
* When the OS can't really suspend, call this function to start a shell.
|
||||
* This is never called in the GUI.
|
||||
@@ -3000,7 +3000,7 @@
|
||||
|
||||
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \
|
||||
|| defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
|
||||
- || defined(FEAT_GUI_PHOTON) || defined(PROTO)
|
||||
+ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_BEOS) || defined(PROTO)
|
||||
/*
|
||||
* Translate window coordinates to buffer position without any side effects
|
||||
*/
|
||||
diff -Naur vim73/src/version.c vim73.haiku/src/version.c
|
||||
--- vim73/src/version.c 2010-08-01 13:45:48.052953088 +0000
|
||||
+++ vim73.haiku/src/version.c 2010-08-20 22:58:43.417333248 +0000
|
||||
|
||||
Reference in New Issue
Block a user