CtrlCore: Developing Cocoa

git-svn-id: svn://ultimatepp.org/upp/trunk@12136 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-08-02 16:14:52 +00:00
parent 6e3853e799
commit c98f81ace0
6 changed files with 48 additions and 36 deletions

View file

@ -73,12 +73,15 @@ bool Upp::Ctrl::IsWndForeground() const
return HasWndFocus();
}
NSRect DesktopRect(const Upp::Rect& r)
{
return NSMakeRect(r.left, Upp::Ctrl::GetPrimaryScreenArea().GetHeight() - r.top - r.GetHeight(),
r.GetWidth(), r.GetHeight());
}
void Upp::Ctrl::Create(Ctrl *owner, dword style, bool active)
{
Rect r = GetRect();
NSRect frame = NSMakeRect(r.left, GetPrimaryScreenArea().GetHeight() - r.top - r.GetHeight(),
r.GetWidth(), r.GetHeight());
NSRect frame = DesktopRect(GetRect());
CocoWindow *window = [[CocoWindow alloc] initWithContentRect:frame styleMask: style
backing:NSBackingStoreBuffered defer:false];
@ -242,4 +245,20 @@ void Upp::TopWindow::SyncSizeHints()
}
}
Upp::Rect Upp::Ctrl::GetWndScreenRect() const
{ // THIS IS NOT NEEDED
GuiLock __;
Rect r = GetRect();
return r;
}
void Upp::Ctrl::WndSetPos(const Upp::Rect& rect)
{
GuiLock __;
if(top)
[top->coco->window setFrame:
[top->coco->window frameRectForContentRect:DesktopRect(rect)]
display:YES];
}
#endif

View file

@ -12,7 +12,16 @@ K_SHIFT_KEY = 500|K_DELTA,
K_CTRL_KEY,
K_ALT_KEY,
K_OPTION_KEY,
// TODO: These are not properly handled yet
K_CAPSLOCK,
K_SEPARATOR,
K_CTRL_APOSTROPHE,
K_PLUS,
K_BREAK,
K_SCROLL,
K_QUOTEDBL,
// ---
K_ESCAPE = kVK_Escape|K_DELTA,
K_PRIOR = kVK_PageUp|K_DELTA,
@ -39,13 +48,11 @@ K_NUMPAD7 = kVK_ANSI_Keypad7|K_DELTA,
K_NUMPAD8 = kVK_ANSI_Keypad8|K_DELTA,
K_NUMPAD9 = kVK_ANSI_Keypad9|K_DELTA,
K_MULTIPLY,
K_ADD,
K_SEPARATOR,
K_SUBTRACT,
K_DECIMAL,
K_DIVIDE,
K_SCROLL,
K_MULTIPLY = kVK_ANSI_KeypadMultiply|K_DELTA,
K_ADD = kVK_ANSI_KeypadPlus|K_DELTA,
K_SUBTRACT = kVK_ANSI_KeypadMinus|K_DELTA,
K_DECIMAL = kVK_ANSI_KeypadDecimal|K_DELTA,
K_DIVIDE = kVK_ANSI_KeypadDivide|K_DELTA,
K_F1 = kVK_F1|K_DELTA,
K_F2 = kVK_F2|K_DELTA,
@ -107,11 +114,7 @@ K_CTRL_COMMA = kVK_ANSI_Comma|K_DELTA|K_CTRL,
K_CTRL_PERIOD = kVK_ANSI_Period|K_DELTA|K_CTRL,
K_CTRL_SEMICOLON = kVK_ANSI_Semicolon|K_DELTA|K_CTRL,
K_CTRL_EQUAL = kVK_ANSI_Equal|K_DELTA|K_CTRL,
K_CTRL_APOSTROPHE, // TODO
K_BREAK, // TODO
K_PLUS = 999999997,
K_MINUS = kVK_ANSI_Minus|K_DELTA,
K_COMMA = kVK_ANSI_Comma|K_DELTA,
K_PERIOD = kVK_ANSI_Period|K_DELTA,
@ -121,4 +124,3 @@ K_GRAVE = kVK_ANSI_Grave|K_DELTA,
K_LBRACKET = kVK_ANSI_LeftBracket|K_DELTA,
K_BACKSLASH = kVK_ANSI_Backslash|K_DELTA,
K_RBRACKET = kVK_ANSI_RightBracket|K_DELTA,
K_QUOTEDBL = 999999996,

View file

@ -107,9 +107,11 @@ struct MMImp {
ctrl->DispatchKey(k, 1);
if(!up && !(k & (K_CTRL|K_ALT))) {
WString x = ToWString((CFStringRef)(e.characters));
for(wchar c : x)
if(c < 0xF700 && (c >= 32 && c != 127 || c == 9 && (k & K_OPTION) == 0))
for(wchar c : x) {
if(c < 0xF700 &&
(c > 32 && c != 127 || c == 9 && (k & K_OPTION) == 0 || c == 32 && (k & K_SHIFT) == 0))
ctrl->DispatchKey(c, 1);
}
}
return true;
}

View file

@ -51,13 +51,6 @@ void Ctrl::UnregisterSystemHotKey(int id)
}*/
}
Rect Ctrl::GetWndScreenRect() const
{
GuiLock __;
Rect r;
return r;
}
void Ctrl::WndShow(bool b)
{
GuiLock __;
@ -85,11 +78,6 @@ int Ctrl::GetKbdSpeed()
return 1000 / 32;
}
void Ctrl::WndSetPos(const Rect& rect)
{
GuiLock __;
}
void Ctrl::WndUpdate(const Rect& r)
{
GuiLock __;

View file

@ -132,7 +132,7 @@ LRESULT CALLBACK Ctrl::OverwatchWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if(ShutdownBlockReasonDestroy)
ShutdownBlockReasonDestroy(hwnd);
ELOGW("WM_QUERYENDSESSION 2");
return TRUE;
return TRUE;
}
if(msg == WM_ENDSESSION) {
EndSession();

View file

@ -2,24 +2,19 @@ sooner:
- OSX flag
- SerializePlacement
- keyboard shortcuts are not stored
- rect loop (ViewDraw)
- minimize, maximaze
- SetWndPos
- Ctrl+Shift+F wrong initial focus
- ide: Alt+Tab does not work
- menubar does not loose focus after click outside (or rather ActiveFocus does not work)
- not all additional cursors are correct
- Ctrl+Mouse wheel
- Ctrl+F5
- Ctrl+Tab
- Synthetise fonts
- Sort fonts
later:
- ide console - wrong wordwrap
- void WakeUpGuiThread(void)
- fullscreen
- missing cursors (add to iml, use undocumented cursor)
@ -56,6 +51,12 @@ void SystemDraw::DrawArcOp(const Rect& rc, Point start, Point end, int width, Co
done:
- Ctrl+Mouse wheel
- Ctrl+F5
- Shift+Space - double space...
- keyboard shortcuts are not stored
- SetWndPos
- ide console - wrong wordwrap
- invalid ide icon in main package selector (caused by caching)
- wheel
- window close button