diff --git a/uppsrc/CtrlCore/CtrlClip.cpp b/uppsrc/CtrlCore/CtrlClip.cpp index 4ead5dcd7..4f0fc3c34 100644 --- a/uppsrc/CtrlCore/CtrlClip.cpp +++ b/uppsrc/CtrlCore/CtrlClip.cpp @@ -37,7 +37,7 @@ PasteClip& Ctrl::Selection() { GuiLock __; static PasteClip d; - GuiPlatformSelection(); + GuiPlatformSelection(d); return d; } diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index e7def5ccd..ac338cd9f 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -654,7 +654,7 @@ private: void GuiPlatformGetTopRect(Rect& r) const; bool GuiPlatformRefreshFrameSpecial(const Rect& r); bool GuiPlatformSetFullRefreshSpecial(); - static void GuiPlatformSelection(); + static void GuiPlatformSelection(PasteClip& d); #ifdef GUIPLATFORM_CTRL_DECLS_INCLUDE #include GUIPLATFORM_CTRL_DECLS_INCLUDE diff --git a/uppsrc/CtrlCore/Win32Ctrl.cpp b/uppsrc/CtrlCore/Win32Ctrl.cpp index d4fe33269..448f4672b 100644 --- a/uppsrc/CtrlCore/Win32Ctrl.cpp +++ b/uppsrc/CtrlCore/Win32Ctrl.cpp @@ -1,130 +1,130 @@ -#include "CtrlCore.h" - -#ifdef GUI_WIN - -#define LLOG(x) // DLOG(x) - -NAMESPACE_UPP - -void Ctrl::GuiPlatformConstruct() -{ - activex = false; - isdhctrl = false; -} - -void Ctrl::GuiPlatformDestruct() -{ -} - -void Ctrl::GuiPlatformRemove() -{ -} - -void Ctrl::GuiPlatformGetTopRect(Rect& r) const -{ - if(activex) - r = GetWndScreenRect(); -} - -bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect& r) -{ - if(isdhctrl) { - InvalidateRect(((DHCtrl *)this)->GetHWND(), r, false); - return true; - } - return false; -} - -bool Ctrl::GuiPlatformSetFullRefreshSpecial() -{ - return isdhctrl; -} - -void Ctrl::PaintCaret(SystemDraw& w) -{ -} - -String GuiPlatformGetKeyDesc(dword key) -{ - static struct { - dword key; - const char *name; - } nkey[] = { - { 0x100c0, "[`]" }, { 0x100bd, "[-]" }, { 0x100bb, "[=]" }, { 0x100dc, "[\\]" }, - { 0x100db, "[[]" }, { 0x100dd, "[]]" }, - { 0x100ba, "[;]" }, { 0x100de, "[']" }, - { 0x100bc, "[,]" }, { 0x100be, "[.]" }, { 0x100bf, "[/]" }, - { 0, NULL } - }; - for(int i = 0; nkey[i].key; i++) - if(nkey[i].key == key) - return nkey[i].name; - return Null; -} - -void Ctrl::GuiPlatformSelection() -{ -} - -void GuiPlatformAdjustDragImage(ImageBuffer& b) -{ -} - -void Ctrl::SetCaret(int x, int y, int cx, int cy) -{ - GuiLock __; - caretx = x; - carety = y; - caretcx = cx; - caretcy = cy; - SyncCaret(); -} - -void Ctrl::SyncCaret() { - GuiLock __; - Rect cr; - cr.Clear(); - if(focusCtrl && focusCtrl->IsVisible()) { - bool inframe = focusCtrl->InFrame(); - cr = focusCtrl->GetScreenView(); - cr = RectC(focusCtrl->caretx + cr.left, focusCtrl->carety + cr.top, - focusCtrl->caretcx, focusCtrl->caretcy) & cr; - for(Ctrl *q = focusCtrl->GetParent(); q; q = q->GetParent()) { - cr &= inframe ? q->GetScreenRect() : q->GetScreenView(); - inframe = q->InFrame(); - } - } - if(focusCtrl != caretCtrl || cr != caretRect) { - LLOG("Do SyncCaret focusCtrl: " << UPP::Name(focusCtrl) - << ", caretCtrl: " << UPP::Name(caretCtrl) - << ", cr: " << cr); - WndDestroyCaret(); - if(focusCtrl && !cr.IsEmpty()) - focusCtrl->GetTopCtrl()->WndCreateCaret(cr); - caretCtrl = focusCtrl; - caretRect = cr; - } -} - -String Ctrl::Name() const { - GuiLock __; -#ifdef CPU_64 - String s = String(typeid(*this).name()) + " : 0x" + FormatIntHex(this); -#else - String s = String(typeid(*this).name()) + " : " + Format("0x%x", (int) this); -#endif - if(IsChild()) - s << "(parent " << String(typeid(*parent).name()) << ")"; - else - s << Format("(hwnd 0x%x)", (int)(intptr_t) GetHWND()); - return s; -} - -void Ctrl::WndCreateCaret(const Rect& cr) -{ - ICall(THISBACK1(WndCreateCaret0, cr)); -} - -END_UPP_NAMESPACE - -#endif +#include "CtrlCore.h" + +#ifdef GUI_WIN + +#define LLOG(x) // DLOG(x) + +NAMESPACE_UPP + +void Ctrl::GuiPlatformConstruct() +{ + activex = false; + isdhctrl = false; +} + +void Ctrl::GuiPlatformDestruct() +{ +} + +void Ctrl::GuiPlatformRemove() +{ +} + +void Ctrl::GuiPlatformGetTopRect(Rect& r) const +{ + if(activex) + r = GetWndScreenRect(); +} + +bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect& r) +{ + if(isdhctrl) { + InvalidateRect(((DHCtrl *)this)->GetHWND(), r, false); + return true; + } + return false; +} + +bool Ctrl::GuiPlatformSetFullRefreshSpecial() +{ + return isdhctrl; +} + +void Ctrl::PaintCaret(SystemDraw& w) +{ +} + +String GuiPlatformGetKeyDesc(dword key) +{ + static struct { + dword key; + const char *name; + } nkey[] = { + { 0x100c0, "[`]" }, { 0x100bd, "[-]" }, { 0x100bb, "[=]" }, { 0x100dc, "[\\]" }, + { 0x100db, "[[]" }, { 0x100dd, "[]]" }, + { 0x100ba, "[;]" }, { 0x100de, "[']" }, + { 0x100bc, "[,]" }, { 0x100be, "[.]" }, { 0x100bf, "[/]" }, + { 0, NULL } + }; + for(int i = 0; nkey[i].key; i++) + if(nkey[i].key == key) + return nkey[i].name; + return Null; +} + +void Ctrl::GuiPlatformSelection(PasteClip&) +{ +} + +void GuiPlatformAdjustDragImage(ImageBuffer&) +{ +} + +void Ctrl::SetCaret(int x, int y, int cx, int cy) +{ + GuiLock __; + caretx = x; + carety = y; + caretcx = cx; + caretcy = cy; + SyncCaret(); +} + +void Ctrl::SyncCaret() { + GuiLock __; + Rect cr; + cr.Clear(); + if(focusCtrl && focusCtrl->IsVisible()) { + bool inframe = focusCtrl->InFrame(); + cr = focusCtrl->GetScreenView(); + cr = RectC(focusCtrl->caretx + cr.left, focusCtrl->carety + cr.top, + focusCtrl->caretcx, focusCtrl->caretcy) & cr; + for(Ctrl *q = focusCtrl->GetParent(); q; q = q->GetParent()) { + cr &= inframe ? q->GetScreenRect() : q->GetScreenView(); + inframe = q->InFrame(); + } + } + if(focusCtrl != caretCtrl || cr != caretRect) { + LLOG("Do SyncCaret focusCtrl: " << UPP::Name(focusCtrl) + << ", caretCtrl: " << UPP::Name(caretCtrl) + << ", cr: " << cr); + WndDestroyCaret(); + if(focusCtrl && !cr.IsEmpty()) + focusCtrl->GetTopCtrl()->WndCreateCaret(cr); + caretCtrl = focusCtrl; + caretRect = cr; + } +} + +String Ctrl::Name() const { + GuiLock __; +#ifdef CPU_64 + String s = String(typeid(*this).name()) + " : 0x" + FormatIntHex(this); +#else + String s = String(typeid(*this).name()) + " : " + Format("0x%x", (int) this); +#endif + if(IsChild()) + s << "(parent " << String(typeid(*parent).name()) << ")"; + else + s << Format("(hwnd 0x%x)", (int)(intptr_t) GetHWND()); + return s; +} + +void Ctrl::WndCreateCaret(const Rect& cr) +{ + ICall(THISBACK1(WndCreateCaret0, cr)); +} + +END_UPP_NAMESPACE + +#endif diff --git a/uppsrc/CtrlCore/X11Ctrl.cpp b/uppsrc/CtrlCore/X11Ctrl.cpp index 44fbc216e..53ec66b54 100644 --- a/uppsrc/CtrlCore/X11Ctrl.cpp +++ b/uppsrc/CtrlCore/X11Ctrl.cpp @@ -1,116 +1,116 @@ -#include "CtrlCore.h" - -#ifdef GUI_X11 - -NAMESPACE_UPP - -void Ctrl::GuiPlatformConstruct() -{ -} - -void Ctrl::GuiPlatformDestruct() -{ -} - -void Ctrl::GuiPlatformRemove() -{ - if(popupgrab) { - EndPopupGrab(); - popupgrab = false; - } -} - -void Ctrl::GuiPlatformGetTopRect(Rect& r) const -{ -} - -String Ctrl::Name() const { - GuiLock __; -#ifdef CPU_64 - String s = String(typeid(*this).name()) + " : 0x" + FormatIntHex(this); -#else - String s = String(typeid(*this).name()) + " : " + Format("0x%x", (int) this); -#endif - if(IsChild()) - s << "(parent " << String(typeid(*parent).name()) << ")"; - else - s << Format("(window 0x%x)", (int)(intptr_t) GetWindow()); - return s; -} - -bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect&) -{ - return false; -} - - -bool Ctrl::GuiPlatformSetFullRefreshSpecial() -{ - return false; -} - -String Ctrl::GuiPlatformGetKeyDesc(dword key) -{ - static struct { - dword key; - const char *name; - } nkey[] = { - { 0x10060, "[`]" }, { 0x1002d, "[-]" }, { 0x1003d, "[=]" }, { 0x1005c, "[\\]" }, - { 0x1005b, "[[]" }, { 0x1005d, "[]]" }, - { 0x1003b, "[;]" }, { 0x10027, "[']" }, - { 0x1002c, "[,]" }, { 0x1002e, "[.]" }, { 0x1005f, "[/]" }, - { 0, NULL } - }; - for(int i = 0; nkey[i].key; i++) - if(nkey[i].key == key) - return nkey[i].name; - return Null; -} - -void Ctrl::GuiPlatformSelection() -{ - d.fmt.Clear(); - d.type = 2; -} - -void GuiPlatformAdjustDragImage(ImageBuffer& b) -{ - if(Ctrl::IsCompositedGui()) { - Image h = Rescale(b, 64, 64); - b = h; - } -} - -void Ctrl::PaintCaret(SystemDraw& w) -{ - GuiLock __; - if(this == caretCtrl && WndCaretVisible) - w.DrawRect(caretx, carety, caretcx, caretcy, InvertColor); -} - -void Ctrl::SetCaret(int x, int y, int cx, int cy) -{ - GuiLock __; - if(this == caretCtrl) - RefreshCaret(); - caretx = x; - carety = y; - caretcx = cx; - caretcy = cy; - WndCaretTime = GetTickCount(); - if(this == caretCtrl) - RefreshCaret(); -} - -void Ctrl::SyncCaret() { - GuiLock __; - if(focusCtrl != caretCtrl) { - RefreshCaret(); - caretCtrl = focusCtrl; - RefreshCaret(); - } -} - -END_UPP_NAMESPACE - +#include "CtrlCore.h" + +#ifdef GUI_X11 + +NAMESPACE_UPP + +void Ctrl::GuiPlatformConstruct() +{ +} + +void Ctrl::GuiPlatformDestruct() +{ +} + +void Ctrl::GuiPlatformRemove() +{ + if(popupgrab) { + EndPopupGrab(); + popupgrab = false; + } +} + +void Ctrl::GuiPlatformGetTopRect(Rect& r) const +{ +} + +String Ctrl::Name() const { + GuiLock __; +#ifdef CPU_64 + String s = String(typeid(*this).name()) + " : 0x" + FormatIntHex(this); +#else + String s = String(typeid(*this).name()) + " : " + Format("0x%x", (int) this); +#endif + if(IsChild()) + s << "(parent " << String(typeid(*parent).name()) << ")"; + else + s << Format("(window 0x%x)", (int)(intptr_t) GetWindow()); + return s; +} + +bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect&) +{ + return false; +} + + +bool Ctrl::GuiPlatformSetFullRefreshSpecial() +{ + return false; +} + +String GuiPlatformGetKeyDesc(dword key) +{ + static struct { + dword key; + const char *name; + } nkey[] = { + { 0x10060, "[`]" }, { 0x1002d, "[-]" }, { 0x1003d, "[=]" }, { 0x1005c, "[\\]" }, + { 0x1005b, "[[]" }, { 0x1005d, "[]]" }, + { 0x1003b, "[;]" }, { 0x10027, "[']" }, + { 0x1002c, "[,]" }, { 0x1002e, "[.]" }, { 0x1005f, "[/]" }, + { 0, NULL } + }; + for(int i = 0; nkey[i].key; i++) + if(nkey[i].key == key) + return nkey[i].name; + return Null; +} + +void Ctrl::GuiPlatformSelection(PasteClip& d) +{ + d.fmt.Clear(); + d.type = 2; +} + +void GuiPlatformAdjustDragImage(ImageBuffer& b) +{ + if(Ctrl::IsCompositedGui()) { + Image h = Rescale(b, 64, 64); + b = h; + } +} + +void Ctrl::PaintCaret(SystemDraw& w) +{ + GuiLock __; + if(this == caretCtrl && WndCaretVisible) + w.DrawRect(caretx, carety, caretcx, caretcy, InvertColor); +} + +void Ctrl::SetCaret(int x, int y, int cx, int cy) +{ + GuiLock __; + if(this == caretCtrl) + RefreshCaret(); + caretx = x; + carety = y; + caretcx = cx; + caretcy = cy; + WndCaretTime = GetTickCount(); + if(this == caretCtrl) + RefreshCaret(); +} + +void Ctrl::SyncCaret() { + GuiLock __; + if(focusCtrl != caretCtrl) { + RefreshCaret(); + caretCtrl = focusCtrl; + RefreshCaret(); + } +} + +END_UPP_NAMESPACE + #endif \ No newline at end of file