mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
.developing rainbow: Framebuffer GUI backend
git-svn-id: svn://ultimatepp.org/upp/trunk@3544 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dc2c4506c8
commit
c4066a4e4b
40 changed files with 358 additions and 107 deletions
|
|
@ -4,24 +4,6 @@ public:
|
||||||
~ViewDraw();
|
~ViewDraw();
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<WString>& coreCmdLine__();
|
|
||||||
Vector<WString> SplitCmdLine__(const char *cmd);
|
|
||||||
|
|
||||||
#define GUI_APP_MAIN \
|
|
||||||
void GuiMainFn_();\
|
|
||||||
\
|
|
||||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \
|
|
||||||
{ \
|
|
||||||
UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \
|
|
||||||
UPP::AppInitEnvironment__(); \
|
|
||||||
GuiMainFn_(); \
|
|
||||||
UPP::Ctrl::CloseTopCtrls(); \
|
|
||||||
UPP::UsrLog("---------- About to delete this log..."); \
|
|
||||||
UPP::DeleteUsrLog(); \
|
|
||||||
return UPP::GetExitCode(); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void GuiMainFn_()
|
|
||||||
|
|
||||||
|
|
||||||
class DHCtrl : Ctrl {};
|
class DHCtrl : Ctrl {};
|
||||||
|
|
||||||
|
void InitFB();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlLib/CtrlLib.h>
|
#include <CtrlLib/CtrlLib.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
#include <plugin/bmp/bmp.h>
|
#include <plugin/bmp/bmp.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
#define LLOG(x) // DLOG(x)
|
#define LLOG(x) // DLOG(x)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
//$ class Ctrl {
|
//$ class Ctrl {
|
||||||
|
public:
|
||||||
|
static void InitFB();
|
||||||
|
static void DoMouseFB(int event, Point p, int zdelta = 0);
|
||||||
//$ };
|
//$ };
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
20
rainbow/Framebuffer/Event.cpp
Normal file
20
rainbow/Framebuffer/Event.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
void Ctrl::DoMouseFB(int event, Point p, int zdelta)
|
||||||
|
{
|
||||||
|
int a = event & Ctrl::ACTION;
|
||||||
|
// if(a == DOWN)
|
||||||
|
// ClickActivateWnd();
|
||||||
|
if(a == Ctrl::UP && Ctrl::ignoreclick)
|
||||||
|
EndIgnore();
|
||||||
|
else
|
||||||
|
if(a != Ctrl::DOWN || !ignoreclick)
|
||||||
|
LOG("Mouse " << p << ' ' << zdelta);
|
||||||
|
// if(_this) PostInput();
|
||||||
|
// if(a == Ctrl::MOUSEMOVE)
|
||||||
|
// DoCursorShape();
|
||||||
|
}
|
||||||
|
|
||||||
|
END_UPP_NAMESPACE
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define GUI_FRAMEBUFFER
|
#define GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
@ -91,15 +91,24 @@ public:
|
||||||
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
|
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
|
||||||
Color color, uint64 pattern);
|
Color color, uint64 pattern);
|
||||||
|
|
||||||
#define GUIPLATFORM_KEYCODES_INCLUDE <Skeleton/Keys.h>
|
#define GUIPLATFORM_KEYCODES_INCLUDE <Framebuffer/Keys.h>
|
||||||
|
|
||||||
#define GUIPLATFORM_CTRL_TOP_DECLS
|
#define GUIPLATFORM_CTRL_TOP_DECLS
|
||||||
|
|
||||||
#define GUIPLATFORM_CTRL_DECLS_INCLUDE <Skeleton/Ctrl.h>
|
#define GUIPLATFORM_CTRL_DECLS_INCLUDE <Framebuffer/Ctrl.h>
|
||||||
|
|
||||||
#define GUIPLATFORM_PASTECLIP_DECLS
|
#define GUIPLATFORM_PASTECLIP_DECLS
|
||||||
|
|
||||||
#define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE <Skeleton/Top.h>
|
#define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE <Framebuffer/Top.h>
|
||||||
|
|
||||||
|
// to be implemented by final FB {
|
||||||
|
|
||||||
|
bool FBIsWaitingEvent();
|
||||||
|
bool FBProcessEvent(bool *quit);
|
||||||
|
void FBSleep(int ms);
|
||||||
|
bool FBEndSession();
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
class PrinterJob {
|
class PrinterJob {
|
||||||
NilDraw nil;
|
NilDraw nil;
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
description "Generic framebuffer GUI rainbow\377";
|
description "Generic framebuffer GUI rainbow\377";
|
||||||
|
|
||||||
file
|
file
|
||||||
Skeleton.h,
|
Framebuffer.h,
|
||||||
After.h,
|
After.h,
|
||||||
Keys.h,
|
Keys.h,
|
||||||
DrawOp.cpp,
|
DrawOp.cpp,
|
||||||
|
|
@ -12,7 +12,7 @@ file
|
||||||
Ctrl.h,
|
Ctrl.h,
|
||||||
Ctrl.cpp,
|
Ctrl.cpp,
|
||||||
Wnd.cpp,
|
Wnd.cpp,
|
||||||
Proc.cpp,
|
Event.cpp,
|
||||||
Top.h,
|
Top.h,
|
||||||
Top.cpp,
|
Top.cpp,
|
||||||
Clip.cpp,
|
Clip.cpp,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define GUI_EMPTY
|
#define GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
|
||||||
|
|
||||||
#include <winnls.h>
|
|
||||||
|
|
||||||
//#include "imm.h"
|
|
||||||
|
|
||||||
NAMESPACE_UPP
|
|
||||||
|
|
||||||
#define LLOG(x) // LOG(x)
|
|
||||||
|
|
||||||
bool GetShift() { return false; }
|
|
||||||
bool GetCtrl() { return false; }
|
|
||||||
bool GetAlt() { return false; }
|
|
||||||
bool GetCapsLock() { return false; }
|
|
||||||
bool GetMouseLeft() { return false; }
|
|
||||||
bool GetMouseRight() { return false; }
|
|
||||||
bool GetMouseMiddle() { return false; }
|
|
||||||
Point GetMousePos() { return Point(0, 0); }
|
|
||||||
|
|
||||||
END_UPP_NAMESPACE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_FB
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
@ -14,6 +14,11 @@ NAMESPACE_UPP
|
||||||
#define ELOGW(x) // RLOG(GetSysTime() << ": " << x) // Only activate in MT!
|
#define ELOGW(x) // RLOG(GetSysTime() << ": " << x) // Only activate in MT!
|
||||||
#define ELOG(x) // RLOG(GetSysTime() << ": " << x)
|
#define ELOG(x) // RLOG(GetSysTime() << ": " << x)
|
||||||
|
|
||||||
|
void Ctrl::InitFB()
|
||||||
|
{
|
||||||
|
Ctrl::InitTimer();
|
||||||
|
}
|
||||||
|
|
||||||
bool Ctrl::IsAlphaSupported()
|
bool Ctrl::IsAlphaSupported()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -81,35 +86,43 @@ void Ctrl::UnregisterSystemHotKey(int id)
|
||||||
|
|
||||||
bool Ctrl::IsWaitingEvent()
|
bool Ctrl::IsWaitingEvent()
|
||||||
{
|
{
|
||||||
return false;
|
return FBIsWaitingEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ctrl::ProcessEvent(bool *quit)
|
bool Ctrl::ProcessEvent(bool *quit)
|
||||||
{
|
{
|
||||||
ASSERT(IsMainThread());
|
ASSERT(IsMainThread());
|
||||||
|
if(DoCall())
|
||||||
|
return false;
|
||||||
|
if(FBEndSession())
|
||||||
|
return false;
|
||||||
|
if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle())
|
||||||
|
ReleaseCtrlCapture();
|
||||||
|
if(FBProcessEvent(quit)) {
|
||||||
|
DefferedFocusSync();
|
||||||
|
SyncCaret();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SweepMkImageCache();
|
|
||||||
|
|
||||||
bool Ctrl::ProcessEvents(bool *quit)
|
bool Ctrl::ProcessEvents(bool *quit)
|
||||||
{
|
{
|
||||||
/* if(ProcessEvent(quit)) {
|
if(ProcessEvent(quit)) {
|
||||||
while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop())); // LoopCtrl-MF 071008
|
while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop())); // LoopCtrl-MF 071008
|
||||||
TimerProc(GetTickCount());
|
TimerProc(GetTickCount());
|
||||||
SweepMkImageCache();
|
SweepMkImageCache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
SweepMkImageCache();
|
SweepMkImageCache();
|
||||||
TimerProc(GetTickCount());*/
|
TimerProc(GetTickCount());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Ctrl::EventLoop0(Ctrl *ctrl)
|
void Ctrl::EventLoop0(Ctrl *ctrl)
|
||||||
{
|
{
|
||||||
GuiLock __;
|
GuiLock __;
|
||||||
/* ASSERT(IsMainThread());
|
ASSERT(IsMainThread());
|
||||||
ASSERT(LoopLevel == 0 || ctrl);
|
ASSERT(LoopLevel == 0 || ctrl);
|
||||||
LoopLevel++;
|
LoopLevel++;
|
||||||
LLOG("Entering event loop at level " << LoopLevel << BeginIndent);
|
LLOG("Entering event loop at level " << LoopLevel << BeginIndent);
|
||||||
|
|
@ -122,12 +135,12 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
ProcessEvents(&quit);
|
ProcessEvents(&quit);
|
||||||
while(!EndSession() && !quit && ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount())
|
while(!FBEndSession() && !quit && ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount())
|
||||||
{
|
{
|
||||||
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
|
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
|
||||||
SyncCaret();
|
SyncCaret();
|
||||||
GuiSleep(1000);
|
GuiSleep(1000);
|
||||||
if(EndSession()) break;
|
if(FBEndSession()) break;
|
||||||
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents");
|
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents");
|
||||||
ProcessEvents(&quit);
|
ProcessEvents(&quit);
|
||||||
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents");
|
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents");
|
||||||
|
|
@ -136,33 +149,20 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
LoopCtrl = ploop;
|
LoopCtrl = ploop;
|
||||||
LoopLevel--;
|
LoopLevel--;
|
||||||
LLOG(EndIndent << "Leaving event loop ");*/
|
LLOG(EndIndent << "Leaving event loop ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ctrl::GuiSleep0(int ms)
|
void Ctrl::GuiSleep0(int ms)
|
||||||
{
|
{
|
||||||
GuiLock __;
|
GuiLock __;
|
||||||
/* ASSERT(IsMainThread());
|
ASSERT(IsMainThread());
|
||||||
ELOG("GuiSleep");
|
ELOG("GuiSleep");
|
||||||
if(EndSession())
|
if(FBEndSession())
|
||||||
return;
|
return;
|
||||||
ELOG("GuiSleep 2");
|
ELOG("GuiSleep 2");
|
||||||
int level = LeaveGMutexAll();
|
int level = LeaveGMutexAll();
|
||||||
#if !defined(flagDLL) && !defined(PLATFORM_WINCE)
|
FBSleep(ms);
|
||||||
if(!OverwatchThread) {
|
EnterGMutex(level);
|
||||||
DWORD dummy;
|
|
||||||
OverwatchThread = CreateThread(NULL, 0x100000, Win32OverwatchThread, NULL, 0, &dummy);
|
|
||||||
ELOG("ExitLoopEventWait 1");
|
|
||||||
ExitLoopEvent.Wait();
|
|
||||||
}
|
|
||||||
HANDLE h[1];
|
|
||||||
*h = ExitLoopEvent.GetHandle();
|
|
||||||
ELOG("ExitLoopEventWait 2 " << (void *)*h);
|
|
||||||
MsgWaitForMultipleObjects(1, h, FALSE, ms, QS_ALLINPUT);
|
|
||||||
#else
|
|
||||||
MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT);
|
|
||||||
#endif
|
|
||||||
EnterGMutex(level);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect Ctrl::GetWndUpdateRect() const
|
Rect Ctrl::GetWndUpdateRect() const
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
#ifndef _Skeleton_icpp_init_stub
|
#ifndef _Framebuffer_icpp_init_stub
|
||||||
#define _Skeleton_icpp_init_stub
|
#define _Framebuffer_icpp_init_stub
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ description "Paint method and Draw example\377";
|
||||||
|
|
||||||
uses
|
uses
|
||||||
CtrlLib,
|
CtrlLib,
|
||||||
Framebuffer;
|
Framebuffer,
|
||||||
|
WinFb;
|
||||||
|
|
||||||
file
|
file
|
||||||
Draw.cpp;
|
Draw.cpp;
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,5 @@
|
||||||
#define _Paint_icpp_init_stub
|
#define _Paint_icpp_init_stub
|
||||||
#include "CtrlLib/init"
|
#include "CtrlLib/init"
|
||||||
#include "Framebuffer/init"
|
#include "Framebuffer/init"
|
||||||
|
#include "WinFb/init"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlLib/CtrlLib.h>
|
#include <CtrlLib/CtrlLib.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
#include <plugin/bmp/bmp.h>
|
#include <plugin/bmp/bmp.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
#define LLOG(x) // DLOG(x)
|
#define LLOG(x) // DLOG(x)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define GUI_EMPTY
|
#define GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
#include <winnls.h>
|
#include <winnls.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define GUI_EMPTY
|
#define GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CtrlCore/CtrlCore.h>
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
#ifdef GUI_EMPTY
|
#ifdef GUI_SKELETON
|
||||||
|
|
||||||
NAMESPACE_UPP
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
|
|
||||||
164
rainbow/WinFb/Proc.cpp
Normal file
164
rainbow/WinFb/Proc.cpp
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
#include "WinFb.h"
|
||||||
|
|
||||||
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
bool GetShift() { return !!(GetKeyState(VK_SHIFT) & 0x8000); }
|
||||||
|
bool GetCtrl() { return !!(GetKeyState(VK_CONTROL) & 0x8000); }
|
||||||
|
bool GetAlt() { return !!(GetKeyState(VK_MENU) & 0x8000); }
|
||||||
|
bool GetCapsLock() { return !!(GetKeyState(VK_CAPITAL) & 1); }
|
||||||
|
bool GetMouseLeft() { return !!(GetKeyState(VK_LBUTTON) & 0x8000); }
|
||||||
|
bool GetMouseRight() { return !!(GetKeyState(VK_RBUTTON) & 0x8000); }
|
||||||
|
bool GetMouseMiddle() { return !!(GetKeyState(VK_MBUTTON) & 0x8000); }
|
||||||
|
|
||||||
|
LRESULT CALLBACK fbWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
GuiLock __;
|
||||||
|
// LLOG("Ctrl::WindowProc(" << message << ") in " << ::Name(this) << ", focus " << (void *)::GetFocus());
|
||||||
|
switch(message) {
|
||||||
|
case WM_PAINT:
|
||||||
|
ASSERT(hwnd);
|
||||||
|
if(hwnd) {
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC dc = BeginPaint(hwnd, &ps);
|
||||||
|
/*
|
||||||
|
SystemDraw draw(dc);
|
||||||
|
#ifndef PLATFORM_WINCE
|
||||||
|
HPALETTE hOldPal;
|
||||||
|
if(draw.PaletteMode() && SystemDraw::AutoPalette()) {
|
||||||
|
hOldPal = SelectPalette(dc, GetQlibPalette(), TRUE);
|
||||||
|
int n = RealizePalette(dc);
|
||||||
|
LLOG("In paint realized " << n << " colors");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
painting = true;
|
||||||
|
UpdateArea(draw, Rect(ps.rcPaint));
|
||||||
|
painting = false;
|
||||||
|
#ifndef PLATFORM_WINCE
|
||||||
|
if(draw.PaletteMode() && SystemDraw::AutoPalette())
|
||||||
|
SelectPalette(dc, hOldPal, TRUE);
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
EndPaint(hwnd, &ps);
|
||||||
|
}
|
||||||
|
return 0L;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::LEFTDOWN, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::LEFTUP, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::LEFTDOUBLE, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::RIGHTDOWN, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::RIGHTUP, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_RBUTTONDBLCLK:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::RIGHTDOUBLE, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_MBUTTONDOWN:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::MIDDLEDOWN, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_MBUTTONUP:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::MIDDLEUP, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_MBUTTONDBLCLK:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::MIDDLEDOUBLE, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::MOUSEMOVE, Point((dword)lParam));
|
||||||
|
return 0L;
|
||||||
|
case 0x20a: // WM_MOUSEWHEEL:
|
||||||
|
Ctrl::DoMouseFB(Ctrl::MOUSEWHEEL, Point((dword)lParam), (short)HIWORD(wParam));
|
||||||
|
return 0L;
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
SetCursor(NULL);
|
||||||
|
break;
|
||||||
|
// case WM_MENUCHAR:
|
||||||
|
// return MAKELONG(0, MNC_SELECT);
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
case WM_SYSKEYDOWN:
|
||||||
|
case WM_CHAR:
|
||||||
|
// ignorekeyup = false;
|
||||||
|
case WM_KEYUP:
|
||||||
|
case WM_SYSKEYUP:
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
String msgdump;
|
||||||
|
switch(message)
|
||||||
|
{
|
||||||
|
case WM_KEYDOWN: msgdump << "WM_KEYDOWN"; break;
|
||||||
|
case WM_KEYUP: msgdump << "WM_KEYUP"; break;
|
||||||
|
case WM_SYSKEYDOWN: msgdump << "WM_SYSKEYDOWN"; break;
|
||||||
|
case WM_SYSKEYUP: msgdump << "WM_SYSKEYUP"; break;
|
||||||
|
case WM_CHAR: msgdump << "WM_CHAR"; break;
|
||||||
|
}
|
||||||
|
msgdump << " wParam = 0x" << FormatIntHex(wParam, 8)
|
||||||
|
<< ", lParam = 0x" << FormatIntHex(lParam, 8)
|
||||||
|
<< ", ignorekeyup = " << (ignorekeyup ? "true" : "false");
|
||||||
|
LLOG(msgdump);
|
||||||
|
dword keycode = 0;
|
||||||
|
if(message == WM_KEYDOWN) {
|
||||||
|
keycode = KEYtoK((dword)wParam);
|
||||||
|
if(keycode == K_SPACE)
|
||||||
|
keycode = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(message == WM_KEYUP)
|
||||||
|
keycode = KEYtoK((dword)wParam) | K_KEYUP;
|
||||||
|
else
|
||||||
|
if(message == WM_SYSKEYDOWN /*&& ((lParam & 0x20000000) || wParam == VK_F10)*/)
|
||||||
|
keycode = KEYtoK((dword)wParam);
|
||||||
|
else
|
||||||
|
if(message == WM_SYSKEYUP /*&& ((lParam & 0x20000000) || wParam == VK_F10)*/)
|
||||||
|
keycode = KEYtoK((dword)wParam) | K_KEYUP;
|
||||||
|
else
|
||||||
|
if(message == WM_CHAR && wParam != 127 && wParam > 32 || wParam == 32 && KEYtoK(VK_SPACE) == K_SPACE) {
|
||||||
|
#ifdef PLATFORM_WINCE
|
||||||
|
keycode = wParam;
|
||||||
|
#else
|
||||||
|
if(IsWindowUnicode(hwnd)) // TRC 04/10/17: ActiveX Unicode patch
|
||||||
|
keycode = (dword)wParam;
|
||||||
|
else {
|
||||||
|
char b[20];
|
||||||
|
::GetLocaleInfo(MAKELCID(LOWORD(GetKeyboardLayout(0)), SORT_DEFAULT),
|
||||||
|
LOCALE_IDEFAULTANSICODEPAGE, b, 20);
|
||||||
|
int codepage = atoi(b);
|
||||||
|
if(codepage >= 1250 && codepage <= 1258)
|
||||||
|
keycode = ToUnicode((dword)wParam, codepage - 1250 + CHARSET_WIN1250);
|
||||||
|
else
|
||||||
|
keycode = (dword)wParam;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
bool b = false;
|
||||||
|
if(keycode) {
|
||||||
|
b = DispatchKey(keycode, LOWORD(lParam));
|
||||||
|
SyncCaret();
|
||||||
|
if(_this) PostInput();
|
||||||
|
}
|
||||||
|
// LOG("key processed = " << b);
|
||||||
|
if(b || (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP)
|
||||||
|
&& wParam != VK_F4 && !PassWindowsKey((dword)wParam)) // 17.11.2003 Mirek -> invoke system menu
|
||||||
|
return 0L;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// case WM_GETDLGCODE:
|
||||||
|
// return wantfocus ? 0 : DLGC_STATIC;
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
return 1L;
|
||||||
|
case WM_SIZE:
|
||||||
|
case WM_MOVE:
|
||||||
|
return 0L;
|
||||||
|
case WM_HELP:
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
END_UPP_NAMESPACE
|
||||||
59
rainbow/WinFb/Win.cpp
Normal file
59
rainbow/WinFb/Win.cpp
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
#include "WinFb.h"
|
||||||
|
|
||||||
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
HWND fbHWND;
|
||||||
|
bool fbEndSession;
|
||||||
|
|
||||||
|
bool FBEndSession()
|
||||||
|
{
|
||||||
|
return fbEndSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FBIsWaitingEvent()
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
return PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FBProcessEvent(bool *quit)
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
if(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
|
if(msg.message == WM_QUIT && quit)
|
||||||
|
*quit = true;
|
||||||
|
DispatchMessageW(&msg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FBSleep(int ms)
|
||||||
|
{
|
||||||
|
MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FBInit(HINSTANCE hInstance)
|
||||||
|
{
|
||||||
|
GuiLock __;
|
||||||
|
|
||||||
|
Ctrl::InitFB();
|
||||||
|
|
||||||
|
WNDCLASSW wc;
|
||||||
|
Zero(wc);
|
||||||
|
wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
|
||||||
|
wc.lpfnWndProc = (WNDPROC)fbWindowProc;
|
||||||
|
wc.hInstance = hInstance;
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)NULL;
|
||||||
|
wc.lpszClassName = L"UPP-FB-CLASS";
|
||||||
|
RegisterClassW(&wc);
|
||||||
|
fbHWND = CreateWindowW(L"UPP-FB-CLASS", L"", WS_OVERLAPPED,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
NULL, NULL, hInstance, NULL);
|
||||||
|
SetTimer(fbHWND, 1, 10, NULL);
|
||||||
|
|
||||||
|
// Csizeinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
END_UPP_NAMESPACE
|
||||||
29
rainbow/WinFb/WinFb.h
Normal file
29
rainbow/WinFb/WinFb.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include <CtrlCore/CtrlCore.h>
|
||||||
|
|
||||||
|
NAMESPACE_UPP
|
||||||
|
|
||||||
|
LRESULT CALLBACK fbWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
Vector<WString>& coreCmdLine__();
|
||||||
|
Vector<WString> SplitCmdLine__(const char *cmd);
|
||||||
|
|
||||||
|
#define GUI_APP_MAIN \
|
||||||
|
void GuiMainFn_();\
|
||||||
|
\
|
||||||
|
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \
|
||||||
|
{ \
|
||||||
|
UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \
|
||||||
|
UPP::AppInitEnvironment__(); \
|
||||||
|
FBInit(hInstance); \
|
||||||
|
GuiMainFn_(); \
|
||||||
|
UPP::Ctrl::CloseTopCtrls(); \
|
||||||
|
UPP::UsrLog("---------- About to delete this log..."); \
|
||||||
|
UPP::DeleteUsrLog(); \
|
||||||
|
return UPP::GetExitCode(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void GuiMainFn_()
|
||||||
|
|
||||||
|
END_UPP_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
5
rainbow/WinFb/WinFb.upp
Normal file
5
rainbow/WinFb/WinFb.upp
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
file
|
||||||
|
WinFb.h,
|
||||||
|
Win.cpp,
|
||||||
|
Proc.cpp;
|
||||||
|
|
||||||
3
rainbow/WinFb/init
Normal file
3
rainbow/WinFb/init
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#ifndef _WinFb_icpp_init_stub
|
||||||
|
#define _WinFb_icpp_init_stub
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue