menu
This commit is contained in:
parent
7d96c216bd
commit
fd1ff59a14
3 changed files with 54 additions and 15 deletions
24
.clang-format
Normal file
24
.clang-format
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
UseTab: Always
|
||||||
|
TabWidth: 8
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: true
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: true
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
NamespaceIndentation: All
|
||||||
|
IndentWidth: 8
|
||||||
|
PointerAlignment: Left
|
||||||
|
ColumnLimit: 0
|
||||||
|
AllowShortIfStatementsOnASingleLine: Always
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: true
|
||||||
|
SpaceBeforeParens: Never
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
SortIncludes: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
#IndentPPDirectives: AfterHash
|
||||||
20
pmake.js
20
pmake.js
|
|
@ -1,23 +1,23 @@
|
||||||
function main(){
|
function main() {
|
||||||
pmake.subdirectory("external/ppr");
|
pmake.subdirectory("external/ppr");
|
||||||
pmake.subdirectory("external/stb");
|
pmake.subdirectory("external/stb");
|
||||||
|
|
||||||
const IDE = new pmake.ExecutableProject("midas");
|
const IDE = new pmake.ExecutableProject("midas");
|
||||||
IDE.sources = fs.glob("src/*.c", "src/icon/*.c");
|
IDE.sources = fs.glob("src/*.c", "src/icon/*.c");
|
||||||
IDE.includes = ["src", main.milsko + "/include"];
|
IDE.includes = [ "src", main.milsko + "/include" ];
|
||||||
IDE.libdirs = [main.milsko + "/src", main.milsko + "/lib"];
|
IDE.libdirs = [ main.milsko + "/src", main.milsko + "/lib" ];
|
||||||
IDE.libraries = ["stb", "ppr", "Mw"];
|
IDE.libraries = [ "stb", "ppr", "Mw" ];
|
||||||
|
|
||||||
pmake.register(IDE);
|
pmake.register(IDE);
|
||||||
}
|
}
|
||||||
main.milsko = "/usr/local";
|
main.milsko = "/usr/local";
|
||||||
|
|
||||||
(function(){
|
(function() {
|
||||||
opt = new pmake.Option("with-milsko=PATH");
|
opt = new pmake.Option("with-milsko=PATH");
|
||||||
opt.category = "General";
|
opt.category = "General";
|
||||||
opt.description = "Specify path to milsko";
|
opt.description = "Specify path to milsko";
|
||||||
|
|
||||||
opt.action = function(value){
|
opt.action = function(value) {
|
||||||
main.milsko = value;
|
main.milsko = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
25
src/gui.c
25
src/gui.c
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
MwWidget window, menu = NULL, fileview = NULL, editor = NULL, console = NULL;
|
MwWidget window, menu = NULL, fileview = NULL, editor = NULL, console = NULL;
|
||||||
|
|
||||||
|
static MwMenu m_about_midas;
|
||||||
|
|
||||||
static void image_draw_inject(MwWidget handle) {
|
static void image_draw_inject(MwWidget handle) {
|
||||||
char version[128];
|
char version[128];
|
||||||
MwPoint p, p2;
|
MwPoint p, p2;
|
||||||
|
|
@ -32,13 +34,28 @@ static void image_draw_inject(MwWidget handle) {
|
||||||
MwLLFreeColor(c);
|
MwLLFreeColor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void menu_handler(MwWidget handle, void* user, void* client) {
|
||||||
|
if(client == m_about_midas) {
|
||||||
|
gui_version();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void MWAPI resize(MwWidget handle, void* user, void* client) {
|
static void MWAPI resize(MwWidget handle, void* user, void* client) {
|
||||||
int ww = MwGetInteger(window, MwNwidth);
|
int ww = MwGetInteger(window, MwNwidth);
|
||||||
int wh = MwGetInteger(window, MwNheight);
|
int wh = MwGetInteger(window, MwNheight);
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int padding = 5;
|
int padding = 5;
|
||||||
|
|
||||||
if(menu == NULL) menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
|
if(menu == NULL) {
|
||||||
|
MwMenu m;
|
||||||
|
|
||||||
|
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
m = MwMenuAdd(menu, NULL, "?Help");
|
||||||
|
m_about_midas = MwMenuAdd(menu, m, "About Midas");
|
||||||
|
|
||||||
|
MwAddUserHandler(menu, MwNmenuHandler, menu_handler, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ww -= padding * 2;
|
ww -= padding * 2;
|
||||||
wh -= MwGetInteger(menu, MwNheight) + padding * 2;
|
wh -= MwGetInteger(menu, MwNheight) + padding * 2;
|
||||||
|
|
@ -126,13 +143,11 @@ void gui_init(void) {
|
||||||
MwNheight, h,
|
MwNheight, h,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwTimeSleep(50);
|
resize(window, NULL, NULL);
|
||||||
|
|
||||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||||
|
|
||||||
resize(window, NULL, NULL);
|
MwTimeSleep(50);
|
||||||
|
|
||||||
gui_version();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void version_ok_activate(MwWidget handle, void* user, void* client) {
|
static void version_ok_activate(MwWidget handle, void* user, void* client) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue