mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Draw: support for LinuxGL, Sql: operator*=(VectorMap, SqlSelect)
git-svn-id: svn://ultimatepp.org/upp/trunk@6283 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
60c72b8769
commit
ca7e60660f
8 changed files with 43 additions and 17 deletions
|
|
@ -8,7 +8,7 @@ NAMESPACE_UPP
|
|||
#define LOGTIMING 0
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define LOGMESSAGES 0
|
||||
// #define LOGMESSAGES 1
|
||||
#endif
|
||||
|
||||
#define ELOGW(x) // RLOG(GetSysTime() << ": " << x) // Only activate in MT!
|
||||
|
|
@ -761,6 +761,22 @@ void Ctrl::sProcessMSG(MSG& msg)
|
|||
if(msg.message != WM_SYSKEYDOWN && msg.message != WM_SYSKEYUP
|
||||
|| PassWindowsKey((dword)msg.wParam) || msg.wParam == VK_MENU) //17.11 Mirek - fix to get windows menu invoked on Alt+Space
|
||||
TranslateMessage(&msg); // 04/09/07: TRC fix to make barcode reader going better
|
||||
|
||||
#if 0
|
||||
DDUMP(msg.hwnd);
|
||||
for(WinMsg *m = sWinMsg; m->ID; m++)
|
||||
if(m->ID == msg.message) {
|
||||
RLOG(m->name << ' ' <<
|
||||
Sprintf(", wParam = %d (0x%x), lParam = %d (0x%x)",
|
||||
msg.wParam, msg.wParam, msg.lParam, msg.lParam));
|
||||
break;
|
||||
}
|
||||
|
||||
char cls[200];
|
||||
GetClassName(msg.hwnd, cls, 200);
|
||||
DDUMP(cls);
|
||||
#endif
|
||||
|
||||
if(IsWindowUnicode(msg.hwnd))
|
||||
DispatchMessageW(&msg);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void ChDraw(Draw& w, int x, int y, int cx, int cy, const Image& img, const Rect
|
|||
{
|
||||
LTIMING("ChDraw");
|
||||
if(cx > 0 && cy > 0) {
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
w.DrawImage(x, y, cx, cy, img, src);
|
||||
#else
|
||||
ChImageMaker m;
|
||||
|
|
@ -253,7 +253,11 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
}
|
||||
if(op == LOOK_PAINT || op == LOOK_PAINTEDGE) {
|
||||
LTIMING("ChPaint Image");
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
w.Offset(r.TopLeft());
|
||||
#else
|
||||
w.Clipoff(r);
|
||||
#endif
|
||||
Rect sr(p, p2);
|
||||
Size sz2(isz.cx - sr.right, isz.cy - sr.bottom);
|
||||
Rect r = RectC(p.x, p.y, sz.cx - sr.left - sz2.cx, sz.cy - sr.top - sz2.cy);
|
||||
|
|
@ -274,7 +278,7 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
ChDraw(w, r.right, p.y, sz2.cx, r.Height(), img,
|
||||
RectC(sr.right, p.y, sz2.cx, sr.Height()));
|
||||
if(op == LOOK_PAINT) {
|
||||
if(IsNull(r) || IsNull(sr)) {
|
||||
if(IsNull(r) || IsNull(sr)) {
|
||||
w.End();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -284,7 +288,7 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
Size sz;
|
||||
sz.cx = (tile & 1 ? sr : r).GetWidth();
|
||||
sz.cy = (tile & 2 ? sr : r).GetHeight();
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
DrawTiles(w, r, img, sz, sr);
|
||||
#else
|
||||
img = Rescale(img, sz, sr);
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ void AddRefreshRect(Vector<Rect>& invalid, const Rect& _r);
|
|||
void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn = false); //??? TODO
|
||||
void DrawRect(Draw& w, int x, int y, int cx, int cy, const Image& img, bool ra = false);
|
||||
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
void DrawTiles(Draw& w, int x, int y, int cx, int cy, const Image& img, const Size& isz, const Rect& src);
|
||||
void DrawTiles(Draw& w, const Rect& rect, const Image& img, const Size& isz, const Rect& src);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#ifdef flagWINGL
|
||||
#include <WinGl/FontGl.h>
|
||||
#include <WinGl/ResGl.h>
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
#include <CoreGl/FontGl.h>
|
||||
#include <CoreGl/ResGl.h>
|
||||
#endif
|
||||
|
||||
#define LLOG(x) // LOG(x)
|
||||
|
|
@ -31,7 +31,7 @@ WString TextUnicode(const char *s, int n, byte cs, Font font)
|
|||
void Draw::DrawText(int x, int y, int angle, const wchar *text, Font font,
|
||||
Color ink, int n, const int *dx)
|
||||
{
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
if(IsNull(ink))
|
||||
return;
|
||||
DrawTextOp(x, y, angle, text, font, ink, n, dx);
|
||||
|
|
@ -221,7 +221,7 @@ void Draw::DrawText(int x, int y, const String& text, Font font, Color ink, cons
|
|||
|
||||
Size GetTextSize(const wchar *text, Font font, int n)
|
||||
{
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
return GetTextSize(text, resources.GetFont(font), n);
|
||||
#else
|
||||
FontInfo fi = font.Info();
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn)
|
|||
DrawRect(w, rect.left, rect.top, rect.Width(), rect.Height(), img, ralgn);
|
||||
}
|
||||
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
void DrawTiles(Draw& w, int x, int y, int cx, int cy, const Image& img, const Size& isz, const Rect& src) {
|
||||
w.Clip(x, y, cx, cy);
|
||||
Size sz = isz;
|
||||
|
|
|
|||
|
|
@ -139,9 +139,6 @@ void Font::InitStdFont()
|
|||
int height = 0;
|
||||
GetStdFontSys(name, height);
|
||||
#ifdef PLATFORM_WIN32
|
||||
#ifdef flagWINGL
|
||||
AStdFont = Font(FindFaceNameIndex("Tahoma"), 12);
|
||||
#else
|
||||
int q = FindFaceNameIndex(name);
|
||||
if(q <= 0)
|
||||
q = FindFaceNameIndex("Tahoma");
|
||||
|
|
@ -151,7 +148,6 @@ void Font::InitStdFont()
|
|||
q = FindFaceNameIndex("MS Sans Serif");
|
||||
if(q > 0)
|
||||
AStdFont = Font(q, max(height, 1));
|
||||
#endif
|
||||
SyncStdFont();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ Vector<FaceInfo> GetAllFacesSys()
|
|||
#define GLYPHINFOCACHE 31
|
||||
|
||||
#ifdef flagWINGL
|
||||
#include <WinGl/FontGl.h>
|
||||
#include <WinGl/ResGl.h>
|
||||
#include <CoreGl/FontGl.h>
|
||||
#include <CoreGl/ResGl.h>
|
||||
GlyphInfo GetGlyphInfoSys(Font font, int chr)
|
||||
{
|
||||
static GlyphInfo gi;
|
||||
|
|
|
|||
|
|
@ -499,6 +499,16 @@ void SqlLoadColumn(T& t, SqlId table, SqlId column, SqlId key = SqlId("ID"))
|
|||
t.Add(sql[key], sql[column]);
|
||||
}
|
||||
|
||||
template<class K, class V>
|
||||
void operator*=(VectorMap<K, V>& map, SqlSelect select)
|
||||
{
|
||||
map.Clear();
|
||||
Sql sql;
|
||||
sql * select;
|
||||
while(sql.Fetch())
|
||||
map.Add(sql[0], sql[1]);
|
||||
}
|
||||
|
||||
// Deprecated, use SqlPerformScript instead
|
||||
struct StdStatementExecutor : StatementExecutor {
|
||||
StdStatementExecutor(SqlSession& session) : cursor(session) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue