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/stb");
|
||||
|
||||
const IDE = new pmake.ExecutableProject("midas");
|
||||
IDE.sources = fs.glob("src/*.c", "src/icon/*.c");
|
||||
IDE.includes = ["src", main.milsko + "/include"];
|
||||
IDE.libdirs = [main.milsko + "/src", main.milsko + "/lib"];
|
||||
IDE.libraries = ["stb", "ppr", "Mw"];
|
||||
const IDE = new pmake.ExecutableProject("midas");
|
||||
IDE.sources = fs.glob("src/*.c", "src/icon/*.c");
|
||||
IDE.includes = [ "src", main.milsko + "/include" ];
|
||||
IDE.libdirs = [ main.milsko + "/src", main.milsko + "/lib" ];
|
||||
IDE.libraries = [ "stb", "ppr", "Mw" ];
|
||||
|
||||
pmake.register(IDE);
|
||||
}
|
||||
main.milsko = "/usr/local";
|
||||
|
||||
(function(){
|
||||
opt = new pmake.Option("with-milsko=PATH");
|
||||
opt.category = "General";
|
||||
(function() {
|
||||
opt = new pmake.Option("with-milsko=PATH");
|
||||
opt.category = "General";
|
||||
opt.description = "Specify path to milsko";
|
||||
|
||||
opt.action = function(value){
|
||||
opt.action = function(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;
|
||||
|
||||
static MwMenu m_about_midas;
|
||||
|
||||
static void image_draw_inject(MwWidget handle) {
|
||||
char version[128];
|
||||
MwPoint p, p2;
|
||||
|
|
@ -32,13 +34,28 @@ static void image_draw_inject(MwWidget handle) {
|
|||
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) {
|
||||
int ww = MwGetInteger(window, MwNwidth);
|
||||
int wh = MwGetInteger(window, MwNheight);
|
||||
int x, y, w, h;
|
||||
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;
|
||||
wh -= MwGetInteger(menu, MwNheight) + padding * 2;
|
||||
|
|
@ -126,13 +143,11 @@ void gui_init(void) {
|
|||
MwNheight, h,
|
||||
NULL);
|
||||
|
||||
MwTimeSleep(50);
|
||||
resize(window, NULL, NULL);
|
||||
|
||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||
|
||||
resize(window, NULL, NULL);
|
||||
|
||||
gui_version();
|
||||
MwTimeSleep(50);
|
||||
}
|
||||
|
||||
static void version_ok_activate(MwWidget handle, void* user, void* client) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue