mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 19:03:29 +00:00
add classic theme option to Makefile.pl
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@664 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -14,7 +14,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|||||||
else()
|
else()
|
||||||
option(BUILD_VULKAN "Compile Vulkan widget or not" ON)
|
option(BUILD_VULKAN "Compile Vulkan widget or not" ON)
|
||||||
endif()
|
endif()
|
||||||
option(CLASSIC "Use classic theme" OFF)
|
option(CLASSIC_THEME "Use classic theme" OFF)
|
||||||
option(BUILD_EXAMPLES "Build examples" OFF)
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
||||||
option(USE_STB_IMAGE "Use stb_image" ON)
|
option(USE_STB_IMAGE "Use stb_image" ON)
|
||||||
option(USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
option(USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
||||||
@@ -100,11 +100,11 @@ target_include_directories(
|
|||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CLASSIC)
|
if(CLASSIC_THEME)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
MW_CLASSIC_THEME
|
USE_CLASSIC_THEME
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
10
Makefile.pl
10
Makefile.pl
@@ -33,6 +33,7 @@ our $cross = 0;
|
|||||||
|
|
||||||
require("./pl/utils.pl");
|
require("./pl/utils.pl");
|
||||||
|
|
||||||
|
param_set("classic-theme", 0);
|
||||||
param_set("stb-image", 1);
|
param_set("stb-image", 1);
|
||||||
param_set("stb-truetype", 0);
|
param_set("stb-truetype", 0);
|
||||||
param_set("freetype2", 1);
|
param_set("freetype2", 1);
|
||||||
@@ -42,6 +43,7 @@ param_set("vulkan", 0);
|
|||||||
param_set("vulkan-string-helper", 1);
|
param_set("vulkan-string-helper", 1);
|
||||||
|
|
||||||
my %features = (
|
my %features = (
|
||||||
|
"classic-theme" => "use classic theme",
|
||||||
"stb-image" => "use stb_image instead of libjpeg/libpng",
|
"stb-image" => "use stb_image instead of libjpeg/libpng",
|
||||||
"stb-truetype" => "use stb_truetype",
|
"stb-truetype" => "use stb_truetype",
|
||||||
"freetype2" => "use FreeType2",
|
"freetype2" => "use FreeType2",
|
||||||
@@ -51,10 +53,10 @@ my %features = (
|
|||||||
"vulkan-string-helper" => "use Vulkan string helper"
|
"vulkan-string-helper" => "use Vulkan string helper"
|
||||||
);
|
);
|
||||||
my @features_keys = (
|
my @features_keys = (
|
||||||
"1stb-image", "1stb-truetype",
|
"1classic-theme", "1stb-image",
|
||||||
"1freetype2", "1opengl",
|
"1stb-truetype", "1freetype2",
|
||||||
"2xrender", "1vulkan",
|
"1opengl", "2xrender",
|
||||||
"2vulkan-string-helper"
|
"1vulkan", "2vulkan-string-helper"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach my $l (@ARGV) {
|
foreach my $l (@ARGV) {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ new_object("src/*.c");
|
|||||||
|
|
||||||
my $gl_libs = "";
|
my $gl_libs = "";
|
||||||
|
|
||||||
|
if (param_get("classic-theme")) {
|
||||||
|
add_cflags("-DUSE_CLASSIC_THEME");
|
||||||
|
}
|
||||||
if ($backend eq "x11") {
|
if ($backend eq "x11") {
|
||||||
add_cflags("-DUSE_X11");
|
add_cflags("-DUSE_X11");
|
||||||
new_object("src/backend/x11.c");
|
new_object("src/backend/x11.c");
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ static void set_boldfont(MwWidget handle) {
|
|||||||
void MwSetDefault(MwWidget handle) {
|
void MwSetDefault(MwWidget handle) {
|
||||||
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
||||||
|
|
||||||
#ifdef MW_CLASSIC_THEME
|
#ifdef USE_CLASSIC_THEME
|
||||||
inherit_integer(handle, MwNmodernLook, 0);
|
inherit_integer(handle, MwNmodernLook, 0);
|
||||||
#else
|
#else
|
||||||
inherit_integer(handle, MwNmodernLook, 1);
|
inherit_integer(handle, MwNmodernLook, 1);
|
||||||
|
|||||||
@@ -47,33 +47,48 @@ static void draw(MwWidget handle) {
|
|||||||
p.y = 3;
|
p.y = 3;
|
||||||
|
|
||||||
for(i = 0; i < arrlen(menu->sub); i++) {
|
for(i = 0; i < arrlen(menu->sub); i++) {
|
||||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
if(strcmp(menu->sub[i]->name, "----") == 0) {
|
||||||
int th = MwTextHeight(handle, menu->sub[i]->name);
|
MwRect rc;
|
||||||
|
|
||||||
if(menu->sub[i]->wsub != NULL) {
|
p.y += 1;
|
||||||
r.x = 0;
|
|
||||||
r.y = p.y - 3;
|
rc.x = MwDefaultBorderWidth(handle) * 2;
|
||||||
r.width = tw + 15 + 5 * 2;
|
rc.y = p.y;
|
||||||
r.height = th + 3 * 2;
|
rc.width = r.width - (rc.x * 2);
|
||||||
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
|
rc.height = MwDefaultBorderWidth(handle) * 2;
|
||||||
|
|
||||||
|
MwDrawFrame(handle, &rc, base, 1);
|
||||||
|
|
||||||
|
p.y += MwDefaultBorderWidth(handle) * 2 + 1;
|
||||||
|
} else {
|
||||||
|
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||||
|
int th = MwTextHeight(handle, menu->sub[i]->name);
|
||||||
|
|
||||||
|
if(menu->sub[i]->wsub != NULL) {
|
||||||
|
r.x = 0;
|
||||||
|
r.y = p.y - 3;
|
||||||
|
r.width = tw + 15 + 5 * 2;
|
||||||
|
r.height = th + 3 * 2;
|
||||||
|
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.x = 5 + tw / 2;
|
||||||
|
|
||||||
|
p.y += th / 2;
|
||||||
|
MwDrawText(handle, &p, menu->sub[i]->name, 1, MwALIGNMENT_CENTER, text);
|
||||||
|
|
||||||
|
if(arrlen(menu->sub[i]->sub) > 0) {
|
||||||
|
MwRect tr;
|
||||||
|
|
||||||
|
tr.x = p.x + tw / 2 + 5;
|
||||||
|
tr.y = p.y - th / 2 + 2;
|
||||||
|
tr.width = tr.height = 11;
|
||||||
|
|
||||||
|
MwDrawTriangle(handle, &tr, base, menu->sub[i]->wsub != NULL ? 1 : 0, MwEAST);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.y += th / 2 + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.x = 5 + tw / 2;
|
|
||||||
|
|
||||||
p.y += th / 2;
|
|
||||||
MwDrawText(handle, &p, menu->sub[i]->name, 1, MwALIGNMENT_CENTER, text);
|
|
||||||
|
|
||||||
if(arrlen(menu->sub[i]->sub) > 0) {
|
|
||||||
MwRect tr;
|
|
||||||
|
|
||||||
tr.x = p.x + tw / 2 + 5;
|
|
||||||
tr.y = p.y - th / 2 + 2;
|
|
||||||
tr.width = tr.height = 11;
|
|
||||||
|
|
||||||
MwDrawTriangle(handle, &tr, base, menu->sub[i]->wsub != NULL ? 1 : 0, MwEAST);
|
|
||||||
}
|
|
||||||
|
|
||||||
p.y += th / 2 + 3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,10 +185,14 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
|
|||||||
MwLLShow(handle->lowlevel, 1);
|
MwLLShow(handle->lowlevel, 1);
|
||||||
|
|
||||||
for(i = 0; i < arrlen(menu->sub); i++) {
|
for(i = 0; i < arrlen(menu->sub); i++) {
|
||||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
if(strcmp(menu->sub[i]->name, "----") == 0) {
|
||||||
h += MwTextHeight(handle, menu->sub[i]->name) + 3;
|
h += MwDefaultBorderWidth(handle) * 2 + 2;
|
||||||
if(tw > w) {
|
} else {
|
||||||
w = tw;
|
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||||
|
h += MwTextHeight(handle, menu->sub[i]->name) + 3;
|
||||||
|
if(tw > w) {
|
||||||
|
w = tw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user