mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-22 09:24:15 +03:00
Remove bulk of old treeview implementation.
This commit is contained in:
parent
46e569c481
commit
49c7994d05
@ -579,8 +579,6 @@ static nserror ami_set_options(struct nsoption_s *defaults)
|
||||
}
|
||||
}
|
||||
|
||||
tree_set_icon_dir(strdup("ENV:Sys"));
|
||||
|
||||
#ifndef __amigaos4__
|
||||
nsoption_set_bool(download_notify, false);
|
||||
nsoption_set_bool(context_menu, false);
|
||||
|
@ -665,7 +665,6 @@ void ami_tree_open(struct treeview_window *twin,int type)
|
||||
|
||||
ami_tree_update_buttons(twin);
|
||||
ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
|
||||
tree_set_redraw(twin->tree, true);
|
||||
ami_tree_draw(twin);
|
||||
}
|
||||
|
||||
@ -673,7 +672,6 @@ void ami_tree_close(struct treeview_window *twin)
|
||||
{
|
||||
int i;
|
||||
|
||||
tree_set_redraw(twin->tree, false);
|
||||
twin->win = NULL;
|
||||
DisposeObject(twin->objects[OID_MAIN]);
|
||||
DelObjectNoFree(twin->node);
|
||||
|
@ -1004,8 +1004,6 @@ static void gui_init(int argc, char** argv)
|
||||
LOG(("Initializing plotters..."));
|
||||
plot_init(nsoption_charp(atari_font_driver));
|
||||
|
||||
tree_set_icon_dir(nsoption_charp(tree_icons_path));
|
||||
|
||||
aes_event_in.emi_m1leave = MO_LEAVE;
|
||||
aes_event_in.emi_m1.g_w = 1;
|
||||
aes_event_in.emi_m1.g_h = 1;
|
||||
|
@ -223,11 +223,7 @@ static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
|
||||
cur_rel_x = origin_rel_x;
|
||||
cur_rel_y = origin_rel_y;
|
||||
|
||||
if( tree_is_edited(tv->tree) ){
|
||||
gem_set_cursor(&gem_cursors.ibeam);
|
||||
} else {
|
||||
gem_set_cursor(&gem_cursors.hand);
|
||||
}
|
||||
gem_set_cursor(&gem_cursors.hand);
|
||||
|
||||
tv->startdrag.x = origin_rel_x;
|
||||
tv->startdrag.y = origin_rel_y;
|
||||
@ -292,7 +288,6 @@ void atari_treeview_open( NSTREEVIEW tv )
|
||||
{
|
||||
if( tv->window != NULL ) {
|
||||
gemtk_wm_link(tv->window);
|
||||
tree_set_redraw(tv->tree, true);
|
||||
|
||||
}
|
||||
}
|
||||
@ -300,7 +295,6 @@ void atari_treeview_open( NSTREEVIEW tv )
|
||||
void atari_treeview_close(NSTREEVIEW tv)
|
||||
{
|
||||
if(tv->window != NULL) {
|
||||
tree_set_redraw(tv->tree, false);
|
||||
gemtk_wm_unlink(tv->window);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,6 @@ static const char *cocoa_hotlist_path( void )
|
||||
[menu addItem: [[item copy] autorelease]];
|
||||
}
|
||||
hasSeparator = false;
|
||||
node = [tree rootNode];
|
||||
}
|
||||
|
||||
for (struct node *child = tree_node_get_child( node );
|
||||
|
@ -42,7 +42,6 @@
|
||||
|
||||
- initWithFlags: (unsigned int) flags;
|
||||
|
||||
- (struct node *) rootNode;
|
||||
- (struct tree *) tree;
|
||||
|
||||
@end
|
||||
|
@ -59,11 +59,6 @@ static const struct treeview_table cocoa_tree_callbacks = {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (struct node *) rootNode;
|
||||
{
|
||||
return tree_get_root( tree );
|
||||
}
|
||||
|
||||
- (struct tree *) tree;
|
||||
{
|
||||
return tree;
|
||||
@ -76,15 +71,11 @@ static const struct treeview_table cocoa_tree_callbacks = {
|
||||
|
||||
- (void) setRedrawing: (BOOL) newRedrawing;
|
||||
{
|
||||
tree_set_redraw( tree, newRedrawing );
|
||||
}
|
||||
|
||||
|
||||
+ (void) initialize;
|
||||
{
|
||||
if (self == [Tree class]) {
|
||||
tree_set_icon_dir( strdup( [[[NSBundle mainBundle] pathForResource: @"Icons" ofType: @""] UTF8String] ) );
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: -
|
||||
|
3002
desktop/tree.c
3002
desktop/tree.c
File diff suppressed because it is too large
Load Diff
176
desktop/tree.h
176
desktop/tree.h
@ -28,48 +28,22 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "desktop/browser.h"
|
||||
#include "image/bitmap.h"
|
||||
|
||||
struct sslcert_session_data;
|
||||
|
||||
extern struct sslcert_session_data *ssl_current_session;
|
||||
extern const char *tree_hotlist_path;
|
||||
|
||||
|
||||
struct hlcache_handle;
|
||||
|
||||
/* Tree flags */
|
||||
enum tree_flags {
|
||||
TREE_NO_FLAGS = 0,
|
||||
TREE_NO_DRAGS = 1,
|
||||
TREE_NO_FURNITURE = 2,
|
||||
TREE_SINGLE_SELECT = 4,
|
||||
TREE_NO_SELECT = 8,
|
||||
TREE_MOVABLE = 16,
|
||||
TREE_DELETE_EMPTY_DIRS = 32, /**< if the last child of a
|
||||
* directory is deleted the
|
||||
* directory will be deleted
|
||||
* too.
|
||||
*/
|
||||
/* The following are to aid transition to new treeviews */
|
||||
TREE_HISTORY = 64,
|
||||
TREE_COOKIES = 128,
|
||||
TREE_SSLCERT = 256,
|
||||
TREE_HOTLIST = 512
|
||||
TREE_HISTORY,
|
||||
TREE_COOKIES,
|
||||
TREE_SSLCERT,
|
||||
TREE_HOTLIST
|
||||
};
|
||||
|
||||
/** A "flag" value to indicate the element data contains title
|
||||
* text. This value should be the first node_element in every
|
||||
* node. All other values should be different than this one. The term
|
||||
* flag is misused as it is actually a value used by the API consumer
|
||||
* to indicate teh type of data a node element contains.
|
||||
*/
|
||||
#define TREE_ELEMENT_TITLE 0x00
|
||||
#define TREE_ELEMENT_LAUNCH_IN_TABS 0x05 /* Launch in tabs instead of windows */
|
||||
|
||||
struct tree;
|
||||
struct node;
|
||||
struct node_element;
|
||||
|
||||
typedef enum {
|
||||
TREE_NO_DRAG = 0,
|
||||
@ -79,45 +53,6 @@ typedef enum {
|
||||
TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
|
||||
} tree_drag_type;
|
||||
|
||||
typedef enum {
|
||||
NODE_ELEMENT_TEXT, /**< Text only */
|
||||
NODE_ELEMENT_TEXT_PLUS_ICON, /**< Text and icon */
|
||||
NODE_ELEMENT_BITMAP /**< Bitmap only */
|
||||
} node_element_type;
|
||||
|
||||
typedef enum {
|
||||
NODE_DELETE_ELEMENT_TXT, /**< The text of an element of the
|
||||
* node is being deleted */
|
||||
NODE_DELETE_ELEMENT_IMG, /**< The bitmap or icon of a node is
|
||||
* being deleted */
|
||||
NODE_LAUNCH, /**< The node has been launched */
|
||||
NODE_ELEMENT_EDIT_CANCELLED, /**< Editing opperation cancelled. */
|
||||
NODE_ELEMENT_EDIT_FINISHING, /**< New text has to be accepted
|
||||
* or rejected. */
|
||||
NODE_ELEMENT_EDIT_FINISHED /**< Editing of a node_element has
|
||||
* been finished. */
|
||||
} node_msg;
|
||||
|
||||
typedef enum {
|
||||
NODE_CALLBACK_HANDLED,
|
||||
NODE_CALLBACK_NOT_HANDLED,
|
||||
NODE_CALLBACK_REJECT, /**< reject new text for node element
|
||||
* and leave editing mode. */
|
||||
NODE_CALLBACK_CONTINUE /**< don't leave editig mode. */
|
||||
} node_callback_resp;
|
||||
|
||||
/** Internal node message. */
|
||||
struct node_msg_data {
|
||||
node_msg msg; /**< The type of message. */
|
||||
unsigned int flag; /**< message flags. */
|
||||
struct node *node; /**< tree node messsage concerns. */
|
||||
union {
|
||||
char *text; /**< textural data. */
|
||||
void *bitmap; /**< bitmap data. */
|
||||
struct browser_window *bw; /**< clone browser_window. */
|
||||
} data; /**< The message data. */
|
||||
};
|
||||
|
||||
/** callbacks to perform necessary operations on treeview. */
|
||||
struct treeview_table {
|
||||
void (*redraw_request)(int x, int y, int width, int height,
|
||||
@ -128,123 +63,20 @@ struct treeview_table {
|
||||
void (*get_window_dimensions)(int *width, int *height, void *data); /**< get dimensions of window */
|
||||
};
|
||||
|
||||
/**
|
||||
* Informs the client about any events requiring his action
|
||||
*
|
||||
* \param user_data the user data which was passed at tree creation
|
||||
* \param msg_data structure containing all the message information
|
||||
* \return the appropriate node_callback_resp response
|
||||
*/
|
||||
typedef node_callback_resp (*tree_node_user_callback)(void *user_data,
|
||||
struct node_msg_data *msg_data);
|
||||
|
||||
/* Non-platform specific code */
|
||||
|
||||
void tree_set_icon_dir(char *icon_dir);
|
||||
void tree_setup_colours(void);
|
||||
|
||||
/* Functions for creating/deleting tree primitives and for tree structure
|
||||
manipulation */
|
||||
struct tree *tree_create(unsigned int flags,
|
||||
const struct treeview_table *callbacks,
|
||||
void *client_data);
|
||||
|
||||
/**
|
||||
* Creates a folder node with the specified title, and optionally links it into
|
||||
* the tree.
|
||||
*
|
||||
* \param tree the owner tree of 'parent', may be NULL
|
||||
* \param parent the parent node, or NULL not to link
|
||||
* \param title the node title
|
||||
* \param editable if true, the node title will be editable
|
||||
* \param retain_in_memory if true, the node will stay in memory after deletion
|
||||
* \param deleted if true, the node is created with the deleted flag
|
||||
* \return the newly created node or NULL on error.
|
||||
*/
|
||||
struct node *tree_create_folder_node(struct tree *tree, struct node *parent,
|
||||
const char *title, bool editable, bool retain_in_memory,
|
||||
bool deleted);
|
||||
|
||||
/**
|
||||
* Creates a leaf node with the specified title, and optionally links it into
|
||||
* the tree.
|
||||
*
|
||||
* \param tree the owner tree of 'parent', may be NULL
|
||||
* \param parent the parent node, or NULL not to link
|
||||
* \param title the node title.
|
||||
* \param editable if true, the node title will be editable
|
||||
* \param retain_in_memory if true, the node will stay in memory after deletion
|
||||
* \param deleted if true, the node is created with the deleted flag
|
||||
* \return the newly created node or NULL on error.
|
||||
*/
|
||||
struct node *tree_create_leaf_node(struct tree *tree, struct node *parent,
|
||||
const char *title, bool editable, bool retain_in_memory,
|
||||
bool deleted);
|
||||
|
||||
struct node_element *tree_create_node_element(struct node *parent,
|
||||
node_element_type type, unsigned int flag, bool editable);
|
||||
void tree_link_node(struct tree *tree, struct node *link, struct node *node,
|
||||
bool before);
|
||||
void tree_delink_node(struct tree *tree, struct node *node);
|
||||
void tree_delete(struct tree *tree);
|
||||
void tree_delete_node(struct tree *tree, struct node *node, bool siblings);
|
||||
|
||||
/* setters and getters for properties and data */
|
||||
void tree_set_node_icon(struct tree *tree, struct node *node,
|
||||
struct hlcache_handle *icon);
|
||||
void tree_set_node_expanded(struct tree *tree, struct node *node, bool expanded,
|
||||
bool folder, bool leaf);
|
||||
void tree_set_node_selected(struct tree *tree, struct node *node, bool all,
|
||||
bool selected);
|
||||
void tree_set_node_selected_at(struct tree *tree, int x, int y, bool selected);
|
||||
void tree_set_node_sort_function(struct tree *tree, struct node *node,
|
||||
int (*sort) (struct node *, struct node *));
|
||||
void tree_set_node_user_callback(struct node *node,
|
||||
tree_node_user_callback callback, void *data);
|
||||
void tree_set_redraw(struct tree *tree, bool redraw);
|
||||
bool tree_get_redraw(struct tree *tree);
|
||||
bool tree_node_has_selection(struct node *node);
|
||||
bool tree_node_is_deleted(struct node *node);
|
||||
bool tree_node_is_folder(struct node *node);
|
||||
bool tree_node_is_default(struct node *node);
|
||||
void tree_update_node_element(struct tree *tree, struct node_element *element,
|
||||
const char *text, void *bitmap);
|
||||
bool tree_update_element_text(struct tree *tree, struct node_element *element, char *text);
|
||||
const char *tree_node_element_get_text(struct node_element *element);
|
||||
struct bitmap *tree_node_element_get_icon(struct node_element *element);
|
||||
struct node *tree_get_root(struct tree *tree);
|
||||
bool tree_is_edited(struct tree *tree);
|
||||
tree_drag_type tree_drag_status(struct tree *tree);
|
||||
|
||||
struct node *tree_get_default_folder_node(struct tree *tree);
|
||||
bool tree_set_default_folder_node(struct tree *tree, struct node *node);
|
||||
void tree_clear_default_folder_node(struct tree *tree);
|
||||
|
||||
/* functions for traversing the tree */
|
||||
struct node *tree_node_get_parent(struct node *node);
|
||||
struct node *tree_node_get_child(struct node *node);
|
||||
struct node *tree_node_get_next(struct node *node);
|
||||
|
||||
void tree_draw(struct tree *tree, int x, int y,
|
||||
int clip_x, int clip_y, int clip_width, int clip_height,
|
||||
const struct redraw_context *ctx);
|
||||
|
||||
struct node_element *tree_node_find_element(struct node *node,
|
||||
unsigned int flag, struct node_element *after);
|
||||
void tree_delete_selected_nodes(struct tree *tree, struct node *node);
|
||||
struct node *tree_get_selected_node(struct node *node);
|
||||
struct node *tree_get_link_details(struct tree *tree, int x, int y,
|
||||
bool *before);
|
||||
void tree_launch_selected(struct tree *tree, bool tabs);
|
||||
|
||||
bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
|
||||
int x, int y);
|
||||
void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
|
||||
int x1, int y1);
|
||||
bool tree_keypress(struct tree *tree, uint32_t key);
|
||||
|
||||
int tree_alphabetical_sort(struct node *, struct node *);
|
||||
void tree_start_edit(struct tree *tree, struct node_element *element);
|
||||
struct hlcache_handle *tree_load_icon(const char *name);
|
||||
|
||||
#endif
|
||||
|
@ -316,10 +316,6 @@ static void check_options(char **respath)
|
||||
/* user options should be stored in the users home directory */
|
||||
snprintf(buf, PATH_MAX, "%s/.netsurf/Choices", hdir);
|
||||
options_file_location = strdup(buf);
|
||||
|
||||
filepath_sfinddef(respath, buf, "icons/", "~/.netsurf/");
|
||||
LOG(("Using '%s' as Tree icons dir", buf));
|
||||
tree_set_icon_dir(strdup(buf));
|
||||
|
||||
filepath_sfinddef(respath, buf, "Print", "~/.netsurf/");
|
||||
LOG(("Using '%s' as Print Settings file", buf));
|
||||
|
@ -166,7 +166,6 @@ nsgtk_tree_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
|
||||
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
|
||||
|
||||
tree_set_redraw(tree, true);
|
||||
tree_draw(tree, 0, 0, x1, y1, x2 - x1, y2 - y1, &ctx);
|
||||
|
||||
current_widget = NULL;
|
||||
@ -196,7 +195,6 @@ nsgtk_tree_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer
|
||||
current_widget = widget;
|
||||
current_cr = gdk_cairo_create(nsgtk_widget_get_window(widget));
|
||||
|
||||
tree_set_redraw(tree, true);
|
||||
tree_draw(tree, 0, 0, x, y, width, height, &ctx);
|
||||
|
||||
current_widget = NULL;
|
||||
@ -209,11 +207,6 @@ nsgtk_tree_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer
|
||||
|
||||
void nsgtk_tree_window_hide(GtkWidget *widget, gpointer g)
|
||||
{
|
||||
struct nsgtk_treeview *tw = g;
|
||||
struct tree *tree = tw->tree;
|
||||
|
||||
if (tree != NULL)
|
||||
tree_set_redraw(tree, false);
|
||||
}
|
||||
|
||||
gboolean nsgtk_tree_window_button_press_event(GtkWidget *widget,
|
||||
@ -390,32 +383,26 @@ gboolean nsgtk_tree_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
|
||||
GtkAdjustment *hscroll;
|
||||
GtkAdjustment *scroll = NULL;
|
||||
gdouble hpage, vpage;
|
||||
bool edited;
|
||||
|
||||
nskey = gtk_gui_gdkkey_to_nskey(event);
|
||||
|
||||
|
||||
if (tree_keypress(tree, nskey) == true)
|
||||
return TRUE;
|
||||
|
||||
vscroll = gtk_scrolled_window_get_vadjustment(tw->scrolled);
|
||||
hscroll = gtk_scrolled_window_get_hadjustment(tw->scrolled);
|
||||
g_object_get(vscroll, "page-size", &vpage, NULL);
|
||||
g_object_get(hscroll, "page-size", &hpage, NULL);
|
||||
|
||||
|
||||
edited = tree_is_edited(tree);
|
||||
|
||||
switch (event->keyval) {
|
||||
case GDK_KEY(Home):
|
||||
case GDK_KEY(KP_Home):
|
||||
if (edited)
|
||||
break;
|
||||
scroll = vscroll;
|
||||
value = nsgtk_adjustment_get_lower(scroll);
|
||||
break;
|
||||
|
||||
case GDK_KEY(End):
|
||||
case GDK_KEY(KP_End):
|
||||
if (edited)
|
||||
break;
|
||||
case GDK_KEY(KP_End):
|
||||
scroll = vscroll;
|
||||
value = nsgtk_adjustment_get_upper(scroll) - vpage;
|
||||
if (value < nsgtk_adjustment_get_lower(scroll))
|
||||
@ -423,9 +410,7 @@ gboolean nsgtk_tree_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
|
||||
break;
|
||||
|
||||
case GDK_KEY(Left):
|
||||
case GDK_KEY(KP_Left):
|
||||
if (edited)
|
||||
break;
|
||||
case GDK_KEY(KP_Left):
|
||||
scroll = hscroll;
|
||||
value = gtk_adjustment_get_value(scroll) -
|
||||
nsgtk_adjustment_get_step_increment(scroll);
|
||||
@ -444,8 +429,6 @@ gboolean nsgtk_tree_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
|
||||
|
||||
case GDK_KEY(Right):
|
||||
case GDK_KEY(KP_Right):
|
||||
if (edited)
|
||||
break;
|
||||
scroll = hscroll;
|
||||
value = gtk_adjustment_get_value(scroll) +
|
||||
nsgtk_adjustment_get_step_increment(scroll);
|
||||
@ -483,16 +466,13 @@ gboolean nsgtk_tree_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
|
||||
value = nsgtk_adjustment_get_upper(scroll) - vpage;
|
||||
break;
|
||||
|
||||
default:
|
||||
tree_keypress(tree, nskey);
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (scroll != NULL)
|
||||
gtk_adjustment_set_value(scroll, value);
|
||||
|
||||
tree_keypress(tree, nskey);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/url.h"
|
||||
#include "utils/utf8.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "oslib/wimp.h"
|
||||
#include "oslib/wimpspriteop.h"
|
||||
#include "content/urldb.h"
|
||||
#include "desktop/cookie_manager.h"
|
||||
#include "desktop/cookies_old.h"
|
||||
#include "desktop/tree.h"
|
||||
#include "riscos/cookies.h"
|
||||
@ -165,8 +166,6 @@ void ro_gui_cookies_postinitialise(void)
|
||||
|
||||
void ro_gui_cookies_open(void)
|
||||
{
|
||||
tree_set_redraw(ro_treeview_get_tree(cookies_window.tv), true);
|
||||
|
||||
ro_gui_cookies_toolbar_update_buttons();
|
||||
|
||||
if (!ro_gui_dialog_open_top(cookies_window.window,
|
||||
@ -220,7 +219,7 @@ void ro_gui_cookies_toolbar_update_buttons(void)
|
||||
{
|
||||
ro_toolbar_set_button_shaded_state(cookies_window.toolbar,
|
||||
TOOLBAR_BUTTON_DELETE,
|
||||
!ro_treeview_has_selection(cookies_window.tv));
|
||||
!cookie_manager_has_selection());
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +255,7 @@ bool ro_gui_cookies_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
|
||||
if (menu != cookies_window.menu)
|
||||
return false;
|
||||
|
||||
selection = ro_treeview_has_selection(cookies_window.tv);
|
||||
selection = cookie_manager_has_selection();
|
||||
|
||||
ro_gui_menu_set_entry_shaded(cookies_window.menu,
|
||||
TREE_SELECTION, !selection);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "oslib/wimpspriteop.h"
|
||||
#include "content/urldb.h"
|
||||
#include "desktop/history_global_core.h"
|
||||
#include "desktop/global_history.h"
|
||||
#include "desktop/tree.h"
|
||||
#include "riscos/dialog.h"
|
||||
#include "riscos/global_history.h"
|
||||
@ -171,8 +172,6 @@ void ro_gui_global_history_postinitialise(void)
|
||||
|
||||
void ro_gui_global_history_open(void)
|
||||
{
|
||||
tree_set_redraw(ro_treeview_get_tree(global_history_window.tv), true);
|
||||
|
||||
ro_gui_global_history_toolbar_update_buttons();
|
||||
|
||||
if (!ro_gui_dialog_open_top(global_history_window.window,
|
||||
@ -230,11 +229,11 @@ void ro_gui_global_history_toolbar_update_buttons(void)
|
||||
{
|
||||
ro_toolbar_set_button_shaded_state(global_history_window.toolbar,
|
||||
TOOLBAR_BUTTON_DELETE,
|
||||
!ro_treeview_has_selection(global_history_window.tv));
|
||||
!global_history_has_selection());
|
||||
|
||||
ro_toolbar_set_button_shaded_state(global_history_window.toolbar,
|
||||
TOOLBAR_BUTTON_LAUNCH,
|
||||
!ro_treeview_has_selection(global_history_window.tv));
|
||||
!global_history_has_selection());
|
||||
}
|
||||
|
||||
|
||||
@ -270,7 +269,7 @@ bool ro_gui_global_history_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
|
||||
if (menu != global_history_window.menu)
|
||||
return false;
|
||||
|
||||
selection = ro_treeview_has_selection(global_history_window.tv);
|
||||
selection = global_history_has_selection();
|
||||
|
||||
ro_gui_menu_set_entry_shaded(global_history_window.menu,
|
||||
TREE_SELECTION, !selection);
|
||||
|
@ -429,7 +429,6 @@ static void gui_init(int argc, char** argv)
|
||||
int length;
|
||||
char *nsdir_temp;
|
||||
byte *base;
|
||||
char *tree_icons_dir;
|
||||
|
||||
/* re-enable all FPU exceptions/traps except inexact operations,
|
||||
* which we're not interested in, and underflow which is incorrectly
|
||||
@ -458,12 +457,6 @@ static void gui_init(int argc, char** argv)
|
||||
ro_plot_patterned_lines = false;
|
||||
}
|
||||
|
||||
tree_icons_dir = strdup("NetSurf:Resources.Icons");
|
||||
if (tree_icons_dir == NULL)
|
||||
die("Failed initialising string options");
|
||||
tree_set_icon_dir(tree_icons_dir);
|
||||
|
||||
|
||||
/* Create our choices directories */
|
||||
ro_gui_create_dirs();
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "content/hlcache.h"
|
||||
#include "content/urldb.h"
|
||||
#include "desktop/hotlist_old.h"
|
||||
#include "desktop/hotlist.h"
|
||||
#include "desktop/tree.h"
|
||||
#include "riscos/dialog.h"
|
||||
#include "riscos/hotlist.h"
|
||||
@ -215,8 +216,6 @@ void ro_gui_hotlist_open(void)
|
||||
error->errmess);
|
||||
}
|
||||
|
||||
tree_set_redraw(ro_treeview_get_tree(hotlist_window.tv), true);
|
||||
|
||||
ro_gui_hotlist_toolbar_update_buttons();
|
||||
|
||||
if (!ro_gui_dialog_open_top(hotlist_window.window,
|
||||
@ -277,11 +276,11 @@ void ro_gui_hotlist_toolbar_update_buttons(void)
|
||||
{
|
||||
ro_toolbar_set_button_shaded_state(hotlist_window.toolbar,
|
||||
TOOLBAR_BUTTON_DELETE,
|
||||
!ro_treeview_has_selection(hotlist_window.tv));
|
||||
!hotlist_has_selection());
|
||||
|
||||
ro_toolbar_set_button_shaded_state(hotlist_window.toolbar,
|
||||
TOOLBAR_BUTTON_LAUNCH,
|
||||
!ro_treeview_has_selection(hotlist_window.tv));
|
||||
!hotlist_has_selection());
|
||||
}
|
||||
|
||||
|
||||
@ -316,7 +315,7 @@ bool ro_gui_hotlist_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
|
||||
if (menu != hotlist_window.menu)
|
||||
return false;
|
||||
|
||||
selection = ro_treeview_has_selection(hotlist_window.tv);
|
||||
selection = hotlist_has_selection();
|
||||
|
||||
ro_gui_menu_set_entry_shaded(hotlist_window.menu,
|
||||
TREE_SELECTION, !selection);
|
||||
|
@ -158,8 +158,6 @@ void gui_cert_verify(nsurl *url,
|
||||
return;
|
||||
}
|
||||
|
||||
tree_set_redraw(ro_treeview_get_tree(sslcert_window->tv), true);
|
||||
|
||||
/* Set up the certificate window event handling.
|
||||
*
|
||||
* (The action buttons are registered as button events, not OK and
|
||||
|
@ -283,22 +283,6 @@ wimp_w ro_treeview_get_window(ro_treeview *tv)
|
||||
return (tv != NULL) ? (tv->w) : (NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an indication of whether the supplied treeview object contains a
|
||||
* selection.
|
||||
*
|
||||
* \param *tv The ro_treeview object of interest.
|
||||
* \return true if there is a selection in the tree; else false.
|
||||
*/
|
||||
|
||||
bool ro_treeview_has_selection(ro_treeview *tv)
|
||||
{
|
||||
if (tv != NULL)
|
||||
return tree_node_has_selection(tree_get_root(tv->tree));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to force a redraw of part of the treeview window.
|
||||
*
|
||||
@ -853,8 +837,8 @@ static bool ro_treeview_mouse_click(wimp_pointer *pointer)
|
||||
mouse = 0;
|
||||
|
||||
if (pointer->buttons == wimp_CLICK_MENU) {
|
||||
if (!tree_node_has_selection(tree_get_root(tv->tree)))
|
||||
mouse |= BROWSER_MOUSE_CLICK_1;
|
||||
/* TODO: test for no selection, and pass click to select node */
|
||||
/* mouse |= BROWSER_MOUSE_CLICK_1; */
|
||||
} else {
|
||||
mouse = ro_gui_mouse_click_state(pointer->buttons,
|
||||
wimp_BUTTON_DOUBLE_CLICK_DRAG);
|
||||
|
@ -50,7 +50,6 @@ const struct toolbar_callbacks *ro_treeview_get_toolbar_callbacks(void);
|
||||
|
||||
struct tree *ro_treeview_get_tree(ro_treeview *tv);
|
||||
wimp_w ro_treeview_get_window(ro_treeview *tv);
|
||||
bool ro_treeview_has_selection(ro_treeview *tv);
|
||||
|
||||
void ro_treeview_set_origin(ro_treeview *tv, int x, int y);
|
||||
void ro_treeview_mouse_at(wimp_pointer *pointer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user