Commit 627d31fc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wineconsole: Reimplement as AllocConsole wrapper.

parent 859b526c
...@@ -3,10 +3,9 @@ APPMODE = -mwindows ...@@ -3,10 +3,9 @@ APPMODE = -mwindows
IMPORTS = advapi32 IMPORTS = advapi32
DELAYIMPORTS = comctl32 user32 gdi32 DELAYIMPORTS = comctl32 user32 gdi32
EXTRADLLFLAGS = -mwindows -municode -mno-cygwin
C_SRCS = \ C_SRCS = \
dialog.c \
registry.c \
user.c \
wineconsole.c wineconsole.c
RC_SRCS = wineconsole.rc RC_SRCS = wineconsole.rc
......
/*
* an application for displaying Win32 console
*
* Copyright 2001 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wincon.h>
#include <wine/condrv.h>
#include "wineconsole_res.h"
/* this is the configuration stored & loaded into the registry */
struct config_data {
DWORD color_map[16]; /* console color table */
unsigned cell_width; /* width in pixels of a character */
unsigned cell_height; /* height in pixels of a character */
int cursor_size; /* in % of cell height */
int cursor_visible;
DWORD def_attr; /* default fill attributes (screen colors) */
DWORD popup_attr; /* pop-up color attributes */
WCHAR face_name[32]; /* name of font (size is LF_FACESIZE) */
DWORD font_pitch_family;
DWORD font_weight;
DWORD history_size; /* number of commands in history buffer */
DWORD history_nodup; /* TRUE if commands are not stored twice in buffer */
DWORD insert_mode; /* TRUE to insert text at the cursor location; FALSE to overwrite it */
DWORD menu_mask; /* MK_CONTROL MK_SHIFT mask to drive submenu opening */
DWORD quick_edit; /* whether mouse ops are sent to app (false) or used for content selection (true) */
unsigned sb_width; /* active screen buffer width */
unsigned sb_height; /* active screen buffer height */
unsigned win_width; /* size (in cells) of visible part of window (width & height) */
unsigned win_height;
COORD win_pos; /* position (in cells) of visible part of screen buffer in window */
BOOL exit_on_die; /* whether the wineconsole should quit if server destroys the console */
unsigned edition_mode; /* edition mode flavor while line editing */
WCHAR* registry; /* <x> part of HKLU\\<x>\\Console where config is read from (NULL if default settings) */
};
struct inner_data {
struct config_data curcfg;
CHAR_INFO* cells; /* local copy of cells (sb_width * sb_height) */
COORD cursor; /* position in cells of cursor */
HANDLE console; /* console renderer handle */
HANDLE hProcess; /* handle to the child process or NULL */
HWND hWnd; /* handle of 'user' window or NULL for 'curses' */
INT nCmdShow; /* argument of WinMain */
BOOL in_set_config; /* to handle re-entrant calls to WINECON_SetConfig */
BOOL in_grab_changes;/* to handle re-entrant calls to WINECON_GrabChanges */
BOOL dying; /* to TRUE when we've been notified by server that child has died */
OVERLAPPED overlapped;
struct condrv_renderer_event events[256];
int (*fnMainLoop)(struct inner_data* data);
void (*fnPosCursor)(const struct inner_data* data);
void (*fnShapeCursor)(struct inner_data* data, int size, int vis, BOOL force);
void (*fnComputePositions)(struct inner_data* data);
void (*fnRefresh)(const struct inner_data* data, int tp, int bm);
void (*fnResizeScreenBuffer)(struct inner_data* data);
void (*fnSetTitle)(const struct inner_data* data);
void (*fnScroll)(struct inner_data* data, int pos, BOOL horz);
void (*fnSetFont)(struct inner_data* data, const WCHAR* font, unsigned height, unsigned weight);
void (*fnDeleteBackend)(struct inner_data* data);
void* private; /* data part belonging to the chosen backend */
};
/* from wineconsole.c */
extern void WINECON_Fatal(const char* msg);
extern void WINECON_ResizeWithContainer(struct inner_data* data, int width, int height);
extern int WINECON_GetHistorySize(HANDLE hConIn);
extern int WINECON_GetHistoryMode(HANDLE hConIn);
extern BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len);
extern void WINECON_GrabChanges(struct inner_data* data);
extern void WINECON_SetConfig(struct inner_data* data,
const struct config_data* cfg);
/* from registry.c */
extern void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg);
extern void WINECON_RegSave(const struct config_data* cfg);
extern void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg);
/* backends... */
enum init_return {
init_success, init_failed, init_not_supported
};
extern enum init_return WCUSER_InitBackend(struct inner_data* data);
/*
* an application for displaying Win32 console
* USER32 backend
*
* Copyright 2001 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include "winecon_private.h"
struct inner_data_user {
/* the following fields are only user by the USER backend (should be hidden in user) */
HFONT hFont; /* font used for rendering, usually fixed */
LONG ext_leading; /* external leading for hFont */
HDC hMemDC; /* memory DC holding the bitmap below */
HBITMAP hBitmap; /* bitmap of display window content */
HMENU hPopMenu; /* popup menu triggered by right mouse click */
HBITMAP cursor_bitmap; /* bitmap used for the caret */
BOOL has_selection; /* an area is being selected (selectPt[12] are edges of the rect) */
COORD selectPt1; /* start (and end) point of a mouse selection */
COORD selectPt2;
};
#define PRIVATE(data) ((struct inner_data_user*)((data)->private))
/* from user.c */
extern const COLORREF WCUSER_ColorMap[16];
extern BOOL WCUSER_GetProperties(struct inner_data*, BOOL);
extern BOOL WCUSER_ValidateFont(const struct inner_data* data, const LOGFONTW* lf, int pass);
extern BOOL WCUSER_ValidateFontMetric(const struct inner_data* data, const TEXTMETRICW* tm,
DWORD type, int pass);
extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd,
const LOGFONTW* lf, LONG* el);
extern void WCUSER_FillLogFont(LOGFONTW* lf, const WCHAR* name,
UINT height, UINT weight);
extern void WCUSER_DumpLogFont(const char* pfx, const LOGFONTW* lf, DWORD ft);
extern void WCUSER_DumpTextMetric(const TEXTMETRICW* tm, DWORD ft);
...@@ -8,10 +8,6 @@ wineconsole \- The Wine console ...@@ -8,10 +8,6 @@ wineconsole \- The Wine console
.B wineconsole .B wineconsole
is the Wine console manager, used to run console commands and applications. It allows running the is the Wine console manager, used to run console commands and applications. It allows running the
console either in the current terminal (\fIcurses\fR) or in a newly made window (\fIuser\fR). console either in the current terminal (\fIcurses\fR) or in a newly made window (\fIuser\fR).
.SH "OPTIONS"
.IP \fB\-\-backend=\fR{\fIuser\fR|\fIcurses\fR}
If \fIuser\fR is chosen, a new window will be created for the console. The \fIcurses\fR option will make
wineconsole try to setup the current terminal as a Wine console.
.SH BUGS .SH BUGS
Bugs can be reported on the Bugs can be reported on the
.UR https://bugs.winehq.org .UR https://bugs.winehq.org
......
...@@ -24,111 +24,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT ...@@ -24,111 +24,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE STRINGTABLE
BEGIN BEGIN
IDS_EDIT, "&Edit"
IDS_DEFAULT, "Set &Defaults"
IDS_PROPERTIES, "&Properties"
IDS_MARK, "&Mark"
IDS_COPY, "&Copy"
IDS_PASTE, "&Paste"
IDS_SELECTALL, "&Select all"
IDS_SCROLL, "Sc&roll"
IDS_SEARCH, "S&earch"
IDS_FNT_DISPLAY, "Each character is %1!u! pixels wide and %2!u! pixels high"
IDS_FNT_PREVIEW, "This is a test"
IDS_DLG_TIT_DEFAULT, "Setup - Default settings"
IDS_DLG_TIT_CURRENT, "Setup - Current settings"
IDS_DLG_TIT_ERROR, "Configuration error"
IDS_DLG_ERR_SBWINSIZE, "The size of the screen buffer must be greater than or equal to the size of the window."
IDS_CMD_INVALID_EVENT_ID "wineconsole: Couldn't parse event id\n"
IDS_CMD_INVALID_BACKEND "wineconsole: Invalid backend\n"
IDS_CMD_INVALID_OPTION "wineconsole: Unrecognized command line option\n"
IDS_CMD_ABOUT "Starts a program in a Wine console\n"
IDS_CMD_LAUNCH_FAILED "wineconsole: Starting program %s failed.\nThe command is invalid.\n" IDS_CMD_LAUNCH_FAILED "wineconsole: Starting program %s failed.\nThe command is invalid.\n"
IDS_USAGE_HEADER "\nUsage:\n wineconsole [options] <command>\n\nOptions:\n"
IDS_USAGE_COMMAND " <command> The Wine program to launch in the console.\n"
IDS_USAGE_FOOTER "\nExample:\n wineconsole cmd\nStarts the Wine command prompt in a Wine console.\n\n"
END END
IDD_OPTION DIALOG 36, 24, 140, 109
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Shell Dlg"
{
GROUPBOX "Cursor size", -1, 5, 5, 70, 54, BS_GROUPBOX
AUTORADIOBUTTON "&Small", IDC_OPT_CURSOR_SMALL, 9, 18, 50, 10, WS_TABSTOP
AUTORADIOBUTTON "&Medium", IDC_OPT_CURSOR_MEDIUM, 9, 30, 50, 10, WS_TABSTOP
AUTORADIOBUTTON "&Large", IDC_OPT_CURSOR_LARGE, 9, 42, 50, 10, WS_TABSTOP
GROUPBOX "Command history", -1, 80, 5, 120, 54, BS_GROUPBOX
LTEXT "&Buffer size:", -1, 84, 20, 70, 10
EDITTEXT IDC_OPT_HIST_SIZE, 154, 18, 40, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER
CONTROL "", IDC_OPT_HIST_SIZE_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0
AUTOCHECKBOX "&Remove duplicates", IDC_OPT_HIST_NODOUBLE, 84, 36, 100, 10, WS_TABSTOP|BS_MULTILINE
GROUPBOX "Popup menu", -1, 5, 61, 70, 42, BS_GROUPBOX
AUTOCHECKBOX "&Control", IDC_OPT_CONF_CTRL, 9, 74, 60, 10, WS_TABSTOP
AUTOCHECKBOX "S&hift", IDC_OPT_CONF_SHIFT, 9, 86, 60, 10, WS_TABSTOP
GROUPBOX "Console", -1, 80, 61, 120, 42, BS_GROUPBOX
AUTOCHECKBOX "&Quick Edit mode", IDC_OPT_QUICK_EDIT, 84, 74, 100, 10, WS_TABSTOP
AUTOCHECKBOX "&Insert mode", IDC_OPT_INSERT_MODE, 84, 86, 100, 10, WS_TABSTOP
}
IDD_FONT DIALOG 36, 24, 140, 109
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Font"
FONT 8, "MS Shell Dlg"
{
LTEXT "&Font", -1, 5, 5, 50, 8
LISTBOX IDC_FNT_LIST_FONT, 5, 18, 90, 42, LBS_SORT|WS_VSCROLL
LTEXT "&Color", -1, 100, 5, 50, 8
CONTROL "", IDC_FNT_COLOR_FG, "WineConColorPreview", 0L, 100, 18, 48, 16
CONTROL "", IDC_FNT_COLOR_BK, "WineConColorPreview", 0L, 100, 40, 48, 16
LTEXT "&Size", -1, 158, 5, 40, 8
LISTBOX IDC_FNT_LIST_SIZE, 158, 18, 40, 60, WS_VSCROLL
CONTROL "", IDC_FNT_PREVIEW, "WineConFontPreview", 0L, 5, 60, 109, 40
LTEXT "", IDC_FNT_FONT_INFO, 128, 73, 80, 27
}
IDD_CONFIG DIALOG 36, 24, 140, 109
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Configuration"
FONT 8, "MS Shell Dlg"
{
GROUPBOX "Buffer zone", -1, 10, 11, 100, 42, BS_GROUPBOX
LTEXT "&Width:", -1, 14, 25, 54, 9
EDITTEXT IDC_CNF_SB_WIDTH, 68, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER
CONTROL "", IDC_CNF_SB_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0
LTEXT "&Height:", -1, 14, 39, 54, 9
EDITTEXT IDC_CNF_SB_HEIGHT, 68, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER
CONTROL "", IDC_CNF_SB_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0
GROUPBOX "Window size", -1, 10, 55, 100, 42
LTEXT "W&idth:", -1, 14, 69, 54, 9
EDITTEXT IDC_CNF_WIN_WIDTH, 68, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER
CONTROL "", IDC_CNF_WIN_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0
LTEXT "H&eight:", -1, 14, 83, 54, 9
EDITTEXT IDC_CNF_WIN_HEIGHT, 68, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER
CONTROL "", IDC_CNF_WIN_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0
GROUPBOX "End of program", -1, 115, 11, 85, 42, BS_GROUPBOX
AUTOCHECKBOX "&Close console", IDC_CNF_CLOSE_EXIT, 119, 25, 75, 20, WS_TABSTOP
GROUPBOX "Edition", -1, 115, 55, 85, 42
COMBOBOX IDC_CNF_EDITION_MODE, 119, 69, 75, 60, CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP
}
IDD_SAVE_SETTINGS DIALOG 20, 20, 210, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Console parameters"
FONT 8, "MS Shell Dlg"
{
AUTORADIOBUTTON "Retain these settings for later sessions", IDC_SAV_SAVE, 10, 8, 200, 10, WS_TABSTOP
AUTORADIOBUTTON "Modify only current session", IDC_SAV_SESSION, 10, 22, 200, 10, WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 100, 43, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 155, 43, 50, 14
}
...@@ -22,72 +22,4 @@ ...@@ -22,72 +22,4 @@
#include <winuser.h> #include <winuser.h>
#include <commctrl.h> #include <commctrl.h>
/* strings */
#define IDS_EDIT 0x100
#define IDS_DEFAULT 0x101
#define IDS_PROPERTIES 0x102
#define IDS_MARK 0x110
#define IDS_COPY 0x111
#define IDS_PASTE 0x112
#define IDS_SELECTALL 0x113
#define IDS_SCROLL 0x114
#define IDS_SEARCH 0x115
#define IDS_DLG_TIT_DEFAULT 0x120
#define IDS_DLG_TIT_CURRENT 0x121
#define IDS_DLG_TIT_ERROR 0x122
#define IDS_DLG_ERR_SBWINSIZE 0x130
#define IDS_FNT_DISPLAY 0x200
#define IDS_FNT_PREVIEW 0x201
#define IDS_CMD_INVALID_EVENT_ID 0x300
#define IDS_CMD_INVALID_BACKEND 0x301
#define IDS_CMD_INVALID_OPTION 0x302
#define IDS_CMD_ABOUT 0x303
#define IDS_CMD_LAUNCH_FAILED 0x304 #define IDS_CMD_LAUNCH_FAILED 0x304
#define IDS_USAGE_HEADER 0x310
#define IDS_USAGE_COMMAND 0x312
#define IDS_USAGE_FOOTER 0x313
/* dialog boxes */
#define IDD_OPTION 0x0100
#define IDD_FONT 0x0200
#define IDD_CONFIG 0x0300
#define IDD_SAVE_SETTINGS 0x0400
/* dialog boxes controls */
#define IDC_OPT_CURSOR_SMALL 0x0101
#define IDC_OPT_CURSOR_MEDIUM 0x0102
#define IDC_OPT_CURSOR_LARGE 0x0103
#define IDC_OPT_HIST_SIZE 0x0104
#define IDC_OPT_HIST_SIZE_UD 0x0105
#define IDC_OPT_HIST_NODOUBLE 0x0106
#define IDC_OPT_CONF_CTRL 0x0107
#define IDC_OPT_CONF_SHIFT 0x0108
#define IDC_OPT_QUICK_EDIT 0x0109
#define IDC_OPT_INSERT_MODE 0x0110
#define IDC_FNT_LIST_FONT 0x0201
#define IDC_FNT_LIST_SIZE 0x0202
#define IDC_FNT_COLOR_BK 0x0203
#define IDC_FNT_COLOR_FG 0x0204
#define IDC_FNT_FONT_INFO 0x0205
#define IDC_FNT_PREVIEW 0x0206
#define IDC_CNF_SB_WIDTH 0x0301
#define IDC_CNF_SB_WIDTH_UD 0x0302
#define IDC_CNF_SB_HEIGHT 0x0303
#define IDC_CNF_SB_HEIGHT_UD 0x0304
#define IDC_CNF_WIN_WIDTH 0x0305
#define IDC_CNF_WIN_WIDTH_UD 0x0306
#define IDC_CNF_WIN_HEIGHT 0x0307
#define IDC_CNF_WIN_HEIGHT_UD 0x0308
#define IDC_CNF_CLOSE_EXIT 0x0309
#define IDC_CNF_EDITION_MODE 0x030a
#define IDC_SAV_SAVE 0x0401
#define IDC_SAV_SESSION 0x0402
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment