/* add an entry to the history list */
void packet_history_add(gint row) {

    if(row < 1) {
        /* Not a valid row number */
        return;
    }

    if(ignore_jump) {
        /* we jumping back and forward in history, so don't change list */
        return;
    }

    if (history_current) {
        /* clear list behind current position */
        clear_list(g_list_next(history_current));

        /* ignore duplicates */
        if(GPOINTER_TO_INT(history_current->data) == row) {
            adjust_menus();
            return;
        }
    }

    /* add row */
    history_list = g_list_append(history_list, GINT_TO_POINTER(row));
    history_current = g_list_last(history_list);

    adjust_menus();
}
void packet_history_clear(void) {

    /* clear "old" list */
    clear_list(history_list);
    history_current = NULL;

    /* add the currently selected first row */
    packet_history_add(0);

    adjust_menus();
}
static void packet_history_forward(void) {
    GList *next;

    if(history_current) {
        next = g_list_next(history_current);

        /* do we have a forward entry? */
        if(next) {
            history_current = next;

            /* goto that packet but don't change history */
            ignore_jump = TRUE;
            cf_goto_frame(&cfile, GPOINTER_TO_INT(next->data));
            ignore_jump = FALSE;
        }
    }

    adjust_menus();
}
static void packet_history_back(void) {
    GList *previous;

    if(history_current) {
        previous = g_list_previous(history_current);

        /* do we have a previous entry */
        if(previous) {
            history_current = previous;

            /* goto that packet but don't change history */
            ignore_jump = TRUE;
            cf_goto_frame(&cfile, GPOINTER_TO_INT(previous->data));
            ignore_jump = FALSE;
        }
    }

    adjust_menus();
}
Exemple #5
0
void do_menu_command(
	long menuResult) 
{
	short menuID;
	short menuItem;

	menuID= GET_MENU_ID(menuResult);
	menuItem= GET_MENU_ITEM(menuResult);
	
	switch (menuID) 
	{
		case mApple:
			switch (menuItem) 
			{
				case iAbout:
					break;
				default:
#if defined(OP_PLATFORM_MAC_CFM) && !defined(OP_PLATFORM_MAC_CARBON_FLAG)
					{
						Str255 daName;
						
						GetMenuItemText(GetMenuHandle(mApple), menuItem, daName);
						OpenDeskAcc(daName);
					}
#endif
					break;
			}
			break;

		case mFile:
			switch (menuItem) 
			{
				case iOpen:
				case iOpenPassive:
					handle_open(menuItem==iOpen, false);
					break;
					
				case iOpenActiveUI:
				case iOpenPassiveUI:
					handle_open(menuItem==iOpenActiveUI, true);
					break;
					
				case iClose:
					close_front_window();
					break;
					
				case iQuit:
					handle_quit();
					break;
			}
			break;
			
		case mSpecial:
			switch(menuItem)
			{
				case iSendPacket:
					send_packet();
					break;
				
				case iSendStream:
					send_stream();
					break;
					
				case iProtocolAlive:
					is_alive();
					break;
					
				case iAcceptingConnections:
					accepting_connections= !accepting_connections;
					check_menu_item(menuID, menuItem, accepting_connections);
					break;

				case iActiveEnumeration:
					active_enumeration= !active_enumeration;
					check_menu_item(menuID, menuItem, active_enumeration);
					break;
					
				case iSetTimeout:
					set_timeout();
					break;
					
				case iGetInfo:
					report_info();
					break;
					
				case iGetConfigString:
//					get_config_string();
					break;
			}
			break;
			
		case mWindowMenu:
			switch(menuItem)
			{
				case iCascade:
				case iTile:
					cascade_or_tile_windows(menuItem==iCascade);
					break;
			}
	}
#if OP_PLATFORM_MAC_CFM || OP_PLATFORM_MAC_MACHO
	HiliteMenu(0);
#endif
	adjust_menus();

	return;
}