Aggiustati dettagli estetici e cambiate funzioni di print varie
This commit is contained in:
1 parent
5508532619
commit
750f7a9149
6 files changed
+17
-13
No files matched your search
Binary file not shown.
+2
-2
@@ -15,6 +15,6 @@ void status(char *msg);
|
|||||||
WINDOW *create_newwin(int height, int width, int starty, int startx);
|
WINDOW *create_newwin(int height, int width, int starty, int startx);
|
||||||
void destroy_win(WINDOW *local_win);
|
void destroy_win(WINDOW *local_win);
|
||||||
void print_menu(WINDOW *menu_win, int y, int x, int highlight);
|
void print_menu(WINDOW *menu_win, int y, int x, int highlight);
|
||||||
void word_wrap_print(WINDOW *win, int start_y, int start_x, int max_width, const char *str);
|
void wwrap_print(WINDOW *win, int start_y, int start_x, const char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -5,7 +5,7 @@ SRC_DIR = src
|
|||||||
BUILD_DIR = build
|
BUILD_DIR = build
|
||||||
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
||||||
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES))
|
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES))
|
||||||
EXEC = newCounter
|
EXEC = productManager
|
||||||
|
|
||||||
DEPS = $(OBJECTS:.o=.d)
|
DEPS = $(OBJECTS:.o=.d)
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
|||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR) $(EXEC)
|
rm -rf $(BUILD_DIR) $(EXEC)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
+13
-9
@@ -33,14 +33,15 @@ int runMainMenu(){
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
keypad(mainWin, TRUE);
|
keypad(mainWin, TRUE);
|
||||||
mvwprintw(mainWin, 2, 2, "Usa le FRECCETTE ed INVIO per scegliere un'opzione!");
|
wwrap_print(mainWin, 1, 2, "Usa le FRECCETTE ed INVIO per scegliere un'opzione,\nin alternativa ci sono i movement di vim e SPAZIO.");
|
||||||
mvwprintw(mainWin, 3, 2, "In alternativa ci sono J e K con SPAZIO!");
|
|
||||||
refresh();
|
refresh();
|
||||||
print_menu(mainWin, 6, width / 2 - 10, highlight);
|
print_menu(mainWin, height / 2 - 3, width / 2 - 9, highlight);
|
||||||
while(1)
|
while(1)
|
||||||
{ c = wgetch(mainWin);
|
{ c = wgetch(mainWin);
|
||||||
switch(c)
|
switch(c)
|
||||||
{ case KEY_UP:
|
{ case KEY_UP:
|
||||||
|
case KEY_LEFT:
|
||||||
|
case 'h':
|
||||||
case 'k':
|
case 'k':
|
||||||
if(highlight == 1)
|
if(highlight == 1)
|
||||||
highlight = n_mainMenu;
|
highlight = n_mainMenu;
|
||||||
@@ -48,6 +49,8 @@ int runMainMenu(){
|
|||||||
--highlight;
|
--highlight;
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
|
case KEY_RIGHT:
|
||||||
|
case 'l':
|
||||||
case 'j':
|
case 'j':
|
||||||
if(highlight == n_mainMenu)
|
if(highlight == n_mainMenu)
|
||||||
highlight = 1;
|
highlight = 1;
|
||||||
@@ -63,7 +66,7 @@ int runMainMenu(){
|
|||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
print_menu(mainWin, 6, width / 2 - 10, highlight);
|
print_menu(mainWin, height / 2 - 3, width / 2 - 9, highlight);
|
||||||
if(choice != 0) /* User did a choice come out of the infinite loop */
|
if(choice != 0) /* User did a choice come out of the infinite loop */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -143,7 +146,7 @@ void warningf(const char *fmt, ...) {
|
|||||||
void warning(char *string){
|
void warning(char *string){
|
||||||
WINDOW *warningWin;
|
WINDOW *warningWin;
|
||||||
int startx, starty, width, height;
|
int startx, starty, width, height;
|
||||||
height = LINES / 2 - 3;
|
height = LINES / 2 - 2;
|
||||||
width = COLS / 2;
|
width = COLS / 2;
|
||||||
starty = LINES / 2;
|
starty = LINES / 2;
|
||||||
startx = 0;
|
startx = 0;
|
||||||
@@ -151,7 +154,7 @@ void warning(char *string){
|
|||||||
wbkgd(warningWin, COLOR_PAIR(1));
|
wbkgd(warningWin, COLOR_PAIR(1));
|
||||||
|
|
||||||
mvwprintw(warningWin, 2, 2, "ATTENZIONE!!! E' avvenuto un errore! ");
|
mvwprintw(warningWin, 2, 2, "ATTENZIONE!!! E' avvenuto un errore! ");
|
||||||
word_wrap_print(warningWin, 4, 3, width - 5, string);
|
wwrap_print(warningWin, 4, 3, string);
|
||||||
mvwprintw(warningWin, height - 1, width /2, " Premi un tasto per continuare . . . ");
|
mvwprintw(warningWin, height - 1, width /2, " Premi un tasto per continuare . . . ");
|
||||||
|
|
||||||
wrefresh(warningWin);
|
wrefresh(warningWin);
|
||||||
@@ -172,7 +175,7 @@ void statusf(const char *fmt, ...) {
|
|||||||
|
|
||||||
void status(char *msg) {
|
void status(char *msg) {
|
||||||
attron(COLOR_PAIR(3));
|
attron(COLOR_PAIR(3));
|
||||||
mvprintw(LINES -2, 0, " %-*s", COLS -1, msg);
|
mvprintw(LINES -2, 0, "%-*s", COLS, msg);
|
||||||
attroff(COLOR_PAIR(3));
|
attroff(COLOR_PAIR(3));
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@@ -190,7 +193,7 @@ WINDOW *create_newwin(int height, int width, int starty, int startx)
|
|||||||
|
|
||||||
void destroy_win(WINDOW *local_win)
|
void destroy_win(WINDOW *local_win)
|
||||||
{
|
{
|
||||||
wborder(local_win, ':', ':', '.', '.', ' ', ' ', ' ', ' ');
|
wborder(local_win, ':', ':', '.', '.', '.', '.', '.', '.');
|
||||||
wrefresh(local_win);
|
wrefresh(local_win);
|
||||||
delwin(local_win);
|
delwin(local_win);
|
||||||
}
|
}
|
||||||
@@ -212,7 +215,8 @@ void print_menu(WINDOW *menu_win, int y, int x, int highlight)
|
|||||||
wrefresh(menu_win);
|
wrefresh(menu_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void word_wrap_print(WINDOW *win, int start_y, int start_x, int max_width, const char *str) {
|
void wwrap_print(WINDOW *win, int start_y, int start_x, const char *str) {
|
||||||
|
int max_width = getmaxx(win) - (start_y + 1);
|
||||||
int y = start_y;
|
int y = start_y;
|
||||||
int x = start_x;
|
int x = start_x;
|
||||||
int line_length = 0;
|
int line_length = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user