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

Implementation of Amiga cookie viewer using core windows. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <proto/intuition.h>
#include <classes/window.h>
#include <gadgets/layout.h>
#include <gadgets/space.h>
#include <reaction/reaction_macros.h>
#include "desktop/cookie_manager.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "amiga/cookies.h"
#include "amiga/corewindow.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
#include "amiga/utf8.h"
Include dependency graph for cookies.c:

Go to the source code of this file.

Data Structures

struct  ami_cookie_window
 Amiga cookie viewer window context. More...
 

Enumerations

enum  {
  AMI_COOKIE_M_PROJECT = 0 , AMI_COOKIE_M_EXPAND , AMI_COOKIE_M_EXPAND_ALL , AMI_COOKIE_M_EXPAND_DOMAINS ,
  AMI_COOKIE_M_EXPAND_COOKIES , AMI_COOKIE_M_COLLAPSE , AMI_COOKIE_M_COLLAPSE_ALL , AMI_COOKIE_M_COLLAPSE_DOMAINS ,
  AMI_COOKIE_M_COLLAPSE_COOKIES , AMI_COOKIE_M_BAR_P1 , AMI_COOKIE_M_SNAPSHOT , AMI_COOKIE_M_BAR_P2 ,
  AMI_COOKIE_M_CLOSE , AMI_COOKIE_M_EDIT , AMI_COOKIE_M_SELECTALL , AMI_COOKIE_M_CLEAR ,
  AMI_COOKIE_M_BAR_E1 , AMI_COOKIE_M_DELETE , AMI_COOKIE_M_LAST
}
 

Functions

static void ami_cookies_menu_free (struct ami_cookie_window *cookie_win)
 
static void ami_cookies_destroy (struct ami_corewindow *ami_cw)
 destroy a previously created cookie view More...
 
static nserror ami_cookies_mouse (struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action for cookie viewer on core window More...
 
static nserror ami_cookies_key (struct ami_corewindow *ami_cw, uint32_t nskey)
 callback for keypress for cookies viewer on core window More...
 
static nserror ami_cookies_draw (struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
 callback on draw event for cookies viewer on core window More...
 
 HOOKF (void, ami_cookies_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
 menu stuff More...
 
 HOOKF (void, ami_cookies_menu_item_project_expand_domains, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_expand_cookies, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_collapse_domains, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_collapse_cookies, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_project_close, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
 
 HOOKF (void, ami_cookies_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
 
static void ami_cookies_menulabs (struct ami_menu_data **md)
 
static struct Menu * ami_cookies_menu_create (struct ami_cookie_window *cookie_win)
 
static nserror ami_cookies_create_window (struct ami_cookie_window *cookie_win)
 
nserror ami_cookies_present (const char *search_term)
 Open the cookie viewer. More...
 

Variables

static struct ami_cookie_windowcookie_window = NULL
 

Detailed Description

Implementation of Amiga cookie viewer using core windows.

Definition in file cookies.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AMI_COOKIE_M_PROJECT 
AMI_COOKIE_M_EXPAND 
AMI_COOKIE_M_EXPAND_ALL 
AMI_COOKIE_M_EXPAND_DOMAINS 
AMI_COOKIE_M_EXPAND_COOKIES 
AMI_COOKIE_M_COLLAPSE 
AMI_COOKIE_M_COLLAPSE_ALL 
AMI_COOKIE_M_COLLAPSE_DOMAINS 
AMI_COOKIE_M_COLLAPSE_COOKIES 
AMI_COOKIE_M_BAR_P1 
AMI_COOKIE_M_SNAPSHOT 
AMI_COOKIE_M_BAR_P2 
AMI_COOKIE_M_CLOSE 
AMI_COOKIE_M_EDIT 
AMI_COOKIE_M_SELECTALL 
AMI_COOKIE_M_CLEAR 
AMI_COOKIE_M_BAR_E1 
AMI_COOKIE_M_DELETE 
AMI_COOKIE_M_LAST 

Definition at line 49 of file cookies.c.

Function Documentation

◆ ami_cookies_create_window()

static nserror ami_cookies_create_window ( struct ami_cookie_window cookie_win)
static

Definition at line 291 of file cookies.c.

References ami_cookies_menu_create(), ami_gui_get_screen(), ami_gui_get_screen_title(), ami_gui_get_shared_msgport(), BVS_DISPLAY, ami_cookie_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_cookies_present().

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

◆ ami_cookies_destroy()

static void ami_cookies_destroy ( struct ami_corewindow ami_cw)
static

destroy a previously created cookie view

Definition at line 101 of file cookies.c.

References ami_cookies_menu_free(), ami_corewindow_fini(), cookie_manager_fini(), cookie_window, ami_cookie_window::core, and NSERROR_OK.

Referenced by ami_cookies_present().

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

◆ ami_cookies_draw()

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

callback on draw event for cookies viewer on core window

Parameters
ami_cwThe Amiga core window structure.
xThe x cordinate to plot at
yThe y cordinate to plot at
rThe rectangle of the window that needs updating.
ctxThe drawing context
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 163 of file cookies.c.

References cookie_manager_redraw(), and NSERROR_OK.

Referenced by ami_cookies_present().

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

◆ ami_cookies_key()

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

callback for keypress for cookies 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 144 of file cookies.c.

References cookie_manager_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.

Referenced by ami_cookies_present().

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

◆ ami_cookies_menu_create()

static struct Menu * ami_cookies_menu_create ( struct ami_cookie_window cookie_win)
static

Definition at line 280 of file cookies.c.

References AMI_COOKIE_M_LAST, ami_cookies_menulabs(), ami_menu_layout(), ami_cookie_window::imenu, and ami_cookie_window::menu_data.

Referenced by ami_cookies_create_window().

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

◆ ami_cookies_menu_free()

static void ami_cookies_menu_free ( struct ami_cookie_window cookie_win)
static

Definition at line 88 of file cookies.c.

References AMI_COOKIE_M_LAST, ami_menu_free_menu(), ami_cookie_window::core, GID_CW_WIN, ami_cookie_window::imenu, ami_cookie_window::menu_data, and ami_corewindow::objects.

Referenced by ami_cookies_destroy().

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

◆ ami_cookies_menulabs()

static void ami_cookies_menulabs ( struct ami_menu_data **  md)
static

Definition at line 243 of file cookies.c.

References AMI_COOKIE_M_BAR_E1, AMI_COOKIE_M_BAR_P1, AMI_COOKIE_M_BAR_P2, AMI_COOKIE_M_CLEAR, AMI_COOKIE_M_CLOSE, AMI_COOKIE_M_COLLAPSE, AMI_COOKIE_M_COLLAPSE_ALL, AMI_COOKIE_M_COLLAPSE_COOKIES, AMI_COOKIE_M_COLLAPSE_DOMAINS, AMI_COOKIE_M_DELETE, AMI_COOKIE_M_EDIT, AMI_COOKIE_M_EXPAND, AMI_COOKIE_M_EXPAND_ALL, AMI_COOKIE_M_EXPAND_COOKIES, AMI_COOKIE_M_EXPAND_DOMAINS, AMI_COOKIE_M_LAST, AMI_COOKIE_M_PROJECT, AMI_COOKIE_M_SELECTALL, AMI_COOKIE_M_SNAPSHOT, ami_menu_alloc_item(), and NSA_SPACE.

Referenced by ami_cookies_menu_create().

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

◆ ami_cookies_mouse()

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

callback for mouse action for cookie 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 127 of file cookies.c.

References cookie_manager_mouse_action(), and NSERROR_OK.

Referenced by ami_cookies_present().

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

◆ ami_cookies_present()

nserror ami_cookies_present ( const char *  search_term)

Open the cookie viewer.

Definition at line 348 of file cookies.c.

References ami_cookies_create_window(), ami_cookies_destroy(), ami_cookies_draw(), ami_cookies_key(), ami_cookies_mouse(), ami_corewindow_init(), ami_utf8_easy(), ami_utf8_free(), ami_corewindow::close, cookie_manager_init(), cookie_manager_set_search_string(), cookie_window, ami_cookie_window::core, ami_corewindow::draw, ami_corewindow::event, GID_CW_WIN, 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/11]

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

Definition at line 230 of file cookies.c.

References cookie_manager_keypress(), and NS_KEY_CLEAR_SELECTION.

Here is the call graph for this function:

◆ HOOKF() [2/11]

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

Definition at line 235 of file cookies.c.

References cookie_manager_keypress(), and NS_KEY_DELETE_LEFT.

Here is the call graph for this function:

◆ HOOKF() [3/11]

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

Definition at line 225 of file cookies.c.

References cookie_manager_keypress(), and NS_KEY_SELECT_ALL.

Here is the call graph for this function:

◆ HOOKF() [4/11]

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

Definition at line 217 of file cookies.c.

References ami_corewindow::close_window.

◆ HOOKF() [5/11]

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

Definition at line 191 of file cookies.c.

References cookie_manager_contract().

Here is the call graph for this function:

◆ HOOKF() [6/11]

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

Definition at line 201 of file cookies.c.

References cookie_manager_contract().

Here is the call graph for this function:

◆ HOOKF() [7/11]

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

Definition at line 196 of file cookies.c.

References cookie_manager_contract().

Here is the call graph for this function:

◆ HOOKF() [8/11]

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

menu stuff

Definition at line 176 of file cookies.c.

References cookie_manager_expand().

Here is the call graph for this function:

◆ HOOKF() [9/11]

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

Definition at line 186 of file cookies.c.

References cookie_manager_expand().

Here is the call graph for this function:

◆ HOOKF() [10/11]

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

Definition at line 181 of file cookies.c.

References cookie_manager_expand().

Here is the call graph for this function:

◆ HOOKF() [11/11]

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

Definition at line 206 of file cookies.c.

References nsoption_set_int, and ami_corewindow::win.

Variable Documentation

◆ cookie_window

struct ami_cookie_window* cookie_window = NULL
static

Definition at line 84 of file cookies.c.

Referenced by ami_cookies_destroy(), and ami_cookies_present().