]> git.deb.at Git - pkg/abook.git/blobdiff - edit.c
merged newtabstyle.diff
[pkg/abook.git] / edit.c
diff --git a/edit.c b/edit.c
index 9403975263bc1520a48031cc81eb0f1b2e943d9b..67a8e2d7bd88e59a319a1656169b462dfee9e80e 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -37,18 +37,29 @@ editor_tab(int tab)
 {
        int i;
        char *tab_names[] = {
-               "/ CONTACT \\",
-               "/ ADDRESS \\",
-               "/  PHONE  \\",
-               "/  OTHER  \\"
+               " CONTACT ",
+               " ADDRESS ",
+               "  PHONE  ",
+               "  OTHER  "
        };
 
        mvwhline(editw, TABLINE+1, 0, UI_HLINE_CHAR, EDITW_COLS);
+       for(i=0; i < TABS; i++) {
+               mvwaddch(editw,  TABLINE+1, 16 * i + 2,  UI_TEE_CHAR);
+               mvwaddch(editw,  TABLINE+1, 16 * i + 14, UI_TEE_CHAR);
+       }
 
-       for(i=0; i < TABS; i++)
-               mvwaddstr(editw, TABLINE, 16 * i + 3, tab_names[i]);
+       for(i=0; i < TABS; i++) {
+               mvwaddch(editw,  TABLINE, 16 * i + 2,  UI_ULCORNER_CHAR);
+               mvwaddch(editw,  TABLINE, 16 * i + 3,  UI_LBOXLINE_CHAR);
+               mvwaddstr(editw, TABLINE, 16 * i + 4,  tab_names[i]);
+               mvwaddch(editw,  TABLINE, 16 * i + 13, UI_RBOXLINE_CHAR);
+               mvwaddch(editw,  TABLINE, 16 * i + 14, UI_URCORNER_CHAR);
+       }
 
-       mvwaddstr(editw, TABLINE+1, 16 * tab + 2, "/           \\");
+       mvwaddch(editw,  TABLINE+1, 16 * tab + 2, UI_LRCORNER_CHAR);
+       mvwaddstr(editw, TABLINE+1, 16 * tab + 3, "           ");
+       mvwaddch(editw,  TABLINE+1, 16 * tab + 14, UI_LLCORNER_CHAR);
 }
 
 void
@@ -182,6 +193,21 @@ editor_print_data(int tab, int item)
        }
 }
 
+/*
+ * function: change_field
+ *
+ * parameters:
+ *  (char *msg)
+ *   message to display as a prompt
+ *  (char **field)
+ *   a pointer to a pointer which will point a new string. if the latter
+ *   pointer != NULL it will be freed (if user doesn't cancel)
+ *
+ * returns (int)
+ *  a nonzero value if user has cancelled and zero if user has typed a
+ *  valid string
+ */
+
 static int
 change_field(char *msg, char **field)
 {
@@ -246,12 +272,9 @@ edit_emails(char c, int item)
        split_emailstr(item, emails);
        field = strdup(emails[email_num]);
 
-       if(change_field("E-mail: ", &field)) {
-#ifdef DEBUG
-               fprintf(stderr, "change_field = TRUE\n");
-#endif
-               return;
-       }
+       if(change_field("E-mail: ", &field))
+               return; /* user cancelled ( C-g ) */
+
        if(field) {
                strncpy(emails[email_num], field, MAX_EMAIL_LEN);
                fix_email_str(emails[email_num]);