migrate MwLLColor and MwLLPixmap
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
e1824cffa0
commit
6e6233edc8
55 changed files with 754 additions and 669 deletions
3
configure
vendored
3
configure
vendored
|
|
@ -44,7 +44,6 @@ require("./pl/utils.pl");
|
|||
|
||||
param_set("classic-theme", 0);
|
||||
param_set("stb-image", 1);
|
||||
param_set("opengl", 0);
|
||||
param_set("vulkan", 0);
|
||||
param_set("vulkan-string-helper", 1);
|
||||
param_set("shared", 1);
|
||||
|
|
@ -114,9 +113,11 @@ sub def_platform {
|
|||
}
|
||||
if ($target eq "Windows") {
|
||||
param_set("gdi-text", 1);
|
||||
param_set("opengl", 1);
|
||||
}
|
||||
else {
|
||||
param_set("gdi-text", 0);
|
||||
param_set("opengl", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
#ifndef __MW_BASETYPES_H__
|
||||
#define __MW_BASETYPES_H__
|
||||
|
||||
typedef struct _MwPoint MwPoint;
|
||||
typedef struct _MwRect MwRect;
|
||||
typedef struct _MwSizeHints MwSizeHints;
|
||||
typedef struct _MwFont MwFont;
|
||||
typedef struct _MwCursor MwCursor;
|
||||
typedef struct _MwRGB MwRGB;
|
||||
typedef struct _MwPoint MwPoint;
|
||||
typedef struct _MwRect MwRect;
|
||||
typedef struct _MwSizeHints MwSizeHints;
|
||||
typedef struct _MwFontResource MwFontResource;
|
||||
typedef struct _MwCursor MwCursor;
|
||||
typedef struct _MwRGB MwRGB;
|
||||
|
||||
typedef unsigned char MwBool;
|
||||
#define MwTRUE ((MwBool)1)
|
||||
|
|
@ -98,7 +98,7 @@ struct _MwCursor {
|
|||
unsigned int data[MwCursorDataHeight];
|
||||
};
|
||||
|
||||
struct _MwFont {
|
||||
struct _MwFontResource {
|
||||
int left;
|
||||
int top;
|
||||
unsigned char data[16];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ MWDECL int MWAPI MwGetColorDifference(MwWidget handle);
|
|||
* @param text Color text
|
||||
* @return Color
|
||||
*/
|
||||
MWDECL MwLLColor MWAPI MwParseColor(MwWidget handle, const char* text);
|
||||
MWDECL MwColor MWAPI MwParseColor(MwWidget handle, const char* text);
|
||||
|
||||
/*!
|
||||
* @brief Parses a color text
|
||||
|
|
@ -50,7 +50,7 @@ MWDECL void MWAPI MwColorTableInit(void);
|
|||
* @param b Blue
|
||||
* @return Color
|
||||
*/
|
||||
MWDECL MwLLColor MWAPI MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b);
|
||||
MWDECL MwColor MWAPI MwLightenColor(MwWidget handle, MwColor color, int r, int g, int b);
|
||||
|
||||
/*!
|
||||
* @brief Fix a rectangle
|
||||
|
|
@ -65,7 +65,7 @@ MWDECL void MWAPI MwFixRect(MwRect* rect);
|
|||
* @param rect Rectangle area
|
||||
* @param color Color
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
|
||||
MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwColor color);
|
||||
|
||||
/*!
|
||||
* @brief Draws a rectangle
|
||||
|
|
@ -73,7 +73,7 @@ MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
|
|||
* @param rect Rectangle area
|
||||
* @param color Color
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawRectLine(MwWidget handle, MwRect* rect, MwLLColor color);
|
||||
MWDECL void MWAPI MwDrawRectLine(MwWidget handle, MwRect* rect, MwColor color);
|
||||
|
||||
/*!
|
||||
* @brief Draws a filled rectangle that fades to a darker color
|
||||
|
|
@ -81,7 +81,7 @@ MWDECL void MWAPI MwDrawRectLine(MwWidget handle, MwRect* rect, MwLLColor color)
|
|||
* @param rect Rectangle area
|
||||
* @param color Color
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
|
||||
MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwColor color);
|
||||
|
||||
/*!
|
||||
* @brief Draws a frame
|
||||
|
|
@ -91,7 +91,7 @@ MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor colo
|
|||
* @param invert Invert the 3D border color or not
|
||||
* @warning `rect` gets changed to the area of rectangle inside
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
|
||||
MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwColor color, int invert);
|
||||
|
||||
/*!
|
||||
* @brief Draws a frame
|
||||
|
|
@ -102,7 +102,7 @@ MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, in
|
|||
* @param border Border
|
||||
* @warning `rect` gets changed to the area of rectangle inside
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
|
||||
MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwColor color, int invert, int border);
|
||||
|
||||
/*!
|
||||
* @brief Does the DrawFrame/DrawRect combo used for drawing widget.
|
||||
|
|
@ -112,7 +112,7 @@ MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor
|
|||
* @param invert Invert the 3D border color or not
|
||||
* @warning `rect` gets changed to the area of rectangle inside
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
|
||||
MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwColor color, int invert, int border);
|
||||
|
||||
/*!
|
||||
* @brief Draws a triangle
|
||||
|
|
@ -121,7 +121,7 @@ MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor colo
|
|||
* @param color Color
|
||||
* @param invert Invert the 3D border color or not
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction);
|
||||
MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwColor color, int invert, int direction);
|
||||
|
||||
/*!
|
||||
* @brief Draws a frame with specified border width
|
||||
|
|
@ -134,7 +134,7 @@ MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
* @param same Same as dark color
|
||||
* @warning `rect` gets changed to the area of rectangle inside
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
|
||||
MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwColor color, int invert, int border, int diff, int same);
|
||||
|
||||
/*!
|
||||
* @brief Creates a pixmap from image
|
||||
|
|
@ -142,16 +142,7 @@ MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
* @param path Path
|
||||
* @return Pixmap
|
||||
*/
|
||||
MWDECL MwLLPixmap MWAPI MwLoadImage(MwWidget handle, const char* path);
|
||||
|
||||
/*!
|
||||
* @brief Get color components
|
||||
* @param color Color
|
||||
* @param red Pointer to red color
|
||||
* @param green Pointer to green color
|
||||
* @param blue Pointer to blue color
|
||||
*/
|
||||
MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue);
|
||||
MWDECL MwPixmap MWAPI MwLoadImage(MwWidget handle, const char* path);
|
||||
|
||||
/*!
|
||||
* @brief Creates a pixmap from raw data
|
||||
|
|
@ -161,34 +152,82 @@ MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue);
|
|||
* @param height Height
|
||||
* @return Pixmap
|
||||
*/
|
||||
MWDECL MwLLPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
|
||||
MWDECL MwPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
|
||||
|
||||
/*!
|
||||
* @brief Updates a pixmap using raw data
|
||||
* @param pixmap Pixmap to update
|
||||
* @param rgb RGBA data
|
||||
*/
|
||||
MWDECL void MWAPI MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb);
|
||||
MWDECL void MWAPI MwPixmapReloadRaw(MwPixmap pixmap, unsigned char* rgb);
|
||||
|
||||
/*!
|
||||
* @brief Gets the raw data of pixmap
|
||||
* @param pixmap Pixmap
|
||||
* @return RGBA data
|
||||
*/
|
||||
MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwLLPixmap pixmap);
|
||||
MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwPixmap pixmap);
|
||||
|
||||
/*!
|
||||
* @brief Gets the size of pixmap
|
||||
* @param pixmap Pixmap
|
||||
* @param rect Size
|
||||
*/
|
||||
MWDECL void MWAPI MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect);
|
||||
MWDECL void MWAPI MwPixmapGetSize(MwPixmap pixmap, MwRect* rect);
|
||||
|
||||
/*!
|
||||
* @brief Updates the pixmap
|
||||
* @param pixmap Pixmap
|
||||
*/
|
||||
MWDECL void MWAPI MwPixmapUpdate(MwPixmap pixmap);
|
||||
|
||||
/*!
|
||||
* @brief Destroys the pixmap
|
||||
* @param pixmap Pixmap
|
||||
*/
|
||||
MWDECL void MWAPI MwDestroyPixmap(MwLLPixmap pixmap);
|
||||
MWDECL void MWAPI MwDestroyPixmap(MwPixmap pixmap);
|
||||
|
||||
/*!
|
||||
* @brief Draws the pixmap
|
||||
* @param handle Handle
|
||||
* @param rect Size
|
||||
* @param pixmap Pixmap
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawPixmap(MwWidget handle, MwRect* rect, MwPixmap pixmap);
|
||||
|
||||
/*!
|
||||
* @brief Allocates a color
|
||||
* @param handle Widget
|
||||
* @param red Red
|
||||
* @param green Green
|
||||
* @param bilue Blue
|
||||
* @return Color
|
||||
*/
|
||||
MWDECL MwColor MWAPI MwAllocColor(MwWidget handle, unsigned int red, unsigned int green, unsigned int blue);
|
||||
|
||||
/*!
|
||||
* @brief Get color components
|
||||
* @param color Color
|
||||
* @param red Pointer to red color
|
||||
* @param green Pointer to green color
|
||||
* @param blue Pointer to blue color
|
||||
*/
|
||||
MWDECL void MWAPI MwColorGet(MwColor color, int* red, int* green, int* blue);
|
||||
|
||||
/*!
|
||||
* @brief Update color
|
||||
* @param color Color
|
||||
* @param red Pointer to red color
|
||||
* @param green Pointer to green color
|
||||
* @param blue Pointer to blue color
|
||||
*/
|
||||
MWDECL void MWAPI MwColorUpdate(MwColor c, int r, int g, int b);
|
||||
|
||||
/*!
|
||||
* @brief Allocates a color
|
||||
* @param color Color
|
||||
*/
|
||||
MWDECL void MWAPI MwFreeColor(MwColor color);
|
||||
|
||||
/*!
|
||||
* @brief Creates a pixmap from XPM data
|
||||
|
|
@ -196,7 +235,7 @@ MWDECL void MWAPI MwDestroyPixmap(MwLLPixmap pixmap);
|
|||
* @param data Data
|
||||
* @return Pixmap
|
||||
*/
|
||||
MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
|
||||
MWDECL MwPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
|
||||
|
||||
/*!
|
||||
* @brief Creates a pixmap from icon data
|
||||
|
|
@ -204,7 +243,7 @@ MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
|
|||
* @param data Data
|
||||
* @return Pixmap
|
||||
*/
|
||||
MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
|
||||
MWDECL MwPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
|
||||
|
||||
/*!
|
||||
* @brief Draws a diamond
|
||||
|
|
@ -213,7 +252,7 @@ MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
|
|||
* @param color Color
|
||||
* @param invert Invert the 3D border color or not
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
|
||||
MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwColor color, int invert);
|
||||
|
||||
/*!
|
||||
* @brief Draws a circle
|
||||
|
|
@ -224,7 +263,7 @@ MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
* @param filled Fill the circle or not
|
||||
* @param outward
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor background, int filled);
|
||||
MWDECL void MWAPI MwDrawCircle(MwWidget handle, MwRect* rect, MwColor color, MwColor background, int filled);
|
||||
|
||||
/*!
|
||||
* @brief Calculate intersect of 2 rectangles
|
||||
|
|
@ -244,7 +283,7 @@ MWDECL void MwIntersectRect(MwRect* a, const MwRect* b);
|
|||
* @param align Align
|
||||
* @param color Color
|
||||
*/
|
||||
MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color);
|
||||
MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwColor color);
|
||||
|
||||
/*!
|
||||
* @brief Calculates a text width
|
||||
|
|
@ -272,7 +311,7 @@ MWDECL int MWAPI MwTextHeight(MwWidget handle, MwFLFont font, const char* text);
|
|||
* @param color Color name
|
||||
* @return Color
|
||||
*/
|
||||
MWDECL MwLLColor MWAPI MwParseColorName(MwWidget handle, const char* color);
|
||||
MWDECL MwColor MWAPI MwParseColorName(MwWidget handle, const char* color);
|
||||
|
||||
/*!
|
||||
* @brief Parses a color name
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ struct _MwLLCommonPixmap {
|
|||
int width;
|
||||
int height;
|
||||
unsigned char* raw;
|
||||
unsigned char* before_blend;
|
||||
void* internal;
|
||||
};
|
||||
|
||||
#ifdef USE_DBUS
|
||||
|
|
@ -255,7 +253,7 @@ MWDECL void (*MwLLBeginDraw)(MwLL handle);
|
|||
MWDECL void (*MwLLEndDraw)(MwLL handle);
|
||||
|
||||
MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
|
||||
MWDECL void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);
|
||||
MWDECL void (*MwLLColorUpdate)(MwLLColor c, int r, int g, int b);
|
||||
MWDECL void (*MwLLFreeColor)(MwLLColor color);
|
||||
|
||||
MWDECL void (*MwLLGetXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||
|
|
@ -362,7 +360,7 @@ MWDECL int MwFL_STBTTSetup(void);
|
|||
MWDECL int MwFL_GDISetup(void);
|
||||
#endif
|
||||
|
||||
MWDECL int (*MwFLDrawText)(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color);
|
||||
MWDECL int (*MwFLDrawText)(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwColor color);
|
||||
MWDECL int (*MwFLTextWidth)(MwFLFont ttf, const char* text);
|
||||
MWDECL int (*MwFLTextHeight)(MwFLFont ttf, int count);
|
||||
MWDECL int (*MwFLTextHeightWithText)(MwFLFont ttf, const char* text);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ struct _MwLLGDI {
|
|||
struct _MwLLGDIColor {
|
||||
struct _MwLLCommonColor common;
|
||||
|
||||
MwLL handle;
|
||||
HBRUSH brush;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ struct _MwLLX11 {
|
|||
struct _MwLLX11Color {
|
||||
struct _MwLLCommonColor common;
|
||||
|
||||
MwLL handle;
|
||||
unsigned long pixel;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -120,4 +120,11 @@
|
|||
|
||||
#define MwInline static __inline
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* when was this added to gcc? */
|
||||
#define MW_DEPRECATE(reason) __attribute__((deprecated((reason))))
|
||||
#else
|
||||
#define MW_DEPRECATE(reason)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ extern "C" {
|
|||
/*!
|
||||
* @brief Default font data
|
||||
*/
|
||||
MWDECL MwFont MwFontData[];
|
||||
MWDECL MwFontResource MwFontData[];
|
||||
|
||||
/*!
|
||||
* @brief Default bold font data
|
||||
*/
|
||||
MWDECL MwFont MwBoldFontData[];
|
||||
MWDECL MwFontResource MwBoldFontData[];
|
||||
|
||||
/*!
|
||||
* @brief Default TTF font data
|
||||
|
|
|
|||
|
|
@ -38,8 +38,14 @@ typedef struct _MwDocument* MwDocument;
|
|||
typedef struct _MwMouse MwMouse;
|
||||
typedef struct _MwTTFInfo* MwTTFInfo;
|
||||
#ifdef _MILSKO
|
||||
typedef struct _MwPixmap* MwPixmap;
|
||||
typedef struct _MwColor* MwColor;
|
||||
typedef struct _MwFont* MwFont;
|
||||
typedef struct _MwWidget* MwWidget;
|
||||
#else
|
||||
typedef void* MwPixmap;
|
||||
typedef void* MwColor;
|
||||
typedef void* MwFont;
|
||||
typedef void* MwWidget;
|
||||
#endif
|
||||
typedef void (*MwHandler)(MwWidget handle);
|
||||
|
|
@ -84,9 +90,26 @@ struct _MwVoidKeyValue {
|
|||
#include <Mw/LowLevel.h>
|
||||
|
||||
#ifdef _MILSKO
|
||||
struct _MwPixmap {
|
||||
MwLLPixmap lowlevel;
|
||||
MwLLCommonPixmap common;
|
||||
|
||||
MwWidget handle;
|
||||
unsigned char* raw;
|
||||
};
|
||||
|
||||
struct _MwColor {
|
||||
MwLLColor lowlevel;
|
||||
MwLLCommonColor common;
|
||||
};
|
||||
|
||||
struct _MwFont {
|
||||
MwFLFont lowlevel;
|
||||
};
|
||||
|
||||
struct _MwWidget {
|
||||
char* name;
|
||||
MwLLColor bgcolor;
|
||||
char* name;
|
||||
MwColor bgcolor;
|
||||
|
||||
MwLL lowlevel;
|
||||
MwWidget parent;
|
||||
|
|
@ -106,7 +129,7 @@ struct _MwWidget {
|
|||
MwHandler destroy_inject;
|
||||
MwHandlerProp prop_inject_pixmap; /* this is for pixmap; do not use */
|
||||
|
||||
MwLLPixmap* pixmaps;
|
||||
MwPixmap* pixmaps;
|
||||
|
||||
MwIntegerKeyValue* integer;
|
||||
MwTextKeyValue* text;
|
||||
|
|
@ -163,8 +186,8 @@ struct _MwViewport {
|
|||
};
|
||||
|
||||
struct _MwListBoxEntry {
|
||||
char** name;
|
||||
MwLLPixmap pixmap;
|
||||
char** name;
|
||||
MwPixmap pixmap;
|
||||
};
|
||||
|
||||
struct _MwListBox {
|
||||
|
|
@ -186,7 +209,7 @@ struct _MwComboBox {
|
|||
|
||||
struct _MwTreeViewEntry {
|
||||
char* label;
|
||||
MwLLPixmap pixmap;
|
||||
MwPixmap pixmap;
|
||||
MwTreeViewEntry** tree;
|
||||
int opened;
|
||||
int selected;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ MwInline int MwListBoxSet(MwWidget handle, int row, int col, const char* text) {
|
|||
* @param index Index
|
||||
* @param icon Icon
|
||||
*/
|
||||
MwInline void MwListBoxSetIcon(MwWidget handle, int index, MwLLPixmap icon) {
|
||||
MwInline void MwListBoxSetIcon(MwWidget handle, int index, MwPixmap icon) {
|
||||
MwVaWidgetExecute(handle, "mwListBoxSetIcon", NULL, index, icon);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ MWDECL MwClass MwTreeViewClass;
|
|||
* @parma pixmap Pixmap
|
||||
* @param item Item
|
||||
*/
|
||||
MwInline void* MwTreeViewAdd(MwWidget handle, void* parent, MwLLPixmap pixmap, const char* item) {
|
||||
MwInline void* MwTreeViewAdd(MwWidget handle, void* parent, MwPixmap pixmap, const char* item) {
|
||||
void* out;
|
||||
MwVaWidgetExecute(handle, "mwTreeViewAdd", &out, parent, pixmap, item);
|
||||
return out;
|
||||
|
|
@ -76,7 +76,7 @@ MwInline void MwTreeViewSetLabel(MwWidget handle, void* item, const char* label)
|
|||
* @param item Item
|
||||
* @param pixmap Pixmap
|
||||
*/
|
||||
MwInline void MwTreeViewSetPixmap(MwWidget handle, void* item, MwLLPixmap pixmap) {
|
||||
MwInline void MwTreeViewSetPixmap(MwWidget handle, void* item, MwPixmap pixmap) {
|
||||
MwVaWidgetExecute(handle, "mwTreeViewSetPixmap", NULL, item, pixmap);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,12 +46,10 @@ MwLLPixmap MwLLCairoCreatePixmap(struct _MwLLCairo handle, unsigned char* data,
|
|||
if(width >= INT16_MAX) width = INT16_MAX;
|
||||
if(height >= INT16_MAX) height = INT16_MAX;
|
||||
|
||||
r->common.width = width;
|
||||
r->common.height = height;
|
||||
r->common.raw = malloc(4 * width * height);
|
||||
r->common.before_blend = malloc(4 * width * height);
|
||||
r->common.width = width;
|
||||
r->common.height = height;
|
||||
r->common.raw = malloc(4 * width * height);
|
||||
memcpy(r->common.raw, data, 4 * width * height);
|
||||
memcpy(r->common.before_blend, data, 4 * width * height);
|
||||
|
||||
r->wayland.cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
|
||||
|
||||
|
|
@ -82,7 +80,6 @@ void MwLLCairoPixmapUpdate(MwLLPixmap r) {
|
|||
|
||||
void MwLLCairoDestroyPixmap(MwLLPixmap pixmap) {
|
||||
cairo_surface_destroy(pixmap->wayland.cs);
|
||||
free(pixmap->common.before_blend);
|
||||
free(pixmap->common.raw);
|
||||
free(pixmap);
|
||||
}
|
||||
|
|
@ -192,13 +189,11 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
|
|||
}
|
||||
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||
MwLLColor c = malloc(sizeof(*c));
|
||||
MwLLColorUpdate(handle, c, r, g, b);
|
||||
MwLLColorUpdate(c, r, g, b);
|
||||
return c;
|
||||
}
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||
(void)handle;
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLLColor c, int r, int g, int b) {
|
||||
c->common.red = r;
|
||||
c->common.green = g;
|
||||
c->common.blue = b;
|
||||
|
|
|
|||
|
|
@ -532,15 +532,17 @@ static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
c->gdi.brush = NULL;
|
||||
c->gdi.handle = handle;
|
||||
c->gdi.brush = NULL;
|
||||
|
||||
MwLLColorUpdate(handle, c, r, g, b);
|
||||
MwLLColorUpdate(c, r, g, b);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||
HDC dc = GetDC(handle->gdi.hWnd);
|
||||
static void MwLLColorUpdateImpl(MwLLColor c, int r, int g, int b) {
|
||||
MwLL handle = c->gdi.handle;
|
||||
HDC dc = GetDC(handle->gdi.hWnd);
|
||||
COLORREF color;
|
||||
|
||||
if(r > 255) r = 255;
|
||||
|
|
@ -665,14 +667,6 @@ static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int wid
|
|||
|
||||
memcpy(r->common.raw, data, 4 * width * height);
|
||||
|
||||
r->common.before_blend = malloc(width * height * 4);
|
||||
if(!r->common.before_blend) {
|
||||
printf("Out Of Memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(r->common.before_blend, data, 4 * width * height);
|
||||
|
||||
r->common.width = width;
|
||||
r->common.height = height;
|
||||
|
||||
|
|
@ -748,7 +742,6 @@ static void MwLLPixmapUpdateImpl(MwLLPixmap r) {
|
|||
}
|
||||
|
||||
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||
free(pixmap->common.before_blend);
|
||||
free(pixmap->common.raw);
|
||||
DeleteObject(pixmap->gdi.hMask);
|
||||
DeleteObject(pixmap->gdi.hMask2);
|
||||
|
|
|
|||
|
|
@ -589,14 +589,12 @@ static void MwLLEndDrawImpl(MwLL handle) {
|
|||
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||
MwLLColor c = (MwLLColor)malloc(sizeof(*c));
|
||||
|
||||
MwLLColorUpdate(handle, c, r, g, b);
|
||||
MwLLColorUpdate(c, r, g, b);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||
(void)handle;
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLLColor c, int r, int g, int b) {
|
||||
c->common.red = r;
|
||||
c->common.green = g;
|
||||
c->common.blue = b;
|
||||
|
|
|
|||
|
|
@ -549,13 +549,15 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
|
|||
}
|
||||
|
||||
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||
MwLLColor c = malloc(sizeof(*c));
|
||||
MwLLColorUpdate(handle, c, r, g, b);
|
||||
MwLLColor c = malloc(sizeof(*c));
|
||||
c->x11.handle = handle;
|
||||
MwLLColorUpdate(c, r, g, b);
|
||||
return c;
|
||||
}
|
||||
|
||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||
static void MwLLColorUpdateImpl(MwLLColor c, int r, int g, int b) {
|
||||
XColor xc;
|
||||
MwLL handle = c->x11.handle;
|
||||
|
||||
if(handle->x11.red_mask == 0) {
|
||||
if(r > 255) r = 255;
|
||||
|
|
@ -1097,9 +1099,6 @@ static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int wid
|
|||
r->common.raw = malloc(4 * width * height);
|
||||
memcpy(r->common.raw, data, 4 * width * height);
|
||||
|
||||
r->common.before_blend = malloc(4 * width * height);
|
||||
memcpy(r->common.before_blend, data, 4 * width * height);
|
||||
|
||||
XGetWindowAttributes(handle->x11.display, handle->x11.window, &attr);
|
||||
|
||||
r->common.width = width;
|
||||
|
|
@ -1155,7 +1154,6 @@ static void MwLLPixmapUpdateImpl(MwLLPixmap r) {
|
|||
}
|
||||
|
||||
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||
free(pixmap->common.before_blend);
|
||||
free(pixmap->common.raw);
|
||||
XDestroyImage(pixmap->x11.image);
|
||||
XDestroyImage(pixmap->x11.mask);
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ struct color {
|
|||
|
||||
static struct color* colors = NULL;
|
||||
|
||||
MwLLColor MwParseColorName(MwWidget handle, const char* color) {
|
||||
MwColor MwParseColorName(MwWidget handle, const char* color) {
|
||||
MwRGB rgb;
|
||||
MwParseColorNameNoAllocate(color, &rgb);
|
||||
return MwLLAllocColor(handle->lowlevel, rgb.red, rgb.green, rgb.blue);
|
||||
return MwAllocColor(handle, rgb.red, rgb.green, rgb.blue);
|
||||
}
|
||||
|
||||
void MwParseColorNameNoAllocate(const char* color, MwRGB* rgb) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ typedef struct color_picker {
|
|||
MwWidget value_slider;
|
||||
MwWidget color_display_text;
|
||||
MwWidget finish;
|
||||
MwLLPixmap color_picker_pixmap;
|
||||
MwPixmap color_picker_pixmap;
|
||||
double value;
|
||||
MwRGB chosen_color;
|
||||
unsigned char color_picker_image_data[PICKER_SIZE * PICKER_SIZE * 4];
|
||||
|
|
@ -239,7 +239,7 @@ static void MWAPI color_display_text_change(MwWidget handle, void* user,
|
|||
color_picker_t* picker = user;
|
||||
char hexColor[9];
|
||||
char fgColor[9];
|
||||
MwLLColor color;
|
||||
MwColor color;
|
||||
int fr, fg, fb;
|
||||
|
||||
(void)call;
|
||||
|
|
@ -248,9 +248,9 @@ static void MWAPI color_display_text_change(MwWidget handle, void* user,
|
|||
|
||||
color = MwParseColor(handle, hexColor);
|
||||
|
||||
fr = color->common.red > 128 ? 0 : 255;
|
||||
fg = color->common.green > 128 ? 0 : 255;
|
||||
fb = color->common.blue > 128 ? 0 : 255;
|
||||
fr = color->common->red > 128 ? 0 : 255;
|
||||
fg = color->common->green > 128 ? 0 : 255;
|
||||
fb = color->common->blue > 128 ? 0 : 255;
|
||||
|
||||
MwStringPrintIntoBuffer(fgColor, 9, "#%02X%02X%02X", fr, fg, fb);
|
||||
MwSetText(picker->color_display_text, MwNforeground, fgColor);
|
||||
|
|
@ -258,11 +258,11 @@ static void MWAPI color_display_text_change(MwWidget handle, void* user,
|
|||
MwSetText(picker->color_display_text, MwNbackground, hexColor);
|
||||
MwSetText(picker->color_display_text, MwNtext, hexColor);
|
||||
|
||||
picker->chosen_color.red = color->common.red;
|
||||
picker->chosen_color.green = color->common.green;
|
||||
picker->chosen_color.blue = color->common.blue;
|
||||
picker->chosen_color.red = color->common->red;
|
||||
picker->chosen_color.green = color->common->green;
|
||||
picker->chosen_color.blue = color->common->blue;
|
||||
|
||||
MwLLFreeColor(color);
|
||||
MwFreeColor(color);
|
||||
}
|
||||
|
||||
static void MWAPI color_picker_finish(MwWidget handle, void* user,
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ typedef struct filechooser {
|
|||
MwWidget okay;
|
||||
MwWidget cancel;
|
||||
|
||||
MwLLPixmap dir;
|
||||
MwLLPixmap file;
|
||||
MwLLPixmap back;
|
||||
MwLLPixmap forward;
|
||||
MwLLPixmap up;
|
||||
MwLLPixmap computer;
|
||||
MwPixmap dir;
|
||||
MwPixmap file;
|
||||
MwPixmap back;
|
||||
MwPixmap forward;
|
||||
MwPixmap up;
|
||||
MwPixmap computer;
|
||||
} filechooser_t;
|
||||
|
||||
static void scan(MwWidget handle, const char* path, int record);
|
||||
|
|
@ -506,7 +506,7 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||
|
||||
static void setup_fallback_filechooser(MwWidget window, int dir) {
|
||||
char* path;
|
||||
MwLLPixmap icon;
|
||||
MwPixmap icon;
|
||||
filechooser_t* fc = malloc(sizeof(*fc));
|
||||
memset(fc, 0, sizeof(*fc));
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
|
|||
if(flag & MwMB_BUTTONYES) spawn_button(window, w - (x += 8 + 80), h - 8 - 24, MwMB_BUTTONYES, "Yes");
|
||||
|
||||
if((flag & MwMB_ICONMASK) != 0) {
|
||||
MwWidget icon;
|
||||
MwLLPixmap px;
|
||||
MwU32* data = NULL;
|
||||
MwWidget icon;
|
||||
MwPixmap px;
|
||||
MwU32* data = NULL;
|
||||
|
||||
icon = MwCreateWidget(MwImageClass, "image", window, 8, (h - 48) / 2, 48, 48);
|
||||
|
||||
|
|
|
|||
325
src/draw.c
325
src/draw.c
|
|
@ -38,19 +38,19 @@ static int hex(const char* txt, int len) {
|
|||
return r;
|
||||
}
|
||||
|
||||
static void color_set_disabled_if_disabled(MwWidget handle, MwLLColor rgb) {
|
||||
static void color_set_disabled_if_disabled(MwWidget handle, MwColor rgb) {
|
||||
int n;
|
||||
|
||||
if((n = MwGetInteger(handle, MwNdisabled)) != MwDEFAULT && n) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
MwColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
|
||||
if(c != NULL) {
|
||||
rgb->common.red = (MwU8)(rgb->common.red + (c->common.red - rgb->common.red) * 0.5);
|
||||
rgb->common.green = (MwU8)(rgb->common.green + (c->common.green - rgb->common.green) * 0.5);
|
||||
rgb->common.blue = (MwU8)(rgb->common.blue + (c->common.blue - rgb->common.blue) * 0.5);
|
||||
MwLLColorUpdate(handle->lowlevel, rgb, rgb->common.red, rgb->common.green, rgb->common.blue);
|
||||
rgb->common->red = (MwU8)(rgb->common->red + (c->common->red - rgb->common->red) * 0.5);
|
||||
rgb->common->green = (MwU8)(rgb->common->green + (c->common->green - rgb->common->green) * 0.5);
|
||||
rgb->common->blue = (MwU8)(rgb->common->blue + (c->common->blue - rgb->common->blue) * 0.5);
|
||||
MwColorUpdate(rgb, rgb->common->red, rgb->common->green, rgb->common->blue);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -74,7 +74,7 @@ void MwParseColorNoAllocate(const char* text, MwRGB* rgb) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLColor MwParseColor(MwWidget handle, const char* text) {
|
||||
MwColor MwParseColor(MwWidget handle, const char* text) {
|
||||
MwRGB rgb;
|
||||
|
||||
rgb.red = 0;
|
||||
|
|
@ -83,13 +83,13 @@ MwLLColor MwParseColor(MwWidget handle, const char* text) {
|
|||
|
||||
MwParseColorNoAllocate(text, &rgb);
|
||||
|
||||
return MwLLAllocColor(handle->lowlevel, rgb.red, rgb.green, rgb.blue);
|
||||
return MwAllocColor(handle, rgb.red, rgb.green, rgb.blue);
|
||||
}
|
||||
|
||||
MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b) {
|
||||
int cr = color->common.red + r;
|
||||
int cg = color->common.green + g;
|
||||
int cb = color->common.blue + b;
|
||||
MwColor MwLightenColor(MwWidget handle, MwColor color, int r, int g, int b) {
|
||||
int cr = color->common->red + r;
|
||||
int cg = color->common->green + g;
|
||||
int cb = color->common->blue + b;
|
||||
|
||||
if(cr < 0) cr = 0;
|
||||
if(cg < 0) cg = 0;
|
||||
|
|
@ -98,7 +98,7 @@ MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b)
|
|||
if(cg > 255) cg = 255;
|
||||
if(cb > 255) cb = 255;
|
||||
|
||||
return MwLLAllocColor(handle->lowlevel, cr, cg, cb);
|
||||
return MwAllocColor(handle, cr, cg, cb);
|
||||
}
|
||||
|
||||
void MwFixRect(MwRect* rect) {
|
||||
|
|
@ -113,7 +113,7 @@ void MwFixRect(MwRect* rect) {
|
|||
}
|
||||
}
|
||||
|
||||
void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||
void MwDrawRect(MwWidget handle, MwRect* rect, MwColor color) {
|
||||
MwPoint p[4];
|
||||
MwRect r = *rect;
|
||||
|
||||
|
|
@ -131,10 +131,10 @@ void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color) {
|
|||
p[3].x = r.x;
|
||||
p[3].y = r.y + r.height;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 4, color);
|
||||
MwLLPolygon(handle->lowlevel, p, 4, color->lowlevel);
|
||||
}
|
||||
|
||||
void MwDrawRectLine(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||
void MwDrawRectLine(MwWidget handle, MwRect* rect, MwColor color) {
|
||||
MwPoint p[5];
|
||||
MwRect r = *rect;
|
||||
|
||||
|
|
@ -154,13 +154,13 @@ void MwDrawRectLine(MwWidget handle, MwRect* rect, MwLLColor color) {
|
|||
|
||||
p[4] = p[0];
|
||||
|
||||
MwLLLine(handle->lowlevel, &p[0], color);
|
||||
MwLLLine(handle->lowlevel, &p[1], color);
|
||||
MwLLLine(handle->lowlevel, &p[2], color);
|
||||
MwLLLine(handle->lowlevel, &p[3], color);
|
||||
MwLLLine(handle->lowlevel, &p[0], color->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[1], color->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[2], color->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[3], color->lowlevel);
|
||||
}
|
||||
|
||||
void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||
void MwDrawRectFading(MwWidget handle, MwRect* rect, MwColor color) {
|
||||
MwLLPixmap pixmap;
|
||||
int y;
|
||||
double darken = 0.;
|
||||
|
|
@ -184,14 +184,14 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
|
|||
r.height -= 2;
|
||||
|
||||
for(y = 0; y < rect->height; y++) {
|
||||
MwLLColor col = MwLightenColor(handle, color, (int)-darken, (int)-darken, (int)-darken);
|
||||
int idx = y * 4;
|
||||
MwColor col = MwLightenColor(handle, color, (int)-darken, (int)-darken, (int)-darken);
|
||||
int idx = y * 4;
|
||||
color_set_disabled_if_disabled(handle, col);
|
||||
data[idx] = col->common.red;
|
||||
data[idx + 1] = col->common.green;
|
||||
data[idx + 2] = col->common.blue;
|
||||
data[idx] = col->common->red;
|
||||
data[idx + 1] = col->common->green;
|
||||
data[idx + 2] = col->common->blue;
|
||||
data[idx + 3] = 255;
|
||||
MwLLFreeColor(col);
|
||||
MwFreeColor(col);
|
||||
darken += darkenStep;
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
|
|||
free(data);
|
||||
}
|
||||
|
||||
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
||||
void MwDrawFrame(MwWidget handle, MwRect* rect, MwColor color, int invert) {
|
||||
MwDrawFrameWithBorder(handle, rect, color, invert, MwDefaultBorderWidth(handle));
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ static int translate_border(MwWidget handle, int border) {
|
|||
return border;
|
||||
}
|
||||
|
||||
void MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border) {
|
||||
void MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwColor color, int invert, int border) {
|
||||
int inv;
|
||||
|
||||
border = translate_border(handle, border);
|
||||
|
|
@ -236,18 +236,18 @@ void MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int i
|
|||
}
|
||||
}
|
||||
|
||||
void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border) {
|
||||
MwLLColor col;
|
||||
void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwColor color, int invert, int border) {
|
||||
MwColor col;
|
||||
|
||||
if(rect->width <= 0 || rect->height <= 0) return;
|
||||
|
||||
if(border) {
|
||||
if(!handle->lowlevel->common.supports_transparency) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
MwColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
|
||||
if(c != NULL) {
|
||||
MwDrawRect(handle, rect, c);
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -273,16 +273,16 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
|
|||
} else {
|
||||
MwDrawRect(handle, rect, col);
|
||||
}
|
||||
MwLLFreeColor(col);
|
||||
MwFreeColor(col);
|
||||
}
|
||||
|
||||
void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
||||
MwPoint p[6];
|
||||
int border = MwDefaultBorderWidth(handle);
|
||||
int ColorDiff = MwGetColorDifference(handle) + (MwGetInteger(handle, MwNmodernLook) ? 48 : 0);
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : MwLightenColor(handle, color, 0, 0, 0);
|
||||
void MwDrawDiamond(MwWidget handle, MwRect* rect, MwColor color, int invert) {
|
||||
MwPoint p[6];
|
||||
int border = MwDefaultBorderWidth(handle);
|
||||
int ColorDiff = MwGetColorDifference(handle) + (MwGetInteger(handle, MwNmodernLook) ? 48 : 0);
|
||||
MwColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : MwLightenColor(handle, color, 0, 0, 0);
|
||||
color_set_disabled_if_disabled(handle, col);
|
||||
color_set_disabled_if_disabled(handle, darker);
|
||||
color_set_disabled_if_disabled(handle, lighter);
|
||||
|
|
@ -305,7 +305,7 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
|||
p[5].x = rect->x + border;
|
||||
p[5].y = rect->y + rect->height / 2;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? darker : lighter)->lowlevel);
|
||||
|
||||
p[0].x = rect->x;
|
||||
p[0].y = rect->y + rect->height / 2;
|
||||
|
|
@ -325,7 +325,7 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
|||
p[5].x = rect->x + border;
|
||||
p[5].y = rect->y + rect->height / 2;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p[0].x = rect->x + rect->width / 2;
|
||||
p[0].y = rect->y + border;
|
||||
|
|
@ -339,14 +339,14 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
|||
p[3].x = rect->x + border;
|
||||
p[3].y = rect->y + rect->height / 2;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 4, col);
|
||||
MwLLPolygon(handle->lowlevel, p, 4, col->lowlevel);
|
||||
|
||||
MwLLFreeColor(col);
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
MwFreeColor(col);
|
||||
MwFreeColor(lighter);
|
||||
MwFreeColor(darker);
|
||||
}
|
||||
|
||||
void MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor background, int filled) {
|
||||
void MwDrawCircle(MwWidget handle, MwRect* rect, MwColor color, MwColor background, int filled) {
|
||||
MwLLPixmap pixmap;
|
||||
int width = rect->width;
|
||||
int height = rect->height;
|
||||
|
|
@ -356,9 +356,9 @@ void MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor back
|
|||
int border;
|
||||
int x, y;
|
||||
int ColorDiff = (MwGetColorDifference(handle));
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwLLColor base = MwLightenColor(handle, color, 0, 0, 0);
|
||||
MwColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwColor base = MwLightenColor(handle, color, 0, 0, 0);
|
||||
|
||||
color_set_disabled_if_disabled(handle, darker);
|
||||
color_set_disabled_if_disabled(handle, lighter);
|
||||
|
|
@ -394,8 +394,8 @@ void MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor back
|
|||
}
|
||||
|
||||
if(inside) {
|
||||
MwLLColor mixColor;
|
||||
MwLLColor c = background ? background : (handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground)));
|
||||
MwColor mixColor;
|
||||
MwColor c = background ? background : (handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground)));
|
||||
double mod;
|
||||
unsigned char* pout = &data[(y * width + x) * 4];
|
||||
|
||||
|
|
@ -413,23 +413,23 @@ void MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor back
|
|||
color_set_disabled_if_disabled(handle, mixColor);
|
||||
|
||||
if(c != NULL) {
|
||||
mixColor->common.red = (MwU8)(mixColor->common.red + (c->common.red - mixColor->common.red) * mod);
|
||||
mixColor->common.green = (MwU8)(mixColor->common.green + (c->common.green - mixColor->common.green) * mod);
|
||||
mixColor->common.blue = (MwU8)(mixColor->common.blue + (c->common.blue - mixColor->common.blue) * mod);
|
||||
MwLLColorUpdate(handle->lowlevel, mixColor, mixColor->common.red, mixColor->common.green, mixColor->common.blue);
|
||||
mixColor->common->red = (MwU8)(mixColor->common->red + (c->common->red - mixColor->common->red) * mod);
|
||||
mixColor->common->green = (MwU8)(mixColor->common->green + (c->common->green - mixColor->common->green) * mod);
|
||||
mixColor->common->blue = (MwU8)(mixColor->common->blue + (c->common->blue - mixColor->common->blue) * mod);
|
||||
MwColorUpdate(mixColor, mixColor->common->red, mixColor->common->green, mixColor->common->blue);
|
||||
|
||||
if(c != background) {
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
}
|
||||
|
||||
pout[0] = (MwU8)mixColor->common.red;
|
||||
pout[1] = (MwU8)mixColor->common.green;
|
||||
pout[2] = (MwU8)mixColor->common.blue;
|
||||
pout[0] = (MwU8)mixColor->common->red;
|
||||
pout[1] = (MwU8)mixColor->common->green;
|
||||
pout[2] = (MwU8)mixColor->common->blue;
|
||||
|
||||
pout[3] = 255;
|
||||
|
||||
MwLLFreeColor(mixColor);
|
||||
MwFreeColor(mixColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -438,18 +438,18 @@ void MwDrawCircle(MwWidget handle, MwRect* rect, MwLLColor color, MwLLColor back
|
|||
MwLLDrawPixmap(handle->lowlevel, rect, pixmap);
|
||||
MwLLDestroyPixmap(pixmap);
|
||||
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(lighter);
|
||||
MwFreeColor(darker);
|
||||
MwFreeColor(base);
|
||||
|
||||
free(data);
|
||||
};
|
||||
|
||||
static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same) {
|
||||
MwPoint p[7];
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
|
||||
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff);
|
||||
static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwColor color, int invert, int border, int diff, int same) {
|
||||
MwPoint p[7];
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
|
||||
MwColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff);
|
||||
color_set_disabled_if_disabled(handle, darker);
|
||||
color_set_disabled_if_disabled(handle, lighter);
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
|
||||
p[5].x = rect->x;
|
||||
p[5].y = rect->y + rect->height;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? darker : lighter)->lowlevel);
|
||||
|
||||
p[0].x = rect->x + rect->width;
|
||||
p[0].y = rect->y;
|
||||
|
|
@ -488,10 +488,10 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
|
||||
p[5].x = rect->x + rect->width;
|
||||
p[5].y = rect->y + rect->height;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
MwFreeColor(lighter);
|
||||
MwFreeColor(darker);
|
||||
|
||||
rect->x += border;
|
||||
rect->y += border;
|
||||
|
|
@ -499,7 +499,7 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
|||
rect->height -= border * 2;
|
||||
}
|
||||
|
||||
static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighter, MwLLColor darker, int invert, int border, int diff, int same) {
|
||||
static void frame_border_complex(MwWidget handle, MwRect* rect, MwColor lighter, MwColor darker, int invert, int border, int diff, int same) {
|
||||
MwPoint p[7];
|
||||
|
||||
(void)diff;
|
||||
|
|
@ -521,7 +521,7 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
|
||||
p[5].x = rect->x;
|
||||
p[5].y = rect->y + rect->height;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p[0].x = rect->x + rect->width;
|
||||
p[0].y = rect->y;
|
||||
|
|
@ -540,14 +540,14 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
|
||||
p[5].x = rect->x + rect->width;
|
||||
p[5].y = rect->y + rect->height;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, (invert ? lighter : darker)->lowlevel);
|
||||
}
|
||||
|
||||
static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same) {
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
|
||||
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff);
|
||||
MwRect r = *rect;
|
||||
static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwColor color, int invert, int border, int diff, int same) {
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
|
||||
MwColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff);
|
||||
MwRect r = *rect;
|
||||
|
||||
color_set_disabled_if_disabled(handle, darker);
|
||||
color_set_disabled_if_disabled(handle, lighter);
|
||||
|
|
@ -562,8 +562,8 @@ static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwLLColor color
|
|||
frame_border_complex(handle, &r, lighter, darker, !invert, border / 2, diff, same);
|
||||
}
|
||||
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
MwFreeColor(lighter);
|
||||
MwFreeColor(darker);
|
||||
|
||||
rect->x += border;
|
||||
rect->y += border;
|
||||
|
|
@ -571,7 +571,7 @@ static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwLLColor color
|
|||
rect->height -= border * 2;
|
||||
}
|
||||
|
||||
void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same) {
|
||||
void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwColor color, int invert, int border, int diff, int same) {
|
||||
border = translate_border(handle, border);
|
||||
|
||||
if(MwGetInteger(handle, MwNmodernLook)) {
|
||||
|
|
@ -581,13 +581,13 @@ void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, i
|
|||
}
|
||||
}
|
||||
|
||||
void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction) {
|
||||
void MwDrawTriangle(MwWidget handle, MwRect* rect, MwColor color, int invert, int direction) {
|
||||
MwPoint p1[4], p2[4], p3[4], p4[3];
|
||||
const int border = MwGetInteger(handle, MwNmodernLook) ? 2 : MwDefaultBorderWidth(handle);
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : MwLightenColor(handle, color, 0, 0, 0);
|
||||
MwColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : MwLightenColor(handle, color, 0, 0, 0);
|
||||
double deg = 30 * ((direction == MwEAST || direction == MwWEST) ? 2 : 1);
|
||||
double c = cos(deg / 180 * M_PI);
|
||||
double s = sin(deg / 180 * M_PI);
|
||||
|
|
@ -633,9 +633,9 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
p3[3].x = (int)(rect->x + rect->width - c * border);
|
||||
p3[3].y = (int)(rect->y + rect->height - s * border);
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, (invert ? lighter : darker)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p4[0].x = (int)(rect->x + c * border);
|
||||
p4[0].y = (int)(rect->y + rect->height - s * border);
|
||||
|
|
@ -682,9 +682,9 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
p3[3].x = (int)(rect->x + rect->width - c * border);
|
||||
p3[3].y = (int)(rect->y + s * border);
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p4[0].x = (int)(rect->x + c * border);
|
||||
p4[0].y = (int)(rect->y + s * border);
|
||||
|
|
@ -731,9 +731,9 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
p3[3].x = (int)(rect->x + rect->width - border);
|
||||
p3[3].y = rect->y + rect->height / 2;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p4[0].x = (int)(rect->x + rect->width - border);
|
||||
p4[0].y = rect->y + rect->height / 2;
|
||||
|
|
@ -780,9 +780,9 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
p3[3].x = rect->x + rect->width;
|
||||
p3[3].y = rect->y + rect->height;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, invert ? darker : lighter);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, invert ? lighter : darker);
|
||||
MwLLPolygon(handle->lowlevel, p1, 4, (invert ? darker : lighter)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p2, 4, (invert ? lighter : darker)->lowlevel);
|
||||
MwLLPolygon(handle->lowlevel, p3, 4, (invert ? lighter : darker)->lowlevel);
|
||||
|
||||
p4[0].x = (int)(rect->x + border);
|
||||
p4[0].y = rect->y + rect->height / 2;
|
||||
|
|
@ -793,11 +793,11 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
p4[2].x = (int)(rect->x + rect->width - c * border);
|
||||
p4[2].y = (int)(rect->y + s * border);
|
||||
}
|
||||
MwLLPolygon(handle->lowlevel, p4, 3, col);
|
||||
MwLLPolygon(handle->lowlevel, p4, 3, col->lowlevel);
|
||||
|
||||
MwLLFreeColor(col);
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
MwFreeColor(col);
|
||||
MwFreeColor(lighter);
|
||||
MwFreeColor(darker);
|
||||
}
|
||||
|
||||
#if defined(NO_IMAGE)
|
||||
|
|
@ -939,10 +939,10 @@ static unsigned char* load_image(const char* path, int* w, int* h) {
|
|||
#endif
|
||||
}
|
||||
|
||||
MwLLPixmap MwLoadImage(MwWidget handle, const char* path) {
|
||||
MwPixmap MwLoadImage(MwWidget handle, const char* path) {
|
||||
int width, height;
|
||||
unsigned char* rgb = load_image(path, &width, &height);
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
|
||||
if(rgb == NULL) return NULL;
|
||||
|
||||
|
|
@ -961,10 +961,15 @@ static void pixmap_prop(MwWidget handle, const char* prop) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height) {
|
||||
MwLLPixmap px = MwLLCreatePixmap(handle->lowlevel, rgb, width, height);
|
||||
MwPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height) {
|
||||
MwPixmap px = malloc(sizeof(*px));
|
||||
|
||||
px->lowlevel = MwLLCreatePixmap(handle->lowlevel, rgb, width, height);
|
||||
px->common = &px->lowlevel->common;
|
||||
px->handle = handle;
|
||||
px->raw = malloc(width * height * 4);
|
||||
memcpy(px->raw, rgb, width * height * 4);
|
||||
|
||||
px->common.internal = handle;
|
||||
MwPixmapReloadRaw(px, rgb);
|
||||
|
||||
handle->prop_inject_pixmap = pixmap_prop;
|
||||
|
|
@ -974,17 +979,17 @@ MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height)
|
|||
return px;
|
||||
}
|
||||
|
||||
void MwPixmapReloadRaw(MwLLPixmap px, unsigned char* rgb) {
|
||||
int i;
|
||||
MwWidget handle = px->common.internal;
|
||||
MwLLColor base = handle->bgcolor == NULL ? MwParseColor(handle, MwGetText(handle, MwNbackground)) : handle->bgcolor;
|
||||
void MwPixmapReloadRaw(MwPixmap px, unsigned char* rgb) {
|
||||
int i;
|
||||
MwWidget handle = px->handle;
|
||||
MwColor base = handle->bgcolor == NULL ? MwParseColor(handle, MwGetText(handle, MwNbackground)) : handle->bgcolor;
|
||||
|
||||
if(rgb != NULL) memcpy(px->common.before_blend, rgb, px->common.width * px->common.height * 4);
|
||||
if(rgb != NULL) memcpy(px->raw, rgb, px->common->width * px->common->height * 4);
|
||||
|
||||
memset(px->common.raw, 0, px->common.width * px->common.height * 4);
|
||||
for(i = 0; i < px->common.width * px->common.height; i++) {
|
||||
unsigned char* pin = &px->common.before_blend[i * 4];
|
||||
unsigned char* pout = &px->common.raw[i * 4];
|
||||
memset(px->common->raw, 0, px->common->width * px->common->height * 4);
|
||||
for(i = 0; i < px->common->width * px->common->height; i++) {
|
||||
unsigned char* pin = &px->raw[i * 4];
|
||||
unsigned char* pout = &px->common->raw[i * 4];
|
||||
double a = pin[3];
|
||||
|
||||
a /= 255;
|
||||
|
|
@ -996,30 +1001,34 @@ void MwPixmapReloadRaw(MwLLPixmap px, unsigned char* rgb) {
|
|||
pout[1] = (unsigned char)(pin[1] * a);
|
||||
pout[2] = (unsigned char)(pin[2] * a);
|
||||
|
||||
pout[0] += (unsigned char)(base->common.red * (1 - a));
|
||||
pout[1] += (unsigned char)(base->common.green * (1 - a));
|
||||
pout[2] += (unsigned char)(base->common.blue * (1 - a));
|
||||
pout[0] += (unsigned char)(base->common->red * (1 - a));
|
||||
pout[1] += (unsigned char)(base->common->green * (1 - a));
|
||||
pout[2] += (unsigned char)(base->common->blue * (1 - a));
|
||||
pout[3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
if(handle->bgcolor == NULL) MwLLFreeColor(base);
|
||||
if(handle->bgcolor == NULL) MwFreeColor(base);
|
||||
|
||||
MwLLPixmapUpdate(px);
|
||||
MwPixmapUpdate(px);
|
||||
}
|
||||
|
||||
unsigned char* MwPixmapGetRaw(MwLLPixmap pixmap) {
|
||||
return pixmap->common.raw;
|
||||
unsigned char* MwPixmapGetRaw(MwPixmap pixmap) {
|
||||
return pixmap->common->raw;
|
||||
}
|
||||
|
||||
void MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect) {
|
||||
rect->width = pixmap->common.width;
|
||||
rect->height = pixmap->common.height;
|
||||
void MwPixmapGetSize(MwPixmap pixmap, MwRect* rect) {
|
||||
rect->width = pixmap->common->width;
|
||||
rect->height = pixmap->common->height;
|
||||
}
|
||||
|
||||
void MwDestroyPixmap(MwLLPixmap pixmap) {
|
||||
void MwPixmapUpdate(MwPixmap pixmap) {
|
||||
MwLLPixmapUpdate(pixmap->lowlevel);
|
||||
}
|
||||
|
||||
void MwDestroyPixmap(MwPixmap pixmap) {
|
||||
int i;
|
||||
MwWidget handle = pixmap->common.internal;
|
||||
MwWidget handle = pixmap->handle;
|
||||
|
||||
for(i = 0; i < arrlen(handle->pixmaps); i++) {
|
||||
if(handle->pixmaps[i] == pixmap) {
|
||||
|
|
@ -1030,20 +1039,44 @@ void MwDestroyPixmap(MwLLPixmap pixmap) {
|
|||
|
||||
if(arrlen(handle->pixmaps) == 0) handle->prop_inject_pixmap = NULL;
|
||||
|
||||
MwLLDestroyPixmap(pixmap);
|
||||
MwLLDestroyPixmap(pixmap->lowlevel);
|
||||
free(pixmap->raw);
|
||||
free(pixmap);
|
||||
}
|
||||
|
||||
void MwColorGet(MwLLColor color, int* red, int* green, int* blue) {
|
||||
*red = color->common.red;
|
||||
*green = color->common.green;
|
||||
*blue = color->common.blue;
|
||||
void MwDrawPixmap(MwWidget handle, MwRect* rect, MwPixmap pixmap) {
|
||||
MwLLDrawPixmap(handle->lowlevel, rect, pixmap->lowlevel);
|
||||
}
|
||||
|
||||
MwLLPixmap MwLoadIcon(MwWidget handle, MwU32* data) {
|
||||
MwColor MwAllocColor(MwWidget handle, unsigned int red, unsigned int green, unsigned int blue) {
|
||||
MwColor color = malloc(sizeof(*color));
|
||||
|
||||
color->lowlevel = MwLLAllocColor(handle->lowlevel, red, green, blue);
|
||||
color->common = &color->lowlevel->common;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void MwColorGet(MwColor color, int* red, int* green, int* blue) {
|
||||
*red = color->common->red;
|
||||
*green = color->common->green;
|
||||
*blue = color->common->blue;
|
||||
}
|
||||
|
||||
void MwColorUpdate(MwColor c, int r, int g, int b) {
|
||||
MwLLColorUpdate(c->lowlevel, r, g, b);
|
||||
}
|
||||
|
||||
void MwFreeColor(MwColor color) {
|
||||
MwLLFreeColor(color->lowlevel);
|
||||
free(color);
|
||||
}
|
||||
|
||||
MwPixmap MwLoadIcon(MwWidget handle, MwU32* data) {
|
||||
int width = (data[0] >> 16) & 0xffff;
|
||||
int height = (data[0]) & 0xffff;
|
||||
unsigned char* rgba = malloc(width * height * 4);
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
int i;
|
||||
|
||||
if(!rgba) {
|
||||
|
|
@ -1078,10 +1111,10 @@ typedef struct color {
|
|||
int a;
|
||||
} color_t;
|
||||
|
||||
MwLLPixmap MwLoadXPM(MwWidget handle, char** data) {
|
||||
MwPixmap MwLoadXPM(MwWidget handle, char** data) {
|
||||
int col, row, colors, cpp;
|
||||
unsigned char* rgb;
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
color_t* c = NULL;
|
||||
int i, y, x;
|
||||
char* comp;
|
||||
|
|
@ -1110,7 +1143,7 @@ MwLLPixmap MwLoadXPM(MwWidget handle, char** data) {
|
|||
c[ind].b = 0;
|
||||
c[ind].a = 0;
|
||||
} else {
|
||||
MwLLColor color = MwParseColor(handle, v);
|
||||
MwColor color = MwParseColor(handle, v);
|
||||
|
||||
memcpy(k, data[i + 1], cpp);
|
||||
k[cpp] = 0;
|
||||
|
|
@ -1118,12 +1151,12 @@ MwLLPixmap MwLoadXPM(MwWidget handle, char** data) {
|
|||
shput(c, k, v);
|
||||
ind = shgeti(c, k);
|
||||
|
||||
c[ind].r = color->common.red;
|
||||
c[ind].g = color->common.green;
|
||||
c[ind].b = color->common.blue;
|
||||
c[ind].r = color->common->red;
|
||||
c[ind].g = color->common->green;
|
||||
c[ind].b = color->common->blue;
|
||||
c[ind].a = 255;
|
||||
|
||||
MwLLFreeColor(color);
|
||||
MwFreeColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color) = NULL;
|
|||
void (*MwLLBeginDraw)(MwLL handle) = NULL;
|
||||
void (*MwLLEndDraw)(MwLL handle) = NULL;
|
||||
|
||||
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b) = NULL;
|
||||
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b) = NULL;
|
||||
void (*MwLLFreeColor)(MwLLColor color) = NULL;
|
||||
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b) = NULL;
|
||||
void (*MwLLColorUpdate)(MwLLColor c, int r, int g, int b) = NULL;
|
||||
void (*MwLLFreeColor)(MwLLColor color) = NULL;
|
||||
|
||||
void (*MwLLGetXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) = NULL;
|
||||
void (*MwLLSetXY)(MwLL handle, int x, int y) = NULL;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright notice:
|
||||
* "Public domain font. Share and enjoy."
|
||||
*/
|
||||
MwFont MwBoldFontData[] = {
|
||||
MwFontResource MwBoldFontData[] = {
|
||||
{0, 11, {0, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 0}}, /* 0 */
|
||||
{0, 11, {0, 0, 0, 0, 0, 24, 60, 126, 60, 24, 0, 0, 0}}, /* 1 */
|
||||
{0, 11, {0, 102, 24, 102, 24, 102, 24, 102, 24, 102, 24, 102, 0}}, /* 2 */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright notice:
|
||||
* "(null)"
|
||||
*/
|
||||
MwFont MwFontData[] = {
|
||||
MwFontResource MwFontData[] = {
|
||||
{0, 11, {0, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 0}}, /* 0 */
|
||||
{0, 11, {0, 0, 0, 0, 0, 16, 56, 124, 56, 16, 0, 0, 0}}, /* 1 */
|
||||
{0, 11, {0, 84, 42, 84, 42, 84, 42, 84, 42, 84, 42, 84, 42}}, /* 2 */
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ struct _MwFLFont {
|
|||
void* data;
|
||||
int px;
|
||||
};
|
||||
static int ft2_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color) {
|
||||
static int ft2_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwColor color) {
|
||||
int tw, th;
|
||||
unsigned char* px;
|
||||
MwLLPixmap p;
|
||||
MwPixmap p;
|
||||
MwRect r;
|
||||
int x = 0, y = 0;
|
||||
|
||||
|
|
@ -62,9 +62,9 @@ static int ft2_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
int ox = x + cx + ttf->face->glyph->bitmap_left;
|
||||
int oy = y + (ttf->face->height * ttf->px / ttf->face->units_per_EM) - ttf->face->glyph->bitmap_top + cy + (ttf->face->descender * ttf->px / ttf->face->units_per_EM);
|
||||
unsigned char* opx = &px[(oy * tw + ox) * 4];
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[0] = color->common->red;
|
||||
opx[1] = color->common->green;
|
||||
opx[2] = color->common->blue;
|
||||
/* overflow check */
|
||||
if(opx[3] + bmp->buffer[cy * bmp->pitch + cx] < opx[3]) {
|
||||
opx[3] = 255;
|
||||
|
|
@ -92,7 +92,7 @@ static int ft2_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
r.width = tw;
|
||||
r.height = th;
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, p);
|
||||
MwDrawPixmap(handle, &r, p);
|
||||
MwDestroyPixmap(p);
|
||||
free(px);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct _MwFLFont {
|
|||
HDC dc;
|
||||
};
|
||||
|
||||
static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color) {
|
||||
static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwColor color) {
|
||||
BITMAPINFOHEADER bmih;
|
||||
int tw;
|
||||
int th;
|
||||
|
|
@ -26,7 +26,7 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
wchar_t* t16;
|
||||
int y, x;
|
||||
MwRect r;
|
||||
MwLLPixmap p;
|
||||
MwPixmap p;
|
||||
|
||||
tw = MwTextWidth(handle, ttf, text);
|
||||
th = MwTextHeight(handle, ttf, text);
|
||||
|
|
@ -34,7 +34,7 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
if(handle->lowlevel->common.type == MwLLBackendGDI) {
|
||||
HFONT old_font = SelectObject(handle->lowlevel->gdi.hDC, ttf->font);
|
||||
int old_bkmode = SetBkMode(handle->lowlevel->gdi.hDC, TRANSPARENT);
|
||||
COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, RGB(color->common.red, color->common.green, color->common.blue));
|
||||
COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, RGB(color->common->red, color->common->green, color->common->blue));
|
||||
|
||||
if(_TextOutW == NULL) {
|
||||
t = MwUTF8TextToACPText(text);
|
||||
|
|
@ -89,9 +89,9 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
for(x = 0; x < tw; x++) {
|
||||
unsigned char* opx = &px[(y * tw + x) * 4];
|
||||
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[0] = color->common->red;
|
||||
opx[1] = color->common->green;
|
||||
opx[2] = color->common->blue;
|
||||
opx[3] = 255 - bits[y * tw + x].rgbRed;
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
r.width = tw;
|
||||
r.height = th;
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, p);
|
||||
MwDrawPixmap(handle, &r, p);
|
||||
MwDestroyPixmap(p);
|
||||
free(px);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ struct _MwFLFont {
|
|||
int descent;
|
||||
};
|
||||
|
||||
static int stbtt_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color) {
|
||||
static int stbtt_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwColor color) {
|
||||
unsigned char* px;
|
||||
int tw, th;
|
||||
MwRect r;
|
||||
MwLLPixmap p;
|
||||
MwPixmap p;
|
||||
int ax, lsb;
|
||||
int x = 0, y = 0;
|
||||
|
||||
|
|
@ -47,9 +47,9 @@ static int stbtt_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const
|
|||
int ox = x + ceil(lsb * ttf->scale) + cx;
|
||||
int oy = y + ceil(ttf->ascent * ttf->scale) + y0 + cy;
|
||||
unsigned char* opx = &px[(oy * tw + ox) * 4];
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[0] = color->common->red;
|
||||
opx[1] = color->common->green;
|
||||
opx[2] = color->common->blue;
|
||||
/* overflow check */
|
||||
if(opx[3] + out[cy * ow + cx] < opx[3]) {
|
||||
opx[3] = 255;
|
||||
|
|
@ -79,7 +79,7 @@ static int stbtt_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const
|
|||
r.width = tw;
|
||||
r.height = th;
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, p);
|
||||
MwDrawPixmap(handle, &r, p);
|
||||
MwDestroyPixmap(p);
|
||||
free(px);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include <Mw/Milsko.h>
|
||||
|
||||
int (*MwFLDrawText)(MwWidget handle, MwFLFont font, MwPoint* point, const char* text, MwLLColor color) = NULL;
|
||||
int (*MwFLTextWidth)(MwFLFont font, const char* text) = NULL;
|
||||
int (*MwFLTextHeight)(MwFLFont font, int count) = NULL;
|
||||
int (*MwFLTextHeightWithText)(MwFLFont ttf, const char* text) = NULL;
|
||||
void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px) = NULL;
|
||||
void (*MwFLFontFree)(void* handle) = NULL;
|
||||
int (*MwFLDrawText)(MwWidget handle, MwFLFont font, MwPoint* point, const char* text, MwColor color) = NULL;
|
||||
int (*MwFLTextWidth)(MwFLFont font, const char* text) = NULL;
|
||||
int (*MwFLTextHeight)(MwFLFont font, int count) = NULL;
|
||||
int (*MwFLTextHeightWithText)(MwFLFont ttf, const char* text) = NULL;
|
||||
void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px) = NULL;
|
||||
void (*MwFLFontFree)(void* handle) = NULL;
|
||||
|
||||
#if defined(USE_FREETYPE2) || defined(USE_STB_TRUETYPE) || defined(USE_GDI_TEXT)
|
||||
#define TTF
|
||||
|
|
@ -14,7 +14,7 @@ void (*MwFLFontFree)(void* handle) = NULL;
|
|||
#define FontWidth 7
|
||||
#define FontHeight 13
|
||||
|
||||
static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, MwLLColor color);
|
||||
static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, MwColor color);
|
||||
|
||||
static int count_nl(const char* text) {
|
||||
int c = 1;
|
||||
|
|
@ -76,25 +76,25 @@ static MwFLFont assume_ttf(MwWidget handle, MwFLFont ttf) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color) {
|
||||
MwPoint p = *point;
|
||||
char* input = (char*)text;
|
||||
char* last = input;
|
||||
int cp;
|
||||
MwLLColor fadedColor = NULL;
|
||||
int n;
|
||||
void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwColor color) {
|
||||
MwPoint p = *point;
|
||||
char* input = (char*)text;
|
||||
char* last = input;
|
||||
int cp;
|
||||
MwColor fadedColor = NULL;
|
||||
int n;
|
||||
|
||||
if((n = MwGetInteger(handle, MwNdisabled)) != MwDEFAULT && n) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
MwColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
|
||||
if(c != NULL) {
|
||||
fadedColor = MwLLAllocColor(handle->lowlevel, color->common.red, color->common.blue, color->common.green);
|
||||
fadedColor->common.red = (MwU8)(fadedColor->common.red + (c->common.red - fadedColor->common.red) * 0.5);
|
||||
fadedColor->common.green = (MwU8)(fadedColor->common.green + (c->common.green - fadedColor->common.green) * 0.5);
|
||||
fadedColor->common.blue = (MwU8)(fadedColor->common.blue + (c->common.blue - fadedColor->common.blue) * 0.5);
|
||||
MwLLColorUpdate(handle->lowlevel, fadedColor, fadedColor->common.red, fadedColor->common.green, fadedColor->common.blue);
|
||||
fadedColor = MwAllocColor(handle, color->common->red, color->common->blue, color->common->green);
|
||||
fadedColor->common->red = (MwU8)(fadedColor->common->red + (c->common->red - fadedColor->common->red) * 0.5);
|
||||
fadedColor->common->green = (MwU8)(fadedColor->common->green + (c->common->green - fadedColor->common->green) * 0.5);
|
||||
fadedColor->common->blue = (MwU8)(fadedColor->common->blue + (c->common->blue - fadedColor->common->blue) * 0.5);
|
||||
MwColorUpdate(fadedColor, fadedColor->common->red, fadedColor->common->green, fadedColor->common->blue);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,13 +159,13 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
|
|||
l[0].y = l[1].y = p.y;
|
||||
|
||||
if((n = MwGetInteger(handle, MwNstrikethrough)) != MwDEFAULT && n) {
|
||||
MwLLLine(handle->lowlevel, l, color);
|
||||
MwLLLine(handle->lowlevel, l, color->lowlevel);
|
||||
}
|
||||
|
||||
if((n = MwGetInteger(handle, MwNunderline)) != MwDEFAULT && n) {
|
||||
l[0].y += th / 2;
|
||||
l[1].y += th / 2;
|
||||
MwLLLine(handle->lowlevel, l, color);
|
||||
MwLLLine(handle->lowlevel, l, color->lowlevel);
|
||||
}
|
||||
|
||||
p.y += th;
|
||||
|
|
@ -177,7 +177,7 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
|
|||
}
|
||||
|
||||
if(fadedColor) {
|
||||
MwLLFreeColor(fadedColor);
|
||||
MwFreeColor(fadedColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -269,12 +269,12 @@ void MwFontFree(void* handle) {
|
|||
if(MwFLFontFree) MwFLFontFree(handle);
|
||||
}
|
||||
|
||||
static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, MwLLColor color) {
|
||||
static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, MwColor color) {
|
||||
int i = 0, x, y, sx, sy;
|
||||
int tw, th;
|
||||
unsigned char* px;
|
||||
MwRect r;
|
||||
MwLLPixmap p;
|
||||
MwPixmap p;
|
||||
|
||||
if(strlen(text) == 0) text = " ";
|
||||
tw = MwTextWidth(handle, NULL, text);
|
||||
|
|
@ -307,9 +307,9 @@ static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text,
|
|||
for(x = 0; x < FontWidth; x++) {
|
||||
unsigned char* ppx = &px[((sy + y) * tw + sx + x) * 4];
|
||||
if((bold ? MwBoldFontData : MwFontData)[out].data[y] & (1 << ((FontWidth - 1) - x))) {
|
||||
ppx[0] = color->common.red;
|
||||
ppx[1] = color->common.green;
|
||||
ppx[2] = color->common.blue;
|
||||
ppx[0] = color->common->red;
|
||||
ppx[1] = color->common->green;
|
||||
ppx[2] = color->common->blue;
|
||||
ppx[3] = 255;
|
||||
} else {
|
||||
ppx[0] = 0;
|
||||
|
|
@ -329,7 +329,7 @@ static void bitmap_MwDrawText(MwWidget handle, MwPoint* point, const char* text,
|
|||
r.width = tw;
|
||||
r.height = th;
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, p);
|
||||
MwDrawPixmap(handle, &r, p);
|
||||
MwDestroyPixmap(p);
|
||||
free(px);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ static void layout(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -91,7 +91,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
MwDrawRect(handle, &r, base);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ static int wcreate(MwWidget handle) {
|
|||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwPoint point;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwLLPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
int inv;
|
||||
|
||||
if(str == NULL) str = "";
|
||||
|
|
@ -38,7 +38,7 @@ static void draw(MwWidget handle) {
|
|||
} else {
|
||||
MwDrawWidgetBack(handle, &r, base, handle->pressed, MwDEFAULT);
|
||||
}
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
if(MwGetInteger(handle, MwNflat) && !(handle->pressed || ((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv))) {
|
||||
r.x += MwDefaultBorderWidth(handle);
|
||||
r.y += MwDefaultBorderWidth(handle);
|
||||
|
|
@ -51,27 +51,27 @@ static void draw(MwWidget handle) {
|
|||
int oh = r.height;
|
||||
|
||||
if(MwGetInteger(handle, MwNfillArea)) {
|
||||
double sw = (double)ow / px->common.width;
|
||||
double sh = (double)oh / px->common.height;
|
||||
double sw = (double)ow / px->common->width;
|
||||
double sh = (double)oh / px->common->height;
|
||||
|
||||
if(sw < sh) {
|
||||
r.width = (int)(px->common.width * sw);
|
||||
r.height = (int)(px->common.height * sw);
|
||||
r.width = (int)(px->common->width * sw);
|
||||
r.height = (int)(px->common->height * sw);
|
||||
} else {
|
||||
r.width = (int)(px->common.width * sh);
|
||||
r.height = (int)(px->common.height * sh);
|
||||
r.width = (int)(px->common->width * sh);
|
||||
r.height = (int)(px->common->height * sh);
|
||||
}
|
||||
r.width -= MwGetInteger(handle, MwNpadding) * 2;
|
||||
r.height -= MwGetInteger(handle, MwNpadding) * 2;
|
||||
} else {
|
||||
r.width = px->common.width;
|
||||
r.height = px->common.height;
|
||||
r.width = px->common->width;
|
||||
r.height = px->common->height;
|
||||
}
|
||||
|
||||
r.x += (int)((double)(ow - r.width) / 2);
|
||||
r.y += (int)((double)(oh - r.height) / 2);
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, px);
|
||||
MwDrawPixmap(handle, &r, px);
|
||||
} else {
|
||||
point.x = r.x + r.width / 2;
|
||||
point.y = r.x + r.height / 2;
|
||||
|
|
@ -79,8 +79,8 @@ static void draw(MwWidget handle) {
|
|||
MwDrawText(handle, NULL, &point, str, MwALIGNMENT_CENTER, text);
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void click(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ static int wcreate(MwWidget handle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static MwLLPixmap blit(MwWidget handle, const char* str, MwLLColor bg, MwLLColor fg, int scale) {
|
||||
static MwPixmap blit(MwWidget handle, const char* str, MwColor bg, MwColor fg, int scale) {
|
||||
int i;
|
||||
unsigned char* buf;
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
int w = (5 * strlen(str) + (strlen(str) - 1)) * scale;
|
||||
int h = 5 * scale;
|
||||
int y, x, s;
|
||||
|
|
@ -81,11 +81,11 @@ static MwLLPixmap blit(MwWidget handle, const char* str, MwLLColor bg, MwLLColor
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor cf = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwLLColor cb = MwParseColor(handle, "#fff");
|
||||
MwLLColor cb_g = MwParseColor(handle, "#666");
|
||||
MwLLColor ct = MwParseColor(handle, "#000");
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor cf = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor cb = MwParseColor(handle, "#fff");
|
||||
MwColor cb_g = MwParseColor(handle, "#666");
|
||||
MwColor ct = MwParseColor(handle, "#000");
|
||||
MwRect r, r2, r3;
|
||||
MwPoint p[6];
|
||||
int h = 32 * MwGetInteger(handle, MwNscale);
|
||||
|
|
@ -115,7 +115,7 @@ static void draw(MwWidget handle) {
|
|||
"THU",
|
||||
"FRI",
|
||||
"SAT"};
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -135,7 +135,7 @@ static void draw(MwWidget handle) {
|
|||
p[4].y = p[0].y + gh * 7;
|
||||
p[5].x = p[0].x + h;
|
||||
p[5].y = p[0].y;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, cb_g);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, cb_g->lowlevel);
|
||||
|
||||
p[0].x = (r.width - h) / 2;
|
||||
p[0].y = (r.height - h - sh) / 2;
|
||||
|
|
@ -149,7 +149,7 @@ static void draw(MwWidget handle) {
|
|||
p[4].y = p[0].y + gh * 3;
|
||||
p[5].x = p[0].x + h;
|
||||
p[5].y = p[0].y;
|
||||
MwLLPolygon(handle->lowlevel, p, 6, ct);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, ct->lowlevel);
|
||||
|
||||
r2.width = h;
|
||||
r2.height = h - ph - gh;
|
||||
|
|
@ -175,7 +175,7 @@ static void draw(MwWidget handle) {
|
|||
p[2].y = r2.y + r2.height + ph;
|
||||
p[3].x = r2.x + r2.width;
|
||||
p[3].y = r2.y + r2.height;
|
||||
MwLLPolygon(handle->lowlevel, p, 4, cb);
|
||||
MwLLPolygon(handle->lowlevel, p, 4, cb->lowlevel);
|
||||
|
||||
p[0].x = r.width / 2;
|
||||
p[0].y = (r.height - sh) / 2;
|
||||
|
|
@ -186,38 +186,38 @@ static void draw(MwWidget handle) {
|
|||
|
||||
px = blit(handle, days[MwGetInteger(handle, MwNday)], cb, ct, gh);
|
||||
r2 = r3;
|
||||
r2.width = px->common.width;
|
||||
r2.height = px->common.height;
|
||||
r2.width = px->common->width;
|
||||
r2.height = px->common->height;
|
||||
r2.x = (r.width - r2.width) / 2;
|
||||
r2.y = r2.y + gh * 2;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, px);
|
||||
MwDrawPixmap(handle, &r2, px);
|
||||
MwDestroyPixmap(px);
|
||||
|
||||
px = blit(handle, months[MwGetInteger(handle, MwNmonth)], cb, ct, gh);
|
||||
r2 = r3;
|
||||
r2.width = px->common.width;
|
||||
r2.height = px->common.height;
|
||||
r2.width = px->common->width;
|
||||
r2.height = px->common->height;
|
||||
r2.x = (r.width - r2.width) / 2;
|
||||
r2.y = r2.y + h - gh * 2 - r2.height;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, px);
|
||||
MwDrawPixmap(handle, &r2, px);
|
||||
MwDestroyPixmap(px);
|
||||
|
||||
MwStringPrintIntoBuffer(buf, 5, "%d", MwGetInteger(handle, MwNyear));
|
||||
|
||||
px = blit(handle, buf, c, cf, gh);
|
||||
r2 = r3;
|
||||
r2.width = px->common.width;
|
||||
r2.height = px->common.height;
|
||||
r2.width = px->common->width;
|
||||
r2.height = px->common->height;
|
||||
r2.x = (r.width - r2.width) / 2;
|
||||
r2.y = r2.y + h + gh * 6;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, px);
|
||||
MwDrawPixmap(handle, &r2, px);
|
||||
MwDestroyPixmap(px);
|
||||
|
||||
MwLLFreeColor(cf);
|
||||
MwLLFreeColor(ct);
|
||||
MwLLFreeColor(cb_g);
|
||||
MwLLFreeColor(cb);
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(cf);
|
||||
MwFreeColor(ct);
|
||||
MwFreeColor(cb_g);
|
||||
MwFreeColor(cb);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ static void destroy(MwWidget handle) {
|
|||
free(handle->internal);
|
||||
}
|
||||
|
||||
static void draw_line(MwWidget handle, const char* text, double x, double y, double width, double height, MwLLColor color) {
|
||||
static void draw_line(MwWidget handle, const char* text, double x, double y, double width, double height, MwColor color) {
|
||||
MwPoint p[2];
|
||||
int type = MwGetInteger(handle, MwNtype);
|
||||
|
||||
|
|
@ -53,13 +53,13 @@ static void draw_line(MwWidget handle, const char* text, double x, double y, dou
|
|||
p2[1].x += height;
|
||||
p2[1].y -= height;
|
||||
|
||||
MwLLLine(handle->lowlevel, &p2[0], color);
|
||||
MwLLLine(handle->lowlevel, &p2[0], color->lowlevel);
|
||||
|
||||
p[0].x += height;
|
||||
p[0].y -= height;
|
||||
p[1].y -= height;
|
||||
}
|
||||
MwLLLine(handle->lowlevel, &p[0], color);
|
||||
MwLLLine(handle->lowlevel, &p[0], color->lowlevel);
|
||||
}
|
||||
|
||||
#define CALC_VMIN_VMAX \
|
||||
|
|
@ -75,7 +75,7 @@ static void draw_line(MwWidget handle, const char* text, double x, double y, dou
|
|||
vmax += (double)width / r.height * (vmax - vmin); \
|
||||
}
|
||||
|
||||
static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int space, const char** colors, int n, MwLLColor border) {
|
||||
static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int space, const char** colors, int n, MwColor border) {
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwChart c = handle->internal;
|
||||
double s = 1.5;
|
||||
|
|
@ -126,22 +126,22 @@ static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int
|
|||
|
||||
p[1].x = node.x;
|
||||
p[1].y = r.height - space;
|
||||
MwLLLine(handle->lowlevel, &p[0], border);
|
||||
MwLLLine(handle->lowlevel, &p[0], border->lowlevel);
|
||||
|
||||
p[0].x = node.x;
|
||||
p[0].y = r.height - space;
|
||||
|
||||
p[1].x = node.x + twidth;
|
||||
p[1].y = p[0].y;
|
||||
MwLLLine(handle->lowlevel, &p[0], border);
|
||||
MwLLLine(handle->lowlevel, &p[0], border->lowlevel);
|
||||
|
||||
node.width = width;
|
||||
for(i = 0; i < arrlen(c->entries); i++) {
|
||||
MwLLColor color = MwParseColor(handle, c->entries[i].color == NULL ? colors[i % n] : c->entries[i].color);
|
||||
MwLLColor colorl = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwLLColor colord = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwPoint persp_top[5];
|
||||
MwPoint persp_right[5];
|
||||
MwColor color = MwParseColor(handle, c->entries[i].color == NULL ? colors[i % n] : c->entries[i].color);
|
||||
MwColor colorl = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwColor colord = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwPoint persp_top[5];
|
||||
MwPoint persp_right[5];
|
||||
|
||||
node.x += gap;
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int
|
|||
|
||||
persp_top[4] = persp_top[0];
|
||||
|
||||
MwLLPolygon(handle->lowlevel, persp_top, 4, colorl);
|
||||
MwLLPolygon(handle->lowlevel, persp_top, 4, colorl->lowlevel);
|
||||
|
||||
persp_right[0] = *(MwPoint*)&node2;
|
||||
persp_right[1] = *(MwPoint*)&node2;
|
||||
|
|
@ -189,22 +189,22 @@ static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int
|
|||
|
||||
persp_right[4] = persp_right[0];
|
||||
|
||||
MwLLPolygon(handle->lowlevel, persp_right, 4, colord);
|
||||
MwLLPolygon(handle->lowlevel, persp_right, 4, colord->lowlevel);
|
||||
}
|
||||
|
||||
if(!modern) {
|
||||
MwDrawRectLine(handle, &node, border);
|
||||
|
||||
if(type == MwCHART_BAR_3D) {
|
||||
MwLLLine(handle->lowlevel, &persp_top[0], border);
|
||||
MwLLLine(handle->lowlevel, &persp_top[1], border);
|
||||
MwLLLine(handle->lowlevel, &persp_top[2], border);
|
||||
MwLLLine(handle->lowlevel, &persp_top[3], border);
|
||||
MwLLLine(handle->lowlevel, &persp_top[0], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_top[1], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_top[2], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_top[3], border->lowlevel);
|
||||
|
||||
MwLLLine(handle->lowlevel, &persp_right[0], border);
|
||||
MwLLLine(handle->lowlevel, &persp_right[1], border);
|
||||
MwLLLine(handle->lowlevel, &persp_right[2], border);
|
||||
MwLLLine(handle->lowlevel, &persp_right[3], border);
|
||||
MwLLLine(handle->lowlevel, &persp_right[0], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_right[1], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_right[2], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &persp_right[3], border->lowlevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -215,13 +215,13 @@ static void bar_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int
|
|||
|
||||
node.x += node.width;
|
||||
|
||||
MwLLFreeColor(colord);
|
||||
MwLLFreeColor(colorl);
|
||||
MwLLFreeColor(color);
|
||||
MwFreeColor(colord);
|
||||
MwFreeColor(colorl);
|
||||
MwFreeColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, MwLLColor border) {
|
||||
static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, MwColor border) {
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
MwChart c = handle->internal;
|
||||
double sum = 0;
|
||||
|
|
@ -242,12 +242,12 @@ static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, M
|
|||
|
||||
for(k = 0; k < 4; k++) {
|
||||
for(i = 0; i < arrlen(c->entries); i++) {
|
||||
MwLLColor color;
|
||||
MwLLColor colorl;
|
||||
double angle = c->entries[i].value / sum * 360;
|
||||
int div = angle / PIE_DIV;
|
||||
int j;
|
||||
int count;
|
||||
MwColor color;
|
||||
MwColor colorl;
|
||||
double angle = c->entries[i].value / sum * 360;
|
||||
int div = angle / PIE_DIV;
|
||||
int j;
|
||||
int count;
|
||||
|
||||
if(c->entries[i].value <= 0) continue;
|
||||
if((k == 0 || k == 1) && type == MwCHART_PIE) continue;
|
||||
|
|
@ -282,27 +282,27 @@ static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, M
|
|||
p3[2] = p2[1];
|
||||
|
||||
if(k == 0) {
|
||||
MwLLPolygon(handle->lowlevel, p3, count + 2, color);
|
||||
MwLLPolygon(handle->lowlevel, p3, count + 2, color->lowlevel);
|
||||
} else if(d == 1 && k == 1) {
|
||||
for(j = 3; j < count + 1; j++) {
|
||||
if(!modern) MwLLLine(handle->lowlevel, &p3[j], border);
|
||||
if(!modern) MwLLLine(handle->lowlevel, &p3[j], border->lowlevel);
|
||||
}
|
||||
|
||||
p2[0] = p2[1];
|
||||
p2[0].y += radius / 8;
|
||||
if(!modern) MwLLLine(handle->lowlevel, p2, border);
|
||||
if(!modern) MwLLLine(handle->lowlevel, p2, border->lowlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(k == 2) {
|
||||
MwLLPolygon(handle->lowlevel, p2, count, type == MwCHART_PIE_3D ? colorl : color);
|
||||
MwLLPolygon(handle->lowlevel, p2, count, (type == MwCHART_PIE_3D ? colorl : color)->lowlevel);
|
||||
} else if(k == 3) {
|
||||
int j;
|
||||
|
||||
p2[count] = p2[0];
|
||||
for(j = 0; j < count; j++) {
|
||||
if(!modern) MwLLLine(handle->lowlevel, &p2[j], border);
|
||||
if(!modern) MwLLLine(handle->lowlevel, &p2[j], border->lowlevel);
|
||||
}
|
||||
|
||||
p2[0].x += cos((cangle + angle / 2 - 90) / 180 * M_PI) * radius / 4;
|
||||
|
|
@ -315,8 +315,8 @@ static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, M
|
|||
|
||||
cangle += angle;
|
||||
|
||||
MwLLFreeColor(colorl);
|
||||
MwLLFreeColor(color);
|
||||
MwFreeColor(colorl);
|
||||
MwFreeColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -325,14 +325,14 @@ static void pie_chart(MwWidget handle, MwRect* _r, const char** colors, int n, M
|
|||
p[0].y = r.height / 2;
|
||||
p[1] = p[0];
|
||||
p[1].y += radius / 8;
|
||||
MwLLLine(handle->lowlevel, p, border);
|
||||
MwLLLine(handle->lowlevel, p, border->lowlevel);
|
||||
|
||||
p[0].x = p[1].x = r.width / 2 + radius / 2;
|
||||
MwLLLine(handle->lowlevel, p, border);
|
||||
MwLLLine(handle->lowlevel, p, border->lowlevel);
|
||||
}
|
||||
}
|
||||
|
||||
static void line_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int space, MwLLColor border) {
|
||||
static void line_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, int space, MwColor border) {
|
||||
MwChart c = handle->internal;
|
||||
char buf[128];
|
||||
double twidth;
|
||||
|
|
@ -376,7 +376,7 @@ static void line_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, in
|
|||
p[1] = p[0];
|
||||
p[1].y = r.height - space;
|
||||
|
||||
MwLLLine(handle->lowlevel, p, border);
|
||||
MwLLLine(handle->lowlevel, p, border->lowlevel);
|
||||
|
||||
for(j = 0; j < 2; j++) {
|
||||
for(i = j == 0 ? 1 : 0; i < arrlen(c->entries); i++) {
|
||||
|
|
@ -386,7 +386,7 @@ static void line_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, in
|
|||
p[1].y = (r.height - space) - (c->entries[i].value - vmin) / (vmax - vmin) * (r.height - space);
|
||||
|
||||
if(j == 0) {
|
||||
MwLLLine(handle->lowlevel, p, border);
|
||||
MwLLLine(handle->lowlevel, p, border->lowlevel);
|
||||
} else {
|
||||
MwDrawText(handle, NULL, &p[1], c->entries[i].name, MwALIGNMENT_CENTER, border);
|
||||
}
|
||||
|
|
@ -395,8 +395,8 @@ static void line_chart(MwWidget handle, MwRect* _r, double vmin, double vmax, in
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor border = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor border = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r;
|
||||
MwChart c = handle->internal;
|
||||
int i;
|
||||
|
|
@ -437,8 +437,8 @@ static void draw(MwWidget handle) {
|
|||
break;
|
||||
}
|
||||
|
||||
MwLLFreeColor(border);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(border);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -31,7 +31,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
MwDrawFrame(handle, &r, base, 1);
|
||||
MwDrawRect(handle, &r, base2);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
if(handle->pressed || MwGetInteger(handle, MwNchecked)) {
|
||||
MwPoint p[6];
|
||||
int gap_w = r.width / 4 / 3;
|
||||
|
|
@ -60,12 +60,12 @@ static void draw(MwWidget handle) {
|
|||
p[5] = p[0];
|
||||
p[5].y -= r.height / 3;
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 6, text2);
|
||||
MwLLPolygon(handle->lowlevel, p, 6, text2->lowlevel);
|
||||
}
|
||||
|
||||
MwLLFreeColor(text2);
|
||||
MwLLFreeColor(base2);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text2);
|
||||
MwFreeColor(base2);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void click(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ static int wcreate(MwWidget handle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void hand(MwWidget handle, double x, double y, double width, double length, double angle, MwLLColor inside, MwLLColor border) {
|
||||
static void hand(MwWidget handle, double x, double y, double width, double length, double angle, MwColor inside, MwColor border) {
|
||||
double w = MwGetInteger(handle, MwNwidth);
|
||||
double h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[5];
|
||||
|
|
@ -43,30 +43,30 @@ static void hand(MwWidget handle, double x, double y, double width, double lengt
|
|||
|
||||
p[4] = p[0];
|
||||
|
||||
MwLLPolygon(handle->lowlevel, p, 4, inside);
|
||||
MwLLPolygon(handle->lowlevel, p, 4, inside->lowlevel);
|
||||
|
||||
MwLLLine(handle->lowlevel, &p[0], border);
|
||||
MwLLLine(handle->lowlevel, &p[1], border);
|
||||
MwLLLine(handle->lowlevel, &p[2], border);
|
||||
MwLLLine(handle->lowlevel, &p[3], border);
|
||||
MwLLLine(handle->lowlevel, &p[0], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[1], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[2], border->lowlevel);
|
||||
MwLLLine(handle->lowlevel, &p[3], border->lowlevel);
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
int ShadowDist;
|
||||
int BaseWidth;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor shadow = MwLightenColor(handle, base, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwLLColor inside = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwLLColor border = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwRect r;
|
||||
int i;
|
||||
double w;
|
||||
double fs = (MwGetInteger(handle, MwNsecond) % 60);
|
||||
double fm = (MwGetInteger(handle, MwNminute) % 60) + (MwGetInteger(handle, MwNsecond) % 60) / 60.0;
|
||||
double s = (double)(MwGetInteger(handle, MwNsecond) % 60) / 60 * 360;
|
||||
double m = ((double)(MwGetInteger(handle, MwNminute) % 60) + fs / 60.0) / 60 * 360;
|
||||
double h = ((double)(MwGetInteger(handle, MwNhour) % 12) + fm / 60.0) / 12 * 360;
|
||||
int ColorDiff = MwGetColorDifference(handle);
|
||||
int ShadowDist;
|
||||
int BaseWidth;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor shadow = MwLightenColor(handle, base, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwColor inside = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwColor border = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwRect r;
|
||||
int i;
|
||||
double w;
|
||||
double fs = (MwGetInteger(handle, MwNsecond) % 60);
|
||||
double fm = (MwGetInteger(handle, MwNminute) % 60) + (MwGetInteger(handle, MwNsecond) % 60) / 60.0;
|
||||
double s = (double)(MwGetInteger(handle, MwNsecond) % 60) / 60 * 360;
|
||||
double m = ((double)(MwGetInteger(handle, MwNminute) % 60) + fs / 60.0) / 60 * 360;
|
||||
double h = ((double)(MwGetInteger(handle, MwNhour) % 12) + fm / 60.0) / 12 * 360;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -96,7 +96,7 @@ static void draw(MwWidget handle) {
|
|||
p[1].x = x;
|
||||
p[1].y = y;
|
||||
|
||||
MwLLLine(handle->lowlevel, p, border);
|
||||
MwLLLine(handle->lowlevel, p, border->lowlevel);
|
||||
}
|
||||
|
||||
hand(handle, ShadowDist, ShadowDist, BaseWidth, w / 2 * 2 / 3, h, shadow, shadow);
|
||||
|
|
@ -107,10 +107,10 @@ static void draw(MwWidget handle) {
|
|||
hand(handle, 0, 0, BaseWidth, w / 2, m, inside, border);
|
||||
hand(handle, 0, 0, BaseWidth / 4, w / 2, s, inside, border);
|
||||
|
||||
MwLLFreeColor(border);
|
||||
MwLLFreeColor(inside);
|
||||
MwLLFreeColor(shadow);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(border);
|
||||
MwFreeColor(inside);
|
||||
MwFreeColor(shadow);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ static void destroy(MwWidget handle) {
|
|||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r, rc;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwComboBox cb = handle->internal;
|
||||
|
||||
r.x = 0;
|
||||
|
|
@ -59,8 +59,8 @@ static void draw(MwWidget handle) {
|
|||
r.height = MwDefaultBorderWidth(handle) * 2;
|
||||
MwDrawFrame(handle, &r, base, 0);
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void MWAPI listbox_activate(MwWidget handle, void* user, void* client) {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ static void destroy(MwWidget handle) {
|
|||
|
||||
static void draw(MwWidget handle) {
|
||||
MwDocument d = handle->internal;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r;
|
||||
int i;
|
||||
MwFLFont font = NULL;
|
||||
|
|
@ -138,7 +138,7 @@ static void draw(MwWidget handle) {
|
|||
if(j == 0 || j == 1) {
|
||||
line[0].y += MwTextHeight(handle, font, l->text) / 2 * (2 - j);
|
||||
line[1].y += MwTextHeight(handle, font, l->text) / 2 * (2 - j);
|
||||
MwLLLine(handle->lowlevel, line, c ? base : text);
|
||||
MwLLLine(handle->lowlevel, line, (c ? base : text)->lowlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -191,8 +191,8 @@ static void draw(MwWidget handle) {
|
|||
if(IsFontChange(l->type)) font = l->font;
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static char* in_hitbox(MwWidget handle, MwPoint* p) {
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ static void tick(MwWidget handle) {
|
|||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwEntry t = handle->internal;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwFLFont font = MwFLBuildFont(MwFLFlagMonospace);
|
||||
if(str == NULL) str = "";
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static void draw(MwWidget handle) {
|
|||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
MwDrawWidgetBack(handle, &r, base, 1, MwDEFAULT);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
if(str != NULL) {
|
||||
int w = MwTextWidth(handle, font, "M");
|
||||
int h = MwTextHeight(handle, font, "M");
|
||||
|
|
@ -108,8 +108,8 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void key(MwWidget handle, int code) {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect fr;
|
||||
MwRect rr;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
int inverted;
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwRect fr;
|
||||
MwRect rr;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
int inverted;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
if(MwGetInteger(handle, MwNhasBorder)) {
|
||||
inverted = MwGetInteger(handle, MwNinverted);
|
||||
|
|
@ -36,9 +36,9 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
|
||||
MwDrawRect(handle, &rr, base);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &rr, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &rr, bgpx);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -25,16 +25,16 @@ static void draw(MwWidget handle) {
|
|||
MwDrawRect(handle, &r, base);
|
||||
if(px != NULL) {
|
||||
if(!MwGetInteger(handle, MwNfillArea)) {
|
||||
r.x = (r.width - px->common.width) / 2;
|
||||
r.y = (r.height - px->common.height) / 2;
|
||||
r.width = px->common.width;
|
||||
r.height = px->common.height;
|
||||
r.x = (r.width - px->common->width) / 2;
|
||||
r.y = (r.height - px->common->height) / 2;
|
||||
r.width = px->common->width;
|
||||
r.height = px->common->height;
|
||||
}
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, px);
|
||||
MwDrawPixmap(handle, &r, px);
|
||||
}
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static void destroy(MwWidget handle) {
|
|||
free(handle->internal);
|
||||
}
|
||||
|
||||
static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
|
||||
static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwColor text) {
|
||||
int cy, cx, b;
|
||||
|
||||
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
|
||||
|
|
@ -37,9 +37,9 @@ static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
for(cy = y; cy < y + l_one; cy++) {
|
||||
for(cx = x; cx < x + s_one; cx++) {
|
||||
unsigned char* px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
unsigned char* px;
|
||||
|
||||
px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -67,15 +67,15 @@ static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
unsigned char* px;
|
||||
|
||||
px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
|
||||
static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwColor text) {
|
||||
int cy, cx, b;
|
||||
|
||||
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
|
||||
|
|
@ -84,9 +84,9 @@ static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
for(cx = x; cx < x + l_one; cx++) {
|
||||
for(cy = y; cy < y + s_one; cy++) {
|
||||
unsigned char* px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,9 +99,9 @@ static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
unsigned char* px;
|
||||
|
||||
px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -114,9 +114,9 @@ static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
unsigned char* px;
|
||||
|
||||
px = &raw[(cy * stride + cx) * 4];
|
||||
px[0] = text->common.red;
|
||||
px[1] = text->common.green;
|
||||
px[2] = text->common.blue;
|
||||
px[0] = text->common->red;
|
||||
px[1] = text->common->green;
|
||||
px[2] = text->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -124,16 +124,16 @@ static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride
|
|||
|
||||
static void draw_seven_segment(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwLLColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
int align;
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwLabel lab = handle->internal;
|
||||
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
|
||||
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
|
||||
MwLLPixmap px;
|
||||
MwPixmap px;
|
||||
unsigned char* raw;
|
||||
int w = 0, h = s_one * 3 + l_one * 2, i;
|
||||
int x = 0;
|
||||
|
|
@ -146,7 +146,7 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
MwDrawRect(handle, &r, base);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
|
||||
align = MwGetInteger(handle, MwNalignment);
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
}
|
||||
|
||||
for(j = 1; j >= 0; j--) {
|
||||
MwLLColor cl = j == 1 ? shadow : text;
|
||||
MwColor cl = j == 1 ? shadow : text;
|
||||
|
||||
if(la) draw_h(handle, raw, x + s_one + j, j, w, cl);
|
||||
if(lb) draw_v(handle, raw, x + s_one + l_one + j, s_one + j, w, cl);
|
||||
|
|
@ -250,7 +250,7 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
int cy, cx;
|
||||
int j;
|
||||
for(j = 1; j >= 0; j--) {
|
||||
MwLLColor cl = j == 1 ? shadow : text;
|
||||
MwColor cl = j == 1 ? shadow : text;
|
||||
for(cy = 1; cy < h - 1; cy++) {
|
||||
int h = s_one / 2;
|
||||
int c = (l_one - h) / 2 + s_one;
|
||||
|
|
@ -261,9 +261,9 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
if(c1 || c2) {
|
||||
for(cx = x; cx < x + s_one; cx++) {
|
||||
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
|
||||
px[0] = cl->common.red;
|
||||
px[1] = cl->common.green;
|
||||
px[2] = cl->common.blue;
|
||||
px[0] = cl->common->red;
|
||||
px[1] = cl->common->green;
|
||||
px[2] = cl->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -276,13 +276,13 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
int cy, cx;
|
||||
int j;
|
||||
for(j = 1; j >= 0; j--) {
|
||||
MwLLColor cl = j == 1 ? shadow : text;
|
||||
MwColor cl = j == 1 ? shadow : text;
|
||||
for(cy = h - (s_one - 1) / 2 - 1; cy < h; cy++) {
|
||||
for(cx = x - Spacing - (s_one - 1) / 2 - 1; cx < (x - Spacing); cx++) {
|
||||
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
|
||||
px[0] = cl->common.red;
|
||||
px[1] = cl->common.green;
|
||||
px[2] = cl->common.blue;
|
||||
px[0] = cl->common->red;
|
||||
px[1] = cl->common->green;
|
||||
px[2] = cl->common->blue;
|
||||
px[3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
r.x = r.width - w;
|
||||
}
|
||||
r.width = w;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, px);
|
||||
MwDrawPixmap(handle, &r, px);
|
||||
|
||||
free(raw);
|
||||
|
||||
|
|
@ -315,12 +315,12 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
static void draw_normal(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwPoint p;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwLLColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
int align;
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
if(str == NULL) str = "";
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ static void draw_normal(MwWidget handle) {
|
|||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
MwDrawRect(handle, &r, base);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
|
||||
align = MwGetInteger(handle, MwNalignment);
|
||||
|
||||
|
|
@ -359,9 +359,9 @@ static void draw_normal(MwWidget handle) {
|
|||
p.y -= 1;
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, text);
|
||||
|
||||
MwLLFreeColor(shadow);
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(shadow);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -136,10 +136,10 @@ static void MWAPI frame_mouse_move(MwWidget handle, void* user, void* call) {
|
|||
static void frame_draw(MwWidget handle) {
|
||||
MwRect r, r2;
|
||||
MwListBox lb = handle->parent->internal;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
int i;
|
||||
MwPoint p;
|
||||
int st = 0;
|
||||
|
|
@ -180,12 +180,12 @@ static void frame_draw(MwWidget handle) {
|
|||
}
|
||||
if(lb->list[i].pixmap != NULL) {
|
||||
MwRect r2;
|
||||
int h = (lb->list[i].pixmap->common.height > (MwTextHeight(handle, Font, "M") + Padding)) ? (MwTextHeight(handle, Font, "M") + Padding) : lb->list[i].pixmap->common.height;
|
||||
int h = (lb->list[i].pixmap->common->height > (MwTextHeight(handle, Font, "M") + Padding)) ? (MwTextHeight(handle, Font, "M") + Padding) : lb->list[i].pixmap->common->height;
|
||||
r2.x = MwDefaultBorderWidth(handle);
|
||||
r2.y = p.y + (MwTextHeight(handle, Font, "M") + Padding - h) / 2;
|
||||
r2.width = h * lb->list[i].pixmap->common.width / lb->list[i].pixmap->common.height;
|
||||
r2.width = h * lb->list[i].pixmap->common->width / lb->list[i].pixmap->common->height;
|
||||
r2.height = h;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, lb->list[i].pixmap);
|
||||
MwDrawPixmap(handle, &r2, lb->list[i].pixmap);
|
||||
}
|
||||
p.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
||||
for(j = 0; j < arrlen(lb->list[i].name); j++) {
|
||||
|
|
@ -259,10 +259,10 @@ static void frame_draw(MwWidget handle) {
|
|||
|
||||
MwDrawFrame(handle, &r, base, 1);
|
||||
|
||||
MwLLFreeColor(text2);
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base2);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text2);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base2);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void resize(MwWidget handle, int no_resize) {
|
||||
|
|
@ -359,8 +359,8 @@ static void destroy(MwWidget handle) {
|
|||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwListBox lb = handle->internal;
|
||||
|
||||
r.x = 0;
|
||||
|
|
@ -405,8 +405,8 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* prop) {
|
||||
|
|
@ -456,7 +456,7 @@ static int mwListBoxSetImpl(MwWidget handle, int row, int col, const char* text)
|
|||
return row;
|
||||
}
|
||||
|
||||
static void mwListBoxSetIconImpl(MwWidget handle, int index, MwLLPixmap icon) {
|
||||
static void mwListBoxSetIconImpl(MwWidget handle, int index, MwPixmap icon) {
|
||||
MwListBox lb = handle->internal;
|
||||
MwListBoxEntry entry;
|
||||
int new = 0;
|
||||
|
|
@ -585,8 +585,8 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
|||
*(int*)out = mwListBoxSetImpl(handle, row, col, text);
|
||||
}
|
||||
if(strcmp(name, "mwListBoxSetIcon") == 0) {
|
||||
int index = va_arg(va, int);
|
||||
MwLLPixmap icon = va_arg(va, MwLLPixmap);
|
||||
int index = va_arg(va, int);
|
||||
MwPixmap icon = va_arg(va, MwPixmap);
|
||||
mwListBoxSetIconImpl(handle, index, icon);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ static void destroy(MwWidget handle) {
|
|||
m->sub[i]->cleaned = 0;
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MENU_LOOP_DECL;
|
||||
|
||||
MENU_LOOP_INIT;
|
||||
|
|
@ -120,8 +120,8 @@ static void draw(MwWidget handle) {
|
|||
MwDrawText(handle, MwFLBuildFont((m->sub[i]->wsub != NULL || (in_area && handle->pressed)) ? MwFLFlagBold : 0), &p, m->sub[i]->name + incr, MwALIGNMENT_CENTER, text);
|
||||
END_MENU_LOOP;
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void parent_resize(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ static void destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwEntry e = handle->internal;
|
||||
MwRect r;
|
||||
int pr;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwEntry e = handle->internal;
|
||||
MwRect r;
|
||||
int pr;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
MwEntryClass->draw(handle);
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static void draw(MwWidget handle) {
|
|||
r.y = r.y + (h / 2 - r.height) / 2;
|
||||
MwDrawTriangle(handle, &r, base, pr, MwSOUTH);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void key(MwWidget handle, int code) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ typedef struct waylandopengl {
|
|||
struct gbm_surface* gbm_surface;
|
||||
struct gbm_bo* previous_bo;
|
||||
int drm_fd;
|
||||
MwLLPixmap frontbuffer;
|
||||
MwPixmap frontbuffer;
|
||||
MwU8* frontbuffer_data;
|
||||
|
||||
void* gllib;
|
||||
|
|
@ -607,7 +607,7 @@ static void frontbuffer_draw(MwWidget handle) {
|
|||
r.y = 0;
|
||||
r.width = handle->lowlevel->wayland.ww;
|
||||
r.height = handle->lowlevel->wayland.wh;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, o->frontbuffer);
|
||||
MwDrawPixmap(handle, &r, o->frontbuffer);
|
||||
}
|
||||
}
|
||||
static void frontbuffer_resize(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
double w;
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
double w;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -27,7 +27,7 @@ static void draw(MwWidget handle) {
|
|||
w = w / (MwGetInteger(handle, MwNmaxValue) - MwGetInteger(handle, MwNminValue));
|
||||
|
||||
MwDrawWidgetBack(handle, &r, base, 1, MwDEFAULT);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
|
||||
r.x += MwDefaultBorderWidth(handle);
|
||||
r.y += MwDefaultBorderWidth(handle);
|
||||
|
|
@ -37,8 +37,8 @@ static void draw(MwWidget handle) {
|
|||
r.width = (int)(r.width * w);
|
||||
MwDrawRect(handle, &r, fill);
|
||||
|
||||
MwLLFreeColor(fill);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(fill);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.width = MwGetInteger(handle, MwNwidth);
|
||||
r.height = MwGetInteger(handle, MwNheight);
|
||||
MwDrawRect(handle, &r, base);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
|
||||
if(r.width < r.height) {
|
||||
r.height = r.width;
|
||||
|
|
@ -31,17 +31,17 @@ static void draw(MwWidget handle) {
|
|||
r.y = (MwGetInteger(handle, MwNheight) - r.height) / 2;
|
||||
|
||||
if(MwGetInteger(handle, MwNmodernLook) == 1) {
|
||||
int is_checked = (handle->pressed || MwGetInteger(handle, MwNchecked));
|
||||
MwLLColor darker;
|
||||
MwLLColor inner;
|
||||
MwLLColor innerunsel = base;
|
||||
int is_checked = (handle->pressed || MwGetInteger(handle, MwNchecked));
|
||||
MwColor darker;
|
||||
MwColor inner;
|
||||
MwColor innerunsel = base;
|
||||
|
||||
if(MwGetInteger(handle, MwNdarkTheme) == 1) {
|
||||
darker = MwLLAllocColor(handle->lowlevel, 255, 255, 255);
|
||||
darker = MwAllocColor(handle, 255, 255, 255);
|
||||
innerunsel = MwLightenColor(handle, base, 80, 80, 80);
|
||||
inner = darker;
|
||||
} else {
|
||||
darker = MwLLAllocColor(handle->lowlevel, 0, 0, 0);
|
||||
darker = MwAllocColor(handle, 0, 0, 0);
|
||||
inner = MwLightenColor(handle, is_checked ? darker : base, -80, -80, -80);
|
||||
}
|
||||
MwDrawCircle(handle, &r, darker, NULL, 1);
|
||||
|
|
@ -57,12 +57,12 @@ static void draw(MwWidget handle) {
|
|||
MwDrawCircle(handle, &r, inner, innerunsel, 1);
|
||||
}
|
||||
}
|
||||
MwLLFreeColor(darker);
|
||||
MwFreeColor(darker);
|
||||
} else {
|
||||
MwDrawDiamond(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0);
|
||||
}
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void click(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ static void add_value(MwWidget handle, int mul) {
|
|||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r = {0}, rt = {0}, rbar = {0};
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor dark = MwLightenColor(handle, base, -64, -64, -64);
|
||||
MwScrollBar scr = handle->internal;
|
||||
int or ;
|
||||
int uy, dy, ux, dx;
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
int uy, dy, ux, dx;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -74,7 +74,7 @@ static void draw(MwWidget handle) {
|
|||
dx = r.width - r.height;
|
||||
|
||||
MwDrawWidgetBack(handle, &r, dark, 1, MwDEFAULT);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(bgpx != NULL) MwDrawPixmap(handle, &r, bgpx);
|
||||
|
||||
rt = r;
|
||||
|
||||
|
|
@ -133,8 +133,8 @@ static void draw(MwWidget handle) {
|
|||
|
||||
if(rbar.height >= 0) MwDrawWidgetBack(handle, &rbar, base, 0, MwDEFAULT);
|
||||
|
||||
MwLLFreeColor(dark);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(dark);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void mouse_move(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -27,7 +27,7 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
MwDrawFrameEx(handle, &r, base, 1, 1, 0, 0);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ static void destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r;
|
||||
MwMenu menu = handle->internal;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r;
|
||||
MwMenu menu = handle->internal;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -96,8 +96,8 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void click(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -8,33 +8,33 @@
|
|||
static void resize(MwWidget handle);
|
||||
|
||||
static void close_draw(MwWidget handle) {
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
|
||||
p[0].x = bw * 2;
|
||||
p[0].y = bw * 2;
|
||||
p[1].x = w - bw * 2 - 1;
|
||||
p[1].y = h - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].x++;
|
||||
p[1].x--;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].x = w - bw * 2 - 1;
|
||||
p[0].y = bw * 2;
|
||||
p[1].x = bw * 2;
|
||||
p[1].y = h - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].x--;
|
||||
p[1].x++;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void MWAPI close_activate(MwWidget handle, void* user, void* client) {
|
||||
|
|
@ -49,34 +49,34 @@ static void MWAPI close_activate(MwWidget handle, void* user, void* client) {
|
|||
}
|
||||
|
||||
static void maximize_draw(MwWidget handle) {
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
|
||||
p[0].x = bw * 2;
|
||||
p[0].y = bw * 2;
|
||||
p[1].x = w - bw * 2 - 1;
|
||||
p[1].y = bw * 2;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].y = p[1].y = h - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].y = p[1].y = bw * 2 + 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].x = bw * 2;
|
||||
p[0].y = bw * 2;
|
||||
p[1].x = bw * 2;
|
||||
p[1].y = h - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].x = p[1].x = w - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void MWAPI maximize_activate(MwWidget handle, void* user, void* client) {
|
||||
|
|
@ -114,23 +114,23 @@ static void MWAPI maximize_activate(MwWidget handle, void* user, void* client) {
|
|||
}
|
||||
|
||||
static void minimize_draw(MwWidget handle) {
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
MwPoint p[2];
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
int bw = MwDefaultBorderWidth(handle);
|
||||
|
||||
p[0].x = bw * 2;
|
||||
p[0].y = h - bw * 2 - 1;
|
||||
p[1].x = w - bw * 2 - 1;
|
||||
p[1].y = h - bw * 2 - 1;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
p[0].y--;
|
||||
p[1].y--;
|
||||
MwLLLine(handle->lowlevel, p, c);
|
||||
MwLLLine(handle->lowlevel, p, c->lowlevel);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static int sort_subwindow(const void* _a, const void* _b) {
|
||||
|
|
@ -285,13 +285,13 @@ static void destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor tb = MwParseColor(handle, MwGetText(handle, MwNtitleBackground));
|
||||
MwLLColor tf = MwParseColor(handle, MwGetText(handle, MwNtitleForeground));
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor tb = MwParseColor(handle, MwGetText(handle, MwNtitleBackground));
|
||||
MwColor tf = MwParseColor(handle, MwGetText(handle, MwNtitleForeground));
|
||||
MwRect r, r2, r3;
|
||||
const char* title = MwGetText(handle, MwNtitle);
|
||||
int incr = 0;
|
||||
MwLLPixmap px = MwGetVoid(handle, MwNiconPixmap);
|
||||
MwPixmap px = MwGetVoid(handle, MwNiconPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -313,7 +313,7 @@ static void draw(MwWidget handle) {
|
|||
r3.y += incr;
|
||||
r3.width = ButtonSize;
|
||||
r3.height = ButtonSize;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r3, px);
|
||||
MwDrawPixmap(handle, &r3, px);
|
||||
|
||||
incr += ButtonSize;
|
||||
}
|
||||
|
|
@ -335,9 +335,9 @@ static void draw(MwWidget handle) {
|
|||
r.height -= TitleHeight;
|
||||
MwDrawFrame(handle, &r, c, 1);
|
||||
|
||||
MwLLFreeColor(tf);
|
||||
MwLLFreeColor(tb);
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(tf);
|
||||
MwFreeColor(tb);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void parent_resize(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ static int icon_width(MwWidget handle, const char* text) {
|
|||
|
||||
for(i = 0; i < arrlen(t->names); i++) {
|
||||
if(strcmp(t->names[i], text) == 0) {
|
||||
MwLLPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
|
||||
if(px == NULL) return 0;
|
||||
|
||||
return px->common.width * tab_height(handle) / px->common.height;
|
||||
return px->common->width * tab_height(handle) / px->common->height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,14 +57,14 @@ static int icon_width(MwWidget handle, const char* text) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwTab t = handle->internal;
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor ct = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r, r2;
|
||||
int h = tab_height(handle);
|
||||
int i;
|
||||
int n;
|
||||
int x = 0;
|
||||
MwTab t = handle->internal;
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor ct = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwRect r, r2;
|
||||
int h = tab_height(handle);
|
||||
int i;
|
||||
int n;
|
||||
int x = 0;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -97,8 +97,8 @@ static void draw(MwWidget handle) {
|
|||
x += r2.width;
|
||||
|
||||
if(iw > 0) {
|
||||
MwLLPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
MwRect rp;
|
||||
MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
MwRect rp;
|
||||
|
||||
rp = r2;
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ static void draw(MwWidget handle) {
|
|||
rp.width = iw - 10;
|
||||
rp.height = rp.height * (iw - 10) / iw;
|
||||
|
||||
MwLLDrawPixmap(handle->lowlevel, &rp, px);
|
||||
MwDrawPixmap(handle, &rp, px);
|
||||
}
|
||||
|
||||
if(render) {
|
||||
|
|
@ -191,8 +191,8 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
}
|
||||
|
||||
MwLLFreeColor(ct);
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(ct);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void show_frame(MwWidget handle) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static void set_all(MwTreeViewEntry** root, int v) {
|
|||
}
|
||||
}
|
||||
|
||||
static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry** root, MwLLColor base, MwLLColor text, MwLLColor base2, MwLLColor text2, MwPoint* p, int next, int shift, int* skip, int* shared, int draw, MwPoint* mouse) {
|
||||
static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry** root, MwColor base, MwColor text, MwColor base2, MwColor text2, MwPoint* p, int next, int shift, int* skip, int* shared, int draw, MwPoint* mouse) {
|
||||
int i;
|
||||
MwPoint l[2];
|
||||
int skipped = 0;
|
||||
|
|
@ -42,7 +42,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
l[0] = *p;
|
||||
l[0].x -= LineSpace / 2;
|
||||
l[1] = *p;
|
||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text2);
|
||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text2->lowlevel);
|
||||
}
|
||||
|
||||
if(shift > LineSpace) {
|
||||
|
|
@ -53,7 +53,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
if(next) {
|
||||
l[1].y += MwTextHeight(handle, Font, "M") / 2;
|
||||
}
|
||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text2);
|
||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text2->lowlevel);
|
||||
}
|
||||
if(tree->tree != NULL) {
|
||||
r.width = OpenerSize;
|
||||
|
|
@ -61,7 +61,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
r.x = p->x - LineSpace + (LineSpace - r.width) / 2;
|
||||
r.y = p->y - MwTextHeight(handle, Font, "M") / 2 + (MwTextHeight(handle, Font, "M") - r.height) / 2;
|
||||
if(draw) {
|
||||
MwLLColor col = tree->opened ? MwLightenColor(handle, base, -8, -8, -8) : base;
|
||||
MwColor col = tree->opened ? MwLightenColor(handle, base, -8, -8, -8) : base;
|
||||
MwRect r2 = r;
|
||||
const int len = 4;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
l[1].x = l[0].x + len;
|
||||
l[1].y = l[0].y;
|
||||
|
||||
MwLLLine(handle->lowlevel, &l[0], text);
|
||||
MwLLLine(handle->lowlevel, &l[0], text->lowlevel);
|
||||
} else {
|
||||
l[0].x = r.x + (r.width - len) / 2;
|
||||
l[0].y = r.y + r.height / 2;
|
||||
|
|
@ -82,7 +82,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
l[1].x = l[0].x + len;
|
||||
l[1].y = l[0].y;
|
||||
|
||||
MwLLLine(handle->lowlevel, &l[0], text);
|
||||
MwLLLine(handle->lowlevel, &l[0], text->lowlevel);
|
||||
|
||||
l[0].x = r.x + r.width / 2;
|
||||
l[0].y = r.y + (r.height - len) / 2;
|
||||
|
|
@ -90,12 +90,12 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
l[1].x = l[0].x;
|
||||
l[1].y = l[0].y + len;
|
||||
|
||||
MwLLLine(handle->lowlevel, &l[0], text);
|
||||
MwLLLine(handle->lowlevel, &l[0], text->lowlevel);
|
||||
}
|
||||
r = r2;
|
||||
MwDrawFrame(handle, &r, base, tree->opened);
|
||||
|
||||
if(col != base) MwLLFreeColor(col);
|
||||
if(col != base) MwFreeColor(col);
|
||||
} else {
|
||||
if(r.x <= mouse->x && mouse->x <= (r.x + r.width) && r.y <= mouse->y && mouse->y <= (r.y + r.height)) {
|
||||
tree->opened = tree->opened ? 0 : 1;
|
||||
|
|
@ -104,12 +104,12 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
}
|
||||
if(tree->pixmap != NULL) {
|
||||
r.height = MwTextHeight(handle, Font, "M");
|
||||
r.width = r.height * tree->pixmap->common.width / tree->pixmap->common.height;
|
||||
r.width = r.height * tree->pixmap->common->width / tree->pixmap->common->height;
|
||||
|
||||
r.x = p->x + (MwGetInteger(handle->parent, MwNleftPadding) - r.width) / 2;
|
||||
r.y = p->y - MwTextHeight(handle, Font, "M") / 2;
|
||||
|
||||
if(draw) MwLLDrawPixmap(handle->lowlevel, &r, tree->pixmap);
|
||||
if(draw) MwDrawPixmap(handle, &r, tree->pixmap);
|
||||
}
|
||||
p->x += MwGetInteger(handle->parent, MwNleftPadding);
|
||||
if(draw) {
|
||||
|
|
@ -160,17 +160,17 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
if(skipped && p->y > l[0].y) {
|
||||
skipped = 0;
|
||||
}
|
||||
if(draw && !skipped && i != (arrlen(tree->tree) - 1)) MwLLLine(handle->lowlevel, &l[0], text);
|
||||
if(draw && !skipped && i != (arrlen(tree->tree) - 1)) MwLLLine(handle->lowlevel, &l[0], text->lowlevel);
|
||||
}
|
||||
}
|
||||
|
||||
static void frame_draw(MwWidget handle) {
|
||||
MwRect r, r2;
|
||||
MwTreeView tv = handle->parent->internal;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
MwColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwPoint p;
|
||||
int shared = 0;
|
||||
int i;
|
||||
|
|
@ -197,10 +197,10 @@ static void frame_draw(MwWidget handle) {
|
|||
|
||||
MwDrawFrame(handle, &r, base, 1);
|
||||
|
||||
MwLLFreeColor(text2);
|
||||
MwLLFreeColor(text);
|
||||
MwLLFreeColor(base2);
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(text2);
|
||||
MwFreeColor(text);
|
||||
MwFreeColor(base2);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static int recursive_length(MwTreeViewEntry** e) {
|
||||
|
|
@ -322,8 +322,8 @@ static void destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -331,10 +331,10 @@ static void draw(MwWidget handle) {
|
|||
r.height = MwGetInteger(handle, MwNheight);
|
||||
MwDrawRect(handle, &r, c);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void* mwTreeViewAddImpl(MwWidget handle, void* parent, MwLLPixmap pixmap, const char* item) {
|
||||
static void* mwTreeViewAddImpl(MwWidget handle, void* parent, MwPixmap pixmap, const char* item) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* t = malloc(sizeof(*t));
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ static void mwTreeViewSetLabelImpl(MwWidget handle, void* item, const char* labe
|
|||
}
|
||||
}
|
||||
|
||||
static void mwTreeViewSetPixmapImpl(MwWidget handle, void* item, MwLLPixmap pixmap) {
|
||||
static void mwTreeViewSetPixmapImpl(MwWidget handle, void* item, MwPixmap pixmap) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* e = item;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ static int mwTreeViewGetOpenedImpl(MwWidget handle, void* item) {
|
|||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwTreeViewAdd") == 0) {
|
||||
void* parent = va_arg(va, void*);
|
||||
MwLLPixmap pixmap = va_arg(va, MwLLPixmap);
|
||||
MwPixmap pixmap = va_arg(va, MwPixmap);
|
||||
const char* item = va_arg(va, const char*);
|
||||
*(void**)out = mwTreeViewAddImpl(handle, parent, pixmap, item);
|
||||
}
|
||||
|
|
@ -468,8 +468,8 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
|||
mwTreeViewSetLabelImpl(handle, item, label);
|
||||
}
|
||||
if(strcmp(name, "mwTreeViewSetPixmap") == 0) {
|
||||
void* item = va_arg(va, void*);
|
||||
MwLLPixmap pixmap = va_arg(va, MwLLPixmap);
|
||||
void* item = va_arg(va, void*);
|
||||
MwPixmap pixmap = va_arg(va, MwPixmap);
|
||||
mwTreeViewSetPixmapImpl(handle, item, pixmap);
|
||||
}
|
||||
if(strcmp(name, "mwTreeViewSetOpened") == 0) {
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ static void destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -111,7 +111,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
MwDrawRect(handle, &r, base);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
MwFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* prop) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ static int wcreate(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -22,7 +22,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
MwDrawRect(handle, &r, c);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
MwFreeColor(c);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
|
|
|
|||
|
|
@ -13,12 +13,10 @@ print(OUT "};\n");
|
|||
print(OUT "\n");
|
||||
print(OUT "static struct color* colors = NULL;\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "MwLLColor MwParseColorName(MwWidget handle, const char* color){\n");
|
||||
print(OUT "MwColor MwParseColorName(MwWidget handle, const char* color){\n");
|
||||
print(OUT " MwRGB rgb;\n");
|
||||
print(OUT " MwParseColorNameNoAllocate(color, &rgb);\n");
|
||||
print(OUT
|
||||
" return MwLLAllocColor(handle->lowlevel, rgb.red, rgb.green, rgb.blue);\n"
|
||||
);
|
||||
print(OUT " return MwAllocColor(handle, rgb.red, rgb.green, rgb.blue);\n");
|
||||
print(OUT "}\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "void MwParseColorNameNoAllocate(const char* color, MwRGB* rgb){\n");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main(int argc, char** argv) {
|
|||
printf(" * Copyright notice:\n");
|
||||
printf(" * \"%s\"\n", rec.u.atom);
|
||||
printf(" */\n");
|
||||
printf("MwFont MwFontData[] = {\n");
|
||||
printf("MwFontResource MwFontData[] = {\n");
|
||||
for(i = 0; i < 0x100; i++) {
|
||||
int y, x;
|
||||
FT_Bitmap bitmap;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue