summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-02 22:49:38 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-02 22:49:38 +0100
commit734a867ffe198886da7365b618be67ab8ed9d9f6 (patch)
treecc650a9ce0b59d7a141bf312b7a724f308d31cea
parenta050b9471c66b383ed674bfd57ac78016199d972 (diff)
downloadvim-git-734a867ffe198886da7365b618be67ab8ed9d9f6.tar.gz
patch 8.1.2383: using old C style commentsv8.1.2383
Problem: Using old C style comments. Solution: Use // comments where appropriate.
-rw-r--r--src/gui_mac.c1397
-rw-r--r--src/gui_motif.c409
-rw-r--r--src/gui_photon.c362
-rw-r--r--src/gui_w32.c1093
-rw-r--r--src/gui_x11.c367
-rw-r--r--src/gui_xmdlg.c110
-rw-r--r--src/gui_xmebw.c118
-rw-r--r--src/version.c2
8 files changed, 1922 insertions, 1936 deletions
diff --git a/src/gui_mac.c b/src/gui_mac.c
index 185cdee28..3dfb939e2 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -28,25 +28,26 @@
*
*/
-/* TODO (Jussi)
+/*
+ * TODO (Jussi)
* * Clipboard does not work (at least some cases)
* * ATSU font rendering has some problems
* * Investigate and remove dead code (there is still lots of that)
*/
-#include <Devices.h> /* included first to avoid CR problems */
+#include <Devices.h> // included first to avoid CR problems
#include "vim.h"
#define USE_CARBONIZED
-#define USE_AEVENT /* Enable AEVENT */
-#undef USE_OFFSETED_WINDOW /* Debugging feature: start Vim window OFFSETed */
+#define USE_AEVENT // Enable AEVENT
+#undef USE_OFFSETED_WINDOW // Debugging feature: start Vim window OFFSETed
-/* Compile as CodeWarrior External Editor */
+// Compile as CodeWarrior External Editor
#if defined(FEAT_CW_EDITOR) && !defined(USE_AEVENT)
-# define USE_AEVENT /* Need Apple Event Support */
+# define USE_AEVENT // Need Apple Event Support
#endif
-/* Vim's Scrap flavor. */
+// Vim's Scrap flavor.
#define VIMSCRAPFLAVOR 'VIM!'
#define SCRAPTEXTFLAVOR kScrapFlavorTypeUnicode
@@ -58,7 +59,7 @@ SInt32 gMacSystemVersion;
static int im_is_active = FALSE;
# if 0
- /* TODO: Implement me! */
+ // TODO: Implement me!
static int im_start_row = 0;
static int im_start_col = 0;
# endif
@@ -86,7 +87,7 @@ static pascal OSStatus gui_mac_unicode_key_event(
#endif
-/* Include some file. TODO: move into os_mac.h */
+// Include some file. TODO: move into os_mac.h
#include <Menus.h>
#include <Resources.h>
#include <Processes.h>
@@ -97,13 +98,13 @@ static pascal OSStatus gui_mac_unicode_key_event(
# include <Gestalt.h>
#if UNIVERSAL_INTERFACES_VERSION >= 0x0330
# include <ControlDefinitions.h>
-# include <Navigation.h> /* Navigation only part of ?? */
+# include <Navigation.h> // Navigation only part of ??
#endif
-/* Help Manager (balloon.h, HM prefixed functions) are not supported
- * under Carbon (Jussi) */
+// Help Manager (balloon.h, HM prefixed functions) are not supported
+// under Carbon (Jussi)
# if 0
-/* New Help Interface for Mac, not implemented yet.*/
+// New Help Interface for Mac, not implemented yet.
# include <MacHelp.h>
# endif
@@ -112,7 +113,7 @@ static pascal OSStatus gui_mac_unicode_key_event(
* headers? (Jussi)
*/
#define kNothing 0
-#define kCreateEmpty 2 /*1*/
+#define kCreateEmpty 2 //1
#define kCreateRect 2
#define kDestroy 3
@@ -123,34 +124,33 @@ static pascal OSStatus gui_mac_unicode_key_event(
#define botRight(r) (((Point*)&(r))[1])
-/* Time of last mouse click, to detect double-click */
+// Time of last mouse click, to detect double-click
static long lastMouseTick = 0;
-/* ??? */
+// ???
static RgnHandle cursorRgn;
static RgnHandle dragRgn;
static Rect dragRect;
static short dragRectEnbl;
static short dragRectControl;
-/* This variable is set when waiting for an event, which is the only moment
- * scrollbar dragging can be done directly. It's not allowed while commands
- * are executed, because it may move the cursor and that may cause unexpected
- * problems (e.g., while ":s" is working).
- */
+// This variable is set when waiting for an event, which is the only moment
+// scrollbar dragging can be done directly. It's not allowed while commands
+// are executed, because it may move the cursor and that may cause unexpected
+// problems (e.g., while ":s" is working).
static int allow_scrollbar = FALSE;
-/* Last mouse click caused contextual menu, (to provide proper release) */
+// Last mouse click caused contextual menu, (to provide proper release)
static short clickIsPopup;
-/* Feedback Action for Scrollbar */
+// Feedback Action for Scrollbar
ControlActionUPP gScrollAction;
ControlActionUPP gScrollDrag;
-/* Keeping track of which scrollbar is being dragged */
+// Keeping track of which scrollbar is being dragged
static ControlHandle dragged_sb = NULL;
-/* Vector of char_u --> control index for hotkeys in dialogs */
+// Vector of char_u --> control index for hotkeys in dialogs
static short *gDialogHotKeys;
static struct
@@ -170,23 +170,23 @@ Boolean gIsFontFallbackSet;
UInt32 useAntialias_cached = 0x0;
#endif
-/* Colors Macros */
+// Colors Macros
#define RGB(r,g,b) ((r) << 16) + ((g) << 8) + (b)
#define Red(c) ((c & 0x00FF0000) >> 16)
#define Green(c) ((c & 0x0000FF00) >> 8)
#define Blue(c) ((c & 0x000000FF) >> 0)
-/* Key mapping */
+// Key mapping
-#define vk_Esc 0x35 /* -> 1B */
+#define vk_Esc 0x35 // -> 1B
-#define vk_F1 0x7A /* -> 10 */
-#define vk_F2 0x78 /*0x63*/
-#define vk_F3 0x63 /*0x76*/
-#define vk_F4 0x76 /*0x60*/
-#define vk_F5 0x60 /*0x61*/
-#define vk_F6 0x61 /*0x62*/
-#define vk_F7 0x62 /*0x63*/ /*?*/
+#define vk_F1 0x7A // -> 10
+#define vk_F2 0x78 //0x63
+#define vk_F3 0x63 //0x76
+#define vk_F4 0x76 //0x60
+#define vk_F5 0x60 //0x61
+#define vk_F6 0x61 //0x62
+#define vk_F7 0x62 //0x63 ?
#define vk_F8 0x64
#define vk_F9 0x65
#define vk_F10 0x6D
@@ -196,26 +196,26 @@ UInt32 useAntialias_cached = 0x0;
#define vk_F14 0x6B
#define vk_F15 0x71
-#define vk_Clr 0x47 /* -> 1B (ESC) */
-#define vk_Enter 0x4C /* -> 03 */
+#define vk_Clr 0x47 // -> 1B (ESC)
+#define vk_Enter 0x4C // -> 03
-#define vk_Space 0x31 /* -> 20 */
-#define vk_Tab 0x30 /* -> 09 */
-#define vk_Return 0x24 /* -> 0D */
-/* This is wrong for OSX, what is it for? */
-#define vk_Delete 0X08 /* -> 08 BackSpace */
+#define vk_Space 0x31 // -> 20
+#define vk_Tab 0x30 // -> 09
+#define vk_Return 0x24 // -> 0D
+// This is wrong for OSX, what is it for?
+#define vk_Delete 0X08 // -> 08 BackSpace
-#define vk_Help 0x72 /* -> 05 */
-#define vk_Home 0x73 /* -> 01 */
-#define vk_PageUp 0x74 /* -> 0D */
-#define vk_FwdDelete 0x75 /* -> 7F */
-#define vk_End 0x77 /* -> 04 */
-#define vk_PageDown 0x79 /* -> 0C */
+#define vk_Help 0x72 // -> 05
+#define vk_Home 0x73 // -> 01
+#define vk_PageUp 0x74 // -> 0D
+#define vk_FwdDelete 0x75 // -> 7F
+#define vk_End 0x77 // -> 04
+#define vk_PageDown 0x79 // -> 0C
-#define vk_Up 0x7E /* -> 1E */
-#define vk_Down 0x7D /* -> 1F */
-#define vk_Left 0x7B /* -> 1C */
-#define vk_Right 0x7C /* -> 1D */
+#define vk_Up 0x7E // -> 1E
+#define vk_Down 0x7D // -> 1F
+#define vk_Left 0x7B // -> 1C
+#define vk_Right 0x7C // -> 1D
#define vk_Undo vk_F1
#define vk_Cut vk_F2
@@ -258,22 +258,22 @@ static struct
{vk_F14, 'F', '4'},
{vk_F15, 'F', '5'},
-/* {XK_Help, '%', '1'}, */
-/* {XK_Undo, '&', '8'}, */
-/* {XK_BackSpace, 'k', 'b'}, */
-/* {vk_Delete, 'k', 'b'}, */
+// {XK_Help, '%', '1'},
+// {XK_Undo, '&', '8'},
+// {XK_BackSpace, 'k', 'b'},
+// {vk_Delete, 'k', 'b'},
{vk_Insert, 'k', 'I'},
{vk_FwdDelete, 'k', 'D'},
{vk_Home, 'k', 'h'},
{vk_End, '@', '7'},
-/* {XK_Prior, 'k', 'P'}, */
-/* {XK_Next, 'k', 'N'}, */
-/* {XK_Print, '%', '9'}, */
+// {XK_Prior, 'k', 'P'},
+// {XK_Next, 'k', 'N'},
+// {XK_Print, '%', '9'},
{vk_PageUp, 'k', 'P'},
{vk_PageDown, 'k', 'N'},
- /* End of list marker: */
+ // End of list marker:
{(KeySym)0, 0, 0}
};
@@ -321,7 +321,7 @@ C2Pascal_save(char_u *Cstring)
len = STRLEN(Cstring);
- if (len > 255) /* Truncate if necessary */
+ if (len > 255) // Truncate if necessary
len = 255;
PascalString = alloc(len + 1);
@@ -351,7 +351,7 @@ C2Pascal_save_and_remove_backslash(char_u *Cstring)
len = STRLEN(Cstring);
- if (len > 255) /* Truncate if necessary */
+ if (len > 255) // Truncate if necessary
len = 255;
PascalString = alloc(len + 1);
@@ -387,8 +387,8 @@ EventModifiers2VimMouseModifiers(EventModifiers macModifiers)
if (macModifiers & (optionKey | rightOptionKey))
vimModifiers |= MOUSE_ALT;
#if 0
- /* Not yet supported */
- if (macModifiers & (cmdKey)) /* There's no rightCmdKey */
+ // Not yet supported
+ if (macModifiers & (cmdKey)) // There's no rightCmdKey
vimModifiers |= MOUSE_CMD;
#endif
return (vimModifiers);
@@ -410,13 +410,14 @@ EventModifiers2VimModifiers(EventModifiers macModifiers)
if (macModifiers & (optionKey | rightOptionKey))
vimModifiers |= MOD_MASK_ALT;
#ifdef USE_CMD_KEY
- if (macModifiers & (cmdKey)) /* There's no rightCmdKey */
+ if (macModifiers & (cmdKey)) // There's no rightCmdKey
vimModifiers |= MOD_MASK_CMD;
#endif
return (vimModifiers);
}
-/* Convert a string representing a point size into pixels. The string should
+/*
+ * Convert a string representing a point size into pixels. The string should
* be a positive decimal number, with an optional decimal point (eg, "12", or
* "10.5"). The pixel value is returned, and a pointer to the next unconverted
* character is stored in *end. The flag "vertical" says whether this
@@ -435,7 +436,7 @@ points_to_pixels(char_u *str, char_u **end, int vertical)
{
if (*str == '.' && divisor == 0)
{
- /* Start keeping a divisor, for later */
+ // Start keeping a divisor, for later
divisor = 1;
continue;
}
@@ -479,8 +480,8 @@ menu_title_removing_mnemonic(vimmenu_T *menu)
if (name)
{
- /* Simple mnemonic-removal algorithm, assumes single parenthesized
- * mnemonic character towards the end of the menu text */
+ // Simple mnemonic-removal algorithm, assumes single parenthesized
+ // mnemonic character towards the end of the menu text
mnemonicStart = CFStringFind(name, CFSTR("("), kCFCompareBackwards);
displayLen = CFStringGetLength(name);
@@ -530,33 +531,33 @@ new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error)
AEKeyword dummyKeyword;
DescType dummyType;
- /* Get number of files in list */
+ // Get number of files in list
*error = AECountItems(theList, numFiles);
if (*error)
return fnames;
- /* Allocate the pointer list */
+ // Allocate the pointer list
fnames = ALLOC_MULT(char_u *, *numFiles);
- /* Empty out the list */
+ // Empty out the list
for (fileCount = 0; fileCount < *numFiles; fileCount++)
fnames[fileCount] = NULL;
- /* Scan the list of FSSpec */
+ // Scan the list of FSSpec
for (fileCount = 1; fileCount <= *numFiles; fileCount++)
{
- /* Get the alias for the nth file, convert to an FSSpec */
+ // Get the alias for the nth file, convert to an FSSpec
newError = AEGetNthPtr(theList, fileCount, typeFSS,
&dummyKeyword, &dummyType,
(Ptr) &fileToOpen, sizeof(FSSpec), &actualSize);
if (newError)
{
- /* Caller is able to clean up */
- /* TODO: Should be clean up or not? For safety. */
+ // Caller is able to clean up
+ // TODO: Should be clean up or not? For safety.
return fnames;
}
- /* Convert the FSSpec to a pathname */
+ // Convert the FSSpec to a pathname
fnames[fileCount - 1] = FullPathFromFSSpec_save(fileToOpen);
}
@@ -595,7 +596,7 @@ new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error)
*/
typedef struct WindowSearch WindowSearch;
-struct WindowSearch /* for handling class 'KAHL', event 'SRCH', keyDirectObject typeChar*/
+struct WindowSearch // for handling class 'KAHL', event 'SRCH', keyDirectObject typeChar
{
FSSpec theFile; // identifies the file
long *theDate; // where to put the modification date/time
@@ -668,7 +669,7 @@ Handle_KAHL_SRCH_AE(
*/
typedef struct ModificationInfo ModificationInfo;
-struct ModificationInfo /* for replying to class 'KAHL', event 'MOD ', keyDirectObject typeAEList*/
+struct ModificationInfo // for replying to class 'KAHL', event 'MOD ', keyDirectObject typeAEList
{
FSSpec theFile; // identifies the file
long theDate; // the date/time the file was last modified
@@ -693,11 +694,11 @@ Handle_KAHL_MOD_AE(
if (error)
return error;
- /* Send the reply */
-/* replyObject.descriptorType = typeNull;
- replyObject.dataHandle = nil;*/
+ // Send the reply
+// replyObject.descriptorType = typeNull;
+// replyObject.dataHandle = nil;
-/* AECreateDesc(typeChar, (Ptr)&title[1], title[0], &data) */
+// AECreateDesc(typeChar, (Ptr)&title[1], title[0], &data)
error = AECreateList(nil, 0, false, &replyList);
if (error)
return error;
@@ -705,22 +706,21 @@ Handle_KAHL_MOD_AE(
#if 0
error = AECountItems(&replyList, &numFiles);
- /* AEPutKeyDesc(&replyList, keyAEPnject, &aDesc)
- * AEPutKeyPtr(&replyList, keyAEPosition, typeChar, (Ptr)&theType,
- * sizeof(DescType))
- */
+ // AEPutKeyDesc(&replyList, keyAEPnject, &aDesc)
+ // AEPutKeyPtr(&replyList, keyAEPosition, typeChar, (Ptr)&theType,
+ // sizeof(DescType))
- /* AEPutDesc */
+ // AEPutDesc
#endif
numFiles = 0;
FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
{
- /* Add this file to the list */
+ // Add this file to the list
theFile.theFile = buf->b_FSSpec;
theFile.theDate = buf->b_mtime;
-/* theFile.theDate = time(NULL) & (time_t) 0xFFFFFFF0; */
+// theFile.theDate = time(NULL) & (time_t) 0xFFFFFFF0;
error = AEPutPtr(&replyList, numFiles, typeChar, (Ptr) &theFile, sizeof(theFile));
};
@@ -728,7 +728,7 @@ Handle_KAHL_MOD_AE(
error = AECountItems(&replyList, &numFiles);
#endif
- /* We can add data only if something to reply */
+ // We can add data only if something to reply
error = AEPutParamDesc(theReply, keyDirectObject, &replyList);
if (replyList.dataHandle)
@@ -764,12 +764,12 @@ Handle_KAHL_MOD_AE(
*/
typedef struct CW_GetText CW_GetText;
-struct CW_GetText /* for handling class 'KAHL', event 'GTTX', keyDirectObject typeChar*/
+struct CW_GetText // for handling class 'KAHL', event 'GTTX', keyDirectObject typeChar
{
- FSSpec theFile; /* identifies the file */
- Handle theText; /* the location where you return the text (must be resized properly) */
- long *unused; /* 0 (not used) */
- long *theDate; /* where to put the modification date/time */
+ FSSpec theFile; // identifies the file
+ Handle theText; // the location where you return the text (must be resized properly)
+ long *unused; // 0 (not used)
+ long *theDate; // where to put the modification date/time
};
pascal OSErr
@@ -806,19 +806,19 @@ Handle_KAHL_GTTX_AE(
if (foundFile)
{
- BufferSize = 0; /* GetHandleSize(GetTextData.theText); */
+ BufferSize = 0; // GetHandleSize(GetTextData.theText);
for (lineno = 0; lineno <= buf->b_ml.ml_line_count; lineno++)
{
- /* Must use the right buffer */
+ // Must use the right buffer
line = ml_get_buf(buf, (linenr_T) lineno, FALSE);
linesize = STRLEN(line) + 1;
lineStart = BufferSize;
BufferSize += linesize;
- /* Resize handle to linesize+1 to include the linefeed */
+ // Resize handle to linesize+1 to include the linefeed
SetHandleSize(GetTextData.theText, BufferSize);
if (GetHandleSize(GetTextData.theText) != BufferSize)
{
- break; /* Simple handling for now */
+ break; // Simple handling for now
}
else
{
@@ -838,7 +838,7 @@ Handle_KAHL_GTTX_AE(
if (foundFile == false)
*GetTextData.theDate = fnfErr;
else
-/* *GetTextData.theDate = time(NULL) & (time_t) 0xFFFFFFF0;*/
+// *GetTextData.theDate = time(NULL) & (time_t) 0xFFFFFFF0;
*GetTextData.theDate = buf->b_mtime;
}
@@ -851,7 +851,9 @@ Handle_KAHL_GTTX_AE(
*
*/
-/* Taken from MoreAppleEvents:ProcessHelpers*/
+/*
+ * Taken from MoreAppleEvents:ProcessHelpers
+ */
pascal OSErr
FindProcessBySignature(
const OSType targetType,
@@ -915,7 +917,7 @@ Send_KAHL_MOD_AE(buf_T *buf)
AEDisposeDesc(&targetAppDesc);
- /* Add the parms */
+ // Add the parms
ModData.theFile = buf->b_FSSpec;
ModData.theDate = buf->b_mtime;
@@ -931,12 +933,12 @@ Send_KAHL_MOD_AE(buf_T *buf)
anErr = AESend(&theEvent, &theReply, sendMode, kAENormalPriority, kNoTimeOut, idleProcUPP, nil);
if (anErr == noErr && sendMode == kAEWaitReply)
{
-/* anErr = AEHGetHandlerError(&theReply);*/
+// anErr = AEHGetHandlerError(&theReply);
}
(void) AEDisposeDesc(&theReply);
}
}
-#endif /* FEAT_CW_EDITOR */
+#endif // FEAT_CW_EDITOR
/*
* ------------------------------------------------------------
@@ -957,13 +959,13 @@ HandleUnusedParms(const AppleEvent *theAEvent)
DescType dummyType;
AEKeyword missedKeyword;
- /* Get the "missed keyword" attribute from the AppleEvent. */
+ // Get the "missed keyword" attribute from the AppleEvent.
error = AEGetAttributePtr(theAEvent, keyMissedKeywordAttr,
typeKeyword, &dummyType,
(Ptr)&missedKeyword, sizeof(missedKeyword),
&actualSize);
- /* If the descriptor isn't found, then we got the required parameters. */
+ // If the descriptor isn't found, then we got the required parameters.
if (error == errAEDescNotFound)
{
error = noErr;
@@ -971,7 +973,7 @@ HandleUnusedParms(const AppleEvent *theAEvent)
else
{
#if 0
- /* Why is this removed? */
+ // Why is this removed?
error = errAEEventNotHandled;
#endif
}
@@ -988,7 +990,7 @@ HandleUnusedParms(const AppleEvent *theAEvent)
*/
typedef struct SelectionRange SelectionRange;
-struct SelectionRange /* for handling kCoreClassEvent:kOpenDocuments:keyAEPosition typeChar */
+struct SelectionRange // for handling kCoreClassEvent:kOpenDocuments:keyAEPosition typeChar
{
short unused1; // 0 (not used)
short lineNum; // line to select (<0 to specify range)
@@ -1005,30 +1007,30 @@ static SelectionRange drop_thePosition;
static void
drop_callback(void *cookie UNUSED)
{
- /* TODO: Handle the goto/select line more cleanly */
+ // TODO: Handle the goto/select line more cleanly
if ((drop_numFiles == 1) & (drop_gotPosition))
{
if (drop_thePosition.lineNum >= 0)
{
lnum = drop_thePosition.lineNum + 1;
- /* oap->motion_type = MLINE;
- setpcmark();*/
+ // oap->motion_type = MLINE;
+ // setpcmark();
if (lnum < 1L)
lnum = 1L;
else if (lnum > curbuf->b_ml.ml_line_count)
lnum = curbuf->b_ml.ml_line_count;
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = 0;
- /* beginline(BL_SOL | BL_FIX);*/
+ // beginline(BL_SOL | BL_FIX);
}
else
goto_byte(drop_thePosition.startRange + 1);
}
- /* Update the screen display */
+ // Update the screen display
update_screen(NOT_VALID);
- /* Select the text if possible */
+ // Select the text if possible
if (drop_gotPosition)
{
VIsual_active = TRUE;
@@ -1047,14 +1049,14 @@ drop_callback(void *cookie UNUSED)
}
}
-/* The IDE uses the optional keyAEPosition parameter to tell the ed-
- itor the selection range. If lineNum is zero or greater, scroll the text
- to the specified line. If lineNum is less than zero, use the values in
- startRange and endRange to select the specified characters. Scroll
- the text to display the selection. If lineNum, startRange, and
- endRange are all negative, there is no selection range specified.
+/*
+ * The IDE uses the optional keyAEPosition parameter to tell the ed-
+ * itor the selection range. If lineNum is zero or greater, scroll the text
+ * to the specified line. If lineNum is less than zero, use the values in
+ * startRange and endRange to select the specified characters. Scroll
+ * the text to display the selection. If lineNum, startRange, and
+ * endRange are all negative, there is no selection range specified.
*/
-
pascal OSErr
HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
{
@@ -1076,7 +1078,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
short gotPosition = false;
long lnum;
- /* the direct object parameter is the list of aliases to files (one or more) */
+ // the direct object parameter is the list of aliases to files (one or more)
error = AEGetParamDesc(theAEvent, keyDirectObject, typeAEList, &theList);
if (error)
return error;
@@ -1111,7 +1113,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
if (error)
{
- /* TODO: empty fnames[] first */
+ // TODO: empty fnames[] first
vim_free(fnames);
return (error);
}
@@ -1122,7 +1124,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
char_u *p;
int fnum = -1;
- /* these are the initial files dropped on the Vim icon */
+ // these are the initial files dropped on the Vim icon
for (i = 0 ; i < numFiles; i++)
{
if (ga_grow(&global_alist.al_ga, 1) == FAIL
@@ -1134,8 +1136,8 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
fnum = GARGLIST[GARGCOUNT - 1].ae_fnum;
}
- /* If the file name was already in the buffer list we need to switch
- * to it. */
+ // If the file name was already in the buffer list we need to switch
+ // to it.
if (curbuf->b_fnum != fnum)
{
char_u cmd[30];
@@ -1144,7 +1146,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
do_cmdline_cmd(cmd);
}
- /* Change directory to the location of the first file. */
+ // Change directory to the location of the first file.
if (GARGCOUNT > 0
&& vim_chdirfile(alist_name(&GARGLIST[0]), "drop") == OK)
shorten_fnames(TRUE);
@@ -1152,7 +1154,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
goto finished;
}
- /* Handle the drop, :edit to get to the file */
+ // Handle the drop, :edit to get to the file
drop_numFiles = numFiles;
drop_gotPosition = gotPosition;
drop_thePosition = thePosition;
@@ -1161,11 +1163,11 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
setcursor();
out_flush();
- /* Fake mouse event to wake from stall */
+ // Fake mouse event to wake from stall
PostEvent(mouseUp, 0);
finished:
- AEDisposeDesc(&theList); /* dispose what we allocated */
+ AEDisposeDesc(&theList); // dispose what we allocated
error = HandleUnusedParms(theAEvent);
return error;
@@ -1174,7 +1176,6 @@ finished:
/*
*
*/
-
pascal OSErr
Handle_aevt_oapp_AE(
const AppleEvent *theAEvent,
@@ -1190,7 +1191,6 @@ Handle_aevt_oapp_AE(
/*
*
*/
-
pascal OSErr
Handle_aevt_quit_AE(
const AppleEvent *theAEvent,
@@ -1203,7 +1203,7 @@ Handle_aevt_quit_AE(
if (error)
return error;
- /* Need to fake a :confirm qa */
+ // Need to fake a :confirm qa
do_cmdline_cmd((char_u *)"confirm qa");
return error;
@@ -1212,7 +1212,6 @@ Handle_aevt_quit_AE(
/*
*
*/
-
pascal OSErr
Handle_aevt_pdoc_AE(
const AppleEvent *theAEvent,
@@ -1253,30 +1252,31 @@ InstallAEHandlers(void)
{
OSErr error;
- /* install open application handler */
+ // install open application handler
error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
NewAEEventHandlerUPP(Handle_aevt_oapp_AE), 0, false);
if (error)
return error;
- /* install quit application handler */
+ // install quit application handler
error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerUPP(Handle_aevt_quit_AE), 0, false);
if (error)
return error;
- /* install open document handler */
+ // install open document handler
error = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
NewAEEventHandlerUPP(HandleODocAE), 0, false);
if (error)
return error;
- /* install print document handler */
+ // install print document handler
error = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
NewAEEventHandlerUPP(Handle_aevt_pdoc_AE), 0, false);
-/* Install Core Suite */
-/* error = AEInstallEventHandler(kAECoreSuite, kAEClone,
+// Install Core Suite
+#if 0
+ error = AEInstallEventHandler(kAECoreSuite, kAEClone,
NewAEEventHandlerUPP(Handle_unknown_AE), nil, false);
error = AEInstallEventHandler(kAECoreSuite, kAEClose,
@@ -1314,7 +1314,7 @@ InstallAEHandlers(void)
error = AEInstallEventHandler(kAECoreSuite, kAESetData,
NewAEEventHandlerUPP(Handle_unknown_AE), nil, false);
-*/
+#endif
#ifdef FEAT_CW_EDITOR
/*
@@ -1335,7 +1335,7 @@ InstallAEHandlers(void)
return error;
}
-#endif /* USE_AEVENT */
+#endif // USE_AEVENT
/*
@@ -1361,7 +1361,7 @@ FontPanelHandler(
FMFontSize newSize;
FMFontStyle newStyle;
- /* Retrieve the font family ID number. */
+ // Retrieve the font family ID number.
status = GetEventParameter(inEvent, kEventParamFMFontFamily,
/*inDesiredType=*/typeFMFontFamily, /*outActualType=*/NULL,
/*inBufferSize=*/sizeof(FMFontFamily), /*outActualSize=*/NULL,
@@ -1369,13 +1369,13 @@ FontPanelHandler(
if (status == noErr)
gFontPanelInfo.family = newFamily;
- /* Retrieve the font size. */
+ // Retrieve the font size.
status = GetEventParameter(inEvent, kEventParamFMFontSize,
typeFMFontSize, NULL, sizeof(FMFontSize), NULL, &newSize);
if (status == noErr)
gFontPanelInfo.size = newSize;
- /* Retrieve the font style (bold, etc.). Currently unused. */
+ // Retrieve the font style (bold, etc.). Currently unused.
status = GetEventParameter(inEvent, kEventParamFMFontStyle,
typeFMFontStyle, NULL, sizeof(FMFontStyle), NULL, &newStyle);
if (status == noErr)
@@ -1390,7 +1390,7 @@ InstallFontPanelHandler(void)
{
EventTypeSpec eventTypes[2];
EventHandlerUPP handlerUPP;
- /* EventHandlerRef handlerRef; */
+ // EventHandlerRef handlerRef;
eventTypes[0].eventClass = kEventClassFont;
eventTypes[0].eventKind = kEventFontSelection;
@@ -1422,20 +1422,20 @@ GetFontPanelSelection(char_u *outName)
if (FMGetFontFamilyName(gFontPanelInfo.family, buf) == noErr)
{
- /* Canonicalize localized font names */
+ // Canonicalize localized font names
if (FMGetFontFromFontFamilyInstance(gFontPanelInfo.family,
gFontPanelInfo.style, &fid, NULL) != noErr)
return;
- /* Request font name with Mac encoding (otherwise we could
- * get an unwanted utf-16 name) */
+ // Request font name with Mac encoding (otherwise we could
+ // get an unwanted utf-16 name)
if (ATSUFindFontName(fid, kFontFullName, kFontMacintoshPlatform,
kFontNoScriptCode, kFontNoLanguageCode,
255, (char *)outName, &fontNameLen, NULL) != noErr)
return;
- /* Only encode font size, because style (bold, italic, etc) is
- * already part of the font full name */
+ // Only encode font size, because style (bold, italic, etc) is
+ // already part of the font full name
vim_snprintf((char *)styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
gFontPanelInfo.size/*,
((gFontPanelInfo.style & bold)!=0 ? ":b" : ""),
@@ -1463,23 +1463,22 @@ GetFontPanelSelection(char_u *outName)
*
* Returns the index inside the menu where
*/
- short /* Should we return MenuItemIndex? */
+ short // Should we return MenuItemIndex?
gui_mac_get_menu_item_index(vimmenu_T *pMenu)
{
short index;
short itemIndex = -1;
vimmenu_T *pBrother;
- /* Only menu without parent are the:
- * -menu in the menubar
- * -popup menu
- * -toolbar (guess)
- *
- * Which are not items anyway.
- */
+ // Only menu without parent are the:
+ // -menu in the menubar
+ // -popup menu
+ // -toolbar (guess)
+ //
+ // Which are not items anyway.
if (pMenu->parent)
{
- /* Start from the Oldest Brother */
+ // Start from the Oldest Brother
pBrother = pMenu->parent->children;
index = 1;
while ((pBrother) && (itemIndex == -1))
@@ -1501,13 +1500,12 @@ gui_mac_get_vim_menu(short menuID, short itemIndex, vimmenu_T *pMenu)
vimmenu_T *pElder = pMenu->parent;
- /* Only menu without parent are the:
- * -menu in the menubar
- * -popup menu
- * -toolbar (guess)
- *
- * Which are not items anyway.
- */
+ // Only menu without parent are the:
+ // -menu in the menubar
+ // -popup menu
+ // -toolbar (guess)
+ //
+ // Which are not items anyway.
if ((pElder) && (pElder->submenu_id == menuID))
{
@@ -1554,12 +1552,12 @@ gui_mac_drag_thumb(ControlHandle theControl, short partCode)
if (sb == NULL)
return;
- /* Need to find value by diff between Old Poss New Pos */
+ // Need to find value by diff between Old Poss New Pos
value = GetControl32BitValue(theControlToUse);
dragging = (partCode != 0);
- /* When "allow_scrollbar" is FALSE still need to remember the new
- * position, but don't actually scroll by setting "dont_scroll". */
+ // When "allow_scrollbar" is FALSE still need to remember the new
+ // position, but don't actually scroll by setting "dont_scroll".
dont_scroll = !allow_scrollbar;
gui_drag_scrollbar(sb, value, dragging);
dont_scroll = dont_scroll_save;
@@ -1569,7 +1567,7 @@ gui_mac_drag_thumb(ControlHandle theControl, short partCode)
void
gui_mac_scroll_action(ControlHandle theControl, short partCode)
{
- /* TODO: have live support */
+ // TODO: have live support
scrollbar_T *sb, *sb_info;
long data;
long value;
@@ -1582,7 +1580,7 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode)
if (sb == NULL)
return;
- if (sb->wp != NULL) /* Left or right scrollbar */
+ if (sb->wp != NULL) // Left or right scrollbar
{
/*
* Careful: need to get scrollbar info out of first (left) scrollbar
@@ -1592,11 +1590,11 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode)
sb_info = &sb->wp->w_scrollbars[0];
if (sb_info->size > 5)
- page = sb_info->size - 2; /* use two lines of context */
+ page = sb_info->size - 2; // use two lines of context
else
page = sb_info->size;
}
- else /* Bottom scrollbar */
+ else // Bottom scrollbar
{
sb_info = sb;
page = curwin->w_width - 5;
@@ -1612,13 +1610,13 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode)
}
value = sb_info->value + data;
-/* if (value > sb_info->max)
- value = sb_info->max;
- else if (value < 0)
- value = 0;*/
+// if (value > sb_info->max)
+// value = sb_info->max;
+// else if (value < 0)
+// value = 0;
- /* When "allow_scrollbar" is FALSE still need to remember the new
- * position, but don't actually scroll by setting "dont_scroll". */
+ // When "allow_scrollbar" is FALSE still need to remember the new
+ // position, but don't actually scroll by setting "dont_scroll".
dont_scroll = !allow_scrollbar;
gui_drag_scrollbar(sb, value, dragging);
dont_scroll = dont_scroll_save;
@@ -1626,7 +1624,8 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode)
out_flush();
gui_mch_set_scrollbar_thumb(sb, value, sb_info->size, sb_info->max);
-/* if (sb_info->wp != NULL)
+#if 0
+ if (sb_info->wp != NULL)
{
win_T *wp;
int sb_num;
@@ -1642,7 +1641,8 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode)
gui_do_scroll();
gui_mch_set_scrollbar_thumb(sb, value, sb_info->size, sb_info->max);
}
- }*/
+ }
+#endif
}
/*
@@ -1676,7 +1676,7 @@ gui_mac_doInContentClick(EventRecord *theEvent, WindowPtr whichWindow)
if (theControl != NUL)
{
- /* We hit a scrollbar */
+ // We hit a scrollbar
if (thePortion != kControlIndicatorPart)
{
@@ -1692,24 +1692,24 @@ gui_mac_doInContentClick(EventRecord *theEvent, WindowPtr whichWindow)
#else
TrackControl(theControl, thePoint, NULL);
#endif
- /* pass 0 as the part to tell gui_mac_drag_thumb, that the mouse
- * button has been released */
- gui_mac_drag_thumb(theControl, 0); /* Should it be thePortion ? (Dany) */
+ // pass 0 as the part to tell gui_mac_drag_thumb, that the mouse
+ // button has been released
+ gui_mac_drag_thumb(theControl, 0); // Should it be thePortion ? (Dany)
dragged_sb = NULL;
}
}
else
{
- /* We are inside the contents */
+ // We are inside the contents
- /* Convert the CTRL, OPTION, SHIFT and CMD key */
+ // Convert the CTRL, OPTION, SHIFT and CMD key
vimModifiers = EventModifiers2VimMouseModifiers(theEvent->modifiers);
- /* Defaults to MOUSE_LEFT as there's only one mouse button */
+ // Defaults to MOUSE_LEFT as there's only one mouse button
vimMouseButton = MOUSE_LEFT;
- /* Convert the CTRL_MOUSE_LEFT to MOUSE_RIGHT */
- /* TODO: NEEDED? */
+ // Convert the CTRL_MOUSE_LEFT to MOUSE_RIGHT
+ // TODO: NEEDED?
clickIsPopup = FALSE;
if (mouse_model_popup() && IsShowContextualMenuClick(theEvent))
@@ -1719,20 +1719,18 @@ gui_mac_doInContentClick(EventRecord *theEvent, WindowPtr whichWindow)
clickIsPopup = TRUE;
}
- /* Is it a double click ? */
+ // Is it a double click ?
dblClick = ((theEvent->when - lastMouseTick) < GetDblTime());
- /* Send the mouse click to Vim */
+ // Send the mouse click to Vim
gui_send_mouse_event(vimMouseButton, thePoint.h,
thePoint.v, dblClick, vimModifiers);
- /* Create the rectangle around the cursor to detect
- * the mouse dragging
- */
+ // Create the rectangle around the cursor to detect
+ // the mouse dragging
#if 0
- /* TODO: Do we need to this even for the contextual menu?
- * It may be require for popup_setpos, but for popup?
- */
+ // TODO: Do we need to this even for the contextual menu?
+ // It may be require for popup_setpos, but for popup?
if (vimMouseButton == MOUSE_LEFT)
#endif
{
@@ -1756,7 +1754,7 @@ gui_mac_doInDragClick(Point where, WindowPtr whichWindow)
Rect movingLimits;
Rect *movingLimitsPtr = &movingLimits;
- /* TODO: may try to prevent move outside screen? */
+ // TODO: may try to prevent move outside screen?
movingLimitsPtr = GetRegionBounds(GetGrayRgn(), &movingLimits);
DragWindow(whichWindow, where, movingLimitsPtr);
}
@@ -1777,8 +1775,8 @@ gui_mac_doInGrowClick(Point where, WindowPtr whichWindow)
resizeLimitsPtr = GetRegionBounds(GetGrayRgn(), &resizeLimits);
- /* Set the minimum size */
- /* TODO: Should this come from Vim? */
+ // Set the minimum size
+ // TODO: Should this come from Vim?
resizeLimits.top = 100;
resizeLimits.left = 100;
@@ -1800,13 +1798,13 @@ gui_mac_doInZoomClick(EventRecord *theEvent, WindowPtr whichWindow)
Point p;
short thePart;
- /* ideal width is current */
+ // ideal width is current
p.h = Columns * gui.char_width + 2 * gui.border_offset;
if (gui.which_scrollbars[SBAR_LEFT])
p.h += gui.scrollbar_width;
if (gui.which_scrollbars[SBAR_RIGHT])
p.h += gui.scrollbar_width;
- /* ideal height is as high as we can get */
+ // ideal height is as high as we can get
p.v = 15 * 1024;
thePart = IsWindowInStandardState(whichWindow, &p, &r)
@@ -1815,9 +1813,9 @@ gui_mac_doInZoomClick(EventRecord *theEvent, WindowPtr whichWindow)
if (!TrackBox(whichWindow, theEvent->where, thePart))
return;
- /* use returned width */
+ // use returned width
p.h = r.right - r.left;
- /* adjust returned height */
+ // adjust returned height
p.v = r.bottom - r.top - 2 * gui.border_offset;
if (gui.which_scrollbars[SBAR_BOTTOM])
p.v -= gui.scrollbar_height;
@@ -1861,46 +1859,42 @@ gui_mac_doUpdateEvent(EventRecord *event)
if (updateRgn == NULL)
return;
- /* This could be done by the caller as we
- * don't require anything else out of the event
- */
+ // This could be done by the caller as we
+ // don't require anything else out of the event
whichWindow = (WindowPtr) event->message;
- /* Save Current Port */
+ // Save Current Port
GetPort(&savePort);
- /* Select the Window's Port */
+ // Select the Window's Port
SetPortWindowPort(whichWindow);
- /* Let's update the window */
+ // Let's update the window
BeginUpdate(whichWindow);
- /* Redraw the biggest rectangle covering the area
- * to be updated.
- */
+ // Redraw the biggest rectangle covering the area
+ // to be updated.
GetPortVisibleRegion(GetWindowPort(whichWindow), updateRgn);
# if 0
- /* Would be more appropriate to use the following but doesn't
- * seem to work under MacOS X (Dany)
- */
+ // Would be more appropriate to use the following but doesn't
+ // seem to work under MacOS X (Dany)
GetWindowRegion(whichWindow, kWindowUpdateRgn, updateRgn);
# endif
- /* Use the HLock useless in Carbon? Is it harmful?*/
+ // Use the HLock useless in Carbon? Is it harmful?
HLock((Handle) updateRgn);
updateRectPtr = GetRegionBounds(updateRgn, &updateRect);
# if 0
- /* Code from original Carbon Port (using GetWindowRegion.
- * I believe the UpdateRgn is already in local (Dany)
- */
- GlobalToLocal(&topLeft(updateRect)); /* preCarbon? */
+ // Code from original Carbon Port (using GetWindowRegion.
+ // I believe the UpdateRgn is already in local (Dany)
+ GlobalToLocal(&topLeft(updateRect)); // preCarbon?
GlobalToLocal(&botRight(updateRect));
# endif
- /* Update the content (i.e. the text) */
+ // Update the content (i.e. the text)
gui_redraw(updateRectPtr->left, updateRectPtr->top,
updateRectPtr->right - updateRectPtr->left,
updateRectPtr->bottom - updateRectPtr->top);
- /* Clear the border areas if needed */
+ // Clear the border areas if needed
gui_mch_set_bg_color(gui.back_pixel);
if (updateRectPtr->left < FILL_X(0))
{
@@ -1927,11 +1921,11 @@ gui_mac_doUpdateEvent(EventRecord *event)
HUnlock((Handle) updateRgn);
DisposeRgn(updateRgn);
- /* Update scrollbars */
+ // Update scrollbars
DrawControls(whichWindow);
- /* Update the GrowBox */
- /* Taken from FAQ 33-27 */
+ // Update the GrowBox
+ // Taken from FAQ 33-27
saveRgn = NewRgn();
GetWindowBounds(whichWindow, kWindowGrowRgn, &growRect);
GetClip(saveRgn);
@@ -1941,7 +1935,7 @@ gui_mac_doUpdateEvent(EventRecord *event)
DisposeRgn(saveRgn);
EndUpdate(whichWindow);
- /* Restore original Port */
+ // Restore original Port
SetPort(savePort);
}
@@ -1955,7 +1949,7 @@ gui_mac_doActivateEvent(EventRecord *event)
WindowPtr whichWindow;
whichWindow = (WindowPtr) event->message;
- /* Dim scrollbars */
+ // Dim scrollbars
if (whichWindow == gui.VimWindow)
{
ControlRef rootControl;
@@ -1966,7 +1960,7 @@ gui_mac_doActivateEvent(EventRecord *event)
DeactivateControl(rootControl);
}
- /* Activate */
+ // Activate
gui_focus_change((event->modifiers) & activeFlag);
}
@@ -1978,20 +1972,18 @@ gui_mac_doActivateEvent(EventRecord *event)
void
gui_mac_doSuspendEvent(EventRecord *event)
{
- /* The frontmost application just changed */
+ // The frontmost application just changed
- /* NOTE: the suspend may happen before the deactivate
- * seen on MacOS X
- */
+ // NOTE: the suspend may happen before the deactivate
+ // seen on MacOS X
- /* May not need to change focus as the window will
- * get an activate/deactivate event
- */
+ // May not need to change focus as the window will
+ // get an activate/deactivate event
if (event->message & 1)
- /* Resume */
+ // Resume
gui_focus_change(TRUE);
else
- /* Suspend */
+ // Suspend
gui_focus_change(FALSE);
}
@@ -2068,8 +2060,8 @@ OSStatus gui_mac_update_input_area(
return eventNotHandledErr;
}
-static int dialog_busy = FALSE; /* TRUE when gui_mch_dialog() wants the
- keys */
+static int dialog_busy = FALSE; // TRUE when gui_mch_dialog() wants the
+ // keys
# define INLINE_KEY_BUFFER_SIZE 80
static pascal OSStatus
@@ -2077,7 +2069,7 @@ gui_mac_unicode_key_event(
EventHandlerCallRef nextHandler,
EventRef theEvent)
{
- /* Multibyte-friendly key event handler */
+ // Multibyte-friendly key event handler
OSStatus err = -1;
UInt32 actualSize;
UniChar *text;
@@ -2093,11 +2085,11 @@ gui_mac_unicode_key_event(
int i;
EventRef keyEvent;
- /* Mask the mouse (as per user setting) */
+ // Mask the mouse (as per user setting)
if (p_mh)
ObscureCursor();
- /* Don't use the keys when the dialog wants them. */
+ // Don't use the keys when the dialog wants them.
if (dialog_busy)
return eventNotHandledErr;
@@ -2131,13 +2123,13 @@ gui_mac_unicode_key_event(
#ifndef USE_CMD_KEY
if (modifiers & cmdKey)
- goto done; /* Let system handle Cmd+... */
+ goto done; // Let system handle Cmd+...
#endif
key_char = charcode;
vimModifiers = EventModifiers2VimModifiers(modifiers);
- /* Find the special key (eg., for cursor keys) */
+ // Find the special key (eg., for cursor keys)
if (actualSize <= sizeof(UniChar) &&
((text[0] < 0x20) || (text[0] == 0x7f)))
{
@@ -2153,30 +2145,30 @@ gui_mac_unicode_key_event(
}
}
- /* Intercept CMD-. and CTRL-c */
+ // Intercept CMD-. and CTRL-c
if (((modifiers & controlKey) && key_char == 'c') ||
((modifiers & cmdKey) && key_char == '.'))
got_int = TRUE;
if (!isSpecial)
{
- /* remove SHIFT for keys that are already shifted, e.g.,
- * '(' and '*' */
+ // remove SHIFT for keys that are already shifted, e.g.,
+ // '(' and '*'
if (key_char < 0x100 && !isalpha(key_char) && isprint(key_char))
vimModifiers &= ~MOD_MASK_SHIFT;
- /* remove CTRL from keys that already have it */
+ // remove CTRL from keys that already have it
if (key_char < 0x20)
vimModifiers &= ~MOD_MASK_CTRL;
- /* don't process unicode characters here */
+ // don't process unicode characters here
if (!IS_SPECIAL(key_char))
{
- /* Following code to simplify and consolidate vimModifiers
- * taken liberally from gui_w48.c */
+ // Following code to simplify and consolidate vimModifiers
+ // taken liberally from gui_w48.c
key_char = simplify_key(key_char, (int *)&vimModifiers);
- /* Interpret META, include SHIFT, etc. */
+ // Interpret META, include SHIFT, etc.
key_char = extract_modifiers(key_char, (int *)&vimModifiers,
TRUE, NULL);
if (key_char == CSI)
@@ -2206,7 +2198,7 @@ gui_mac_unicode_key_event(
to = mac_utf16_to_enc(text, actualSize, &encLen);
if (to)
{
- /* This is basically add_to_input_buf_csi() */
+ // This is basically add_to_input_buf_csi()
for (i = 0; i < encLen && len < (INLINE_KEY_BUFFER_SIZE-1); ++i)
{
result[len++] = to[i];
@@ -2227,8 +2219,8 @@ done:
vim_free(text);
if (err == noErr)
{
- /* Fake event to wake up WNE (required to get
- * key repeat working */
+ // Fake event to wake up WNE (required to get
+ // key repeat working
PostEvent(keyUp, 0);
return noErr;
}
@@ -2239,7 +2231,7 @@ done:
void
gui_mac_doKeyEvent(EventRecord *theEvent)
{
- /* TODO: add support for COMMAND KEY */
+ // TODO: add support for COMMAND KEY
long menu;
unsigned char string[20];
short num, i;
@@ -2249,16 +2241,16 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
int modifiers;
int simplify = FALSE;
- /* Mask the mouse (as per user setting) */
+ // Mask the mouse (as per user setting)
if (p_mh)
ObscureCursor();
- /* Get the key code and its ASCII representation */
+ // Get the key code and its ASCII representation
key_sym = ((theEvent->message & keyCodeMask) >> 8);
key_char = theEvent->message & charCodeMask;
num = 1;
- /* Intercept CTRL-C */
+ // Intercept CTRL-C
if (theEvent->modifiers & controlKey)
{
if (key_char == Ctrl_C && ctrl_c_interrupts)
@@ -2266,7 +2258,7 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
else if ((theEvent->modifiers & ~(controlKey|shiftKey)) == 0
&& (key_char == '2' || key_char == '6'))
{
- /* CTRL-^ and CTRL-@ don't work in the normal way. */
+ // CTRL-^ and CTRL-@ don't work in the normal way.
if (key_char == '2')
key_char = Ctrl_AT;
else
@@ -2275,16 +2267,16 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
}
}
- /* Intercept CMD-. */
+ // Intercept CMD-.
if (theEvent->modifiers & cmdKey)
if (key_char == '.')
got_int = TRUE;
- /* Handle command key as per menu */
- /* TODO: should override be allowed? Require YAO or could use 'winaltkey' */
+ // Handle command key as per menu
+ // TODO: should override be allowed? Require YAO or could use 'winaltkey'
if (theEvent->modifiers & cmdKey)
- /* Only accept CMD alone or with CAPLOCKS and the mouse button.
- * Why the mouse button? */
+ // Only accept CMD alone or with CAPLOCKS and the mouse button.
+ // Why the mouse button?
if ((theEvent->modifiers & (~(cmdKey | btnState | alphaLock))) == 0)
{
menu = MenuKey(key_char);
@@ -2295,23 +2287,23 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
}
}
- /* Convert the modifiers */
+ // Convert the modifiers
modifiers = EventModifiers2VimModifiers(theEvent->modifiers);
- /* Handle special keys. */
+ // Handle special keys.
#if 0
- /* Why has this been removed? */
+ // Why has this been removed?
if (!(theEvent->modifiers & (cmdKey | controlKey | rightControlKey)))
#endif
{
- /* Find the special key (for non-printable keyt_char) */
+ // Find the special key (for non-printable keyt_char)
if ((key_char < 0x20) || (key_char == 0x7f))
for (i = 0; special_keys[i].key_sym != (KeySym)0; i++)
if (special_keys[i].key_sym == key_sym)
{
# if 0
- /* We currently don't have not so special key */
+ // We currently don't have not so special key
if (special_keys[i].vim_code1 == NUL)
key_char = special_keys[i].vim_code0;
else
@@ -2323,12 +2315,12 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
}
}
- /* For some keys the modifier is included in the char itself. */
+ // For some keys the modifier is included in the char itself.
if (simplify || key_char == TAB || key_char == ' ')
key_char = simplify_key(key_char, &modifiers);
- /* Add the modifier to the input bu if needed */
- /* Do not want SHIFT-A or CTRL-A with modifier */
+ // Add the modifier to the input bu if needed
+ // Do not want SHIFT-A or CTRL-A with modifier
if (!IS_SPECIAL(key_char)
&& key_sym != vk_Space
&& key_sym != vk_Tab
@@ -2337,7 +2329,7 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
&& key_sym != vk_Esc)
{
#if 1
- /* Clear modifiers when only one modifier is set */
+ // Clear modifiers when only one modifier is set
if ((modifiers == MOD_MASK_SHIFT)
|| (modifiers == MOD_MASK_CTRL)
|| (modifiers == MOD_MASK_ALT))
@@ -2366,8 +2358,8 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
}
else
{
- /* Convert characters when needed (e.g., from MacRoman to latin1).
- * This doesn't work for the NUL byte. */
+ // Convert characters when needed (e.g., from MacRoman to latin1).
+ // This doesn't work for the NUL byte.
if (input_conv.vc_type != CONV_NONE && key_char > 0)
{
char_u from[2], *to;
@@ -2400,7 +2392,7 @@ gui_mac_doKeyEvent(EventRecord *theEvent)
if (len == 1 && string[0] == CSI)
{
- /* Turn CSI into K_CSI. */
+ // Turn CSI into K_CSI.
string[ len++ ] = KS_EXTRA;
string[ len++ ] = KE_CSI;
}
@@ -2421,8 +2413,8 @@ gui_mac_doMouseDownEvent(EventRecord *theEvent)
thePart = FindWindow(theEvent->where, &whichWindow);
#ifdef FEAT_GUI_TABLINE
- /* prevent that the vim window size changes if it's activated by a
- click into the tab pane */
+ // prevent that the vim window size changes if it's activated by a
+ // click into the tab pane
if (whichWindow == drawer)
return;
#endif
@@ -2430,7 +2422,7 @@ gui_mac_doMouseDownEvent(EventRecord *theEvent)
switch (thePart)
{
case (inDesk):
- /* TODO: what to do? */
+ // TODO: what to do?
break;
case (inMenuBar):
@@ -2482,7 +2474,7 @@ gui_mac_doMouseMovedEvent(EventRecord *event)
gui_send_mouse_event(MOUSE_DRAG, thePoint.h,
thePoint.v, FALSE, vimModifiers);
- /* Reset the region from which we move in and out */
+ // Reset the region from which we move in and out
SetRect(&dragRect, FILL_X(X_2_COL(thePoint.h)),
FILL_Y(Y_2_ROW(thePoint.v)),
FILL_X(X_2_COL(thePoint.h)+1),
@@ -2502,8 +2494,8 @@ gui_mac_doMouseUpEvent(EventRecord *theEvent)
Point thePoint;
int_u vimModifiers;
- /* TODO: Properly convert the Contextual menu mouse-up */
- /* Potential source of the double menu */
+ // TODO: Properly convert the Contextual menu mouse-up
+ // Potential source of the double menu
lastMouseTick = theEvent->when;
dragRectEnbl = FALSE;
dragRectControl = kCreateEmpty;
@@ -2533,7 +2525,7 @@ gui_mac_mouse_wheel(EventHandlerCallRef nextHandler, EventRef theEvent,
if (noErr == GetEventParameter(theEvent, kEventParamMouseWheelAxis,
typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis)
&& axis != kEventMouseWheelAxisY)
- goto bail; /* Vim only does up-down scrolling */
+ goto bail; // Vim only does up-down scrolling
if (noErr != GetEventParameter(theEvent, kEventParamMouseWheelDelta,
typeSInt32, NULL, sizeof(SInt32), NULL, &delta))
@@ -2562,7 +2554,7 @@ gui_mac_mouse_wheel(EventHandlerCallRef nextHandler, EventRef theEvent,
gui_send_mouse_event((delta > 0) ? MOUSE_4 : MOUSE_5,
point.h, point.v, FALSE, vim_mod);
- /* post a bogus event to wake up WaitNextEvent */
+ // post a bogus event to wake up WaitNextEvent
PostEvent(keyUp, 0);
return noErr;
@@ -2578,7 +2570,7 @@ bail:
void
gui_mch_mousehide(int hide)
{
- /* TODO */
+ // TODO
}
#if 0
@@ -2605,14 +2597,14 @@ gui_mac_handle_contextual_menu(EventRecord *event)
if (CntxType == kCMMenuItemSelected)
{
- /* Handle the menu CntxMenuID, CntxMenuItem */
- /* The submenu can be handle directly by gui_mac_handle_menu */
- /* But what about the current menu, is the many changed by ContextualMenuSelect */
+ // Handle the menu CntxMenuID, CntxMenuItem
+ // The submenu can be handle directly by gui_mac_handle_menu
+ // But what about the current menu, is the many changed by ContextualMenuSelect
gui_mac_handle_menu((CntxMenuID << 16) + CntxMenuItem);
}
else if (CntxMenuID == kCMShowHelpSelected)
{
- /* Should come up with the help */
+ // Should come up with the help
}
}
@@ -2628,10 +2620,10 @@ gui_mac_handle_menu(long menuChoice)
short item = LoWord(menuChoice);
vimmenu_T *theVimMenu = root_menu;
- if (menu == 256) /* TODO: use constant or gui.xyz */
+ if (menu == 256) // TODO: use constant or gui.xyz
{
if (item == 1)
- gui_mch_beep(); /* TODO: Popup dialog or do :intro */
+ gui_mch_beep(); // TODO: Popup dialog or do :intro
}
else if (item != 0)
{
@@ -2652,7 +2644,7 @@ gui_mac_handle_event(EventRecord *event)
{
OSErr error;
- /* Handle contextual menu right now (if needed) */
+ // Handle contextual menu right now (if needed)
if (IsShowContextualMenuClick(event))
{
# if 0
@@ -2663,7 +2655,7 @@ gui_mac_handle_event(EventRecord *event)
return;
}
- /* Handle normal event */
+ // Handle normal event
switch (event->what)
{
#ifndef USE_CARBONKEYHANDLER
@@ -2673,7 +2665,7 @@ gui_mac_handle_event(EventRecord *event)
break;
#endif
case (keyUp):
- /* We don't care about when the key is released */
+ // We don't care about when the key is released
break;
case (mouseDown):
@@ -2689,7 +2681,7 @@ gui_mac_handle_event(EventRecord *event)
break;
case (diskEvt):
- /* We don't need special handling for disk insertion */
+ // We don't need special handling for disk insertion
break;
case (activateEvt):
@@ -2699,10 +2691,10 @@ gui_mac_handle_event(EventRecord *event)
case (osEvt):
switch ((event->message >> 24) & 0xFF)
{
- case (0xFA): /* mouseMovedMessage */
+ case (0xFA): // mouseMovedMessage
gui_mac_doMouseMovedEvent(event);
break;
- case (0x01): /* suspendResumeMessage */
+ case (0x01): // suspendResumeMessage
gui_mac_doSuspendEvent(event);
break;
}
@@ -2710,8 +2702,8 @@ gui_mac_handle_event(EventRecord *event)
#ifdef USE_AEVENT
case (kHighLevelEvent):
- /* Someone's talking to us, through AppleEvents */
- error = AEProcessAppleEvent(event); /* TODO: Error Handling */
+ // Someone's talking to us, through AppleEvents
+ error = AEProcessAppleEvent(event); // TODO: Error Handling
break;
#endif
}
@@ -2749,7 +2741,7 @@ gui_mac_find_font(char_u *font_name)
pFontName[0] = STRLEN(font_name);
*p = c;
- /* Get the font name, minus the style suffix (:h, etc) */
+ // Get the font name, minus the style suffix (:h, etc)
char_u fontName[256];
char_u *styleStart = vim_strchr(font_name, ':');
size_t fontNameLen = styleStart ? styleStart - font_name : STRLEN(fontName);
@@ -2795,7 +2787,7 @@ gui_mac_find_font(char_u *font_name)
}
#else
- /* name = C2Pascal_save(menu->dname); */
+ // name = C2Pascal_save(menu->dname);
fontNamePtr = C2Pascal_save_and_remove_backslash(font_name);
GetFNum(fontNamePtr, &font_id);
@@ -2804,7 +2796,7 @@ gui_mac_find_font(char_u *font_name)
if (font_id == 0)
{
- /* Oups, the system font was it the one the user want */
+ // Oups, the system font was it the one the user want
if (FMGetFontFamilyName(systemFont, systemFontname) != noErr)
return NOFONT;
@@ -2814,7 +2806,7 @@ gui_mac_find_font(char_u *font_name)
if (*p == ':')
{
p++;
- /* Set the values found after ':' */
+ // Set the values found after ':'
while (*p)
{
switch (*p++)
@@ -2832,7 +2824,7 @@ gui_mac_find_font(char_u *font_name)
}
if (size < 1)
- size = 1; /* Avoid having a size of 0 with system font */
+ size = 1; // Avoid having a size of 0 with system font
font = (size << 16) + ((long) font_id & 0xFFFF);
@@ -2853,7 +2845,7 @@ gui_mac_find_font(char_u *font_name)
void
gui_mch_prepare(int *argc, char **argv)
{
- /* TODO: Move most of this stuff toward gui_mch_init */
+ // TODO: Move most of this stuff toward gui_mch_init
#ifdef USE_EXE_NAME
FSSpec applDir;
# ifndef USE_FIND_BUNDLE_PATH
@@ -2875,7 +2867,7 @@ gui_mch_prepare(int *argc, char **argv)
(void) InstallAEHandlers();
#endif
- pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
+ pomme = NewMenu(256, "\p\024"); // 0x14= = Apple Menu
AppendMenu(pomme, "\pAbout VIM");
@@ -2901,7 +2893,7 @@ gui_mch_prepare(int *argc, char **argv)
gui.char_ascent = 6;
gui.num_rows = 24;
gui.num_cols = 80;
- gui.in_focus = TRUE; /* For the moment -> syn. of front application */
+ gui.in_focus = TRUE; // For the moment -> syn. of front application
gScrollAction = NewControlActionUPP(gui_mac_scroll_action);
gScrollDrag = NewControlActionUPP(gui_mac_drag_thumb);
@@ -2914,21 +2906,20 @@ gui_mch_prepare(int *argc, char **argv)
#ifdef USE_EXE_NAME
# ifndef USE_FIND_BUNDLE_PATH
HGetVol(volName, &applVRefNum, &applDirID);
- /* TN2015: mention a possible bad VRefNum */
+ // TN2015: mention a possible bad VRefNum
FSMakeFSSpec(applVRefNum, applDirID, "\p", &applDir);
# else
- /* OSErr GetApplicationBundleFSSpec(FSSpecPtr theFSSpecPtr)
- * of TN2015
- */
+ // OSErr GetApplicationBundleFSSpec(FSSpecPtr theFSSpecPtr)
+ // of TN2015
(void)GetCurrentProcess(&psn);
- /* if (err != noErr) return err; */
+ // if (err != noErr) return err;
(void)GetProcessBundleLocation(&psn, &applFSRef);
- /* if (err != noErr) return err; */
+ // if (err != noErr) return err;
(void)FSGetCatalogInfo(&applFSRef, kFSCatInfoNone, NULL, NULL, &applDir, NULL);
- /* This technic return NIL when we disallow_gui */
+ // This technic return NIL when we disallow_gui
# endif
exe_name = FullPathFromFSSpec_save(applDir);
#endif
@@ -2942,10 +2933,9 @@ gui_mch_prepare(int *argc, char **argv)
int
gui_mch_init_check(void)
{
- /* TODO: For MacOS X find a way to return FAIL, if the user logged in
- * using the >console
- */
- if (disallow_gui) /* see main.c for reason to disallow */
+ // TODO: For MacOS X find a way to return FAIL, if the user logged in
+ // using the >console
+ if (disallow_gui) // see main.c for reason to disallow
return FAIL;
return OK;
}
@@ -2960,7 +2950,7 @@ receiveHandler(WindowRef theWindow, void *handlerRefCon, DragRef theDrag)
int count;
int i, j;
- /* Get drop position, modifiers and count of items */
+ // Get drop position, modifiers and count of items
{
Point point;
SInt16 mouseUpModifiers;
@@ -2980,7 +2970,7 @@ receiveHandler(WindowRef theWindow, void *handlerRefCon, DragRef theDrag)
if (fnames == NULL)
return dragNotAcceptedErr;
- /* Get file names dropped */
+ // Get file names dropped
for (i = j = 0; i < count; ++i)
{
DragItemRef item;
@@ -3003,7 +2993,7 @@ receiveHandler(WindowRef theWindow, void *handlerRefCon, DragRef theDrag)
gui_handle_drop(x, y, modifiers, fnames, count);
- /* Fake mouse event to wake from stall */
+ // Fake mouse event to wake from stall
PostEvent(mouseUp, 0);
return noErr;
@@ -3016,7 +3006,7 @@ receiveHandler(WindowRef theWindow, void *handlerRefCon, DragRef theDrag)
int
gui_mch_init(void)
{
- /* TODO: Move most of this stuff toward gui_mch_init */
+ // TODO: Move most of this stuff toward gui_mch_init
Rect windRect;
MenuHandle pomme;
EventHandlerRef mouseWheelHandlerRef;
@@ -3024,7 +3014,7 @@ gui_mch_init(void)
ControlRef rootControl;
if (Gestalt(gestaltSystemVersion, &gMacSystemVersion) != noErr)
- gMacSystemVersion = 0x1000; /* TODO: Default to minimum sensible value */
+ gMacSystemVersion = 0x1000; // TODO: Default to minimum sensible value
#if 1
InitCursor();
@@ -3035,7 +3025,7 @@ gui_mch_init(void)
(void) InstallAEHandlers();
#endif
- pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
+ pomme = NewMenu(256, "\p\024"); // 0x14= = Apple Menu
AppendMenu(pomme, "\pAbout VIM");
@@ -3063,12 +3053,12 @@ gui_mch_init(void)
gui.char_ascent = 6;
gui.num_rows = 24;
gui.num_cols = 80;
- gui.in_focus = TRUE; /* For the moment -> syn. of front application */
+ gui.in_focus = TRUE; // For the moment -> syn. of front application
gScrollAction = NewControlActionUPP(gui_mac_scroll_action);
gScrollDrag = NewControlActionUPP(gui_mac_drag_thumb);
- /* Install Carbon event callbacks. */
+ // Install Carbon event callbacks.
(void)InstallFontPanelHandler();
dragRectEnbl = FALSE;
@@ -3076,16 +3066,16 @@ gui_mch_init(void)
dragRectControl = kCreateEmpty;
cursorRgn = NewRgn();
#endif
- /* Display any pending error messages */
+ // Display any pending error messages
display_errors();
- /* Get background/foreground colors from system */
- /* TODO: do the appropriate call to get real defaults */
+ // Get background/foreground colors from system
+ // TODO: do the appropriate call to get real defaults
gui.norm_pixel = 0x00000000;
gui.back_pixel = 0x00FFFFFF;
- /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc
- * file). */
+ // Get the colors from the "Normal" group (set in syntax.c or in a vimrc
+ // file).
set_normal_colors();
/*
@@ -3096,8 +3086,8 @@ gui_mch_init(void)
gui.def_norm_pixel = gui.norm_pixel;
gui.def_back_pixel = gui.back_pixel;
- /* Get the colors for the highlight groups (gui_check_colors() might have
- * changed them) */
+ // Get the colors for the highlight groups (gui_check_colors() might have
+ // changed them)
highlight_gui_started();
/*
@@ -3106,11 +3096,11 @@ gui_mch_init(void)
#ifdef FEAT_MENU
gui.menu_height = 0;
#endif
- gui.scrollbar_height = gui.scrollbar_width = 15; /* cheat 1 overlap */
+ gui.scrollbar_height = gui.scrollbar_width = 15; // cheat 1 overlap
gui.border_offset = gui.border_width = 2;
- /* If Quartz-style text anti aliasing is available (see
- gui_mch_draw_string() below), enable it for all font sizes. */
+ // If Quartz-style text anti aliasing is available (see
+ // gui_mch_draw_string() below), enable it for all font sizes.
vim_setenv((char_u *)"QDTEXT_MINSIZE", (char_u *)"1");
eventTypeSpec.eventClass = kEventClassMouse;
@@ -3128,10 +3118,10 @@ gui_mch_init(void)
InterfaceTypeList supportedServices = { kUnicodeDocument };
NewTSMDocument(1, supportedServices, &gTSMDocument, 0);
- /* We don't support inline input yet, use input window by default */
+ // We don't support inline input yet, use input window by default
UseInputWindow(gTSMDocument, TRUE);
- /* Should we activate the document by default? */
+ // Should we activate the document by default?
// ActivateTSMDocument(gTSMDocument);
EventTypeSpec textEventTypes[] = {
@@ -3155,8 +3145,8 @@ gui_mch_init(void)
{ kEventClassWindow, kEventWindowDeactivated },
};
- /* Install window event handler to support TSMDocument activate and
- * deactivate */
+ // Install window event handler to support TSMDocument activate and
+ // deactivate
winEventHandlerUPP = NewEventHandlerUPP(gui_mac_handle_window_activate);
if (noErr != InstallWindowEventHandler(gui.VimWindow,
winEventHandlerUPP,
@@ -3175,7 +3165,7 @@ gui_mch_init(void)
initialise_tabline();
#endif
- /* TODO: Load bitmap if using TOOLBAR */
+ // TODO: Load bitmap if using TOOLBAR
return OK;
}
@@ -3185,10 +3175,9 @@ gui_mch_init(void)
void
gui_mch_new_colors(void)
{
- /* TODO:
- * This proc is called when Normal is set to a value
- * so what must be done? I don't know
- */
+ // TODO:
+ // This proc is called when Normal is set to a value
+ // so what must be done? I don't know
}
/*
@@ -3229,7 +3218,7 @@ gui_mac_dispose_atsui_style(void)
void
gui_mch_exit(int rc)
{
- /* TODO: find out all what is missing here? */
+ // TODO: find out all what is missing here?
DisposeRgn(cursorRgn);
#ifdef USE_CARBONKEYHANDLER
@@ -3250,7 +3239,7 @@ gui_mch_exit(int rc)
DeleteTSMDocument(gTSMDocument);
#endif
- /* Exit to shell? */
+ // Exit to shell?
exit(rc);
}
@@ -3260,11 +3249,11 @@ gui_mch_exit(int rc)
int
gui_mch_get_winpos(int *x, int *y)
{
- /* TODO */
+ // TODO
Rect bounds;
OSStatus status;
- /* Carbon >= 1.0.2, MacOS >= 8.5 */
+ // Carbon >= 1.0.2, MacOS >= 8.5
status = GetWindowBounds(gui.VimWindow, kWindowStructureRgn, &bounds);
if (status != noErr)
@@ -3281,9 +3270,8 @@ gui_mch_get_winpos(int *x, int *y)
void
gui_mch_set_winpos(int x, int y)
{
- /* TODO: Should make sure the window is move within range
- * e.g.: y > ~16 [Menu bar], x > 0, x < screen width
- */
+ // TODO: Should make sure the window is move within range
+ // e.g.: y > ~16 [Menu bar], x > 0, x < screen width
MoveWindowStructure(gui.VimWindow, x, y);
}
@@ -3304,9 +3292,9 @@ gui_mch_set_shellsize(
{
VimPort = GetWindowPort(gui.VimWindow);
GetPortBounds(VimPort, &VimBound);
- VimBound.left = -gui.scrollbar_width; /* + 1;*/
+ VimBound.left = -gui.scrollbar_width; // + 1;
SetPortBounds(VimPort, &VimBound);
- /* GetWindowBounds(gui.VimWindow, kWindowGlobalPortRgn, &winPortRect); ??*/
+ // GetWindowBounds(gui.VimWindow, kWindowGlobalPortRgn, &winPortRect); ??
}
else
{
@@ -3351,13 +3339,13 @@ gui_mac_select_font(char_u *font_name)
OSStatus status;
FontSelectionQDStyle curr_font;
- /* Initialize the Font Panel with the current font. */
+ // Initialize the Font Panel with the current font.
curr_font.instance.fontFamily = gui.norm_font & 0xFFFF;
curr_font.size = (gui.norm_font >> 16);
- /* TODO: set fontStyle once styles are supported in gui_mac_find_font() */
+ // TODO: set fontStyle once styles are supported in gui_mac_find_font()
curr_font.instance.fontStyle = 0;
curr_font.hasColor = false;
- curr_font.version = 0; /* version number of the style structure */
+ curr_font.version = 0; // version number of the style structure
status = SetFontInfoForSelection(kFontSelectionQDType,
/*numStyles=*/1, &curr_font, /*eventTarget=*/NULL);
@@ -3365,7 +3353,7 @@ gui_mac_select_font(char_u *font_name)
gFontPanelInfo.style = curr_font.instance.fontStyle;
gFontPanelInfo.size = curr_font.size;
- /* Pop up the Font Panel. */
+ // Pop up the Font Panel.
status = FPShowHideFontPanel();
if (status == noErr)
{
@@ -3412,7 +3400,7 @@ gui_mac_create_atsui_style(void)
int
gui_mch_init_font(char_u *font_name, int fontset)
{
- /* TODO: Add support for bold italic underline proportional etc... */
+ // TODO: Add support for bold italic underline proportional etc...
Str255 suggestedFont = "\pMonaco";
int suggestedSize = 10;
FontInfo font_info;
@@ -3426,12 +3414,12 @@ gui_mch_init_font(char_u *font_name, int fontset)
if (font_name == NULL)
{
- /* First try to get the suggested font */
+ // First try to get the suggested font
GetFNum(suggestedFont, &font_id);
if (font_id == 0)
{
- /* Then pickup the standard application font */
+ // Then pickup the standard application font
font_id = GetAppFont();
STRCPY(used_font_name, "default");
}
@@ -3447,14 +3435,14 @@ gui_mch_init_font(char_u *font_name, int fontset)
if (font == NOFONT)
return FAIL;
- /* Set guifont to the name of the selected font. */
+ // Set guifont to the name of the selected font.
new_p_guifont = alloc(STRLEN(used_font_name) + 1);
if (new_p_guifont != NULL)
{
STRCPY(new_p_guifont, used_font_name);
vim_free(p_guifont);
p_guifont = new_p_guifont;
- /* Replace spaces in the font name with underscores. */
+ // Replace spaces in the font name with underscores.
for ( ; *new_p_guifont; ++new_p_guifont)
{
if (*new_p_guifont == ' ')
@@ -3587,8 +3575,8 @@ gui_mac_set_font_attributes(GuiFont font)
if (has_mbyte)
{
- /* FIXME: we should use a more mbyte sensitive way to support
- * wide font drawing */
+ // FIXME: we should use a more mbyte sensitive way to support
+ // wide font drawing
fontWidth = Long2Fix(gui.char_width * 2);
if (ATSUSetAttributes(gWideFontStyle,
@@ -3615,7 +3603,7 @@ gui_mch_set_font(GuiFont font)
if (p_macatsui && gFontStyle)
{
- /* Avoid setting same font again */
+ // Avoid setting same font again
if (ATSUGetAttribute(gFontStyle, kATSUMaxATSUITagValue + 1,
sizeof(font), &currFont, &actualFontByteCount) == noErr
&& actualFontByteCount == (sizeof font))
@@ -3629,14 +3617,14 @@ gui_mch_set_font(GuiFont font)
if (p_macatsui && !gIsFontFallbackSet)
{
- /* Setup automatic font substitution. The user's guifontwide
- * is tried first, then the system tries other fonts. */
-/*
+ // Setup automatic font substitution. The user's guifontwide
+ // is tried first, then the system tries other fonts.
+#if 0
ATSUAttributeTag fallbackTags[] = { kATSULineFontFallbacksTag };
ByteCount fallbackSizes[] = { sizeof(ATSUFontFallbacks) };
ATSUCreateFontFallbacks(&gFontFallbacks);
ATSUSetObjFontFallbacks(gFontFallbacks, );
-*/
+#endif
if (gui.wide_font)
{
ATSUFontID fallbackFonts;
@@ -3652,9 +3640,7 @@ gui_mch_set_font(GuiFont font)
&fallbackFonts,
kATSUSequentialFallbacksPreferred);
}
-/*
- ATSUAttributeValuePtr fallbackValues[] = { };
-*/
+// ATSUAttributeValuePtr fallbackValues[] = { };
}
}
#endif
@@ -3684,8 +3670,7 @@ gui_mch_free_font(GuiFont font)
guicolor_T
gui_mch_get_color(char_u *name)
{
- /* TODO: Add support for the new named color of MacOS 8
- */
+ // TODO: Add support for the new named color of MacOS 8
RGBColor MacColor;
if (STRICMP(name, "hilite") == 0)
@@ -3786,7 +3771,7 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
*/
if (gMacSystemVersion >= 0x1020)
{
- /* Quartz antialiasing is available only in OS 10.2 and later. */
+ // Quartz antialiasing is available only in OS 10.2 and later.
UInt32 qd_flags = (p_antialias ?
kQDUseCGTextRendering | kQDUseCGTextMetrics : 0);
QDSwapTextFlags(qd_flags);
@@ -3808,10 +3793,10 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
rc.left = FILL_X(col);
rc.top = FILL_Y(row);
- /* Multibyte computation taken from gui_w32.c */
+ // Multibyte computation taken from gui_w32.c
if (has_mbyte)
{
- /* Compute the length in display cells. */
+ // Compute the length in display cells.
rc.right = FILL_X(col + mb_string2cells(s, len));
}
else
@@ -3831,7 +3816,7 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
face |= underline;
TextFace(face);
- /* Quartz antialiasing works only in srcOr transfer mode. */
+ // Quartz antialiasing works only in srcOr transfer mode.
TextMode(srcOr);
MoveTo(TEXT_X(col), TEXT_Y(row));
@@ -3839,11 +3824,11 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
}
else
{
- /* Use old-style, non-antialiased QuickDraw text rendering. */
+ // Use old-style, non-antialiased QuickDraw text rendering.
TextMode(srcCopy);
TextFace(normal);
- /* SelectFont(hdc, gui.currFont); */
+ // SelectFont(hdc, gui.currFont);
if (flags & DRAW_TRANSP)
TextMode(srcOr);
@@ -3881,13 +3866,13 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
static void
draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
{
- /* ATSUI requires utf-16 strings */
+ // ATSUI requires utf-16 strings
UniCharCount utf16_len;
UniChar *tofree = mac_enc_to_utf16(s, len, (size_t *)&utf16_len);
utf16_len /= sizeof(UniChar);
- /* - ATSUI automatically antialiases text (Someone)
- * - for some reason it does not work... (Jussi) */
+ // - ATSUI automatically antialiases text (Someone)
+ // - for some reason it does not work... (Jussi)
#ifdef MAC_ATSUI_DEBUG
fprintf(stderr, "row = %d, col = %d, len = %d: '%c'\n",
row, col, len, len == 1 ? s[0] : ' ');
@@ -3907,10 +3892,10 @@ draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
rc.left = FILL_X(col);
rc.top = FILL_Y(row);
- /* Multibyte computation taken from gui_w32.c */
+ // Multibyte computation taken from gui_w32.c
if (has_mbyte)
{
- /* Compute the length in display cells. */
+ // Compute the length in display cells.
rc.right = FILL_X(col + mb_string2cells(s, len));
}
else
@@ -3924,7 +3909,7 @@ draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
TextMode(srcCopy);
TextFace(normal);
- /* SelectFont(hdc, gui.currFont); */
+ // SelectFont(hdc, gui.currFont);
if (flags & DRAW_TRANSP)
TextMode(srcOr);
@@ -3975,14 +3960,14 @@ draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
ATSUSetRunStyle(textLayout, gFontStyle,
kATSUFromTextBeginning, kATSUToTextEnd); */
- /* Compute the length in display cells. */
+ // Compute the length in display cells.
for (n = 0; n < len; n += MB_BYTE2LEN(s[n]))
{
width_in_cell = (*mb_ptr2cells)(s + n);
- /* probably we are switching from single byte character
- * to multibyte characters (which requires more than one
- * cell to draw) */
+ // probably we are switching from single byte character
+ // to multibyte characters (which requires more than one
+ // cell to draw)
if (width_in_cell != last_width_in_cell)
{
#ifdef MAC_ATSUI_DEBUG
@@ -4007,7 +3992,7 @@ draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
fprintf(stderr, "\tn = %2d, (%d-%d), offset = %d, yet_to_draw = %d\n",
n, last_width_in_cell, width_in_cell, offset, yet_to_draw);
#endif
- /* finish the rest style */
+ // finish the rest style
textStyle = width_in_cell > 1 ? gWideFontStyle : gFontStyle;
ATSUSetRunStyle(textLayout, textStyle, offset, kATSUToTextEnd);
}
@@ -4039,7 +4024,7 @@ draw_string_ATSUI(int row, int col, char_u *s, int len, int flags)
}
}
- /* drawing is done, now reset bold to normal */
+ // drawing is done, now reset bold to normal
if (gFontStyle && flags & DRAW_BOLD)
{
Boolean attValue = false;
@@ -4065,10 +4050,10 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
{
#if defined(USE_ATSUI_DRAWING)
if (p_macatsui == 0 && p_macatsui_last != 0)
- /* switch from macatsui to nomacatsui */
+ // switch from macatsui to nomacatsui
gui_mac_dispose_atsui_style();
else if (p_macatsui != 0 && p_macatsui_last == 0)
- /* switch from nomacatsui to macatsui */
+ // switch from nomacatsui to macatsui
gui_mac_create_atsui_style();
if (p_macatsui)
@@ -4096,13 +4081,13 @@ gui_mch_haskey(char_u *name)
void
gui_mch_beep(void)
{
- SysBeep(1); /* Should this be 0? (????) */
+ SysBeep(1); // Should this be 0? (????)
}
void
gui_mch_flash(int msec)
{
- /* Do a visual beep by reversing the foreground and background colors */
+ // Do a visual beep by reversing the foreground and background colors
Rect rc;
/*
@@ -4114,7 +4099,7 @@ gui_mch_flash(int msec)
rc.bottom = gui.num_rows * gui.char_height;
InvertRect(&rc);
- ui_delay((long)msec, TRUE); /* wait for some msec */
+ ui_delay((long)msec, TRUE); // wait for some msec
InvertRect(&rc);
}
@@ -4143,10 +4128,9 @@ gui_mch_invert_rectangle(int r, int c, int nr, int nc)
void
gui_mch_iconify(void)
{
- /* TODO: find out what could replace iconify
- * -window shade?
- * -hide application?
- */
+ // TODO: find out what could replace iconify
+ // -window shade?
+ // -hide application?
}
#if defined(FEAT_EVAL) || defined(PROTO)
@@ -4156,7 +4140,7 @@ gui_mch_iconify(void)
void
gui_mch_set_foreground(void)
{
- /* TODO */
+ // TODO
}
#endif
@@ -4192,7 +4176,7 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
Rect rc;
#ifdef FEAT_RIGHTLEFT
- /* vertical line should be on the right of current point */
+ // vertical line should be on the right of current point
if (CURSOR_BAR_RIGHT)
rc.left = FILL_X(gui.col + 1) - w;
else
@@ -4219,14 +4203,13 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
void
gui_mch_update(void)
{
- /* TODO: find what to do
- * maybe call gui_mch_wait_for_chars (0)
- * more like look at EventQueue then
- * call heart of gui_mch_wait_for_chars;
- *
- * if (eventther)
- * gui_mac_handle_event(&event);
- */
+ // TODO: find what to do
+ // maybe call gui_mch_wait_for_chars (0)
+ // more like look at EventQueue then
+ // call heart of gui_mch_wait_for_chars;
+ //
+ // if (eventther)
+ // gui_mac_handle_event(&event);
EventRecord theEvent;
if (EventAvail(everyEvent, &theEvent))
@@ -4266,13 +4249,12 @@ gui_mch_wait_for_chars(int wtime)
long currentTick;
long sleeppyTick;
- /* If we are providing life feedback with the scrollbar,
- * we don't want to try to wait for an event, or else
- * there won't be any life feedback.
- */
+ // If we are providing life feedback with the scrollbar,
+ // we don't want to try to wait for an event, or else
+ // there won't be any life feedback.
if (dragged_sb != NULL)
return FAIL;
- /* TODO: Check if FAIL is the proper return code */
+ // TODO: Check if FAIL is the proper return code
entryTick = TickCount();
@@ -4280,12 +4262,15 @@ gui_mch_wait_for_chars(int wtime)
do
{
-/* if (dragRectControl == kCreateEmpty)
+#if 0
+ if (dragRectControl == kCreateEmpty)
{
dragRgn = NULL;
dragRectControl = kNothing;
}
- else*/ if (dragRectControl == kCreateRect)
+ else
+#endif
+ if (dragRectControl == kCreateRect)
{
dragRgn = cursorRgn;
RectRgn(dragRgn, &dragRect);
@@ -4297,7 +4282,7 @@ gui_mch_wait_for_chars(int wtime)
* event arrives. No need to check for input_buf_full because we are
* returning as soon as it contains a single char.
*/
- /* TODO: reduce wtime accordingly??? */
+ // TODO: reduce wtime accordingly???
if (wtime > -1)
sleeppyTick = 60 * wtime / 1000;
else
@@ -4324,11 +4309,13 @@ gui_mch_wait_for_chars(int wtime)
* Output routines.
*/
-/* Flush any output to the screen */
+/*
+ * Flush any output to the screen
+ */
void
gui_mch_flush(void)
{
- /* TODO: Is anything needed here? */
+ // TODO: Is anything needed here?
}
/*
@@ -4368,9 +4355,8 @@ gui_mch_clear_all(void)
gui_mch_set_bg_color(gui.back_pixel);
EraseRect(&rc);
-/* gui_mch_set_fg_color(gui.norm_pixel);
- FrameRect(&rc);
-*/
+// gui_mch_set_fg_color(gui.norm_pixel);
+// FrameRect(&rc);
}
/*
@@ -4382,7 +4368,7 @@ gui_mch_delete_lines(int row, int num_lines)
{
Rect rc;
- /* changed without checking! */
+ // changed without checking!
rc.left = FILL_X(gui.scroll_region_left);
rc.right = FILL_X(gui.scroll_region_right + 1);
rc.top = FILL_Y(row);
@@ -4414,7 +4400,7 @@ gui_mch_insert_lines(int row, int num_lines)
ScrollRect(&rc, 0, gui.char_height * num_lines, (RgnHandle) nil);
- /* Update gui.cursor_row if the cursor scrolled or copied over */
+ // Update gui.cursor_row if the cursor scrolled or copied over
if (gui.cursor_row >= gui.row
&& gui.cursor_col >= gui.scroll_region_left
&& gui.cursor_col <= gui.scroll_region_right)
@@ -4474,10 +4460,10 @@ clip_mch_request_selection(Clipboard_T *cbd)
ReserveMem(scrapSize);
- /* In CARBON we don't need a Handle, a pointer is good */
+ // In CARBON we don't need a Handle, a pointer is good
textOfClip = NewHandle(scrapSize);
- /* tempclip = alloc(scrapSize+1); */
+ // tempclip = alloc(scrapSize+1);
HLock(textOfClip);
error = GetScrapFlavorData(scrap,
flavor ? VIMSCRAPFLAVOR : SCRAPTEXTFLAVOR,
@@ -4495,7 +4481,7 @@ clip_mch_request_selection(Clipboard_T *cbd)
#ifdef MACOS_CONVERT
{
- /* Convert from utf-16 (clipboard) */
+ // Convert from utf-16 (clipboard)
size_t encLen = 0;
char_u *to = mac_utf16_to_enc((UniChar *)tempclip, scrapSize, &encLen);
@@ -4601,7 +4587,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h)
{
Rect VimBound;
-/* HideWindow(gui.VimWindow); */
+// HideWindow(gui.VimWindow);
GetWindowBounds(gui.VimWindow, kWindowGlobalPortRgn, &VimBound);
if (gui.which_scrollbars[SBAR_LEFT])
@@ -4647,33 +4633,33 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
* Carbon Help suggest to use only id between 1 and 235
*/
static long next_avail_id = 128;
- long menu_after_me = 0; /* Default to the end */
+ long menu_after_me = 0; // Default to the end
CFStringRef name;
short index;
vimmenu_T *parent = menu->parent;
vimmenu_T *brother = menu->next;
- /* Cannot add a menu if ... */
+ // Cannot add a menu if ...
if ((parent != NULL && parent->submenu_id == 0))
return;
- /* menu ID greater than 1024 are reserved for ??? */
+ // menu ID greater than 1024 are reserved for ???
if (next_avail_id == 1024)
return;
- /* My brother could be the PopUp, find my real brother */
+ // My brother could be the PopUp, find my real brother
while ((brother != NULL) && (!menu_is_menubar(brother->name)))
brother = brother->next;
- /* Find where to insert the menu (for MenuBar) */
+ // Find where to insert the menu (for MenuBar)
if ((parent == NULL) && (brother != NULL))
menu_after_me = brother->submenu_id;
- /* If the menu is not part of the menubar (and its submenus), add it 'nowhere' */
+ // If the menu is not part of the menubar (and its submenus), add it 'nowhere'
if (!menu_is_menubar(menu->name))
menu_after_me = hierMenu;
- /* Convert the name */
+ // Convert the name
#ifdef MACOS_CONVERT
name = menu_title_removing_mnemonic(menu);
#else
@@ -4682,12 +4668,11 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
if (name == NULL)
return;
- /* Create the menu unless it's the help menu */
+ // Create the menu unless it's the help menu
{
- /* Carbon suggest use of
- * OSStatus CreateNewMenu(MenuID, MenuAttributes, MenuRef *);
- * OSStatus SetMenuTitle(MenuRef, ConstStr255Param title);
- */
+ // Carbon suggest use of
+ // OSStatus CreateNewMenu(MenuID, MenuAttributes, MenuRef *);
+ // OSStatus SetMenuTitle(MenuRef, ConstStr255Param title);
menu->submenu_id = next_avail_id;
if (CreateNewMenu(menu->submenu_id, 0, (MenuRef *)&menu->submenu_handle) == noErr)
SetMenuTitleWithCFString((MenuRef)menu->submenu_handle, name);
@@ -4696,29 +4681,27 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
if (parent == NULL)
{
- /* Adding a menu to the menubar, or in the no mans land (for PopUp) */
+ // Adding a menu to the menubar, or in the no mans land (for PopUp)
- /* TODO: Verify if we could only Insert Menu if really part of the
- * menubar The Inserted menu are scanned or the Command-key combos
- */
+ // TODO: Verify if we could only Insert Menu if really part of the
+ // menubar The Inserted menu are scanned or the Command-key combos
- /* Insert the menu */
- InsertMenu(menu->submenu_handle, menu_after_me); /* insert before */
+ // Insert the menu
+ InsertMenu(menu->submenu_handle, menu_after_me); // insert before
#if 1
- /* Vim should normally update it. TODO: verify */
+ // Vim should normally update it. TODO: verify
DrawMenuBar();
#endif
}
else
{
- /* Adding as a submenu */
+ // Adding as a submenu
index = gui_mac_get_menu_item_index(menu);
- /* Call InsertMenuItem followed by SetMenuItemText
- * to avoid special character recognition by InsertMenuItem
- */
- InsertMenuItem(parent->submenu_handle, "\p ", idx); /* afterItem */
+ // Call InsertMenuItem followed by SetMenuItemText
+ // to avoid special character recognition by InsertMenuItem
+ InsertMenuItem(parent->submenu_handle, "\p ", idx); // afterItem
SetMenuItemTextWithCFString(parent->submenu_handle, idx+1, name);
SetItemCmd(parent->submenu_handle, idx+1, 0x1B);
SetItemMark(parent->submenu_handle, idx+1, menu->submenu_id);
@@ -4728,7 +4711,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
CFRelease(name);
#if 0
- /* Done by Vim later on */
+ // Done by Vim later on
DrawMenuBar();
#endif
}
@@ -4743,31 +4726,30 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
vimmenu_T *parent = menu->parent;
int menu_inserted;
- /* Cannot add item, if the menu have not been created */
+ // Cannot add item, if the menu have not been created
if (parent->submenu_id == 0)
return;
- /* Could call SetMenuRefCon [CARBON] to associate with the Menu,
- for older OS call GetMenuItemData (menu, item, isCommandID?, data) */
+ // Could call SetMenuRefCon [CARBON] to associate with the Menu,
+ // for older OS call GetMenuItemData (menu, item, isCommandID?, data)
- /* Convert the name */
+ // Convert the name
#ifdef MACOS_CONVERT
name = menu_title_removing_mnemonic(menu);
#else
name = C2Pascal_save(menu->dname);
#endif
- /* Where are just a menu item, so no handle, no id */
+ // Where are just a menu item, so no handle, no id
menu->submenu_id = 0;
menu->submenu_handle = NULL;
menu_inserted = 0;
if (menu->actext)
{
- /* If the accelerator text for the menu item looks like it describes
- * a command key (e.g., "<D-S-t>" or "<C-7>"), display it as the
- * item's command equivalent.
- */
+ // If the accelerator text for the menu item looks like it describes
+ // a command key (e.g., "<D-S-t>" or "<C-7>"), display it as the
+ // item's command equivalent.
int key = 0;
int modifiers = 0;
char_u *p_actext;
@@ -4776,39 +4758,36 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
key = find_special_key(&p_actext, &modifiers, FALSE, FALSE, FALSE,
TRUE, NULL);
if (*p_actext != 0)
- key = 0; /* error: trailing text */
- /* find_special_key() returns a keycode with as many of the
- * specified modifiers as appropriate already applied (e.g., for
- * "<D-C-x>" it returns Ctrl-X as the keycode and MOD_MASK_CMD
- * as the only modifier). Since we want to display all of the
- * modifiers, we need to convert the keycode back to a printable
- * character plus modifiers.
- * TODO: Write an alternative find_special_key() that doesn't
- * apply modifiers.
- */
+ key = 0; // error: trailing text
+ // find_special_key() returns a keycode with as many of the
+ // specified modifiers as appropriate already applied (e.g., for
+ // "<D-C-x>" it returns Ctrl-X as the keycode and MOD_MASK_CMD
+ // as the only modifier). Since we want to display all of the
+ // modifiers, we need to convert the keycode back to a printable
+ // character plus modifiers.
+ // TODO: Write an alternative find_special_key() that doesn't
+ // apply modifiers.
if (key > 0 && key < 32)
{
- /* Convert a control key to an uppercase letter. Note that
- * by this point it is no longer possible to distinguish
- * between, e.g., Ctrl-S and Ctrl-Shift-S.
- */
+ // Convert a control key to an uppercase letter. Note that
+ // by this point it is no longer possible to distinguish
+ // between, e.g., Ctrl-S and Ctrl-Shift-S.
modifiers |= MOD_MASK_CTRL;
key += '@';
}
- /* If the keycode is an uppercase letter, set the Shift modifier.
- * If it is a lowercase letter, don't set the modifier, but convert
- * the letter to uppercase for display in the menu.
- */
+ // If the keycode is an uppercase letter, set the Shift modifier.
+ // If it is a lowercase letter, don't set the modifier, but convert
+ // the letter to uppercase for display in the menu.
else if (key >= 'A' && key <= 'Z')
modifiers |= MOD_MASK_SHIFT;
else if (key >= 'a' && key <= 'z')
key += 'A' - 'a';
- /* Note: keycodes below 0x22 are reserved by Apple. */
+ // Note: keycodes below 0x22 are reserved by Apple.
if (key >= 0x22 && vim_isprintc_strict(key))
{
int valid = 1;
char_u mac_mods = kMenuNoModifiers;
- /* Convert Vim modifier codes to Menu Manager equivalents. */
+ // Convert Vim modifier codes to Menu Manager equivalents.
if (modifiers & MOD_MASK_SHIFT)
mac_mods |= kMenuShiftModifier;
if (modifiers & MOD_MASK_CTRL)
@@ -4816,30 +4795,29 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
if (!(modifiers & MOD_MASK_CMD))
mac_mods |= kMenuNoCommandModifier;
if (modifiers & MOD_MASK_ALT || modifiers & MOD_MASK_MULTI_CLICK)
- valid = 0; /* TODO: will Alt someday map to Option? */
+ valid = 0; // TODO: will Alt someday map to Option?
if (valid)
{
char_u item_txt[10];
- /* Insert the menu item after idx, with its command key. */
+ // Insert the menu item after idx, with its command key.
item_txt[0] = 3; item_txt[1] = ' '; item_txt[2] = '/';
item_txt[3] = key;
InsertMenuItem(parent->submenu_handle, item_txt, idx);
- /* Set the modifier keys. */
+ // Set the modifier keys.
SetMenuItemModifiers(parent->submenu_handle, idx+1, mac_mods);
menu_inserted = 1;
}
}
}
- /* Call InsertMenuItem followed by SetMenuItemText
- * to avoid special character recognition by InsertMenuItem
- */
+ // Call InsertMenuItem followed by SetMenuItemText
+ // to avoid special character recognition by InsertMenuItem
if (!menu_inserted)
- InsertMenuItem(parent->submenu_handle, "\p ", idx); /* afterItem */
- /* Set the menu item name. */
+ InsertMenuItem(parent->submenu_handle, "\p ", idx); // afterItem
+ // Set the menu item name.
SetMenuItemTextWithCFString(parent->submenu_handle, idx+1, name);
#if 0
- /* Called by Vim */
+ // Called by Vim
DrawMenuBar();
#endif
@@ -4849,7 +4827,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
void
gui_mch_toggle_tearoffs(int enable)
{
- /* no tearoff menus */
+ // no tearoff menus
}
/*
@@ -4865,10 +4843,10 @@ gui_mch_destroy_menu(vimmenu_T *menu)
if (menu->parent)
{
{
- /* For now just don't delete help menu items. (Huh? Dany) */
+ // For now just don't delete help menu items. (Huh? Dany)
DeleteMenuItem(menu->parent->submenu_handle, index);
- /* Delete the Menu if it was a hierarchical Menu */
+ // Delete the Menu if it was a hierarchical Menu
if (menu->submenu_id != 0)
{
DeleteMenu(menu->submenu_id);
@@ -4890,7 +4868,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
DisposeMenu(menu->submenu_handle);
}
}
- /* Shouldn't this be already done by Vim. TODO: Check */
+ // Shouldn't this be already done by Vim. TODO: Check
DrawMenuBar();
}
@@ -4900,7 +4878,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
void
gui_mch_menu_grey(vimmenu_T *menu, int grey)
{
- /* TODO: Check if menu really exists */
+ // TODO: Check if menu really exists
short index = gui_mac_get_menu_item_index(menu);
/*
index = menu->index;
@@ -4929,7 +4907,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
void
gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
{
- /* There's no hidden mode on MacOS */
+ // There's no hidden mode on MacOS
gui_mch_menu_grey(menu, hidden);
}
@@ -4988,7 +4966,8 @@ gui_mch_set_scrollbar_pos(
int h)
{
gui_mch_set_bg_color(gui.back_pixel);
-/* if (gui.which_scrollbars[SBAR_LEFT])
+#if 0
+ if (gui.which_scrollbars[SBAR_LEFT])
{
MoveControl(sb->id, x-16, y);
SizeControl(sb->id, w + 1, h);
@@ -4997,7 +4976,8 @@ gui_mch_set_scrollbar_pos(
{
MoveControl(sb->id, x, y);
SizeControl(sb->id, w + 1, h);
- }*/
+ }
+#endif
if (sb == &gui.bottom_sbar)
h += 1;
else
@@ -5016,7 +4996,7 @@ gui_mch_set_scrollbar_pos(
void
gui_mch_create_scrollbar(
scrollbar_T *sb,
- int orient) /* SBAR_VERT or SBAR_HORIZ */
+ int orient) // SBAR_VERT or SBAR_HORIZ
{
Rect bounds;
@@ -5029,9 +5009,9 @@ gui_mch_create_scrollbar(
&bounds,
"\pScrollBar",
TRUE,
- 0, /* current*/
- 0, /* top */
- 0, /* bottom */
+ 0, // current
+ 0, // top
+ 0, // bottom
kControlScrollBarLiveProc,
(long) sb->ident);
#ifdef DEBUG_MAC_SB
@@ -5072,10 +5052,12 @@ gui_mch_is_blink_off(void)
void
gui_mch_set_blinking(long wait, long on, long off)
{
- /* TODO: TODO: TODO: TODO: */
-/* blink_waittime = wait;
+#if 0
+ // TODO: TODO: TODO: TODO:
+ blink_waittime = wait;
blink_ontime = on;
- blink_offtime = off;*/
+ blink_offtime = off;
+#endif
}
/*
@@ -5086,11 +5068,13 @@ gui_mch_stop_blink(int may_call_gui_update_cursor)
{
if (may_call_gui_update_cursor)
gui_update_cursor(TRUE, FALSE);
- /* TODO: TODO: TODO: TODO: */
-/* gui_w32_rm_blink_timer();
+#if 0
+ // TODO: TODO: TODO: TODO:
+ gui_w32_rm_blink_timer();
if (blink_state == BLINK_OFF)
gui_update_cursor(TRUE, FALSE);
- blink_state = BLINK_NONE;*/
+ blink_state = BLINK_NONE;
+#endif
}
/*
@@ -5101,17 +5085,19 @@ gui_mch_stop_blink(int may_call_gui_update_cursor)
gui_mch_start_blink(void)
{
gui_update_cursor(TRUE, FALSE);
- /* TODO: TODO: TODO: TODO: */
-/* gui_w32_rm_blink_timer(); */
+ // TODO: TODO: TODO: TODO:
+// gui_w32_rm_blink_timer();
- /* Only switch blinking on if none of the times is zero */
-/* if (blink_waittime && blink_ontime && blink_offtime)
+ // Only switch blinking on if none of the times is zero
+#if 0
+ if (blink_waittime && blink_ontime && blink_offtime)
{
blink_timer = SetTimer(NULL, 0, (UINT)blink_waittime,
(TIMERPROC)_OnBlinkTimer);
blink_state = BLINK_ON;
gui_update_cursor(TRUE, FALSE);
- }*/
+ }
+#endif
}
/*
@@ -5153,7 +5139,7 @@ gui_mch_browse(
char_u *initdir,
char_u *filter)
{
- /* TODO: Add Ammon's safety check (Dany) */
+ // TODO: Add Ammon's safety check (Dany)
NavReplyRecord reply;
char_u *fname = NULL;
char_u **fnames = NULL;
@@ -5161,33 +5147,32 @@ gui_mch_browse(
NavDialogOptions navOptions;
OSErr error;
- /* Get Navigation Service Defaults value */
+ // Get Navigation Service Defaults value
NavGetDefaultDialogOptions(&navOptions);
- /* TODO: If we get a :browse args, set the Multiple bit. */
+ // TODO: If we get a :browse args, set the Multiple bit.
navOptions.dialogOptionFlags = kNavAllowInvisibleFiles
| kNavDontAutoTranslate
| kNavDontAddTranslateItems
- /* | kNavAllowMultipleFiles */
+ // | kNavAllowMultipleFiles
| kNavAllowStationery;
(void) C2PascalString(title, &navOptions.message);
(void) C2PascalString(dflt, &navOptions.savedFileName);
- /* Could set clientName?
- * windowTitle? (there's no title bar?)
- */
+ // Could set clientName?
+ // windowTitle? (there's no title bar?)
if (saving)
{
- /* Change first parm AEDesc (typeFSS) *defaultLocation to match dflt */
+ // Change first parm AEDesc (typeFSS) *defaultLocation to match dflt
NavPutFile(NULL, &reply, &navOptions, NULL, 'TEXT', 'VIM!', NULL);
if (!reply.validRecord)
return NULL;
}
else
{
- /* Change first parm AEDesc (typeFSS) *defaultLocation to match dflt */
+ // Change first parm AEDesc (typeFSS) *defaultLocation to match dflt
NavGetFile(NULL, &reply, &navOptions, NULL, NULL, NULL, NULL, NULL);
if (!reply.validRecord)
return NULL;
@@ -5203,10 +5188,10 @@ gui_mch_browse(
vim_free(fnames);
}
- /* TODO: Shorten the file name if possible */
+ // TODO: Shorten the file name if possible
return fname;
}
-#endif /* FEAT_BROWSE */
+#endif // FEAT_BROWSE
#ifdef FEAT_GUI_DIALOG
/*
@@ -5233,9 +5218,9 @@ gui_mch_browse(
typedef struct
{
short idx;
- short width; /* Size of the text in pixel */
+ short width; // Size of the text in pixel
Rect box;
-} vgmDlgItm; /* Vim Gui_Mac.c Dialog Item */
+} vgmDlgItm; // Vim Gui_Mac.c Dialog Item
#define MoveRectTo(r,x,y) OffsetRect(r,x-r->left,y-r->top)
@@ -5247,8 +5232,8 @@ macMoveDialogItem(
short Y,
Rect *inBox)
{
-#if 0 /* USE_CARBONIZED */
- /* Untested */
+#if 0 // USE_CARBONIZED
+ // Untested
MoveDialogItem(theDialog, itemNumber, X, Y);
if (inBox != nil)
GetDialogItem(theDialog, itemNumber, &itemType, &itemHandle, inBox);
@@ -5264,9 +5249,9 @@ macMoveDialogItem(
GetDialogItem(theDialog, itemNumber, &itemType, &itemHandle, itemBox);
OffsetRect(itemBox, -itemBox->left, -itemBox->top);
OffsetRect(itemBox, X, Y);
- /* To move a control (like a button) we need to call both
- * MoveControl and SetDialogItem. FAQ 6-18 */
- if (1) /*(itemType & kControlDialogItem) */
+ // To move a control (like a button) we need to call both
+ // MoveControl and SetDialogItem. FAQ 6-18
+ if (1) //(itemType & kControlDialogItem)
MoveControl((ControlRef) itemHandle, X, Y);
SetDialogItem(theDialog, itemNumber, itemType, itemHandle, itemBox);
#endif
@@ -5285,25 +5270,25 @@ macSizeDialogItem(
GetDialogItem(theDialog, itemNumber, &itemType, &itemHandle, &itemBox);
- /* When width or height is zero do not change it */
+ // When width or height is zero do not change it
if (width == 0)
width = itemBox.right - itemBox.left;
if (height == 0)
height = itemBox.bottom - itemBox.top;
-#if 0 /* USE_CARBONIZED */
- SizeDialogItem(theDialog, itemNumber, width, height); /* Untested */
+#if 0 // USE_CARBONIZED
+ SizeDialogItem(theDialog, itemNumber, width, height); // Untested
#else
- /* Resize the bounding box */
+ // Resize the bounding box
itemBox.right = itemBox.left + width;
itemBox.bottom = itemBox.top + height;
- /* To resize a control (like a button) we need to call both
- * SizeControl and SetDialogItem. (deducted from FAQ 6-18) */
+ // To resize a control (like a button) we need to call both
+ // SizeControl and SetDialogItem. (deducted from FAQ 6-18)
if (itemType & kControlDialogItem)
SizeControl((ControlRef) itemHandle, width, height);
- /* Configure back the item */
+ // Configure back the item
SetDialogItem(theDialog, itemNumber, itemType, itemHandle, &itemBox);
#endif
}
@@ -5327,7 +5312,8 @@ macSetDialogItemText(
}
-/* ModalDialog() handler for message dialogs that have hotkey accelerators.
+/*
+ * ModalDialog() handler for message dialogs that have hotkey accelerators.
* Expects a mapping of hotkey char to control index in gDialogHotKeys;
* setting gDialogHotKeys to NULL disables any hotkey handling.
*/
@@ -5350,26 +5336,26 @@ DialogHotkeyFilterProc (
#endif
*itemHit = gDialogHotKeys[keyHit];
- /* When handing off to StdFilterProc, pretend that the user
- * clicked the control manually. Note that this is also supposed
- * to cause the button to hilite briefly (to give some user
- * feedback), but this seems not to actually work (or it's too
- * fast to be seen).
- */
+ // When handing off to StdFilterProc, pretend that the user
+ // clicked the control manually. Note that this is also supposed
+ // to cause the button to hilite briefly (to give some user
+ // feedback), but this seems not to actually work (or it's too
+ // fast to be seen).
event->what = kEventControlSimulateHit;
- return true; /* we took care of it */
+ return true; // we took care of it
}
- /* Defer to the OS's standard behavior for this event.
- * This ensures that Enter will still activate the default button. */
+ // Defer to the OS's standard behavior for this event.
+ // This ensures that Enter will still activate the default button.
return StdFilterProc(theDialog, event, itemHit);
}
- return false; /* Let ModalDialog deal with it */
+ return false; // Let ModalDialog deal with it
}
-/* TODO: There have been some crashes with dialogs, check your inbox
+/*
+ * TODO: There have been some crashes with dialogs, check your inbox
* (Jussi)
*/
int
@@ -5390,12 +5376,12 @@ gui_mch_dialog(
Handle iconHandle;
DialogPtr theDialog;
char_u len;
- char_u PascalTitle[256]; /* place holder for the title */
+ char_u PascalTitle[256]; // place holder for the title
char_u name[256];
GrafPtr oldPort;
short itemHit;
char_u *buttonChar;
- short hotKeys[256]; /* map of hotkey -> control ID */
+ short hotKeys[256]; // map of hotkey -> control ID
char_u aHotKey;
Rect box;
short button;
@@ -5403,14 +5389,14 @@ gui_mch_dialog(
short itemType;
short useIcon;
short width;
- short totalButtonWidth = 0; /* the width of all buttons together
- including spacing */
+ short totalButtonWidth = 0; // the width of all buttons together
+ // including spacing
short widestButton = 0;
- short dfltButtonEdge = 20; /* gut feeling */
- short dfltElementSpacing = 13; /* from IM:V.2-29 */
- short dfltIconSideSpace = 23; /* from IM:V.2-29 */
- short maximumWidth = 400; /* gut feeling */
- short maxButtonWidth = 175; /* gut feeling */
+ short dfltButtonEdge = 20; // gut feeling
+ short dfltElementSpacing = 13; // from IM:V.2-29
+ short dfltIconSideSpace = 23; // from IM:V.2-29
+ short maximumWidth = 400; // gut feeling
+ short maxButtonWidth = 175; // gut feeling
short vertical;
short dialogHeight;
@@ -5426,51 +5412,50 @@ gui_mch_dialog(
ModalFilterUPP dialogUPP;
- /* Check 'v' flag in 'guioptions': vertical button placement. */
+ // Check 'v' flag in 'guioptions': vertical button placement.
vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
- /* Create a new Dialog Box from template. */
+ // Create a new Dialog Box from template.
theDialog = GetNewDialog(129, nil, (WindowRef) -1);
- /* Get the WindowRef */
+ // Get the WindowRef
theWindow = GetDialogWindow(theDialog);
- /* Hide the window.
- * 1. to avoid seeing slow drawing
- * 2. to prevent a problem seen while moving dialog item
- * within a visible window. (non-Carbon MacOS 9)
- * Could be avoided by changing the resource.
- */
+ // Hide the window.
+ // 1. to avoid seeing slow drawing
+ // 2. to prevent a problem seen while moving dialog item
+ // within a visible window. (non-Carbon MacOS 9)
+ // Could be avoided by changing the resource.
HideWindow(theWindow);
- /* Change the graphical port to the dialog,
- * so we can measure the text with the proper font */
+ // Change the graphical port to the dialog,
+ // so we can measure the text with the proper font
GetPort(&oldPort);
SetPortDialogPort(theDialog);
- /* Get the info about the default text,
- * used to calculate the height of the message
- * and of the text field */
+ // Get the info about the default text,
+ // used to calculate the height of the message
+ // and of the text field
GetFontInfo(&textFontInfo);
- /* Set the dialog title */
+ // Set the dialog title
if (title != NULL)
{
(void) C2PascalString(title, &PascalTitle);
SetWTitle(theWindow, PascalTitle);
}
- /* Creates the buttons and add them to the Dialog Box. */
+ // Creates the buttons and add them to the Dialog Box.
buttonDITL = GetResource('DITL', 130);
buttonChar = buttons;
button = 0;
- /* initialize the hotkey mapping */
+ // initialize the hotkey mapping
vim_memset(hotKeys, 0, sizeof(hotKeys));
for (;*buttonChar != 0;)
{
- /* Get the name of the button */
+ // Get the name of the button
button++;
len = 0;
for (;((*buttonChar != DLG_BUTTON_SEP) && (*buttonChar != 0) && (len < 255)); buttonChar++)
@@ -5493,16 +5478,16 @@ gui_mch_dialog(
buttonChar++;
name[0] = len;
- /* Add the button */
- AppendDITL(theDialog, buttonDITL, overlayDITL); /* appendDITLRight); */
+ // Add the button
+ AppendDITL(theDialog, buttonDITL, overlayDITL); // appendDITLRight);
- /* Change the button's name */
+ // Change the button's name
macSetDialogItemText(theDialog, button, name);
- /* Resize the button to fit its name */
+ // Resize the button to fit its name
width = StringWidth(name) + 2 * dfltButtonEdge;
- /* Limit the size of any button to an acceptable value. */
- /* TODO: Should be based on the message width */
+ // Limit the size of any button to an acceptable value.
+ // TODO: Should be based on the message width
if (width > maxButtonWidth)
width = maxButtonWidth;
macSizeDialogItem(theDialog, button, width, 0);
@@ -5515,7 +5500,7 @@ gui_mch_dialog(
ReleaseResource(buttonDITL);
lastButton = button;
- /* Add the icon to the Dialog Box. */
+ // Add the icon to the Dialog Box.
iconItm.idx = lastButton + 1;
iconDITL = GetResource('DITL', 131);
switch (type)
@@ -5530,11 +5515,11 @@ gui_mch_dialog(
AppendDITL(theDialog, iconDITL, overlayDITL);
ReleaseResource(iconDITL);
GetDialogItem(theDialog, iconItm.idx, &itemType, &itemHandle, &box);
- /* TODO: Should the item be freed? */
+ // TODO: Should the item be freed?
iconHandle = GetIcon(useIcon);
SetDialogItem(theDialog, iconItm.idx, itemType, iconHandle, &box);
- /* Add the message to the Dialog box. */
+ // Add the message to the Dialog box.
messageItm.idx = lastButton + 2;
messageDITL = GetResource('DITL', 132);
AppendDITL(theDialog, messageDITL, overlayDITL);
@@ -5544,62 +5529,62 @@ gui_mch_dialog(
SetDialogItemText(itemHandle, name);
messageItm.width = StringWidth(name);
- /* Add the input box if needed */
+ // Add the input box if needed
if (textfield != NULL)
{
- /* Cheat for now reuse the message and convert to text edit */
+ // Cheat for now reuse the message and convert to text edit
inputItm.idx = lastButton + 3;
inputDITL = GetResource('DITL', 132);
AppendDITL(theDialog, inputDITL, overlayDITL);
ReleaseResource(inputDITL);
GetDialogItem(theDialog, inputItm.idx, &itemType, &itemHandle, &box);
-/* SetDialogItem(theDialog, inputItm.idx, kEditTextDialogItem, itemHandle, &box);*/
+// SetDialogItem(theDialog, inputItm.idx, kEditTextDialogItem, itemHandle, &box);
(void) C2PascalString(textfield, &name);
SetDialogItemText(itemHandle, name);
inputItm.width = StringWidth(name);
- /* Hotkeys don't make sense if there's a text field */
+ // Hotkeys don't make sense if there's a text field
gDialogHotKeys = NULL;
}
else
- /* Install hotkey table */
+ // Install hotkey table
gDialogHotKeys = (short *)&hotKeys;
- /* Set the <ENTER> and <ESC> button. */
+ // Set the <ENTER> and <ESC> button.
SetDialogDefaultItem(theDialog, dfltbutton);
SetDialogCancelItem(theDialog, 0);
- /* Reposition element */
+ // Reposition element
- /* Check if we need to force vertical */
+ // Check if we need to force vertical
if (totalButtonWidth > maximumWidth)
vertical = TRUE;
- /* Place icon */
+ // Place icon
macMoveDialogItem(theDialog, iconItm.idx, dfltIconSideSpace, dfltElementSpacing, &box);
iconItm.box.right = box.right;
iconItm.box.bottom = box.bottom;
- /* Place Message */
+ // Place Message
messageItm.box.left = iconItm.box.right + dfltIconSideSpace;
macSizeDialogItem(theDialog, messageItm.idx, 0, messageLines * (textFontInfo.ascent + textFontInfo.descent));
macMoveDialogItem(theDialog, messageItm.idx, messageItm.box.left, dfltElementSpacing, &messageItm.box);
- /* Place Input */
+ // Place Input
if (textfield != NULL)
{
inputItm.box.left = messageItm.box.left;
inputItm.box.top = messageItm.box.bottom + dfltElementSpacing;
macSizeDialogItem(theDialog, inputItm.idx, 0, textFontInfo.ascent + textFontInfo.descent);
macMoveDialogItem(theDialog, inputItm.idx, inputItm.box.left, inputItm.box.top, &inputItm.box);
- /* Convert the static text into a text edit.
- * For some reason this change need to be done last (Dany) */
+ // Convert the static text into a text edit.
+ // For some reason this change need to be done last (Dany)
GetDialogItem(theDialog, inputItm.idx, &itemType, &itemHandle, &inputItm.box);
SetDialogItem(theDialog, inputItm.idx, kEditTextDialogItem, itemHandle, &inputItm.box);
SelectDialogItemText(theDialog, inputItm.idx, 0, 32767);
}
- /* Place Button */
+ // Place Button
if (textfield != NULL)
{
buttonItm.box.left = inputItm.box.left;
@@ -5615,47 +5600,47 @@ gui_mch_dialog(
{
macMoveDialogItem(theDialog, button, buttonItm.box.left, buttonItm.box.top, &box);
- /* With vertical, it's better to have all buttons the same length */
+ // With vertical, it's better to have all buttons the same length
if (vertical)
{
macSizeDialogItem(theDialog, button, widestButton, 0);
GetDialogItem(theDialog, button, &itemType, &itemHandle, &box);
}
- /* Calculate position of next button */
+ // Calculate position of next button
if (vertical)
buttonItm.box.top = box.bottom + dfltElementSpacing;
else
buttonItm.box.left = box.right + dfltElementSpacing;
}
- /* Resize the dialog box */
+ // Resize the dialog box
dialogHeight = box.bottom + dfltElementSpacing;
SizeWindow(theWindow, maximumWidth, dialogHeight, TRUE);
- /* Magic resize */
+ // Magic resize
AutoSizeDialog(theDialog);
- /* Need a horizontal resize anyway so not that useful */
+ // Need a horizontal resize anyway so not that useful
- /* Display it */
+ // Display it
ShowWindow(theWindow);
-/* BringToFront(theWindow); */
+// BringToFront(theWindow);
SelectWindow(theWindow);
-/* DrawDialog(theDialog); */
+// DrawDialog(theDialog);
#if 0
GetPort(&oldPort);
SetPortDialogPort(theDialog);
#endif
#ifdef USE_CARBONKEYHANDLER
- /* Avoid that we use key events for the main window. */
+ // Avoid that we use key events for the main window.
dialog_busy = TRUE;
#endif
- /* Prepare the shortcut-handling filterProc for handing to the dialog */
+ // Prepare the shortcut-handling filterProc for handing to the dialog
dialogUPP = NewModalFilterUPP(DialogHotkeyFilterProc);
- /* Hang until one of the button is hit */
+ // Hang until one of the button is hit
do
ModalDialog(dialogUPP, &itemHit);
while ((itemHit < 1) || (itemHit > lastButton));
@@ -5664,26 +5649,26 @@ gui_mch_dialog(
dialog_busy = FALSE;
#endif
- /* Copy back the text entered by the user into the param */
+ // Copy back the text entered by the user into the param
if (textfield != NULL)
{
GetDialogItem(theDialog, inputItm.idx, &itemType, &itemHandle, &box);
GetDialogItemText(itemHandle, (char_u *) &name);
#if IOSIZE < 256
- /* Truncate the name to IOSIZE if needed */
+ // Truncate the name to IOSIZE if needed
if (name[0] > IOSIZE)
name[0] = IOSIZE - 1;
#endif
vim_strncpy(textfield, &name[1], name[0]);
}
- /* Restore the original graphical port */
+ // Restore the original graphical port
SetPort(oldPort);
- /* Free the modal filterProc */
+ // Free the modal filterProc
DisposeRoutineDescriptor(dialogUPP);
- /* Get ride of the dialog (free memory) */
+ // Get ride of the dialog (free memory)
DisposeDialog(theDialog);
return itemHit;
@@ -5696,7 +5681,7 @@ gui_mch_dialog(
* AutoSizeDialog(): Magic resize of dialog based on text length
*/
}
-#endif /* FEAT_DIALOG_GUI */
+#endif // FEAT_DIALOG_GUI
/*
* Display the saved error message(s).
@@ -5711,7 +5696,7 @@ display_errors(void)
if (error_ga.ga_data == NULL)
return;
- /* avoid putting up a message box with blanks only */
+ // avoid putting up a message box with blanks only
for (p = (char *)error_ga.ga_data; *p; ++p)
if (!isspace(*p))
{
@@ -5724,10 +5709,9 @@ display_errors(void)
ParamText(pError, nil, nil, nil);
Alert(128, nil);
break;
- /* TODO: handled message longer than 256 chars
- * use auto-sizeable alert
- * or dialog with scrollbars (TextEdit zone)
- */
+ // TODO: handled message longer than 256 chars
+ // use auto-sizeable alert
+ // or dialog with scrollbars (TextEdit zone)
}
ga_clear(&error_ga);
}
@@ -5750,9 +5734,9 @@ gui_mch_getmouse(int *x, int *y)
void
gui_mch_setmouse(int x, int y)
{
- /* TODO */
+ // TODO
#if 0
- /* From FAQ 3-11 */
+ // From FAQ 3-11
CursorDevicePtr myMouse;
Point where;
@@ -5760,7 +5744,7 @@ gui_mch_setmouse(int x, int y)
if ( NGetTrapAddress(_CursorDeviceDispatch, ToolTrap)
!= NGetTrapAddress(_Unimplemented, ToolTrap))
{
- /* New way */
+ // New way
/*
* Get first device with one button.
@@ -5773,7 +5757,7 @@ gui_mch_setmouse(int x, int y)
do
{
- /* Get the next cursor device */
+ // Get the next cursor device
CursorDeviceNextDevice(&myMouse);
}
while ((myMouse != nil) && (myMouse->cntButtons != 1));
@@ -5782,7 +5766,7 @@ gui_mch_setmouse(int x, int y)
}
else
{
- /* Old way */
+ // Old way
where.h = x;
where.v = y;
@@ -5811,16 +5795,16 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
Str255 HelpName = "";
GrafPtr savePort;
- /* Save Current Port: On MacOS X we seem to lose the port */
- GetPort(&savePort); /*OSX*/
+ // Save Current Port: On MacOS X we seem to lose the port
+ GetPort(&savePort); //OSX
GetMouse(&where);
- LocalToGlobal(&where); /*OSX*/
+ LocalToGlobal(&where); //OSX
CntxMenu = menu->submenu_handle;
- /* TODO: Get the text selection from Vim */
+ // TODO: Get the text selection from Vim
- /* Call to Handle Popup */
+ // Call to Handle Popup
status = ContextualMenuSelect(CntxMenu, where, false, kCMHelpItemRemoveHelp,
HelpName, NULL, &CntxType, &CntxMenuID, &CntxMenuItem);
@@ -5828,24 +5812,24 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
{
if (CntxType == kCMMenuItemSelected)
{
- /* Handle the menu CntxMenuID, CntxMenuItem */
- /* The submenu can be handle directly by gui_mac_handle_menu */
- /* But what about the current menu, is the menu changed by
- * ContextualMenuSelect */
+ // Handle the menu CntxMenuID, CntxMenuItem
+ // The submenu can be handle directly by gui_mac_handle_menu
+ // But what about the current menu, is the menu changed by
+ // ContextualMenuSelect
gui_mac_handle_menu((CntxMenuID << 16) + CntxMenuItem);
}
else if (CntxMenuID == kCMShowHelpSelected)
{
- /* Should come up with the help */
+ // Should come up with the help
}
}
- /* Restore original Port */
- SetPort(savePort); /*OSX*/
+ // Restore original Port
+ SetPort(savePort); //OSX
}
#if defined(FEAT_CW_EDITOR) || defined(PROTO)
-/* TODO: Is it need for MACOS_X? (Dany) */
+// TODO: Is it need for MACOS_X? (Dany)
void
mch_post_buffer_write(buf_T *buf)
{
@@ -5862,9 +5846,8 @@ mch_post_buffer_write(buf_T *buf)
void
gui_mch_settitle(char_u *title, char_u *icon)
{
- /* TODO: Get vim to make sure maxlen (from p_titlelen) is smaller
- * that 256. Even better get it to fit nicely in the titlebar.
- */
+ // TODO: Get vim to make sure maxlen (from p_titlelen) is smaller
+ // that 256. Even better get it to fit nicely in the titlebar.
#ifdef MACOS_CONVERT
CFStringRef windowTitle;
size_t windowTitleLen;
@@ -5872,7 +5855,7 @@ gui_mch_settitle(char_u *title, char_u *icon)
char_u *pascalTitle;
#endif
- if (title == NULL) /* nothing to do */
+ if (title == NULL) // nothing to do
return;
#ifdef MACOS_CONVERT
@@ -5925,7 +5908,7 @@ C2PascalString(char_u *CString, Str255 *PascalString)
int
GetFSSpecFromPath(char_u *file, FSSpec *fileFSSpec)
{
- /* From FAQ 8-12 */
+ // From FAQ 8-12
Str255 filePascal;
CInfoPBRec myCPB;
OSErr err;
@@ -5939,10 +5922,10 @@ GetFSSpecFromPath(char_u *file, FSSpec *fileFSSpec)
err= PBGetCatInfo(&myCPB, false);
- /* vRefNum, dirID, name */
+ // vRefNum, dirID, name
FSMakeFSSpec(0, 0, filePascal, fileFSSpec);
- /* TODO: Use an error code mechanism */
+ // TODO: Use an error code mechanism
return 0;
}
@@ -5976,36 +5959,36 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
#endif
#ifdef USE_UNIXFILENAME
- /* Get the default volume */
- /* TODO: Remove as this only work if Vim is on the Boot Volume*/
+ // Get the default volume
+ // TODO: Remove as this only work if Vim is on the Boot Volume
error=HGetVol(NULL, &dfltVol_vRefNum, &dfltVol_dirID);
if (error)
return NULL;
#endif
- /* Start filling fname with file.name */
+ // Start filling fname with file.name
vim_strncpy(filenamePtr, &file.name[1], file.name[0]);
- /* Get the info about the file specified in FSSpec */
+ // Get the info about the file specified in FSSpec
theCPB.dirInfo.ioFDirIndex = 0;
theCPB.dirInfo.ioNamePtr = file.name;
theCPB.dirInfo.ioVRefNum = file.vRefNum;
- /*theCPB.hFileInfo.ioDirID = 0;*/
+ //theCPB.hFileInfo.ioDirID = 0;
theCPB.dirInfo.ioDrDirID = file.parID;
- /* As ioFDirIndex = 0, get the info of ioNamePtr,
- which is relative to ioVrefNum, ioDirID */
+ // As ioFDirIndex = 0, get the info of ioNamePtr,
+ // which is relative to ioVrefNum, ioDirID
error = PBGetCatInfo(&theCPB, false);
- /* If we are called for a new file we expect fnfErr */
+ // If we are called for a new file we expect fnfErr
if ((error) && (error != fnfErr))
return NULL;
- /* Check if it's a file or folder */
- /* default to file if file don't exist */
+ // Check if it's a file or folder
+ // default to file if file don't exist
if (((theCPB.hFileInfo.ioFlAttrib & ioDirMask) == 0) || (error))
- folder = 0; /* It's not a folder */
+ folder = 0; // It's not a folder
else
folder = 1;
@@ -6016,12 +5999,12 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
*/
if (error == fnfErr)
{
- /* If the file to be saved does not already exist, it isn't possible
- to convert its FSSpec into an FSRef. But we can construct an
- FSSpec for the file's parent folder (since we have its volume and
- directory IDs), and since that folder does exist, we can convert
- that FSSpec into an FSRef, convert the FSRef in turn into a path,
- and, finally, append the filename. */
+ // If the file to be saved does not already exist, it isn't possible
+ // to convert its FSSpec into an FSRef. But we can construct an
+ // FSSpec for the file's parent folder (since we have its volume and
+ // directory IDs), and since that folder does exist, we can convert
+ // that FSSpec into an FSRef, convert the FSRef in turn into a path,
+ // and, finally, append the filename.
FSSpec dirSpec;
FSRef dirRef;
Str255 emptyFilename = "\p";
@@ -6043,8 +6026,8 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
}
else
{
- /* If the file to be saved already exists, we can get its full path
- by converting its FSSpec into an FSRef. */
+ // If the file to be saved already exists, we can get its full path
+ // by converting its FSSpec into an FSRef.
error=FSpMakeFSRef(&file, &refFile);
if (error)
return NULL;
@@ -6054,18 +6037,18 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
return NULL;
}
- /* Add a slash at the end if needed */
+ // Add a slash at the end if needed
if (folder)
STRCAT(path, "/");
return (vim_strsave(path));
#else
- /* TODO: Get rid of all USE_UNIXFILENAME below */
- /* Set ioNamePtr, it's the same area which is always reused. */
+ // TODO: Get rid of all USE_UNIXFILENAME below
+ // Set ioNamePtr, it's the same area which is always reused.
theCPB.dirInfo.ioNamePtr = directoryName;
- /* Trick for first entry, set ioDrParID to the first value
- * we want for ioDrDirID*/
+ // Trick for first entry, set ioDrParID to the first value
+ // we want for ioDrDirID
theCPB.dirInfo.ioDrParID = file.parID;
theCPB.dirInfo.ioDrDirID = file.parID;
@@ -6073,53 +6056,53 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
do
{
theCPB.dirInfo.ioFDirIndex = -1;
- /* theCPB.dirInfo.ioNamePtr = directoryName; Already done above. */
+ // theCPB.dirInfo.ioNamePtr = directoryName; Already done above.
theCPB.dirInfo.ioVRefNum = file.vRefNum;
- /* theCPB.dirInfo.ioDirID = irrelevant when ioFDirIndex = -1 */
+ // theCPB.dirInfo.ioDirID = irrelevant when ioFDirIndex = -1
theCPB.dirInfo.ioDrDirID = theCPB.dirInfo.ioDrParID;
- /* As ioFDirIndex = -1, get the info of ioDrDirID, */
- /* *ioNamePtr[0 TO 31] will be updated */
+ // As ioFDirIndex = -1, get the info of ioDrDirID,
+ // *ioNamePtr[0 TO 31] will be updated
error = PBGetCatInfo(&theCPB,false);
if (error)
return NULL;
- /* Put the new directoryName in front of the current fname */
+ // Put the new directoryName in front of the current fname
STRCPY(temporaryPtr, filenamePtr);
vim_strncpy(filenamePtr, &directoryName[1], directoryName[0]);
STRCAT(filenamePtr, ":");
STRCAT(filenamePtr, temporaryPtr);
}
-#if 1 /* def USE_UNIXFILENAME */
- while ((theCPB.dirInfo.ioDrParID != fsRtDirID) /* && */
- /* (theCPB.dirInfo.ioDrDirID != fsRtDirID)*/);
+#if 1 // def USE_UNIXFILENAME
+ while ((theCPB.dirInfo.ioDrParID != fsRtDirID)
+ /* && (theCPB.dirInfo.ioDrDirID != fsRtDirID)*/);
#else
while (theCPB.dirInfo.ioDrDirID != fsRtDirID);
#endif
- /* Get the information about the volume on which the file reside */
+ // Get the information about the volume on which the file reside
theCPB.dirInfo.ioFDirIndex = -1;
- /* theCPB.dirInfo.ioNamePtr = directoryName; Already done above. */
+ // theCPB.dirInfo.ioNamePtr = directoryName; Already done above.
theCPB.dirInfo.ioVRefNum = file.vRefNum;
- /* theCPB.dirInfo.ioDirID = irrelevant when ioFDirIndex = -1 */
+ // theCPB.dirInfo.ioDirID = irrelevant when ioFDirIndex = -1
theCPB.dirInfo.ioDrDirID = theCPB.dirInfo.ioDrParID;
- /* As ioFDirIndex = -1, get the info of ioDrDirID, */
- /* *ioNamePtr[0 TO 31] will be updated */
+ // As ioFDirIndex = -1, get the info of ioDrDirID,
+ // *ioNamePtr[0 TO 31] will be updated
error = PBGetCatInfo(&theCPB,false);
if (error)
return NULL;
- /* For MacOS Classic always add the volume name */
- /* For MacOS X add the volume name preceded by "Volumes" */
- /* when we are not referring to the boot volume */
+ // For MacOS Classic always add the volume name
+ // For MacOS X add the volume name preceded by "Volumes"
+ // when we are not referring to the boot volume
#ifdef USE_UNIXFILENAME
if (file.vRefNum != dfltVol_vRefNum)
#endif
{
- /* Add the volume name */
+ // Add the volume name
STRCPY(temporaryPtr, filenamePtr);
vim_strncpy(filenamePtr, &directoryName[1], directoryName[0]);
STRCAT(filenamePtr, ":");
@@ -6127,20 +6110,20 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
#ifdef USE_UNIXFILENAME
STRCPY(temporaryPtr, filenamePtr);
- filenamePtr[0] = 0; /* NULL terminate the string */
+ filenamePtr[0] = 0; // NULL terminate the string
STRCAT(filenamePtr, "Volumes:");
STRCAT(filenamePtr, temporaryPtr);
#endif
}
- /* Append final path separator if it's a folder */
+ // Append final path separator if it's a folder
if (folder)
STRCAT(fname, ":");
- /* As we use Unix File Name for MacOS X convert it */
+ // As we use Unix File Name for MacOS X convert it
#ifdef USE_UNIXFILENAME
- /* Need to insert leading / */
- /* TODO: get the above code to use directly the / */
+ // Need to insert leading /
+ // TODO: get the above code to use directly the /
STRCPY(&temporaryPtr[1], filenamePtr);
temporaryPtr[0] = '/';
STRCPY(filenamePtr, temporaryPtr);
@@ -6168,7 +6151,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
im_set_position(int row, int col)
{
# if 0
- /* TODO: Implement me! */
+ // TODO: Implement me!
im_start_row = row;
im_start_col = col;
# endif
@@ -6197,7 +6180,7 @@ im_on_window_switch(int active)
{
im_initialized = 1;
- /* save default TSM component (should be U.S.) to default */
+ // save default TSM component (should be U.S.) to default
GetDefaultInputMethodOfClass(&gTSCDefault, &gTSLDefault,
kKeyboardInputMethodClass);
}
@@ -6250,7 +6233,7 @@ im_set_active(int active)
{
im_initialized = 1;
- /* save default TSM component (should be U.S.) to default */
+ // save default TSM component (should be U.S.) to default
GetDefaultInputMethodOfClass(&gTSCDefault, &gTSLDefault,
kKeyboardInputMethodClass);
}
@@ -6282,8 +6265,8 @@ im_set_active(int active)
GetDefaultInputMethodOfClass(&gTSCInsert, slptr,
kKeyboardInputMethodClass);
- /* restore to default when switch to normal mode, so than we could
- * enter commands easier */
+ // restore to default when switch to normal mode, so than we could
+ // enter commands easier
SetDefaultInputMethodOfClass(gTSCDefault, &gTSLDefault,
kKeyboardInputMethodClass);
SetTextServiceLanguage(&gTSLDefault);
diff --git a/src/gui_motif.c b/src/gui_motif.c
index 875df500c..d5a627609 100644
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -49,7 +49,7 @@
# include <Xm/Notebook.h>
#endif
-#include "gui_xmebw.h" /* for our Enhanced Button Widget */
+#include "gui_xmebw.h" // for our Enhanced Button Widget
#if defined(FEAT_GUI_DIALOG) && defined(HAVE_XPM)
# include "../pixmaps/alert.xpm"
@@ -80,7 +80,7 @@ static Widget footer;
#endif
#ifdef FEAT_MENU
# if (XmVersion >= 1002)
-/* remember the last set value for the tearoff item */
+// remember the last set value for the tearoff item
static int tearoff_val = (int)XmTEAR_OFF_ENABLED;
# endif
static Widget menuBar;
@@ -178,10 +178,10 @@ tabline_scroller_clicked(
XtVaGetValues(tab_scroll_w, XmNx, &pos_x, XmNy, &pos_y, XmNwidth,
&width, XmNheight, &height, NULL);
if (pos_x >= 0) {
- /* Tab scroller (next) is visible */
+ // Tab scroller (next) is visible
if ((event->x >= pos_x) && (event->x <= pos_x + width) &&
(event->y >= pos_y) && (event->y <= pos_y + height)) {
- /* Clicked on the scroller */
+ // Clicked on the scroller
return TRUE;
}
}
@@ -238,7 +238,7 @@ tabline_menu_cb(
if (event->button != Button3)
return;
- /* When ignoring events don't show the menu. */
+ // When ignoring events don't show the menu.
if (hold_gui_events
# ifdef FEAT_CMDWIN
|| cmdwin_type != 0
@@ -249,7 +249,7 @@ tabline_menu_cb(
if (event->subwindow != None)
{
tab_w = XtWindowToWidget(XtDisplay(w), event->subwindow);
- /* LINTED: avoid warning: dubious operation on enum */
+ // LINTED: avoid warning: dubious operation on enum
if (tab_w != (Widget)0 && XmIsPushButton(tab_w))
XtVaGetValues(tab_w, XmNpageNumber, &tab_idx, NULL);
}
@@ -316,7 +316,7 @@ label_expose(Widget _w, XEvent *_event, Region _region)
_XmFontListGetDefaultFont(lw->label.font, &fs);
- /* FIXME: we should be doing the whole drawing ourself here. */
+ // FIXME: we should be doing the whole drawing ourself here.
insensitiveGC = lw->label.insensitive_GC;
mask = GCForeground | GCBackground | GCGraphicsExposures;
@@ -407,7 +407,7 @@ gui_x11_create_widgets(void)
XmRepTypeInstallTearOffModelConverter();
#endif
- /* Make sure the "Quit" menu entry of the window manager is ignored */
+ // Make sure the "Quit" menu entry of the window manager is ignored
XtVaSetValues(vimShell, XmNdeleteResponse, XmDO_NOTHING, NULL);
vimForm = XtVaCreateManagedWidget("vimForm",
@@ -423,7 +423,7 @@ gui_x11_create_widgets(void)
#ifdef FEAT_MENU
{
- Arg al[7]; /* Make sure there is enough room for arguments! */
+ Arg al[7]; // Make sure there is enough room for arguments!
int ac = 0;
# if (XmVersion >= 1002)
@@ -433,14 +433,14 @@ gui_x11_create_widgets(void)
XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
# ifndef FEAT_TOOLBAR
- /* Always stick to right hand side. */
+ // Always stick to right hand side.
XtSetArg(al[ac], XmNrightOffset, 0); ac++;
# endif
XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
menuBar = XmCreateMenuBar(vimForm, "menuBar", al, ac);
XtManageChild(menuBar);
- /* Remember the default colors, needed for ":hi clear". */
+ // Remember the default colors, needed for ":hi clear".
XtVaGetValues(menuBar,
XmNbackground, &gui.menu_def_bg_pixel,
XmNforeground, &gui.menu_def_fg_pixel,
@@ -483,7 +483,7 @@ gui_x11_create_widgets(void)
#endif
#ifdef FEAT_GUI_TABLINE
- /* Create the Vim GUI tabline */
+ // Create the Vim GUI tabline
n = 0;
XtSetArg(args[n], XmNbindingType, XmNONE); n++;
XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
@@ -603,7 +603,7 @@ gui_x11_create_widgets(void)
*/
gui_x11_callbacks(textArea, vimForm);
- /* Pretend we don't have input focus, we will get an event if we do. */
+ // Pretend we don't have input focus, we will get an event if we do.
gui.in_focus = FALSE;
}
@@ -627,7 +627,7 @@ gui_mch_set_text_area_pos(
int h UNUSED)
{
#ifdef FEAT_TOOLBAR
- /* Give keyboard focus to the textArea instead of the toolbar. */
+ // Give keyboard focus to the textArea instead of the toolbar.
reset_focus();
#endif
}
@@ -659,19 +659,19 @@ manage_centered(Widget dialog_child)
int x, y, win_x, win_y, maxX, maxY;
Boolean mappedWhenManaged;
- /* Temporarily set value of XmNmappedWhenManaged
- to stop the dialog from popping up right away */
+ // Temporarily set value of XmNmappedWhenManaged
+ // to stop the dialog from popping up right away
XtVaGetValues(shell, XmNmappedWhenManaged, &mappedWhenManaged, NULL);
XtVaSetValues(shell, XmNmappedWhenManaged, False, NULL);
XtManageChild(dialog_child);
- /* Get the pointer position (x, y) */
+ // Get the pointer position (x, y)
XQueryPointer(XtDisplay(shell), XtWindow(shell), &root, &child,
&x, &y, &win_x, &win_y, &mask);
- /* Translate the pointer position (x, y) into a position for the new
- window that will place the pointer at its center */
+ // Translate the pointer position (x, y) into a position for the new
+ // window that will place the pointer at its center
XGetGeometry(XtDisplay(shell), XtWindow(shell), &root, &win_x, &win_y,
&width, &height, &border_width, &depth);
width += 2 * border_width;
@@ -679,7 +679,7 @@ manage_centered(Widget dialog_child)
x -= width / 2;
y -= height / 2;
- /* Ensure that the dialog remains on screen */
+ // Ensure that the dialog remains on screen
maxX = XtScreen(shell)->width - width;
maxY = XtScreen(shell)->height - height;
if (x < 0)
@@ -691,13 +691,13 @@ manage_centered(Widget dialog_child)
if (y > maxY)
y = maxY;
- /* Set desired window position in the DialogShell */
+ // Set desired window position in the DialogShell
XtVaSetValues(shell, XmNx, x, XmNy, y, NULL);
- /* Map the widget */
+ // Map the widget
XtMapWidget(shell);
- /* Restore the value of XmNmappedWhenManaged */
+ // Restore the value of XmNmappedWhenManaged
XtVaSetValues(shell, XmNmappedWhenManaged, mappedWhenManaged, NULL);
}
@@ -712,10 +712,10 @@ gui_motif_create_fontlist(XFontStruct *font)
XmFontList font_list;
# if (XmVersion <= 1001)
- /* Motif 1.1 method */
+ // Motif 1.1 method
font_list = XmFontListCreate(font, STRING_TAG);
# else
- /* Motif 1.2 method */
+ // Motif 1.2 method
XmFontListEntry font_list_entry;
font_list_entry = XmFontListEntryCreate(STRING_TAG, XmFONT_IS_FONT,
@@ -732,7 +732,7 @@ gui_motif_fontset2fontlist(XFontSet *fontset)
{
XmFontList font_list;
- /* Motif 1.2 method */
+ // Motif 1.2 method
XmFontListEntry font_list_entry;
font_list_entry = XmFontListEntryCreate(STRING_TAG,
@@ -770,7 +770,7 @@ gui_mch_enable_menu(int flag)
#ifdef FEAT_TOOLBAR
if (XtIsManaged(XtParent(toolBar)))
{
- /* toolBar is attached to top form */
+ // toolBar is attached to top form
XtVaSetValues(XtParent(toolBar),
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, menuBar,
@@ -909,8 +909,8 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
Arg arg[2];
int n = 0;
- /* Only create the popup menu when it's actually used, otherwise there
- * is a delay when using the right mouse button. */
+ // Only create the popup menu when it's actually used, otherwise there
+ // is a delay when using the right mouse button.
# if (XmVersion <= 1002)
if (mouse_model_popup())
# endif
@@ -940,7 +940,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
XmNlabelString, label,
XmNmnemonic, p_wak[0] == 'n' ? NUL : menu->mnemonic,
#if (XmVersion >= 1002)
- /* submenu: count the tearoff item (needed for LessTif) */
+ // submenu: count the tearoff item (needed for LessTif)
XmNpositionIndex, idx + (parent != NULL
&& tearoff_val == (int)XmTEAR_OFF_ENABLED ? 1 : 0),
#endif
@@ -949,10 +949,10 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
gui_motif_menu_fontlist(menu->id);
XmStringFree(label);
- if (menu->id == (Widget)0) /* failed */
+ if (menu->id == (Widget)0) // failed
return;
- /* add accelerator text */
+ // add accelerator text
gui_motif_add_actext(menu);
shell = XtVaCreateWidget("subMenuShell",
@@ -967,11 +967,11 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
NULL);
gui_motif_menu_colors(menu->submenu_id);
- if (menu->submenu_id == (Widget)0) /* failed */
+ if (menu->submenu_id == (Widget)0) // failed
return;
#if (XmVersion >= 1002)
- /* Set the colors for the tear off widget */
+ // Set the colors for the tear off widget
toggle_tearoff(menu->submenu_id);
#endif
@@ -1005,7 +1005,7 @@ gui_motif_add_actext(vimmenu_T *menu)
{
XmString label;
- /* Add accelerator text, if there is one */
+ // Add accelerator text, if there is one
if (menu->actext != NULL && menu->id != (Widget)0)
{
label = XmStringCreate((char *)menu->actext, STRING_TAG);
@@ -1077,12 +1077,12 @@ gui_mch_text_area_extra_height(void)
*/
void
gui_mch_compute_menu_height(
- Widget id) /* can be NULL when deleting menu */
+ Widget id) // can be NULL when deleting menu
{
Dimension y, maxy;
Dimension margin, shadow;
vimmenu_T *mp;
- static Dimension height = 21; /* normal height of a menu item */
+ static Dimension height = 21; // normal height of a menu item
/*
* Get the height of the new item, before managing it, because it will
@@ -1092,7 +1092,7 @@ gui_mch_compute_menu_height(
if (id != (Widget)0)
XtVaGetValues(id, XmNheight, &height, NULL);
- /* Find any menu Widget, to be able to call XtManageChild() */
+ // Find any menu Widget, to be able to call XtManageChild()
else
for (mp = root_menu; mp != NULL; mp = mp->next)
if (mp->id != (Widget)0 && menu_is_menubar(mp->name))
@@ -1139,9 +1139,9 @@ gui_mch_compute_menu_height(
*/
gui.menu_height = maxy + height - 2 * shadow + 2 * margin + 4;
- /* Somehow the menu bar doesn't resize automatically. Set it here,
- * even though this is a catch 22. Don't do this when starting up,
- * somehow the menu gets very high then. */
+ // Somehow the menu bar doesn't resize automatically. Set it here,
+ // even though this is a catch 22. Don't do this when starting up,
+ // somehow the menu gets very high then.
if (gui.shell_created)
XtVaSetValues(menuBar, XmNheight, gui.menu_height, NULL);
}
@@ -1168,7 +1168,7 @@ check_xpm(char_u *path)
attrs.valuemask = 0;
- /* Create the "sensitive" pixmap */
+ // Create the "sensitive" pixmap
status = XpmReadFileToPixmap(gui.dpy,
RootWindow(gui.dpy, DefaultScreen(gui.dpy)),
(char *)path, &map, &mask, &attrs);
@@ -1189,20 +1189,20 @@ check_xpm(char_u *path)
static char **
get_toolbar_pixmap(vimmenu_T *menu, char **fname)
{
- char_u buf[MAXPATHL]; /* buffer storing expanded pathname */
- char **xpm = NULL; /* xpm array */
+ char_u buf[MAXPATHL]; // buffer storing expanded pathname
+ char **xpm = NULL; // xpm array
int res;
*fname = NULL;
- buf[0] = NUL; /* start with NULL path */
+ buf[0] = NUL; // start with NULL path
if (menu->iconfile != NULL)
{
- /* Use the "icon=" argument. */
+ // Use the "icon=" argument.
gui_find_iconfile(menu->iconfile, buf, "xpm");
res = check_xpm(buf);
- /* If it failed, try using the menu name. */
+ // If it failed, try using the menu name.
if (res == FAIL && gui_find_bitmap(menu->name, buf, "xpm") == OK)
res = check_xpm(buf);
if (res == OK)
@@ -1245,7 +1245,7 @@ add_pixmap_args(vimmenu_T *menu, Arg *args, int n)
}
return n;
}
-#endif /* FEAT_TOOLBAR */
+#endif // FEAT_TOOLBAR
void
gui_mch_add_menu_item(vimmenu_T *menu, int idx)
@@ -1258,7 +1258,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
# endif
# if (XmVersion <= 1002)
- /* Don't add Popup menu items when the popup menu isn't used. */
+ // Don't add Popup menu items when the popup menu isn't used.
if (menu_is_child_of_popup(menu) && !mouse_model_popup())
return;
# endif
@@ -1267,7 +1267,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
if (menu_is_toolbar(parent->name))
{
WidgetClass type;
- XmString xms = NULL; /* fallback label if pixmap not found */
+ XmString xms = NULL; // fallback label if pixmap not found
int n;
Arg args[18];
@@ -1295,17 +1295,16 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
}
else
{
- /* Without shadows one can't sense whatever the button has been
- * pressed or not! However we want to save a bit of space...
- * Need the highlightThickness to see the focus.
- */
+ // Without shadows one can't sense whatever the button has been
+ // pressed or not! However we want to save a bit of space...
+ // Need the highlightThickness to see the focus.
XtSetArg(args[n], XmNhighlightThickness, 1); n++;
XtSetArg(args[n], XmNhighlightOnEnter, True); n++;
XtSetArg(args[n], XmNmarginWidth, 0); n++;
XtSetArg(args[n], XmNmarginHeight, 0); n++;
XtSetArg(args[n], XmNtraversalOn, False); n++;
- /* Set the label here, so that we can switch between icons/text
- * by changing the XmNlabelType resource. */
+ // Set the label here, so that we can switch between icons/text
+ // by changing the XmNlabelType resource.
xms = XmStringCreate((char *)menu->dname, STRING_TAG);
XtSetArg(args[n], XmNlabelString, xms); n++;
@@ -1342,28 +1341,28 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
menu->parent = parent;
menu->submenu_id = NULL;
- /* When adding first item to toolbar it might have to be enabled .*/
+ // When adding first item to toolbar it might have to be enabled .
if (!XtIsManaged(XtParent(toolBar))
&& vim_strchr(p_go, GO_TOOLBAR) != NULL)
gui_mch_show_toolbar(TRUE);
gui.toolbar_height = gui_mch_compute_toolbar_height();
return;
- } /* toolbar menu item */
+ } // toolbar menu item
# endif
- /* No parent, must be a non-menubar menu */
+ // No parent, must be a non-menubar menu
if (parent->submenu_id == (Widget)0)
return;
menu->submenu_id = (Widget)0;
- /* Add menu separator */
+ // Add menu separator
if (menu_is_separator(menu->name))
{
menu->id = XtVaCreateWidget("subMenu",
xmSeparatorGadgetClass, parent->submenu_id,
#if (XmVersion >= 1002)
- /* count the tearoff item (needed for LessTif) */
+ // count the tearoff item (needed for LessTif)
XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED
? 1 : 0),
#endif
@@ -1380,7 +1379,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
XmNlabelString, label,
XmNmnemonic, menu->mnemonic,
#if (XmVersion >= 1002)
- /* count the tearoff item (needed for LessTif) */
+ // count the tearoff item (needed for LessTif)
XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED
? 1 : 0),
#endif
@@ -1393,7 +1392,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
{
XtAddCallback(menu->id, XmNactivateCallback, gui_x11_menu_cb,
(XtPointer)menu);
- /* add accelerator text */
+ // add accelerator text
gui_motif_add_actext(menu);
}
}
@@ -1410,7 +1409,7 @@ gui_motif_update_mousemodel(vimmenu_T *menu)
{
int idx = 0;
- /* When GUI hasn't started the menus have not been created. */
+ // When GUI hasn't started the menus have not been created.
if (!gui.in_use)
return;
@@ -1422,13 +1421,13 @@ gui_motif_update_mousemodel(vimmenu_T *menu)
{
if (mouse_model_popup())
{
- /* Popup menu will be used. Create the popup menus. */
+ // Popup menu will be used. Create the popup menus.
gui_mch_add_menu(menu, idx);
gui_motif_update_mousemodel(menu->children);
}
else
{
- /* Popup menu will not be used. Destroy the popup menus. */
+ // Popup menu will not be used. Destroy the popup menus.
gui_motif_update_mousemodel(menu->children);
gui_mch_destroy_menu(menu);
}
@@ -1520,7 +1519,7 @@ gui_mch_new_tooltip_colors(void)
static void
submenu_change(
vimmenu_T *menu,
- int colors) /* TRUE for colors, FALSE for font */
+ int colors) // TRUE for colors, FALSE for font
{
vimmenu_T *mp;
@@ -1532,8 +1531,8 @@ submenu_change(
{
gui_motif_menu_colors(mp->id);
#ifdef FEAT_TOOLBAR
- /* For a toolbar item: Free the pixmap and allocate a new one,
- * so that the background color is right. */
+ // For a toolbar item: Free the pixmap and allocate a new one,
+ // so that the background color is right.
if (mp->xpm != NULL)
{
int n = 0;
@@ -1543,7 +1542,7 @@ submenu_change(
XtSetValues(mp->id, args, n);
}
# ifdef FEAT_BEVAL_GUI
- /* If we have a tooltip, then we need to change its font */
+ // If we have a tooltip, then we need to change its font
if (mp->tip != NULL)
{
Arg args[2];
@@ -1561,7 +1560,7 @@ submenu_change(
{
gui_motif_menu_fontlist(mp->id);
#ifdef FEAT_BEVAL_GUI
- /* If we have a tooltip, then we need to change its font */
+ // If we have a tooltip, then we need to change its font
if (mp->tip != NULL)
{
Arg args[1];
@@ -1578,7 +1577,7 @@ submenu_change(
if (mp->children != NULL)
{
#if (XmVersion >= 1002)
- /* Set the colors/font for the tear off widget */
+ // Set the colors/font for the tear off widget
if (mp->submenu_id != (Widget)0)
{
if (colors)
@@ -1588,7 +1587,7 @@ submenu_change(
toggle_tearoff(mp->submenu_id);
}
#endif
- /* Set the colors for the children */
+ // Set the colors for the children
submenu_change(mp->children, colors);
}
}
@@ -1600,13 +1599,12 @@ submenu_change(
void
gui_mch_destroy_menu(vimmenu_T *menu)
{
- /* Please be sure to destroy the parent widget first (i.e. menu->id).
- * On the other hand, problems have been reported that the submenu must be
- * deleted first...
- *
- * This code should be basically identical to that in the file gui_athena.c
- * because they are both Xt based.
- */
+ // Please be sure to destroy the parent widget first (i.e. menu->id).
+ // On the other hand, problems have been reported that the submenu must be
+ // deleted first...
+ //
+ // This code should be basically identical to that in the file gui_athena.c
+ // because they are both Xt based.
if (menu->submenu_id != (Widget)0)
{
XtDestroyWidget(menu->submenu_id);
@@ -1621,15 +1619,14 @@ gui_mch_destroy_menu(vimmenu_T *menu)
#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI)
if (parent == toolBar && menu->tip != NULL)
{
- /* We try to destroy this before the actual menu, because there are
- * callbacks, etc. that will be unregistered during the tooltip
- * destruction.
- *
- * If you call "gui_mch_destroy_beval_area()" after destroying
- * menu->id, then the tooltip's window will have already been
- * deallocated by Xt, and unknown behaviour will ensue (probably
- * a core dump).
- */
+ // We try to destroy this before the actual menu, because there are
+ // callbacks, etc. that will be unregistered during the tooltip
+ // destruction.
+ //
+ // If you call "gui_mch_destroy_beval_area()" after destroying
+ // menu->id, then the tooltip's window will have already been
+ // deallocated by Xt, and unknown behaviour will ensue (probably
+ // a core dump).
gui_mch_destroy_beval_area(menu->tip);
menu->tip = NULL;
}
@@ -1643,7 +1640,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
{
Cardinal num_children;
- /* When removing last toolbar item, don't display the toolbar. */
+ // When removing last toolbar item, don't display the toolbar.
XtVaGetValues(toolBar, XmNnumChildren, &num_children, NULL);
if (num_children == 0)
gui_mch_show_toolbar(FALSE);
@@ -1663,7 +1660,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
#endif
}
-#endif /* FEAT_MENU */
+#endif // FEAT_MENU
/*
* Set the menu and scrollbar colors to their default values.
@@ -1673,8 +1670,8 @@ gui_mch_def_colors(void)
{
if (gui.in_use)
{
- /* Use the values saved when starting up. These should come from the
- * window manager or a resources file. */
+ // Use the values saved when starting up. These should come from the
+ // window manager or a resources file.
gui.menu_fg_pixel = gui.menu_def_fg_pixel;
gui.menu_bg_pixel = gui.menu_def_bg_pixel;
gui.scroll_fg_pixel = gui.scroll_def_fg_pixel;
@@ -1705,7 +1702,7 @@ gui_mch_set_scrollbar_thumb(
XmNvalue, val,
XmNsliderSize, size,
XmNpageIncrement, (size > 2 ? size - 2 : 1),
- XmNmaximum, max + 1, /* Motif has max one past the end */
+ XmNmaximum, max + 1, // Motif has max one past the end
NULL);
}
@@ -1775,8 +1772,8 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
{
if (!gui.which_scrollbars[sb->type])
{
- /* The scrollbars of this type are all disabled, adjust the
- * textArea attachment offset. */
+ // The scrollbars of this type are all disabled, adjust the
+ // textArea attachment offset.
switch (sb->type)
{
case SBAR_LEFT:
@@ -1801,7 +1798,7 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
void
gui_mch_create_scrollbar(
scrollbar_T *sb,
- int orient) /* SBAR_VERT or SBAR_HORIZ */
+ int orient) // SBAR_VERT or SBAR_HORIZ
{
Arg args[16];
int n;
@@ -1835,7 +1832,7 @@ gui_mch_create_scrollbar(
sb->id = XtCreateWidget("scrollBar",
xmScrollBarWidgetClass, textAreaForm, args, n);
- /* Remember the default colors, needed for ":hi clear". */
+ // Remember the default colors, needed for ":hi clear".
if (gui.scroll_def_bg_pixel == (guicolor_T)0
&& gui.scroll_def_fg_pixel == (guicolor_T)0)
XtVaGetValues(sb->id,
@@ -1887,7 +1884,7 @@ gui_mch_set_scrollbar_colors(scrollbar_T *sb)
NULL);
}
- /* This is needed for the rectangle below the vertical scrollbars. */
+ // This is needed for the rectangle below the vertical scrollbars.
if (sb == &gui.bottom_sbar && textAreaForm != (Widget)0)
gui_motif_scroll_colors(textAreaForm);
}
@@ -2082,8 +2079,8 @@ set_fontlist(Widget id)
{
XtUnmanageChild(id);
XtVaSetValues(id, XmNfontList, fl, NULL);
- /* We should force the widget to recalculate its
- * geometry now. */
+ // We should force the widget to recalculate its
+ // geometry now.
XtManageChild(id);
}
else
@@ -2101,8 +2098,8 @@ set_fontlist(Widget id)
{
XtUnmanageChild(id);
XtVaSetValues(id, XmNfontList, fl, NULL);
- /* We should force the widget to recalculate its
- * geometry now. */
+ // We should force the widget to recalculate its
+ // geometry now.
XtManageChild(id);
}
else
@@ -2125,14 +2122,14 @@ set_fontlist(Widget id)
typedef struct dialog_callback_arg
{
- char * args; /* not used right now */
+ char * args; // not used right now
int id;
} dcbarg_T;
static Widget dialog_wgt;
static char *browse_fname = NULL;
static XmStringCharSet charset = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET;
- /* used to set up XmStrings */
+ // used to set up XmStrings
static void DialogCancelCB(Widget, XtPointer, XtPointer);
static void DialogAcceptCB(Widget, XtPointer, XtPointer);
@@ -2208,22 +2205,21 @@ set_predefined_fontlist(Widget parent, String name)
*/
char_u *
gui_mch_browse(
- int saving UNUSED, /* select file to write */
- char_u *title, /* title for the window */
- char_u *dflt, /* default name */
- char_u *ext UNUSED, /* not used (extension added) */
- char_u *initdir, /* initial directory, NULL for current dir */
- char_u *filter) /* file name filter */
+ int saving UNUSED, // select file to write
+ char_u *title, // title for the window
+ char_u *dflt, // default name
+ char_u *ext UNUSED, // not used (extension added)
+ char_u *initdir, // initial directory, NULL for current dir
+ char_u *filter) // file name filter
{
char_u dirbuf[MAXPATHL];
char_u dfltbuf[MAXPATHL];
char_u *pattern;
char_u *tofree = NULL;
- /* There a difference between the resource name and value, Therefore, we
- * avoid to (ab-)use the (maybe internationalized!) dialog title as a
- * dialog name.
- */
+ // There a difference between the resource name and value, Therefore, we
+ // avoid to (ab-)use the (maybe internationalized!) dialog title as a
+ // dialog name.
dialog_wgt = XmCreateFileSelectionDialog(vimShell, "browseDialog", NULL, 0);
@@ -2237,16 +2233,16 @@ gui_mch_browse(
dflt = (char_u *)"";
else if (STRLEN(initdir) + STRLEN(dflt) + 2 < MAXPATHL)
{
- /* The default selection should be the full path, "dflt" is only the
- * file name. */
+ // The default selection should be the full path, "dflt" is only the
+ // file name.
STRCPY(dfltbuf, initdir);
add_pathsep(dfltbuf);
STRCAT(dfltbuf, dflt);
dflt = dfltbuf;
}
- /* Can only use one pattern for a file name. Get the first pattern out of
- * the filter. An empty pattern means everything matches. */
+ // Can only use one pattern for a file name. Get the first pattern out of
+ // the filter. An empty pattern means everything matches.
if (filter == NULL)
pattern = (char_u *)"";
else
@@ -2256,9 +2252,9 @@ gui_mch_browse(
s = filter;
for (p = filter; *p != NUL; ++p)
{
- if (*p == '\t') /* end of description, start of pattern */
+ if (*p == '\t') // end of description, start of pattern
s = p + 1;
- if (*p == ';' || *p == '\n') /* end of (first) pattern */
+ if (*p == ';' || *p == '\n') // end of (first) pattern
break;
}
pattern = vim_strnsave(s, p - s);
@@ -2287,9 +2283,8 @@ gui_mch_browse(
set_predefined_label(dialog_wgt, "OK", _("&OK"));
set_predefined_label(dialog_wgt, "Selection", _("Selection"));
- /* This is to save us from silly external settings using not fixed with
- * fonts for file selection.
- */
+ // This is to save us from silly external settings using not fixed with
+ // fonts for file selection.
set_predefined_fontlist(dialog_wgt, "DirListSW.DirList");
set_predefined_fontlist(dialog_wgt, "ItemsListSW.ItemsList");
@@ -2299,14 +2294,14 @@ gui_mch_browse(
XtAddCallback(dialog_wgt, XmNokCallback, DialogAcceptCB, (XtPointer)0);
XtAddCallback(dialog_wgt, XmNcancelCallback, DialogCancelCB, (XtPointer)0);
- /* We have no help in this window, so hide help button */
+ // We have no help in this window, so hide help button
XtUnmanageChild(XmFileSelectionBoxGetChild(dialog_wgt,
(unsigned char)XmDIALOG_HELP_BUTTON));
manage_centered(dialog_wgt);
activate_dialog_mnemonics(dialog_wgt);
- /* sit in a loop until the dialog box has gone away */
+ // sit in a loop until the dialog box has gone away
do
{
XtAppProcessEvent(XtWidgetToApplicationContext(dialog_wgt),
@@ -2333,9 +2328,9 @@ gui_mch_browse(
*/
static void
DialogCancelCB(
- Widget w UNUSED, /* widget id */
- XtPointer client_data UNUSED, /* data from application */
- XtPointer call_data UNUSED) /* data from widget class */
+ Widget w UNUSED, // widget id
+ XtPointer client_data UNUSED, // data from application
+ XtPointer call_data UNUSED) // data from widget class
{
if (browse_fname != NULL)
{
@@ -2350,9 +2345,9 @@ DialogCancelCB(
*/
static void
DialogAcceptCB(
- Widget w UNUSED, /* widget id */
- XtPointer client_data UNUSED, /* data from application */
- XtPointer call_data) /* data from widget class */
+ Widget w UNUSED, // widget id
+ XtPointer client_data UNUSED, // data from application
+ XtPointer call_data) // data from widget class
{
XmFileSelectionBoxCallbackStruct *fcb;
@@ -2363,14 +2358,14 @@ DialogAcceptCB(
}
fcb = (XmFileSelectionBoxCallbackStruct *)call_data;
- /* get the filename from the file selection box */
+ // get the filename from the file selection box
XmStringGetLtoR(fcb->value, charset, &browse_fname);
- /* popdown the file selection box */
+ // popdown the file selection box
XtUnmanageChild(dialog_wgt);
}
-#endif /* FEAT_BROWSE */
+#endif // FEAT_BROWSE
#if defined(FEAT_GUI_DIALOG) || defined(PROTO)
@@ -2483,7 +2478,7 @@ gui_mch_dialog(
char_u *message,
char_u *button_names,
int dfltbutton,
- char_u *textfield, /* buffer of size IOSIZE */
+ char_u *textfield, // buffer of size IOSIZE
int ex_cmd UNUSED)
{
char_u *buts;
@@ -2509,15 +2504,15 @@ gui_mch_dialog(
if (title == NULL)
title = (char_u *)_("Vim dialog");
- /* if our pointer is currently hidden, then we should show it. */
+ // if our pointer is currently hidden, then we should show it.
gui_mch_mousehide(FALSE);
dialogform = XmCreateFormDialog(vimShell, (char *)"dialog", NULL, 0);
- /* Check 'v' flag in 'guioptions': vertical button placement. */
+ // Check 'v' flag in 'guioptions': vertical button placement.
vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
- /* Set the title of the Dialog window */
+ // Set the title of the Dialog window
label = XmStringCreateSimple((char *)title);
if (label == NULL)
return -1;
@@ -2528,12 +2523,12 @@ gui_mch_dialog(
NULL);
XmStringFree(label);
- /* make a copy, so that we can insert NULs */
+ // make a copy, so that we can insert NULs
buts = vim_strsave(button_names);
if (buts == NULL)
return -1;
- /* Count the number of buttons and allocate buttons[]. */
+ // Count the number of buttons and allocate buttons[].
butcount = 1;
for (p = buts; *p; ++p)
if (*p == DLG_BUTTON_SEP)
@@ -2588,7 +2583,7 @@ gui_mch_dialog(
XmStringFree(label);
gui_motif_menu_fontlist(buttons[butcount]);
- /* Layout properly. */
+ // Layout properly.
if (butcount > 0)
{
@@ -2605,7 +2600,7 @@ gui_mch_dialog(
XmNrightOffset, 4,
NULL);
- /* fill in a form as invisible separator */
+ // fill in a form as invisible separator
sep_form = XtVaCreateWidget("separatorForm",
xmFormWidgetClass, dialogform,
XmNleftAttachment, XmATTACH_WIDGET,
@@ -2635,7 +2630,7 @@ gui_mch_dialog(
XmNrightOffset, 4,
NULL);
- /* fill in a form as invisible separator */
+ // fill in a form as invisible separator
sep_form = XtVaCreateWidget("separatorForm",
xmFormWidgetClass, dialogform,
XmNleftAttachment, XmATTACH_FORM,
@@ -2663,7 +2658,7 @@ gui_mch_dialog(
separator = (Widget) 0;
if (butcount > 0)
{
- /* Create the separator for beauty. */
+ // Create the separator for beauty.
n = 0;
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
@@ -2699,7 +2694,7 @@ gui_mch_dialog(
(XtEventHandler)keyhit_callback, (XtPointer)NULL);
}
- /* Form holding both message and pixmap labels */
+ // Form holding both message and pixmap labels
form = XtVaCreateWidget("separatorForm",
xmFormWidgetClass, dialogform,
XmNleftAttachment, XmATTACH_FORM,
@@ -2709,7 +2704,7 @@ gui_mch_dialog(
XtManageChild(form);
#ifdef HAVE_XPM
- /* Add a pixmap, left of the message. */
+ // Add a pixmap, left of the message.
switch (type)
{
case VIM_GENERIC:
@@ -2744,12 +2739,11 @@ gui_mch_dialog(
XtManageChild(dialogpixmap);
#endif
- /* Create the dialog message.
- * Since LessTif is apparently having problems with the creation of
- * properly localized string, we use LtoR here. The symptom is that the
- * string sill not show properly in multiple lines as it does in native
- * Motif.
- */
+ // Create the dialog message.
+ // Since LessTif is apparently having problems with the creation of
+ // properly localized string, we use LtoR here. The symptom is that the
+ // string sill not show properly in multiple lines as it does in native
+ // Motif.
label = XmStringCreateLtoR((char *)message, STRING_TAG);
if (label == NULL)
return -1;
@@ -2811,7 +2805,7 @@ gui_mch_dialog(
if (textfield != NULL && *textfield != NUL)
{
- /* This only works after the textfield has been realised. */
+ // This only works after the textfield has been realised.
XmTextFieldSetSelection(dialogtextfield,
(XmTextPosition)0, (XmTextPosition)STRLEN(textfield),
XtLastTimestampProcessed(gui.dpy));
@@ -2821,7 +2815,7 @@ gui_mch_dialog(
app = XtWidgetToApplicationContext(dialogform);
- /* Loop until a button is pressed or the dialog is killed somehow. */
+ // Loop until a button is pressed or the dialog is killed somehow.
dialogStatus = -1;
for (;;)
{
@@ -2847,17 +2841,17 @@ gui_mch_dialog(
return dialogStatus;
}
-#endif /* FEAT_GUI_DIALOG */
+#endif // FEAT_GUI_DIALOG
#if defined(FEAT_FOOTER) || defined(PROTO)
static int
gui_mch_compute_footer_height(void)
{
- Dimension height; /* total Toolbar height */
- Dimension top; /* XmNmarginTop */
- Dimension bottom; /* XmNmarginBottom */
- Dimension shadow; /* XmNshadowThickness */
+ Dimension height; // total Toolbar height
+ Dimension top; // XmNmarginTop
+ Dimension bottom; // XmNmarginBottom
+ Dimension shadow; // XmNshadowThickness
XtVaGetValues(footer,
XmNheight, &height,
@@ -2905,16 +2899,15 @@ gui_mch_set_footer(char_u *s)
void
gui_mch_show_toolbar(int showit)
{
- Cardinal numChildren; /* how many children toolBar has */
+ Cardinal numChildren; // how many children toolBar has
if (toolBar == (Widget)0)
return;
XtVaGetValues(toolBar, XmNnumChildren, &numChildren, NULL);
if (showit && numChildren > 0)
{
- /* Assume that we want to show the toolbar if p_toolbar contains
- * valid option settings, therefore p_toolbar must not be NULL.
- */
+ // Assume that we want to show the toolbar if p_toolbar contains
+ // valid option settings, therefore p_toolbar must not be NULL.
WidgetList children;
XtVaGetValues(toolBar, XmNchildren, &children, NULL);
@@ -2938,12 +2931,11 @@ gui_mch_show_toolbar(int showit)
for (toolbar = root_menu; toolbar; toolbar = toolbar->next)
if (menu_is_toolbar(toolbar->dname))
break;
- /* Assumption: toolbar is NULL if there is no toolbar,
- * otherwise it contains the toolbar menu structure.
- *
- * Assumption: "numChildren" == the number of items in the list
- * of items beginning with toolbar->children.
- */
+ // Assumption: toolbar is NULL if there is no toolbar,
+ // otherwise it contains the toolbar menu structure.
+ //
+ // Assumption: "numChildren" == the number of items in the list
+ // of items beginning with toolbar->children.
if (toolbar)
{
for (cur = toolbar->children; cur; cur = cur->next)
@@ -2951,8 +2943,8 @@ gui_mch_show_toolbar(int showit)
Arg args[1];
int n = 0;
- /* Enable/Disable tooltip (OK to enable while
- * currently enabled). */
+ // Enable/Disable tooltip (OK to enable while
+ // currently enabled).
if (cur->tip != NULL)
(*action)(cur->tip);
if (!menu_is_separator(cur->name))
@@ -3068,16 +3060,16 @@ reset_focus(void)
gui_mch_compute_toolbar_height(void)
{
Dimension borders;
- Dimension height; /* total Toolbar height */
- Dimension whgt; /* height of each widget */
- WidgetList children; /* list of toolBar's children */
- Cardinal numChildren; /* how many children toolBar has */
+ Dimension height; // total Toolbar height
+ Dimension whgt; // height of each widget
+ WidgetList children; // list of toolBar's children
+ Cardinal numChildren; // how many children toolBar has
int i;
borders = 0;
height = 0;
if (toolBar != (Widget)0 && toolBarFrame != (Widget)0)
- { /* get height of XmFrame parent */
+ { // get height of XmFrame parent
Dimension fst;
Dimension fmh;
Dimension tst;
@@ -3103,7 +3095,7 @@ gui_mch_compute_toolbar_height(void)
}
}
#ifdef LESSTIF_VERSION
- /* Hack: When starting up we get wrong dimensions. */
+ // Hack: When starting up we get wrong dimensions.
if (height < 10)
height = 24;
#endif
@@ -3256,7 +3248,7 @@ gui_mch_update_tabline(void)
if (tabLine == (Widget)0)
return;
- /* Add a label for each tab page. They all contain the same text area. */
+ // 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)
@@ -3266,7 +3258,7 @@ gui_mch_update_tabline(void)
if (page_status == XmPAGE_INVALID
|| page_info.major_tab_widget == (Widget)0)
{
- /* Add the tab */
+ // Add the tab
n = 0;
XtSetArg(args[n], XmNnotebookChildType, XmMAJOR_TAB); n++;
XtSetArg(args[n], XmNtraversalOn, False); n++;
@@ -3309,7 +3301,7 @@ gui_mch_update_tabline(void)
XtVaGetValues(tabLine, XmNlastPageNumber, &last_page, NULL);
- /* Remove any old labels. */
+ // Remove any old labels.
while (nr <= last_page)
{
if (XmNotebookGetPageInfo(tabLine, nr, &page_info) != XmPAGE_INVALID
@@ -3400,8 +3392,8 @@ gui_motif_menu_fontlist(Widget id UNUSED)
{
XtUnmanageChild(id);
XtVaSetValues(id, XmNfontList, fl, NULL);
- /* We should force the widget to recalculate its
- * geometry now. */
+ // We should force the widget to recalculate its
+ // geometry now.
XtManageChild(id);
}
else
@@ -3421,8 +3413,8 @@ gui_motif_menu_fontlist(Widget id UNUSED)
{
XtUnmanageChild(id);
XtVaSetValues(id, XmNfontList, fl, NULL);
- /* We should force the widget to recalculate its
- * geometry now. */
+ // We should force the widget to recalculate its
+ // geometry now.
XtManageChild(id);
}
else
@@ -3441,17 +3433,17 @@ gui_motif_menu_fontlist(Widget id UNUSED)
typedef struct _SharedFindReplace
{
- Widget dialog; /* the main dialog widget */
- Widget wword; /* 'Exact match' check button */
- Widget mcase; /* 'match case' check button */
- Widget up; /* search direction 'Up' radio button */
- Widget down; /* search direction 'Down' radio button */
- Widget what; /* 'Find what' entry text widget */
- Widget with; /* 'Replace with' entry text widget */
- Widget find; /* 'Find Next' action button */
- Widget replace; /* 'Replace With' action button */
- Widget all; /* 'Replace All' action button */
- Widget undo; /* 'Undo' action button */
+ Widget dialog; // the main dialog widget
+ Widget wword; // 'Exact match' check button
+ Widget mcase; // 'match case' check button
+ Widget up; // search direction 'Up' radio button
+ Widget down; // search direction 'Down' radio button
+ Widget what; // 'Find what' entry text widget
+ Widget with; // 'Replace with' entry text widget
+ Widget find; // 'Find Next' action button
+ Widget replace; // 'Replace With' action button
+ Widget all; // 'Replace All' action button
+ Widget undo; // 'Undo' action button
Widget cancel;
} SharedFindReplace;
@@ -3468,7 +3460,7 @@ find_replace_destroy_callback(
SharedFindReplace *cd = (SharedFindReplace *)client_data;
if (cd != NULL)
- /* suppress_dialog_mnemonics(cd->dialog); */
+ // suppress_dialog_mnemonics(cd->dialog);
cd->dialog = (Widget)0;
}
@@ -3510,7 +3502,7 @@ find_replace_callback(
{
char_u *save_cpo = p_cpo;
- /* No need to be Vi compatible here. */
+ // No need to be Vi compatible here.
p_cpo = (char_u *)"";
u_undo(1);
p_cpo = save_cpo;
@@ -3518,7 +3510,7 @@ find_replace_callback(
return;
}
- /* Get the search/replace strings from the dialog */
+ // Get the search/replace strings from the dialog
if (flags == FRD_FINDNEXT)
{
repl_text = NULL;
@@ -3560,7 +3552,7 @@ find_replace_keypress(
keysym = XLookupKeysym(event, 0);
- /* the scape key pops the whole dialog down */
+ // the scape key pops the whole dialog down
if (keysym == XK_Escape)
XtUnmanageChild(frdp->dialog);
}
@@ -3625,15 +3617,15 @@ find_replace_dialog_create(char_u *arg, int do_replace)
frdp = do_replace ? &repl_widgets : &find_widgets;
- /* Get the search string to use. */
+ // Get the search string to use.
entry_text = get_find_dialog_text(arg, &wword, &mcase);
- /* If the dialog already exists, just raise it. */
+ // If the dialog already exists, just raise it.
if (frdp->dialog)
{
gui_motif_synch_fonts();
- /* If the window is already up, just pop it to the top */
+ // If the window is already up, just pop it to the top
if (XtIsManaged(frdp->dialog))
XMapRaised(XtDisplay(frdp->dialog),
XtWindow(XtParent(frdp->dialog)));
@@ -3650,7 +3642,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
return;
}
- /* Create a fresh new dialog window */
+ // Create a fresh new dialog window
if (do_replace)
str = XmStringCreateSimple(_("VIM - Search and Replace..."));
else
@@ -3832,8 +3824,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
(XtEventHandler)find_replace_keypress,
(XtPointer)frdp);
- /* Get the maximum width between the label widgets and line them up.
- */
+ // Get the maximum width between the label widgets and line them up.
n = 0;
XtSetArg(args[n], XmNwidth, &width); n++;
XtGetValues(label_what, args, n);
@@ -3990,15 +3981,15 @@ gui_motif_synch_fonts(void)
XFontStruct *font;
XmFontList font_list;
- /* FIXME: Unless we find out how to create a XmFontList from a XFontSet,
- * we just give up here on font synchronization. */
+ // FIXME: Unless we find out how to create a XmFontList from a XFontSet,
+ // we just give up here on font synchronization.
font = (XFontStruct *)gui.norm_font;
if (font == NULL)
return;
font_list = gui_motif_create_fontlist(font);
- /* OK this loop is a bit tricky... */
+ // OK this loop is a bit tricky...
for (do_replace = 0; do_replace <= 1; ++do_replace)
{
frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
diff --git a/src/gui_photon.c b/src/gui_photon.c
index 8d0c27171..963cabc27 100644
--- a/src/gui_photon.c
+++ b/src/gui_photon.c
@@ -13,7 +13,7 @@
#include "vim.h"
-/* cproto fails on missing include files */
+// cproto fails on missing include files
#ifndef PROTO
# ifdef FEAT_TOOLBAR
# include <photon/PxImage.h>
@@ -21,7 +21,7 @@
#endif
#if !defined(__QNX__)
-/* Used when generating prototypes. */
+// Used when generating prototypes.
# define PgColor_t int
# define PhEvent_t int
# define PhPoint_t int
@@ -39,11 +39,11 @@
#define EVENT_BUFFER_SIZE sizeof(PhEvent_t) + 1000
-/* Some defines for gui_mch_mousehide() */
+// Some defines for gui_mch_mousehide()
#define MOUSE_HIDE TRUE
#define MOUSE_SHOW FALSE
-/* Optional support for using a PtPanelGroup widget, needs work */
+// Optional support for using a PtPanelGroup widget, needs work
#undef USE_PANEL_GROUP
#ifdef USE_PANEL_GROUP
@@ -53,15 +53,15 @@ static ushort_t num_panels = 0;
static short pg_margin_left, pg_margin_right, pg_margin_top, pg_margin_bottom;
#endif
-#define GUI_PH_MARGIN 4 /* Size of the bevel */
+#define GUI_PH_MARGIN 4 // Size of the bevel
#define GUI_PH_MOUSE_TYPE Ph_CURSOR_INSERT
static PgColor_t gui_ph_mouse_color = Pg_BLACK;
static PhPoint_t gui_ph_raw_offset;
-static PtWidget_t *gui_ph_timer_cursor; /* handle cursor blinking */
-static PtWidget_t *gui_ph_timer_timeout; /* used in gui_mch_wait_for_chars */
-static short is_timeout; /* Has the timeout occurred? */
+static PtWidget_t *gui_ph_timer_cursor; // handle cursor blinking
+static PtWidget_t *gui_ph_timer_timeout; // used in gui_mch_wait_for_chars
+static short is_timeout; // Has the timeout occurred?
/*
* This is set inside the mouse callback for a right mouse
@@ -69,10 +69,10 @@ static short is_timeout; /* Has the timeout occurred? */
*/
static PhPoint_t abs_mouse;
-/* Try and avoid redraws while a resize is in progress */
+// Try and avoid redraws while a resize is in progress
static int is_ignore_draw = FALSE;
-/* Used for converting to/from utf-8 and other charsets */
+// Used for converting to/from utf-8 and other charsets
static struct PxTransCtrl *charset_translate;
/*
@@ -160,23 +160,23 @@ static struct
{Pk_KP_Multiply,'K', '9'},
{Pk_KP_Enter, 'K', 'A'},
- {Pk_KP_0, KS_EXTRA, KE_KINS}, /* Insert */
- {Pk_KP_Decimal, KS_EXTRA, KE_KDEL}, /* Delete */
+ {Pk_KP_0, KS_EXTRA, KE_KINS}, // Insert
+ {Pk_KP_Decimal, KS_EXTRA, KE_KDEL}, // Delete
- {Pk_KP_4, 'k', 'l'}, /* Left */
- {Pk_KP_6, 'k', 'r'}, /* Right */
- {Pk_KP_8, 'k', 'u'}, /* Up */
- {Pk_KP_2, 'k', 'd'}, /* Down */
+ {Pk_KP_4, 'k', 'l'}, // Left
+ {Pk_KP_6, 'k', 'r'}, // Right
+ {Pk_KP_8, 'k', 'u'}, // Up
+ {Pk_KP_2, 'k', 'd'}, // Down
- {Pk_KP_7, 'K', '1'}, /* Home */
- {Pk_KP_1, 'K', '4'}, /* End */
+ {Pk_KP_7, 'K', '1'}, // Home
+ {Pk_KP_1, 'K', '4'}, // End
- {Pk_KP_9, 'K', '3'}, /* Page Up */
- {Pk_KP_3, 'K', '5'}, /* Page Down */
+ {Pk_KP_9, 'K', '3'}, // Page Up
+ {Pk_KP_3, 'K', '5'}, // Page Down
- {Pk_KP_5, '&', '8'}, /* Undo */
+ {Pk_KP_5, '&', '8'}, // Undo
- /* Keys that we want to be able to use any modifier with: */
+ // Keys that we want to be able to use any modifier with:
{Pk_Return, CAR, NUL},
{Pk_space, ' ', NUL},
{Pk_Tab, TAB, NUL},
@@ -184,12 +184,12 @@ static struct
{NL, NL, NUL},
{CAR, CAR, NUL},
- /* End of list marker: */
+ // End of list marker:
{0, 0, 0}
};
-/****************************************************************************/
+////////////////////////////////////////////////////////////////////////////
static PtCallbackF_t gui_ph_handle_timer_cursor;
static PtCallbackF_t gui_ph_handle_timer_timeout;
@@ -201,11 +201,11 @@ static PtCallbackF_t gui_ph_handle_keyboard;
static PtCallbackF_t gui_ph_handle_mouse;
static PtCallbackF_t gui_ph_handle_pulldown_menu;
static PtCallbackF_t gui_ph_handle_menu;
-static PtCallbackF_t gui_ph_handle_focus; /* focus change of text area */
+static PtCallbackF_t gui_ph_handle_focus; // focus change of text area
static PtCallbackF_t gui_ph_handle_menu_resize;
-/* When a menu is unrealized, give focus back to vimTextArea */
+// When a menu is unrealized, give focus back to vimTextArea
static PtCallbackF_t gui_ph_handle_menu_unrealized;
#ifdef USE_PANEL_GROUP
@@ -215,7 +215,7 @@ static void gui_ph_get_panelgroup_margins(short*, short*, short*, short*);
static void gui_ph_draw_start(void);
static void gui_ph_draw_end(void);
-/* Set the text for the balloon */
+// Set the text for the balloon
static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window,
PtWidget_t *widget,
int position,
@@ -224,7 +224,7 @@ static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window,
PgColor_t fill_color,
PgColor_t text_color);
-/****************************************************************************/
+////////////////////////////////////////////////////////////////////////////
static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window,
PtWidget_t *widget,
@@ -241,7 +241,7 @@ static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window,
PtSetArg(&arg, Pt_ARG_POINTER, &menu, 0);
PtGetResources(widget, 1, &arg);
- /* Override the text and position */
+ // Override the text and position
tooltip = text;
if (menu != NULL)
@@ -254,8 +254,8 @@ static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window,
return PtInflateBalloon(
window,
widget,
- /* Don't put the balloon at the bottom,
- * it gets drawn over by gfx done in the PtRaw */
+ // Don't put the balloon at the bottom,
+ // it gets drawn over by gfx done in the PtRaw
Pt_BALLOON_TOP,
tooltip,
font,
@@ -287,9 +287,9 @@ gui_ph_handle_menu_resize(
height = sizes->new_dim.h;
- /* Because vim treats the toolbar and menubar separately,
- * and here they're lumped together into a PtToolbarGroup,
- * we only need either menu_height or toolbar_height set at once */
+ // Because vim treats the toolbar and menubar separately,
+ // and here they're lumped together into a PtToolbarGroup,
+ // we only need either menu_height or toolbar_height set at once
if (gui.menu_is_active)
{
gui.menu_height = height;
@@ -368,7 +368,7 @@ gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
break;
case Ph_WM_FOCUS:
- /* Just in case it's hidden and needs to be shown */
+ // Just in case it's hidden and needs to be shown
gui_mch_mousehide(MOUSE_SHOW);
if (we->event_state == Ph_WM_EVSTATE_FOCUS)
@@ -424,7 +424,7 @@ gui_ph_handle_scrollbar(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
break;
case Pt_SCROLL_SET:
- /* FIXME: return straight away here? */
+ // FIXME: return straight away here?
return Pt_CONTINUE;
break;
}
@@ -449,7 +449,7 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
if (p_mh)
gui_mch_mousehide(MOUSE_HIDE);
- /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */
+ // We're a good lil photon program, aren't we? yes we are, yeess wee arrr
if (key->key_flags & Pk_KF_Compose)
return Pt_CONTINUE;
@@ -469,7 +469,7 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
(*p_wak == 'm' &&
gui_is_menu_shortcut(key->key_cap))))
{
- /* Fallthrough and let photon look for the hotkey */
+ // Fallthrough and let photon look for the hotkey
return Pt_CONTINUE;
}
#endif
@@ -483,13 +483,13 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
ch = special_keys[i].vim_code0;
else
{
- /* Detect if a keypad number key has been pressed
- * and change the key if Num Lock is on */
+ // Detect if a keypad number key has been pressed
+ // and change the key if Num Lock is on
if (key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9
&& (key->key_mods & Pk_KM_Num_Lock))
{
- /* FIXME: For now, just map the key to a ascii value
- * (see <photon/PkKeyDef.h>) */
+ // FIXME: For now, just map the key to a ascii value
+ // (see <photon/PkKeyDef.h>)
ch = key->key_cap - 0xf080;
}
else
@@ -507,7 +507,7 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
if (key->key_mods & Pk_KM_Shift)
modifiers |= MOD_MASK_SHIFT;
- /* Is this not a special key? */
+ // Is this not a special key?
if (special_keys[i].key_sym == 0)
{
ch = PhTo8859_1(key);
@@ -542,7 +542,7 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
ch = key->key_cap;
if (ch < 0xff)
{
- /* FIXME: is this the right thing to do? */
+ // FIXME: is this the right thing to do?
if (modifiers & MOD_MASK_CTRL)
{
modifiers &= ~MOD_MASK_CTRL;
@@ -605,7 +605,7 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
if (len == 1 && string[0] == CSI)
{
- /* Turn CSI into K_CSI. */
+ // Turn CSI into K_CSI.
string[ len++ ] = KS_EXTRA;
string[ len++ ] = KE_CSI;
}
@@ -663,7 +663,7 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
if (pointer->buttons & Ph_BUTTON_MENU)
{
button = MOUSE_RIGHT;
- /* Need the absolute coordinates for the popup menu */
+ // Need the absolute coordinates for the popup menu
abs_mouse.x = pointer->pos.x;
abs_mouse.y = pointer->pos.y;
}
@@ -671,7 +671,7 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
if (pointer->buttons & Ph_BUTTON_ADJUST)
button = MOUSE_MIDDLE;
- /* Catch a real release (not phantom or other releases */
+ // Catch a real release (not phantom or other releases
if (info->event->type == Ph_EV_BUT_RELEASE)
button = MOUSE_RELEASE;
@@ -679,12 +679,12 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
button = MOUSE_DRAG;
#if 0
- /* Vim doesn't use button repeats */
+ // Vim doesn't use button repeats
if (info->event->type & Ph_EV_BUT_REPEAT)
button = MOUSE_DRAG;
#endif
- /* Don't do anything if it is one of the phantom mouse release events */
+ // Don't do anything if it is one of the phantom mouse release events
if ((button != MOUSE_RELEASE) ||
(info->event->subtype == Ph_EV_RELEASE_REAL))
{
@@ -696,7 +696,9 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
return Pt_CONTINUE;
}
-/* Handle a focus change of the PtRaw widget */
+/*
+ * Handle a focus change of the PtRaw widget
+ */
static int
gui_ph_handle_focus(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
{
@@ -745,7 +747,7 @@ gui_ph_handle_raw_draw(PtWidget_t *widget, PhTile_t *damage)
PhTranslatePoint(&offset, PtWidgetPos(gui.vimTextArea, NULL));
#if 1
- /* Redraw individual damage regions */
+ // Redraw individual damage regions
if (damage->next != NULL)
damage = damage->next;
@@ -759,7 +761,7 @@ gui_ph_handle_raw_draw(PtWidget_t *widget, PhTile_t *damage)
damage = damage->next;
}
#else
- /* Redraw the rectangle that covers all the damaged regions */
+ // Redraw the rectangle that covers all the damaged regions
r = &damage->rect;
gui_redraw(
r->ul.x - offset.x, r->ul.y - offset.y,
@@ -787,7 +789,9 @@ gui_ph_handle_pulldown_menu(
return Pt_CONTINUE;
}
-/* This is used for pulldown/popup menus and also toolbar buttons */
+/*
+ * This is used for pulldown/popup menus and also toolbar buttons
+ */
static int
gui_ph_handle_menu(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
{
@@ -799,7 +803,9 @@ gui_ph_handle_menu(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
return Pt_CONTINUE;
}
-/* Stop focus from disappearing into the menubar... */
+/*
+ * Stop focus from disappearing into the menubar...
+ */
static int
gui_ph_handle_menu_unrealized(
PtWidget_t *widget,
@@ -820,12 +826,14 @@ gui_ph_handle_window_open(
return Pt_CONTINUE;
}
-/****************************************************************************/
+////////////////////////////////////////////////////////////////////////////
#define DRAW_START gui_ph_draw_start()
#define DRAW_END gui_ph_draw_end()
-/* TODO: Set a clipping rect? */
+/*
+ * TODO: Set a clipping rect?
+ */
static void
gui_ph_draw_start(void)
{
@@ -888,8 +896,8 @@ gui_ph_pg_set_buffer_num(int_u buf_num)
for (i = 0; i < num_panels; i++)
{
- /* find the last "(" in the panel title and see if the buffer
- * number in the title matches the one we're looking for */
+ // find the last "(" in the panel title and see if the buffer
+ // number in the title matches the one we're looking for
mark = STRRCHR(panel_titles[ i ], '(');
if (mark != NULL && STRCMP(mark, search) == 0)
{
@@ -948,7 +956,9 @@ gui_ph_get_panelgroup_margins(
*right = *margin_right;
}
-/* Used for the tabs for PtPanelGroup */
+/*
+ * Used for the tabs for PtPanelGroup
+ */
static int
gui_ph_is_buffer_item(vimmenu_T *menu, vimmenu_T *parent)
{
@@ -956,7 +966,7 @@ gui_ph_is_buffer_item(vimmenu_T *menu, vimmenu_T *parent)
if (STRCMP(parent->dname, "Buffers") == 0)
{
- /* Look for '(' digits ')' */
+ // Look for '(' digits ')'
mark = vim_strchr(menu->dname, '(');
if (mark != NULL)
{
@@ -998,14 +1008,14 @@ gui_ph_pg_remove_buffer(char *name)
int i;
char **new_titles = NULL;
- /* If there is only 1 panel, we just use the temporary place holder */
+ // If there is only 1 panel, we just use the temporary place holder
if (num_panels > 1)
{
new_titles = ALLOC_MULT(char *, num_panels - 1);
if (new_titles != NULL)
{
char **s = new_titles;
- /* Copy all the titles except the one we're removing */
+ // Copy all the titles except the one we're removing
for (i = 0; i < num_panels; i++)
{
if (STRCMP(panel_titles[ i ], name) != 0)
@@ -1030,7 +1040,9 @@ gui_ph_pg_remove_buffer(char *name)
}
}
-/* When a buffer item is deleted from the buffer menu */
+/*
+ * When a buffer item is deleted from the buffer menu
+ */
static int
gui_ph_handle_buffer_remove(
PtWidget_t *widget,
@@ -1062,12 +1074,12 @@ gui_ph_pane_resize(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
return Pt_CONTINUE;
}
-/****************************************************************************/
+////////////////////////////////////////////////////////////////////////////
void
gui_ph_encoding_changed(int new_encoding)
{
- /* Default encoding is latin1 */
+ // Default encoding is latin1
char *charset = "latin1";
int i;
@@ -1090,8 +1102,7 @@ gui_ph_encoding_changed(int new_encoding)
charset_translate = PxTranslateSet(charset_translate, charset);
}
-/****************************************************************************/
-/****************************************************************************/
+////////////////////////////////////////////////////////////////////////////
void
gui_mch_prepare(int *argc, char **argv)
@@ -1105,20 +1116,20 @@ gui_mch_init(void)
PtArg_t args[10];
int flags = 0, n = 0;
- PhDim_t window_size = {100, 100}; /* Arbitrary values */
+ PhDim_t window_size = {100, 100}; // Arbitrary values
PhPoint_t pos = {0, 0};
gui.event_buffer = alloc(EVENT_BUFFER_SIZE);
if (gui.event_buffer == NULL)
return FAIL;
- /* Get a translation so we can convert from ISO Latin-1 to UTF */
+ // Get a translation so we can convert from ISO Latin-1 to UTF
charset_translate = PxTranslateSet(NULL, "latin1");
- /* The +2 is for the 1 pixel dark line on each side */
+ // The +2 is for the 1 pixel dark line on each side
gui.border_offset = gui.border_width = GUI_PH_MARGIN + 2;
- /* Handle close events ourselves */
+ // Handle close events ourselves
PtSetArg(&args[ n++ ], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_CLOSE);
PtSetArg(&args[ n++ ], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
Ph_WM_CLOSE | Ph_WM_RESIZE | Ph_WM_FOCUS);
@@ -1137,7 +1148,7 @@ gui_mch_init(void)
PtSetArg(&args[ n++ ], Pt_ARG_POS, &pos, 0);
#ifdef USE_PANEL_GROUP
- /* Put in a temporary place holder title */
+ // Put in a temporary place holder title
PtSetArg(&args[ n++ ], Pt_ARG_PG_PANEL_TITLES, &empty_title, 1);
gui.vimPanelGroup = PtCreateWidget(PtPanelGroup, gui.vimWindow, n, args);
@@ -1147,7 +1158,7 @@ gui_mch_init(void)
PtAddCallback(gui.vimPanelGroup, Pt_CB_PG_PANEL_SWITCHING,
gui_ph_handle_pg_change, NULL);
#else
- /* Turn off all edge decorations */
+ // Turn off all edge decorations
PtSetArg(&args[ n++ ], Pt_ARG_BASIC_FLAGS, Pt_FALSE, Pt_ALL);
PtSetArg(&args[ n++ ], Pt_ARG_BEVEL_WIDTH, 0, 0);
PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_WIDTH, 0, 0);
@@ -1161,7 +1172,7 @@ gui_mch_init(void)
PtAddCallback(gui.vimContainer, Pt_CB_RESIZE, gui_ph_pane_resize, NULL);
#endif
- /* Size for the text area is set in gui_mch_set_text_area_pos */
+ // Size for the text area is set in gui_mch_set_text_area_pos
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_RAW_DRAW_F, gui_ph_handle_raw_draw, 1);
@@ -1181,8 +1192,8 @@ gui_mch_init(void)
if (gui.vimTextArea == NULL)
return FAIL;
- /* TODO: use PtAddEventHandlers instead? */
- /* Not using Ph_EV_BUT_REPEAT because vim wouldn't use it anyway */
+ // TODO: use PtAddEventHandlers instead?
+ // Not using Ph_EV_BUT_REPEAT because vim wouldn't use it anyway
PtAddEventHandler(gui.vimTextArea,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION_BUTTON,
gui_ph_handle_mouse, NULL);
@@ -1311,11 +1322,13 @@ gui_mch_exit(int rc)
#endif
}
-/****************************************************************************/
-/* events */
+////////////////////////////////////////////////////////////////////////////
+// events
-/* When no events are available, photon will call this function, working is
- * set to FALSE, and the gui_mch_update loop will exit. */
+/*
+ * When no events are available, photon will call this function, working is
+ * set to FALSE, and the gui_mch_update loop will exit.
+ */
static int
exit_gui_mch_update(void *data)
{
@@ -1388,12 +1401,12 @@ gui_mch_browse(
{
if (saving == TRUE)
{
- /* Don't need Pt_FSR_CONFIRM_EXISTING, vim will ask anyway */
+ // Don't need Pt_FSR_CONFIRM_EXISTING, vim will ask anyway
flags |= Pt_FSR_NO_FCHECK;
open_text = "&Save";
}
- /* combine the directory and filename into a single path */
+ // combine the directory and filename into a single path
if (initdir == NULL || *initdir == NUL)
{
mch_dirname(default_path, MAXPATHL);
@@ -1413,7 +1426,7 @@ gui_mch_browse(
STRCAT(default_path, default_name);
}
- /* TODO: add a filter? */
+ // TODO: add a filter?
PtFileSelection(
gui.vimWindow,
NULL,
@@ -1496,18 +1509,18 @@ gui_mch_dialog(
int i, len;
int dialog_result = -1;
- /* FIXME: the vertical option in guioptions is blatantly ignored */
- /* FIXME: so is the type */
+ // FIXME: the vertical option in guioptions is blatantly ignored
+ // FIXME: so is the type
button_count = len = i = 0;
if (buttons == NULL || *buttons == NUL)
return -1;
- /* There is one less separator than buttons, so bump up the button count */
+ // There is one less separator than buttons, so bump up the button count
button_count = 1;
- /* Count string length and number of separators */
+ // Count string length and number of separators
for (str = buttons; *str; str++)
{
len++;
@@ -1550,8 +1563,8 @@ gui_mch_dialog(
button_count, (const char **) button_array, NULL,
default_button, 0, Pt_MODAL);
#else
- /* Writing the dialog ourselves lets us add extra features, like
- * trapping the escape key and returning 0 to vim */
+ // Writing the dialog ourselves lets us add extra features, like
+ // trapping the escape key and returning 0 to vim
{
int n;
PtArg_t args[5];
@@ -1593,8 +1606,8 @@ gui_mch_dialog(
di.buttons = (const char **) button_array;
di.nbtns = button_count;
di.def_btn = default_button;
- /* This is just to give the dialog the close button.
- * We check for the Escape key ourselves and return 0 */
+ // This is just to give the dialog the close button.
+ // We check for the Escape key ourselves and return 0
di.esc_btn = button_count;
di.callback = gui_ph_dialog_close;
di.data = &modal_ctrl;
@@ -1606,7 +1619,7 @@ gui_mch_dialog(
if (gui_ph_dialog_text != NULL)
PtGiveFocus(gui_ph_dialog_text, NULL);
- /* Open dialog, block the vim window and wait for the dialog to close */
+ // Open dialog, block the vim window and wait for the dialog to close
PtRealizeWidget(dialog);
PtMakeModal(dialog, Ph_CURSOR_NOINPUT, Ph_CURSOR_DEFAULT_COLOR);
dialog_result = (int) PtModalBlock(&modal_ctrl, 0);
@@ -1623,8 +1636,8 @@ gui_mch_dialog(
return dialog_result;
}
#endif
-/****************************************************************************/
-/* window size/position/state */
+////////////////////////////////////////////////////////////////////////////
+// window size/position/state
int
gui_mch_get_winpos(int *x, int *y)
@@ -1719,11 +1732,11 @@ gui_mch_settitle(char_u *title, char_u *icon)
gui_ph_pg_set_buffer_num(curwin->w_buffer->b_fnum);
#endif
PtSetResource(gui.vimWindow, Pt_ARG_WINDOW_TITLE, title, 0);
- /* Not sure what to do with the icon text, set balloon text somehow? */
+ // Not sure what to do with the icon text, set balloon text somehow?
}
-/****************************************************************************/
-/* Scrollbar */
+////////////////////////////////////////////////////////////////////////////
+// Scrollbar
void
gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max)
@@ -1749,7 +1762,7 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
{
int n = 0;
-/* int anchor_flags = 0;*/
+// int anchor_flags = 0;
PtArg_t args[4];
/*
@@ -1762,7 +1775,7 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
Pt_DELAY_REALIZE | Pt_GETS_FOCUS);
PtSetArg(&args[ n++ ], Pt_ARG_SCROLLBAR_FLAGS, Pt_SCROLLBAR_SHOW_ARROWS, 0);
#if 0
- /* Don't need this anchoring for the scrollbars */
+ // Don't need this anchoring for the scrollbars
if (orient == SBAR_HORIZ)
{
anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM |
@@ -1808,35 +1821,35 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
sb->id = NULL;
}
-/****************************************************************************/
-/* Mouse functions */
+////////////////////////////////////////////////////////////////////////////
+// Mouse functions
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
-/* The last set mouse pointer shape is remembered, to be used when it goes
- * from hidden to not hidden. */
+// The last set mouse pointer shape is remembered, to be used when it goes
+// from hidden to not hidden.
static int last_shape = 0;
-/* Table for shape IDs. Keep in sync with the mshape_names[] table in
- * misc2.c! */
+// Table for shape IDs. Keep in sync with the mshape_names[] table in
+// misc2.c!
static int mshape_ids[] =
{
- Ph_CURSOR_POINTER, /* arrow */
- Ph_CURSOR_NONE, /* blank */
- Ph_CURSOR_INSERT, /* beam */
- Ph_CURSOR_DRAG_VERTICAL, /* updown */
- Ph_CURSOR_DRAG_VERTICAL, /* udsizing */
- Ph_CURSOR_DRAG_HORIZONTAL, /* leftright */
- Ph_CURSOR_DRAG_HORIZONTAL, /* lrsizing */
- Ph_CURSOR_WAIT, /* busy */
- Ph_CURSOR_DONT, /* no */
- Ph_CURSOR_CROSSHAIR, /* crosshair */
- Ph_CURSOR_FINGER, /* hand1 */
- Ph_CURSOR_FINGER, /* hand2 */
- Ph_CURSOR_FINGER, /* pencil */
- Ph_CURSOR_QUESTION_POINT, /* question */
- Ph_CURSOR_POINTER, /* right-arrow */
- Ph_CURSOR_POINTER, /* up-arrow */
- Ph_CURSOR_POINTER /* last one */
+ Ph_CURSOR_POINTER, // arrow
+ Ph_CURSOR_NONE, // blank
+ Ph_CURSOR_INSERT, // beam
+ Ph_CURSOR_DRAG_VERTICAL, // updown
+ Ph_CURSOR_DRAG_VERTICAL, // udsizing
+ Ph_CURSOR_DRAG_HORIZONTAL, // leftright
+ Ph_CURSOR_DRAG_HORIZONTAL, // lrsizing
+ Ph_CURSOR_WAIT, // busy
+ Ph_CURSOR_DONT, // no
+ Ph_CURSOR_CROSSHAIR, // crosshair
+ Ph_CURSOR_FINGER, // hand1
+ Ph_CURSOR_FINGER, // hand2
+ Ph_CURSOR_FINGER, // pencil
+ Ph_CURSOR_QUESTION_POINT, // question
+ Ph_CURSOR_POINTER, // right-arrow
+ Ph_CURSOR_POINTER, // up-arrow
+ Ph_CURSOR_POINTER // last one
};
void
@@ -1890,8 +1903,8 @@ gui_mch_getmouse(int *x, int *y)
PhCursorInfo_t info;
short ix, iy;
- /* FIXME: does this return the correct position,
- * with respect to the border? */
+ // FIXME: does this return the correct position,
+ // with respect to the border?
PhQueryCursor(PhInputGroup(NULL), &info);
PtGetAbsPosition(gui.vimTextArea , &ix, &iy);
@@ -1905,12 +1918,12 @@ gui_mch_setmouse(int x, int y)
short abs_x, abs_y;
PtGetAbsPosition(gui.vimTextArea, &abs_x, &abs_y);
- /* Add the border offset? */
+ // Add the border offset?
PhMoveCursorAbs(PhInputGroup(NULL), abs_x + x, abs_y + y);
}
-/****************************************************************************/
-/* Colours */
+////////////////////////////////////////////////////////////////////////////
+// Colours
/*
* Return the RGB value of a pixel as a long.
@@ -1925,7 +1938,7 @@ gui_mch_get_rgb(guicolor_T pixel)
void
gui_mch_new_colors(void)
{
-#if 0 /* Don't bother changing the cursor colour */
+#if 0 // Don't bother changing the cursor colour
short color_diff;
/*
@@ -1938,7 +1951,7 @@ gui_mch_new_colors(void)
if (abs(color_diff) < 64)
{
short r, g, b;
- /* not a great algorithm... */
+ // not a great algorithm...
r = PgRedValue(gui_ph_mouse_color) ^ 255;
g = PgGreenValue(gui_ph_mouse_color) ^ 255;
b = PgBlueValue(gui_ph_mouse_color) ^ 255;
@@ -1999,7 +2012,7 @@ gui_mch_invert_rectangle(int row, int col, int nr, int nc)
rect.ul.x = FILL_X(col);
rect.ul.y = FILL_Y(row);
- /* FIXME: This has an off by one pixel problem */
+ // FIXME: This has an off by one pixel problem
rect.lr.x = rect.ul.x + nc * gui.char_width;
rect.lr.y = rect.ul.y + nr * gui.char_height;
if (nc > 0)
@@ -2132,7 +2145,7 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
{
int src_taken, dst_made;
- /* Use a static buffer to avoid large amounts of de/allocations */
+ // Use a static buffer to avoid large amounts of de/allocations
if (utf8_len < len)
{
utf8_buffer = realloc(utf8_buffer, len * MB_LEN_MAX);
@@ -2155,12 +2168,12 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
if (flags & DRAW_BOLD)
{
- /* FIXME: try and only calculate these values once... */
+ // FIXME: try and only calculate these values once...
rect.ul.x = FILL_X(col) + 1;
rect.ul.y = FILL_Y(row);
rect.lr.x = FILL_X(col + len) - 1;
rect.lr.y = FILL_Y(row + 1) - 1;
- /* PgSetUserClip(NULL) causes the scrollbar to not redraw... */
+ // PgSetUserClip(NULL) causes the scrollbar to not redraw...
#if 0
pos.x++;
@@ -2169,7 +2182,7 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
PgSetUserClip(NULL);
#else
rect.lr.y -= (p_linespace + 1) / 2;
- /* XXX: DrawTextArea doesn't work with phditto */
+ // XXX: DrawTextArea doesn't work with phditto
PgDrawTextArea(s, len, &rect, Pg_TEXT_BOTTOM);
#endif
}
@@ -2180,15 +2193,15 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
DRAW_END;
}
-/****************************************************************************/
-/* Cursor */
+////////////////////////////////////////////////////////////////////////////
+// Cursor
void
gui_mch_draw_hollow_cursor(guicolor_T color)
{
PhRect_t r;
- /* FIXME: Double width characters */
+ // FIXME: Double width characters
r.ul.x = FILL_X(gui.col);
r.ul.y = FILL_Y(gui.row);
@@ -2240,7 +2253,7 @@ gui_mch_set_blinking(long wait, long on, long off)
void
gui_mch_start_blink(void)
{
- /* Only turn on the timer on if none of the times are zero */
+ // Only turn on the timer on if none of the times are zero
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
{
PtSetResource(gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL,
@@ -2261,8 +2274,8 @@ gui_mch_stop_blink(int may_call_gui_update_cursor)
blink_state = BLINK_NONE;
}
-/****************************************************************************/
-/* miscellaneous functions */
+////////////////////////////////////////////////////////////////////////////
+// miscellaneous functions
void
gui_mch_beep(void)
@@ -2311,8 +2324,8 @@ gui_mch_haskey(char_u *name)
return FAIL;
}
-/****************************************************************************/
-/* Menu */
+////////////////////////////////////////////////////////////////////////////
+// Menu
#ifdef FEAT_TOOLBAR
#include "toolbar.phi"
@@ -2360,8 +2373,8 @@ gui_ph_toolbar_load_icon(char_u *iconfile)
temp_phi = PxLoadImage(iconfile, NULL);
if (temp_phi != NULL)
{
- /* The label widget will free the image/palette/etc. for us when
- * it's destroyed */
+ // The label widget will free the image/palette/etc. for us when
+ // it's destroyed
temp_phi->flags |= Ph_RELEASE_IMAGE_ALL;
memcpy(&external_icon, temp_phi, sizeof(external_icon));
free(temp_phi);
@@ -2387,10 +2400,10 @@ gui_ph_toolbar_find_icon(vimmenu_T *menu)
if (menu->icon_builtin == FALSE)
{
if (menu->iconfile != NULL)
- /* TODO: use gui_find_iconfile() */
+ // TODO: use gui_find_iconfile()
icon = gui_ph_toolbar_load_icon(menu->iconfile);
- /* TODO: Restrict loading to just .png? Search for any format? */
+ // TODO: Restrict loading to just .png? Search for any format?
if ((icon == NULL) &&
((gui_find_bitmap(menu->name, full_pathname, "gif") == OK) ||
(gui_find_bitmap(menu->name, full_pathname, "png") == OK)))
@@ -2421,10 +2434,12 @@ gui_mch_enable_menu(int flag)
void
gui_mch_set_menu_pos(int x, int y, int w, int h)
{
- /* Nothing */
+ // Nothing
}
-/* Change the position of a menu button in the parent */
+/*
+ * Change the position of a menu button in the parent
+ */
static void
gui_ph_position_menu(PtWidget_t *widget, int priority)
{
@@ -2433,9 +2448,9 @@ gui_ph_position_menu(PtWidget_t *widget, int priority)
traverse = PtWidgetChildBack(PtWidgetParent(widget));
- /* Iterate through the list of widgets in traverse, until
- * we find the position we want to insert our widget into */
- /* TODO: traverse from front to back, possible speedup? */
+ // Iterate through the list of widgets in traverse, until
+ // we find the position we want to insert our widget into
+ // TODO: traverse from front to back, possible speedup?
while (traverse != NULL)
{
PtGetResource(traverse, Pt_ARG_POINTER, &menu, 0);
@@ -2444,7 +2459,7 @@ gui_ph_position_menu(PtWidget_t *widget, int priority)
priority < menu->priority &&
widget != traverse)
{
- /* Insert the widget before the current traverse widget */
+ // Insert the widget before the current traverse widget
PtWidgetInsert(widget, traverse, 1);
return;
}
@@ -2453,7 +2468,9 @@ gui_ph_position_menu(PtWidget_t *widget, int priority)
}
}
-/* the index is ignored because it's not useful for our purposes */
+/*
+ * the index is ignored because it's not useful for our purposes
+ */
void
gui_mch_add_menu(vimmenu_T *menu, int index)
{
@@ -2475,7 +2492,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index)
mnemonic_str[1] = NUL;
}
- /* Create the menu button */
+ // Create the menu button
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_TEXT_STRING, menu->dname, 0);
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_TEXT, menu->actext, 0);
@@ -2492,7 +2509,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index)
PtAddCallback(menu->id, Pt_CB_ARM, gui_ph_handle_pulldown_menu, menu);
- /* Create the actual menu */
+ // Create the actual menu
n = 0;
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_MENU_FLAGS, Pt_TRUE, Pt_MENU_CHILD);
@@ -2513,7 +2530,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index)
gui_ph_position_menu(menu->id, menu->priority);
- /* Redraw menubar here instead of gui_mch_draw_menubar */
+ // Redraw menubar here instead of gui_mch_draw_menubar
if (gui.menu_is_active)
PtRealizeWidget(menu->id);
}
@@ -2583,7 +2600,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index)
PtAddCallback(menu->id, Pt_CB_ACTIVATE, gui_ph_handle_menu, menu);
}
- /* Update toolbar if it's open */
+ // Update toolbar if it's open
if (PtWidgetIsRealized(gui.vimToolBar))
PtRealizeWidget(menu->id);
}
@@ -2669,16 +2686,15 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
void
gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
{
- /* TODO: [un]realize the widget? */
+ // TODO: [un]realize the widget?
}
void
gui_mch_draw_menubar(void)
{
- /* The only time a redraw is needed is when a menu button
- * is added to the menubar, and that is detected and the bar
- * redrawn in gui_mch_add_menu_item
- */
+ // The only time a redraw is needed is when a menu button
+ // is added to the menubar, and that is detected and the bar
+ // redrawn in gui_mch_add_menu_item
}
void
@@ -2691,7 +2707,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
void
gui_mch_toggle_tearoffs(int enable)
{
- /* No tearoffs yet */
+ // No tearoffs yet
}
#endif
@@ -2707,16 +2723,16 @@ gui_mch_show_toolbar(int showit)
}
#endif
-/****************************************************************************/
-/* Fonts */
+////////////////////////////////////////////////////////////////////////////
+// Fonts
static GuiFont
gui_ph_get_font(
char_u *font_name,
int_u font_flags,
int_u font_size,
- /* Check whether the resulting font has the font flags and size that
- * was asked for */
+ // Check whether the resulting font has the font flags and size that
+ // was asked for
int_u enforce
)
{
@@ -2730,7 +2746,7 @@ gui_ph_get_font(
if (PfGenerateFontName(font_name, font_flags, font_size,
font_tag) != NULL)
{
- /* Enforce some limits on the font used */
+ // Enforce some limits on the font used
style = PHFONT_INFO_FIXED;
if (enforce & PF_STYLE_BOLD)
@@ -2745,8 +2761,8 @@ gui_ph_get_font(
if (info.size == 0)
font_size = 0;
- /* Make sure font size matches, and that the font style
- * at least has the bits we're checking for */
+ // Make sure font size matches, and that the font style
+ // at least has the bits we're checking for
if (font_size == info.size &&
style == (info.style & style))
return (GuiFont)font_tag;
@@ -2799,7 +2815,7 @@ gui_ph_parse_font_name(
case 's':
size = getdigits(&mark);
- /* Restrict the size to some vague limits */
+ // Restrict the size to some vague limits
if (size < 1 || size > 100)
size = 8;
@@ -2829,7 +2845,7 @@ gui_mch_init_font(char_u *vim_font_name, int fontset)
if (vim_font_name == NULL)
{
- /* Default font */
+ // Default font
vim_font_name = "PC Terminal";
}
@@ -2872,7 +2888,7 @@ gui_mch_init_font(char_u *vim_font_name, int fontset)
gui.ital_font = gui_ph_get_font(font_name, font_flags | PF_STYLE_ITALIC,
font_size, PF_STYLE_ITALIC);
- /* This extent was brought to you by the letter 'g' */
+ // This extent was brought to you by the letter 'g'
PfExtentText(&extent, NULL, font_tag, "g", 1);
gui.char_width = extent.lr.x - extent.ul.x + 1;
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 1c17b110e..e6b5dad54 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -58,7 +58,7 @@ gui_mch_set_rendering_options(char_u *s)
int dx_renmode = 0;
int dx_taamode = 0;
- /* parse string as rendering options. */
+ // parse string as rendering options.
for (p = s; p != NULL && *p != NUL; )
{
char_u item[256];
@@ -119,16 +119,16 @@ gui_mch_set_rendering_options(char_u *s)
}
else if (STRCMP(name, "scrlines") == 0)
{
- /* Deprecated. Simply ignore it. */
+ // Deprecated. Simply ignore it.
}
else
return FAIL;
}
if (!gui.in_use)
- return OK; /* only checking the syntax of the value */
+ return OK; // only checking the syntax of the value
- /* Enable DirectX/DirectWrite */
+ // Enable DirectX/DirectWrite
if (dx_enable)
{
if (!directx_enabled())
@@ -179,12 +179,12 @@ gui_mch_set_rendering_options(char_u *s)
#endif
-#include "version.h" /* used by dialog box routine for default title */
+#include "version.h" // used by dialog box routine for default title
#ifdef DEBUG
# include <tchar.h>
#endif
-/* cproto fails on missing include files */
+// cproto fails on missing include files
#ifndef PROTO
# ifndef __MINGW32__
@@ -199,18 +199,18 @@ gui_mch_set_rendering_options(char_u *s)
# include "glbl_ime.h"
# endif
-#endif /* PROTO */
+#endif // PROTO
#ifdef FEAT_MENU
-# define MENUHINTS /* show menu hints in command line */
+# define MENUHINTS // show menu hints in command line
#endif
-/* Some parameters for dialog boxes. All in pixels. */
+// Some parameters for dialog boxes. All in pixels.
#define DLG_PADDING_X 10
#define DLG_PADDING_Y 10
#define DLG_OLD_STYLE_PADDING_X 5
#define DLG_OLD_STYLE_PADDING_Y 5
-#define DLG_VERT_PADDING_X 4 /* For vertical buttons */
+#define DLG_VERT_PADDING_X 4 // For vertical buttons
#define DLG_VERT_PADDING_Y 4
#define DLG_ICON_WIDTH 34
#define DLG_ICON_HEIGHT 34
@@ -220,9 +220,9 @@ gui_mch_set_rendering_options(char_u *s)
#define DLG_MIN_MAX_WIDTH 400
#define DLG_MIN_MAX_HEIGHT 400
-#define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */
+#define DLG_NONBUTTON_CONTROL 5000 // First ID of non-button controls
-#ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */
+#ifndef WM_XBUTTONDOWN // For Win2K / winME ONLY
# define WM_XBUTTONDOWN 0x020B
# define WM_XBUTTONUP 0x020C
# define WM_XBUTTONDBLCLK 0x020D
@@ -295,22 +295,22 @@ static void _OnPaint( HWND hwnd);
static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color);
static void clear_rect(RECT *rcp);
-static WORD s_dlgfntheight; /* height of the dialog font */
-static WORD s_dlgfntwidth; /* width of the dialog font */
+static WORD s_dlgfntheight; // height of the dialog font
+static WORD s_dlgfntwidth; // width of the dialog font
#ifdef FEAT_MENU
static HMENU s_menuBar = NULL;
#endif
#ifdef FEAT_TEAROFF
static void rebuild_tearoff(vimmenu_T *menu);
-static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */
+static HBITMAP s_htearbitmap; // bitmap used to indicate tearoff
#endif
-/* Flag that is set while processing a message that must not be interrupted by
- * processing another message. */
+// Flag that is set while processing a message that must not be interrupted by
+// processing another message.
static int s_busy_processing = FALSE;
-static int destroying = FALSE; /* call DestroyWindow() ourselves */
+static int destroying = FALSE; // call DestroyWindow() ourselves
#ifdef MSWIN_FIND_REPLACE
static UINT s_findrep_msg = 0; // set in gui_w[16/32].c
@@ -344,15 +344,14 @@ static LPARAM s_lParam = 0;
static HWND s_textArea = NULL;
static UINT s_uMsg = 0;
-static char_u *s_textfield; /* Used by dialogs to pass back strings */
+static char_u *s_textfield; // Used by dialogs to pass back strings
static int s_need_activate = FALSE;
-/* This variable is set when waiting for an event, which is the only moment
- * scrollbar dragging can be done directly. It's not allowed while commands
- * are executed, because it may move the cursor and that may cause unexpected
- * problems (e.g., while ":s" is working).
- */
+// This variable is set when waiting for an event, which is the only moment
+// scrollbar dragging can be done directly. It's not allowed while commands
+// are executed, because it may move the cursor and that may cause unexpected
+// problems (e.g., while ":s" is working).
static int allow_scrollbar = FALSE;
#ifdef GLOBAL_IME
@@ -369,7 +368,7 @@ directx_enabled(void)
return 1;
else if (s_directx_load_attempted)
return 0;
- /* load DirectX */
+ // load DirectX
DWrite_Init();
s_directx_load_attempted = 1;
s_dwc = DWriteContext_Open();
@@ -389,10 +388,10 @@ directx_binddc(void)
}
#endif
-/* use of WindowProc depends on Global IME */
+// use of WindowProc depends on Global IME
#define MyWindowProc vim_WindowProc
-extern int current_font_height; /* this is in os_mswin.c */
+extern int current_font_height; // this is in os_mswin.c
static struct
{
@@ -430,11 +429,11 @@ static struct
{VK_F21, 'F', 'B'},
#ifdef FEAT_NETBEANS_INTG
- {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */
+ {VK_PAUSE, 'F', 'B'}, // Pause == F21 (see gui_gtk_x11.c)
#endif
{VK_F22, 'F', 'C'},
{VK_F23, 'F', 'D'},
- {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */
+ {VK_F24, 'F', 'E'}, // winuser.h defines up to F24
{VK_HELP, '%', '1'},
{VK_BACK, 'k', 'b'},
@@ -449,7 +448,7 @@ static struct
{VK_SUBTRACT, 'K', '7'},
{VK_DIVIDE, 'K', '8'},
{VK_MULTIPLY, 'K', '9'},
- {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */
+ {VK_SEPARATOR, 'K', 'A'}, // Keypad Enter
{VK_DECIMAL, 'K', 'B'},
{VK_NUMPAD0, 'K', 'C'},
@@ -463,22 +462,22 @@ static struct
{VK_NUMPAD8, 'K', 'K'},
{VK_NUMPAD9, 'K', 'L'},
- /* Keys that we want to be able to use any modifier with: */
+ // Keys that we want to be able to use any modifier with:
{VK_SPACE, ' ', NUL},
{VK_TAB, TAB, NUL},
{VK_ESCAPE, ESC, NUL},
{NL, NL, NUL},
{CAR, CAR, NUL},
- /* End of list marker: */
+ // End of list marker:
{0, 0, 0}
};
-/* Local variables */
+// Local variables
static int s_button_pending = -1;
-/* s_getting_focus is set when we got focus but didn't see mouse-up event yet,
- * so don't reset s_button_pending. */
+// s_getting_focus is set when we got focus but didn't see mouse-up event yet,
+// so don't reset s_button_pending.
static int s_getting_focus = FALSE;
static int s_x_pending;
@@ -491,7 +490,7 @@ static UINT surrogate_pending_ch = 0; // 0: no surrogate pending,
// else a high surrogate
#ifdef FEAT_BEVAL_GUI
-/* balloon-eval WM_NOTIFY_HANDLER */
+// balloon-eval WM_NOTIFY_HANDLER
static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh);
static void TrackUserActivity(UINT uMsg);
#endif
@@ -502,11 +501,11 @@ static void TrackUserActivity(UINT uMsg);
* These LOGFONTW used for IME.
*/
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
-/* holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont' */
+// holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont'
static LOGFONTW norm_logfont;
#endif
#ifdef FEAT_MBYTE_IME
-/* holds LOGFONTW for 'guifont' always. */
+// holds LOGFONTW for 'guifont' always.
static LOGFONTW sub_logfont;
#endif
@@ -590,7 +589,7 @@ _OnBlinkTimer(
KillTimer(NULL, idEvent);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
@@ -619,7 +618,7 @@ gui_mswin_rm_blink_timer(void)
if (blink_timer != 0)
{
KillTimer(NULL, blink_timer);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
blink_timer = 0;
@@ -650,7 +649,7 @@ gui_mch_start_blink(void)
{
gui_mswin_rm_blink_timer();
- /* Only switch blinking on if none of the times is zero */
+ // Only switch blinking on if none of the times is zero
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
{
blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime,
@@ -680,7 +679,7 @@ _OnTimer(
KillTimer(NULL, idEvent);
s_timed_out = TRUE;
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
if (idEvent == s_wait_timer)
@@ -717,17 +716,17 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
if (surrogate_pending_ch != 0)
{
- /* We don't guarantee ch is a low surrogate to match the high surrogate
- * we already have; it should be, but if it isn't, tough luck. */
+ // We don't guarantee ch is a low surrogate to match the high surrogate
+ // we already have; it should be, but if it isn't, tough luck.
wstring[0] = surrogate_pending_ch;
wstring[1] = ch;
surrogate_pending_ch = 0;
len = 2;
}
- else if (ch >= 0xD800 && ch <= 0xDBFF) /* high surrogate */
+ else if (ch >= 0xD800 && ch <= 0xDBFF) // high surrogate
{
- /* We don't have the entire code point yet, only the first UTF-16 code
- * unit; so just remember it and use it in the next call. */
+ // We don't have the entire code point yet, only the first UTF-16 code
+ // unit; so just remember it and use it in the next call.
surrogate_pending_ch = ch;
return 0;
}
@@ -737,23 +736,23 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
len = 1;
}
- /* "ch" is a UTF-16 character. Convert it to a string of bytes. When
- * "enc_codepage" is non-zero use the standard Win32 function,
- * otherwise use our own conversion function (e.g., for UTF-8). */
+ // "ch" is a UTF-16 character. Convert it to a string of bytes. When
+ // "enc_codepage" is non-zero use the standard Win32 function,
+ // otherwise use our own conversion function (e.g., for UTF-8).
if (enc_codepage > 0)
{
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
(LPSTR)string, slen, 0, NULL);
- /* If we had included the ALT key into the character but now the
- * upper bit is no longer set, that probably means the conversion
- * failed. Convert the original character and set the upper bit
- * afterwards. */
+ // If we had included the ALT key into the character but now the
+ // upper bit is no longer set, that probably means the conversion
+ // failed. Convert the original character and set the upper bit
+ // afterwards.
if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80)
{
wstring[0] = ch & 0x7f;
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
(LPSTR)string, slen, 0, NULL);
- if (len == 1) /* safety check */
+ if (len == 1) // safety check
string[0] |= 0x80;
}
}
@@ -764,7 +763,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
len = 0;
else
{
- if (len > slen) /* just in case */
+ if (len > slen) // just in case
len = slen;
mch_memmove(string, ws, len);
vim_free(ws);
@@ -780,7 +779,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
for (i = 0; i < len; ++i)
if (string[i] == CSI && len <= slen - 2)
{
- /* Insert CSI as K_CSI. */
+ // Insert CSI as K_CSI.
mch_memmove(string + i + 3, string + i + 1, len - i - 1);
string[++i] = KS_EXTRA;
string[++i] = (int)KE_CSI;
@@ -823,20 +822,19 @@ _OnSysChar(
UINT cch,
int cRepeat UNUSED)
{
- char_u string[40]; /* Enough for multibyte character */
+ char_u string[40]; // Enough for multibyte character
int len;
int modifiers;
- int ch = cch; /* special keys are negative */
+ int ch = cch; // special keys are negative
dead_key = 0;
- /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */
+ // TRACE("OnSysChar(%d, %c)\n", ch, ch);
- /* OK, we have a character key (given by ch) which was entered with the
- * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note
- * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless
- * CAPSLOCK is pressed) at this point.
- */
+ // OK, we have a character key (given by ch) which was entered with the
+ // ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note
+ // that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless
+ // CAPSLOCK is pressed) at this point.
modifiers = MOD_MASK_ALT;
if (GetKeyState(VK_SHIFT) & 0x8000)
modifiers |= MOD_MASK_SHIFT;
@@ -844,12 +842,12 @@ _OnSysChar(
modifiers |= MOD_MASK_CTRL;
ch = simplify_key(ch, &modifiers);
- /* remove the SHIFT modifier for keys where it's already included, e.g.,
- * '(' and '*' */
+ // remove the SHIFT modifier for keys where it's already included, e.g.,
+ // '(' and '*'
if (ch < 0x100 && !isalpha(ch) && isprint(ch))
modifiers &= ~MOD_MASK_SHIFT;
- /* Interpret the ALT key as making the key META, include SHIFT, etc. */
+ // Interpret the ALT key as making the key META, include SHIFT, etc.
ch = extract_modifiers(ch, &modifiers, TRUE, NULL);
if (ch == CSI)
ch = K_CSI;
@@ -870,8 +868,8 @@ _OnSysChar(
}
else
{
- /* Although the documentation isn't clear about it, we assume "ch" is
- * a Unicode character. */
+ // Although the documentation isn't clear about it, we assume "ch" is
+ // a Unicode character.
len += char_to_string(ch, string + len, 40 - len, TRUE);
}
@@ -914,7 +912,7 @@ _OnMouseButtonDown(
int button = -1;
int repeated_click;
- /* Give main window the focus: this is so the cursor isn't hollow. */
+ // Give main window the focus: this is so the cursor isn't hollow.
(void)SetFocus(s_hwnd);
if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK)
@@ -932,8 +930,8 @@ _OnMouseButtonDown(
}
else if (s_uMsg == WM_CAPTURECHANGED)
{
- /* on W95/NT4, somehow you get in here with an odd Msg
- * if you press one button while holding down the other..*/
+ // on W95/NT4, somehow you get in here with an odd Msg
+ // if you press one button while holding down the other..
if (s_button_pending == MOUSE_LEFT)
button = MOUSE_RIGHT;
else
@@ -970,7 +968,7 @@ _OnMouseButtonDown(
_OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags);
s_button_pending = -1;
}
- /* TRACE("Button down at x %d, y %d\n", x, y); */
+ // TRACE("Button down at x %d, y %d\n", x, y);
_OnMouseEvent(button, x, y, repeated_click, keyFlags);
}
else
@@ -1010,7 +1008,7 @@ _OnMouseMoveOrRelease(
s_getting_focus = FALSE;
if (s_button_pending > -1)
{
- /* Delayed action for mouse down event */
+ // Delayed action for mouse down event
_OnMouseEvent(s_button_pending, s_x_pending,
s_y_pending, FALSE, s_kFlags_pending);
s_button_pending = -1;
@@ -1034,13 +1032,13 @@ _OnMouseMoveOrRelease(
*/
SetCapture(s_textArea);
button = MOUSE_DRAG;
- /* TRACE(" move at x %d, y %d\n", x, y); */
+ // TRACE(" move at x %d, y %d\n", x, y);
}
else
{
ReleaseCapture();
button = MOUSE_RELEASE;
- /* TRACE(" up at x %d, y %d\n", x, y); */
+ // TRACE(" up at x %d, y %d\n", x, y);
}
_OnMouseEvent(button, x, y, FALSE, keyFlags);
@@ -1114,23 +1112,23 @@ _OnFindRepl(void)
int down;
if (s_findrep_struct.Flags & FR_DIALOGTERM)
- /* Give main window the focus back. */
+ // Give main window the focus back.
(void)SetFocus(s_hwnd);
if (s_findrep_struct.Flags & FR_FINDNEXT)
{
flags = FRD_FINDNEXT;
- /* Give main window the focus back: this is so the cursor isn't
- * hollow. */
+ // Give main window the focus back: this is so the cursor isn't
+ // hollow.
(void)SetFocus(s_hwnd);
}
else if (s_findrep_struct.Flags & FR_REPLACE)
{
flags = FRD_REPLACE;
- /* Give main window the focus back: this is so the cursor isn't
- * hollow. */
+ // Give main window the focus back: this is so the cursor isn't
+ // hollow.
(void)SetFocus(s_hwnd);
}
else if (s_findrep_struct.Flags & FR_REPLACEALL)
@@ -1142,7 +1140,7 @@ _OnFindRepl(void)
{
char_u *p, *q;
- /* Call the generic GUI function to do the actual work. */
+ // Call the generic GUI function to do the actual work.
if (s_findrep_struct.Flags & FR_WHOLEWORD)
flags |= FRD_WHOLE_WORD;
if (s_findrep_struct.Flags & FR_MATCHCASE)
@@ -1163,7 +1161,7 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
{
static LPARAM last_lParam = 0L;
- /* We sometimes get a mousemove when the mouse didn't move... */
+ // We sometimes get a mousemove when the mouse didn't move...
if (uMsg == WM_MOUSEMOVE || uMsg == WM_NCMOUSEMOVE)
{
if (lParam == last_lParam)
@@ -1171,10 +1169,9 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
last_lParam = lParam;
}
- /* Handle specially, to centralise coding. We need to be sure we catch all
- * possible events which should cause us to restore the cursor (as it is a
- * shared resource, we take full responsibility for it).
- */
+ // Handle specially, to centralise coding. We need to be sure we catch all
+ // possible events which should cause us to restore the cursor (as it is a
+ // shared resource, we take full responsibility for it).
switch (uMsg)
{
case WM_KEYUP:
@@ -1186,9 +1183,9 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
gui_mch_mousehide(TRUE);
break;
- case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */
+ case WM_SYSKEYUP: // show the pointer when a system-key is pressed
case WM_SYSCHAR:
- case WM_MOUSEMOVE: /* show the pointer on any mouse action */
+ case WM_MOUSEMOVE: // show the pointer on any mouse action
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
@@ -1309,14 +1306,14 @@ gui_mch_def_colors(void)
int
gui_mch_open(void)
{
- /* Actually open the window, if not already visible
- * (may be done already in gui_mch_set_shellsize) */
+ // Actually open the window, if not already visible
+ // (may be done already in gui_mch_set_shellsize)
if (!IsWindowVisible(s_hwnd))
ShowWindow(s_hwnd, SW_SHOWDEFAULT);
#ifdef MSWIN_FIND_REPLACE
- /* Init replace string here, so that we keep it when re-opening the
- * dialog. */
+ // Init replace string here, so that we keep it when re-opening the
+ // dialog.
s_findrep_struct.lpstrReplaceWith[0] = NUL;
#endif
@@ -1375,9 +1372,9 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h)
}
#endif
- /* When side scroll bar is unshown, the size of window will change.
- * then, the text area move left or right. thus client rect should be
- * forcedly redrawn. (Yasuhiro Matsumoto) */
+ // When side scroll bar is unshown, the size of window will change.
+ // then, the text area move left or right. thus client rect should be
+ // forcedly redrawn. (Yasuhiro Matsumoto)
if (oldx != x || oldy != y)
{
InvalidateRect(s_hwnd, NULL, FALSE);
@@ -1398,9 +1395,9 @@ gui_mch_enable_scrollbar(
{
ShowScrollBar(sb->id, SB_CTL, flag);
- /* TODO: When the window is maximized, the size of the window stays the
- * same, thus the size of the text area changes. On Win98 it's OK, on Win
- * NT 4.0 it's not... */
+ // TODO: When the window is maximized, the size of the window stays the
+ // same, thus the size of the text area changes. On Win98 it's OK, on Win
+ // NT 4.0 it's not...
}
void
@@ -1418,13 +1415,13 @@ gui_mch_set_scrollbar_pos(
void
gui_mch_create_scrollbar(
scrollbar_T *sb,
- int orient) /* SBAR_VERT or SBAR_HORIZ */
+ int orient) // SBAR_VERT or SBAR_HORIZ
{
sb->id = CreateWindow(
"SCROLLBAR", "Scrollbar",
WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0,
- 10, /* Any value will do for now */
- 10, /* Any value will do for now */
+ 10, // Any value will do for now
+ 10, // Any value will do for now
s_hwnd, NULL,
g_hinst, NULL);
}
@@ -1491,7 +1488,7 @@ get_font_handle(LOGFONTW *lf)
{
HFONT font = NULL;
- /* Load the font */
+ // Load the font
font = CreateFontIndirectW(lf);
if (font == NULL)
@@ -1722,7 +1719,7 @@ gui_mch_draw_part_cursor(
*/
rc.left =
#ifdef FEAT_RIGHTLEFT
- /* vertical line should be on the right of current point */
+ // vertical line should be on the right of current point
CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w :
#endif
FILL_X(gui.col);
@@ -1748,14 +1745,14 @@ outputDeadKey_rePost(MSG originalMsg)
dead_key = 0;
- /* Make Windows generate the dead key's character */
+ // Make Windows generate the dead key's character
deadCharExpel.message = originalMsg.message;
deadCharExpel.hwnd = originalMsg.hwnd;
deadCharExpel.wParam = VK_SPACE;
MyTranslateMessage(&deadCharExpel);
- /* re-generate the current character free of the dead char influence */
+ // re-generate the current character free of the dead char influence
PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam,
originalMsg.lParam);
}
@@ -1769,7 +1766,7 @@ outputDeadKey_rePost(MSG originalMsg)
process_message(void)
{
MSG msg;
- UINT vk = 0; /* Virtual key */
+ UINT vk = 0; // Virtual key
char_u string[40];
int i;
int modifiers = 0;
@@ -1781,27 +1778,27 @@ process_message(void)
pGetMessage(&msg, NULL, 0, 0);
#ifdef FEAT_OLE
- /* Look after OLE Automation commands */
+ // Look after OLE Automation commands
if (msg.message == WM_OLE)
{
char_u *str = (char_u *)msg.lParam;
if (str == NULL || *str == NUL)
{
- /* Message can't be ours, forward it. Fixes problem with Ultramon
- * 3.0.4 */
+ // Message can't be ours, forward it. Fixes problem with Ultramon
+ // 3.0.4
pDispatchMessage(&msg);
}
else
{
add_to_input_buf(str, (int)STRLEN(str));
- vim_free(str); /* was allocated in CVim::SendKeys() */
+ vim_free(str); // was allocated in CVim::SendKeys()
}
return;
}
#endif
#ifdef MSWIN_FIND_REPLACE
- /* Don't process messages used by the dialog */
+ // Don't process messages used by the dialog
if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg))
{
HandleMouseHide(msg.message, msg.lParam);
@@ -1851,8 +1848,8 @@ process_message(void)
MyTranslateMessage(&msg);
return;
}
- /* In modes where we are not typing, dead keys should behave
- * normally */
+ // In modes where we are not typing, dead keys should behave
+ // normally
else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE)))
{
outputDeadKey_rePost(msg);
@@ -1860,7 +1857,7 @@ process_message(void)
}
}
- /* Check for CTRL-BREAK */
+ // Check for CTRL-BREAK
if (vk == VK_CANCEL)
{
trash_input_buf();
@@ -1872,7 +1869,7 @@ process_message(void)
for (i = 0; special_keys[i].key_sym != 0; i++)
{
- /* ignore VK_SPACE when ALT key pressed: system menu */
+ // ignore VK_SPACE when ALT key pressed: system menu
if (special_keys[i].key_sym == vk
&& (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000)))
{
@@ -1890,8 +1887,8 @@ process_message(void)
}
#ifdef FEAT_MENU
- /* Check for <F10>: Windows selects the menu. When <F10> is
- * mapped we want to use the mapping instead. */
+ // Check for <F10>: Windows selects the menu. When <F10> is
+ // mapped we want to use the mapping instead.
if (vk == VK_F10
&& gui.menu_is_active
&& check_map(k10, State, FALSE, TRUE, FALSE,
@@ -1942,7 +1939,7 @@ process_message(void)
{
int len;
- /* Handle "key" as a Unicode character. */
+ // Handle "key" as a Unicode character.
len = char_to_string(key, string, 40, FALSE);
add_to_input_buf(string, len);
}
@@ -1951,27 +1948,27 @@ process_message(void)
}
if (special_keys[i].key_sym == 0)
{
- /* Some keys need C-S- where they should only need C-.
- * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since
- * system startup (Helmut Stiegler, 2003 Oct 3). */
+ // Some keys need C-S- where they should only need C-.
+ // Ignore 0xff, Windows XP sends it when NUMLOCK has changed since
+ // system startup (Helmut Stiegler, 2003 Oct 3).
if (vk != 0xff
&& (GetKeyState(VK_CONTROL) & 0x8000)
&& !(GetKeyState(VK_SHIFT) & 0x8000)
&& !(GetKeyState(VK_MENU) & 0x8000))
{
- /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */
+ // CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE
if (vk == '6' || MapVirtualKey(vk, 2) == (UINT)'^')
{
string[0] = Ctrl_HAT;
add_to_input_buf(string, 1);
}
- /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */
- else if (vk == 0xBD) /* QWERTY for CTRL-'-' */
+ // vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY!
+ else if (vk == 0xBD) // QWERTY for CTRL-'-'
{
string[0] = Ctrl__;
add_to_input_buf(string, 1);
}
- /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */
+ // CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0
else if (vk == '2' || MapVirtualKey(vk, 2) == (UINT)'@')
{
string[0] = Ctrl_AT;
@@ -1988,11 +1985,11 @@ process_message(void)
else if (msg.message == WM_IME_NOTIFY)
_OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam);
else if (msg.message == WM_KEYUP && im_get_status())
- /* added for non-MS IME (Yasuhiro Matsumoto) */
+ // added for non-MS IME (Yasuhiro Matsumoto)
MyTranslateMessage(&msg);
#endif
#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
-/* GIME_TEST */
+// GIME_TEST
else if (msg.message == WM_IME_STARTCOMPOSITION)
{
POINT point;
@@ -2006,9 +2003,9 @@ process_message(void)
#endif
#ifdef FEAT_MENU
- /* Check for <F10>: Default effect is to select the menu. When <F10> is
- * mapped we need to stop it here to avoid strange effects (e.g., for the
- * key-up event) */
+ // Check for <F10>: Default effect is to select the menu. When <F10> is
+ // mapped we need to stop it here to avoid strange effects (e.g., for the
+ // key-up event)
if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE,
NULL, NULL) == NULL)
#endif
@@ -2041,7 +2038,7 @@ remove_any_timer(void)
{
KillTimer(NULL, s_wait_timer);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
s_wait_timer = 0;
@@ -2213,7 +2210,7 @@ gui_mch_set_menu_pos(
int w UNUSED,
int h UNUSED)
{
- /* It will be in the right place anyway */
+ // It will be in the right place anyway
}
#if defined(FEAT_MENU) || defined(PROTO)
@@ -2245,7 +2242,7 @@ gui_mch_draw_menubar(void)
{
DrawMenuBar(s_hwnd);
}
-#endif /*FEAT_MENU*/
+#endif // FEAT_MENU
/*
* Return the RGB value of a pixel as a long.
@@ -2258,21 +2255,27 @@ gui_mch_get_rgb(guicolor_T pixel)
}
#if defined(FEAT_GUI_DIALOG) || defined(PROTO)
-/* Convert pixels in X to dialog units */
+/*
+ * Convert pixels in X to dialog units
+ */
static WORD
PixelToDialogX(int numPixels)
{
return (WORD)((numPixels * 4) / s_dlgfntwidth);
}
-/* Convert pixels in Y to dialog units */
+/*
+ * Convert pixels in Y to dialog units
+ */
static WORD
PixelToDialogY(int numPixels)
{
return (WORD)((numPixels * 8) / s_dlgfntheight);
}
-/* Return the width in pixels of the given text in the given DC. */
+/*
+ * Return the width in pixels of the given text in the given DC.
+ */
static int
GetTextWidth(HDC hdc, char_u *str, int len)
{
@@ -2328,7 +2331,7 @@ CenterWindow(
wChild = rChild.right - rChild.left;
hChild = rChild.bottom - rChild.top;
- /* If Vim is minimized put the window in the middle of the screen. */
+ // If Vim is minimized put the window in the middle of the screen.
if (hwndParent == NULL || IsMinimized(hwndParent))
get_work_area(&rParent);
else
@@ -2367,7 +2370,7 @@ CenterWindow(
return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0,
SWP_NOSIZE | SWP_NOZORDER);
}
-#endif /* FEAT_GUI_DIALOG */
+#endif // FEAT_GUI_DIALOG
#if defined(FEAT_TOOLBAR) || defined(PROTO)
void
@@ -2391,7 +2394,7 @@ gui_mch_show_toolbar(int showit)
ShowWindow(s_toolbarhwnd, SW_HIDE);
}
-/* The number of bitmaps is fixed. Exit is missing! */
+// The number of bitmaps is fixed. Exit is missing!
# define TOOLBAR_BITMAP_COUNT 31
#endif
@@ -2424,7 +2427,7 @@ show_tabline_popup_menu(void)
long rval;
POINT pt;
- /* When ignoring events don't show the menu. */
+ // When ignoring events don't show the menu.
if (hold_gui_events
# ifdef FEAT_CMDWIN
|| cmdwin_type != 0
@@ -2450,7 +2453,7 @@ show_tabline_popup_menu(void)
DestroyMenu(tab_pmenu);
- /* Add the string cmd into input buffer */
+ // Add the string cmd into input buffer
if (rval > 0)
{
TCHITTESTINFO htinfo;
@@ -2516,7 +2519,7 @@ gui_mch_update_tabline(void)
return;
# ifndef CCM_SETUNICODEFORMAT
- /* For older compilers. We assume this never changes. */
+ // For older compilers. We assume this never changes.
# define CCM_SETUNICODEFORMAT 0x2005
# endif
// Enable unicode support
@@ -2525,10 +2528,10 @@ gui_mch_update_tabline(void)
tie.mask = TCIF_TEXT;
tie.iImage = -1;
- /* Disable redraw for tab updates to eliminate O(N^2) draws. */
+ // Disable redraw for tab updates to eliminate O(N^2) draws.
SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0);
- /* Add a label for each tab page. They all contain the same text area. */
+ // 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)
@@ -2536,7 +2539,7 @@ gui_mch_update_tabline(void)
if (nr >= TabCtrl_GetItemCount(s_tabhwnd))
{
- /* Add the tab */
+ // Add the tab
tie.pszText = "-Empty-";
TabCtrl_InsertItem(s_tabhwnd, nr, &tie);
tabadded = 1;
@@ -2558,14 +2561,14 @@ gui_mch_update_tabline(void)
}
}
- /* Remove any old labels. */
+ // Remove any old labels.
while (nr < TabCtrl_GetItemCount(s_tabhwnd))
TabCtrl_DeleteItem(s_tabhwnd, nr);
if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
- /* Re-enable redraw and redraw. */
+ // Re-enable redraw and redraw.
SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
RedrawWindow(s_tabhwnd, NULL, NULL,
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
@@ -2603,15 +2606,15 @@ ex_simalt(exarg_T *eap)
while (*keys)
{
if (*keys == '~')
- *keys = ' '; /* for showing system menu */
+ *keys = ' '; // for showing system menu
PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0);
keys++;
fill_typebuf = TRUE;
}
if (fill_typebuf)
{
- /* Put a NOP in the typeahead buffer so that the message will get
- * processed. */
+ // Put a NOP in the typeahead buffer so that the message will get
+ // processed.
key_name[0] = K_SPECIAL;
key_name[1] = KS_EXTRA;
key_name[2] = KE_NOP;
@@ -2636,7 +2639,7 @@ initialise_findrep(char_u *initial_string)
int mcase = !p_ic;
char_u *entry_text;
- /* Get the search string to use. */
+ // Get the search string to use.
entry_text = get_find_dialog_text(initial_string, &wword, &mcase);
s_findrep_struct.hwndOwner = s_hwnd;
@@ -2668,7 +2671,7 @@ set_window_title(HWND hwnd, char *title)
{
WCHAR *wbuf;
- /* Convert the title from 'encoding' to UTF-16. */
+ // Convert the title from 'encoding' to UTF-16.
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
if (wbuf != NULL)
{
@@ -2745,14 +2748,14 @@ gui_mch_mousehide(int hide)
static void
gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y)
{
- /* Unhide the mouse, we don't get move events here. */
+ // Unhide the mouse, we don't get move events here.
gui_mch_mousehide(FALSE);
(void)TrackPopupMenu(
(HMENU)menu->submenu_id,
TPM_LEFTALIGN | TPM_LEFTBUTTON,
x, y,
- (int)0, /*reserved param*/
+ (int)0, //reserved param
s_hwnd,
NULL);
/*
@@ -2799,11 +2802,11 @@ _OnPaint(
{
PAINTSTRUCT ps;
- out_flush(); /* make sure all output has been processed */
+ out_flush(); // make sure all output has been processed
(void)BeginPaint(hwnd, &ps);
- /* prevent multi-byte characters from misprinting on an invalid
- * rectangle */
+ // prevent multi-byte characters from misprinting on an invalid
+ // rectangle
if (has_mbyte)
{
RECT rect;
@@ -2836,7 +2839,7 @@ _OnSize(
gui_resize_shell(cx, cy);
#ifdef FEAT_MENU
- /* Menu bar may wrap differently now */
+ // Menu bar may wrap differently now
gui_mswin_get_menu_height(TRUE);
#endif
}
@@ -2871,8 +2874,8 @@ _OnActivateApp(
BOOL fActivate,
DWORD dwThreadId)
{
- /* we call gui_focus_change() in _OnSetFocus() */
- /* gui_focus_change((int)fActivate); */
+ // we call gui_focus_change() in _OnSetFocus()
+ // gui_focus_change((int)fActivate);
return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId);
}
@@ -2954,9 +2957,9 @@ gui_mch_flash(int msec)
rc.right = gui.num_cols * gui.char_width;
rc.bottom = gui.num_rows * gui.char_height;
InvertRect(s_hdc, &rc);
- gui_mch_flush(); /* make sure it's displayed */
+ gui_mch_flush(); // make sure it's displayed
- ui_delay((long)msec, TRUE); /* wait for a few msec */
+ ui_delay((long)msec, TRUE); // wait for a few msec
InvertRect(s_hdc, &rc);
}
@@ -2974,13 +2977,13 @@ get_scroll_flags(void)
GetWindowRect(s_hwnd, &rcVim);
- /* Check if the window is partly above or below the screen. We don't care
- * about partly left or right of the screen, it is not relevant when
- * scrolling up or down. */
+ // Check if the window is partly above or below the screen. We don't care
+ // about partly left or right of the screen, it is not relevant when
+ // scrolling up or down.
if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN))
return SW_INVALIDATE;
- /* Check if there is an window (partly) on top of us. */
+ // Check if there is an window (partly) on top of us.
for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; )
if (IsWindowVisible(hwnd))
{
@@ -3036,11 +3039,11 @@ gui_mch_delete_lines(
UpdateWindow(s_textArea);
}
- /* This seems to be required to avoid the cursor disappearing when
- * scrolling such that the cursor ends up in the top-left character on
- * the screen... But why? (Webb) */
- /* It's probably fixed by disabling drawing the cursor while scrolling. */
- /* gui.cursor_is_valid = FALSE; */
+ // This seems to be required to avoid the cursor disappearing when
+ // scrolling such that the cursor ends up in the top-left character on
+ // the screen... But why? (Webb)
+ // It's probably fixed by disabling drawing the cursor while scrolling.
+ // gui.cursor_is_valid = FALSE;
gui_clear_block(gui.scroll_region_bot - num_lines + 1,
gui.scroll_region_left,
@@ -3073,8 +3076,8 @@ gui_mch_insert_lines(
#endif
{
intel_gpu_workaround();
- /* The SW_INVALIDATE is required when part of the window is covered or
- * off-screen. How do we avoid it when it's not needed? */
+ // The SW_INVALIDATE is required when part of the window is covered or
+ // off-screen. How do we avoid it when it's not needed?
ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height,
&rc, &rc, NULL, NULL, get_scroll_flags());
UpdateWindow(s_textArea);
@@ -3098,14 +3101,14 @@ gui_mch_exit(int rc UNUSED)
DeleteObject(s_brush);
#ifdef FEAT_TEAROFF
- /* Unload the tearoff bitmap */
+ // Unload the tearoff bitmap
(void)DeleteObject((HGDIOBJ)s_htearbitmap);
#endif
- /* Destroy our window (if we have one). */
+ // Destroy our window (if we have one).
if (s_hwnd != NULL)
{
- destroying = TRUE; /* ignore WM_DESTROY message now */
+ destroying = TRUE; // ignore WM_DESTROY message now
DestroyWindow(s_hwnd);
}
@@ -3246,7 +3249,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
GuiFont font = NOFONT;
char_u *p;
- /* Load the font */
+ // Load the font
if (get_logfont(&lf, font_name, NULL, TRUE) == OK)
font = get_font_handle(&lf);
if (font == NOFONT)
@@ -3273,8 +3276,8 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
{
hl_set_font_name(p);
- /* When setting 'guifont' to "*" replace it with the actual font name.
- * */
+ // When setting 'guifont' to "*" replace it with the actual font name.
+ //
if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0)
{
vim_free(p_guifont);
@@ -3312,7 +3315,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
}
#ifndef WPF_RESTORETOMAXIMIZED
-# define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */
+# define WPF_RESTORETOMAXIMIZED 2 // just in case someone doesn't have it
#endif
/*
@@ -3359,7 +3362,7 @@ gui_mch_newfont(void)
}
else
{
- /* Inside another window, don't use the frame and border. */
+ // Inside another window, don't use the frame and border.
gui_resize_shell(rect.right - rect.left,
rect.bottom - rect.top
#ifdef FEAT_MENU
@@ -3381,27 +3384,27 @@ gui_mch_settitle(
}
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
-/* Table for shape IDCs. Keep in sync with the mshape_names[] table in
- * misc2.c! */
+// Table for shape IDCs. Keep in sync with the mshape_names[] table in
+// misc2.c!
static LPCSTR mshape_idcs[] =
{
- IDC_ARROW, /* arrow */
- MAKEINTRESOURCE(0), /* blank */
- IDC_IBEAM, /* beam */
- IDC_SIZENS, /* updown */
- IDC_SIZENS, /* udsizing */
- IDC_SIZEWE, /* leftright */
- IDC_SIZEWE, /* lrsizing */
- IDC_WAIT, /* busy */
- IDC_NO, /* no */
- IDC_ARROW, /* crosshair */
- IDC_ARROW, /* hand1 */
- IDC_ARROW, /* hand2 */
- IDC_ARROW, /* pencil */
- IDC_ARROW, /* question */
- IDC_ARROW, /* right-arrow */
- IDC_UPARROW, /* up-arrow */
- IDC_ARROW /* last one */
+ IDC_ARROW, // arrow
+ MAKEINTRESOURCE(0), // blank
+ IDC_IBEAM, // beam
+ IDC_SIZENS, // updown
+ IDC_SIZENS, // udsizing
+ IDC_SIZEWE, // leftright
+ IDC_SIZEWE, // lrsizing
+ IDC_WAIT, // busy
+ IDC_NO, // no
+ IDC_ARROW, // crosshair
+ IDC_ARROW, // hand1
+ IDC_ARROW, // hand2
+ IDC_ARROW, // pencil
+ IDC_ARROW, // question
+ IDC_ARROW, // right-arrow
+ IDC_UPARROW, // up-arrow
+ IDC_ARROW // last one
};
void
@@ -3422,7 +3425,7 @@ mch_set_mouse_shape(int shape)
{
POINT mp;
- /* Set the position to make it redrawn with the new shape. */
+ // Set the position to make it redrawn with the new shape.
(void)GetCursorPos((LPPOINT)&mp);
(void)SetCursorPos(mp.x, mp.y);
ShowCursor(TRUE);
@@ -3470,8 +3473,8 @@ gui_mch_browse(
char_u *initdir,
char_u *filter)
{
- /* We always use the wide function. This means enc_to_utf16() must work,
- * otherwise it fails miserably! */
+ // We always use the wide function. This means enc_to_utf16() must work,
+ // otherwise it fails miserably!
OPENFILENAMEW fileStruct;
WCHAR fileBuf[MAXPATHL];
WCHAR *wp;
@@ -3498,12 +3501,12 @@ gui_mch_browse(
}
}
- /* Convert the filter to Windows format. */
+ // Convert the filter to Windows format.
filterp = convert_filterW(filter);
vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW));
# ifdef OPENFILENAME_SIZE_VERSION_400W
- /* be compatible with Windows NT 4.0 */
+ // be compatible with Windows NT 4.0
fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
# else
fileStruct.lStructSize = sizeof(fileStruct);
@@ -3520,11 +3523,11 @@ gui_mch_browse(
fileStruct.lpstrFile = fileBuf;
fileStruct.nMaxFile = MAXPATHL;
fileStruct.lpstrFilter = filterp;
- fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
- /* has an initial dir been specified? */
+ fileStruct.hwndOwner = s_hwnd; // main Vim window is owner
+ // has an initial dir been specified?
if (initdir != NULL && *initdir != NUL)
{
- /* Must have backslashes here, no matter what 'shellslash' says */
+ // Must have backslashes here, no matter what 'shellslash' says
initdirp = enc_to_utf16(initdir, NULL);
if (initdirp != NULL)
{
@@ -3564,15 +3567,15 @@ gui_mch_browse(
vim_free(titlep);
vim_free(extp);
- /* Convert from UCS2 to 'encoding'. */
+ // Convert from UCS2 to 'encoding'.
p = utf16_to_enc(fileBuf, NULL);
if (p == NULL)
return NULL;
- /* Give focus back to main window (when using MDI). */
+ // Give focus back to main window (when using MDI).
SetFocus(s_hwnd);
- /* Shorten the file name if possible */
+ // Shorten the file name if possible
q = vim_strsave(shorten_fname1(p));
vim_free(p);
return q;
@@ -3602,7 +3605,7 @@ convert_filter(char_u *s)
else
res[i] = s[i];
res[s_len] = NUL;
- /* Add two extra NULs to make sure it's properly terminated. */
+ // Add two extra NULs to make sure it's properly terminated.
res[s_len + 1] = NUL;
res[s_len + 2] = NUL;
}
@@ -3615,12 +3618,12 @@ convert_filter(char_u *s)
char_u *
gui_mch_browsedir(char_u *title, char_u *initdir)
{
- /* We fake this: Use a filter that doesn't select anything and a default
- * file name that won't be used. */
+ // We fake this: Use a filter that doesn't select anything and a default
+ // file name that won't be used.
return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL,
initdir, (char_u *)_("Directory\t*.nothing\n"));
}
-#endif /* FEAT_BROWSE */
+#endif // FEAT_BROWSE
static void
_OnDropFiles(
@@ -3637,9 +3640,9 @@ _OnDropFiles(
POINT pt;
int_u modifiers = 0;
- /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */
+ // TRACE("_OnDropFiles: %d files dropped\n", cFiles);
- /* Obtain dropped position */
+ // Obtain dropped position
DragQueryPoint(hDrop, &pt);
MapWindowPoints(s_hwnd, s_textArea, &pt, 1);
@@ -3683,7 +3686,7 @@ _OnScroll(
UINT code,
int pos)
{
- static UINT prev_code = 0; /* code of previous call */
+ static UINT prev_code = 0; // code of previous call
scrollbar_T *sb, *sb_info;
long val;
int dragging = FALSE;
@@ -3697,7 +3700,7 @@ _OnScroll(
if (sb == NULL)
return 0;
- if (sb->wp != NULL) /* Left or right scrollbar */
+ if (sb->wp != NULL) // Left or right scrollbar
{
/*
* Careful: need to get scrollbar info out of first (left) scrollbar
@@ -3706,7 +3709,7 @@ _OnScroll(
*/
sb_info = &sb->wp->w_scrollbars[0];
}
- else /* Bottom scrollbar */
+ else // Bottom scrollbar
sb_info = sb;
val = sb_info->value;
@@ -3751,7 +3754,7 @@ _OnScroll(
break;
default:
- /* TRACE("Unknown scrollbar event %d\n", code); */
+ // TRACE("Unknown scrollbar event %d\n", code);
return 0;
}
prev_code = code;
@@ -3770,11 +3773,11 @@ _OnScroll(
SetScrollInfo(id, SB_CTL, &si, TRUE);
}
- /* Don't let us be interrupted here by another message. */
+ // Don't let us be interrupted here by another message.
s_busy_processing = TRUE;
- /* When "allow_scrollbar" is FALSE still need to remember the new
- * position, but don't actually scroll by setting "dont_scroll". */
+ // When "allow_scrollbar" is FALSE still need to remember the new
+ // position, but don't actually scroll by setting "dont_scroll".
dont_scroll = !allow_scrollbar;
mch_disable_flush();
@@ -3902,10 +3905,10 @@ _OnScroll(
# define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \
((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
# endif
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
-/* Some parameters for tearoff menus. All in pixels. */
+// Some parameters for tearoff menus. All in pixels.
#define TEAROFF_PADDING_X 2
#define TEAROFF_BUTTON_PAD_X 8
#define TEAROFF_MIN_WIDTH 200
@@ -3913,7 +3916,7 @@ _OnScroll(
#define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with.
-/* For the Intellimouse: */
+// For the Intellimouse:
#ifndef WM_MOUSEWHEEL
# define WM_MOUSEWHEEL 0x20a
#endif
@@ -3924,8 +3927,8 @@ _OnScroll(
# define BEVAL_TEXT_LEN MAXPATHL
# if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
-/* Work around old versions of basetsd.h which wrongly declares
- * UINT_PTR as unsigned long. */
+// Work around old versions of basetsd.h which wrongly declares
+// UINT_PTR as unsigned long.
# undef UINT_PTR
# define UINT_PTR UINT
# endif
@@ -3935,7 +3938,7 @@ static UINT_PTR BevalTimerId = 0;
static DWORD LastActivity = 0;
-/* cproto fails on missing include files */
+// cproto fails on missing include files
# ifndef PROTO
/*
@@ -4018,13 +4021,13 @@ typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
# define TTN_GETDISPINFO (TTN_FIRST - 0)
# endif
-#endif /* defined(FEAT_BEVAL_GUI) */
+#endif // defined(FEAT_BEVAL_GUI)
#if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE)
-/* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define
- * it here if LPNMTTDISPINFO isn't defined.
- * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check
- * _MSC_VER. */
+// Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define
+// it here if LPNMTTDISPINFO isn't defined.
+// MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check
+// _MSC_VER.
# if !defined(LPNMTTDISPINFO) && defined(_MSC_VER)
typedef struct tagNMTTDISPINFOA {
NMHDR hdr;
@@ -4051,7 +4054,7 @@ typedef struct tagNMTTDISPINFOW {
# define TTN_GETDISPINFOW (TTN_FIRST - 10)
#endif
-/* Local variables: */
+// Local variables:
#ifdef FEAT_MENU
static UINT s_menu_id = 100;
@@ -4066,9 +4069,9 @@ static UINT s_menu_id = 100;
#define VIM_NAME "vim"
#define VIM_CLASSW L"Vim"
-/* Initial size for the dialog template. For gui_mch_dialog() it's fixed,
- * thus there should be room for every dialog. For tearoffs it's made bigger
- * when needed. */
+// Initial size for the dialog template. For gui_mch_dialog() it's fixed,
+// thus there should be room for every dialog. For tearoffs it's made bigger
+// when needed.
#define DLG_ALLOC_SIZE 16 * 1024
/*
@@ -4094,10 +4097,10 @@ static void get_dialog_font_metrics(void);
static int dialog_default_button = -1;
-/* Intellimouse support */
+// Intellimouse support
static int mouse_scroll_lines = 0;
-static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */
+static int s_usenewlook; // emulate W95/NT4 non-bold dialogs
#ifdef FEAT_TOOLBAR
static void initialise_toolbar(void);
static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -4158,7 +4161,7 @@ static void dyn_imm_load(void);
*/
static int
gui_mswin_get_menu_height(
- int fix_window) /* If TRUE, resize window if menu height changed */
+ int fix_window) // If TRUE, resize window if menu height changed
{
static int old_menu_height = -1;
@@ -4175,10 +4178,10 @@ gui_mswin_get_menu_height(
menu_height = 0;
else if (IsMinimized(s_hwnd))
{
- /* The height of the menu cannot be determined while the window is
- * minimized. Take the previous height if the menu is changed in that
- * state, to avoid that Vim's vertical window size accidentally
- * increases due to the unaccounted-for menu height. */
+ // The height of the menu cannot be determined while the window is
+ // minimized. Take the previous height if the menu is changed in that
+ // state, to avoid that Vim's vertical window size accidentally
+ // increases due to the unaccounted-for menu height.
menu_height = old_menu_height == -1 ? 0 : old_menu_height;
}
else
@@ -4206,7 +4209,7 @@ gui_mswin_get_menu_height(
return menu_height;
}
-#endif /*FEAT_MENU*/
+#endif // FEAT_MENU
/*
@@ -4223,14 +4226,14 @@ init_mouse_wheel(void)
# define SPI_SETWHEELSCROLLLINES 105
#endif
-#define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */
-#define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */
+#define VMOUSEZ_CLASSNAME "MouseZ" // hidden wheel window class
+#define VMOUSEZ_TITLE "Magellan MSWHEEL" // hidden wheel window title
#define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
#define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
- mouse_scroll_lines = 3; /* reasonable default */
+ mouse_scroll_lines = 3; // reasonable default
- /* if NT 4.0+ (or Win98) get scroll lines directly from system */
+ // if NT 4.0+ (or Win98) get scroll lines directly from system
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
&mouse_scroll_lines, 0);
}
@@ -4399,7 +4402,7 @@ _OnWindowPosChanged(
cy = lpwpos->cy;
netbeans_frame_moved(x, y);
}
- /* Allow to send WM_SIZE and WM_MOVE */
+ // Allow to send WM_SIZE and WM_MOVE
FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc);
}
#endif
@@ -4459,9 +4462,9 @@ _WndProc(
{
HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar);
HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar);
- /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */
+ // HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate);
HANDLE_MSG(hwnd, WM_CLOSE, _OnClose);
- /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */
+ // HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand);
HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy);
HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles);
HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll);
@@ -4469,12 +4472,12 @@ _WndProc(
#ifdef FEAT_MENU
HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu);
#endif
- /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */
- /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */
+ // HANDLE_MSG(hwnd, WM_MOVE, _OnMove);
+ // HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate);
HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus);
HANDLE_MSG(hwnd, WM_SIZE, _OnSize);
- /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */
- /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */
+ // HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand);
+ // HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey);
HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll);
// HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging);
HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp);
@@ -4522,12 +4525,12 @@ _WndProc(
}
#endif
- case WM_QUERYENDSESSION: /* System wants to go down. */
- gui_shell_closed(); /* Will exit when no changed buffers. */
- return FALSE; /* Do NOT allow system to go down. */
+ case WM_QUERYENDSESSION: // System wants to go down.
+ gui_shell_closed(); // Will exit when no changed buffers.
+ return FALSE; // Do NOT allow system to go down.
case WM_ENDSESSION:
- if (wParam) /* system only really goes down when wParam is TRUE */
+ if (wParam) // system only really goes down when wParam is TRUE
{
_OnEndSession();
return 0L;
@@ -4535,8 +4538,8 @@ _WndProc(
break;
case WM_CHAR:
- /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single
- * byte while we want the UTF-16 character value. */
+ // Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single
+ // byte while we want the UTF-16 character value.
_OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam));
return 0L;
@@ -4563,23 +4566,23 @@ _WndProc(
case WM_SYSKEYUP:
#ifdef FEAT_MENU
- /* This used to be done only when menu is active: ALT key is used for
- * that. But that caused problems when menu is disabled and using
- * Alt-Tab-Esc: get into a strange state where no mouse-moved events
- * are received, mouse pointer remains hidden. */
+ // This used to be done only when menu is active: ALT key is used for
+ // that. But that caused problems when menu is disabled and using
+ // Alt-Tab-Esc: get into a strange state where no mouse-moved events
+ // are received, mouse pointer remains hidden.
return MyWindowProc(hwnd, uMsg, wParam, lParam);
#else
return 0L;
#endif
- case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */
+ case WM_SIZING: // HANDLE_MSG doesn't seem to handle this one
return _DuringSizing((UINT)wParam, (LPRECT)lParam);
case WM_MOUSEWHEEL:
_OnMouseWheel(hwnd, HIWORD(wParam));
return 0L;
- /* Notification for change in SystemParametersInfo() */
+ // Notification for change in SystemParametersInfo()
case WM_SETTINGCHANGE:
return _OnSettingChange((UINT)wParam);
@@ -4653,21 +4656,21 @@ _WndProc(
{
LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam;
- /* Set the maximum width, this also enables using
- * \n for line break. */
+ // Set the maximum width, this also enables using
+ // \n for line break.
SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
0, 500);
tt_text = enc_to_utf16(str, NULL);
lpdi->lpszText = tt_text;
- /* can't show tooltip if failed */
+ // can't show tooltip if failed
}
else
{
LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam;
- /* Set the maximum width, this also enables using
- * \n for line break. */
+ // Set the maximum width, this also enables using
+ // \n for line break.
SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
0, 500);
@@ -4760,8 +4763,8 @@ _WndProc(
int yPos = GET_Y_LPARAM(lParam);
RECT rct;
- /* If the cursor is on the GUI tabline, don't process this
- * event */
+ // If the cursor is on the GUI tabline, don't process this
+ // event
GetWindowRect(s_textArea, &rct);
if (yPos < rct.top)
return result;
@@ -4770,7 +4773,7 @@ _WndProc(
(void)gui_mch_get_winpos(&x, &y);
xPos -= x;
- if (xPos < 48) /* <VN> TODO should use system metric? */
+ if (xPos < 48) // <VN> TODO should use system metric?
return HTBOTTOMLEFT;
else
return HTBOTTOMRIGHT;
@@ -4778,7 +4781,7 @@ _WndProc(
else
return result;
}
- /* break; notreached */
+ // break; notreached
#ifdef FEAT_MBYTE_IME
case WM_IME_NOTIFY:
@@ -4807,7 +4810,7 @@ _WndProc(
* End of call-back routines
*/
-/* parent window, if specified with -P */
+// parent window, if specified with -P
HWND vim_parent_hwnd = NULL;
static BOOL CALLBACK
@@ -4820,14 +4823,14 @@ FindWindowTitle(HWND hwnd, LPARAM lParam)
{
if (strstr(buf, title) != NULL)
{
- /* Found it. Store the window ref. and quit searching if MDI
- * works. */
+ // Found it. Store the window ref. and quit searching if MDI
+ // works.
vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL);
if (vim_parent_hwnd != NULL)
return FALSE;
}
}
- return TRUE; /* continue searching */
+ return TRUE; // continue searching
}
/*
@@ -4855,7 +4858,7 @@ ole_error(char *arg)
gui.in_use = mch_is_gui_executable();
# endif
- /* Can't use emsg() here, we have not finished initialisation yet. */
+ // Can't use emsg() here, we have not finished initialisation yet.
vim_snprintf(buf, IOSIZE,
_("E243: Argument not supported: \"-%s\"; Use the OLE version."),
arg);
@@ -5009,10 +5012,10 @@ gui_mch_prepare(int *argc, char **argv)
int silent = FALSE;
int idx;
- /* Check for special OLE command line parameters */
+ // Check for special OLE command line parameters
if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/'))
{
- /* Check for a "-silent" argument first. */
+ // Check for a "-silent" argument first.
if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0
&& (argv[2][0] == '-' || argv[2][0] == '/'))
{
@@ -5022,7 +5025,7 @@ gui_mch_prepare(int *argc, char **argv)
else
idx = 1;
- /* Register Vim as an OLE Automation server */
+ // Register Vim as an OLE Automation server
if (STRICMP(argv[idx] + 1, "register") == 0)
{
#ifdef FEAT_OLE
@@ -5035,7 +5038,7 @@ gui_mch_prepare(int *argc, char **argv)
#endif
}
- /* Unregister Vim as an OLE Automation server */
+ // Unregister Vim as an OLE Automation server
if (STRICMP(argv[idx] + 1, "unregister") == 0)
{
#ifdef FEAT_OLE
@@ -5048,11 +5051,10 @@ gui_mch_prepare(int *argc, char **argv)
#endif
}
- /* Ignore an -embedding argument. It is only relevant if the
- * application wants to treat the case when it is started manually
- * differently from the case where it is started via automation (and
- * we don't).
- */
+ // Ignore an -embedding argument. It is only relevant if the
+ // application wants to treat the case when it is started manually
+ // differently from the case where it is started via automation (and
+ // we don't).
if (STRICMP(argv[idx] + 1, "embedding") == 0)
{
#ifdef FEAT_OLE
@@ -5069,7 +5071,7 @@ gui_mch_prepare(int *argc, char **argv)
int bDoRestart = FALSE;
InitOLE(&bDoRestart);
- /* automatically exit after registering */
+ // automatically exit after registering
if (bDoRestart)
mch_exit(0);
}
@@ -5077,7 +5079,7 @@ gui_mch_prepare(int *argc, char **argv)
#ifdef FEAT_NETBEANS_INTG
{
- /* stolen from gui_x11.c */
+ // stolen from gui_x11.c
int arg;
for (arg = 1; arg < *argc; arg++)
@@ -5087,7 +5089,7 @@ gui_mch_prepare(int *argc, char **argv)
mch_memmove(&argv[arg], &argv[arg + 1],
(--*argc - arg) * sizeof(char *));
argv[*argc] = NULL;
- break; /* enough? */
+ break; // enough?
}
}
#endif
@@ -5107,8 +5109,8 @@ gui_mch_init(void)
ATOM atom;
#endif
- /* Return here if the window was already opened (happens when
- * gui_mch_dialog() is called early). */
+ // Return here if the window was already opened (happens when
+ // gui_mch_dialog() is called early).
if (s_hwnd != NULL)
goto theend;
@@ -5122,14 +5124,14 @@ gui_mch_init(void)
gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL);
gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL);
#ifdef FEAT_MENU
- gui.menu_height = 0; /* Windows takes care of this */
+ gui.menu_height = 0; // Windows takes care of this
#endif
gui.border_width = 0;
s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
- /* First try using the wide version, so that we can use any title.
- * Otherwise only characters in the active codepage will work. */
+ // First try using the wide version, so that we can use any title.
+ // Otherwise only characters in the active codepage will work.
if (GetClassInfoW(g_hinst, szVimWndClassW, &wndclassw) == 0)
{
wndclassw.style = CS_DBLCLKS;
@@ -5175,7 +5177,7 @@ gui_mch_init(void)
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
- /* NOP */
+ // NOP
}
#endif
if (s_hwnd == NULL)
@@ -5186,21 +5188,21 @@ gui_mch_init(void)
}
else
{
- /* If the provided windowid is not valid reset it to zero, so that it
- * is ignored and we open our own window. */
+ // If the provided windowid is not valid reset it to zero, so that it
+ // is ignored and we open our own window.
if (IsWindow((HWND)win_socket_id) <= 0)
win_socket_id = 0;
- /* Create a window. If win_socket_id is not zero without border and
- * titlebar, it will be reparented below. */
+ // Create a window. If win_socket_id is not zero without border and
+ // titlebar, it will be reparented below.
s_hwnd = CreateWindowW(
szVimWndClassW, L"Vim MSWindows GUI",
(win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP)
| WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
- 100, /* Any value will do */
- 100, /* Any value will do */
+ 100, // Any value will do
+ 100, // Any value will do
NULL, NULL,
g_hinst, NULL);
if (s_hwnd != NULL && win_socket_id != 0)
@@ -5220,7 +5222,7 @@ gui_mch_init(void)
dyn_imm_load();
#endif
- /* Create the text area window */
+ // Create the text area window
if (GetClassInfoW(g_hinst, szTextAreaClassW, &wndclassw) == 0)
{
wndclassw.style = CS_OWNDC;
@@ -5251,7 +5253,7 @@ gui_mch_init(void)
return FAIL;
#ifdef FEAT_LIBCALL
- /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */
+ // Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico.
{
HANDLE hIcon = NULL;
@@ -5267,14 +5269,14 @@ gui_mch_init(void)
DragAcceptFiles(s_hwnd, TRUE);
- /* Do we need to bother with this? */
- /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */
+ // Do we need to bother with this?
+ // m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT);
- /* Get background/foreground colors from the system */
+ // Get background/foreground colors from the system
gui_mch_def_colors();
- /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc
- * file) */
+ // Get the colors from the "Normal" group (set in syntax.c or in a vimrc
+ // file)
set_normal_colors();
/*
@@ -5285,8 +5287,8 @@ gui_mch_init(void)
gui.def_norm_pixel = gui.norm_pixel;
gui.def_back_pixel = gui.back_pixel;
- /* Get the colors for the highlight groups (gui_check_colors() might have
- * changed them) */
+ // Get the colors for the highlight groups (gui_check_colors() might have
+ // changed them)
highlight_gui_started();
/*
@@ -5321,7 +5323,7 @@ gui_mch_init(void)
*/
s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING);
- /* Initialise the struct */
+ // Initialise the struct
s_findrep_struct.lStructSize = sizeof(s_findrep_struct);
s_findrep_struct.lpstrFindWhat = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE);
s_findrep_struct.lpstrFindWhat[0] = NUL;
@@ -5333,12 +5335,12 @@ gui_mch_init(void)
#ifdef FEAT_EVAL
# if !defined(_MSC_VER) || (_MSC_VER < 1400)
-/* Define HandleToLong for old MS and non-MS compilers if not defined. */
+// Define HandleToLong for old MS and non-MS compilers if not defined.
# ifndef HandleToLong
# define HandleToLong(h) ((long)(intptr_t)(h))
# endif
# endif
- /* set the v:windowid variable */
+ // set the v:windowid variable
set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd));
#endif
@@ -5348,7 +5350,7 @@ gui_mch_init(void)
#endif
theend:
- /* Display any pending error messages */
+ // Display any pending error messages
display_errors();
return OK;
@@ -5364,7 +5366,7 @@ get_work_area(RECT *spi_rect)
HMONITOR mon;
MONITORINFO moninfo;
- /* work out which monitor the window is on, and get *its* work area */
+ // work out which monitor the window is on, and get *its* work area
mon = MonitorFromWindow(s_hwnd, MONITOR_DEFAULTTOPRIMARY);
if (mon != NULL)
{
@@ -5375,7 +5377,7 @@ get_work_area(RECT *spi_rect)
return;
}
}
- /* this is the old method... */
+ // this is the old method...
SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0);
}
@@ -5396,27 +5398,27 @@ gui_mch_set_shellsize(
int win_width, win_height;
WINDOWPLACEMENT wndpl;
- /* Try to keep window completely on screen. */
- /* Get position of the screen work area. This is the part that is not
- * used by the taskbar or appbars. */
+ // Try to keep window completely on screen.
+ // Get position of the screen work area. This is the part that is not
+ // used by the taskbar or appbars.
get_work_area(&workarea_rect);
- /* Get current position of our window. Note that the .left and .top are
- * relative to the work area. */
+ // Get current position of our window. Note that the .left and .top are
+ // relative to the work area.
wndpl.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(s_hwnd, &wndpl);
- /* Resizing a maximized window looks very strange, unzoom it first.
- * But don't do it when still starting up, it may have been requested in
- * the shortcut. */
+ // Resizing a maximized window looks very strange, unzoom it first.
+ // But don't do it when still starting up, it may have been requested in
+ // the shortcut.
if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0)
{
ShowWindow(s_hwnd, SW_SHOWNORMAL);
- /* Need to get the settings of the normal window. */
+ // Need to get the settings of the normal window.
GetWindowPlacement(s_hwnd, &wndpl);
}
- /* compute the size of the outside of the window */
+ // compute the size of the outside of the window
win_width = width + (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
win_height = height + (GetSystemMetrics(SM_CYFRAME) +
@@ -5427,13 +5429,13 @@ gui_mch_set_shellsize(
#endif
;
- /* The following should take care of keeping Vim on the same monitor, no
- * matter if the secondary monitor is left or right of the primary
- * monitor. */
+ // The following should take care of keeping Vim on the same monitor, no
+ // matter if the secondary monitor is left or right of the primary
+ // monitor.
wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width;
wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height;
- /* If the window is going off the screen, move it on to the screen. */
+ // If the window is going off the screen, move it on to the screen.
if ((direction & RESIZE_HOR)
&& wndpl.rcNormalPosition.right > workarea_rect.right)
OffsetRect(&wndpl.rcNormalPosition,
@@ -5454,16 +5456,16 @@ gui_mch_set_shellsize(
OffsetRect(&wndpl.rcNormalPosition,
0, workarea_rect.top - wndpl.rcNormalPosition.top);
- /* set window position - we should use SetWindowPlacement rather than
- * SetWindowPos as the MSDN docs say the coord systems returned by
- * these two are not compatible. */
+ // set window position - we should use SetWindowPlacement rather than
+ // SetWindowPos as the MSDN docs say the coord systems returned by
+ // these two are not compatible.
SetWindowPlacement(s_hwnd, &wndpl);
SetActiveWindow(s_hwnd);
SetFocus(s_hwnd);
#ifdef FEAT_MENU
- /* Menu may wrap differently now */
+ // Menu may wrap differently now
gui_mswin_get_menu_height(!gui.starting);
#endif
}
@@ -5543,7 +5545,7 @@ gui_mch_set_sp_color(guicolor_T color)
* First static functions (no prototypes generated).
*/
# ifdef _MSC_VER
-# include <ime.h> /* Apparently not needed for Cygwin or MinGW. */
+# include <ime.h> // Apparently not needed for Cygwin or MinGW.
# endif
# include <imm.h>
@@ -5566,15 +5568,15 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED)
pImmSetCompositionFontW(hImc, &norm_logfont);
im_set_position(gui.row, gui.col);
- /* Disable langmap */
+ // Disable langmap
State &= ~LANGMAP;
if (State & INSERT)
{
# if defined(FEAT_KEYMAP)
- /* Unshown 'keymap' in status lines */
+ // Unshown 'keymap' in status lines
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
{
- /* Save cursor position */
+ // Save cursor position
int old_row = gui.row;
int old_col = gui.col;
@@ -5584,7 +5586,7 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED)
showmode();
status_redraw_curbuf();
update_screen(0);
- /* Restore cursor position */
+ // Restore cursor position
gui.row = old_row;
gui.col = old_col;
}
@@ -5606,7 +5608,7 @@ _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param)
char_u *ret;
int len;
- if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */
+ if ((param & GCS_RESULTSTR) == 0) // Composition unfinished.
return 0;
ret = GetResultStr(hwnd, GCS_RESULTSTR, &len);
@@ -5631,16 +5633,16 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
char_u *buf;
if (!pImmGetContext)
- return NULL; /* no imm32.dll */
+ return NULL; // no imm32.dll
- /* Try Unicode; this'll always work on NT regardless of codepage. */
+ // Try Unicode; this'll always work on NT regardless of codepage.
ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0);
if (ret == 0)
- return NULL; /* empty */
+ return NULL; // empty
if (ret > 0)
{
- /* Allocate the requested buffer plus space for the NUL character. */
+ // Allocate the requested buffer plus space for the NUL character.
wbuf = alloc(ret + sizeof(WCHAR));
if (wbuf != NULL)
{
@@ -5650,19 +5652,19 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
return (short_u *)wbuf;
}
- /* ret < 0; we got an error, so try the ANSI version. This'll work
- * on 9x/ME, but only if the codepage happens to be set to whatever
- * we're inputting. */
+ // ret < 0; we got an error, so try the ANSI version. This'll work
+ // on 9x/ME, but only if the codepage happens to be set to whatever
+ // we're inputting.
ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0);
if (ret <= 0)
- return NULL; /* empty or error */
+ return NULL; // empty or error
buf = alloc(ret);
if (buf == NULL)
return NULL;
pImmGetCompositionStringA(hIMC, GCS, buf, ret);
- /* convert from codepage to UCS-2 */
+ // convert from codepage to UCS-2
MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp);
vim_free(buf);
@@ -5678,14 +5680,14 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
static char_u *
GetResultStr(HWND hwnd, int GCS, int *lenp)
{
- HIMC hIMC; /* Input context handle. */
+ HIMC hIMC; // Input context handle.
short_u *buf = NULL;
char_u *convbuf = NULL;
if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0)
return NULL;
- /* Reads in the composition string. */
+ // Reads in the composition string.
buf = GetCompositionString_inUCS2(hIMC, GCS, lenp);
if (buf == NULL)
return NULL;
@@ -5697,7 +5699,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
}
#endif
-/* For global functions we need prototypes. */
+// For global functions we need prototypes.
#if defined(FEAT_MBYTE_IME) || defined(PROTO)
/*
@@ -5754,7 +5756,7 @@ im_set_active(int active)
}
# endif
- if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */
+ if (pImmGetContext) // if NULL imm32.dll wasn't loaded (yet)
{
if (p_imdisable)
{
@@ -5787,7 +5789,7 @@ im_set_active(int active)
if (active)
{
- /* if we have a saved conversion status, restore it */
+ // if we have a saved conversion status, restore it
if (bSaved)
pImmSetConversionStatus(hImc, dwConversionSaved,
dwSentenceSaved);
@@ -5795,7 +5797,7 @@ im_set_active(int active)
}
else
{
- /* save conversion status and disable korean */
+ // save conversion status and disable korean
if (pImmGetConversionStatus(hImc, &dwConversionSaved,
&dwSentenceSaved))
{
@@ -5836,10 +5838,10 @@ im_get_status(void)
return status;
}
-#endif /* FEAT_MBYTE_IME */
+#endif // FEAT_MBYTE_IME
#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
-/* Win32 with GLOBAL IME */
+// Win32 with GLOBAL IME
/*
* Notify cursor position to IM.
@@ -5847,7 +5849,7 @@ im_get_status(void)
void
im_set_position(int row, int col)
{
- /* Win32 with GLOBAL IME */
+ // Win32 with GLOBAL IME
POINT p;
p.x = FILL_X(col);
@@ -5888,14 +5890,14 @@ latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf)
c = *text++;
switch (c)
{
- case 0xa4: c = 0x20ac; break; /* euro */
- case 0xa6: c = 0x0160; break; /* S hat */
- case 0xa8: c = 0x0161; break; /* S -hat */
- case 0xb4: c = 0x017d; break; /* Z hat */
- case 0xb8: c = 0x017e; break; /* Z -hat */
- case 0xbc: c = 0x0152; break; /* OE */
- case 0xbd: c = 0x0153; break; /* oe */
- case 0xbe: c = 0x0178; break; /* Y */
+ case 0xa4: c = 0x20ac; break; // euro
+ case 0xa6: c = 0x0160; break; // S hat
+ case 0xa8: c = 0x0161; break; // S -hat
+ case 0xb4: c = 0x017d; break; // Z hat
+ case 0xb8: c = 0x017e; break; // Z -hat
+ case 0xbc: c = 0x0152; break; // OE
+ case 0xbd: c = 0x0153; break; // oe
+ case 0xbe: c = 0x0178; break; // Y
}
*unicodebuf++ = c;
}
@@ -5949,7 +5951,7 @@ draw_line(
HPEN hpen = CreatePen(PS_SOLID, 1, color);
HPEN old_pen = SelectObject(s_hdc, hpen);
MoveToEx(s_hdc, x1, y1, NULL);
- /* Note: LineTo() excludes the last pixel in the line. */
+ // Note: LineTo() excludes the last pixel in the line.
LineTo(s_hdc, x2, y2);
DeleteObject(SelectObject(s_hdc, old_pen));
}
@@ -6041,15 +6043,15 @@ gui_mch_draw_string(
rc.top = FILL_Y(row);
if (has_mbyte)
{
- /* Compute the length in display cells. */
+ // Compute the length in display cells.
rc.right = FILL_X(col + mb_string2cells(text, len));
}
else
rc.right = FILL_X(col + len);
rc.bottom = FILL_Y(row + 1);
- /* Cache the created brush, that saves a lot of time. We need two:
- * one for cursor background and one for the normal background. */
+ // Cache the created brush, that saves a lot of time. We need two:
+ // one for cursor background and one for the normal background.
if (gui.currBgColor == brush_color[0])
{
hbr = hbr_cache[0];
@@ -6097,8 +6099,8 @@ gui_mch_draw_string(
vim_free(padding);
pad_size = Columns;
- /* Don't give an out-of-memory message here, it would call us
- * recursively. */
+ // Don't give an out-of-memory message here, it would call us
+ // recursively.
padding = LALLOC_MULT(int, pad_size);
if (padding != NULL)
for (i = 0; i < pad_size; i++)
@@ -6112,24 +6114,24 @@ gui_mch_draw_string(
* No check for DRAW_BOLD, Windows will have done it already.
*/
- /* Check if there are any UTF-8 characters. If not, use normal text
- * output to speed up output. */
+ // Check if there are any UTF-8 characters. If not, use normal text
+ // output to speed up output.
if (enc_utf8)
for (n = 0; n < len; ++n)
if (text[n] >= 0x80)
break;
#if defined(FEAT_DIRECTX)
- /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
- * required that unicode drawing routine, currently. So this forces it
- * enabled. */
+ // Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
+ // required that unicode drawing routine, currently. So this forces it
+ // enabled.
if (IS_ENABLE_DIRECTX())
- n = 0; /* Keep n < len, to enter block for unicode. */
+ n = 0; // Keep n < len, to enter block for unicode.
#endif
- /* Check if the Unicode buffer exists and is big enough. Create it
- * with the same length as the multi-byte string, the number of wide
- * characters is always equal or smaller. */
+ // Check if the Unicode buffer exists and is big enough. Create it
+ // with the same length as the multi-byte string, the number of wide
+ // characters is always equal or smaller.
if ((enc_utf8
|| (enc_codepage > 0 && (int)GetACP() != enc_codepage)
|| enc_latin9)
@@ -6146,13 +6148,13 @@ gui_mch_draw_string(
if (enc_utf8 && n < len && unicodebuf != NULL)
{
- /* Output UTF-8 characters. Composing characters should be
- * handled here. */
+ // Output UTF-8 characters. Composing characters should be
+ // handled here.
int i;
- int wlen; /* string length in words */
- int clen; /* string length in characters */
- int cells; /* cell width of string up to composing char */
- int cw; /* width of current cell */
+ int wlen; // string length in words
+ int clen; // string length in characters
+ int cells; // cell width of string up to composing char
+ int cw; // width of current cell
int c;
wlen = 0;
@@ -6163,7 +6165,7 @@ gui_mch_draw_string(
c = utf_ptr2char(text + i);
if (c >= 0x10000)
{
- /* Turn into UTF-16 encoding. */
+ // Turn into UTF-16 encoding.
unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800;
unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00;
}
@@ -6177,15 +6179,15 @@ gui_mch_draw_string(
else
{
cw = utf_char2cells(c);
- if (cw > 2) /* don't use 4 for unprintable char */
+ if (cw > 2) // don't use 4 for unprintable char
cw = 1;
}
if (unicodepdy != NULL)
{
- /* Use unicodepdy to make characters fit as we expect, even
- * when the font uses different widths (e.g., bold character
- * is wider). */
+ // Use unicodepdy to make characters fit as we expect, even
+ // when the font uses different widths (e.g., bold character
+ // is wider).
if (c >= 0x10000)
{
unicodepdy[wlen - 2] = cw * gui.char_width;
@@ -6201,7 +6203,7 @@ gui_mch_draw_string(
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
- /* Add one to "cells" for italics. */
+ // Add one to "cells" for italics.
DWriteContext_DrawText(s_dwc, unicodebuf, wlen,
TEXT_X(col), TEXT_Y(row),
FILL_X(cells + 1), FILL_Y(1) - p_linespace,
@@ -6212,12 +6214,12 @@ gui_mch_draw_string(
#endif
ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, unicodebuf, wlen, unicodepdy);
- len = cells; /* used for underlining */
+ len = cells; // used for underlining
}
else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9)
{
- /* If we want to display codepage data, and the current CP is not the
- * ANSI one, we need to go via Unicode. */
+ // If we want to display codepage data, and the current CP is not the
+ // ANSI one, we need to go via Unicode.
if (unicodebuf != NULL)
{
if (enc_latin9)
@@ -6229,9 +6231,9 @@ gui_mch_draw_string(
(LPWSTR)unicodebuf, unibuflen);
if (len != 0)
{
- /* Use unicodepdy to make characters fit as we expect, even
- * when the font uses different widths (e.g., bold character
- * is wider). */
+ // Use unicodepdy to make characters fit as we expect, even
+ // when the font uses different widths (e.g., bold character
+ // is wider).
if (unicodepdy != NULL)
{
int i;
@@ -6253,8 +6255,8 @@ gui_mch_draw_string(
else
{
#ifdef FEAT_RIGHTLEFT
- /* Windows will mess up RL text, so we have to draw it character by
- * character. Only do this if RL is on, since it's slow. */
+ // Windows will mess up RL text, so we have to draw it character by
+ // character. Only do this if RL is on, since it's slow.
if (curwin->w_p_rl)
RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, (char *)text, len, padding);
@@ -6264,25 +6266,25 @@ gui_mch_draw_string(
foptions, pcliprect, (char *)text, len, padding);
}
- /* Underline */
+ // Underline
if (flags & DRAW_UNDERL)
{
- /* When p_linespace is 0, overwrite the bottom row of pixels.
- * Otherwise put the line just below the character. */
+ // When p_linespace is 0, overwrite the bottom row of pixels.
+ // Otherwise put the line just below the character.
y = FILL_Y(row + 1) - 1;
if (p_linespace > 1)
y -= p_linespace - 1;
draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor);
}
- /* Strikethrough */
+ // Strikethrough
if (flags & DRAW_STRIKE)
{
y = FILL_Y(row + 1) - gui.char_height/2;
draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currSpColor);
}
- /* Undercurl */
+ // Undercurl
if (flags & DRAW_UNDERC)
{
int x;
@@ -6303,7 +6305,9 @@ gui_mch_draw_string(
* Output routines.
*/
-/* Flush any output to the screen */
+/*
+ * Flush any output to the screen
+ */
void
gui_mch_flush(void)
{
@@ -6333,9 +6337,9 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
- (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
- /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
- * the menubar for MSwin, we subtract it from the screen height, so that
- * the window size can be made to fit on the screen. */
+ // FIXME: dirty trick: Because the gui_get_base_height() doesn't include
+ // the menubar for MSwin, we subtract it from the screen height, so that
+ // the window size can be made to fit on the screen.
*screen_h = workarea_rect.bottom - workarea_rect.top
- (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
@@ -6385,7 +6389,7 @@ gui_mch_add_menu(
vim_free(wn);
}
- /* Fix window size if menu may have wrapped */
+ // Fix window size if menu may have wrapped
if (parent == NULL)
gui_mswin_get_menu_height(!gui.starting);
# ifdef FEAT_TEAROFF
@@ -6412,7 +6416,7 @@ gui_make_popup(char_u *path_name, int mouse_pos)
{
POINT p;
- /* Find the position of the current cursor */
+ // Find the position of the current cursor
GetDCOrgEx(s_hdc, &p);
if (mouse_pos)
{
@@ -6442,7 +6446,7 @@ gui_make_tearoff(char_u *path_name)
{
vimmenu_T *menu = gui_find_menu(path_name);
- /* Found the menu, so tear it off. */
+ // Found the menu, so tear it off.
if (menu != NULL)
gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL);
}
@@ -6549,7 +6553,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
&& menu->parent->children != NULL
&& IsWindow(menu->parent->tearoff_handle))
{
- /* This menu must not show up when rebuilding the tearoff window. */
+ // This menu must not show up when rebuilding the tearoff window.
menu->modes = 0;
rebuild_tearoff(menu->parent);
}
@@ -6561,7 +6565,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
static void
rebuild_tearoff(vimmenu_T *menu)
{
- /*hackish*/
+ //hackish
char_u tbuf[128];
RECT trect;
RECT rct;
@@ -6595,7 +6599,7 @@ rebuild_tearoff(vimmenu_T *menu)
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
}
-# endif /* FEAT_TEAROFF */
+# endif // FEAT_TEAROFF
/*
* Make a menu either grey or not grey.
@@ -6640,10 +6644,10 @@ gui_mch_menu_grey(
# endif
}
-#endif /* FEAT_MENU */
+#endif // FEAT_MENU
-/* define some macros used to make the dialogue creation more readable */
+// define some macros used to make the dialogue creation more readable
#define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1)
#define add_word(x) *p++ = (x)
@@ -6671,13 +6675,13 @@ dialog_callback(
if (message == WM_INITDIALOG)
{
CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER));
- /* Set focus to the dialog. Set the default button, if specified. */
+ // Set focus to the dialog. Set the default button, if specified.
(void)SetFocus(hwnd);
if (dialog_default_button > IDCANCEL)
(void)SetFocus(GetDlgItem(hwnd, dialog_default_button));
else
- /* We don't have a default, set focus on another element of the
- * dialog window, probably the icon */
+ // We don't have a default, set focus on another element of the
+ // dialog window, probably the icon
(void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL));
return FALSE;
}
@@ -6686,13 +6690,12 @@ dialog_callback(
{
int button = LOWORD(wParam);
- /* Don't end the dialog if something was selected that was
- * not a button.
- */
+ // Don't end the dialog if something was selected that was
+ // not a button.
if (button >= DLG_NONBUTTON_CONTROL)
return TRUE;
- /* If the edit box exists, copy the string. */
+ // If the edit box exists, copy the string.
if (s_textfield != NULL)
{
WCHAR *wp = ALLOC_MULT(WCHAR, IOSIZE);
@@ -6744,7 +6747,7 @@ dialog_callback(
* If stubbing out this fn, return 1.
*/
-static const char *dlg_icons[] = /* must match names in resource file */
+static const char *dlg_icons[] = // must match names in resource file
{
"IDR_VIM",
"IDR_VIM_ERROR",
@@ -6800,12 +6803,12 @@ gui_mch_dialog(
int l;
# ifndef NO_CONSOLE
- /* Don't output anything in silent mode ("ex -s") */
+ // Don't output anything in silent mode ("ex -s")
# ifdef VIMDLL
if (!(gui.in_use || gui.starting))
# endif
if (silent_mode)
- return dfltbutton; /* return default option */
+ return dfltbutton; // return default option
# endif
if (s_hwnd == NULL)
@@ -6814,8 +6817,8 @@ gui_mch_dialog(
if ((type < 0) || (type > VIM_LAST_TYPE))
type = 0;
- /* allocate some memory for dialog template */
- /* TODO should compute this really */
+ // allocate some memory for dialog template
+ // TODO should compute this really
pdlgtemplate = p = (PWORD)LocalAlloc(LPTR,
DLG_ALLOC_SIZE + STRLEN(message) * 2);
@@ -6831,9 +6834,9 @@ gui_mch_dialog(
if (tbuffer == NULL)
return -1;
- --dfltbutton; /* Change from one-based to zero-based */
+ --dfltbutton; // Change from one-based to zero-based
- /* Count buttons */
+ // Count buttons
numButtons = 1;
for (i = 0; tbuffer[i] != '\0'; i++)
{
@@ -6843,12 +6846,12 @@ gui_mch_dialog(
if (dfltbutton >= numButtons)
dfltbutton = -1;
- /* Allocate array to hold the width of each button */
+ // Allocate array to hold the width of each button
buttonWidths = ALLOC_MULT(int, numButtons);
if (buttonWidths == NULL)
return -1;
- /* Allocate array to hold the X position of each button */
+ // Allocate array to hold the X position of each button
buttonPositions = ALLOC_MULT(int, numButtons);
if (buttonPositions == NULL)
return -1;
@@ -6883,25 +6886,25 @@ gui_mch_dialog(
GetTextMetrics(hdc, &fontInfo);
fontHeight = fontInfo.tmHeight;
- /* Minimum width for horizontal button */
+ // Minimum width for horizontal button
minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6);
- /* Maximum width of a dialog, if possible */
+ // Maximum width of a dialog, if possible
if (s_hwnd == NULL)
{
RECT workarea_rect;
- /* We don't have a window, use the desktop area. */
+ // We don't have a window, use the desktop area.
get_work_area(&workarea_rect);
maxDialogWidth = workarea_rect.right - workarea_rect.left - 100;
if (maxDialogWidth > 600)
maxDialogWidth = 600;
- /* Leave some room for the taskbar. */
+ // Leave some room for the taskbar.
maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150;
}
else
{
- /* Use our own window for the size, unless it's very small. */
+ // Use our own window for the size, unless it's very small.
GetWindowRect(s_hwnd, &rect);
maxDialogWidth = rect.right - rect.left
- (GetSystemMetrics(SM_CXFRAME) +
@@ -6917,20 +6920,20 @@ gui_mch_dialog(
maxDialogHeight = DLG_MIN_MAX_HEIGHT;
}
- /* Set dlgwidth to width of message.
- * Copy the message into "ga", changing NL to CR-NL and inserting line
- * breaks where needed. */
+ // Set dlgwidth to width of message.
+ // Copy the message into "ga", changing NL to CR-NL and inserting line
+ // breaks where needed.
pstart = message;
messageWidth = 0;
msgheight = 0;
ga_init2(&ga, sizeof(char), 500);
do
{
- msgheight += fontHeight; /* at least one line */
+ msgheight += fontHeight; // at least one line
- /* Need to figure out where to break the string. The system does it
- * at a word boundary, which would mean we can't compute the number of
- * wrapped lines. */
+ // Need to figure out where to break the string. The system does it
+ // at a word boundary, which would mean we can't compute the number of
+ // wrapped lines.
textWidth = 0;
last_white = NULL;
for (pend = pstart; *pend != NUL && *pend != '\n'; )
@@ -6942,14 +6945,14 @@ gui_mch_dialog(
textWidth += GetTextWidthEnc(hdc, pend, l);
if (textWidth >= maxDialogWidth)
{
- /* Line will wrap. */
+ // Line will wrap.
messageWidth = maxDialogWidth;
msgheight += fontHeight;
textWidth = 0;
if (last_white != NULL)
{
- /* break the line just after a space */
+ // break the line just after a space
ga.ga_len -= (int)(pend - (last_white + 1));
pend = last_white + 1;
last_white = NULL;
@@ -6973,9 +6976,9 @@ gui_mch_dialog(
if (ga.ga_data != NULL)
message = ga.ga_data;
- messageWidth += 10; /* roundoff space */
+ messageWidth += 10; // roundoff space
- /* Add width of icon to dlgwidth, and some space */
+ // Add width of icon to dlgwidth, and some space
dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX
+ GetSystemMetrics(SM_CXVSCROLL);
@@ -7001,10 +7004,10 @@ gui_mch_dialog(
textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
if (textWidth < minButtonWidth)
textWidth = minButtonWidth;
- textWidth += dlgPaddingX; /* Padding within button */
+ textWidth += dlgPaddingX; // Padding within button
buttonWidths[i] = textWidth;
buttonPositions[i++] = horizWidth;
- horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */
+ horizWidth += textWidth + dlgPaddingX; // Pad between buttons
pstart = pend + 1;
} while (*pend != NUL);
@@ -7024,8 +7027,8 @@ gui_mch_dialog(
if (pend == NULL)
pend = pstart + STRLEN(pstart); // Last button name.
textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
- textWidth += dlgPaddingX; /* Padding within button */
- textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */
+ textWidth += dlgPaddingX; // Padding within button
+ textWidth += DLG_VERT_PADDING_X * 2; // Padding around button
if (textWidth > dlgwidth)
dlgwidth = textWidth;
pstart = pend + 1;
@@ -7033,9 +7036,9 @@ gui_mch_dialog(
}
if (dlgwidth < DLG_MIN_WIDTH)
- dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/
+ dlgwidth = DLG_MIN_WIDTH; // Don't allow a really thin dialog!
- /* start to fill in the dlgtemplate information. addressing by WORDs */
+ // start to fill in the dlgtemplate information. addressing by WORDs
if (s_usenewlook)
lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT;
else
@@ -7043,7 +7046,7 @@ gui_mch_dialog(
add_long(lStyle);
add_long(0); // (lExtendedStyle)
- pnumitems = p; /*save where the number of items must be stored*/
+ pnumitems = p; //save where the number of items must be stored
add_word(0); // NumberOfItems(will change later)
add_word(10); // x
add_word(10); // y
@@ -7061,13 +7064,13 @@ gui_mch_dialog(
if (textfield != NULL)
dlgheight += editboxheight;
- /* Restrict the size to a maximum. Causes a scrollbar to show up. */
+ // Restrict the size to a maximum. Causes a scrollbar to show up.
if (dlgheight > maxDialogHeight)
{
msgheight = msgheight - (dlgheight - maxDialogHeight);
dlgheight = maxDialogHeight;
scroll_flag = WS_VSCROLL;
- /* Make sure scrollbar doesn't appear in the middle of the dialog */
+ // Make sure scrollbar doesn't appear in the middle of the dialog
messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX;
}
@@ -7076,18 +7079,18 @@ gui_mch_dialog(
add_word(0); // Menu
add_word(0); // Class
- /* copy the title of the dialog */
+ // copy the title of the dialog
nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
p += nchar;
if (s_usenewlook)
{
- /* do the font, since DS_3DLOOK doesn't work properly */
+ // do the font, since DS_3DLOOK doesn't work properly
# ifdef USE_SYSMENU_FONT
if (use_lfSysmenu)
{
- /* point size */
+ // point size
*p++ = -MulDiv(lfSysmenu.lfHeight, 72,
GetDeviceCaps(hdc, LOGPIXELSY));
wcscpy(p, lfSysmenu.lfFaceName);
@@ -7109,10 +7112,10 @@ gui_mch_dialog(
pstart = tbuffer;
if (!vertical)
- horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */
+ horizWidth = (dlgwidth - horizWidth) / 2; // Now it's X offset
for (i = 0; i < numButtons; i++)
{
- /* get end of this button. */
+ // get end of this button.
for ( pend = pstart;
*pend && (*pend != DLG_BUTTON_SEP);
pend++)
@@ -7140,7 +7143,7 @@ gui_mch_dialog(
(i == dfltbutton
? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP,
PixelToDialogX(DLG_VERT_PADDING_X),
- PixelToDialogY(buttonYpos /* TBK */
+ PixelToDialogY(buttonYpos // TBK
+ 2 * fontHeight * i),
PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X),
(WORD)(PixelToDialogY(2 * fontHeight) - 1),
@@ -7152,16 +7155,16 @@ gui_mch_dialog(
(i == dfltbutton
? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP,
PixelToDialogX(horizWidth + buttonPositions[i]),
- PixelToDialogY(buttonYpos), /* TBK */
+ PixelToDialogY(buttonYpos), // TBK
PixelToDialogX(buttonWidths[i]),
(WORD)(PixelToDialogY(2 * fontHeight) - 1),
(WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart);
}
- pstart = pend + 1; /*next button*/
+ pstart = pend + 1; //next button
}
*pnumitems += numButtons;
- /* Vim icon */
+ // Vim icon
p = add_dialog_element(p, SS_ICON,
PixelToDialogX(dlgPaddingX),
PixelToDialogY(dlgPaddingY),
@@ -7170,7 +7173,7 @@ gui_mch_dialog(
DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082,
dlg_icons[type]);
- /* Dialog message */
+ // Dialog message
p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY,
PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH),
PixelToDialogY(dlgPaddingY),
@@ -7178,7 +7181,7 @@ gui_mch_dialog(
PixelToDialogY(msgheight),
DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message);
- /* Edit box */
+ // Edit box
if (textfield != NULL)
{
p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER,
@@ -7196,11 +7199,10 @@ gui_mch_dialog(
DeleteObject(font);
ReleaseDC(hwnd, hdc);
- /* Let the dialog_callback() function know which button to make default
- * If we have an edit box, make that the default. We also need to tell
- * dialog_callback() if this dialog contains an edit box or not. We do
- * this by setting s_textfield if it does.
- */
+ // Let the dialog_callback() function know which button to make default
+ // If we have an edit box, make that the default. We also need to tell
+ // dialog_callback() if this dialog contains an edit box or not. We do
+ // this by setting s_textfield if it does.
if (textfield != NULL)
{
dialog_default_button = DLG_NONBUTTON_CONTROL + 2;
@@ -7212,7 +7214,7 @@ gui_mch_dialog(
s_textfield = NULL;
}
- /* show the dialog box modally and get a return value */
+ // show the dialog box modally and get a return value
nchar = (int)DialogBoxIndirect(
g_hinst,
(LPDLGTEMPLATE)pdlgtemplate,
@@ -7225,13 +7227,13 @@ gui_mch_dialog(
vim_free(buttonPositions);
vim_free(ga.ga_data);
- /* Focus back to our window (for when MDI is used). */
+ // Focus back to our window (for when MDI is used).
(void)SetFocus(s_hwnd);
return nchar;
}
-#endif /* FEAT_GUI_DIALOG */
+#endif // FEAT_GUI_DIALOG
/*
* Put a simple element (basic class) onto a dialog template in memory.
@@ -7263,7 +7265,7 @@ add_dialog_element(
{
int nchar;
- p = lpwAlign(p); /* Align to dword boundary*/
+ p = lpwAlign(p); // Align to dword boundary
lStyle = lStyle | WS_VISIBLE | WS_CHILD;
*p++ = LOWORD(lStyle);
*p++ = HIWORD(lStyle);
@@ -7319,13 +7321,13 @@ nCopyAnsiToWideChar(
BOOL use_enc)
{
int nChar = 0;
- int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */
+ int len = lstrlen(lpAnsiIn) + 1; // include NUL character
int i;
WCHAR *wn;
if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
- /* Not a codepage, use our own conversion function. */
+ // Not a codepage, use our own conversion function.
wn = enc_to_utf16((char_u *)lpAnsiIn, NULL);
if (wn != NULL)
{
@@ -7335,14 +7337,14 @@ nCopyAnsiToWideChar(
}
}
if (nChar == 0)
- /* Use Win32 conversion function. */
+ // Use Win32 conversion function.
nChar = MultiByteToWideChar(
enc_codepage > 0 ? enc_codepage : CP_ACP,
MB_PRECOMPOSED,
lpAnsiIn, len,
lpWCStr, len);
for (i = 0; i < nChar; ++i)
- if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */
+ if (lpWCStr[i] == (WORD)'\t') // replace tabs with spaces
lpWCStr[i] = (WORD)' ';
return nChar;
@@ -7360,7 +7362,7 @@ tearoff_lookup_menuhandle(
{
for ( ; menu != NULL; menu = menu->next)
{
- if (menu->modes == 0) /* this menu has just been deleted */
+ if (menu->modes == 0) // this menu has just been deleted
continue;
if (menu_is_separator(menu->dname))
continue;
@@ -7388,7 +7390,7 @@ tearoff_callback(
return (TRUE);
}
- /* May show the mouse pointer again. */
+ // May show the mouse pointer again.
HandleMouseHide(message, lParam);
if (message == WM_COMMAND)
@@ -7408,7 +7410,7 @@ tearoff_callback(
TPM_LEFTALIGN | TPM_LEFTBUTTON,
(int)rect.right - 8,
(int)mp.y,
- (int)0, /*reserved param*/
+ (int)0, // reserved param
s_hwnd,
NULL);
/*
@@ -7418,7 +7420,7 @@ tearoff_callback(
}
}
else
- /* Pass on messages to the main Vim window */
+ // Pass on messages to the main Vim window
PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0);
/*
* Give main window the focus back: this is so after
@@ -7434,7 +7436,7 @@ tearoff_callback(
return TRUE;
}
- /* When moved around, give main window the focus back. */
+ // When moved around, give main window the focus back.
if (message == WM_EXITSIZEMOVE)
(void)SetActiveWindow(s_hwnd);
@@ -7490,7 +7492,7 @@ get_dialog_font_metrics(void)
if (!s_usenewlook)
{
- dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/
+ dlgFontSize = GetDialogBaseUnits(); // fall back to big old system
s_dlgfntwidth = LOWORD(dlgFontSize);
s_dlgfntheight = HIWORD(dlgFontSize);
}
@@ -7555,8 +7557,8 @@ gui_mch_tearoff(
if (*title == MNU_HIDDEN_CHAR)
title++;
- /* Allocate memory to store the dialog template. It's made bigger when
- * needed. */
+ // Allocate memory to store the dialog template. It's made bigger when
+ // needed.
template_len = DLG_ALLOC_SIZE;
pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len);
if (p == NULL)
@@ -7579,19 +7581,19 @@ gui_mch_tearoff(
else
oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT));
- /* Calculate width of a single space. Used for padding columns to the
- * right width. */
+ // Calculate width of a single space. Used for padding columns to the
+ // right width.
spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1);
- /* Figure out max width of the text column, the accelerator column and the
- * optional submenu column. */
+ // Figure out max width of the text column, the accelerator column and the
+ // optional submenu column.
submenuWidth = 0;
for (col = 0; col < 2; col++)
{
columnWidths[col] = 0;
for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next)
{
- /* Use "dname" here to compute the width of the visible text. */
+ // Use "dname" here to compute the width of the visible text.
text = (col == 0) ? pmenu->dname : pmenu->actext;
if (text != NULL && *text != NUL)
{
@@ -7605,7 +7607,7 @@ gui_mch_tearoff(
}
if (columnWidths[1] == 0)
{
- /* no accelerators */
+ // no accelerators
if (submenuWidth != 0)
columnWidths[0] += submenuWidth;
else
@@ -7613,7 +7615,7 @@ gui_mch_tearoff(
}
else
{
- /* there is an accelerator column */
+ // there is an accelerator column
columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth;
columnWidths[1] += submenuWidth;
}
@@ -7633,7 +7635,7 @@ gui_mch_tearoff(
dlgwidth = textWidth;
dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X;
- /* start to fill in the dlgtemplate information. addressing by WORDs */
+ // start to fill in the dlgtemplate information. addressing by WORDs
if (s_usenewlook)
lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE;
else
@@ -7644,7 +7646,7 @@ gui_mch_tearoff(
*p++ = HIWORD(lStyle);
*p++ = LOWORD(lExtendedStyle);
*p++ = HIWORD(lExtendedStyle);
- pnumitems = p; /* save where the number of items must be stored */
+ pnumitems = p; // save where the number of items must be stored
*p++ = 0; // NumberOfItems(will change later)
gui_mch_getmouse(&x, &y);
if (initX == 0xffffL)
@@ -7661,7 +7663,7 @@ gui_mch_tearoff(
*p++ = 0; // Menu
*p++ = 0; // Class
- /* copy the title of the dialog */
+ // copy the title of the dialog
nchar = nCopyAnsiToWideChar(p, ((*title)
? (LPSTR)title
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
@@ -7669,11 +7671,11 @@ gui_mch_tearoff(
if (s_usenewlook)
{
- /* do the font, since DS_3DLOOK doesn't work properly */
+ // do the font, since DS_3DLOOK doesn't work properly
# ifdef USE_SYSMENU_FONT
if (use_lfSysmenu)
{
- /* point size */
+ // point size
*p++ = -MulDiv(lfSysmenu.lfHeight, 72,
GetDeviceCaps(hdc, LOGPIXELSY));
wcscpy(p, lfSysmenu.lfFaceName);
@@ -7699,7 +7701,7 @@ gui_mch_tearoff(
top_menu = menu;
for ( ; menu != NULL; menu = menu->next)
{
- if (menu->modes == 0) /* this menu has just been deleted */
+ if (menu->modes == 0) // this menu has just been deleted
continue;
if (menu_is_separator(menu->dname))
{
@@ -7707,8 +7709,8 @@ gui_mch_tearoff(
continue;
}
- /* Check if there still is plenty of room in the template. Make it
- * larger when needed. */
+ // Check if there still is plenty of room in the template. Make it
+ // larger when needed.
if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len)
{
WORD *newp;
@@ -7727,9 +7729,9 @@ gui_mch_tearoff(
}
}
- /* Figure out minimal length of this menu label. Use "name" for the
- * actual text, "dname" for estimating the displayed size. "name"
- * has "&a" for mnemonic and includes the accelerator. */
+ // Figure out minimal length of this menu label. Use "name" for the
+ // actual text, "dname" for estimating the displayed size. "name"
+ // has "&a" for mnemonic and includes the accelerator.
len = nameLen = (int)STRLEN(menu->name);
padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname,
(int)STRLEN(menu->dname))) / spaceWidth;
@@ -7758,15 +7760,15 @@ gui_mch_tearoff(
menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000);
}
- /* Allocate menu label and fill it in */
+ // Allocate menu label and fill it in
text = label = alloc(len + 1);
if (label == NULL)
break;
vim_strncpy(text, menu->name, nameLen);
- text = vim_strchr(text, TAB); /* stop at TAB before actext */
+ text = vim_strchr(text, TAB); // stop at TAB before actext
if (text == NULL)
- text = label + nameLen; /* no actext, use whole name */
+ text = label + nameLen; // no actext, use whole name
while (padding0-- > 0)
*text++ = ' ';
if (menu->actext != NULL)
@@ -7806,7 +7808,7 @@ gui_mch_tearoff(
*ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems));
- /* show modelessly */
+ // show modelessly
the_menu->tearoff_handle = CreateDialogIndirectParam(
g_hinst,
(LPDLGTEMPLATE)pdlgtemplate,
@@ -7826,7 +7828,7 @@ gui_mch_tearoff(
*/
(void)SetActiveWindow(s_hwnd);
- /* make sure the right buttons are enabled */
+ // make sure the right buttons are enabled
force_menu_update = TRUE;
}
#endif
@@ -7834,7 +7836,7 @@ gui_mch_tearoff(
#if defined(FEAT_TOOLBAR) || defined(PROTO)
# include "gui_w32_rc.h"
-/* This not defined in older SDKs */
+// This not defined in older SDKs
# ifndef TBSTYLE_FLAT
# define TBSTYLE_FLAT 0x0800
# endif
@@ -7941,7 +7943,7 @@ get_toolbar_bitmap(vimmenu_T *menu)
i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP,
(WPARAM)1, (LPARAM)&tbAddBitmap);
- /* i will be set to -1 if it fails */
+ // i will be set to -1 if it fails
}
}
if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT)
@@ -7984,7 +7986,7 @@ GetTabFromPoint(
{
TCHITTESTINFO htinfo;
htinfo.pt = pt;
- /* ignore if a window under cusor is not tabcontrol. */
+ // ignore if a window under cusor is not tabcontrol.
if (s_tabhwnd == hWnd)
{
int idx = TabCtrl_HitTest(s_tabhwnd, &htinfo);
@@ -8021,7 +8023,7 @@ tabline_wndproc(
s_pt.x = GET_X_LPARAM(lParam);
s_pt.y = GET_Y_LPARAM(lParam);
SetCapture(hwnd);
- s_hCursor = GetCursor(); /* backup default cursor */
+ s_hCursor = GetCursor(); // backup default cursor
break;
}
case WM_MOUSEMOVE:
@@ -8043,8 +8045,8 @@ tabline_wndproc(
TabCtrl_GetItemRect(hwnd, idx1, &rect);
nCenter = rect.left + (rect.right - rect.left) / 2;
- /* Check if the mouse cursor goes over the center of
- * the next tab to prevent "flickering". */
+ // Check if the mouse cursor goes over the center of
+ // the next tab to prevent "flickering".
if ((idx0 < idx1) && (nCenter < pt.x))
{
tabpage_move(idx1 + 1);
@@ -8157,7 +8159,7 @@ typedef struct _signicon_t
HANDLE hImage;
UINT uType;
# ifdef FEAT_XPM_W32
- HANDLE hShape; /* Mask bitmap handle */
+ HANDLE hShape; // Mask bitmap handle
# endif
} signicon_t;
@@ -8205,11 +8207,11 @@ gui_mch_drawsign(int row, int col, int typenr)
hdcMem = CreateCompatibleDC(s_hdc);
hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape);
- /* Make hole */
+ // Make hole
BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND);
SelectObject(hdcMem, sign->hImage);
- /* Paint sign */
+ // Paint sign
BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT);
SelectObject(hdcMem, hbmpOld);
DeleteDC(hdcMem);
@@ -8250,7 +8252,7 @@ gui_mch_register_sign(char_u *signfile)
char_u *ext;
sign.hImage = NULL;
- ext = signfile + STRLEN(signfile) - 4; /* get extension */
+ ext = signfile + STRLEN(signfile) - 4; // get extension
if (ext > signfile)
{
int do_load = 1;
@@ -8305,7 +8307,8 @@ gui_mch_destroy_sign(void *sign)
#if defined(FEAT_BEVAL_GUI) || defined(PROTO)
-/* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS.
+/*
+ * BALLOON-EVAL IMPLEMENTATION FOR WINDOWS.
* Added by Sergey Khorev <sergey.khorev@gmail.com>
*
* The only reused thing is beval.h and get_beval_info()
@@ -8366,8 +8369,8 @@ multiline_balloon_available(void)
}
else
{
- /* there is chance we have ancient CommCtl 4.70
- which doesn't export DllGetVersion */
+ // there is chance we have ancient CommCtl 4.70
+ // which doesn't export DllGetVersion
DWORD dwHandle = 0;
DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle);
if (len > 0)
@@ -8500,8 +8503,8 @@ BevalTimerProc(
|| abs(cur_beval->x - pt.x) > 3
|| abs(cur_beval->y - pt.y) > 3))
{
- /* Pointer resting in one place long enough, it's time to show
- * the tooltip. */
+ // Pointer resting in one place long enough, it's time to show
+ // the tooltip.
cur_beval->showState = ShS_PENDING;
cur_beval->x = pt.x;
cur_beval->y = pt.y;
@@ -8554,7 +8557,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3)
{
- /* cursor is still here */
+ // cursor is still here
gui_mch_disable_beval_area(cur_beval);
beval->showState = ShS_SHOWING;
make_tooltip(beval, (char *)mesg, pt);
@@ -8564,12 +8567,12 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
BalloonEval *
gui_mch_create_beval_area(
- void *target UNUSED, /* ignored, always use s_textArea */
+ void *target UNUSED, // ignored, always use s_textArea
char_u *mesg,
void (*mesgCB)(BalloonEval *, int),
void *clientData)
{
- /* partially stolen from gui_beval.c */
+ // partially stolen from gui_beval.c
BalloonEval *beval;
if (mesg != NULL && mesgCB != NULL)
@@ -8600,7 +8603,7 @@ gui_mch_create_beval_area(
static void
Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
{
- if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */
+ if (pnmh->idFrom != ID_BEVAL_TOOLTIP) // it is not our tooltip
return;
if (cur_beval != NULL)
@@ -8611,7 +8614,7 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
// TRACE0("TTN_SHOW {{{");
// TRACE0("TTN_SHOW }}}");
break;
- case TTN_POP: /* Before tooltip disappear */
+ case TTN_POP: // Before tooltip disappear
// TRACE0("TTN_POP {{{");
delete_tooltip(cur_beval);
gui_mch_enable_beval_area(cur_beval);
@@ -8621,7 +8624,7 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
break;
case TTN_GETDISPINFO:
{
- /* if you get there then we have new common controls */
+ // if you get there then we have new common controls
NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh;
info->lpszText = (LPSTR)info->lParam;
info->uFlags |= TTF_DI_SETITEM;
@@ -8656,7 +8659,7 @@ gui_mch_destroy_beval_area(BalloonEval *beval)
vim_free(beval->tofree);
vim_free(beval);
}
-#endif /* FEAT_BEVAL_GUI */
+#endif // FEAT_BEVAL_GUI
#if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
/*
diff --git a/src/gui_x11.c b/src/gui_x11.c
index 40f53d6f7..ce619f654 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -57,7 +57,7 @@
#define VIM_NAME "vim"
#define VIM_CLASS "Vim"
-/* Default resource values */
+// Default resource values
#define DFLT_FONT "7x13"
#ifdef FONTSET_ALWAYS
# define DFLT_MENU_FONT XtDefaultFontSet
@@ -74,7 +74,7 @@
# define DFLT_TOOLTIP_BG_COLOR "#ffff91"
# define DFLT_TOOLTIP_FG_COLOR "#000000"
#else
-/* use the default (CDE) colors */
+// use the default (CDE) colors
# define DFLT_MENU_BG_COLOR ""
# define DFLT_MENU_FG_COLOR ""
# define DFLT_SCROLL_BG_COLOR ""
@@ -85,9 +85,9 @@
Widget vimShell = (Widget)0;
-static Atom wm_atoms[2]; /* Window Manager Atoms */
-#define DELETE_WINDOW_IDX 0 /* index in wm_atoms[] for WM_DELETE_WINDOW */
-#define SAVE_YOURSELF_IDX 1 /* index in wm_atoms[] for WM_SAVE_YOURSELF */
+static Atom wm_atoms[2]; // Window Manager Atoms
+#define DELETE_WINDOW_IDX 0 // index in wm_atoms[] for WM_DELETE_WINDOW
+#define SAVE_YOURSELF_IDX 1 // index in wm_atoms[] for WM_SAVE_YOURSELF
#ifdef FEAT_XFONTSET
/*
@@ -198,7 +198,7 @@ static struct specialkey
{XK_F32, 'F', 'M'},
{XK_F33, 'F', 'N'},
{XK_F34, 'F', 'O'},
- {XK_F35, 'F', 'P'}, /* keysymdef.h defines up to F35 */
+ {XK_F35, 'F', 'P'}, // keysymdef.h defines up to F35
#ifdef SunXK_F36
{SunXK_F36, 'F', 'Q'},
{SunXK_F37, 'F', 'R'},
@@ -215,7 +215,7 @@ static struct specialkey
{XK_Next, 'k', 'N'},
{XK_Print, '%', '9'},
- /* Keypad keys: */
+ // Keypad keys:
#ifdef XK_KP_Left
{XK_KP_Left, 'k', 'l'},
{XK_KP_Right, 'k', 'r'},
@@ -247,7 +247,7 @@ static struct specialkey
{XK_KP_9, 'K', 'L'},
#endif
- /* End of list marker: */
+ // End of list marker:
{(KeySym)0, 0, 0}
};
@@ -267,19 +267,19 @@ static struct specialkey
#define XtCMenuFontSet "MenuFontSet"
-/* Resources for setting the foreground and background colors of menus */
+// Resources for setting the foreground and background colors of menus
#define XtNmenuBackground "menuBackground"
#define XtCMenuBackground "MenuBackground"
#define XtNmenuForeground "menuForeground"
#define XtCMenuForeground "MenuForeground"
-/* Resources for setting the foreground and background colors of scrollbars */
+// Resources for setting the foreground and background colors of scrollbars
#define XtNscrollBackground "scrollBackground"
#define XtCScrollBackground "ScrollBackground"
#define XtNscrollForeground "scrollForeground"
#define XtCScrollForeground "ScrollForeground"
-/* Resources for setting the foreground and background colors of tooltip */
+// Resources for setting the foreground and background colors of tooltip
#define XtNtooltipBackground "tooltipBackground"
#define XtCTooltipBackground "TooltipBackground"
#define XtNtooltipForeground "tooltipForeground"
@@ -383,7 +383,7 @@ static XtResource vim_resources[] =
(XtPointer)SB_DEFAULT_WIDTH
},
#ifdef FEAT_MENU
-# ifdef FEAT_GUI_ATHENA /* with Motif the height is always computed */
+# ifdef FEAT_GUI_ATHENA // with Motif the height is always computed
{
XtNmenuHeight,
XtCMenuHeight,
@@ -391,7 +391,7 @@ static XtResource vim_resources[] =
sizeof(int),
XtOffsetOf(gui_T, menu_height),
XtRImmediate,
- (XtPointer)MENU_DEFAULT_HEIGHT /* Should figure out at run time */
+ (XtPointer)MENU_DEFAULT_HEIGHT // Should figure out at run time
},
# endif
{
@@ -473,7 +473,7 @@ static XtResource vim_resources[] =
XtRString,
DFLT_TOOLTIP_FONT
},
- /* This one may not be really needed? */
+ // This one may not be really needed?
{
"balloonEvalFontSet",
XtCFontSet,
@@ -483,7 +483,7 @@ static XtResource vim_resources[] =
XtRImmediate,
(XtPointer)NOFONTSET
},
-#endif /* FEAT_BEVAL_GUI */
+#endif // FEAT_BEVAL_GUI
#ifdef FEAT_XIM
{
"preeditType",
@@ -503,7 +503,7 @@ static XtResource vim_resources[] =
XtRString,
NULL
},
-#endif /* FEAT_XIM */
+#endif // FEAT_XIM
};
/*
@@ -514,7 +514,7 @@ static XtResource vim_resources[] =
*/
static XrmOptionDescRec cmdline_options[] =
{
- /* We handle these options ourselves */
+ // We handle these options ourselves
{"-bg", ".background", XrmoptionSepArg, NULL},
{"-background", ".background", XrmoptionSepArg, NULL},
{"-fg", ".foreground", XrmoptionSepArg, NULL},
@@ -572,12 +572,12 @@ channel_poll_cb(
{
XtIntervalId *channel_timer = (XtIntervalId *)client_data;
- /* Using an event handler for a channel that may be disconnected does
- * not work, it hangs. Instead poll for messages. */
+ // Using an event handler for a channel that may be disconnected does
+ // not work, it hangs. Instead poll for messages.
channel_handle_events(TRUE);
parse_queued_messages();
- /* repeat */
+ // repeat
*channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
channel_poll_cb, client_data);
}
@@ -602,7 +602,7 @@ gui_x11_visibility_cb(
XSetGraphicsExposures(gui.dpy, gui.text_gc,
gui.visibility != VisibilityUnobscured);
- /* This is needed for when redrawing is slow. */
+ // This is needed for when redrawing is slow.
gui_mch_update();
}
@@ -619,14 +619,14 @@ gui_x11_expose_cb(
if (event->type != Expose)
return;
- out_flush(); /* make sure all output has been processed */
+ out_flush(); // make sure all output has been processed
gevent = (XExposeEvent *)event;
gui_redraw(gevent->x, gevent->y, gevent->width, gevent->height);
new_x = FILL_X(0);
- /* Clear the border areas if needed */
+ // Clear the border areas if needed
if (gevent->x < new_x)
XClearArea(gui.dpy, gui.wid, 0, 0, new_x, 0, False);
if (gevent->y < FILL_Y(0))
@@ -636,7 +636,7 @@ gui_x11_expose_cb(
if (gevent->y > FILL_Y(Rows))
XClearArea(gui.dpy, gui.wid, 0, FILL_Y((int)Rows), 0, 0, False);
- /* This is needed for when redrawing is slow. */
+ // This is needed for when redrawing is slow.
gui_mch_update();
}
@@ -783,8 +783,8 @@ gui_x11_key_hit_cb(
if (xic)
{
# ifdef USE_UTF8LOOKUP
- /* XFree86 4.0.2 or newer: Be able to get UTF-8 characters even when
- * the locale isn't utf-8. */
+ // XFree86 4.0.2 or newer: Be able to get UTF-8 characters even when
+ // the locale isn't utf-8.
if (enc_utf8)
len = Xutf8LookupString(xic, ev_press, (char *)string,
sizeof(string_shortbuf), &key_sym, &status);
@@ -797,8 +797,8 @@ gui_x11_key_hit_cb(
string = (char_u *)XtMalloc(len + 1);
string_alloced = True;
# ifdef USE_UTF8LOOKUP
- /* XFree86 4.0.2 or newer: Be able to get UTF-8 characters even
- * when the locale isn't utf-8. */
+ // XFree86 4.0.2 or newer: Be able to get UTF-8 characters even
+ // when the locale isn't utf-8.
if (enc_utf8)
len = Xutf8LookupString(xic, ev_press, (char *)string,
len, &key_sym, &status);
@@ -810,15 +810,15 @@ gui_x11_key_hit_cb(
if (status == XLookupNone || status == XLookupChars)
key_sym = XK_VoidSymbol;
- /* Do conversion from 'termencoding' to 'encoding'. When using
- * Xutf8LookupString() it has already been done. */
+ // Do conversion from 'termencoding' to 'encoding'. When using
+ // Xutf8LookupString() it has already been done.
if (len > 0 && input_conv.vc_type != CONV_NONE
# ifdef USE_UTF8LOOKUP
&& !enc_utf8
# endif
)
{
- int maxlen = len * 4 + 40; /* guessed */
+ int maxlen = len * 4 + 40; // guessed
char_u *p = (char_u *)XtMalloc(maxlen);
mch_memmove(p, string, len);
@@ -829,8 +829,8 @@ gui_x11_key_hit_cb(
len = convert_input(p, len, maxlen);
}
- /* Translate CSI to K_CSI, otherwise it could be recognized as the
- * start of a special key. */
+ // Translate CSI to K_CSI, otherwise it could be recognized as the
+ // start of a special key.
for (i = 0; i < len; ++i)
if (string[i] == CSI)
{
@@ -864,7 +864,7 @@ gui_x11_key_hit_cb(
#endif
if (key_sym == XK_space)
- string[0] = ' '; /* Otherwise Ctrl-Space doesn't work */
+ string[0] = ' '; // Otherwise Ctrl-Space doesn't work
/*
* Only on some machines ^_ requires Ctrl+Shift+minus. For consistency,
@@ -874,7 +874,7 @@ gui_x11_key_hit_cb(
string[0] = Ctrl__;
#ifdef XK_ISO_Left_Tab
- /* why do we get XK_ISO_Left_Tab instead of XK_Tab for shift-tab? */
+ // why do we get XK_ISO_Left_Tab instead of XK_Tab for shift-tab?
if (key_sym == XK_ISO_Left_Tab)
{
key_sym = XK_Tab;
@@ -883,10 +883,10 @@ gui_x11_key_hit_cb(
}
#endif
- /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
- * that already has the 8th bit set. And not when using a double-byte
- * encoding, setting the 8th bit may make it the lead byte of a
- * double-byte character. */
+ // Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
+ // that already has the 8th bit set. And not when using a double-byte
+ // encoding, setting the 8th bit may make it the lead byte of a
+ // double-byte character.
if (len == 1
&& (ev_press->state & Mod1Mask)
&& !(key_sym == XK_BackSpace || key_sym == XK_Delete)
@@ -894,7 +894,7 @@ gui_x11_key_hit_cb(
&& !enc_dbcs)
{
#if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF)
- /* Ignore ALT keys when they are used for the menu only */
+ // Ignore ALT keys when they are used for the menu only
if (gui.menu_is_active
&& (p_wak[0] == 'y'
|| (p_wak[0] == 'm' && gui_is_menu_shortcut(string[0]))))
@@ -911,13 +911,13 @@ gui_x11_key_hit_cb(
len2 = XLookupString(ev_press, (char *)string2, sizeof(string2),
&key_sym2, NULL);
if (key_sym2 == XK_space)
- string2[0] = ' '; /* Otherwise Meta-Ctrl-Space doesn't work */
+ string2[0] = ' '; // Otherwise Meta-Ctrl-Space doesn't work
if ( len2 == 1
&& string[0] == string2[0]
&& !(key_sym == XK_Tab && (ev_press->state & ShiftMask)))
{
string[0] |= 0x80;
- if (enc_utf8) /* convert to utf-8 */
+ if (enc_utf8) // convert to utf-8
{
string[1] = string[0] & 0xbf;
string[0] = ((unsigned)string[0] >> 6) + 0xc0;
@@ -942,8 +942,8 @@ gui_x11_key_hit_cb(
len = -3;
}
- /* Check for special keys. Also do this when len == 1 (key has an ASCII
- * value) to detect backspace, delete and keypad keys. */
+ // Check for special keys. Also do this when len == 1 (key has an ASCII
+ // value) to detect backspace, delete and keypad keys.
if (len == 0 || len == 1)
{
for (i = 0; special_keys[i].key_sym != (KeySym)0; i++)
@@ -959,12 +959,12 @@ gui_x11_key_hit_cb(
}
}
- /* Unrecognised key is ignored. */
+ // Unrecognised key is ignored.
if (len == 0)
goto theend;
- /* Special keys (and a few others) may have modifiers. Also when using a
- * double-byte encoding (can't set the 8th bit). */
+ // Special keys (and a few others) may have modifiers. Also when using a
+ // double-byte encoding (can't set the 8th bit).
if (len == -3 || key_sym == XK_space || key_sym == XK_Tab
|| key_sym == XK_Return || key_sym == XK_Linefeed
|| key_sym == XK_Escape
@@ -1040,7 +1040,7 @@ gui_x11_key_hit_cb(
}
#endif
theend:
- {} /* some compilers need a statement here */
+ {} // some compilers need a statement here
#ifdef FEAT_XIM
if (string_alloced)
XtFree((char *)string);
@@ -1065,7 +1065,7 @@ gui_x11_mouse_cb(
if (event->type == MotionNotify)
{
- /* Get the latest position, avoids lagging behind on a drag. */
+ // Get the latest position, avoids lagging behind on a drag.
x = event->xmotion.x;
y = event->xmotion.y;
x_modifiers = event->xmotion.state;
@@ -1077,10 +1077,10 @@ gui_x11_mouse_cb(
*/
gui_mch_mousehide(FALSE);
- if (button != MOUSE_DRAG) /* just moving the rodent */
+ if (button != MOUSE_DRAG) // just moving the rodent
{
#ifdef FEAT_MENU
- if (dud) /* moved in vimForm */
+ if (dud) // moved in vimForm
y -= gui.menu_height;
#endif
gui_mouse_moved(x, y);
@@ -1093,7 +1093,7 @@ gui_x11_mouse_cb(
y = event->xbutton.y;
if (event->type == ButtonPress)
{
- /* Handle multiple clicks */
+ // Handle multiple clicks
if (!timed_out)
{
XtRemoveTimeOut(timer);
@@ -1104,7 +1104,7 @@ gui_x11_mouse_cb(
gui_x11_timer_cb, &timed_out);
switch (event->xbutton.button)
{
- /* keep in sync with gui_gtk_x11.c */
+ // keep in sync with gui_gtk_x11.c
case Button1: button = MOUSE_LEFT; break;
case Button2: button = MOUSE_MIDDLE; break;
case Button3: button = MOUSE_RIGHT; break;
@@ -1115,13 +1115,13 @@ gui_x11_mouse_cb(
case 8: button = MOUSE_X1; break;
case 9: button = MOUSE_X2; break;
default:
- return; /* Unknown button */
+ return; // Unknown button
}
}
else if (event->type == ButtonRelease)
button = MOUSE_RELEASE;
else
- return; /* Unknown mouse event type */
+ return; // Unknown mouse event type
x_modifiers = event->xbutton.state;
#if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
@@ -1134,7 +1134,7 @@ gui_x11_mouse_cb(
vim_modifiers |= MOUSE_SHIFT;
if (x_modifiers & ControlMask)
vim_modifiers |= MOUSE_CTRL;
- if (x_modifiers & Mod1Mask) /* Alt or Meta key */
+ if (x_modifiers & Mod1Mask) // Alt or Meta key
vim_modifiers |= MOUSE_ALT;
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
@@ -1166,14 +1166,14 @@ gui_mch_prepare(int *argc, char **argv)
arg = 1;
while (arg < *argc)
{
- /* Look for argv[arg] in cmdline_options[] table */
+ // Look for argv[arg] in cmdline_options[] table
for (i = 0; i < (int)XtNumber(cmdline_options); i++)
if (strcmp(argv[arg], cmdline_options[i].option) == 0)
break;
if (i < (int)XtNumber(cmdline_options))
{
- /* Remember finding "-rv" or "-reverse" */
+ // Remember finding "-rv" or "-reverse"
if (strcmp("-rv", argv[arg]) == 0
|| strcmp("-reverse", argv[arg]) == 0)
found_reverse_arg = TRUE;
@@ -1182,7 +1182,7 @@ gui_mch_prepare(int *argc, char **argv)
&& arg + 1 < *argc)
font_argument = argv[arg + 1];
- /* Found match in table, so move it into gui_argv */
+ // Found match in table, so move it into gui_argv
gui_argv[gui_argc++] = argv[arg];
if (--*argc > arg)
{
@@ -1190,7 +1190,7 @@ gui_mch_prepare(int *argc, char **argv)
* sizeof(char *));
if (cmdline_options[i].argKind != XrmoptionNoArg)
{
- /* Move the options argument as well */
+ // Move the options argument as well
gui_argv[gui_argc++] = argv[arg];
if (--*argc > arg)
mch_memmove(&argv[arg], &argv[arg + 1], (*argc - arg)
@@ -1203,7 +1203,7 @@ gui_mch_prepare(int *argc, char **argv)
#ifdef FEAT_NETBEANS_INTG
if (strncmp("-nb", argv[arg], 3) == 0)
{
- gui.dofork = FALSE; /* don't fork() when starting GUI */
+ gui.dofork = FALSE; // don't fork() when starting GUI
netbeansArg = argv[arg];
mch_memmove(&argv[arg], &argv[arg + 1],
(--*argc - arg) * sizeof(char *));
@@ -1243,9 +1243,9 @@ gui_mch_init_check(void)
# if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
{
- /* The call to XtOpenDisplay() may have set the locale from the
- * environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a
- * decimal point, not a comma. */
+ // The call to XtOpenDisplay() may have set the locale from the
+ // environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a
+ // decimal point, not a comma.
char *p = setlocale(LC_NUMERIC, NULL);
if (p == NULL || strcmp(p, "C") != 0)
@@ -1293,7 +1293,7 @@ gui_mch_init(void)
unsigned w, h;
#if 0
- /* Uncomment this to enable synchronous mode for debugging */
+ // Uncomment this to enable synchronous mode for debugging
XSynchronize(gui.dpy, True);
#endif
@@ -1312,9 +1312,8 @@ gui_mch_init(void)
* Get the colors ourselves. Using the automatic conversion doesn't
* handle looking for approximate colors.
*/
- /* NOTE: These next few lines are an exact duplicate of gui_athena.c's
- * gui_mch_def_colors(). Why?
- */
+ // NOTE: These next few lines are an exact duplicate of gui_athena.c's
+ // gui_mch_def_colors(). Why?
gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
@@ -1325,16 +1324,16 @@ gui_mch_init(void)
#endif
#if defined(FEAT_MENU) && defined(FEAT_GUI_ATHENA)
- /* If the menu height was set, don't change it at runtime */
+ // If the menu height was set, don't change it at runtime
if (gui.menu_height != MENU_DEFAULT_HEIGHT)
gui.menu_height_fixed = TRUE;
#endif
- /* Set default foreground and background colours */
+ // Set default foreground and background colours
gui.norm_pixel = gui.def_norm_pixel;
gui.back_pixel = gui.def_back_pixel;
- /* Check if reverse video needs to be applied (on Sun it's done by X) */
+ // Check if reverse video needs to be applied (on Sun it's done by X)
if (gui.rsrc_rev_video && gui_get_lightness(gui.back_pixel)
> gui_get_lightness(gui.norm_pixel))
{
@@ -1344,8 +1343,8 @@ gui_mch_init(void)
gui.def_back_pixel = gui.back_pixel;
}
- /* Get the colors from the "Normal", "Tooltip", "Scrollbar" and "Menu"
- * group (set in syntax.c or in a vimrc file) */
+ // Get the colors from the "Normal", "Tooltip", "Scrollbar" and "Menu"
+ // group (set in syntax.c or in a vimrc file)
set_normal_colors();
/*
@@ -1377,8 +1376,8 @@ gui_mch_init(void)
if (gui_win_x != -1 && gui_win_y != -1)
gui_mch_set_winpos(gui_win_x, gui_win_y);
- /* Now adapt the supplied(?) geometry-settings */
- /* Added by Kjetil Jacobsen <kjetilja@stud.cs.uit.no> */
+ // Now adapt the supplied(?) geometry-settings
+ // Added by Kjetil Jacobsen <kjetilja@stud.cs.uit.no>
if (gui.geom != NULL && *gui.geom != NUL)
{
mask = XParseGeometry((char *)gui.geom, &x, &y, &w, &h);
@@ -1427,10 +1426,10 @@ gui_mch_init(void)
vim_mask_icon_height));
XtSetValues(vimShell, arg, (Cardinal)2);
#else
-/* Use Pixmaps, looking much nicer. */
+// Use Pixmaps, looking much nicer.
-/* If you get an error message here, you still need to unpack the runtime
- * archive! */
+// If you get an error message here, you still need to unpack the runtime
+// archive!
# ifdef magick
# undef magick
# endif
@@ -1481,7 +1480,7 @@ gui_mch_init(void)
attr.valuemask = 0L;
attr.valuemask = XpmCloseness | XpmReturnPixels | XpmColormap | XpmDepth;
- attr.closeness = 65535; /* accuracy isn't crucial */
+ attr.closeness = 65535; // accuracy isn't crucial
attr.colormap = cmap;
attr.depth = DefaultDepthOfScreen(scr);
@@ -1511,7 +1510,7 @@ gui_mch_init(void)
#endif
#ifdef USE_XSMP
- /* Attach listener on ICE connection */
+ // Attach listener on ICE connection
if (-1 != xsmp_icefd)
_xsmp_xtinputid = XtAppAddInput(app_context, xsmp_icefd,
(XtPointer)XtInputReadMask, local_xsmp_handle_requests, NULL);
@@ -1569,7 +1568,7 @@ gui_mch_new_colors(void)
int
gui_mch_open(void)
{
- /* Actually open the window */
+ // Actually open the window
XtRealizeWidget(vimShell);
XtManageChild(XtNameToWidget(vimShell, "*vimForm"));
@@ -1599,7 +1598,7 @@ gui_mch_open(void)
#ifdef FEAT_CLIENTSERVER
if (serverName == NULL && serverDelayedStartName != NULL)
{
- /* This is a :gui command in a plain vim with no previous server */
+ // This is a :gui command in a plain vim with no previous server
commWindow = XtWindow(vimShell);
(void)serverRegisterName(gui.dpy, serverDelayedStartName);
}
@@ -1618,7 +1617,7 @@ gui_mch_open(void)
#if defined(FEAT_MENU) && defined(FEAT_GUI_ATHENA)
- /* The Athena GUI needs this again after opening the window */
+ // The Athena GUI needs this again after opening the window
gui_position_menu();
# ifdef FEAT_TOOLBAR
gui_mch_set_toolbar_pos(0, gui.menu_height, gui.menu_width,
@@ -1626,9 +1625,9 @@ gui_mch_open(void)
# endif
#endif
- /* Get the colors for the highlight groups (gui_check_colors() might have
- * changed them) */
- highlight_gui_started(); /* re-init colors and fonts */
+ // Get the colors for the highlight groups (gui_check_colors() might have
+ // changed them)
+ highlight_gui_started(); // re-init colors and fonts
#ifdef FEAT_XIM
xim_init();
@@ -1653,13 +1652,13 @@ gui_init_tooltip_font(void)
if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False)
{
- /* Failed. What to do? */
+ // Failed. What to do?
}
}
#endif
#if defined(FEAT_MENU) || defined(PROTO)
-/* Convert the menu font/fontset name to an XFontStruct/XFontset */
+// Convert the menu font/fontset name to an XFontStruct/XFontset
void
gui_init_menu_font(void)
{
@@ -1673,7 +1672,7 @@ gui_init_menu_font(void)
if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False)
{
- /* Failed. What to do? */
+ // Failed. What to do?
}
#else
from.addr = (char *)gui.rsrc_menu_font_name;
@@ -1683,7 +1682,7 @@ gui_init_menu_font(void)
if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontStruct, &to) == False)
{
- /* Failed. What to do? */
+ // Failed. What to do?
}
#endif
}
@@ -1693,8 +1692,8 @@ gui_init_menu_font(void)
gui_mch_exit(int rc UNUSED)
{
#if 0
- /* Lesstif gives an error message here, and so does Solaris. The man page
- * says that this isn't needed when exiting, so just skip it. */
+ // Lesstif gives an error message here, and so does Solaris. The man page
+ // says that this isn't needed when exiting, so just skip it.
XtCloseDisplay(gui.dpy);
#endif
VIM_CLEAR(gui_argv);
@@ -1788,8 +1787,8 @@ gui_mch_init_font(
#endif
#ifdef FEAT_GUI_MOTIF
- /* A font name equal "*" is indicating, that we should activate the font
- * selection dialogue to get a new font name. So let us do it here. */
+ // A font name equal "*" is indicating, that we should activate the font
+ // selection dialogue to get a new font name. So let us do it here.
if (font_name != NULL && STRCMP(font_name, "*") == 0)
font_name = gui_xm_select_font(hl_get_font_name());
#endif
@@ -1797,8 +1796,8 @@ gui_mch_init_font(
#ifdef FEAT_XFONTSET
if (do_fontset)
{
- /* If 'guifontset' is set, VIM treats all font specifications as if
- * they were fontsets, and 'guifontset' becomes the default. */
+ // If 'guifontset' is set, VIM treats all font specifications as if
+ // they were fontsets, and 'guifontset' becomes the default.
if (font_name != NULL)
{
fontset = (XFontSet)gui_mch_get_fontset(font_name, FALSE, TRUE);
@@ -1876,9 +1875,9 @@ gui_mch_init_font(
}
else
{
- /* When not using the font specified by the resources, also don't use
- * the bold/italic fonts, otherwise setting 'guifont' will look very
- * strange. */
+ // When not using the font specified by the resources, also don't use
+ // the bold/italic fonts, otherwise setting 'guifont' will look very
+ // strange.
if (gui.bold_font != NOFONT)
{
XFreeFont(gui.dpy, (XFontStruct *)gui.bold_font);
@@ -1911,7 +1910,7 @@ gui_mch_get_font(char_u *name, int giveErrorIfMissing)
{
XFontStruct *font;
- if (!gui.in_use || name == NULL) /* can't do this when GUI not running */
+ if (!gui.in_use || name == NULL) // can't do this when GUI not running
return NOFONT;
font = XLoadQueryFont(gui.dpy, (char *)name);
@@ -1961,13 +1960,13 @@ gui_mch_get_fontname(GuiFont font, char_u *name)
if (name != NULL && font == NULL)
{
- /* In this case, there's no way other than doing this. */
+ // In this case, there's no way other than doing this.
ret = vim_strsave(name);
}
else if (font != NULL)
{
- /* In this case, try to retrieve the XLFD corresponding to 'font'->fid;
- * if failed, use 'name' unless it's NULL. */
+ // In this case, try to retrieve the XLFD corresponding to 'font'->fid;
+ // if failed, use 'name' unless it's NULL.
unsigned long value = 0L;
if (XGetFontProperty(font, XA_FONT, &value))
@@ -2141,7 +2140,7 @@ check_fontset_sanity(XFontSet fs)
return FAIL;
}
}
- /* scan base font width */
+ // scan base font width
min_width = 32767;
for (i = 0; i < fn; i++)
{
@@ -2166,7 +2165,7 @@ check_fontset_sanity(XFontSet fs)
return FAIL;
}
}
- /* it seems ok. Good Luck!! */
+ // it seems ok. Good Luck!!
return OK;
}
@@ -2202,7 +2201,8 @@ fontset_height2(XFontSet fs)
}
#endif
-/* NOT USED YET
+#if 0
+// NOT USED YET
static int
fontset_descent(XFontSet fs)
{
@@ -2211,7 +2211,7 @@ fontset_descent(XFontSet fs)
extents = XExtentsOfFontSet (fs);
return extents->max_logical_extent.height + extents->max_logical_extent.y;
}
-*/
+#endif
static int
fontset_ascent(XFontSet fs)
@@ -2222,7 +2222,7 @@ fontset_ascent(XFontSet fs)
return -extents->max_logical_extent.y;
}
-#endif /* FEAT_XFONTSET */
+#endif // FEAT_XFONTSET
/*
* Return the Pixel value (color) for the given color name.
@@ -2233,7 +2233,7 @@ gui_mch_get_color(char_u *name)
{
guicolor_T requested;
- /* can't do this when GUI not running */
+ // can't do this when GUI not running
if (!gui.in_use || name == NULL || *name == NUL)
return INVALCOLOR;
@@ -2257,14 +2257,15 @@ gui_mch_get_rgb_color(int r, int g, int b)
XColor available;
Colormap colormap;
-/* Using XParseColor() is very slow, put rgb in XColor directly.
+#if 0
+// Using XParseColor() is very slow, put rgb in XColor directly.
char spec[8]; // space enough to hold "#RRGGBB"
vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b);
if (XParseColor(gui.dpy, colormap, (char *)spec, &available) != 0
&& XAllocColor(gui.dpy, colormap, &available) != 0)
return (guicolor_T)available.pixel;
-*/
+#endif
colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy));
vim_memset(&available, 0, sizeof(XColor));
available.red = r << 8;
@@ -2362,9 +2363,9 @@ gui_mch_draw_string(
if (enc_utf8)
{
- /* Convert UTF-8 byte sequence to 16 bit characters for the X
- * functions. Need a buffer for the 16 bit characters. Keep it
- * between calls, because allocating it each time is slow. */
+ // Convert UTF-8 byte sequence to 16 bit characters for the X
+ // functions. Need a buffer for the 16 bit characters. Keep it
+ // between calls, because allocating it each time is slow.
if (buflen < len)
{
XtFree((char *)buf);
@@ -2382,7 +2383,7 @@ gui_mch_draw_string(
{
# ifdef SMALL_WCHAR_T
if (c >= 0x10000)
- c = 0xbf; /* show chars > 0xffff as ? */
+ c = 0xbf; // show chars > 0xffff as ?
# endif
((wchar_t *)buf)[wlen] = c;
}
@@ -2390,7 +2391,7 @@ gui_mch_draw_string(
#endif
{
if (c >= 0x10000)
- c = 0xbf; /* show chars > 0xffff as ? */
+ c = 0xbf; // show chars > 0xffff as ?
((XChar2b *)buf)[wlen].byte1 = (unsigned)c >> 8;
((XChar2b *)buf)[wlen].byte2 = c;
}
@@ -2412,9 +2413,9 @@ gui_mch_draw_string(
#ifdef FEAT_XFONTSET
if (current_fontset != NULL)
{
- /* Setup a clip rectangle to avoid spilling over in the next or
- * previous line. This is apparently needed for some fonts which are
- * used in a fontset. */
+ // Setup a clip rectangle to avoid spilling over in the next or
+ // previous line. This is apparently needed for some fonts which are
+ // used in a fontset.
XRectangle clip;
clip.x = 0;
@@ -2455,7 +2456,7 @@ gui_mch_draw_string(
}
else
{
- /* XmbDrawImageString has bug, don't use it for fontset. */
+ // XmbDrawImageString has bug, don't use it for fontset.
if (enc_utf8)
XDrawImageString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), buf, wlen);
@@ -2464,7 +2465,7 @@ gui_mch_draw_string(
TEXT_Y(row), (char *)s, len);
}
- /* Bold trick: draw the text again with a one-pixel offset. */
+ // Bold trick: draw the text again with a one-pixel offset.
if (flags & DRAW_BOLD)
{
if (enc_utf8)
@@ -2475,17 +2476,17 @@ gui_mch_draw_string(
TEXT_Y(row), (char *)s, len);
}
- /* Undercurl: draw curl at the bottom of the character cell. */
+ // Undercurl: draw curl at the bottom of the character cell.
if (flags & DRAW_UNDERC)
draw_curl(row, col, cells);
- /* Underline: draw a line at the bottom of the character cell. */
+ // Underline: draw a line at the bottom of the character cell.
if (flags & DRAW_UNDERL)
{
int y = FILL_Y(row + 1) - 1;
- /* When p_linespace is 0, overwrite the bottom row of pixels.
- * Otherwise put the line just below the character. */
+ // When p_linespace is 0, overwrite the bottom row of pixels.
+ // Otherwise put the line just below the character.
if (p_linespace > 1)
y -= p_linespace - 1;
XDrawLine(gui.dpy, gui.wid, gui.text_gc, FILL_X(col),
@@ -2543,12 +2544,12 @@ gui_mch_beep(void)
void
gui_mch_flash(int msec)
{
- /* Do a visual beep by reversing the foreground and background colors */
+ // Do a visual beep by reversing the foreground and background colors
XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, 0, 0,
FILL_X((int)Columns) + gui.border_offset,
FILL_Y((int)Rows) + gui.border_offset);
XSync(gui.dpy, False);
- ui_delay((long)msec, TRUE); /* wait for a few msec */
+ ui_delay((long)msec, TRUE); // wait for a few msec
XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, 0, 0,
FILL_X((int)Columns) + gui.border_offset,
FILL_Y((int)Rows) + gui.border_offset);
@@ -2614,7 +2615,7 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
XFillRectangle(gui.dpy, gui.wid, gui.text_gc,
#ifdef FEAT_RIGHTLEFT
- /* vertical line should be on the right of current point */
+ // vertical line should be on the right of current point
CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w :
#endif
FILL_X(gui.col),
@@ -2677,8 +2678,8 @@ gui_mch_wait_for_chars(long wtime)
(long_u)(wtime == 0 ? 1L : wtime),
gui_x11_timer_cb, &timed_out);
#ifdef FEAT_JOB_CHANNEL
- /* If there is a channel with the keep_open flag we need to poll for input
- * on them. */
+ // If there is a channel with the keep_open flag we need to poll for input
+ // on them.
if (channel_any_keep_open())
channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
channel_poll_cb, (XtPointer)&channel_timer);
@@ -2688,7 +2689,7 @@ gui_mch_wait_for_chars(long wtime)
desired = (XtIMAll);
while (!timed_out)
{
- /* Stop or start blinking when focus changes */
+ // Stop or start blinking when focus changes
if (gui.in_focus != focus)
{
if (gui.in_focus)
@@ -2705,7 +2706,7 @@ gui_mch_wait_for_chars(long wtime)
parse_queued_messages();
# ifdef FEAT_TIMERS
if (did_add_timer)
- /* Need to recompute the waiting time. */
+ // Need to recompute the waiting time.
break;
# endif
#endif
@@ -2741,7 +2742,9 @@ gui_mch_wait_for_chars(long wtime)
* Output routines.
*/
-/* Flush any output to the screen */
+/*
+ * Flush any output to the screen
+ */
void
gui_mch_flush(void)
{
@@ -2763,8 +2766,8 @@ gui_mch_clear_block(
x = FILL_X(col1);
- /* Clear one extra pixel at the far right, for when bold characters have
- * spilled over to the next column. */
+ // Clear one extra pixel at the far right, for when bold characters have
+ // spilled over to the next column.
XFillRectangle(gui.dpy, gui.wid, gui.back_gc, x, FILL_Y(row1),
(col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1),
(row2 - row1 + 1) * gui.char_height);
@@ -2784,10 +2787,10 @@ gui_mch_clear_all(void)
gui_mch_delete_lines(int row, int num_lines)
{
if (gui.visibility == VisibilityFullyObscured)
- return; /* Can't see the window */
+ return; // Can't see the window
- /* copy one extra pixel at the far right, for when bold has spilled
- * over */
+ // copy one extra pixel at the far right, for when bold has spilled
+ // over
XCopyArea(gui.dpy, gui.wid, gui.wid, gui.text_gc,
FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
gui.char_width * (gui.scroll_region_right - gui.scroll_region_left + 1)
@@ -2809,10 +2812,10 @@ gui_mch_delete_lines(int row, int num_lines)
gui_mch_insert_lines(int row, int num_lines)
{
if (gui.visibility == VisibilityFullyObscured)
- return; /* Can't see the window */
+ return; // Can't see the window
- /* copy one extra pixel at the far right, for when bold has spilled
- * over */
+ // copy one extra pixel at the far right, for when bold has spilled
+ // over
XCopyArea(gui.dpy, gui.wid, gui.wid, gui.text_gc,
FILL_X(gui.scroll_region_left), FILL_Y(row),
gui.char_width * (gui.scroll_region_right - gui.scroll_region_left + 1)
@@ -2839,18 +2842,18 @@ gui_x11_check_copy_area(void)
XFlush(gui.dpy);
- /* Wait to check whether the scroll worked or not */
+ // Wait to check whether the scroll worked or not
for (;;)
{
if (XCheckTypedEvent(gui.dpy, NoExpose, &event))
- return; /* The scroll worked. */
+ return; // The scroll worked.
if (XCheckTypedEvent(gui.dpy, GraphicsExpose, &event))
{
gevent = (XGraphicsExposeEvent *)&event;
gui_redraw(gevent->x, gevent->y, gevent->width, gevent->height);
if (gevent->count == 0)
- return; /* This was the last expose event */
+ return; // This was the last expose event
}
XSync(gui.dpy, False);
}
@@ -2931,7 +2934,7 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
void
gui_mch_draw_menubar(void)
{
- /* Nothing to do in X */
+ // Nothing to do in X
}
void
@@ -2943,7 +2946,7 @@ gui_x11_menu_cb(
gui_menu_cb((vimmenu_T *)client_data);
}
-#endif /* FEAT_MENU */
+#endif // FEAT_MENU
@@ -2973,11 +2976,11 @@ gui_x11_wm_protocol_handler(
wm_atoms[SAVE_YOURSELF_IDX])
{
out_flush();
- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
+ ml_sync_all(FALSE, FALSE); // preserve all swap files
- /* Set the window's WM_COMMAND property, to let the window manager
- * know we are done saving ourselves. We don't want to be restarted,
- * thus set argv to NULL. */
+ // Set the window's WM_COMMAND property, to let the window manager
+ // know we are done saving ourselves. We don't want to be restarted,
+ // thus set argv to NULL.
XSetCommand(gui.dpy, XtWindow(vimShell), NULL, 0);
return;
}
@@ -3093,7 +3096,7 @@ gui_mch_start_blink(void)
{
if (blink_timer != (XtIntervalId)0)
XtRemoveTimeOut(blink_timer);
- /* Only switch blinking on if none of the times is zero */
+ // Only switch blinking on if none of the times is zero
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
{
blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
@@ -3158,7 +3161,7 @@ gui_x11_callbacks(Widget textArea, Widget vimForm)
XtAddEventHandler(textArea, KeyPressMask, FALSE, gui_x11_key_hit_cb,
(XtPointer)0);
- /* get pointer moved events from scrollbar, needed for 'mousefocus' */
+ // get pointer moved events from scrollbar, needed for 'mousefocus'
XtAddEventHandler(vimForm, PointerMotionMask,
FALSE, gui_x11_mouse_cb, (XtPointer)1);
XtAddEventHandler(textArea, ButtonPressMask | ButtonReleaseMask |
@@ -3203,8 +3206,8 @@ gui_x11_get_last_mouse_event(void)
#if defined(FEAT_SIGN_ICONS) || defined(PROTO)
-/* Signs are currently always 2 chars wide. Hopefully the font is big enough
- * to provide room for the bitmap! */
+// Signs are currently always 2 chars wide. Hopefully the font is big enough
+// to provide room for the bitmap!
# define SIGN_WIDTH (gui.char_width * 2)
void
@@ -3252,9 +3255,9 @@ gui_mch_register_sign(char_u *signfile)
&sign, NULL, &attrs);
if (status == 0)
{
- /* Sign width is fixed at two columns now.
- if (sign->width > gui.sign_width)
- gui.sign_width = sign->width + 8; */
+ // Sign width is fixed at two columns now.
+ // if (sign->width > gui.sign_width)
+ // gui.sign_width = sign->width + 8;
}
else
emsg(_(e_signdata));
@@ -3272,8 +3275,8 @@ gui_mch_destroy_sign(void *sign)
#ifdef FEAT_MOUSESHAPE
-/* The last set mouse pointer shape is remembered, to be used when it goes
- * from hidden to not hidden. */
+// The last set mouse pointer shape is remembered, to be used when it goes
+// from hidden to not hidden.
static int last_shape = 0;
#endif
@@ -3282,7 +3285,7 @@ static int last_shape = 0;
*/
void
gui_mch_mousehide(
- int hide) /* TRUE = use blank ptr, FALSE = use parent ptr */
+ int hide) // TRUE = use blank ptr, FALSE = use parent ptr
{
if (gui.pointer_hidden != hide)
{
@@ -3300,27 +3303,27 @@ gui_mch_mousehide(
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
-/* Table for shape IDs. Keep in sync with the mshape_names[] table in
- * misc2.c! */
+// Table for shape IDs. Keep in sync with the mshape_names[] table in
+// misc2.c!
static int mshape_ids[] =
{
- XC_left_ptr, /* arrow */
- 0, /* blank */
- XC_xterm, /* beam */
- XC_sb_v_double_arrow, /* updown */
- XC_sizing, /* udsizing */
- XC_sb_h_double_arrow, /* leftright */
- XC_sizing, /* lrsizing */
- XC_watch, /* busy */
- XC_X_cursor, /* no */
- XC_crosshair, /* crosshair */
- XC_hand1, /* hand1 */
- XC_hand2, /* hand2 */
- XC_pencil, /* pencil */
- XC_question_arrow, /* question */
- XC_right_ptr, /* right-arrow */
- XC_center_ptr, /* up-arrow */
- XC_left_ptr /* last one */
+ XC_left_ptr, // arrow
+ 0, // blank
+ XC_xterm, // beam
+ XC_sb_v_double_arrow, // updown
+ XC_sizing, // udsizing
+ XC_sb_h_double_arrow, // leftright
+ XC_sizing, // lrsizing
+ XC_watch, // busy
+ XC_X_cursor, // no
+ XC_crosshair, // crosshair
+ XC_hand1, // hand1
+ XC_hand2, // hand2
+ XC_pencil, // pencil
+ XC_question_arrow, // question
+ XC_right_ptr, // right-arrow
+ XC_center_ptr, // up-arrow
+ XC_left_ptr // last one
};
void
@@ -3341,7 +3344,7 @@ mch_set_mouse_shape(int shape)
if (id >= XC_num_glyphs)
id = XC_left_ptr;
else
- id &= ~1; /* they are always even (why?) */
+ id &= ~1; // they are always even (why?)
}
else
id = mshape_ids[shape];
@@ -3365,8 +3368,8 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
if (menu->id != NULL && menu->parent != NULL
&& menu_is_toolbar(menu->parent->name))
{
- /* Always destroy and create the balloon, in case the string was
- * changed. */
+ // Always destroy and create the balloon, in case the string was
+ // changed.
if (menu->tip != NULL)
{
gui_mch_destroy_beval_area(menu->tip);
diff --git a/src/gui_xmdlg.c b/src/gui_xmdlg.c
index 01e536c1e..04996efec 100644
--- a/src/gui_xmdlg.c
+++ b/src/gui_xmdlg.c
@@ -46,9 +46,8 @@ extern Widget vimShell;
# define apply_fontlist(w)
#endif
-/****************************************************************************
- * Font selection dialogue implementation.
- */
+/////////////////////////////////////////////////////////////////////////////
+// Font selection dialogue implementation.
static char wild[3] = "*";
@@ -68,10 +67,10 @@ add_cancel_action(Widget shell, XtCallbackProc close_callback, void *arg)
static Atom dw_atom = 0;
Display *display = XtDisplay(shell);
- /* deactivate the built-in delete response of killing the application */
+ // deactivate the built-in delete response of killing the application
XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL);
- /* add a delete window protocol callback instead */
+ // add a delete window protocol callback instead
if (!dw_atom)
{
wmp_atom = XmInternAtom(display, "WM_PROTOCOLS", True);
@@ -105,14 +104,14 @@ typedef struct _SharedFontSelData
Widget list[NONE];
Widget name;
Widget sample;
- char **names; /* font name array of arrays */
- int num; /* number of font names */
- String sel[NONE]; /* selection category */
- Boolean in_pixels; /* toggle state - size in pixels */
- char *font_name; /* current font name */
- XFontStruct *old; /* font data structure for sample display */
- XmFontList old_list; /* font data structure for sample display */
- Boolean exit; /* used for program exit control */
+ char **names; // font name array of arrays
+ int num; // number of font names
+ String sel[NONE]; // selection category
+ Boolean in_pixels; // toggle state - size in pixels
+ char *font_name; // current font name
+ XFontStruct *old; // font data structure for sample display
+ XmFontList old_list; // font data structure for sample display
+ Boolean exit; // used for program exit control
} SharedFontSelData;
/*
@@ -121,7 +120,7 @@ typedef struct _SharedFontSelData
static char *
fn(SharedFontSelData *data, int i)
{
- /* Assertion checks: */
+ // Assertion checks:
if (data->num < 0)
abort();
if (i >= data->num)
@@ -279,14 +278,14 @@ add_to_list(char **buf, char *item, int *count)
if (*count == MAX_ENTRIES_IN_LIST)
return;
- /* avoid duplication */
+ // avoid duplication
for (i = 0; i < *count; ++i)
{
if (!strcmp(buf[i], item))
return;
}
- /* find order place, but make sure that wild card comes first */
+ // find order place, but make sure that wild card comes first
if (!strcmp(item, wild))
i = 0;
else
@@ -294,7 +293,7 @@ add_to_list(char **buf, char *item, int *count)
if (strcmp(buf[i], item) > 0 && strcmp(buf[i], wild))
break;
- /* now insert the item */
+ // now insert the item
for (j = *count; j > i; --j)
buf[j] = buf[j-1];
buf[i] = XtNewString(item);
@@ -310,12 +309,11 @@ match(SharedFontSelData *data, enum ListSpecifier l, int i)
{
char buf[TEMP_BUF_SIZE];
- /* An empty selection or a wild card matches anything.
- */
+ // An empty selection or a wild card matches anything.
if (!data->sel[l] || !strcmp(data->sel[l], wild))
return True;
- /* chunk out the desired part... */
+ // chunk out the desired part...
switch (l)
{
case ENCODING:
@@ -337,7 +335,7 @@ match(SharedFontSelData *data, enum ListSpecifier l, int i)
;
}
- /* ...and chew it now */
+ // ...and chew it now
return !strcmp(buf, data->sel[l]);
}
@@ -374,7 +372,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
count[idx] = 0;
- /* First we insert the wild char into every single list. */
+ // First we insert the wild char into every single list.
if (fix != ENCODING)
add_to_list(list[ENCODING], wild, &count[ENCODING]);
if (fix != NAME)
@@ -436,7 +434,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
WidgetList children;
Widget selected_button = 0;
- /* Get and update the current button list. */
+ // Get and update the current button list.
XtVaGetValues(data->encoding_pulldown,
XmNchildren, &children,
XmNnumChildren, &n_items,
@@ -450,7 +448,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
if (i < (int)n_items)
{
- /* recycle old button */
+ // recycle old button
XtVaSetValues(children[i],
XmNlabelString, items[i],
XmNuserData, i,
@@ -459,7 +457,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
}
else
{
- /* create a new button */
+ // create a new button
button = XtVaCreateManagedWidget("button",
xmPushButtonGadgetClass,
data->encoding_pulldown,
@@ -479,16 +477,14 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
XtFree(list[ENCODING][i]);
}
- /* Destroy all the outstanding menu items.
- */
+ // Destroy all the outstanding menu items.
for (i = count[ENCODING]; i < (int)n_items; ++i)
{
XtUnmanageChild(children[i]);
XtDestroyWidget(children[i]);
}
- /* Preserve the current selection visually.
- */
+ // Preserve the current selection visually.
if (selected_button)
{
XtVaSetValues(data->encoding_menu,
@@ -522,7 +518,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
w = data->list[SIZE];
break;
default:
- w = (Widget)0; /* for lint */
+ w = (Widget)0; // for lint
}
for (i = 0; i < count[idx]; ++i)
@@ -635,7 +631,7 @@ do_choice(Widget w,
{
if (!strcmp(data->sel[which], sel))
{
- /* unselecting current selection */
+ // unselecting current selection
XtFree(data->sel[which]);
data->sel[which] = NULL;
if (w)
@@ -651,7 +647,7 @@ do_choice(Widget w,
fill_lists(which, data);
- /* If there is a font selection, we display it. */
+ // If there is a font selection, we display it.
if (data->sel[ENCODING]
&& data->sel[NAME]
&& data->sel[STYLE]
@@ -904,11 +900,11 @@ gui_xm_select_font(char_u *current)
data->old = XLoadQueryFont(XtDisplay(parent), big_font);
data->old_list = gui_motif_create_fontlist(data->old);
- /* Set the title of the Dialog window. */
+ // Set the title of the Dialog window.
data->dialog = XmCreateDialogShell(parent, "fontSelector", NULL, 0);
str = XmStringCreateLocalized(_("Vim - Font Selector"));
- /* Create form popup dialog widget. */
+ // Create form popup dialog widget.
form = XtVaCreateWidget("form",
xmFormWidgetClass, data->dialog,
XmNdialogTitle, str,
@@ -948,7 +944,7 @@ gui_xm_select_font(char_u *current)
NULL);
apply_fontlist(data->cancel);
- /* Create the separator for beauty. */
+ // Create the separator for beauty.
n = 0;
XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
@@ -959,7 +955,7 @@ gui_xm_select_font(char_u *current)
separator = XmCreateSeparatorGadget(form, "separator", args, n);
XtManageChild(separator);
- /* Create font name text widget and the corresponding label. */
+ // Create font name text widget and the corresponding label.
data->name = XtVaCreateManagedWidget("fontName",
xmTextWidgetClass, form,
XmNbottomAttachment, XmATTACH_FORM,
@@ -989,7 +985,7 @@ gui_xm_select_font(char_u *current)
XmStringFree(str);
apply_fontlist(name);
- /* create sample display label widget */
+ // create sample display label widget
disp_frame = XtVaCreateManagedWidget("sampleFrame",
xmFrameWidgetClass, form,
XmNshadowType, XmSHADOW_ETCHED_IN,
@@ -1014,7 +1010,7 @@ gui_xm_select_font(char_u *current)
XmNfontList, data->old_list,
NULL);
- /* create toggle button */
+ // create toggle button
str = XmStringCreateLocalized(_("Show size in Points"));
size_toggle = XtVaCreateManagedWidget("sizeToggle",
xmToggleButtonGadgetClass, form,
@@ -1029,8 +1025,7 @@ gui_xm_select_font(char_u *current)
apply_fontlist(size_toggle);
XtManageChild(size_toggle);
- /* Encoding pulldown menu.
- */
+ // Encoding pulldown menu.
data->encoding_pulldown = XmCreatePulldownMenu(form,
"encodingPulldown", NULL, 0);
@@ -1070,7 +1065,7 @@ gui_xm_select_font(char_u *current)
XmNorientation, XmVERTICAL,
NULL);
- /* font list */
+ // font list
frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form,
XmNshadowThickness, 0,
XmNtopAttachment, XmATTACH_FORM,
@@ -1101,7 +1096,7 @@ gui_xm_select_font(char_u *current)
data->list[NAME] = XmCreateScrolledList(frame, "fontList", args, n);
XtVaSetValues(name, XmNuserData, data->list[NAME], NULL);
- /* style list */
+ // style list
frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form,
XmNshadowThickness, 0,
XmNtopAttachment, XmATTACH_FORM,
@@ -1134,7 +1129,7 @@ gui_xm_select_font(char_u *current)
data->list[STYLE] = XmCreateScrolledList(frame, "styleList", args, n);
XtVaSetValues(name, XmNuserData, data->list[STYLE], NULL);
- /* size list */
+ // size list
frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form,
XmNshadowThickness, 0,
XmNtopAttachment, XmATTACH_FORM,
@@ -1166,7 +1161,7 @@ gui_xm_select_font(char_u *current)
data->list[SIZE] = XmCreateScrolledList(frame, "sizeList", args, n);
XtVaSetValues(name, XmNuserData, data->list[SIZE], NULL);
- /* update form widgets cancel button */
+ // update form widgets cancel button
XtVaSetValues(form, XmNcancelButton, data->cancel, NULL);
XtAddCallback(size_toggle, XmNvalueChangedCallback,
@@ -1184,7 +1179,7 @@ gui_xm_select_font(char_u *current)
XmProcessTraversal(data->list[NAME], XmTRAVERSE_CURRENT);
- /* setup tabgroups */
+ // setup tabgroups
XmAddTabGroup(data->list[NAME]);
XmAddTabGroup(data->list[STYLE]);
@@ -1196,7 +1191,7 @@ gui_xm_select_font(char_u *current)
add_cancel_action(data->dialog, (XtCallbackProc)cancel_callback, data);
- /* Preset selection data. */
+ // Preset selection data.
data->exit = False;
data->in_pixels= True;
@@ -1206,7 +1201,7 @@ gui_xm_select_font(char_u *current)
data->sel[SIZE] = NULL;
data->font_name = NULL;
- /* set up current font parameters */
+ // set up current font parameters
if (current && current[0] != '\0')
{
int i;
@@ -1244,14 +1239,12 @@ gui_xm_select_font(char_u *current)
}
else
{
- /* We can't preset a symbolic name, which isn't a full font
- * description. Therefore we just behave the same way as if the
- * user didn't have selected anything thus far.
- *
- * Unfortunately there is no known way to expand an abbreviated
- * font name.
- */
-
+ // We can't preset a symbolic name, which isn't a full font
+ // description. Therefore we just behave the same way as if the
+ // user didn't have selected anything thus far.
+ //
+ // Unfortunately there is no known way to expand an abbreviated
+ // font name.
data->font_name = NULL;
}
}
@@ -1260,16 +1253,15 @@ gui_xm_select_font(char_u *current)
fill_lists(NONE, data);
- /* Unfortunately LessTif doesn't align the list widget's properly. I don't
- * have currently any idea how to fix this problem.
- */
+ // Unfortunately LessTif doesn't align the list widget's properly. I don't
+ // have currently any idea how to fix this problem.
XtManageChild(data->list[NAME]);
XtManageChild(data->list[STYLE]);
XtManageChild(data->list[SIZE]);
XtManageChild(data->encoding_menu);
manage_centered(form);
- /* modal event loop */
+ // modal event loop
while (!data->exit)
XtAppProcessEvent(XtWidgetToApplicationContext(data->dialog),
(XtInputMask)XtIMAll);
diff --git a/src/gui_xmebw.c b/src/gui_xmebw.c
index cd6079418..6a01a7132 100644
--- a/src/gui_xmebw.c
+++ b/src/gui_xmebw.c
@@ -52,13 +52,12 @@
#include "gui_xmebwp.h"
-/* Provide some missing wrappers, which are missed from the LessTif
- * implementation. Also missing in Motif 1.2 and earlier.
- *
- * We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the
- * pixmap will not appear in its caches properly. We cache the interesting
- * values in XmEnhancedButtonPart instead ourself.
- */
+// Provide some missing wrappers, which are missed from the LessTif
+// implementation. Also missing in Motif 1.2 and earlier.
+//
+// We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the
+// pixmap will not appear in its caches properly. We cache the interesting
+// values in XmEnhancedButtonPart instead ourself.
#if defined(LESSTIF_VERSION) || (XmVersion <= 1002)
# ifndef Lab_IsMenupane
# define Lab_IsMenupane(w) (Lab_MenuType(w) == (int)XmMENU_POPUP || \
@@ -74,7 +73,7 @@
* Motif internals we have to cheat around with.
*/
-/* Hopefully this will never change... */
+// Hopefully this will never change...
#ifndef XmFOCUS_IGNORE
# define XmFOCUS_IGNORE 1<<1
#endif
@@ -144,8 +143,8 @@ static XtResource resources[] =
}
};
-/* This is needed to work around a bug in Lesstif 2, leaving the extension
- * NULL somehow results in getting it set to an invalid pointer. */
+// This is needed to work around a bug in Lesstif 2, leaving the extension
+// NULL somehow results in getting it set to an invalid pointer.
XmPrimitiveClassExtRec xmEnhancedButtonPrimClassExtRec =
{
/* next_extension */ NULL,
@@ -160,7 +159,7 @@ XmPrimitiveClassExtRec xmEnhancedButtonPrimClassExtRec =
XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
{
{
- /* core_class fields */
+ // core_class fields
/* superclass */ (WidgetClass) & xmPushButtonClassRec,
/* class_name */ "XmEnhancedButton",
/* widget_size */ sizeof(XmEnhancedButtonRec),
@@ -195,7 +194,7 @@ XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
/* extension */ NULL
},
- /* primitive_class fields */
+ // primitive_class fields
{
/* border highlight */ BorderHighlight,
/* border_unhighlight */ BorderUnhighlight,
@@ -206,7 +205,7 @@ XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
/* extension */ (XtPointer)&xmEnhancedButtonPrimClassExtRec,
},
- /* label_class fields */
+ // label_class fields
{
/* setOverrideCallback */ XmInheritSetOverrideCallback,
/* menuProcs */ XmInheritMenuProc,
@@ -214,12 +213,12 @@ XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
/* extension */ NULL,
},
- /* pushbutton_class record */
+ // pushbutton_class record
{
/* extension */ (XtPointer) NULL,
},
- /* enhancedbutton_class fields */
+ // enhancedbutton_class fields
{
/* stipple_bitmap */ None
}
@@ -262,17 +261,17 @@ alloc_color(Display *display,
return status != 0 ? 1 : 0;
}
-/* XPM */
+// XPM
static char * blank_xpm[] =
{
-/* width height ncolors cpp [x_hot y_hot] */
+// width height ncolors cpp [x_hot y_hot]
"12 12 4 1 0 0",
-/* colors */
+// colors
" s iconColor1 m black c #000000",
". s none m none c none",
"X s topShadowColor m none c #DCDEE5",
"o s bottomShadowColor m black c #5D6069",
-/* pixels */
+// pixels
" ..",
" XXXXXXXX ..",
" X....... o.",
@@ -292,8 +291,8 @@ static char * blank_xpm[] =
static void
set_pixmap(XmEnhancedButtonWidget eb)
{
- /* Configure defines XPMATTRIBUTES_TYPE as XpmAttributes or as
- * XpmAttributes_21, depending on what is in Xm/XpmP.h. */
+ // Configure defines XPMATTRIBUTES_TYPE as XpmAttributes or as
+ // XpmAttributes_21, depending on what is in Xm/XpmP.h.
XPMATTRIBUTES_TYPE attr;
Pixmap sen_pix;
Window root;
@@ -323,8 +322,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
int shift;
GC gc;
- /* Make sure there is a default value for the pixmap.
- */
+ // Make sure there is a default value for the pixmap.
if (!data)
return;
@@ -343,7 +341,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
eb->enhancedbutton.highlight_pixmap = None;
eb->enhancedbutton.insensitive_pixmap = None;
- /* We use dynamic colors, get them now. */
+ // We use dynamic colors, get them now.
motif_get_toolbar_colors(
&eb->core.background_pixel,
&eb->primitive.foreground,
@@ -351,7 +349,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
&eb->primitive.top_shadow_color,
&eb->primitive.highlight_color);
- /* Setup color substitution table. */
+ // Setup color substitution table.
color[0].pixel = eb->core.background_pixel;
color[1].pixel = eb->core.background_pixel;
color[2].pixel = eb->core.background_pixel;
@@ -361,9 +359,9 @@ set_pixmap(XmEnhancedButtonWidget eb)
color[6].pixel = eb->primitive.highlight_color;
color[7].pixel = eb->pushbutton.arm_color;
- /* Create the "sensitive" pixmap. */
+ // Create the "sensitive" pixmap.
attr.valuemask = XpmColorSymbols | XpmCloseness;
- attr.closeness = 65535; /* accuracy isn't crucial */
+ attr.closeness = 65535; // accuracy isn't crucial
attr.colorsymbols = color;
attr.numsymbols = XtNumber(color);
@@ -372,7 +370,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
if (!fname || status != XpmSuccess)
status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
- /* If something failed, we will fill in the default pixmap. */
+ // If something failed, we will fill in the default pixmap.
if (status != XpmSuccess)
status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix,
&mask, &attr);
@@ -381,7 +379,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
XGetGeometry(dpy, pix, &root, &x, &y, &width, &height, &border, &depth);
- /* TODO: does the shift depend on label_location somehow? */
+ // TODO: does the shift depend on label_location somehow?
shift = eb->primitive.shadow_thickness / 2;
if (shift < 1)
@@ -395,15 +393,15 @@ set_pixmap(XmEnhancedButtonWidget eb)
XSetClipOrigin(dpy, gc, shift, shift);
XCopyArea(dpy, pix, sen_pix, gc, 0, 0, width, height, shift, shift);
- /* Create the "highlight" pixmap. */
+ // Create the "highlight" pixmap.
color[4].pixel = eb->primitive.bottom_shadow_color;
-#ifdef XpmAllocColor /* SGI doesn't have it */
+#ifdef XpmAllocColor // SGI doesn't have it
attr.valuemask = XpmColorSymbols | XpmCloseness | XpmAllocColor;
attr.alloc_color = alloc_color;
#else
attr.valuemask = XpmColorSymbols | XpmCloseness;
#endif
- attr.closeness = 65535; /* accuracy isn't crucial */
+ attr.closeness = 65535; // accuracy isn't crucial
attr.colorsymbols = color;
attr.numsymbols = XtNumber(color);
@@ -439,15 +437,15 @@ set_pixmap(XmEnhancedButtonWidget eb)
XFreePixmap(dpy, pix);
XFreePixmap(dpy, mask);
- /* Create the "insensitive" pixmap. */
+ // Create the "insensitive" pixmap.
attr.valuemask = XpmColorSymbols | XpmCloseness | XpmColorKey;
- attr.closeness = 65535; /* accuracy isn't crucial */
+ attr.closeness = 65535; // accuracy isn't crucial
attr.colorsymbols = color;
attr.numsymbols = sizeof(color) / sizeof(color[0]);
attr.color_key = XPM_MONO;
status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
- /* Need to create new Pixmaps with the mask applied. */
+ // Need to create new Pixmaps with the mask applied.
ins_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth);
@@ -566,13 +564,13 @@ draw_unhighlight(XmEnhancedButtonWidget eb)
XtClass(eb->core.parent), XmQTspecifyUnhighlight))
!= NULL) && (UnhighlightT->getUnhighlightGC != NULL))
{
- /* if unhighlight trait in parent use specified GC... */
+ // if unhighlight trait in parent use specified GC...
manager_background_GC =
UnhighlightT->getUnhighlightGC(eb->core.parent, (Widget) eb);
}
else
{
- /* ...otherwise, use parent's background GC */
+ // ...otherwise, use parent's background GC
manager_background_GC = ((XmManagerWidget)
(eb->core.parent))->manager.background_GC;
}
@@ -696,7 +694,7 @@ draw_label(XmEnhancedButtonWidget eb, XEvent *event, Region region)
eb->label.pixmap = eb->pushbutton.unarm_pixmap;
}
else
- /* pushbutton is not armed */
+ // pushbutton is not armed
eb->label.pixmap = eb->pushbutton.unarm_pixmap;
}
@@ -758,7 +756,7 @@ Enter(Widget wid,
if (eb->pushbutton.armed)
return;
- /* ...so KHelp event is delivered correctly. */
+ // ...so KHelp event is delivered correctly.
_XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, TRUE);
XtSetKeyboardFocus(XtParent(XtParent(eb)), (Widget) eb);
_XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, FALSE);
@@ -767,7 +765,7 @@ Enter(Widget wid,
((XmManagerWidget) XtParent(wid))->manager.active_child = wid;
- /* etched in menu button */
+ // etched in menu button
if (etched_in && !XmIsTearOffButton(eb))
{
XFillRectangle(XtDisplay(eb), XtWindow(eb),
@@ -843,7 +841,7 @@ Leave(Widget wid,
if (_XmGetInDragMode((Widget)eb)
&& eb->pushbutton.armed
- && ( /* !ActiveTearOff || */
+ && ( // !ActiveTearOff ||
event->xcrossing.mode == NotifyNormal))
{
eb->pushbutton.armed = FALSE;
@@ -915,7 +913,7 @@ set_size(XmEnhancedButtonWidget newtb)
_XmCalcLabelDimensions((Widget) newtb);
- /* Find out how big the pixmap is */
+ // Find out how big the pixmap is
if (newtb->enhancedbutton.pixmap_data
&& !IsNull(newtb->label.pixmap)
&& !IsNull(newtb->enhancedbutton.normal_pixmap))
@@ -958,8 +956,8 @@ set_size(XmEnhancedButtonWidget newtb)
}
else
{
- /* FIXME: We should calculate an drawing offset for the pixmap here to
- * adjust it. */
+ // FIXME: We should calculate an drawing offset for the pixmap here to
+ // adjust it.
}
#if 0
@@ -972,7 +970,7 @@ set_size(XmEnhancedButtonWidget newtb)
newtb->core.height);
#endif
- /* Invoke Label's Resize procedure. */
+ // Invoke Label's Resize procedure.
{
XtWidgetProc resize;
XtProcessLock();
@@ -994,7 +992,7 @@ Initialize(Widget rq, Widget ebw, ArgList args UNUSED, Cardinal *n UNUSED)
resize = xmLabelClassRec.core_class.resize;
XtProcessUnlock();
- /* Create a bitmap for stippling (Drawable resources are cheap). */
+ // Create a bitmap for stippling (Drawable resources are cheap).
if (STIPPLE_BITMAP == None)
{
Display *dpy = XtDisplay((Widget) request);
@@ -1005,15 +1003,14 @@ Initialize(Widget rq, Widget ebw, ArgList args UNUSED, Cardinal *n UNUSED)
}
eb->enhancedbutton.doing_setvalues = False;
- /* First see what type of extended label this is.
- */
+ // First see what type of extended label this is.
if (eb->enhancedbutton.pixmap_data)
{
XmString str;
set_pixmap(eb);
- /* FIXME: this is not the perfect way to deal with menus, which do not
- * have any string set right now. */
+ // FIXME: this is not the perfect way to deal with menus, which do not
+ // have any string set right now.
str = XmStringCreateLocalized("");
XtVaSetValues((Widget) eb, XmNlabelString, str, NULL);
XmStringFree(str);
@@ -1106,7 +1103,7 @@ SetValues(Widget current,
/*
* Artificially let the highlight appear if the mouse is over us.
*/
- /* Best way to get the root window of object: */
+ // Best way to get the root window of object:
XGetGeometry(dpy, XtWindow(cur), &root, &r_x, &r_y, &r_width,
&r_height, &r_border, &r_depth);
XQueryPointer(XtDisplay(cur), XtWindow(cur), &root_q, &child,
@@ -1133,7 +1130,7 @@ SetValues(Widget current,
if (NOT_EQUAL(primitive.shadow_thickness))
{
redraw = True;
- /* Don't change the pixmaps */
+ // Don't change the pixmaps
change = False;
}
@@ -1230,10 +1227,9 @@ Redisplay(Widget w, XEvent *event, Region region)
{
GC gc;
- /* Don't shade if the button contains a label with a pixmap, since
- * there is no variant of the label available with the needed
- * background.
- */
+ // Don't shade if the button contains a label with a pixmap, since
+ // there is no variant of the label available with the needed
+ // background.
if (eb->pushbutton.armed && eb->pushbutton.fill_on_arm)
{
if (eb->label.label_type == (int)XmPIXMAP)
@@ -1248,7 +1244,7 @@ Redisplay(Widget w, XEvent *event, Region region)
}
else
gc = eb->pushbutton.background_gc;
- /* really need to fill with background if not armed ? */
+ // really need to fill with background if not armed ?
if (gc)
XFillRectangle(XtDisplay(eb), XtWindow(eb), gc,
box.x, box.y, box.width, box.height);
@@ -1318,7 +1314,7 @@ Redisplay(Widget w, XEvent *event, Region region)
switch (default_button_emphasis)
{
case XmINTERNAL_HIGHLIGHT:
- /* The call above erases the border highlighting. */
+ // The call above erases the border highlighting.
if (eb->primitive.highlight_drawn)
(*(((XmPushButtonWidgetClass) XtClass (eb))
->primitive_class.border_highlight)) ((Widget) eb) ;
@@ -1368,13 +1364,13 @@ Redisplay(Widget w, XEvent *event, Region region)
parent = XtParent(eb);
if (XmIsManager(parent))
{
- /* Use the parent's GC so monochrome works. */
+ // Use the parent's GC so monochrome works.
bottom_gc = XmParentTopShadowGC(eb);
top_gc = XmParentBottomShadowGC(eb);
}
else
{
- /* Use your own pixel for drawing. */
+ // Use your own pixel for drawing.
bottom_gc = eb->primitive.top_shadow_GC;
top_gc = eb->primitive.bottom_shadow_GC;
}
@@ -1447,4 +1443,4 @@ BorderUnhighlight(Widget w)
draw_pixmap(eb, NULL, NULL);
}
-#endif /* FEAT_TOOLBAR */
+#endif // FEAT_TOOLBAR
diff --git a/src/version.c b/src/version.c
index 066e2093a..e46160e6a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2383,
+/**/
2382,
/**/
2381,