nuke console

This commit is contained in:
Marco Antonio J. Costa
2025-08-31 13:50:19 -03:00
committed by majcosta
parent 5d3cc7969f
commit e5d25810f6
17 changed files with 0 additions and 6920 deletions
-2
View File
@@ -53,7 +53,6 @@ include_directories(
"${CMAKE_SOURCE_DIR}/Laptop"
"${CMAKE_SOURCE_DIR}/Multiplayer"
"${CMAKE_SOURCE_DIR}/Editor"
"${CMAKE_SOURCE_DIR}/Console"
"${CMAKE_SOURCE_DIR}/i18n/include"
)
@@ -88,7 +87,6 @@ wine
# static libraries whose translation units rely on Application preprocessor definitions.
set(Ja2_Libs
Console
Editor
Ja2
Laptop
-6
View File
@@ -1,6 +0,0 @@
set(ConsoleSrc
"${CMAKE_CURRENT_SOURCE_DIR}/Console.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Cursors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Dialogs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FileStream.cpp"
PARENT_SCOPE)
-81
View File
@@ -1,81 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
#ifndef _COMBSTROUT_H_
#define _COMBSTROUT_H_
/////////////////////////////////////////////////////////////////////////////
// CComBSTROut - a class that inherits from CComBSTR and adds Out() method
// that should be used instead of & operator for 'out'
// function parameters
class CComBSTROut : public CComBSTR
{
public:
CComBSTROut()
{
}
/*explicit*/ CComBSTROut(int nSize) : CComBSTR(nSize)
{
}
/*explicit*/ CComBSTROut(int nSize, LPCOLESTR sz) : CComBSTR(nSize, sz)
{
}
/*explicit*/ CComBSTROut(LPCOLESTR pSrc) : CComBSTR(pSrc)
{
}
/*explicit*/ CComBSTROut(const CComBSTROut& src) : CComBSTR(src)
{
}
/*explicit*/ CComBSTROut(REFGUID src) : CComBSTR(src)
{
}
#ifndef OLE2ANSI
CComBSTROut(LPCSTR pSrc) : CComBSTR(pSrc)
{
}
CComBSTROut(int nSize, LPCSTR sz) : CComBSTR(nSize, sz)
{
}
#endif
~CComBSTROut()
{
CComBSTR::~CComBSTR();
}
BSTR* Out()
{
Empty();
return &m_str;
}
};
/////////////////////////////////////////////////////////////////////////////
#endif // _COMBSTROUT_H_
-109
View File
@@ -1,109 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
#ifndef _COMVARIANTOUT_H_
#define _COMVARIANTOUT_H_
/////////////////////////////////////////////////////////////////////////////
// CComVariantOut - a class that inherits from CComVariant and adds Out()
// method that should be used instead of & operator for
// 'out' function parameters
class CComVariantOut : public CComVariant
{
public:
CComVariantOut()
{
}
~CComVariantOut()
{
CComVariant::~CComVariant();
}
CComVariantOut(const VARIANT& varSrc) : CComVariant(varSrc)
{
}
CComVariantOut(const CComVariant& varSrc) : CComVariant(varSrc)
{
}
CComVariantOut(BSTR bstrSrc) : CComVariant(bstrSrc)
{
}
CComVariantOut(LPCOLESTR lpszSrc) : CComVariant(lpszSrc)
{
}
#ifndef OLE2ANSI
CComVariantOut(LPCSTR lpszSrc) : CComVariant(lpszSrc)
{
}
#endif
CComVariantOut(bool bSrc) : CComVariant(bSrc)
{
}
CComVariantOut(int nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(BYTE nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(short nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(long nSrc, VARTYPE m_varSrc = VT_I4) : CComVariant(nSrc, m_varSrc)
{
}
CComVariantOut(float fltSrc) : CComVariant(fltSrc)
{
}
CComVariantOut(double dblSrc) : CComVariant(dblSrc)
{
}
CComVariantOut(CY cySrc) : CComVariant(cySrc)
{
}
CComVariantOut(IDispatch* pSrc) : CComVariant(pSrc)
{
}
CComVariantOut(IUnknown* pSrc) : CComVariant(pSrc)
{
}
public:
VARIANT* Out()
{
Clear();
return this;
}
};
/////////////////////////////////////////////////////////////////////////////
#endif // _COMVARIANTOUT_H_
-2876
View File
File diff suppressed because it is too large Load Diff
-746
View File
@@ -1,746 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Console.h - console class declaration
#pragma once
#include <string>
#include <vector>
using namespace std;
//#include "include/FreeImagePlus.h"
typedef basic_string<TCHAR> tstring;
#define WM_INPUTREADY WM_USER + 1
// tray icon message
#define WM_TRAY_NOTIFY WM_USER + 0x123
#define TRAY_ICON_ID 1
// timer #defines
#define TIMER_REPAINT_CHANGE 42 // timer that is started after there
// were some changes in the console
#define TIMER_REPAINT_MASTER 43 // master timer (needed to repaint
// for some DOS programs, can be
// disabled for lower CPU usage)
#define TIMER_SHOW_HIDE_CONSOLE 100 // used to hide console window when
// starting shell process after a
// defined period of time (some
// shells, like 4NT need console
// window visible during startup for
// all init options to work properly
// transparency #defines
#define TRANSPARENCY_NONE 0
#define TRANSPARENCY_ALPHA 1
#define TRANSPARENCY_COLORKEY 2
#define TRANSPARENCY_FAKE 3
// cusror style #defines
#define CURSOR_STYLE_NONE 0
#define CURSOR_STYLE_XTERM 1
#define CURSOR_STYLE_BLOCK 2
#define CURSOR_STYLE_NBBLOCK 3
#define CURSOR_STYLE_PULSEBLOCK 4
#define CURSOR_STYLE_BAR 5
#define CURSOR_STYLE_CONSOLE 6
#define CURSOR_STYLE_NBHLINE 7
#define CURSOR_STYLE_HLINE 8
#define CURSOR_STYLE_VLINE 9
#define CURSOR_STYLE_RECT 10
#define CURSOR_STYLE_NBRECT 11
#define CURSOR_STYLE_PULSERECT 12
#define CURSOR_STYLE_FADEBLOCK 13
// docking #defines
#define DOCK_NONE 0
#define DOCK_TOP_LEFT 1
#define DOCK_TOP_RIGHT 2
#define DOCK_BOTTOM_RIGHT 3
#define DOCK_BOTTOM_LEFT 4
// Z-order #defines
#define Z_ORDER_REGULAR 0
#define Z_ORDER_ONTOP 1
#define Z_ORDER_ONBOTTOM 2
// window border defines
#define BORDER_NONE 0
#define BORDER_REGULAR 1
#define BORDER_THIN 2
// window background style
#define BACKGROUND_STYLE_RESIZE 0
#define BACKGROUND_STYLE_CENTER 1
#define BACKGROUND_STYLE_TILE 2
// taskbar button defines
#define TASKBAR_BUTTON_NORMAL 0
#define TASKBAR_BUTTON_HIDE 1
#define TASKBAR_BUTTON_TRAY 2
// new configuration auto-reload defines
#define RELOAD_NEW_CONFIG_PROMPT 0
#define RELOAD_NEW_CONFIG_YES 1
#define RELOAD_NEW_CONFIG_NO 2
#define TEXT_SELECTION_NONE 0
#define TEXT_SELECTION_SELECTING 1
#define TEXT_SELECTION_SELECTED 2
/////////////////////////////////////////////////////////////////////////////
// Console class
class Console {
public: // ctor/dtor
Console(LPCTSTR szConfigFile, LPCTSTR szShellCmdLine, LPCTSTR szConsoleTitle, LPCTSTR pszReloadNewConfig);
~Console();
public:
// creates and shows Console window
BOOL Create(HWND notify);
private:
////////////////////
// message handlers
////////////////////
////////////////////////////////
// windows destruction messages
// destroys GDI stuff and posts a quit message
void OnDestroy();
// deletes Console object
void OnNcDestroy();
/////////////////////
// painting messages
// handles painting from off-screen buffers
void OnPaint();
// handles master and 'change' timers
void OnPaintTimer();
// handles cursor timer (for animated cursors)
void OnCursorTimer();
/////////////////////////
// window state messages
// handles window position changes (for snapping to desktop edges)
void OnWindowPosChanging(WINDOWPOS* lpWndPos);
// handles activation message (used for setting alpha transparency and cursor states)
void OnActivateApp(BOOL bActivate, DWORD dwFlags);
// handles vertical scrolling
void OnVScroll(WPARAM wParam);
// handles keyboard layout change, posts the same message to the windows console window
void OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam);
//////////////////
// mouse messages
// handles text selection start and window mouse drag start
void OnLButtonDown(UINT uiFlags, POINTS points);
// handles text selection end, window mouse drag end and text copy
void OnLButtonUp(UINT uiFlags, POINTS points);
// toggles always on top flag
void OnLButtonDblClick(UINT uiFlags, POINTS points);
// pops up the Console menu
void OnRButtonUp(UINT uiFlags, POINTS points);
// pastes text from clipboard
void OnMButtonDown(UINT uiFlags, POINTS points);
// handles mouse movement for text selection and window mouse drag
void OnMouseMove(UINT uiFlags, POINTS points);
// handles start/stop mouse drag for window border
void OnSetCursor(WORD wHitTest, WORD wMouseMessage);
// handles text input
void OnChar(WORD mychar);
wstring Input;
//////////////////
// other messages
// called before the Console menu or system menu pops up
// (populates config files submenu with filenames)
void OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu);
// handles drag-n-dropped filenames
void OnDropFiles(HDROP hDrop);
// handles commands from the Console popup menu
BOOL OnCommand(WPARAM wParam, LPARAM lParam);
// handles commands from the system popup menu
BOOL OnSysCommand(WPARAM wParam, LPARAM lParam);
// handles tray icon messages
void OnTrayNotify(WPARAM wParam, LPARAM lParam);
// handles WM_SETTINGCHANGE (we handle only wallpaper changes here)
// void OnWallpaperChanged(const TCHAR* pszFilename);
private:
///////////////////////////////////////////
// Console window creation/setup functions
///////////////////////////////////////////
// gets Console options
BOOL GetOptions();
// registers Console window classes
BOOL RegisterWindowClasses();
// adds stuff to system and popup menus
BOOL SetupMenus();
// creates Console window
BOOL CreateConsoleWindow();
// creates new Console font
void CreateNewFont();
// creates new background brush
void CreateNewBrush();
// creates the cursor
void CreateCursor();
// creates offscreen painting buffers
void CreateOffscreenBuffers();
// creates background bitmap
void CreateBackgroundBitmap();
// called by the ::EnumDisplayMonitors to create background for each display
// static BOOL CALLBACK BackgroundEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
// gets character width and height
void GetTextSize();
// gets window borders (X, Y and caption sizes)
void GetBordersDimensions();
// calculates window and client area sizes
void CalcWindowSize();
// sets up window transparency (alpha, color key, fake)
// void SetWindowTransparency();
// sets scrollbar stuff
void SetScrollbarStuff();
// sets default console colors
void SetDefaultConsoleColors();
// sets window size and position
void SetWindowSizeAndPosition();
// sets Console's big, small and tray icons
void SetWindowIcons();
// sets up traybar icon
BOOL SetTrayIcon(DWORD dwMessage);
// destroys Console cursor
void DestroyCursor();
// opens the configuration file in a text editor
void EditConfigFile();
// reloads Console settings
void ReloadSettings();
/////////////////////////////
// windows console functions
/////////////////////////////
// allocates the console and starts the command shell
BOOL StartShellProcess();
// refreshes m_hStdOutFresh handle
void RefreshStdOut();
// gets a fresh console output
void RefreshScreenBuffer();
// sets initial windows console size
void InitConsoleWndSize(DWORD dwColumns);
// resizes the windows console
void ResizeConsoleWindow();
// Allocates the screen buffer
void AllocateBuffer();
//////////////////////
// painting functions
//////////////////////
// repaints the memory hdc
void RepaintWindow();
// repaints the memory hdc (paint only changes)
void RepaintWindowChanges();
// draws the cursor
void DrawCursor(BOOL bOnlyCursor = FALSE);
// two helper functions for DrawCursor method
// returns cursor rectangle
inline void GetCursorRect(RECT& rectCursor);
// draws cursor background and returns the cursor rectangle
inline void DrawCursorBackground(RECT& rectCursor);
// clears text selection
void ClearSelection();
// returns the console text change rate since the last painting
// (using this value we decide whether to repaint entire window
// or just the changes)
DWORD GetChangeRate();
//////////////////////////
// window state functions
//////////////////////////
// shows/hides Console window
void ShowHideWindow();
// shows/hides windows console window
void ShowHideConsole();
// shows/hides windows console window after a timeout (used during
// shell startup)
void ShowHideConsoleTimeout();
// toggles 'always on top' status
void ToggleWindowOnTop();
//////////////////
// menu functions
//////////////////
// called by OnCommand and OnSysCommand to handle menu commands
BOOL HandleMenuCommand(DWORD dwID);
// updates popup and system menus for 'always on top' status
void UpdateOnTopMenuItem();
// updates popup and system menus for 'hide console' status
void UpdateHideConsoleMenuItem();
// updates configuration files submenu
void UpdateConfigFilesSubmenu();
///////////////////////
// clipboard functions
///////////////////////
// copies selected text to the clipboard
void CopyTextToClipboard();
// pastes text from the clipboard
void PasteClipoardText();
//////////////////
// misc functions
//////////////////
// shows Readme.txt file
void ShowReadmeFile();
// shows about dialog
void About();
// sends text to the windows console
void SendTextToConsole(const wchar_t *pszText);
// returns the full filename
tstring GetFullFilename(const tstring& strFilename);
// gets a desktop rectangle
void GetDesktopRect(RECT& rectDesktop);
// Pulls the text from the stdout or stderr handle (both are the same) and sends it to the console
void AddOutput();
///////////////////////
// 'gearbox' functions
///////////////////////
// Console window procedure
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// shell activities monitor
static DWORD WINAPI MonitorThreadStatic(LPVOID lpParam);
DWORD MonitorThread();
// CTRL+C, CTRL+BREAK handler
static BOOL WINAPI CtrlHandler(DWORD dwCtrlType);
public: // public data
// Console window handle
HWND m_hWnd;
HWND m_notifyhWnd;
// console colors
COLORREF m_arrConsoleColors[16];
private: // private data
// readem filename
tstring m_strReadmeFile;
BOOL m_bInitializing;
BOOL m_bReloading;
tstring m_strConfigFile;
tstring m_strConfigEditor;
tstring m_strConfigEditorParams;
// one of the RELOAD_NEW_CONFIG_* constants
// - specifies relaod behaviour when a new configuration is selected
// (auto reload, don't reload, ask user)
DWORD m_dwReloadNewConfigDefault;
DWORD m_dwReloadNewConfig;
tstring m_strShell;
tstring m_strShellCmdLine;
// handle to invisible window - used for hiding the taskbar button in tray and 'hidden' modes
HWND m_hwndInvisParent;
// memory device context that holds console output image
HDC m_hdcConsole;
// memory device context for an off-screen window buffer (used to
// compose an image from m_hdcConsole and m_hdcSelection if text
// selection is active)
HDC m_hdcWindow;
// a bitmap used for drawing in the console memory DC
HBITMAP m_hbmpConsole;
HBITMAP m_hbmpConsoleOld;
// a bitmap used for drawing in the window memory DC
HBITMAP m_hbmpWindow;
HBITMAP m_hbmpWindowOld;
// brush for painting background
HBRUSH m_hBkBrush;
// master repaint timer interval (runs independent of changes in the
// console)
DWORD m_dwMasterRepaintInt;
// change repaint timer interval (when a change occurs, repainting
// will be postponed for this interval)
DWORD m_dwChangeRepaintInt;
// icon filename
tstring m_strIconFilename;
// program icons
HICON m_hSmallIcon;
HICON m_hBigIcon;
// popup menu
HMENU m_hPopupMenu;
// system (taskbar button) menu
HMENU m_hSysMenu;
// submenu for the XML (config) files
HMENU m_hConfigFilesMenu;
// set to TRUE if the popup menu is disabled
BOOL m_bPopupMenuDisabled;
// Console window title variables
// holds the default console title ("console" or the one passed in the cmdline param)
tstring m_strWindowTitleDefault;
// holds the window title (default title, or the one from the config file)
tstring m_strWindowTitle;
// holds the current window title
tstring m_strWindowTitleCurrent;
// font data
tstring m_strFontName;
DWORD m_dwFontSize;
BOOL m_bBold;
BOOL m_bItalic;
BOOL m_bUseFontColor;
COLORREF m_crFontColor;
HFONT m_hFont;
HFONT m_hFontOld;
// window X and Y positions
int m_nX;
int m_nY;
// client area inside border (gives a more 'relaxed' look to windows)
int m_nInsideBorder;
// window width and height
int m_nWindowWidth;
int m_nWindowHeight;
// window border sizes
int m_nXBorderSize;
int m_nYBorderSize;
int m_nCaptionSize;
// client area widht/height
int m_nClientWidth;
int m_nClientHeight;
// char height and width (used in window repainting)
// Note: width is used only for fixed-pitch fonts to speed up
// repainting
int m_nCharHeight;
int m_nCharWidth;
// window border type
// 0 - none
// 1 - regular window
// 2 - 1-pixel thin border
DWORD m_dwWindowBorder;
// scrollbar stuff
BOOL m_bShowScrollbar;
int m_nScrollbarStyle;
COLORREF m_crScrollbarColor;
int m_nScrollbarWidth;
int m_nScrollbarButtonHeight;
int m_nScrollbarThunmbHeight;
// what to do with the taskbar button
// if the taskbar button is hidden, or placed in the traybar, you
// can't ALT-TAB to console (take care when using with color key
// transparency :-)
// 0 - nothing
// 1 - hide it
// 2 - put icon to traybar
DWORD m_dwTaskbarButton;
// set to TRUE if the window can be dragged by left-click hold
BOOL m_bMouseDragable;
// snap distance
int m_nSnapDst;
// window docking position
// 0 - no dock
// 1 - top left
// 2 - top right
// 3 - bottom right
// 4 - bottom left
DWORD m_dwDocked;
// window Z-ordering
// 0 - regular
// 1 - always on top
// 2 - always on bottom
DWORD m_dwOriginalZOrder;
DWORD m_dwCurrentZOrder;
// Win2000/XP transparency
// 0 - none
// 1 - alpha blending
// 2 - colorkey
// 3 - fake transparency
DWORD m_dwTransparency;
// alpha value for alpha blending (Win2000 and later only!)
BYTE m_byAlpha;
// alpha value for inactive window
BYTE m_byInactiveAlpha;
COLORREF m_crBackground;
COLORREF m_crConsoleBackground;
// this is used for tinting background images and fake transparencies
BOOL m_bTintSet;
BYTE m_byTintOpacity;
BYTE m_byTintR;
BYTE m_byTintG;
BYTE m_byTintB;
// used when background is an image
BOOL m_bBitmapBackground;
tstring m_strBackgroundFile;
HDC m_hdcBackground;
HBITMAP m_hbmpBackground;
HBITMAP m_hbmpBackgroundOld;
// background attributes
// one of BACKGROUND_STYLE_ #defines
DWORD m_dwBackgroundStyle;
// set to true for relative background
BOOL m_bRelativeBackground;
// set to true to extend the background to all monitors
BOOL m_bExtendBackground;
// offsets used for multiple monitors and relative backgrounds (fake transparency, too)
int m_nBackgroundOffsetX;
int m_nBackgroundOffsetY;
// used for showing/hiding main window
BOOL m_bHideWindow;
// set to TRUE when the real console is hidden
BOOL m_bHideConsole;
// timeout used when hiding console window for the first time (some
// shells need console window visible during startup)
DWORD m_dwHideConsoleTimeout;
// if set to TRUE, Console will be started minimized
BOOL m_bStartMinimized;
// cursor style
// 0 - none
// 1 - XTerm
// 2 - block cursor
// 3 - bar cursor
// 4 - console cursor
// 5 - horizontal line
// 6 - vertical line
// 7 - pulse rect
// 8 - fading block
DWORD m_dwCursorStyle;
COLORREF m_crCursorColor;
// console screen buffer info for cursor
CONSOLE_SCREEN_BUFFER_INFO m_csbiCursor;
// wether console cursor is visible or not
BOOL m_bCursorVisible;
class Cursor* m_pCursor;
// mouse cursor offset within the window (used for moving the window)
POINT m_mouseCursorOffset;
/////////////////////
// console stuff
// console window handle
HWND m_hWndConsole;
// console screen buffer info for console repainting
CONSOLE_SCREEN_BUFFER_INFO m_csbiConsole;
// console stdouts
HANDLE m_hStdOut;
HANDLE m_hStdOutFresh;
// set when quitting the application
HANDLE m_hQuitEvent;
// set by monitor thread when detects console process exit
HANDLE m_hConsoleProcess;
// handle to monitor thread
HANDLE m_hMonitorThread;
// console rows & columns
DWORD m_dwRows;
DWORD m_dwColumns;
DWORD m_dwBufferRows;
BOOL m_bUseTextBuffer;
// set to one of TEXT_SELECTION_ #defines
int m_nTextSelection;
// X Windows style copy-on-select
BOOL m_bCopyOnSelect;
// Inverse the shift behaviour for selecting and dragging
BOOL m_bInverseShift;
COORD m_coordSelOrigin;
RECT m_rectSelection;
HDC m_hdcSelection;
HBITMAP m_hbmpSelection;
HBITMAP m_hbmpSelectionOld;
HBRUSH m_hbrushSelection;
CHAR_INFO* m_pScreenBuffer;
CHAR_INFO* m_pScreenBufferNew;
DWORD m_nTextColor;
DWORD m_nTextBgColor;
// Console window class names
static const TCHAR m_szConsoleClass[];
static const TCHAR m_szHiddenParentClass[];
// win console window title
static const tstring m_strWinConsoleTitle;
};
/////////////////////////////////////////////////////////////////////////////
-208
View File
@@ -1,208 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "res\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
#define IDC_STATIC 00
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 146, 87
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_CENTER | WS_POPUP |
WS_CAPTION | WS_SYSMENU
CAPTION "About Console"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,48,66,50,14
LTEXT "Console v1.5",IDC_STATIC,51,11,42,8
LTEXT "Copyright© 2001-2005 Marko Bozikovic",IDC_STATIC,9,30,
127,8
LTEXT "bozho@kset.org",IDC_STATIC,46,45,53,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 139
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
END
#endif // APSTUDIO_INVOKED
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
//IDI_ICON2 ICON DISCARDABLE "Console.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_POPUP_MENU MENU DISCARDABLE
BEGIN
POPUP " "
BEGIN
// MENUITEM "Read&me", ID_SHOW_README_FILE
MENUITEM "&About Console", ID_ABOUT
MENUITEM SEPARATOR
MENUITEM "&Copy", ID_COPY
MENUITEM "&Paste", ID_PASTE
MENUITEM SEPARATOR
// MENUITEM "Always on &top", ID_TOGGLE_ONTOP
// MENUITEM "&Hide console", ID_HIDE_CONSOLE
// MENUITEM SEPARATOR
// MENUITEM "&Select configuration file", ID_SEL_CONFIG_FILE
// MENUITEM "&Edit configuration file", ID_EDIT_CONFIG_FILE
// MENUITEM "&Reload settings", ID_RELOAD_SETTINGS
// MENUITEM SEPARATOR
MENUITEM "E&xit", ID_EXIT_CONSOLE
END
END
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Croatian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HRV)
#ifdef _WIN32
LANGUAGE LANG_CROATIAN, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,0,351
PRODUCTVERSION 1,5,0,351
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "A cool console window :-)\0"
VALUE "CompanyName", "Ingenuity Unlimited Ltd.\0"
VALUE "FileDescription", "Console\0"
VALUE "FileVersion", "1.5, Build 351 2005.09.22\0"
VALUE "InternalName", "Console\0"
VALUE "LegalCopyright", "Copyright © 2001-2004 Marko Bozikovic\0"
VALUE "LegalTrademarks", "Copyright © 2001-2004 Marko Bozikovic\0"
VALUE "OriginalFilename", "Console.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Console\0"
VALUE "ProductVersion", "1.5.00.351\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // !_MAC
#endif // Croatian resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-769
View File
@@ -1,769 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Cursors.h - cursor classes
//#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include "Cursors.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// XTermCursor
XTermCursor::XTermCursor(HWND hwndConsole, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndConsole, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_hInactiveBrush(::CreateSolidBrush(crCursorColor))
{
}
XTermCursor::~XTermCursor() {
::DeleteObject(m_hActiveBrush);
::DeleteObject(m_hInactiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void XTermCursor::Draw(LPRECT pRect) {
if (m_bActive) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
} else {
::FrameRect(m_hdcWindow, pRect, m_hInactiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void XTermCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BlockCursor
BlockCursor::BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
BlockCursor::~BlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BlockCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BlockCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBBlockCursor
NBBlockCursor::NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
{
}
NBBlockCursor::~NBBlockCursor() {
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBBlockCursor::Draw(LPRECT pRect) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBBlockCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseBlockCursor
PulseBlockCursor::PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_nSize(0)
, m_nMaxSize(0)
, m_nStep(0)
{
::ZeroMemory(&m_rect, sizeof(RECT));
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
PulseBlockCursor::~PulseBlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseBlockCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nMaxSize == 0) {
if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) {
m_nMaxSize = (pRect->right - pRect->left) >> 1;
} else {
m_nMaxSize = (pRect->bottom - pRect->top) >> 1;
}
}
if (m_bActive) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
rect.left += m_nSize;
rect.top += m_nSize;
rect.right -= m_nSize;
rect.bottom -= m_nSize;
::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseBlockCursor::PrepareNext() {
if (m_nSize == 0) {
m_nStep = 1;
} else if (m_nSize == m_nMaxSize) {
m_nStep = -1;
}
m_nSize += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BarCursor
BarCursor::BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
BarCursor::~BarCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BarCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->top, NULL);
::LineTo(m_hdcWindow, pRect->left, pRect->bottom);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BarCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ConsoleCursor
ConsoleCursor::ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hStdOut(::CreateFile(_T("CONOUT$"), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0))
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
ConsoleCursor::~ConsoleCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
::CloseHandle(m_hStdOut);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void ConsoleCursor::Draw(LPRECT pRect) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
if (m_bActive && m_bVisible) {
rect.top += (rect.bottom - rect.top) * 80 / 100;
::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void ConsoleCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBHLineCursor
NBHLineCursor::NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
{
}
NBHLineCursor::~NBHLineCursor() {
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBHLineCursor::Draw(LPRECT pRect) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->bottom-1, NULL);
::LineTo(m_hdcWindow, pRect->right, pRect->bottom-1);
::SelectObject(m_hdcWindow, hOldPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBHLineCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// HLineCursor
HLineCursor::HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_nSize(0)
, m_nPosition(0)
, m_nStep(0)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
HLineCursor::~HLineCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void HLineCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nSize != (pRect->bottom - pRect->top - 1)) {
m_nSize = pRect->bottom - pRect->top - 1;
m_nPosition = 0;
m_nStep = 1;
}
if (m_bActive) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->top + m_nPosition, NULL);
::LineTo(m_hdcWindow, pRect->right, pRect->top + m_nPosition);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void HLineCursor::PrepareNext() {
if (m_nPosition == 0) {
m_nStep = 1;
} else if (m_nPosition == m_nSize) {
m_nStep = -1;
}
m_nPosition += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// VLineCursor
VLineCursor::VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_nSize(0)
, m_nPosition(0)
, m_nStep(0)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
VLineCursor::~VLineCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void VLineCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nSize != (pRect->right - pRect->left - 1)) {
m_nSize = pRect->right - pRect->left - 1;
m_nPosition = 0;
m_nStep = 1;
}
if (m_bActive) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left + m_nPosition, pRect->top, NULL);
::LineTo(m_hdcWindow, pRect->left + m_nPosition, pRect->bottom);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void VLineCursor::PrepareNext() {
if (m_nPosition == 0) {
m_nStep = 1;
} else if (m_nPosition == m_nSize) {
m_nStep = -1;
}
m_nPosition += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// RectCursor
RectCursor::RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
RectCursor::~RectCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void RectCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
::FrameRect(m_hdcWindow, pRect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void RectCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBRectCursor
NBRectCursor::NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
{
}
NBRectCursor::~NBRectCursor() {
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBRectCursor::Draw(LPRECT pRect) {
::FrameRect(m_hdcWindow, pRect, m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBRectCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseRectCursor
PulseRectCursor::PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_nSize(0)
, m_nMaxSize(0)
, m_nStep(0)
{
::ZeroMemory(&m_rect, sizeof(RECT));
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
PulseRectCursor::~PulseRectCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseRectCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nMaxSize == 0) {
if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) {
m_nMaxSize = (pRect->right - pRect->left) >> 1;
} else {
m_nMaxSize = (pRect->bottom - pRect->top) >> 1;
}
}
if (m_bActive) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
rect.left += m_nSize;
rect.top += m_nSize;
rect.right -= m_nSize;
rect.bottom -= m_nSize;
::FrameRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseRectCursor::PrepareNext() {
if (m_nSize == 0) {
m_nStep = 1;
} else if (m_nSize == m_nMaxSize) {
m_nStep = -1;
}
m_nSize += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FadeBlockCursor
FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_crCursorColor(crCursorColor)
, m_nStep(1)
, m_crBkColor(crBkColor)
, m_nIndex(0)
, m_hUser32(NULL)
, m_hMemDC(NULL)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL);
FakeBlend();
// }
}
FadeBlockCursor::~FadeBlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void FadeBlockCursor::Draw(LPRECT pRect) {
HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]);
::FillRect(m_hdcWindow, pRect, hBrush);
::DeleteObject(hBrush);
// }
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void FadeBlockCursor::PrepareNext() {
if (m_nIndex == 0) {
m_nStep = 1;
} else if (m_nIndex == (FADE_STEPS)) {
m_nStep = -1;
}
m_nIndex += m_nStep;
// }
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// This function is used to create a fake blending for WinNT (uuseful only
// for solid background, though)
void FadeBlockCursor::FakeBlend() {
int nDeltaR = ((GetRValue(m_crCursorColor) - GetRValue(m_crBkColor)) << 8) / FADE_STEPS;
int nDeltaG = ((GetGValue(m_crCursorColor) - GetGValue(m_crBkColor)) << 8) / FADE_STEPS;
int nDeltaB = ((GetBValue(m_crCursorColor) - GetBValue(m_crBkColor)) << 8) / FADE_STEPS;
for (int i = 0; i < FADE_STEPS; ++i) {
m_arrColors[i] = RGB(GetRValue(m_crCursorColor) - (nDeltaR*i >> 8), GetGValue(m_crCursorColor) - (nDeltaG*i >> 8), GetBValue(m_crCursorColor) - (nDeltaB*i >> 8));
}
m_arrColors[FADE_STEPS] = m_crBkColor;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-342
View File
@@ -1,342 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Cursors.h - cursor classes
#pragma once
#define CURSOR_TIMER 45
extern BOOL g_bWin2000;
/////////////////////////////////////////////////////////////////////////////
// A base class for all the cursors
class Cursor {
public:
Cursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: m_hwndParent(hwndParent)
, m_hdcWindow(hdcWindow)
, m_crCursorColor(crCursorColor)
, m_bActive(TRUE)
, m_uiTimer(0)
{};
virtual ~Cursor(){};
void SetState(BOOL bActive) {m_bActive = bActive;};
BOOL GetState() { return m_bActive; }
// used to draw current frame of the cursor
virtual void Draw(LPRECT pRect) = 0;
// used to prepare the next frame of cursor animation
virtual void PrepareNext() = 0;
protected:
HWND m_hwndParent;
HDC m_hdcWindow;
COLORREF m_crCursorColor;
BOOL m_bActive;
UINT m_uiTimer;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// XTermCursor
class XTermCursor : public Cursor {
public:
XTermCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~XTermCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
HBRUSH m_hInactiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BlockCursor
class BlockCursor : public Cursor {
public:
BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~BlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBBlockCursor
class NBBlockCursor : public Cursor {
public:
NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseBlockCursor
class PulseBlockCursor : public Cursor {
public:
PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~PulseBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
RECT m_rect;
int m_nSize;
int m_nMaxSize;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BarCursor
class BarCursor : public Cursor {
public:
BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~BarCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ConsoleCursor
class ConsoleCursor : public Cursor {
public:
ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~ConsoleCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HANDLE m_hStdOut;
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBHLineCursor
class NBHLineCursor : public Cursor {
public:
NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBHLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// HLineCursor
class HLineCursor : public Cursor {
public:
HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~HLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
int m_nSize;
int m_nPosition;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// VLineCursor
class VLineCursor : public Cursor {
public:
VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~VLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
int m_nSize;
int m_nPosition;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// RectCursor
class RectCursor : public Cursor {
public:
RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~RectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBRectCursor
class NBRectCursor : public Cursor {
public:
NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBRectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseRectCursor
class PulseRectCursor : public Cursor {
public:
PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~PulseRectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
RECT m_rect;
int m_nSize;
int m_nMaxSize;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FadeBlockCursor
#define FADE_STEPS 20
#define ALPHA_STEP 12
#define BLEND_BMP_WIDTH 10
#define BLEND_BMP_HEIGHT 20
class FadeBlockCursor : public Cursor {
public:
FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor);
~FadeBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
void FakeBlend();
COLORREF m_crCursorColor;
int m_nStep;
// used under WinNT 4.0
COLORREF m_crBkColor;
COLORREF m_arrColors[FADE_STEPS+1];
int m_nIndex;
// these are used under Win2000 only
HMODULE m_hUser32;
BLENDFUNCTION m_bfn;
HDC m_hMemDC;
};
/////////////////////////////////////////////////////////////////////////////
-134
View File
@@ -1,134 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dialogs.h - dialog classes
//
// About dialog class, etc...
//#include "stdafx.h"
#include <windows.h>
#include "resource.h"
#include "Console.h"
#include "Dialogs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HINSTANCE ghInstance;
/////////////////////////////////////////////////////////////////////////////
// About dialog class
/////////////////////////////////////////////////////////////////////////////
// Ctor/Dtor
CAboutDlg::CAboutDlg(HWND hwndParent)
: m_hWndParent(hwndParent)
{
}
CAboutDlg::~CAboutDlg()
{
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// public methods
/////////////////////////////////////////////////////////////////////////////
// DoModal - shows About dialog
BOOL CAboutDlg::DoModal()
{
::DialogBox(
ghInstance,
MAKEINTRESOURCE(IDD_ABOUT),
m_hWndParent,
CAboutDlg::DialogProc);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// message handlers
/////////////////////////////////////////////////////////////////////////////
// DialogProc - dialog window procedure
int CALLBACK CAboutDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
if (HIWORD(wParam) == BN_CLICKED) {
::EndDialog(hwndDlg, MB_OK);
return TRUE;
}
break;
}
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-64
View File
@@ -1,64 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dialogs.h - dialog classes
//
// About dialog class, etc...
#pragma once
/////////////////////////////////////////////////////////////////////////////
// About dialog class
class CAboutDlg {
public:
CAboutDlg(HWND hwndParent);
~CAboutDlg();
// public methods
public:
// shows About dialog
BOOL DoModal();
// public data
public:
// parent window handle
HWND m_hWndParent;
// private methods
private:
/////////////////////////
// message handlers
// dialog window procedure
static int CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
// private data
private:
};
/////////////////////////////////////////////////////////////////////////////
-259
View File
@@ -1,259 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream.cpp - implementation of IStream interface on any file
// (not strictly COM, I'm faking it here a bit :-)
//
#undef CINTERFACE
#include "builddefines.h"
//#include "stdafx.h"
//#include <atlbase.h>
#include <windows.h>
#include <objidl.h>
#include "FileStream.h"
//#ifdef _DEBUG
//#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
//#endif
/////////////////////////////////////////////////////////////////////////////
// CreateFileStream - opens/creates a file and returns an IStream interface
HRESULT CreateFileStream(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile, // handle to template file
IStream** ppStream // pointer to IStream interface
)
{
HANDLE hFile = ::CreateFile(
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile);
if (hFile == INVALID_HANDLE_VALUE) {
// DWORD a = ::GetLastError();
ppStream = NULL;
return E_FAIL;
}
FileStream* pFileStream = new FileStream(hFile);
return pFileStream->QueryInterface(IID_IStream, (void**)ppStream);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream class
/////////////////////////////////////////////////////////////////////////////
// ctor/dtor
FileStream::FileStream(HANDLE hFile)
: m_lRefCount(0)
, m_hFile(hFile)
{
}
FileStream::~FileStream()
{
if (m_hFile) ::CloseHandle(m_hFile);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// IStream methods
/////////////////////////////////////////////////////////////////////////////
// Read - reads a specified number of bytes from the stream object into memory
// starting at the current seek pointer
STDMETHODIMP FileStream::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
if (!::ReadFile(m_hFile, pv, cb, pcbRead, NULL)) return S_FALSE;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Write - writes a specified number of bytes into the stream object starting
// at the current seek pointer
STDMETHODIMP FileStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten)
{
if (!::WriteFile(m_hFile, pv, cb, pcbWritten, NULL)) return S_FALSE;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Seek - changes the seek pointer to a new location relative to the beginning
// of the stream, to the end of the stream, or to the current seek pointer
STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
DWORD dwFileOrigin;
DWORD dwMoveLow = dlibMove.LowPart;
LONG lMoveHigh = dlibMove.HighPart;
switch (dwOrigin) {
case STREAM_SEEK_SET : dwFileOrigin = FILE_BEGIN; break;
case STREAM_SEEK_CUR : dwFileOrigin = FILE_CURRENT; break;
case STREAM_SEEK_END : dwFileOrigin = FILE_END; break;
default:dwFileOrigin = FILE_BEGIN;
}
DWORD dwRet = ::SetFilePointer(m_hFile, dwMoveLow, &lMoveHigh, dwFileOrigin);
if (::GetLastError() != NO_ERROR) return STG_E_INVALIDPOINTER;
plibNewPosition->LowPart = dwRet;
plibNewPosition->HighPart = lMoveHigh;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// SetSize - not really doing anything here
STDMETHODIMP FileStream::SetSize(ULARGE_INTEGER libNewSize)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CopyTo - copies a specified number of bytes from the current seek pointer
// in the stream to the current seek pointer in another stream
STDMETHODIMP FileStream::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
// later...
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Commit - no work here...
STDMETHODIMP FileStream::Commit(DWORD grfCommitFlags)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Revert - no work here...
STDMETHODIMP FileStream::Revert(void)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// LockRegion - no work here...
STDMETHODIMP FileStream::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// UnlockRegion - no work here...
STDMETHODIMP FileStream::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Stat - no work here...
STDMETHODIMP FileStream::Stat(STATSTG *pstatstg, DWORD grfStatFlag)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Clone - no work here...
STDMETHODIMP FileStream::Clone(IStream **ppstm)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
-107
View File
@@ -1,107 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream.h - implementation of IStream interface on any file
// (not really COM, I'm faking it here a bit :-)
//
#pragma once
/////////////////////////////////////////////////////////////////////////////
// CreateFileStream - opens/creates a file and returns an IStream interface
HRESULT CreateFileStream(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile, // handle to template file
IStream** ppStream // pointer to IStream interface
);
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream class
class FileStream : public IStream {
public:
FileStream(HANDLE hFile);
~FileStream();
// IUnknown methods
STDMETHOD(QueryInterface)(REFIID riid, void ** ppv) {
if (riid == IID_IUnknown) {
*ppv = static_cast<IStream*>(this);
} else if (riid == IID_IStream) {
*ppv = static_cast<IStream*>(this);
} else {
*ppv = NULL;
return E_NOINTERFACE;
}
static_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
};
STDMETHOD_(ULONG, AddRef)(void) {
return ::InterlockedIncrement(&m_lRefCount);
};
STDMETHOD_(ULONG, Release)(void) {
long l = ::InterlockedDecrement(&m_lRefCount);
if (l == 0) delete this;
return l;
};
// IStream methods
STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead);
STDMETHOD(Write)(void const *pv, ULONG cb, ULONG *pcbWritten);
STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize);
STDMETHOD(CopyTo)(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
STDMETHOD(Commit)(DWORD grfCommitFlags);
STDMETHOD(Revert)(void);
STDMETHOD(LockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
STDMETHOD(UnlockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag);
STDMETHOD(Clone)(IStream **ppstm);
private: // private data
// reference count
long m_lRefCount;
// file handle
HANDLE m_hFile;
};
/////////////////////////////////////////////////////////////////////////////
-1200
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

-1
View File
@@ -8,7 +8,6 @@
#include "GameSettings.h"
#include "input.h"
#include "Console.h"
#include "lwstring.h"
#include "message.h"
#include "mousesystem.h"
-16
View File
@@ -45,7 +45,6 @@
#include "INIReader.h"
#include "Console.h"
#include "Lua Interpreter.h"
#include "connect.h"
#include "english.h"
@@ -383,21 +382,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
}
break;
case WM_INPUTREADY:
{
wstring *tstr = (wstring*) lParam;
if (EvalLua( tstr->c_str()))
{
tstr->erase();
}
else
{
cout << ">";
}
cout << "> ";
}
break;
default :
return DefWindowProc(hWindow, Message, wParam, lParam);
}