Пример #1
0
void help(char *command)
{
         if(!command) help_ls();
    else if(!strcmp(command, "help"          )) help_help();
    else if(!strcmp(command, "prompt"        )) help_prompt();
    else if(!strcmp(command, "init"          )) help_init();
    else if(!strcmp(command, "drop"          )) help_drop();
    else if(!strcmp(command, "create-service")) help_create_service();
    else if(!strcmp(command, "list"          )) help_list();
    else if(!strcmp(command, "switch"        )) help_switch();
    else if(!strcmp(command, "back"          )) help_back();
    else if(!strcmp(command, "book"          )) help_book();
    else if(!strcmp(command, "service"       )) help_service();
    else if(!strcmp(command, "bill"          )) help_bill();
    else if(!strcmp(command, "checkout"      )) help_checkout();
    else error_print("Unknown command!");
}
Пример #2
0
static cb_ret_t
help_execute_cmd (unsigned long command)
{
    cb_ret_t ret = MSG_HANDLED;

    switch (command)
    {
    case CK_Help:
        help_help (whelp);
        break;
    case CK_Index:
        help_index (whelp);
        break;
    case CK_Back:
        help_back (whelp);
        break;
    case CK_Up:
        help_prev_link (TRUE);
        break;
    case CK_Down:
        help_next_link (TRUE);
        break;
    case CK_PageDown:
        move_forward (help_lines - 1);
        break;
    case CK_PageUp:
        move_backward (help_lines - 1);
        break;
    case CK_HalfPageDown:
        move_forward (help_lines / 2);
        break;
    case CK_HalfPageUp:
        move_backward (help_lines / 2);
        break;
    case CK_Top:
        move_to_top ();
        break;
    case CK_Bottom:
        move_to_bottom ();
        break;
    case CK_Enter:
        help_select_link ();
        break;
    case CK_LinkNext:
        help_next_link (FALSE);
        break;
    case CK_LinkPrev:
        help_prev_link (FALSE);
        break;
    case CK_NodeNext:
        help_next_node ();
        break;
    case CK_NodePrev:
        help_prev_node ();
        break;
    case CK_Quit:
        dlg_stop (whelp);
        break;
    default:
        ret = MSG_NOT_HANDLED;
    }

    return ret;
}
Пример #3
0
static void
help_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event)
{
    int x, y;
    GSList *current_area;

    if (msg != MSG_MOUSE_CLICK)
        return;

    if ((event->buttons & GPM_B_RIGHT) != 0)
    {
        /* Right button click */
        help_back (whelp);
        return;
    }

    /* Left bytton click */

    /* The event is relative to the dialog window, adjust it: */
    x = event->x - 1;
    y = event->y - 1;

    /* Test whether the mouse click is inside one of the link areas */
    for (current_area = link_area; current_area != NULL; current_area = g_slist_next (current_area))
    {
        Link_Area *la = (Link_Area *) current_area->data;

        /* Test one line link area */
        if (y == la->y1 && x >= la->x1 && y == la->y2 && x <= la->x2)
            break;

        /* Test two line link area */
        if (la->y1 + 1 == la->y2)
        {
            /* The first line || The second line */
            if ((y == la->y1 && x >= la->x1) || (y == la->y2 && x <= la->x2))
                break;
        }
        /* Mouse will not work with link areas of more than two lines */
    }

    /* Test whether a link area was found */
    if (current_area != NULL)
    {
        Link_Area *la = (Link_Area *) current_area->data;

        /* The click was inside a link area -> follow the link */
        history_ptr = (history_ptr + 1) % HISTORY_SIZE;
        history[history_ptr].page = currentpoint;
        history[history_ptr].link = la->link_name;
        currentpoint = help_follow_link (currentpoint, la->link_name);
        selected_item = NULL;
    }
    else if (y < 0)
        move_backward (help_lines - 1);
    else if (y >= help_lines)
        move_forward (help_lines - 1);
    else if (y < help_lines / 2)
        move_backward (1);
    else
        move_forward (1);

    /* Show the new node */
    send_message (w->owner, NULL, MSG_DRAW, 0, NULL);
}