diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-24 22:16:13 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-24 22:16:13 +0200 |
commit | b52575f9cfcb5c9715ed08ccd552a55e0052370e (patch) | |
tree | 94967d94c6aad3783855ca2691833b0a119d6deb /src/gui_haiku.cc | |
parent | 7714d7b31f0fc7c717c97abd4a8b5cbb13a3ad31 (diff) |
patch 8.2.0631: Haiku file formatted with wrong tabstopv8.2.0631
Problem: Haiku file formatted with wrong tabstop.
Solution: Use normal tabstop. Fix white space.
Diffstat (limited to 'src/gui_haiku.cc')
-rw-r--r-- | src/gui_haiku.cc | 6794 |
1 files changed, 3397 insertions, 3397 deletions
diff --git a/src/gui_haiku.cc b/src/gui_haiku.cc index f26e9035a5..2dbd852f27 100644 --- a/src/gui_haiku.cc +++ b/src/gui_haiku.cc @@ -2,7 +2,7 @@ * * VIM - Vi IMproved by Bram Moolenaar * BeBox GUI support Copyright 1998 by Olaf Seibert. - * All Rights Reserved. + * All Rights Reserved. * * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. @@ -79,7 +79,7 @@ extern "C" { #include "proto.h" #include "version.h" -} // extern "C" +} // extern "C" // ---------------- start of header part ---------------- @@ -143,165 +143,165 @@ extern int main(int argc, char **argv); // VimApp seems comparable to the X "vimShell" class VimApp: public BApplication { - typedef BApplication Inherited; - public: - VimApp(const char *appsig); - ~VimApp(); + typedef BApplication Inherited; + public: + VimApp(const char *appsig); + ~VimApp(); - // callbacks: + // callbacks: #if 0 - virtual void DispatchMessage(BMessage *m, BHandler *h) - { - m->PrintToStream(); - Inherited::DispatchMessage(m, h); - } + virtual void DispatchMessage(BMessage *m, BHandler *h) + { + m->PrintToStream(); + Inherited::DispatchMessage(m, h); + } #endif - virtual void ReadyToRun(); - virtual void ArgvReceived(int32 argc, char **argv); - virtual void RefsReceived(BMessage *m); - virtual bool QuitRequested(); - virtual void MessageReceived(BMessage *m); - - static void SendRefs(BMessage *m, bool changedir); - - sem_id fFilePanelSem; - BFilePanel* fFilePanel; - BPath fBrowsedPath; - private: + virtual void ReadyToRun(); + virtual void ArgvReceived(int32 argc, char **argv); + virtual void RefsReceived(BMessage *m); + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage *m); + + static void SendRefs(BMessage *m, bool changedir); + + sem_id fFilePanelSem; + BFilePanel* fFilePanel; + BPath fBrowsedPath; + private: }; class VimWindow: public BWindow { - typedef BWindow Inherited; - public: - VimWindow(); - ~VimWindow(); + typedef BWindow Inherited; + public: + VimWindow(); + ~VimWindow(); - // virtual void DispatchMessage(BMessage *m, BHandler *h); - virtual void WindowActivated(bool active); - virtual bool QuitRequested(); + // virtual void DispatchMessage(BMessage *m, BHandler *h); + virtual void WindowActivated(bool active); + virtual bool QuitRequested(); - VimFormView *formView; + VimFormView *formView; - private: - void init(); + private: + void init(); }; class VimFormView: public BView { - typedef BView Inherited; - public: - VimFormView(BRect frame); - ~VimFormView(); + typedef BView Inherited; + public: + VimFormView(BRect frame); + ~VimFormView(); - // callbacks: - virtual void AllAttached(); - virtual void FrameResized(float new_width, float new_height); + // callbacks: + virtual void AllAttached(); + virtual void FrameResized(float new_width, float new_height); #define MENUBAR_MARGIN 1 - float MenuHeight() const - { return menuBar ? menuBar->Frame().Height() + MENUBAR_MARGIN: 0; } - BMenuBar *MenuBar() const - { return menuBar; } + float MenuHeight() const + { return menuBar ? menuBar->Frame().Height() + MENUBAR_MARGIN: 0; } + BMenuBar *MenuBar() const + { return menuBar; } - private: - void init(BRect); + private: + void init(BRect); - BMenuBar *menuBar; - VimTextAreaView *textArea; + BMenuBar *menuBar; + VimTextAreaView *textArea; #ifdef FEAT_TOOLBAR - public: - float ToolbarHeight() const; - VimToolbar *ToolBar() const - { return toolBar; } - private: - VimToolbar *toolBar; + public: + float ToolbarHeight() const; + VimToolbar *ToolBar() const + { return toolBar; } + private: + 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; + 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 { - typedef BView Inherited; - public: - VimTextAreaView(BRect frame); - ~VimTextAreaView(); - - // callbacks: - virtual void Draw(BRect updateRect); - virtual void KeyDown(const char *bytes, int32 numBytes); - virtual void MouseDown(BPoint point); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); - virtual void MessageReceived(BMessage *m); - - // own functions: - int mchInitFont(char_u *name); - void mchDrawString(int row, int col, char_u *s, int len, int flags); - void mchClearBlock(int row1, int col1, int row2, int col2); - void mchClearAll(); - void mchDeleteLines(int row, int num_lines); - void mchInsertLines(int row, int num_lines); - - static void guiSendMouseEvent(int button, int x, int y, int repeated_click, int_u modifiers); - static void guiMouseMoved(int x, int y); - static void guiBlankMouse(bool should_hide); - static int_u mouseModifiersToVim(int32 beModifiers); - - int32 mouseDragEventCount; + typedef BView Inherited; + public: + VimTextAreaView(BRect frame); + ~VimTextAreaView(); + + // callbacks: + virtual void Draw(BRect updateRect); + virtual void KeyDown(const char *bytes, int32 numBytes); + virtual void MouseDown(BPoint point); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); + virtual void MessageReceived(BMessage *m); + + // own functions: + int mchInitFont(char_u *name); + void mchDrawString(int row, int col, char_u *s, int len, int flags); + void mchClearBlock(int row1, int col1, int row2, int col2); + void mchClearAll(); + void mchDeleteLines(int row, int num_lines); + void mchInsertLines(int row, int num_lines); + + static void guiSendMouseEvent(int button, int x, int y, int repeated_click, int_u modifiers); + static void guiMouseMoved(int x, int y); + static void guiBlankMouse(bool should_hide); + static int_u mouseModifiersToVim(int32 beModifiers); + + int32 mouseDragEventCount; #ifdef FEAT_MBYTE_IME - void DrawIMString(void); + void DrawIMString(void); #endif - private: - void init(BRect); + private: + void init(BRect); - int_u vimMouseButton; - int_u vimMouseModifiers; + int_u vimMouseButton; + int_u vimMouseModifiers; #ifdef FEAT_MBYTE_IME - struct { - BMessenger* messenger; - BMessage* message; - BPoint location; - int row; - int col; - int count; - } IMData; + struct { + BMessenger* messenger; + BMessage* message; + BPoint location; + int row; + int col; + int count; + } IMData; #endif }; class VimScrollBar: public BScrollBar { - typedef BScrollBar Inherited; - public: - VimScrollBar(scrollbar_T *gsb, orientation posture); - ~VimScrollBar(); + typedef BScrollBar Inherited; + public: + VimScrollBar(scrollbar_T *gsb, orientation posture); + ~VimScrollBar(); - virtual void ValueChanged(float newValue); - virtual void MouseUp(BPoint where); - void SetValue(float newval); - scrollbar_T *getGsb() - { return gsb; } + virtual void ValueChanged(float newValue); + virtual void MouseUp(BPoint where); + void SetValue(float newval); + scrollbar_T *getGsb() + { return gsb; } - int32 scrollEventCount; + int32 scrollEventCount; - private: - scrollbar_T *gsb; - float ignoreValue; + private: + scrollbar_T *gsb; + float ignoreValue; }; @@ -309,28 +309,28 @@ class VimScrollBar: public BScrollBar class VimToolbar : public BBox { - static BBitmap *normalButtonsBitmap; - static BBitmap *grayedButtonsBitmap; + static BBitmap *normalButtonsBitmap; + static BBitmap *grayedButtonsBitmap; - BBitmap *LoadVimBitmap(const char* fileName); - bool GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed); - bool ModifyBitmapToGrayed(BBitmap *bitmap); + BBitmap *LoadVimBitmap(const char* fileName); + bool GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed); + bool ModifyBitmapToGrayed(BBitmap *bitmap); - BList fButtonsList; - void InvalidateLayout(); + BList fButtonsList; + void InvalidateLayout(); - public: - VimToolbar(BRect frame, const char * name); - ~VimToolbar(); + public: + VimToolbar(BRect frame, const char * name); + ~VimToolbar(); - bool PrepareButtonBitmaps(); + bool PrepareButtonBitmaps(); - bool AddButton(int32 index, vimmenu_T *menu); - bool RemoveButton(vimmenu_T *menu); - bool GrayButton(vimmenu_T *menu, int grey); + bool AddButton(int32 index, vimmenu_T *menu); + bool RemoveButton(vimmenu_T *menu); + bool GrayButton(vimmenu_T *menu, int grey); - float ToolbarHeight() const; - virtual void AttachedToWindow(); + float ToolbarHeight() const; + virtual void AttachedToWindow(); }; BBitmap *VimToolbar::normalButtonsBitmap = NULL; @@ -345,19 +345,19 @@ const float ButtonMargin = 3.; class VimTabLine : public BTabView { - public: - class VimTab : public BTab { - public: - VimTab() : BTab(new BView(BRect(), "-Empty-", 0, 0)) {} + public: + class VimTab : public BTab { + public: + VimTab() : BTab(new BView(BRect(), "-Empty-", 0, 0)) {} - virtual void Select(BView* owner); - }; + 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) {} + 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); + float TablineHeight() const; + virtual void MouseDown(BPoint point); }; #endif //FEAT_GUI_TABLINE @@ -367,97 +367,97 @@ class VimTabLine : public BTabView // Vim seems rather sloppy in this regard. class VimFont: public BFont { - typedef BFont Inherited; - public: - VimFont(); - VimFont(const VimFont *rhs); - VimFont(const BFont *rhs); - VimFont(const VimFont &rhs); - ~VimFont(); + typedef BFont Inherited; + public: + VimFont(); + VimFont(const VimFont *rhs); + VimFont(const BFont *rhs); + VimFont(const VimFont &rhs); + ~VimFont(); - VimFont *next; - int refcount; - char_u *name; + VimFont *next; + int refcount; + char_u *name; - private: - void init(); + private: + void init(); }; #if defined(FEAT_GUI_DIALOG) class VimDialog : public BWindow { - typedef BWindow Inherited; + typedef BWindow Inherited; - BButton* _CreateButton(int32 which, const char* label); + BButton* _CreateButton(int32 which, const char* label); - public: + public: - class View : public BView { - typedef BView Inherited; + class View : public BView { + typedef BView Inherited; - public: - View(BRect frame); - ~View(); + public: + View(BRect frame); + ~View(); - virtual void Draw(BRect updateRect); - void InitIcon(int32 type); + virtual void Draw(BRect updateRect); + void InitIcon(int32 type); - private: - BBitmap* fIconBitmap; - }; + private: + BBitmap* fIconBitmap; + }; - VimDialog(int type, const char *title, const char *message, - const char *buttons, int dfltbutton, const char *textfield, - int ex_cmd); - ~VimDialog(); + VimDialog(int type, const char *title, const char *message, + const char *buttons, int dfltbutton, const char *textfield, + int ex_cmd); + ~VimDialog(); - int Go(); + int Go(); - virtual void MessageReceived(BMessage *msg); + virtual void MessageReceived(BMessage *msg); - private: - sem_id fDialogSem; - int fDialogValue; - BList fButtonsList; - BTextView* fMessageView; - BTextControl* fInputControl; - const char* fInputValue; + private: + sem_id fDialogSem; + int fDialogValue; + BList fButtonsList; + BTextView* fMessageView; + BTextControl* fInputControl; + const char* fInputValue; }; class VimSelectFontDialog : public BWindow { - typedef BWindow Inherited; - - void _CleanList(BListView* list); - void _UpdateFontStyles(); - void _UpdateSizeInputPreview(); - void _UpdateFontPreview(); - bool _UpdateFromListItem(BListView* list, char* text, int textSize); - public: - - VimSelectFontDialog(font_family* family, font_style* style, float* size); - ~VimSelectFontDialog(); - - bool Go(); - - virtual void MessageReceived(BMessage *msg); - - private: - status_t fStatus; - sem_id fDialogSem; - bool fDialogValue; - font_family* fFamily; - font_style* fStyle; - float* fSize; - font_family fFontFamily; - font_style fFontStyle; - float fFontSize; - BStringView* fPreview; - BListView* fFamiliesList; - BListView* fStylesList; - BListView* fSizesList; - BTextControl* fSizesInput; + typedef BWindow Inherited; + + void _CleanList(BListView* list); + void _UpdateFontStyles(); + void _UpdateSizeInputPreview(); + void _UpdateFontPreview(); + bool _UpdateFromListItem(BListView* list, char* text, int textSize); + public: + + VimSelectFontDialog(font_family* family, font_style* style, float* size); + ~VimSelectFontDialog(); + + bool Go(); + + virtual void MessageReceived(BMessage *msg); + + private: + status_t fStatus; + sem_id fDialogSem; + bool fDialogValue; + font_family* fFamily; + font_style* fStyle; + float* fSize; + font_family fFontFamily; + font_style fFontStyle; + float fFontSize; + BStringView* fPreview; + BListView* fFamiliesList; + BListView* fStylesList; + BListView* fSizesList; + BTextControl* fSizesInput; }; #endif // FEAT_GUI_DIALOG @@ -465,8 +465,8 @@ class VimSelectFontDialog : public BWindow // ---------------- end of GUI classes ---------------- struct MainArgs { - int argc; - char **argv; + int argc; + char **argv; }; // These messages are copied through the VDCMP. @@ -480,74 +480,74 @@ struct MainArgs { #endif struct VimKeyMsg { - char_u length; - char_u chars[KEY_MSG_BUFSIZ]; // contains Vim encoding - bool csi_escape; + char_u length; + char_u chars[KEY_MSG_BUFSIZ]; // contains Vim encoding + bool csi_escape; }; struct VimResizeMsg { - int width; - int height; + int width; + int height; }; struct VimScrollBarMsg { - VimScrollBar *sb; - long value; - int stillDragging; + VimScrollBar *sb; + long value; + int stillDragging; }; struct VimMenuMsg { - vimmenu_T *guiMenu; + vimmenu_T *guiMenu; }; struct VimMouseMsg { - int button; - int x; - int y; - int repeated_click; - int_u modifiers; + int button; + int x; + int y; + int repeated_click; + int_u modifiers; }; struct VimMouseMovedMsg { - int x; - int y; + int x; + int y; }; struct VimFocusMsg { - bool active; + bool active; }; struct VimRefsMsg { - BMessage *message; - bool changedir; + BMessage *message; + bool changedir; }; struct VimTablineMsg { - int index; + int index; }; struct VimTablineMenuMsg { - int index; - int event; + int index; + int event; }; struct VimMsg { - enum VimMsgType { - Key, Resize, ScrollBar, Menu, Mouse, MouseMoved, Focus, Refs, Tabline, TablineMenu - }; - - union { - struct VimKeyMsg Key; - struct VimResizeMsg NewSize; - struct VimScrollBarMsg Scroll; - struct VimMenuMsg Menu; - struct VimMouseMsg Mouse; - struct VimMouseMovedMsg MouseMoved; - struct VimFocusMsg Focus; - struct VimRefsMsg Refs; - struct VimTablineMsg Tabline; - struct VimTablineMenuMsg TablineMenu; - } u; + enum VimMsgType { + Key, Resize, ScrollBar, Menu, Mouse, MouseMoved, Focus, Refs, Tabline, TablineMenu + }; + + union { + struct VimKeyMsg Key; + struct VimResizeMsg NewSize; + struct VimScrollBarMsg Scroll; + struct VimMenuMsg Menu; + struct VimMouseMsg Mouse; + struct VimMouseMovedMsg MouseMoved; + struct VimFocusMsg Focus; + struct VimRefsMsg Refs; + struct VimTablineMsg Tabline; + struct VimTablineMenuMsg TablineMenu; + } u; }; #define RGB(r, g, b) ((char_u)(r) << 16 | (char_u)(g) << 8 | (char_u)(b) << 0) @@ -557,100 +557,100 @@ struct VimMsg { static struct specialkey { - uint16 BeKeys; -#define KEY(a,b) ((a)<<8|(b)) -#define K(a) KEY(0,a) // for ASCII codes -#define F(b) KEY(1,b) // for scancodes - char_u vim_code0; - char_u vim_code1; + uint16 BeKeys; +#define KEY(a,b) ((a)<<8|(b)) +#define K(a) KEY(0,a) // for ASCII codes +#define F(b) KEY(1,b) // for scancodes + char_u vim_code0; + char_u vim_code1; } special_keys[] = { - {K(B_UP_ARROW), 'k', 'u'}, - {K(B_DOWN_ARROW), 'k', 'd'}, - {K(B_LEFT_ARROW), 'k', 'l'}, - {K(B_RIGHT_ARROW), 'k', 'r'}, - {K(B_BACKSPACE), 'k', 'b'}, - {K(B_INSERT), 'k', 'I'}, - {K(B_DELETE), 'k', 'D'}, - {K(B_HOME), 'k', 'h'}, - {K(B_END), '@', '7'}, - {K(B_PAGE_UP), 'k', 'P'}, // XK_Prior - {K(B_PAGE_DOWN), 'k', 'N'}, // XK_Next, + {K(B_UP_ARROW), 'k', 'u'}, + {K(B_DOWN_ARROW), 'k', 'd'}, + {K(B_LEFT_ARROW), 'k', 'l'}, + {K(B_RIGHT_ARROW), 'k', 'r'}, + {K(B_BACKSPACE), 'k', 'b'}, + {K(B_INSERT), 'k', 'I'}, + {K(B_DELETE), 'k', 'D'}, + {K(B_HOME), 'k', 'h'}, + {K(B_END), '@', '7'}, + {K(B_PAGE_UP), 'k', 'P'}, // XK_Prior + {K(B_PAGE_DOWN), 'k', 'N'}, // XK_Next, #define FIRST_FUNCTION_KEY 11 - {F(B_F1_KEY), 'k', '1'}, - {F(B_F2_KEY), 'k', '2'}, - {F(B_F3_KEY), 'k', '3'}, - {F(B_F4_KEY), 'k', '4'}, - {F(B_F5_KEY), 'k', '5'}, - {F(B_F6_KEY), 'k', '6'}, - {F(B_F7_KEY), 'k', '7'}, - {F(B_F8_KEY), 'k', '8'}, - {F(B_F9_KEY), 'k', '9'}, - {F(B_F10_KEY), 'k', ';'}, - - {F(B_F11_KEY), 'F', '1'}, - {F(B_F12_KEY), 'F', '2'}, - // {XK_F13, 'F', '3'}, // would be print screen - // sysreq - {F(0x0F), 'F', '4'}, // scroll lock - {F(0x10), 'F', '5'}, // pause/break - // {XK_F16, 'F', '6'}, - // {XK_F17, 'F', '7'}, - // {XK_F18, 'F', '8'}, - // {XK_F19, 'F', '9'}, - // {XK_F20, 'F', 'A'}, - // {XK_F21, 'F', 'B'}, - // {XK_F22, 'F', 'C'}, - // {XK_F23, 'F', 'D'}, - // {XK_F24, 'F', 'E'}, - // {XK_F25, 'F', 'F'}, - // {XK_F26, 'F', 'G'}, - // {XK_F27, 'F', 'H'}, - // {XK_F28, 'F', 'I'}, - // {XK_F29, 'F', 'J'}, - // {XK_F30, 'F', 'K'}, - // {XK_F31, 'F', 'L'}, - // {XK_F32, 'F', 'M'}, - // {XK_F33, 'F', 'N'}, - // {XK_F34, 'F', 'O'}, - // {XK_F35, 'F', 'P'}, // keysymdef.h defines up to F35 - - // {XK_Help, '%', '1'}, // XK_Help - {F(B_PRINT_KEY), '%', '9'}, + {F(B_F1_KEY), 'k', '1'}, + {F(B_F2_KEY), 'k', '2'}, + {F(B_F3_KEY), 'k', '3'}, + {F(B_F4_KEY), 'k', '4'}, + {F(B_F5_KEY), 'k', '5'}, + {F(B_F6_KEY), 'k', '6'}, + {F(B_F7_KEY), 'k', '7'}, + {F(B_F8_KEY), 'k', '8'}, + {F(B_F9_KEY), 'k', '9'}, + {F(B_F10_KEY), 'k', ';'}, + + {F(B_F11_KEY), 'F', '1'}, + {F(B_F12_KEY), 'F', '2'}, + // {XK_F13, 'F', '3'}, // would be print screen + // sysreq + {F(0x0F), 'F', '4'}, // scroll lock + {F(0x10), 'F', '5'}, // pause/break + // {XK_F16, 'F', '6'}, + // {XK_F17, 'F', '7'}, + // {XK_F18, 'F', '8'}, + // {XK_F19, 'F', '9'}, + // {XK_F20, 'F', 'A'}, + // {XK_F21, 'F', 'B'}, + // {XK_F22, 'F', 'C'}, + // {XK_F23, 'F', 'D'}, + // {XK_F24, 'F', 'E'}, + // {XK_F25, 'F', 'F'}, + // {XK_F26, 'F', 'G'}, + // {XK_F27, 'F', 'H'}, + // {XK_F28, 'F', 'I'}, + // {XK_F29, 'F', 'J'}, + // {XK_F30, 'F', 'K'}, + // {XK_F31, 'F', 'L'}, + // {XK_F32, 'F', 'M'}, + // {XK_F33, 'F', 'N'}, + // {XK_F34, 'F', 'O'}, + // {XK_F35, 'F', 'P'}, // keysymdef.h defines up to F35 + + // {XK_Help, '%', '1'}, // XK_Help + {F(B_PRINT_KEY), '%', '9'}, #if 0 - // Keypad keys: - {F(0x48), 'k', 'l'}, // XK_KP_Left - {F(0x4A), 'k', 'r'}, // XK_KP_Right - {F(0x38), 'k', 'u'}, // XK_KP_Up - {F(0x59), 'k', 'd'}, // XK_KP_Down - {F(0x64), 'k', 'I'}, // XK_KP_Insert - {F(0x65), 'k', 'D'}, // XK_KP_Delete - {F(0x37), 'k', 'h'}, // XK_KP_Home - {F(0x58), '@', '7'}, // XK_KP_End - {F(0x39), 'k', 'P'}, // XK_KP_Prior - {F(0x60), 'k', 'N'}, // XK_KP_Next - {F(0x49), '&', '8'}, // XK_Undo, keypad 5 + // Keypad keys: + {F(0x48), 'k', 'l'}, // XK_KP_Left + {F(0x4A), 'k', 'r'}, // XK_KP_Right + {F(0x38), 'k', 'u'}, // XK_KP_Up + {F(0x59), 'k', 'd'}, // XK_KP_Down + {F(0x64), 'k', 'I'}, // XK_KP_Insert + {F(0x65), 'k', 'D'}, // XK_KP_Delete + {F(0x37), 'k', 'h'}, // XK_KP_Home + {F(0x58), '@', '7'}, // XK_KP_End + {F(0x39), 'k', 'P'}, // XK_KP_Prior + {F(0x60), 'k', 'N'}, // XK_KP_Next + {F(0x49), '&', '8'}, // XK_Undo, keypad 5 #endif - // End of list marker: - {0, 0, 0} + // End of list marker: + {0, 0, 0} }; #define NUM_SPECIAL_KEYS (sizeof(special_keys)/sizeof(special_keys[0])) // ---------------- VimApp ---------------- - static void + static void docd(BPath &path) { - mch_chdir((char *)path.Path()); - // Do this to get the side effects of a :cd command - do_cmdline_cmd((char_u *)"cd ."); + mch_chdir((char *)path.Path()); + // Do this to get the side effects of a :cd command + do_cmdline_cmd((char_u *)"cd ."); } - static void + static void drop_callback(void *cookie) { // TODO here we could handle going to a specific position in the dropped @@ -660,119 +660,119 @@ drop_callback(void *cookie) } // Really handle dropped files and folders. - static void + static void RefsReceived(BMessage *m, bool changedir) { - uint32 type; - int32 count; + uint32 type; + int32 count; - m->PrintToStream(); - switch (m->what) { - case B_REFS_RECEIVED: - case B_SIMPLE_DATA: - m->GetInfo("refs", &type, &count); - if (type != B_REF_TYPE) - goto bad; - break; - case B_ARGV_RECEIVED: - m->GetInfo("argv", &type, &count); - if (type != B_STRING_TYPE) - goto bad; - if (changedir) { - char *dirname; - if (m->FindString("cwd", (const char **) &dirname) == B_OK) { - chdir(dirname); - do_cmdline_cmd((char_u *)"cd ."); - } - } - break; - default: + m->PrintToStream(); + switch (m->what) { + case B_REFS_RECEIVED: + case B_SIMPLE_DATA: + m->GetInfo("refs", &type, &count); + if (type != B_REF_TYPE) + goto bad; + break; + case B_ARGV_RECEIVED: + m->GetInfo("argv", &type, &count); + if (type != B_STRING_TYPE) + goto bad; + if (changedir) { + char *dirname; + if (m->FindString("cwd", (const char **) &dirname) == B_OK) { + chdir(dirname); + do_cmdline_cmd((char_u *)"cd ."); + } + } + break; + default: bad: - /*fprintf(stderr, "bad!\n"); */ - delete m; - return; - } + /*fprintf(stderr, "bad!\n"); */ + delete m; + return; + } #ifdef FEAT_VISUAL - reset_VIsual(); + reset_VIsual(); #endif - char_u **fnames; - fnames = (char_u **) alloc(count * sizeof(char_u *)); - int fname_index = 0; - - switch (m->what) { - case B_REFS_RECEIVED: - case B_SIMPLE_DATA: - // fprintf(stderr, "case B_REFS_RECEIVED\n"); - for (int i = 0; i < count; ++i) - { - entry_ref ref; - if (m->FindRef("refs", i, &ref) == B_OK) { - BEntry entry(&ref, false); - BPath path; - entry.GetPath(&path); - - // Change to parent directory? - if (changedir) { - BPath parentpath; - path.GetParent(&parentpath); - docd(parentpath); - } - - // Is it a directory? If so, cd into it. - BDirectory bdir(&ref); - if (bdir.InitCheck() == B_OK) { - // don't cd if we already did it - if (!changedir) - docd(path); - } else { - mch_dirname(IObuff, IOSIZE); - char_u *fname = shorten_fname((char_u *)path.Path(), IObuff); - if (fname == NULL) - fname = (char_u *)path.Path(); - fnames[fname_index++] = vim_strsave(fname); - // fprintf(stderr, "%s\n", fname); - } - - // Only do it for the first file/dir - changedir = false; - } - } - break; - case B_ARGV_RECEIVED: - // fprintf(stderr, "case B_ARGV_RECEIVED\n"); - for (int i = 1; i < count; ++i) - { - char *fname; - - if (m->FindString("argv", i, (const char **) &fname) == B_OK) { - fnames[fname_index++] = vim_strsave((char_u *)fname); - } - } - break; - default: - // fprintf(stderr, "case default\n"); - break; - } + char_u **fnames; + fnames = (char_u **) alloc(count * sizeof(char_u *)); + int fname_index = 0; + + switch (m->what) { + case B_REFS_RECEIVED: + case B_SIMPLE_DATA: + // fprintf(stderr, "case B_REFS_RECEIVED\n"); + for (int i = 0; i < count; ++i) + { + entry_ref ref; + if (m->FindRef("refs", i, &ref) == B_OK) { + BEntry entry(&ref, false); + BPath path; + entry.GetPath(&path); + + // Change to parent directory? + if (changedir) { + BPath parentpath; + path.GetParent(&parentpath); + docd(parentpath); + } + + // Is it a directory? If so, cd into it. + BDirectory bdir(&ref); + if (bdir.InitCheck() == B_OK) { + // don't cd if we already did it + if (!changedir) + docd(path); + } else { + mch_dirname(IObuff, IOSIZE); + char_u *fname = shorten_fname((char_u *)path.Path(), IObuff); + if (fname == NULL) + fname = (char_u *)path.Path(); + fnames[fname_index++] = vim_strsave(fname); + // fprintf(stderr, "%s\n", fname); + } + + // Only do it for the first file/dir + changedir = false; + } + } + break; + case B_ARGV_RECEIVED: + // fprintf(stderr, "case B_ARGV_RECEIVED\n"); + for (int i = 1; i < count; ++i) + { + char *fname; + + if (m->FindString("argv", i, (const char **) &fname) == B_OK) { + fnames[fname_index++] = vim_strsave((char_u *)fname); + } + } + break; + default: + // fprintf(stderr, "case default\n"); + break; + } - delete m; + delete m; - // Handle the drop, :edit to get to the file - if (fname_index > 0) { - handle_drop(fname_index, fnames, FALSE, drop_callback, NULL); + // Handle the drop, :edit to get to the file + if (fname_index > 0) { + handle_drop(fname_index, fnames, FALSE, drop_callback, NULL); - setcursor(); - out_flush(); - } else { - vim_free(fnames); - } + setcursor(); + out_flush(); + } else { + vim_free(fnames); + } } VimApp::VimApp(const char *appsig): - BApplication(appsig), - fFilePanelSem(-1), - fFilePanel(NULL) + BApplication(appsig), + fFilePanelSem(-1), + fFilePanel(NULL) { } @@ -780,1073 +780,1073 @@ VimApp::~VimApp() { } - void + void VimApp::ReadyToRun() { - /* - * Apparently signals are inherited by the created thread - - * disable the most annoying ones. - */ - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); + /* + * Apparently signals are inherited by the created thread - + * disable the most annoying ones. + */ + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); } - void + void VimApp::ArgvReceived(int32 arg_argc, char **arg_argv) { - if (!IsLaunching()) { - /* - * This can happen if we are set to Single or Exclusive - * Launch. Be nice and open the file(s). - */ - if (gui.vimWindow) - gui.vimWindow->Minimize(false); - BMessage *m = CurrentMessage(); - DetachCurrentMessage(); - SendRefs(m, true); - } + if (!IsLaunching()) { + /* + * This can happen if we are set to Single or Exclusive + * Launch. Be nice and open the file(s). + */ + if (gui.vimWindow) + gui.vimWindow->Minimize(false); + BMessage *m = CurrentMessage(); + DetachCurrentMessage(); + SendRefs(m, true); + } } - void + void VimApp::RefsReceived(BMessage *m) { - // Horrible hack!!! XXX XXX XXX - // The real problem is that b_start_ffc is set too late for - // the initial empty buffer. As a result the window will be - // split instead of abandoned. - int limit = 15; - while (--limit >= 0 && (curbuf == NULL || curbuf->b_start_ffc == 0)) - snooze(100000); // 0.1 s - if (gui.vimWindow) - gui.vimWindow->Minimize(false); - DetachCurrentMessage(); - SendRefs(m, true); + // Horrible hack!!! XXX XXX XXX + // The real problem is that b_start_ffc is set too late for + // the initial empty buffer. As a result the window will be + // split instead of abandoned. + int limit = 15; + while (--limit >= 0 && (curbuf == NULL || curbuf->b_start_ffc == 0)) + snooze(100000); // 0.1 s + if (gui.vimWindow) + gui.vimWindow->Minimize(false); + DetachCurrentMessage(); + SendRefs(m, true); } /* * Pass a BMessage on to the main() thread. * Caller must have detached the message. */ - void + void VimApp::SendRefs(BMessage *m, bool changedir) { - VimRefsMsg rm; - rm.message = m; - rm.changedir = changedir; + VimRefsMsg rm; + rm.message = m; + rm.changedir = changedir; - write_port(gui.vdcmp, VimMsg::Refs, &rm, sizeof(rm)); - // calls ::RefsReceived + write_port(gui.vdcmp, VimMsg::Refs, &rm, sizeof(rm)); + // calls ::RefsReceived } - void + void VimApp::MessageReceived(BMessage *m) { - switch (m->what) { - case 'save': - { - entry_ref refDirectory; - m->FindRef("directory", &refDirectory); - fBrowsedPath.SetTo(&refDirectory); - BString strName; - m->FindString("name", &strName); - fBrowsedPath.Append(strName.String()); - } - break; - case 'open': - { - entry_ref ref; - m->FindRef("refs", &ref); - fBrowsedPath.SetTo(&ref); - } - break; - case B_CANCEL: - { - BFilePanel *panel; - m->FindPointer("source", (void**)&panel); - if(fFilePanelSem != -1 && panel == fFilePanel) - { - delete_sem(fFilePanelSem); - fFilePanelSem = -1; - } + switch (m->what) { + case 'save': + { + entry_ref refDirectory; + m->FindRef("directory", &refDirectory); + fBrowsedPath.SetTo(&refDirectory); + BString strName; + m->FindString("name", &strName); + fBrowsedPath.Append(strName.String()); + } + break; + case 'open': + { + entry_ref ref; + m->FindRef("refs", &ref); + fBrowsedPath.SetTo(&ref); + } + break; + case B_CANCEL: + { + BFilePanel *panel; + m->FindPointer("source", (void**)&panel); + if (fFilePanelSem != -1 && panel == fFilePanel) + { + delete_sem(fFilePanelSem); + fFilePanelSem = -1; + } - } - break; - default: - |