diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/PlatWin.cxx | 40 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 68 |
2 files changed, 54 insertions, 54 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index e20e2be55..c2967d2a5 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -18,7 +18,7 @@ Point Point::FromLong(long lpoint) { return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint))); } - + static RECT RectFromPRectangle(PRectangle prc) { RECT rc = {prc.left, prc.top, prc.right, prc.bottom}; return rc; @@ -80,7 +80,7 @@ void Palette::WantFind(ColourPair &cp, bool want) { if (entries[i].desired == cp.desired) return; } - + if (used < numEntries) { entries[used].desired = cp.desired; entries[used].allocated = cp.desired; @@ -112,9 +112,9 @@ void Palette::Allocate(Window &) { logpal->palPalEntry[iPal].peRed = static_cast<BYTE>(desired.GetRed()); logpal->palPalEntry[iPal].peGreen = static_cast<BYTE>(desired.GetGreen()); logpal->palPalEntry[iPal].peBlue = static_cast<BYTE>(desired.GetBlue()); - entries[iPal].allocated = + entries[iPal].allocated = PALETTERGB(desired.GetRed(), desired.GetGreen(), desired.GetBlue()); - // PC_NOCOLLAPSE means exact colours allocated even when in background this means other windows + // PC_NOCOLLAPSE means exact colours allocated even when in background this means other windows // are less likely to get their colours and also flashes more when switching windows logpal->palPalEntry[iPal].peFlags = PC_NOCOLLAPSE; // 0 allows approximate colours when in background, yielding moe colours to other windows @@ -141,7 +141,7 @@ void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, int size, b * same then they may still be different. */ int HashFont(const char *faceName, int characterSet, int size, bool bold, bool italic) { - return + return size ^ (characterSet << 10) ^ (bold ? 0x10000000 : 0) ^ @@ -158,7 +158,7 @@ class FontCached : Font { ~FontCached() {} bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); virtual void Release(); - + static FontCached *first; public: static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); @@ -167,7 +167,7 @@ public: FontCached *FontCached::first = 0; -FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) : +FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) : next(0), usage(0), hash(0) { SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_); hash = HashFont(faceName_, characterSet_, size_, bold_, italic_); @@ -176,7 +176,7 @@ FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool } bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { - return + return (lf.lfHeight == -(abs(size_))) && (lf.lfWeight == (bold_ ? FW_BOLD : FW_NORMAL)) && (lf.lfItalic == static_cast<BYTE>(italic_ ? 1 : 0)) && @@ -193,7 +193,7 @@ void FontCached::Release() { FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { int hashFind = HashFont(faceName_, characterSet_, size_, bold_, italic_); for (FontCached *cur=first; cur; cur=cur->next) { - if ((cur->hash == hashFind) && + if ((cur->hash == hashFind) && cur->SameAs(faceName_, characterSet_, size_, bold_, italic_)) { cur->usage++; return cur->id; @@ -238,7 +238,7 @@ Font::~Font() { void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) { #ifndef FONTS_CACHED Release(); - + LOGFONT lf; SetLogFont(lf, faceName, characterSet, size, bold, italic); id = ::CreateFontIndirect(&lf); @@ -261,9 +261,9 @@ void Font::Release() { Surface::Surface() : unicodeMode(false), hdc(0), hdcOwned(false), - pen(0), penOld(0), - brush(0), brushOld(0), - font(0), fontOld(0), + pen(0), penOld(0), + brush(0), brushOld(0), + font(0), fontOld(0), bitmap(0), bitmapOld(0), paletteOld(0) { } @@ -434,7 +434,7 @@ void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { } void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) { - ::BitBlt(hdc, rc.left, rc.top, rc.Width(), rc.Height(), + ::BitBlt(hdc, rc.left, rc.top, rc.Width(), rc.Height(), surfaceSource.hdc, from.x, from.y, SRCCOPY); } @@ -498,7 +498,7 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) // Likely to have failed because on Windows 9x where function not available // So measure the character widths by measuring each initial substring // Turns a linear operation into a qudratic but seems fast enough on test files - for (int widthSS=0; widthSS < tlen; widthSS++) { + for (int widthSS=0; widthSS < tlen; widthSS++) { ::GetTextExtentPoint32W(hdc, tbuf, widthSS+1, &sz); poses[widthSS] = sz.cx; } @@ -591,7 +591,7 @@ int Surface::SetPalette(Palette *pal, bool inBackGround) { } return changes; } - + void Surface::SetClip(PRectangle rc) { ::IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); } @@ -652,7 +652,7 @@ void Window::InvalidateRectangle(PRectangle rc) { } void Window::SetFont(Font &font) { - SendMessage(WM_SETFONT, + SendMessage(WM_SETFONT, reinterpret_cast<WPARAM>(font.GetID()), 0); } @@ -718,7 +718,7 @@ void ListBox::Create(Window &parent, int ctrlID) { id = ::CreateWindowEx( WS_EX_WINDOWEDGE, "listbox", "", WS_CHILD | WS_THICKFRAME | WS_VSCROLL | LBS_SORT | LBS_NOTIFY, - 100,100, 150,80, parent.GetID(), reinterpret_cast<HMENU>(ctrlID), + 100,100, 150,80, parent.GetID(), reinterpret_cast<HMENU>(ctrlID), parent.GetInstance(), 0); } @@ -776,7 +776,7 @@ int ListBox::GetSelection() { } int ListBox::Find(const char *prefix) { - return SendMessage(LB_FINDSTRING, static_cast<WPARAM>(-1), + return SendMessage(LB_FINDSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(prefix)); } @@ -896,7 +896,7 @@ void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); if (assertionPopUps) { - int idButton = ::MessageBox(0, buffer, "Assertion failure", + int idButton = ::MessageBox(0, buffer, "Assertion failure", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); if (idButton == IDRETRY) { ::DebugBreak(); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 80702fa41..522a038eb 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -117,7 +117,7 @@ class ScintillaWin : bool hasOKText; CLIPFORMAT cfColumnSelect; - + DropSource ds; DataObject dob; DropTarget dt; @@ -192,7 +192,7 @@ public: STDMETHODIMP GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM); bool IsUnicodeMode() const; - + static void Register(HINSTANCE hInstance_); friend class DropSource; friend class DataObject; @@ -214,7 +214,7 @@ ScintillaWin::ScintillaWin(HWND hwnd) { // contains a rectangular selection, so copy Developer Studio. cfColumnSelect = static_cast<CLIPFORMAT>( ::RegisterClipboardFormat("MSDEVColumnSelect")); - + wMain = hwnd; dob.sci = this; @@ -276,7 +276,7 @@ static int InputCodePage() { char sCodePage[10]; int res = ::GetLocaleInfo(MAKELCID(inputLang, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, sCodePage, sizeof(sCodePage)); - if (!res) + if (!res) return 0; return atoi(sCodePage); } @@ -313,14 +313,14 @@ LRESULT ScintillaWin::WndPaint(unsigned long wParam) { //LARGE_INTEGER performanceFreq; //QueryPerformanceFrequency(&performanceFreq); //QueryPerformanceCounter(&perfStart); - - // Redirect assertions to debug output and save current state + + // Redirect assertions to debug output and save current state bool assertsPopup = Platform::ShowAssertionPopUps(false); paintState = painting; PAINTSTRUCT ps; PAINTSTRUCT* pps; - bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains + bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains // a PAINSTRUCT* from the OCX if (IsOcxCtrl) { pps = reinterpret_cast<PAINTSTRUCT*>(wParam); @@ -349,9 +349,9 @@ LRESULT ScintillaWin::WndPaint(unsigned long wParam) { } paintState = notPainting; - // Restore debug output state + // Restore debug output state Platform::ShowAssertionPopUps(assertsPopup); - + //QueryPerformanceCounter(&perfEnd); //__int64 start = perfStart.QuadPart; //__int64 end = perfEnd.QuadPart; @@ -451,11 +451,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam); case WM_LBUTTONDOWN: - //Platform::DebugPrintf("Buttdown %d %x %x %x %x %x\n",iMessage, wParam, lParam, - // Platform::IsKeyDown(VK_SHIFT), + //Platform::DebugPrintf("Buttdown %d %x %x %x %x %x\n",iMessage, wParam, lParam, + // Platform::IsKeyDown(VK_SHIFT), // Platform::IsKeyDown(VK_CONTROL), // Platform::IsKeyDown(VK_MENU)); - ButtonDown(Point::FromLong(lParam), GetTickCount(), + ButtonDown(Point::FromLong(lParam), GetTickCount(), wParam & MK_SHIFT, wParam & MK_CONTROL, Platform::IsKeyDown(VK_MENU)); SetFocus(wMain.GetID()); break; @@ -501,7 +501,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_KEYDOWN: { //Platform::DebugPrintf("S keydown %d %x %x %x %x\n",iMessage, wParam, lParam, ::IsKeyDown(VK_SHIFT), ::IsKeyDown(VK_CONTROL)); - int ret = KeyDown(KeyTranslate(wParam), + int ret = KeyDown(KeyTranslate(wParam), Platform::IsKeyDown(VK_SHIFT), Platform::IsKeyDown(VK_CONTROL), false); if (!ret) @@ -560,7 +560,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_IME_ENDCOMPOSITION: // dbcs ImeEndComposition(); return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam); - + case WM_IME_COMPOSITION: if (lParam & GCS_RESULTSTR) { Platform::DebugPrintf("Result\n"); @@ -597,12 +597,12 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam); case WM_ERASEBKGND: - return 1; // Avoid any background erasure as whole window painted. + return 1; // Avoid any background erasure as whole window painted. case WM_CAPTURECHANGED: capturedMouse = false; return 0; - + // These are not handled in Scintilla and its faster to dispatch them here. // Also moves time out to here so profile doesn't count lots of empty message calls. case WM_MOVE: @@ -621,14 +621,14 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case SCI_GETDIRECTFUNCTION: return reinterpret_cast<sptr_t>(DirectFunction); - + case SCI_GETDIRECTPOINTER: return reinterpret_cast<sptr_t>(this); case SCI_GRABFOCUS: ::SetFocus(wMain.GetID()); break; - + default: return ScintillaBase::WndProc(iMessage, wParam, lParam); } @@ -671,7 +671,7 @@ bool ScintillaWin::HaveMouseCapture() { void ScintillaWin::ScrollText(int linesToMove) { //Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove); - ::ScrollWindow(wMain.GetID(), 0, + ::ScrollWindow(wMain.GetID(), 0, vs.lineHeight * linesToMove, 0, 0); ::UpdateWindow(wMain.GetID()); } @@ -721,13 +721,13 @@ bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { void ScintillaWin::NotifyChange() { ::SendMessage(GetParent(wMain.GetID()), WM_COMMAND, - MAKELONG(wMain.GetDlgCtrlID(), SCEN_CHANGE), + MAKELONG(wMain.GetDlgCtrlID(), SCEN_CHANGE), reinterpret_cast<LPARAM>(wMain.GetID())); } void ScintillaWin::NotifyFocus(bool focus) { ::SendMessage(GetParent(wMain.GetID()), WM_COMMAND, - MAKELONG(wMain.GetDlgCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), + MAKELONG(wMain.GetDlgCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), reinterpret_cast<LPARAM>(wMain.GetID())); } @@ -987,7 +987,7 @@ STDMETHODIMP DataObject_GetDataHere(DataObject *, FORMATETC *, STGMEDIUM *) { } STDMETHODIMP DataObject_QueryGetData(DataObject *pd, FORMATETC *pFE) { - if (pd->sci->DragIsRectangularOK(pFE->cfFormat) && + if (pd->sci->DragIsRectangularOK(pFE->cfFormat) && pFE->ptd == 0 && (pFE->dwAspect & DVASPECT_CONTENT) != 0 && pFE->lindex == -1 && @@ -995,9 +995,9 @@ STDMETHODIMP DataObject_QueryGetData(DataObject *pd, FORMATETC *pFE) { ) { return S_OK; } - - bool formatOK = (pFE->cfFormat == CF_TEXT) || - ((pFE->cfFormat == CF_UNICODETEXT) && pd->sci->IsUnicodeMode()) || + + bool formatOK = (pFE->cfFormat == CF_TEXT) || + ((pFE->cfFormat == CF_UNICODETEXT) && pd->sci->IsUnicodeMode()) || (pFE->cfFormat == CF_HDROP); if (!formatOK || pFE->ptd != 0 || @@ -1205,10 +1205,10 @@ void ScintillaWin::GetIntelliMouseParameters() { void ScintillaWin::CopySelTextToClipboard() { int bytes = SelectionRangeLength(); char *selChars = CopySelectionRange(); - if (!selChars) + if (!selChars) return; - HGLOBAL hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, + HGLOBAL hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, bytes + 1); if (hand) { char *ptr = static_cast<char *>(::GlobalLock(hand)); @@ -1220,7 +1220,7 @@ void ScintillaWin::CopySelTextToClipboard() { if (IsUnicodeMode()) { int uchars = UCS2Length(selChars, bytes); - HGLOBAL uhand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, + HGLOBAL uhand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 2 * (uchars + 1)); if (uhand) { wchar_t *uptr = static_cast<wchar_t *>(::GlobalLock(uhand)); @@ -1372,7 +1372,7 @@ STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyStat *pdwEffect = DROPEFFECT_NONE; return S_OK; } - + if (inDragDrop) // Internal defaults to move *pdwEffect = DROPEFFECT_MOVE; else @@ -1464,7 +1464,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, FORMATETC fmtr = {cfColumnSelect, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; HRESULT hrRectangular = pIDataSource->QueryGetData(&fmtr); - + POINT rpt = {pt.x, pt.y}; ::ScreenToClient(wMain.GetID(), &rpt); int movePos = PositionFromLocation(Point(rpt.x, rpt.y)); @@ -1479,7 +1479,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, else ::GlobalFree(medium.hGlobal); - if (udata) + if (udata) delete []data; return S_OK; @@ -1487,8 +1487,8 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, /// Implement important part of IDataObject STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { - bool formatOK = (pFEIn->cfFormat == CF_TEXT) || - ((pFEIn->cfFormat == CF_UNICODETEXT) && IsUnicodeMode()) || + bool formatOK = (pFEIn->cfFormat == CF_TEXT) || + ((pFEIn->cfFormat == CF_UNICODETEXT) && IsUnicodeMode()) || (pFEIn->cfFormat == CF_HDROP); if (!formatOK || pFEIn->ptd != 0 || @@ -1647,7 +1647,7 @@ sptr_t ScintillaWin::DirectFunction( ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) { return sci->WndProc(iMessage, wParam, lParam); } - + sptr_t PASCAL ScintillaWin::SWndProc( HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) { //Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam); |