NetSurf
|
Implementation of Amiga hotlist 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/hotlist.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/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
Go to the source code of this file.
Data Structures | |
struct | ami_hotlist_window |
Amiga hotlist viewer window context. More... | |
struct | ami_hotlist_ctx |
Functions | |
static nserror | ami_hotlist_folder_enter_cb (void *ctx, const char *title) |
hotlist scanner More... | |
static nserror | ami_hotlist_address_cb (void *ctx, nsurl *url, const char *title) |
static nserror | ami_hotlist_folder_leave_cb (void *ctx) |
nserror | ami_hotlist_scan (void *userdata, int first_item, const char *folder, bool(*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder)) |
Scan the hotlist. More... | |
static nserror | ami_hotlist_mouse (struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y) |
callback for mouse action for hotlist viewer on core window More... | |
static nserror | ami_hotlist_key (struct ami_corewindow *ami_cw, uint32_t nskey) |
callback for keypress for hotlist viewer on core window More... | |
static nserror | ami_hotlist_draw (struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx) |
callback on draw event for hotlist viewer on core window More... | |
static nserror | ami_hotlist_drag_end (struct ami_corewindow *ami_cw, int x, int y) |
callback for drag end on Amiga core window ie. More... | |
static nserror | ami_hotlist_icon_drop (struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y) |
callback for icon drop on Amiga core window ie. More... | |
static void | ami_hotlist_menu_free (struct ami_hotlist_window *hotlist_win) |
menu stuff More... | |
HOOKF (void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_snapshot, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *) | |
HOOKF (void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *) | |
static void | ami_hotlist_menulabs (struct ami_menu_data **md) |
static struct Menu * | ami_hotlist_menu_create (struct ami_hotlist_window *hotlist_win) |
static nserror | ami_hotlist_create_window (struct ami_hotlist_window *hotlist_win) |
static void | ami_hotlist_destroy (struct ami_corewindow *ami_cw) |
destroy a previously created hotlist view More... | |
nserror | ami_hotlist_present (void) |
Open the hotlist viewer. More... | |
void | ami_hotlist_close (void) |
Close the hotlist viewer normally this shouldn't be used; only exists for ARexx use. More... | |
Variables | |
static struct ami_hotlist_window * | hotlist_window = NULL |
Implementation of Amiga hotlist viewer using core windows.
Definition in file hotlist.c.
anonymous enum |
Definition at line 127 of file hotlist.c.
References ami_hotlist_ctx::cb, ami_hotlist_ctx::in_menu, ami_hotlist_ctx::item, ami_hotlist_ctx::level, NSERROR_OK, and ami_hotlist_ctx::userdata.
Referenced by ami_hotlist_scan().
void ami_hotlist_close | ( | void | ) |
Close the hotlist viewer normally this shouldn't be used; only exists for ARexx use.
Definition at line 603 of file hotlist.c.
References ami_hotlist_destroy(), and hotlist_window.
Referenced by RXHOOKF().
|
static |
Definition at line 468 of file hotlist.c.
References ami_gui_get_screen(), ami_gui_get_screen_title(), ami_gui_get_shared_msgport(), ami_hotlist_menu_create(), BVS_DISPLAY, ami_hotlist_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_hotlist_present().
|
static |
destroy a previously created hotlist view
Definition at line 528 of file hotlist.c.
References ami_corewindow_fini(), ami_gui_hotlist_update_all(), ami_hotlist_menu_free(), ami_hotlist_window::core, hotlist_manager_fini(), hotlist_window, and NSERROR_OK.
Referenced by ami_hotlist_close(), and ami_hotlist_present().
|
static |
callback for drag end on Amiga core window ie.
a drag from this window has ended
ami_cw | The Amiga core window structure. |
x | mouse x co-ordinate |
y | mouse y co-ordinate |
Definition at line 241 of file hotlist.c.
References ami_gui2_get_browser_window(), ami_gui_beep(), ami_window_at_pointer(), AMINS_COREWINDOW, AMINS_WINDOW, browser_window_navigate(), BW_NAVIGATE_HISTORY, hotlist_get_selection(), hotlist_has_selection(), ami_corewindow::icon_drop, and NSERROR_OK.
Referenced by ami_hotlist_present().
|
static |
callback on draw event for hotlist viewer on core window
ami_cw | The Amiga core window structure. |
x | The x coordinate of hotlist area to redraw |
y | The y coordinate of hotlist area to redraw |
r | The rectangle of the window that needs updating. |
ctx | The drawing context |
Definition at line 223 of file hotlist.c.
References hotlist_redraw(), and NSERROR_OK.
Referenced by ami_hotlist_present().
|
static |
hotlist scanner
Definition at line 110 of file hotlist.c.
References ami_hotlist_ctx::cb, ami_hotlist_ctx::folder, ami_hotlist_ctx::found, ami_hotlist_ctx::in_menu, ami_hotlist_ctx::item, ami_hotlist_ctx::level, NSERROR_OK, and ami_hotlist_ctx::userdata.
Referenced by ami_hotlist_scan().
|
static |
Definition at line 139 of file hotlist.c.
References ami_hotlist_ctx::in_menu, ami_hotlist_ctx::level, and NSERROR_OK.
Referenced by ami_hotlist_scan().
|
static |
callback for icon drop on Amiga core window ie.
a drag has ended above this window
ami_cw | The Amiga core window structure. |
url | url of dropped icon |
title | title of dropped icon |
x | mouse x co-ordinate |
y | mouse y co-ordinate |
Definition at line 285 of file hotlist.c.
References hotlist_add_entry(), and NSERROR_OK.
Referenced by ami_hotlist_present().
|
static |
callback for keypress for hotlist viewer on core window
ami_cw | The Amiga core window structure. |
nskey | The netsurf key code |
Definition at line 204 of file hotlist.c.
References hotlist_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.
Referenced by ami_hotlist_present().
|
static |
Definition at line 457 of file hotlist.c.
References AMI_HOTLIST_M_LAST, ami_hotlist_menulabs(), ami_menu_layout(), ami_hotlist_window::imenu, and ami_hotlist_window::menu_data.
Referenced by ami_hotlist_create_window().
|
static |
menu stuff
Definition at line 296 of file hotlist.c.
References AMI_HOTLIST_M_LAST, ami_menu_free_menu(), ami_hotlist_window::core, GID_CW_WIN, ami_hotlist_window::imenu, ami_hotlist_window::menu_data, and ami_corewindow::objects.
Referenced by ami_hotlist_destroy().
|
static |
Definition at line 409 of file hotlist.c.
References AMI_HOTLIST_M_BAR_E1, AMI_HOTLIST_M_BAR_E2, AMI_HOTLIST_M_BAR_P1, AMI_HOTLIST_M_BAR_P2, AMI_HOTLIST_M_BAR_P3, AMI_HOTLIST_M_CLEAR, AMI_HOTLIST_M_CLOSE, AMI_HOTLIST_M_COLLAPSE, AMI_HOTLIST_M_COLLAPSE_ALL, AMI_HOTLIST_M_COLLAPSE_FOLDERS, AMI_HOTLIST_M_COLLAPSE_LINKS, AMI_HOTLIST_M_DELETE, AMI_HOTLIST_M_EDIT, AMI_HOTLIST_M_EDIT_EDIT, AMI_HOTLIST_M_EXPAND, AMI_HOTLIST_M_EXPAND_ALL, AMI_HOTLIST_M_EXPAND_FOLDERS, AMI_HOTLIST_M_EXPAND_LINKS, AMI_HOTLIST_M_EXPORT, AMI_HOTLIST_M_LAST, AMI_HOTLIST_M_NEWFOLDER, AMI_HOTLIST_M_NEWLINK, AMI_HOTLIST_M_PROJECT, AMI_HOTLIST_M_SELECTALL, AMI_HOTLIST_M_SNAPSHOT, ami_menu_alloc_item(), and NSA_SPACE.
Referenced by ami_hotlist_menu_create().
|
static |
callback for mouse action for hotlist viewer on core window
ami_cw | The Amiga core window structure. |
mouse_state | netsurf mouse state on event |
x | location of event |
y | location of event |
Definition at line 187 of file hotlist.c.
References hotlist_mouse_action(), and NSERROR_OK.
Referenced by ami_hotlist_present().
nserror ami_hotlist_present | ( | void | ) |
Open the hotlist viewer.
Definition at line 547 of file hotlist.c.
References ami_corewindow_init(), ami_hotlist_create_window(), ami_hotlist_destroy(), ami_hotlist_drag_end(), ami_hotlist_draw(), ami_hotlist_icon_drop(), ami_hotlist_key(), ami_hotlist_mouse(), ami_utf8_easy(), ami_utf8_free(), ami_corewindow::close, ami_hotlist_window::core, ami_corewindow::drag_end, ami_corewindow::draw, ami_corewindow::event, GID_CW_WIN, hotlist_manager_init(), hotlist_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(), and RXHOOKF().
nserror ami_hotlist_scan | ( | void * | userdata, |
int | first_item, | ||
const char * | folder, | ||
bool(*)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder) | cb_add_item | ||
) |
Scan the hotlist.
Definition at line 151 of file hotlist.c.
References ami_hotlist_address_cb(), ami_hotlist_folder_enter_cb(), ami_hotlist_folder_leave_cb(), ami_hotlist_ctx::cb, ami_hotlist_ctx::folder, ami_hotlist_ctx::found, hotlist_add_folder(), hotlist_iterate(), ami_hotlist_ctx::in_menu, ami_hotlist_ctx::item, ami_hotlist_ctx::level, NSERROR_OK, and ami_hotlist_ctx::userdata.
Referenced by ami_gui_hotlist_scan(), and ami_menu_scan().
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_clear | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 396 of file hotlist.c.
References hotlist_keypress(), and NS_KEY_CLEAR_SELECTION.
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_delete | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 401 of file hotlist.c.
References hotlist_keypress(), and NS_KEY_DELETE_LEFT.
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_edit | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 386 of file hotlist.c.
References hotlist_edit_selection().
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_newfolder | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 376 of file hotlist.c.
References hotlist_add_folder().
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_newlink | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 381 of file hotlist.c.
References hotlist_add_entry().
HOOKF | ( | void | , |
ami_hotlist_menu_item_edit_select_all | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 391 of file hotlist.c.
References hotlist_keypress(), and NS_KEY_SELECT_ALL.
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_close | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 368 of file hotlist.c.
References ami_corewindow::close_window.
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_collapse_all | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 342 of file hotlist.c.
References hotlist_contract().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_collapse_folders | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 347 of file hotlist.c.
References hotlist_contract().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_collapse_links | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 352 of file hotlist.c.
References hotlist_contract().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_expand_all | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 327 of file hotlist.c.
References hotlist_expand().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_expand_folders | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 332 of file hotlist.c.
References hotlist_expand().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_expand_links | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 337 of file hotlist.c.
References hotlist_expand().
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_export | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 306 of file hotlist.c.
References ami_gui_get_screen(), ami_update_pointer(), GUI_POINTER_DEFAULT, GUI_POINTER_WAIT, hotlist_export(), messages_get(), savereq, and ami_corewindow::win.
HOOKF | ( | void | , |
ami_hotlist_menu_item_project_snapshot | , | ||
APTR | , | ||
window | , | ||
struct IntuiMessage * | |||
) |
Definition at line 357 of file hotlist.c.
References nsoption_set_int, and ami_corewindow::win.
|
static |
Definition at line 97 of file hotlist.c.
Referenced by ami_hotlist_close(), ami_hotlist_destroy(), and ami_hotlist_present().