This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
magicka/utils/ccenter/main.c

129 lines
4.4 KiB
C
Raw Normal View History

2017-03-27 03:12:46 +00:00
#include <curses.h>
#include <cdk.h>
2017-03-27 05:07:58 +00:00
#include "ccenter.h"
2017-03-27 03:12:46 +00:00
CDKSCREEN *cdkscreen = 0;
void displayLabel() {
CDKLABEL *label;
char *message[] ={
" ,$.",
" `S$$$S'",
" .$²$. $$",
" `Sn. ' ` $$",
" $$s,sSSsSSSs ,sSSSs. ,4S$$Ss $$ $$$ ,sS$$Ss, $$ $$ ,sSSSs.",
" $$$² $$² $$ `' $$ $$' `$$. $$' $$' `4S $$ $$ `' $$",
" $$ )$ $$ ,$$$$$$ $$ .$$ $$ $$ $$$$ ,$$$$$$",
" $$ $$ $$ $$ $$ `$$$$$$$² $$, $$ ,sS $$ $$ $$ $$",
" $$' $$ `$$$$`SS $$, $$$ `4S$$SS' $$ $$ `$$$$`SS",
" `$$. ,sS$$$s`$$ $$. .,",
" `$Ss $$ $$ sS sS sS$s `$$, ,$$",
" `4$$$$$$$' $$$$. $$$$. $$, ²S$$$$S'",
" $$ $$ $$ $$ `$$",
" $$$$' $$$$' 4$$'"};
label = newCDKLabel(cdkscreen, COLS / 2 - 35, LINES / 2 - 7, message, 14, FALSE, FALSE);
drawCDKLabel(label, FALSE);
}
void displayAbout() {
CDKDIALOG *aboutWindow;
char *message[] = {"<C>Control Centre for MagickaBBS",
"<C>Copyright (c) 2017 Andrew Pamment"};
char *buttons[] = {"OK"};
aboutWindow = newCDKDialog(cdkscreen, 10, 5, message, 2, buttons, 1, 0, TRUE, TRUE, FALSE);
activateCDKDialog(aboutWindow, 0);
destroyCDKDialog(aboutWindow);
}
int main(int argc, char **argv) {
WINDOW *cursesWin = 0;
CDK_PARAMS params;
CDKMENU *mainMenu;
int selection;
int doexit = 0;
char *menuItems[MAX_MENU_ITEMS][MAX_SUB_ITEMS];
2017-03-28 09:47:41 +00:00
int menuLength[] = {2, 9, 2};
2017-03-27 03:12:46 +00:00
menuItems[0][0] = strdup("Main");
2017-03-28 09:47:41 +00:00
menuItems[0][1] = strdup("Exit");
menuItems[1][0] = strdup("Configuration");
menuItems[1][1] = strdup("System Config");
menuItems[1][2] = strdup("System Paths");
menuItems[1][3] = strdup("Mail Conferences");
menuItems[1][4] = strdup("File Directories");
menuItems[1][5] = strdup("Text Files");
menuItems[1][6] = strdup("Archivers");
menuItems[1][7] = strdup("Protocols");
menuItems[1][8] = strdup("Doors");
menuItems[2][0] = strdup("Misc");
menuItems[2][1] = strdup("About");
int locations[3] = {LEFT, LEFT, RIGHT};
2017-03-27 05:07:58 +00:00
CDKparseParams(argc, argv, &params, "c:" CDK_CLI_PARAMS);
if (!load_ini_file(CDKparamString (&params, 'c'))) {
fprintf(stderr, "Error opening ini file: %s\n", CDKparamString (&params, 'c'));
exit (-1);
}
2017-03-27 03:12:46 +00:00
cursesWin = initscr();
cdkscreen = initCDKScreen(cursesWin);
initCDKColor();
displayLabel();
2017-03-28 09:47:41 +00:00
mainMenu = newCDKMenu(cdkscreen, menuItems, 3, menuLength, locations, TOP, A_NORMAL, A_NORMAL);
2017-03-27 03:12:46 +00:00
setCDKMenuTitleHighlight(mainMenu, A_STANDOUT);
setCDKMenuSubTitleHighlight(mainMenu, A_STANDOUT);
while(!doexit) {
selection = activateCDKMenu(mainMenu, 0);
if (mainMenu->exitType == vESCAPE_HIT) {
doexit = 1;
} else if (mainMenu->exitType == vNORMAL) {
switch(selection / 100) {
case 0:
2017-03-28 09:47:41 +00:00
switch (selection % 100) {
case 5:
doexit = 1;
break;
}
break;
case 1:
2017-03-27 03:12:46 +00:00
switch (selection % 100) {
2017-03-27 05:07:58 +00:00
case 0:
system_config();
break;
2017-03-27 11:41:23 +00:00
case 1:
system_paths();
break;
case 2:
mail_conferences();
break;
2017-03-28 04:17:48 +00:00
case 3:
file_directories();
break;
2017-03-28 09:47:41 +00:00
case 4:
textfiles();
break;
default:
2017-03-27 03:12:46 +00:00
break;
}
break;
2017-03-28 09:47:41 +00:00
case 2:
2017-03-27 03:12:46 +00:00
switch (selection % 100) {
case 0:
displayAbout();
break;
}
break;
}
}
}
destroyCDKScreen(cdkscreen);
endCDK();
return 0;
}