cleanup: convert tab to spaces and trim tail spaces

This commit is contained in:
Vincent Wei
2020-02-02 10:53:31 +08:00
parent 8dbe2c63f1
commit 14d020cccf
831 changed files with 468564 additions and 468554 deletions

View File

@@ -5,11 +5,11 @@
*/
case MSG_ACTIVEMENU:
if (wParam == 2) {
CheckMenuRadioItem ((HMENU)lParam,
IDM_40X15, IDM_CUSTOMIZE,
CheckMenuRadioItem ((HMENU)lParam,
IDM_40X15, IDM_CUSTOMIZE,
pConInfo->termType, MF_BYCOMMAND);
CheckMenuRadioItem ((HMENU)lParam,
IDM_DEFAULT, IDM_BIG5,
CheckMenuRadioItem ((HMENU)lParam,
IDM_DEFAULT, IDM_BIG5,
pConInfo->termCharset, MF_BYCOMMAND);
}
break;

View File

@@ -1,6 +1,6 @@
/*
* This example trys to handle the event when the user presses
* This example trys to handle the event when the user presses
* left button and right button of the mouse at the same time.
*/
LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

View File

@@ -16,6 +16,6 @@ void DrawMyCircle (HDC hdc, int x, int y, int r, gal_pixel pixel)
old_bursh = SetBrushColor (hdc, pixle);
CircleGenerator ((void*)hdc, x, y, r, draw_circle_pixel);
SetBrushColor (hdc, old_brush);
}

View File

@@ -1,4 +1,4 @@
/*
/*
* This program tries to create a new layer named "vcongui" if
* there is no such layer. If there is already a layer named "vcongui",
* this program brings the layer to be the topmost one.

View File

@@ -1,14 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontbig24;
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
FONT_OTHER_NIL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
12, 0);
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
24, 0);

View File

@@ -1,14 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontttf;
logfont = CreateLogFontEx (NULL, "SansSerif", "ISO8859-1",
logfont = CreateLogFontEx (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
16, 0);
logfontgb12 = CreateLogFontEx (NULL, "song", "GB2312",
logfontgb12 = CreateLogFontEx (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
12, 0);
logfontttf = CreateLogFontEx ("ttf", "Courier", "UTF-8",
logfontttf = CreateLogFontEx ("ttf", "Courier", "UTF-8",
FONT_WEIGHT_BLACK, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FS_OTHER_LCDPORTRAIT, FONT_DECORATE_NONE, FONT_RENDER_SUBPIXEL,
24, 0);

View File

@@ -15,35 +15,35 @@ LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
switch (message) {
case MSG_CREATE:
{
hStaticWnd1 = CreateWindow (CTRL_STATIC,
"This is a static control",
hStaticWnd1 = CreateWindow (CTRL_STATIC,
"This is a static control",
WS_CHILD | SS_NOTIFY | SS_SIMPLE | WS_VISIBLE | WS_BORDER,
IDC_STATIC1,
IDC_STATIC1,
10, 10, 180, 300, hWnd, 0);
hButton1 = CreateWindow (CTRL_BUTTON,
"Button1",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_BUTTON1,
"Button1",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_BUTTON1,
20, 20, 80, 20, hStaticWnd1, 0);
hButton2 = CreateWindow (CTRL_BUTTON,
"Button2",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_BUTTON2,
"Button2",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_BUTTON2,
20, 50, 80, 20, hStaticWnd1, 0);
hEdit1 = CreateWindow (CTRL_EDIT,
"Edit Box 1",
WS_CHILD | WS_VISIBLE | WS_BORDER,
IDC_EDIT1,
"Edit Box 1",
WS_CHILD | WS_VISIBLE | WS_BORDER,
IDC_EDIT1,
20, 80, 100, 24, hStaticWnd1, 0);
hStaticWnd2 = CreateWindow (CTRL_STATIC,
"This is child static control",
hStaticWnd2 = CreateWindow (CTRL_STATIC,
"This is child static control",
WS_CHILD | SS_NOTIFY | SS_SIMPLE | WS_VISIBLE | WS_BORDER,
IDC_STATIC1,
IDC_STATIC1,
20, 110, 100, 50, hStaticWnd1, 0);
hEdit2 = CreateWindow (CTRL_EDIT,
"Edit Box 2",
WS_CHILD | WS_VISIBLE | WS_BORDER,
IDC_EDIT2,
"Edit Box 2",
WS_CHILD | WS_VISIBLE | WS_BORDER,
IDC_EDIT2,
0, 20, 100, 24, hStaticWnd2, 0);
break;
}

View File

@@ -2,19 +2,19 @@
* The following code destroies all resource used by the main window
* and then destroies the main window itself.
*/
case MSG_CLOSE:
/* Destroy the resource used by the main window. */
DestroyLogFont (logfont1);
DestroyLogFont (logfont2);
DestroyLogFont (logfont3);
/* Destroy the child windows. */
DestroyWindow(hWndButton);
DestroyWindow(hWndEdit);
case MSG_CLOSE:
/* Destroy the resource used by the main window. */
DestroyLogFont (logfont1);
DestroyLogFont (logfont2);
DestroyLogFont (logfont3);
/* Destroy the main window. */
DestroyMainWindow (hWnd);
/* Destroy the child windows. */
DestroyWindow(hWndButton);
DestroyWindow(hWndEdit);
/* Send a MSG_QUIT message to quit the message loop. */
PostQuitMessage(hWnd);
return 0;
/* Destroy the main window. */
DestroyMainWindow (hWnd);
/* Send a MSG_QUIT message to quit the message loop. */
PostQuitMessage(hWnd);
return 0;

View File

@@ -7,7 +7,7 @@ static LRESULT InitDialogBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM
switch (message) {
case MSG_INITDIALOG:
return 1;
case MSG_COMMAND:
switch (wParam) {
case IDOK:
@@ -16,16 +16,16 @@ static LRESULT InitDialogBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM
break;
}
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
static void InitDialogBox (HWND hWnd)
{
/* Assoiciate the dialog with the controls */
DlgInitProgress.controls = CtrlInitProgress;
/* Display the dialog box and wait */
DialogBoxIndirectParam (&DlgInitProgress, hWnd, InitDialogBoxProc, 0L);
}

View File

@@ -1,8 +1,8 @@
static DLGTEMPLATE DlgInitProgress =
{
WS_BORDER | WS_CAPTION,
WS_BORDER | WS_CAPTION,
WS_EX_NONE,
120, 150, 400, 130,
120, 150, 400, 130,
"VAM-CNC is initializing",
0, 0,
3, NULL,
@@ -10,12 +10,12 @@ static DLGTEMPLATE DlgInitProgress =
};
static CTRLDATA CtrlInitProgress [] =
{
{
{
"static",
WS_VISIBLE | SS_SIMPLE,
10, 10, 380, 16,
IDC_PROMPTINFO,
10, 10, 380, 16,
IDC_PROMPTINFO,
"Initialize...",
0
},
@@ -29,9 +29,9 @@ static CTRLDATA CtrlInitProgress [] =
},
{
"button",
WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON,
WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON,
170, 70, 60, 25,
IDOK,
IDOK,
"OK",
0
}

View File

@@ -1,4 +1,4 @@
/**
/**
* Selecting a logical font to the DC and output text in GB2312 charset
* by using DrawText.
*/
@@ -10,7 +10,7 @@ void OnModeDrawText (HDC hdc)
const char* szBuff2 = "This is a good day. \n"
"This text is drawn by calling DrawText.";
const char* szBuff3 = "Single line text, center.";
const char* szBuff4 =
const char* szBuff4 =
"This text is drawn by calling DrawText.";
rc1.left = 1; rc1.top = 1; rc1.right = 401; rc1.bottom = 101;

View File

@@ -40,11 +40,11 @@ static void InitCreateInfo (PMAINWINCREATE pCreateInfo)
pCreateInfo->hCursor = GetSystemCursor (0);
pCreateInfo->hIcon = 0;
pCreateInfo->MainWindowProc = HelloWinProc;
pCreateInfo->lx = 0;
pCreateInfo->ty = 0;
pCreateInfo->lx = 0;
pCreateInfo->ty = 0;
pCreateInfo->rx = 320;
pCreateInfo->by = 240;
pCreateInfo->iBkColor = PIXEL_lightwhite;
pCreateInfo->iBkColor = PIXEL_lightwhite;
pCreateInfo->dwAddData = 0;
pCreateInfo->hHosting = HWND_DESKTOP;
}

View File

@@ -1,6 +1,6 @@
/*
* This program parses the command line arguments.
* If the user specified a layer name by using "-layer <layer_name",
* If the user specified a layer name by using "-layer <layer_name",
* the program will try to join the layer, otherwise create a new layer.
*/
int MiniGUIMain (int args, const char* arg[])

View File

@@ -1,11 +1,11 @@
static LRESULT DepInfoBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
struct _DepInfo *info;
switch(message) {
case MSG_INITDIALOG:
{
/*
/*
* Get the lParam passed to this dialog box, and assign it
* to the second private additional data assoiciated
* with the dialog box.
@@ -17,7 +17,7 @@ static LRESULT DepInfoBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
case MSG_COMMAND:
{
/*
/*
* Get the parameter from the second private data assoiciated
* with the dialog box.
*/
@@ -34,6 +34,6 @@ static LRESULT DepInfoBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
}
}
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}

View File

@@ -2,10 +2,10 @@
* The handler makes sure that the client area always
* is _WIDTH wide and _HEIGHT high.
*/
case MSG_SIZECHANGED:
{
RECT* rcClient = (RECT*)lParam;
rcClient->right = rcClient->left + _WIDTH;
rcClient->bottom = rcClient->top + _HEIGHT;
return 1;
}
case MSG_SIZECHANGED:
{
RECT* rcClient = (RECT*)lParam;
rcClient->right = rcClient->left + _WIDTH;
rcClient->bottom = rcClient->top + _HEIGHT;
return 1;
}

View File

@@ -2,14 +2,14 @@
* The handler set the actual size of the window always
* to be _WIDTH wide and _HEIGHT high.
*/
case MSG_SIZECHANGING:
{
const RECT* rcExpect = (const RECT*)wParam;
RECT* rcResult = (RECT*)lParam;
case MSG_SIZECHANGING:
{
const RECT* rcExpect = (const RECT*)wParam;
RECT* rcResult = (RECT*)lParam;
rcResult->left = rcExpect->left;
rcResult->top = rcExpect->top;
rcResult->right = rcExpect->left + _WIDTH;
rcResult->bottom = rcExpect->top + _HEIGHT;
return 0;
}
rcResult->left = rcExpect->left;
rcResult->top = rcExpect->top;
rcResult->right = rcExpect->left + _WIDTH;
rcResult->bottom = rcExpect->top + _HEIGHT;
return 0;
}

View File

@@ -3,14 +3,14 @@
*/
case MSG_PAINT:
{
HDC hdc = BeginPaint (hWnd);
HDC hdc = BeginPaint (hWnd);
for (j = 0; j < 10; j ++) {
if (RectVisible (hdc, rcs + j)) {
FillBox (hdc, rcs[j].left, rcs[j].top, rcs [j].right, rcs [j].bottom);
}
}
for (j = 0; j < 10; j ++) {
if (RectVisible (hdc, rcs + j)) {
FillBox (hdc, rcs[j].left, rcs[j].top, rcs [j].right, rcs [j].bottom);
}
}
EndPaint (hWnd, hdc);
return 0;
EndPaint (hWnd, hdc);
return 0;
}

View File

@@ -53,15 +53,15 @@ static void GDIDemo_Region (HWND hWnd, HDC hdc)
FillBox (hdc, 400, 0, 180, 200);
/*
* Empty two clipping region to free the clipping rectangles used
/*
* Empty two clipping region to free the clipping rectangles used
* by them.
*/
EmptyClipRgn (&my_cliprgn1);
EmptyClipRgn (&my_cliprgn2);
/*
* You should not forget to destroy the FreeClipRectList in your
/*
* You should not forget to destroy the FreeClipRectList in your
* applications.
* Here we do not destroy the heap because we will use it in next call.
*

View File

@@ -7,7 +7,7 @@ static LRESULT StepControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
{
HDC hdc;
HELPWININFO* info;
switch (message) {
case MSG_PAINT:
hdc = BeginPaint (hwnd);

View File

@@ -3,7 +3,7 @@ typedef struct TEST_REQ
int a, b;
} TEST_REQ;
/*
/*
* In the server, we define the request handler
* and register it.
*/
@@ -11,7 +11,7 @@ static int ServerSendReply (int clifd, void* reply, int len)
{
MSG reply_msg = {HWND_INVALID, 0};
/*
/*
* Sending a null message to client in order to indicate this is
* a reply of a request.
*/

View File

@@ -1,5 +1,5 @@
/*
* This program which should be named "mginit" calls "ServerStartup"
* This program which should be named "mginit" calls "ServerStartup"
* to start the server of MiniGUI-Processes.
*/
int MiniGUIMain (int args, const char* arg[])

View File

@@ -9,7 +9,7 @@ BOOL listen_socket (HWND hwnd)
return RegisterListenFD (fd, POLL_IN, hwnd, NULL);
}
/*
/*
* When the server receives the request to connect from a client,
* the window hwnd will receive a MSG_FDEVENT message.
* Now the server can accept the request.
@@ -17,11 +17,11 @@ BOOL listen_socket (HWND hwnd)
LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
...
case MSG_FDEVENT:
if (LOWORD (wParam) == listen_fd) {
if (LOWORD (wParam) == listen_fd) {
/* This message comes from the listen socket fd. */
pid_t pid;
uid_t uid;
@@ -31,7 +31,7 @@ LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
RegisterListenFD (conn_fd, POLL_IN, hwnd, NULL);
}
}
else {
else {
/* Client send a request. */
int fd = LOWORD(wParam);
/* Handle the request from client. */
@@ -39,9 +39,9 @@ LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
sock_write_t (fd, ....);
}
break;
...
}
}
@@ -50,7 +50,7 @@ LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
int conn_fd;
if ((conn_fd = cli_conn (LISTEN_SOCKET, 'b')) >= 0) {
/* Send a request to the server. */
sock_write_t (fd, ....);

View File

@@ -35,20 +35,20 @@ static LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARA
{
HWND hWnd1, hWnd2, hWnd3;
CreateWindow (CTRL_STATIC, "Digit-only box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
CreateWindow (CTRL_STATIC, "Digit-only box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
10, 10, 180, 24, hWnd, 0);
hWnd1 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_VISIBLE | WS_BORDER, IDC_CTRL1,
hWnd1 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_VISIBLE | WS_BORDER, IDC_CTRL1,
200, 10, 180, 24, hWnd, MY_ES_DIGIT_ONLY);
CreateWindow (CTRL_STATIC, "Alpha-only box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
CreateWindow (CTRL_STATIC, "Alpha-only box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
10, 40, 180, 24, hWnd, 0);
hWnd2 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_BORDER | WS_VISIBLE, IDC_CTRL2,
hWnd2 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_BORDER | WS_VISIBLE, IDC_CTRL2,
200, 40, 180, 24, hWnd, MY_ES_ALPHA_ONLY);
CreateWindow (CTRL_STATIC, "Normal edit box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
CreateWindow (CTRL_STATIC, "Normal edit box:", WS_CHILD | WS_VISIBLE | SS_RIGHT, 0,
10, 70, 180, 24, hWnd, 0);
hWnd3 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_BORDER | WS_VISIBLE, IDC_CTRL2,
hWnd3 = CreateWindow (CTRL_EDIT, "", WS_CHILD | WS_BORDER | WS_VISIBLE, IDC_CTRL2,
200, 70, 180, 24, hWnd, MY_ES_ALPHA_ONLY);
CreateWindow ("button", "Close", WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, IDC_CTRL4,
CreateWindow ("button", "Close", WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, IDC_CTRL4,
100, 100, 60, 24, hWnd, 0);
/* Set new window procedure and save the old procedure. */

View File

@@ -39,11 +39,11 @@ static void InitCreateInfo (PMAINWINCREATE pCreateInfo)
pCreateInfo->hCursor = GetSystemCursor (0);
pCreateInfo->hIcon = 0;
pCreateInfo->MainWindowProc = HelloWinProc;
pCreateInfo->lx = 0;
pCreateInfo->ty = 0;
pCreateInfo->lx = 0;
pCreateInfo->ty = 0;
pCreateInfo->rx = 320;
pCreateInfo->by = 240;
pCreateInfo->iBkColor = PIXEL_lightwhite;
pCreateInfo->iBkColor = PIXEL_lightwhite;
pCreateInfo->dwAddData = 0;
pCreateInfo->hHosting = HWND_DESKTOP;
}