NetSurf
Data Structures | Enumerations | Functions | Variables
history.c File Reference

Implementation of Amiga global history viewer using core windows. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <proto/asl.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <classes/window.h>
#include <gadgets/layout.h>
#include <gadgets/space.h>
#include <reaction/reaction_macros.h>
#include "desktop/global_history.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/history.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
Include dependency graph for history.c:

Go to the source code of this file.

Data Structures

struct  ami_history_global_window
 Amiga history viewer window context. More...
 

Enumerations

enum  {
  AMI_HISTORY_M_PROJECT = 0 , AMI_HISTORY_M_EXPORT , AMI_HISTORY_M_BAR_P1 , AMI_HISTORY_M_EXPAND ,
  AMI_HISTORY_M_EXPAND_ALL , AMI_HISTORY_M_EXPAND_FOLDERS , AMI_HISTORY_M_EXPAND_LINKS , AMI_HISTORY_M_COLLAPSE ,
  AMI_HISTORY_M_COLLAPSE_ALL , AMI_HISTORY_M_COLLAPSE_FOLDERS , AMI_HISTORY_M_COLLAPSE_LINKS , AMI_HISTORY_M_BAR_P2 ,
  AMI_HISTORY_M_SNAPSHOT , AMI_HISTORY_M_BAR_P3 , AMI_HISTORY_M_CLOSE , AMI_HISTORY_M_EDIT ,
  AMI_HISTORY_M_SELECTALL , AMI_HISTORY_M_CLEAR , AMI_HISTORY_M_BAR_E1 , AMI_HISTORY_M_DELETE ,
  AMI_HISTORY_M_LAST
}
 

Functions

static void ami_history_global_menu_free (struct ami_history_global_window *history_win)
 
static void ami_history_global_destroy (struct ami_corewindow *ami_cw)
 destroy a previously created history view More...
 
static nserror ami_history_global_mouse (struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action for history viewer on core window More...
 
static nserror ami_history_global_key (struct ami_corewindow *ami_cw, uint32_t nskey)
 callback for keypress for history viewer on core window More...
 
static nserror ami_history_global_draw (struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
 callback on draw event for history viewer on core window More...
 
static nserror ami_history_global_drag_end (struct ami_corewindow *ami_cw, int x, int y)
 callback on drag end for history viewer More...
 
 HOOKF (void, ami_history_global_menu_item_project_export, APTR, window, struct IntuiMessage *)
 menu stuff More...
 
 HOOKF (void, ami_history_global_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_project_close, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_history_global_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
 
static void ami_history_global_menulabs (struct ami_menu_data **md)
 
static struct Menu * ami_history_global_menu_create (struct ami_history_global_window *history_win)
 
static nserror ami_history_global_create_window (struct ami_history_global_window *history_win)
 
nserror ami_history_global_present (void)
 Open the global history viewer. More...
 

Variables

static struct ami_history_global_windowhistory_window = NULL
 

Detailed Description

Implementation of Amiga global history viewer using core windows.

Definition in file history.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AMI_HISTORY_M_PROJECT 
AMI_HISTORY_M_EXPORT 
AMI_HISTORY_M_BAR_P1 
AMI_HISTORY_M_EXPAND 
AMI_HISTORY_M_EXPAND_ALL 
AMI_HISTORY_M_EXPAND_FOLDERS 
AMI_HISTORY_M_EXPAND_LINKS 
AMI_HISTORY_M_COLLAPSE 
AMI_HISTORY_M_COLLAPSE_ALL 
AMI_HISTORY_M_COLLAPSE_FOLDERS 
AMI_HISTORY_M_COLLAPSE_LINKS 
AMI_HISTORY_M_BAR_P2 
AMI_HISTORY_M_SNAPSHOT 
AMI_HISTORY_M_BAR_P3 
AMI_HISTORY_M_CLOSE 
AMI_HISTORY_M_EDIT 
AMI_HISTORY_M_SELECTALL 
AMI_HISTORY_M_CLEAR 
AMI_HISTORY_M_BAR_E1 
AMI_HISTORY_M_DELETE 
AMI_HISTORY_M_LAST 

Definition at line 56 of file history.c.

Function Documentation

◆ ami_history_global_create_window()

static nserror ami_history_global_create_window ( struct ami_history_global_window history_win)
static

Definition at line 365 of file history.c.

References ami_gui_get_screen(), ami_gui_get_screen_title(), ami_gui_get_shared_msgport(), ami_history_global_menu_create(), BVS_DISPLAY, ami_history_global_window::core, GID_CW_DRAW, GID_CW_MAIN, GID_CW_WIN, IDCMP_EXTENDEDMOUSE, ami_corewindow::idcmp_hook, LayoutVObj, NSERROR_NOMEM, NSERROR_OK, nsoption_bool, nsoption_int, ami_corewindow::objects, SpaceObj, WindowObj, and ami_corewindow::wintitle.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_destroy()

static void ami_history_global_destroy ( struct ami_corewindow ami_cw)
static

destroy a previously created history view

Definition at line 110 of file history.c.

References ami_corewindow_fini(), ami_history_global_menu_free(), ami_history_global_window::core, global_history_fini(), history_window, and NSERROR_OK.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_drag_end()

static nserror ami_history_global_drag_end ( struct ami_corewindow ami_cw,
int  x,
int  y 
)
static

callback on drag end for history viewer

Parameters
ami_cwThe Amiga core window structure.
xmouse x co-ordinate
ymouse y co-ordinate
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 190 of file history.c.

References ami_gui2_get_browser_window(), ami_gui_beep(), ami_window_at_pointer(), AMINS_COREWINDOW, AMINS_WINDOW, browser_window_navigate(), BW_NAVIGATE_HISTORY, global_history_get_selection(), global_history_has_selection(), ami_corewindow::icon_drop, and NSERROR_OK.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_draw()

static nserror ami_history_global_draw ( struct ami_corewindow ami_cw,
int  x,
int  y,
struct rect r,
struct redraw_context ctx 
)
static

callback on draw event for history viewer on core window

Parameters
ami_cwThe Amiga core window structure.
xThe x coordinate of global history area to redraw
yThe y coordinate of global history area to redraw
rThe rectangle of the window that needs updating.
ctxThe drawing context
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 172 of file history.c.

References global_history_redraw(), and NSERROR_OK.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_key()

static nserror ami_history_global_key ( struct ami_corewindow ami_cw,
uint32_t  nskey 
)
static

callback for keypress for history viewer on core window

Parameters
ami_cwThe Amiga core window structure.
nskeyThe netsurf key code
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 153 of file history.c.

References global_history_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_menu_create()

static struct Menu * ami_history_global_menu_create ( struct ami_history_global_window history_win)
static

Definition at line 354 of file history.c.

References ami_history_global_menulabs(), AMI_HISTORY_M_LAST, ami_menu_layout(), ami_history_global_window::imenu, and ami_history_global_window::menu_data.

Referenced by ami_history_global_create_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_menu_free()

static void ami_history_global_menu_free ( struct ami_history_global_window history_win)
static

Definition at line 97 of file history.c.

References AMI_HISTORY_M_LAST, ami_menu_free_menu(), ami_history_global_window::core, GID_CW_WIN, ami_history_global_window::imenu, ami_history_global_window::menu_data, and ami_corewindow::objects.

Referenced by ami_history_global_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_menulabs()

static void ami_history_global_menulabs ( struct ami_menu_data **  md)
static

Definition at line 314 of file history.c.

References AMI_HISTORY_M_BAR_E1, AMI_HISTORY_M_BAR_P1, AMI_HISTORY_M_BAR_P2, AMI_HISTORY_M_BAR_P3, AMI_HISTORY_M_CLEAR, AMI_HISTORY_M_CLOSE, AMI_HISTORY_M_COLLAPSE, AMI_HISTORY_M_COLLAPSE_ALL, AMI_HISTORY_M_COLLAPSE_FOLDERS, AMI_HISTORY_M_COLLAPSE_LINKS, AMI_HISTORY_M_DELETE, AMI_HISTORY_M_EDIT, AMI_HISTORY_M_EXPAND, AMI_HISTORY_M_EXPAND_ALL, AMI_HISTORY_M_EXPAND_FOLDERS, AMI_HISTORY_M_EXPAND_LINKS, AMI_HISTORY_M_EXPORT, AMI_HISTORY_M_LAST, AMI_HISTORY_M_PROJECT, AMI_HISTORY_M_SELECTALL, AMI_HISTORY_M_SNAPSHOT, ami_menu_alloc_item(), and NSA_SPACE.

Referenced by ami_history_global_menu_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_mouse()

static nserror ami_history_global_mouse ( struct ami_corewindow ami_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse action for history viewer on core window

Parameters
ami_cwThe Amiga core window structure.
mouse_statenetsurf mouse state on event
xlocation of event
ylocation of event
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 136 of file history.c.

References global_history_mouse_action(), and NSERROR_OK.

Referenced by ami_history_global_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_history_global_present()

nserror ami_history_global_present ( void  )

Open the global history viewer.

Definition at line 422 of file history.c.

References ami_corewindow_init(), ami_history_global_create_window(), ami_history_global_destroy(), ami_history_global_drag_end(), ami_history_global_draw(), ami_history_global_key(), ami_history_global_mouse(), ami_utf8_easy(), ami_utf8_free(), ami_corewindow::close, ami_history_global_window::core, ami_corewindow::drag_end, ami_corewindow::draw, ami_corewindow::event, GID_CW_WIN, global_history_init(), history_window, ami_corewindow::icon_drop, ami_corewindow::key, messages_get(), ami_corewindow::mouse, NSERROR_NOMEM, NSERROR_OK, NSLOG, ami_corewindow::objects, and ami_corewindow::wintitle.

Referenced by HOOKF().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HOOKF() [1/12]

HOOKF ( void  ,
ami_history_global_menu_item_edit_clear  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 301 of file history.c.

References global_history_keypress(), and NS_KEY_CLEAR_SELECTION.

Here is the call graph for this function:

◆ HOOKF() [2/12]

HOOKF ( void  ,
ami_history_global_menu_item_edit_delete  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 306 of file history.c.

References global_history_keypress(), and NS_KEY_DELETE_LEFT.

Here is the call graph for this function:

◆ HOOKF() [3/12]

HOOKF ( void  ,
ami_history_global_menu_item_edit_select_all  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 296 of file history.c.

References global_history_keypress(), and NS_KEY_SELECT_ALL.

Here is the call graph for this function:

◆ HOOKF() [4/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_close  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 288 of file history.c.

References ami_corewindow::close_window.

◆ HOOKF() [5/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_collapse_all  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 262 of file history.c.

References global_history_contract().

Here is the call graph for this function:

◆ HOOKF() [6/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_collapse_folders  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 267 of file history.c.

References global_history_contract().

Here is the call graph for this function:

◆ HOOKF() [7/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_collapse_links  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 272 of file history.c.

References global_history_contract().

Here is the call graph for this function:

◆ HOOKF() [8/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_expand_all  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 247 of file history.c.

References global_history_expand().

Here is the call graph for this function:

◆ HOOKF() [9/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_expand_folders  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 252 of file history.c.

References global_history_expand().

Here is the call graph for this function:

◆ HOOKF() [10/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_expand_links  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 257 of file history.c.

References global_history_expand().

Here is the call graph for this function:

◆ HOOKF() [11/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_export  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

menu stuff

Definition at line 226 of file history.c.

References ami_gui_get_screen(), ami_update_pointer(), global_history_export(), GUI_POINTER_DEFAULT, GUI_POINTER_WAIT, messages_get(), savereq, and ami_corewindow::win.

Here is the call graph for this function:

◆ HOOKF() [12/12]

HOOKF ( void  ,
ami_history_global_menu_item_project_snapshot  ,
APTR  ,
window  ,
struct IntuiMessage *   
)

Definition at line 277 of file history.c.

References nsoption_set_int, and ami_corewindow::win.

Variable Documentation

◆ history_window

struct ami_history_global_window* history_window = NULL
static

Definition at line 93 of file history.c.

Referenced by ami_history_global_destroy(), and ami_history_global_present().