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