2008-08-02 18:31:32 +04:00
|
|
|
/*
|
2013-09-15 03:05:52 +04:00
|
|
|
* Copyright 2008 - 2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
2008-08-02 18:31:32 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-12-30 03:53:11 +03:00
|
|
|
#include "amiga/os3support.h"
|
|
|
|
|
2008-09-28 00:55:11 +04:00
|
|
|
#include <proto/window.h>
|
|
|
|
#include <proto/layout.h>
|
2010-10-05 23:14:46 +04:00
|
|
|
#include <proto/space.h>
|
|
|
|
#include <proto/label.h>
|
|
|
|
#include <proto/scroller.h>
|
2008-09-28 00:55:11 +04:00
|
|
|
#include <proto/exec.h>
|
|
|
|
#include <proto/intuition.h>
|
2008-10-12 01:38:04 +04:00
|
|
|
#include <proto/button.h>
|
2008-10-19 17:01:01 +04:00
|
|
|
#include <proto/bitmap.h>
|
2010-10-05 23:14:46 +04:00
|
|
|
#include <proto/graphics.h>
|
|
|
|
#include <proto/asl.h>
|
|
|
|
#include <proto/utility.h>
|
|
|
|
#include <proto/dos.h>
|
2011-10-15 18:09:35 +04:00
|
|
|
|
|
|
|
#include <libraries/gadtools.h>
|
|
|
|
#include <gadgets/button.h>
|
|
|
|
#include <classes/window.h>
|
|
|
|
#include <gadgets/space.h>
|
|
|
|
#include <images/label.h>
|
|
|
|
#include <images/bitmap.h>
|
|
|
|
#include <gadgets/layout.h>
|
|
|
|
#include <gadgets/scroller.h>
|
|
|
|
#include <reaction/reaction_macros.h>
|
|
|
|
#include <intuition/icclass.h>
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2012-02-26 14:42:15 +04:00
|
|
|
#include <graphics/blitattr.h>
|
2015-01-19 02:13:32 +03:00
|
|
|
#endif
|
2011-10-15 18:09:35 +04:00
|
|
|
|
2014-10-16 12:55:01 +04:00
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "utils/nsoption.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "content/urldb.h"
|
|
|
|
#include "content/llcache.h"
|
2014-10-18 02:18:58 +04:00
|
|
|
#include "desktop/browser.h"
|
2014-10-16 12:55:01 +04:00
|
|
|
#include "desktop/cookie_manager.h"
|
|
|
|
#include "desktop/global_history.h"
|
|
|
|
#include "desktop/hotlist.h"
|
|
|
|
#include "desktop/gui_window.h"
|
|
|
|
#include "desktop/sslcert_viewer.h"
|
|
|
|
|
2011-10-15 18:09:35 +04:00
|
|
|
#include "amiga/gui.h"
|
|
|
|
#include "amiga/tree.h"
|
2014-10-16 12:55:01 +04:00
|
|
|
#include "amiga/file.h"
|
2015-01-26 03:05:01 +03:00
|
|
|
#include "amiga/libs.h"
|
2015-01-19 02:13:32 +03:00
|
|
|
#include "amiga/misc.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "amiga/utf8.h"
|
|
|
|
#include "amiga/sslcert.h"
|
2010-10-30 15:20:53 +04:00
|
|
|
#include "amiga/drag.h" /* drag icon stuff */
|
2010-10-24 21:51:00 +04:00
|
|
|
#include "amiga/theme.h" /* pointers */
|
2010-10-30 18:23:38 +04:00
|
|
|
#include "amiga/filetype.h"
|
2013-09-14 15:44:32 +04:00
|
|
|
#include "amiga/schedule.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
#define AMI_TREE_MENU_ITEMS 26
|
2013-11-17 20:33:06 +04:00
|
|
|
#define AMI_TREE_MENU_NEWDIR FULLMENUNUM(1,0,0)
|
|
|
|
#define AMI_TREE_MENU_NEWURL FULLMENUNUM(1,1,0)
|
2014-11-14 02:31:26 +03:00
|
|
|
#define AMI_TREE_MENU_EDIT FULLMENUNUM(1,3,0)
|
|
|
|
#define AMI_TREE_MENU_DELETE FULLMENUNUM(1,5,0)
|
|
|
|
#define AMI_TREE_MENU_CLEAR FULLMENUNUM(1,8,0)
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2011-11-10 16:23:52 +04:00
|
|
|
enum {
|
|
|
|
GID_OPEN = GID_LAST,
|
|
|
|
GID_TREE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
struct treeview_window {
|
2011-12-02 17:24:40 +04:00
|
|
|
struct nsObject *node;
|
2010-10-05 23:14:46 +04:00
|
|
|
struct Window *win;
|
2011-11-10 16:23:52 +04:00
|
|
|
Object *objects[GID_TREE_LAST];
|
2010-10-05 23:14:46 +04:00
|
|
|
int type;
|
|
|
|
struct NewMenu *menu;
|
|
|
|
char *menu_name[AMI_TREE_MENU_ITEMS];
|
|
|
|
struct tree *tree;
|
|
|
|
struct Hook scrollerhook;
|
2010-12-30 03:33:18 +03:00
|
|
|
uint32 key_state;
|
|
|
|
uint32 mouse_state;
|
2010-10-05 23:14:46 +04:00
|
|
|
int drag_x;
|
|
|
|
int drag_y;
|
|
|
|
struct timeval lastclick;
|
|
|
|
int max_width;
|
|
|
|
int max_height;
|
|
|
|
struct gui_globals globals;
|
|
|
|
struct sslcert_session_data *ssl_data;
|
2011-11-11 17:09:12 +04:00
|
|
|
BOOL rmbtrapped;
|
2011-12-16 16:43:42 +04:00
|
|
|
char *wintitle;
|
|
|
|
char *sslerr;
|
|
|
|
char *sslaccept;
|
|
|
|
char *sslreject;
|
2012-08-09 00:07:29 +04:00
|
|
|
struct MinList shared_pens;
|
2010-10-05 23:14:46 +04:00
|
|
|
};
|
|
|
|
|
2013-09-14 15:44:32 +04:00
|
|
|
struct ami_tree_redraw_req {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
struct treeview_window *twin;
|
|
|
|
};
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
#if 0
|
2010-10-05 23:14:46 +04:00
|
|
|
void ami_tree_draw(struct treeview_window *twin);
|
|
|
|
static void ami_tree_resized(struct tree *tree, int width,
|
|
|
|
int height, void *data);
|
|
|
|
static void ami_tree_scroll_visible(int y, int height, void *data);
|
|
|
|
static void ami_tree_get_window_dimensions(int *width, int *height, void *data);
|
2014-10-18 02:18:58 +04:00
|
|
|
#endif
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
void ami_tree_destroy(struct treeview_window *twin)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
tree_delete(twin->tree);
|
|
|
|
FreeVec(twin);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
struct tree *ami_tree_get_tree(struct treeview_window *twin)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
return twin->tree;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_resized(struct tree *tree, int width, int height, void *data)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
struct treeview_window *twin = data;
|
|
|
|
struct IBox *bbox;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->max_height = height;
|
|
|
|
twin->max_width = width;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if(twin->win)
|
2008-09-28 00:55:11 +04:00
|
|
|
{
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2013-09-05 23:37:39 +04:00
|
|
|
if(height == -1) {
|
|
|
|
SetAttrs((APTR)twin->objects[OID_MAIN],
|
|
|
|
WINDOW_VertProp, -1,
|
|
|
|
TAG_DONE);
|
|
|
|
} else {
|
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
|
|
|
|
SCROLLER_Total, height,
|
|
|
|
SCROLLER_Visible, bbox->Height,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(width == -1) {
|
|
|
|
SetAttrs((APTR)twin->objects[OID_MAIN],
|
|
|
|
WINDOW_HorizProp, -1,
|
|
|
|
TAG_DONE);
|
|
|
|
} else {
|
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
|
|
|
|
SCROLLER_Total, width,
|
|
|
|
SCROLLER_Visible, bbox->Width,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
2008-09-28 00:55:11 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/**
|
|
|
|
* Retrieves the dimensions of the window with the tree
|
|
|
|
*
|
|
|
|
* \param data user data assigned to the tree on tree creation
|
|
|
|
* \param width will be updated to window width if not NULL
|
|
|
|
* \param height will be updated to window height if not NULL
|
|
|
|
*/
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_get_window_dimensions(int *width, int *height, void *data)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
struct treeview_window *twin = data;
|
|
|
|
struct IBox *bbox;
|
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
if(width) *width = bbox->Width;
|
|
|
|
if(height) *height = bbox->Height;
|
2014-11-15 17:01:38 +03:00
|
|
|
|
|
|
|
ami_gui_free_space_box(bbox);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_redraw_req_dr(void *p)
|
|
|
|
{
|
|
|
|
struct ami_tree_redraw_req *atrr_data = (struct ami_tree_redraw_req *)p;
|
|
|
|
int x = atrr_data->x;
|
|
|
|
int y = atrr_data->y;
|
|
|
|
int width = atrr_data->width;
|
|
|
|
int height = atrr_data->height;
|
|
|
|
struct treeview_window *twin = atrr_data->twin;
|
|
|
|
struct IBox *bbox;
|
|
|
|
int pos_x, pos_y;
|
|
|
|
struct RastPort *temprp;
|
|
|
|
struct redraw_context ctx = {
|
|
|
|
.interactive = true,
|
|
|
|
.background_images = true,
|
|
|
|
.plot = &amiplot
|
|
|
|
};
|
|
|
|
|
|
|
|
if(!twin->win) return;
|
|
|
|
|
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_WAIT);
|
|
|
|
|
|
|
|
glob = &twin->globals;
|
|
|
|
temprp = glob->rp;
|
|
|
|
glob->rp = twin->win->RPort;
|
2014-11-15 17:01:38 +03:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&pos_x);
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&pos_y);
|
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
x += bbox->Left;
|
|
|
|
y += bbox->Top;
|
|
|
|
|
|
|
|
if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
|
|
|
|
if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
|
|
|
|
|
|
|
|
if(x < pos_x) {
|
|
|
|
width -= pos_x - x;
|
|
|
|
x = pos_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(y < pos_y) {
|
|
|
|
height -= pos_y - y;
|
|
|
|
y = pos_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
tree_draw(twin->tree, bbox->Left - pos_x, bbox->Top - pos_y,
|
|
|
|
atrr_data->x, atrr_data->y,
|
|
|
|
atrr_data->width, atrr_data->height, &ctx);
|
|
|
|
|
|
|
|
FreeVec(atrr_data);
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
2014-10-18 02:18:58 +04:00
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
|
|
|
|
ami_clearclipreg(glob);
|
|
|
|
glob->rp = temprp;
|
|
|
|
glob = &browserglob;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ami_tree_redraw_req(void *p)
|
|
|
|
{
|
|
|
|
struct ami_tree_redraw_req *atrr_data = (struct ami_tree_redraw_req *)p;
|
|
|
|
int x = atrr_data->x;
|
|
|
|
int y = atrr_data->y;
|
|
|
|
int width = atrr_data->width;
|
|
|
|
int height = atrr_data->height;
|
|
|
|
struct treeview_window *twin = atrr_data->twin;
|
|
|
|
struct IBox *bbox;
|
|
|
|
int pos_x, pos_y;
|
|
|
|
int tile_x, tile_y, tile_w, tile_h;
|
|
|
|
struct redraw_context ctx = {
|
|
|
|
.interactive = true,
|
|
|
|
.background_images = true,
|
|
|
|
.plot = &amiplot
|
|
|
|
};
|
|
|
|
|
|
|
|
if(!twin->win) return;
|
|
|
|
|
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_WAIT);
|
|
|
|
|
|
|
|
glob = &twin->globals;
|
|
|
|
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&pos_x);
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&pos_y);
|
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
|
|
|
|
if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
|
|
|
|
|
|
|
|
if(x < pos_x) {
|
|
|
|
width -= pos_x - x;
|
|
|
|
x = pos_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(y < pos_y) {
|
|
|
|
height -= pos_y - y;
|
|
|
|
y = pos_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(tile_y = y; tile_y < (y + height); tile_y += nsoption_int(redraw_tile_size_y)) {
|
|
|
|
tile_h = nsoption_int(redraw_tile_size_y);
|
|
|
|
if(((y + height) - tile_y) < nsoption_int(redraw_tile_size_y))
|
|
|
|
tile_h = (y + height) - tile_y;
|
|
|
|
|
|
|
|
for(tile_x = x; tile_x < (x + width); tile_x += nsoption_int(redraw_tile_size_x)) {
|
|
|
|
tile_w = nsoption_int(redraw_tile_size_x);
|
|
|
|
if(((x + width) - tile_x) < nsoption_int(redraw_tile_size_x))
|
|
|
|
tile_w = (x + width) - tile_x;
|
|
|
|
|
|
|
|
tree_draw(twin->tree, - tile_x, - tile_y,
|
|
|
|
tile_x, tile_y, tile_w, tile_h, &ctx);
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2014-10-18 02:18:58 +04:00
|
|
|
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
|
|
|
|
BLITA_Source, twin->globals.bm,
|
|
|
|
BLITA_SrcX, 0,
|
|
|
|
BLITA_SrcY, 0,
|
|
|
|
BLITA_DestType, BLITT_RASTPORT,
|
|
|
|
BLITA_Dest, twin->win->RPort,
|
|
|
|
BLITA_DestX, bbox->Left + tile_x - pos_x,
|
|
|
|
BLITA_DestY, bbox->Top + tile_y - pos_y,
|
|
|
|
BLITA_Width, tile_w,
|
|
|
|
BLITA_Height, tile_h,
|
|
|
|
TAG_DONE);
|
2015-01-19 02:13:32 +03:00
|
|
|
#else
|
|
|
|
BltBitMapRastPort(twin->globals.bm, 0, 0,
|
|
|
|
twin->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y,
|
|
|
|
tile_w, tile_h, 0xC0);
|
|
|
|
#endif
|
2014-10-18 02:18:58 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeVec(atrr_data);
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
2014-10-18 02:18:58 +04:00
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
|
|
|
|
ami_clearclipreg(glob);
|
|
|
|
glob = &browserglob;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
|
|
|
|
{
|
|
|
|
struct ami_tree_redraw_req *atrr_data = AllocVecTagList(sizeof(struct ami_tree_redraw_req), NULL);
|
2014-11-15 17:01:38 +03:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
atrr_data->x = x;
|
|
|
|
atrr_data->y = y;
|
|
|
|
atrr_data->width = width;
|
|
|
|
atrr_data->height = height;
|
|
|
|
atrr_data->twin = (struct treeview_window *)data;
|
2014-11-15 17:01:38 +03:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
/** /todo Queue these requests properly like the main browser code does
|
|
|
|
**/
|
|
|
|
|
|
|
|
if(nsoption_bool(direct_render) == false)
|
|
|
|
ami_schedule(0, ami_tree_redraw_req, atrr_data);
|
|
|
|
else
|
|
|
|
ami_schedule(0, ami_tree_redraw_req_dr, atrr_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ami_tree_draw(struct treeview_window *twin)
|
|
|
|
{
|
|
|
|
struct IBox *bbox;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if(!twin) return;
|
|
|
|
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&x);
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&y);
|
2014-11-15 17:01:38 +03:00
|
|
|
|
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
2014-10-18 02:18:58 +04:00
|
|
|
|
|
|
|
ami_tree_redraw_request(x, y, bbox->Width, bbox->Height, twin);
|
2014-11-15 17:01:38 +03:00
|
|
|
|
|
|
|
ami_gui_free_space_box(bbox);
|
2014-10-18 02:18:58 +04:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/**
|
|
|
|
* Scrolls the tree to make an element visible
|
|
|
|
*
|
|
|
|
* \param y Y coordinate of the element
|
|
|
|
* \param height height of the element
|
|
|
|
* \param data user data assigned to the tree on tree creation
|
|
|
|
*/
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_scroll_visible(int y, int height, void *data)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2014-11-11 03:03:04 +03:00
|
|
|
int sy, scrollset;
|
2010-10-05 23:14:46 +04:00
|
|
|
struct IBox *bbox;
|
|
|
|
struct treeview_window *twin = data;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&sy);
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
return;
|
|
|
|
}
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
if((y > sy) && ((y + height) < (sy + bbox->Height))) {
|
|
|
|
ami_gui_free_space_box(bbox);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-13 22:00:44 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if((y <= sy) || (height > bbox->Height)) scrollset = (ULONG)y;
|
|
|
|
else scrollset = sy + (y + height) - (sy + bbox->Height);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
|
|
|
|
SCROLLER_Top, scrollset,
|
|
|
|
TAG_DONE);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_draw(twin);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_scroll(struct treeview_window *twin, int sx, int sy)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if(!twin) return;
|
|
|
|
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&x);
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&y);
|
|
|
|
|
2010-10-25 21:26:34 +04:00
|
|
|
x += sx;
|
|
|
|
y += sy;
|
|
|
|
|
|
|
|
if(y < 0) y = 0;
|
|
|
|
if(x < 0) x = 0;
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
|
2010-10-25 21:26:34 +04:00
|
|
|
SCROLLER_Top, y,
|
2010-10-05 23:14:46 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
|
2010-10-25 21:26:34 +04:00
|
|
|
SCROLLER_Top, x,
|
2010-10-05 23:14:46 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
ami_tree_draw(twin);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_drag_icon_show(struct treeview_window *twin)
|
2010-10-29 21:40:36 +04:00
|
|
|
{
|
2010-11-04 00:00:07 +03:00
|
|
|
const char *type = "project";
|
2013-09-14 15:12:12 +04:00
|
|
|
nsurl *url = NULL;
|
|
|
|
const char *title = NULL;
|
2010-11-04 00:00:07 +03:00
|
|
|
|
2010-10-30 14:44:44 +04:00
|
|
|
if((twin->type == AMI_TREE_COOKIES) ||
|
|
|
|
(twin->type == AMI_TREE_SSLCERT)) return; /* No permissable drag operations */
|
2010-11-04 00:00:07 +03:00
|
|
|
|
2013-09-15 03:05:52 +04:00
|
|
|
if((tree_drag_status(twin->tree) == TREE_SELECT_DRAG) ||
|
|
|
|
(tree_drag_status(twin->tree) == TREE_TEXTAREA_DRAG))
|
|
|
|
return;
|
|
|
|
|
2013-09-14 15:12:12 +04:00
|
|
|
if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
|
|
|
|
hotlist_get_selection(&url, &title);
|
|
|
|
} else if((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection())) {
|
|
|
|
global_history_get_selection(&url, &title);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(title && (url == NULL))
|
2010-10-29 21:40:36 +04:00
|
|
|
{
|
|
|
|
ami_drag_icon_show(twin->win, "drawer");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-04 00:00:07 +03:00
|
|
|
ami_drag_icon_show(twin->win, type);
|
2010-10-29 21:40:36 +04:00
|
|
|
}
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_drag_end(struct treeview_window *twin, int x, int y)
|
2010-10-30 14:44:44 +04:00
|
|
|
{
|
|
|
|
struct gui_window_2 *gwin;
|
2011-12-02 17:24:40 +04:00
|
|
|
struct treeview_window *tw;
|
2010-10-30 14:44:44 +04:00
|
|
|
BOOL drag;
|
2013-09-14 15:12:12 +04:00
|
|
|
nsurl *url = NULL;
|
|
|
|
const char *title = NULL;
|
2014-05-24 14:46:14 +04:00
|
|
|
bool ok = false;
|
2010-10-30 14:44:44 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
if((drag = ami_drag_in_progress())) ami_drag_icon_close(twin->win);
|
2013-09-14 15:12:12 +04:00
|
|
|
|
2011-12-02 17:24:40 +04:00
|
|
|
if(drag && (twin != ami_window_at_pointer(AMINS_TVWINDOW)))
|
2010-10-30 14:44:44 +04:00
|
|
|
{
|
2013-09-14 15:12:12 +04:00
|
|
|
if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
|
2014-05-24 14:46:14 +04:00
|
|
|
ok = hotlist_get_selection(&url, &title);
|
2013-09-14 15:12:12 +04:00
|
|
|
} else if((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection())) {
|
2014-05-24 14:46:14 +04:00
|
|
|
ok = global_history_get_selection(&url, &title);
|
2013-09-14 15:12:12 +04:00
|
|
|
}
|
2010-10-30 14:44:44 +04:00
|
|
|
|
2014-05-24 14:46:14 +04:00
|
|
|
if((ok == false) || (url == NULL)) {
|
2010-10-30 14:44:44 +04:00
|
|
|
DisplayBeep(scrn);
|
2013-09-14 15:29:34 +04:00
|
|
|
} else if(url) {
|
2014-10-18 02:18:58 +04:00
|
|
|
if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
|
2014-11-16 17:57:25 +03:00
|
|
|
browser_window_navigate(gwin->gw->bw,
|
2013-02-14 19:09:28 +04:00
|
|
|
url,
|
|
|
|
NULL,
|
2014-02-11 02:40:04 +04:00
|
|
|
BW_NAVIGATE_HISTORY,
|
2013-02-14 19:09:28 +04:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2013-09-14 15:12:12 +04:00
|
|
|
} else if((tw = ami_window_at_pointer(AMINS_TVWINDOW)) &&
|
|
|
|
(tw != twin) && (tw->type == AMI_TREE_HOTLIST)) {
|
|
|
|
hotlist_add_entry(url, title, true, y);
|
2011-12-02 17:24:40 +04:00
|
|
|
}
|
2010-10-30 14:44:44 +04:00
|
|
|
}
|
2014-05-24 14:46:14 +04:00
|
|
|
tree_mouse_action(twin->tree, twin->mouse_state | twin->key_state,
|
|
|
|
twin->drag_x, twin->drag_y); /* Keep the tree happy */
|
2010-10-30 14:44:44 +04:00
|
|
|
tree_drag_end(twin->tree, twin->mouse_state,
|
|
|
|
twin->drag_x, twin->drag_y,
|
2014-05-24 14:46:14 +04:00
|
|
|
twin->drag_x, twin->drag_y); /* Keep the tree happier */
|
2013-09-14 15:12:12 +04:00
|
|
|
} else {
|
2010-10-30 14:44:44 +04:00
|
|
|
if(tree_drag_status(twin->tree) == TREE_UNKNOWN_DRAG)
|
|
|
|
DisplayBeep(scrn);
|
|
|
|
|
|
|
|
tree_drag_end(twin->tree, twin->mouse_state,
|
|
|
|
twin->drag_x, twin->drag_y, x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-24 22:51:51 +03:00
|
|
|
HOOKF(void, ami_tree_scroller_hook, Object *, object, struct IntuiMessage *)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2014-10-18 02:18:58 +04:00
|
|
|
ULONG gid;
|
2010-10-05 23:14:46 +04:00
|
|
|
struct treeview_window *twin = hook->h_Data;
|
|
|
|
struct IntuiWheelData *wheel;
|
|
|
|
|
|
|
|
switch(msg->Class)
|
|
|
|
{
|
|
|
|
case IDCMP_IDCMPUPDATE:
|
|
|
|
gid = GetTagData( GA_ID, 0, msg->IAddress );
|
|
|
|
|
|
|
|
switch( gid )
|
|
|
|
{
|
|
|
|
case OID_HSCROLL:
|
|
|
|
case OID_VSCROLL:
|
|
|
|
ami_tree_draw(twin);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2010-10-05 23:14:46 +04:00
|
|
|
case IDCMP_EXTENDEDMOUSE:
|
|
|
|
if(msg->Code == IMSGCODE_INTUIWHEELDATA)
|
|
|
|
{
|
|
|
|
wheel = (struct IntuiWheelData *)msg->IAddress;
|
|
|
|
|
|
|
|
ami_tree_scroll(twin, (wheel->WheelX * 20), (wheel->WheelY * 20));
|
|
|
|
}
|
|
|
|
break;
|
2015-01-19 02:13:32 +03:00
|
|
|
#endif
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_menu(struct treeview_window *twin)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
if(twin->menu) return;
|
|
|
|
|
2015-01-19 02:13:32 +03:00
|
|
|
if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->menu[0].nm_Type = NM_TITLE;
|
|
|
|
twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
|
|
|
|
twin->menu[0].nm_Label = twin->menu_name[0];
|
|
|
|
|
|
|
|
twin->menu[1].nm_Type = NM_ITEM;
|
|
|
|
twin->menu_name[1] = ami_utf8_easy((char *)messages_get("TreeExport"));
|
|
|
|
twin->menu[1].nm_Label = twin->menu_name[1];
|
|
|
|
if(twin->type == AMI_TREE_COOKIES)
|
|
|
|
twin->menu[1].nm_Flags = NM_ITEMDISABLED;
|
|
|
|
twin->menu[1].nm_CommKey = "S";
|
|
|
|
|
|
|
|
twin->menu[2].nm_Type = NM_ITEM;
|
|
|
|
twin->menu[2].nm_Label = NM_BARLABEL;
|
|
|
|
|
|
|
|
twin->menu[3].nm_Type = NM_ITEM;
|
|
|
|
twin->menu_name[3] = ami_utf8_easy((char *)messages_get("Expand"));
|
|
|
|
twin->menu[3].nm_Label = twin->menu_name[3];
|
|
|
|
|
|
|
|
twin->menu[4].nm_Type = NM_SUB;
|
|
|
|
twin->menu_name[4] = ami_utf8_easy((char *)messages_get("All"));
|
|
|
|
twin->menu[4].nm_Label = twin->menu_name[4];
|
|
|
|
twin->menu[4].nm_CommKey = "+";
|
|
|
|
|
|
|
|
if(twin->type == AMI_TREE_COOKIES)
|
|
|
|
{
|
|
|
|
twin->menu_name[5] = ami_utf8_easy((char *)messages_get("Domains"));
|
|
|
|
twin->menu_name[6] = ami_utf8_easy((char *)messages_get("Cookies"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
twin->menu_name[5] = ami_utf8_easy((char *)messages_get("Folders"));
|
|
|
|
twin->menu_name[6] = ami_utf8_easy((char *)messages_get("Links"));
|
|
|
|
}
|
|
|
|
|
|
|
|
twin->menu[5].nm_Type = NM_SUB;
|
|
|
|
twin->menu[5].nm_Label = twin->menu_name[5]; // tree-specific title
|
|
|
|
|
|
|
|
twin->menu[6].nm_Type = NM_SUB;
|
|
|
|
twin->menu[6].nm_Label = twin->menu_name[6]; // tree-specific title
|
|
|
|
|
|
|
|
twin->menu[7].nm_Type = NM_ITEM;
|
|
|
|
twin->menu_name[7] = ami_utf8_easy((char *)messages_get("Collapse"));
|
|
|
|
twin->menu[7].nm_Label = twin->menu_name[7];
|
|
|
|
|
|
|
|
twin->menu[8].nm_Type = NM_SUB;
|
|
|
|
twin->menu[8].nm_Label = twin->menu_name[4];
|
|
|
|
twin->menu[8].nm_CommKey = "-";
|
|
|
|
|
|
|
|
twin->menu[9].nm_Type = NM_SUB;
|
|
|
|
twin->menu[9].nm_Label = twin->menu_name[5]; // tree-specific title
|
|
|
|
|
|
|
|
twin->menu[10].nm_Type = NM_SUB;
|
|
|
|
twin->menu[10].nm_Label = twin->menu_name[6]; // tree-specific title
|
|
|
|
|
|
|
|
twin->menu[11].nm_Type = NM_ITEM;
|
|
|
|
twin->menu[11].nm_Label = NM_BARLABEL;
|
|
|
|
|
|
|
|
twin->menu[12].nm_Type = NM_ITEM;
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu_name[12] = ami_utf8_easy((char *)messages_get("SnapshotWindow"));
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->menu[12].nm_Label = twin->menu_name[12];
|
|
|
|
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu[13].nm_Type = NM_ITEM;
|
|
|
|
twin->menu[13].nm_Label = NM_BARLABEL;
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
twin->menu[14].nm_Type = NM_ITEM;
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu_name[14] = ami_utf8_easy((char *)messages_get("CloseWindow"));
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->menu[14].nm_Label = twin->menu_name[14];
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu[14].nm_CommKey = "K";
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu[15].nm_Type = NM_TITLE;
|
|
|
|
twin->menu_name[15] = ami_utf8_easy((char *)messages_get("Edit"));
|
|
|
|
twin->menu[15].nm_Label = twin->menu_name[15];
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
twin->menu[16].nm_Type = NM_ITEM;
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu_name[16] = ami_utf8_easy((char *)messages_get("TreeNewFolder"));
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->menu[16].nm_Label = twin->menu_name[16];
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu[16].nm_CommKey = "N";
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
twin->menu[17].nm_Type = NM_ITEM;
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu_name[17] = ami_utf8_easy((char *)messages_get("TreeNewLink"));
|
|
|
|
twin->menu[17].nm_Label = twin->menu_name[17];
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu[18].nm_Type = NM_ITEM;
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu[18].nm_Label = NM_BARLABEL;
|
2010-12-19 15:04:35 +03:00
|
|
|
|
|
|
|
twin->menu[19].nm_Type = NM_ITEM;
|
2014-11-14 02:38:58 +03:00
|
|
|
twin->menu_name[19] = ami_utf8_easy((char *)messages_get("TreeEdit"));
|
2010-12-19 15:04:35 +03:00
|
|
|
twin->menu[19].nm_Label = twin->menu_name[19];
|
2014-11-14 02:31:26 +03:00
|
|
|
twin->menu[19].nm_CommKey = "E";
|
2010-12-19 15:04:35 +03:00
|
|
|
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu[20].nm_Type = NM_ITEM;
|
|
|
|
twin->menu[20].nm_Label = NM_BARLABEL;
|
|
|
|
|
|
|
|
twin->menu[21].nm_Type = NM_ITEM;
|
2014-11-14 02:31:26 +03:00
|
|
|
twin->menu_name[21] = ami_utf8_easy((char *)messages_get("TreeDelete"));
|
2013-11-17 20:33:06 +04:00
|
|
|
twin->menu[21].nm_Label = twin->menu_name[21];
|
2014-11-14 02:31:26 +03:00
|
|
|
twin->menu[21].nm_CommKey = "D";
|
2013-11-17 20:33:06 +04:00
|
|
|
|
|
|
|
twin->menu[22].nm_Type = NM_ITEM;
|
2014-11-14 02:31:26 +03:00
|
|
|
twin->menu[22].nm_Label = NM_BARLABEL;
|
2013-11-17 20:33:06 +04:00
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
twin->menu[23].nm_Type = NM_ITEM;
|
|
|
|
twin->menu_name[23] = ami_utf8_easy((char *)messages_get("SelectAllNS"));
|
|
|
|
twin->menu[23].nm_Label = twin->menu_name[23];
|
|
|
|
twin->menu[23].nm_CommKey = "A";
|
|
|
|
|
|
|
|
twin->menu[24].nm_Type = NM_ITEM;
|
|
|
|
twin->menu_name[24] = ami_utf8_easy((char *)messages_get("ClearNS"));
|
|
|
|
twin->menu[24].nm_Label = twin->menu_name[24];
|
|
|
|
|
|
|
|
twin->menu[25].nm_Type = NM_END;
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_update_buttons(struct treeview_window *twin)
|
2010-12-19 15:49:41 +03:00
|
|
|
{
|
|
|
|
if(twin->type == AMI_TREE_SSLCERT) return;
|
|
|
|
|
2013-11-17 20:33:06 +04:00
|
|
|
if(twin->type != AMI_TREE_HOTLIST) {
|
|
|
|
OffMenu(twin->win, AMI_TREE_MENU_NEWDIR);
|
|
|
|
OffMenu(twin->win, AMI_TREE_MENU_NEWURL);
|
|
|
|
}
|
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
|
|
|
|
OnMenu(twin->win, AMI_TREE_MENU_EDIT);
|
|
|
|
} else {
|
|
|
|
OffMenu(twin->win, AMI_TREE_MENU_EDIT);
|
|
|
|
}
|
|
|
|
|
2013-09-12 14:09:05 +04:00
|
|
|
if(((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) ||
|
|
|
|
((twin->type == AMI_TREE_COOKIES) && (cookie_manager_has_selection())) ||
|
|
|
|
((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection()))) {
|
2010-12-19 15:49:41 +03:00
|
|
|
OnMenu(twin->win, AMI_TREE_MENU_DELETE);
|
|
|
|
OnMenu(twin->win, AMI_TREE_MENU_CLEAR);
|
2013-09-12 14:09:05 +04:00
|
|
|
} else {
|
2010-12-19 15:49:41 +03:00
|
|
|
OffMenu(twin->win, AMI_TREE_MENU_DELETE);
|
|
|
|
OffMenu(twin->win, AMI_TREE_MENU_CLEAR);
|
2011-11-10 16:23:52 +04:00
|
|
|
}
|
2010-12-19 15:49:41 +03:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
void ami_tree_open(struct treeview_window *twin,int type)
|
2008-09-28 00:55:11 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
if(twin->win)
|
2008-09-28 17:55:40 +04:00
|
|
|
{
|
|
|
|
WindowToFront(twin->win);
|
|
|
|
ActivateWindow(twin->win);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->type = type;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
switch(twin->type)
|
2008-10-12 01:38:04 +04:00
|
|
|
{
|
|
|
|
case AMI_TREE_HOTLIST:
|
2011-12-16 16:43:42 +04:00
|
|
|
twin->wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
|
2008-10-12 01:38:04 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2011-12-16 16:43:42 +04:00
|
|
|
twin->wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
|
2008-10-12 01:38:04 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HISTORY:
|
2011-12-16 16:43:42 +04:00
|
|
|
twin->wintitle = ami_utf8_easy((char *)messages_get("GlobalHistory"));
|
2008-10-12 01:38:04 +04:00
|
|
|
break;
|
2009-06-01 02:12:42 +04:00
|
|
|
case AMI_TREE_SSLCERT:
|
2011-12-16 16:43:42 +04:00
|
|
|
twin->wintitle = ami_utf8_easy((char *)messages_get("SSLCerts"));
|
|
|
|
twin->sslerr = ami_utf8_easy((char *)messages_get("SSLError"));
|
2013-02-07 00:00:46 +04:00
|
|
|
twin->sslaccept = ami_utf8_easy((char *)messages_get("SSL_Certificate_Accept"));
|
|
|
|
twin->sslreject = ami_utf8_easy((char *)messages_get("SSL_Certificate_Reject"));
|
2009-06-01 02:12:42 +04:00
|
|
|
break;
|
2008-10-12 01:38:04 +04:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->scrollerhook.h_Entry = (void *)ami_tree_scroller_hook;
|
|
|
|
twin->scrollerhook.h_Data = twin;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2012-02-26 14:42:15 +04:00
|
|
|
ami_init_layers(&twin->globals, 0, 0);
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_menu(twin);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if(type == AMI_TREE_SSLCERT)
|
|
|
|
{
|
2015-01-26 03:05:01 +03:00
|
|
|
twin->objects[OID_MAIN] = WindowObj,
|
2014-11-16 19:40:41 +03:00
|
|
|
WA_ScreenTitle, ami_gui_get_screen_title(),
|
2011-12-16 16:43:42 +04:00
|
|
|
WA_Title, twin->wintitle,
|
2008-09-28 00:55:11 +04:00
|
|
|
WA_Activate, TRUE,
|
|
|
|
WA_DepthGadget, TRUE,
|
|
|
|
WA_DragBar, TRUE,
|
|
|
|
WA_CloseGadget, TRUE,
|
|
|
|
WA_SizeGadget, TRUE,
|
2014-11-14 02:31:26 +03:00
|
|
|
WA_SizeBRight, TRUE,
|
2010-10-05 23:14:46 +04:00
|
|
|
WA_Height, scrn->Height / 2,
|
2013-03-20 12:22:03 +04:00
|
|
|
WA_PubScreen,scrn,
|
2010-10-05 23:14:46 +04:00
|
|
|
WA_ReportMouse,TRUE,
|
2010-12-19 02:34:56 +03:00
|
|
|
WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
2010-10-05 23:14:46 +04:00
|
|
|
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
2010-12-19 02:34:56 +03:00
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
|
2010-10-05 23:14:46 +04:00
|
|
|
WINDOW_HorizProp,1,
|
|
|
|
WINDOW_VertProp,1,
|
|
|
|
WINDOW_IDCMPHook,&twin->scrollerhook,
|
|
|
|
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
|
2008-09-28 17:55:40 +04:00
|
|
|
WINDOW_SharedPort,sport,
|
|
|
|
WINDOW_UserData,twin,
|
2010-10-05 23:14:46 +04:00
|
|
|
/* WINDOW_NewMenu, twin->menu, -> No menu for SSL Cert */
|
|
|
|
WINDOW_IconifyGadget, FALSE,
|
2008-10-12 01:38:04 +04:00
|
|
|
WINDOW_Position, WPOS_CENTERSCREEN,
|
2015-01-26 03:05:01 +03:00
|
|
|
WINDOW_ParentGroup, twin->objects[GID_MAIN] = LayoutVObj,
|
2010-10-05 23:14:46 +04:00
|
|
|
LAYOUT_AddImage, LabelObject,
|
2011-12-16 16:43:42 +04:00
|
|
|
LABEL_Text, twin->sslerr,
|
2010-10-05 23:14:46 +04:00
|
|
|
LabelEnd,
|
2015-01-26 03:05:01 +03:00
|
|
|
LAYOUT_AddChild, twin->objects[GID_BROWSER] = SpaceObj,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_ID, GID_BROWSER,
|
|
|
|
SPACE_Transparent,TRUE,
|
|
|
|
SPACE_BevelStyle, BVS_DISPLAY,
|
|
|
|
SpaceEnd,
|
|
|
|
LAYOUT_AddChild, HGroupObject,
|
2015-01-26 03:05:01 +03:00
|
|
|
LAYOUT_AddChild, twin->objects[GID_OPEN] = ButtonObj,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_ID,GID_OPEN,
|
2011-12-16 16:43:42 +04:00
|
|
|
GA_Text, twin->sslaccept,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
ButtonEnd,
|
2015-01-26 03:05:01 +03:00
|
|
|
LAYOUT_AddChild, twin->objects[GID_CANCEL] = ButtonObj,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_ID,GID_CANCEL,
|
2011-12-16 16:43:42 +04:00
|
|
|
GA_Text, twin->sslreject,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
ButtonEnd,
|
|
|
|
EndGroup,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-19 15:04:35 +03:00
|
|
|
ULONG width = scrn->Width / 2;
|
|
|
|
ULONG height = scrn->Height / 2;
|
|
|
|
ULONG top = (scrn->Height / 2) - (height / 2);
|
|
|
|
ULONG left = (scrn->Width / 2) - (width / 2);
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if((type == AMI_TREE_HOTLIST) && (nsoption_int(hotlist_window_xsize) > 0))
|
2010-12-19 15:04:35 +03:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
top = nsoption_int(hotlist_window_ypos);
|
|
|
|
left = nsoption_int(hotlist_window_xpos);
|
|
|
|
width = nsoption_int(hotlist_window_xsize);
|
|
|
|
height = nsoption_int(hotlist_window_ysize);
|
2010-12-19 15:04:35 +03:00
|
|
|
}
|
2012-03-22 13:34:34 +04:00
|
|
|
else if((type == AMI_TREE_HISTORY) && (nsoption_int(history_window_xsize) > 0))
|
2010-12-19 15:04:35 +03:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
top = nsoption_int(history_window_ypos);
|
|
|
|
left = nsoption_int(history_window_xpos);
|
|
|
|
width = nsoption_int(history_window_xsize);
|
|
|
|
height = nsoption_int(history_window_ysize);
|
2010-12-19 15:04:35 +03:00
|
|
|
}
|
2012-03-22 13:34:34 +04:00
|
|
|
else if((type == AMI_TREE_COOKIES) && (nsoption_int(cookies_window_xsize) > 0))
|
2010-12-19 15:04:35 +03:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
top = nsoption_int(cookies_window_ypos);
|
|
|
|
left = nsoption_int(cookies_window_xpos);
|
|
|
|
width = nsoption_int(cookies_window_xsize);
|
|
|
|
height = nsoption_int(cookies_window_ysize);
|
2010-12-19 15:04:35 +03:00
|
|
|
}
|
|
|
|
|
2015-01-26 03:05:01 +03:00
|
|
|
twin->objects[OID_MAIN] = WindowObj,
|
2014-11-16 19:40:41 +03:00
|
|
|
WA_ScreenTitle, ami_gui_get_screen_title(),
|
2011-12-16 16:43:42 +04:00
|
|
|
WA_Title, twin->wintitle,
|
2010-10-05 23:14:46 +04:00
|
|
|
WA_Activate, TRUE,
|
|
|
|
WA_DepthGadget, TRUE,
|
|
|
|
WA_DragBar, TRUE,
|
|
|
|
WA_CloseGadget, TRUE,
|
|
|
|
WA_SizeGadget, TRUE,
|
2014-11-14 02:31:26 +03:00
|
|
|
WA_SizeBRight, TRUE,
|
2010-12-19 15:04:35 +03:00
|
|
|
WA_Top, top,
|
|
|
|
WA_Left, left,
|
|
|
|
WA_Width, width,
|
|
|
|
WA_Height, height,
|
2013-03-20 12:22:03 +04:00
|
|
|
WA_PubScreen,scrn,
|
2010-10-05 23:14:46 +04:00
|
|
|
WA_ReportMouse,TRUE,
|
2010-12-19 02:34:56 +03:00
|
|
|
WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
2010-10-05 23:14:46 +04:00
|
|
|
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
2010-12-19 02:34:56 +03:00
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_INTUITICKS,
|
2010-10-05 23:14:46 +04:00
|
|
|
WINDOW_HorizProp,1,
|
|
|
|
WINDOW_VertProp,1,
|
|
|
|
WINDOW_IDCMPHook,&twin->scrollerhook,
|
|
|
|
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
|
|
|
|
WINDOW_SharedPort,sport,
|
|
|
|
WINDOW_UserData,twin,
|
|
|
|
WINDOW_NewMenu, twin->menu,
|
|
|
|
WINDOW_IconifyGadget, FALSE,
|
2010-12-19 15:04:35 +03:00
|
|
|
// WINDOW_Position, WPOS_CENTERSCREEN,
|
2015-01-26 03:05:01 +03:00
|
|
|
WINDOW_ParentGroup, twin->objects[GID_MAIN] = LayoutVObj,
|
|
|
|
LAYOUT_AddChild, twin->objects[GID_BROWSER] = SpaceObj,
|
2010-10-05 23:14:46 +04:00
|
|
|
GA_ID, GID_BROWSER,
|
|
|
|
SPACE_Transparent,TRUE,
|
|
|
|
SPACE_BevelStyle, BVS_DISPLAY,
|
|
|
|
SpaceEnd,
|
2008-09-28 00:55:11 +04:00
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
2008-09-28 00:55:11 +04:00
|
|
|
|
|
|
|
twin->win = (struct Window *)RA_OpenWindow(twin->objects[OID_MAIN]);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
GetAttr(WINDOW_HorizObject, twin->objects[OID_MAIN],
|
|
|
|
(ULONG *)&twin->objects[OID_HSCROLL]);
|
|
|
|
GetAttr(WINDOW_VertObject, twin->objects[OID_MAIN],
|
|
|
|
(ULONG *)&twin->objects[OID_VSCROLL]);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
|
|
|
|
GA_ID,OID_VSCROLL,
|
|
|
|
ICA_TARGET,ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
|
|
|
|
GA_ID,OID_HSCROLL,
|
|
|
|
ICA_TARGET,ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->node = AddObject(window_list,AMINS_TVWINDOW);
|
|
|
|
twin->node->objstruct = twin;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-12-19 15:49:41 +03:00
|
|
|
ami_tree_update_buttons(twin);
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
|
|
|
|
ami_tree_draw(twin);
|
2008-09-28 00:55:11 +04:00
|
|
|
}
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
void ami_tree_close(struct treeview_window *twin)
|
2008-09-28 00:55:11 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
int i;
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->win = NULL;
|
|
|
|
DisposeObject(twin->objects[OID_MAIN]);
|
|
|
|
DelObjectNoFree(twin->node);
|
|
|
|
ami_free_layers(&twin->globals);
|
2012-08-09 00:07:29 +04:00
|
|
|
ami_plot_release_pens(&twin->shared_pens);
|
2008-10-06 22:20:16 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
for(i=0;i<AMI_TREE_MENU_ITEMS;i++)
|
|
|
|
{
|
|
|
|
if(twin->menu_name[i] && (twin->menu_name[i] != NM_BARLABEL)) ami_utf8_free(twin->menu_name[i]);
|
|
|
|
}
|
|
|
|
FreeVec(twin->menu);
|
|
|
|
twin->menu = NULL;
|
2011-12-16 16:43:42 +04:00
|
|
|
ami_utf8_free(twin->wintitle);
|
|
|
|
if(twin->type == AMI_TREE_SSLCERT)
|
|
|
|
{
|
|
|
|
ami_utf8_free(twin->sslerr);
|
|
|
|
ami_utf8_free(twin->sslaccept);
|
|
|
|
ami_utf8_free(twin->sslreject);
|
|
|
|
ami_ssl_free(twin);
|
|
|
|
}
|
2012-11-30 02:13:42 +04:00
|
|
|
|
2014-07-01 01:37:05 +04:00
|
|
|
ami_gui_hotlist_update_all();
|
2008-09-28 00:55:11 +04:00
|
|
|
}
|
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
static void ami_tree_update_quals(struct treeview_window *twin)
|
2008-09-28 00:55:11 +04:00
|
|
|
{
|
2010-12-30 03:33:18 +03:00
|
|
|
uint32 quals = 0;
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2010-12-30 03:33:18 +03:00
|
|
|
GetAttr(WINDOW_Qualifier, twin->objects[OID_MAIN], (uint32 *)&quals);
|
2015-01-19 02:13:32 +03:00
|
|
|
#else
|
|
|
|
#warning FIXME not reading qualifiers on OS3
|
|
|
|
#endif
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->key_state = 0;
|
2008-09-28 17:55:40 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
|
|
|
|
{
|
|
|
|
twin->key_state |= BROWSER_MOUSE_MOD_1;
|
|
|
|
}
|
2008-09-28 17:55:40 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if(quals & IEQUALIFIER_CONTROL)
|
|
|
|
{
|
|
|
|
twin->key_state |= BROWSER_MOUSE_MOD_2;
|
|
|
|
}
|
2008-09-28 00:55:11 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if((quals & IEQUALIFIER_LALT) || (quals & IEQUALIFIER_RALT))
|
|
|
|
{
|
|
|
|
twin->key_state |= BROWSER_MOUSE_MOD_3;
|
2008-09-28 00:55:11 +04:00
|
|
|
}
|
|
|
|
}
|
2008-09-28 17:55:40 +04:00
|
|
|
|
|
|
|
BOOL ami_tree_event(struct treeview_window *twin)
|
|
|
|
{
|
|
|
|
/* return TRUE if window destroyed */
|
2014-10-18 02:18:58 +04:00
|
|
|
ULONG result,storage = 0;
|
2010-12-30 03:33:18 +03:00
|
|
|
uint16 code;
|
2008-09-28 17:55:40 +04:00
|
|
|
struct MenuItem *item;
|
2010-10-05 23:14:46 +04:00
|
|
|
ULONG menunum=0,itemnum=0,subnum=0;
|
|
|
|
int xs, ys, x, y;
|
|
|
|
struct IBox *bbox;
|
|
|
|
struct timeval curtime;
|
|
|
|
struct InputEvent *ie;
|
|
|
|
int nskey;
|
|
|
|
char fname[1024];
|
2010-12-19 02:34:56 +03:00
|
|
|
static int drag_x_move = 0, drag_y_move = 0;
|
2008-09-28 17:55:40 +04:00
|
|
|
|
|
|
|
while((result = RA_HandleInput(twin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
|
|
|
|
{
|
|
|
|
switch(result & WMHI_CLASSMASK) // class
|
|
|
|
{
|
|
|
|
case WMHI_GADGETUP:
|
|
|
|
switch(result & WMHI_GADGETMASK)
|
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
case GID_OPEN:
|
2013-08-12 14:44:36 +04:00
|
|
|
sslcert_viewer_accept(twin->ssl_data);
|
2011-12-18 21:59:23 +04:00
|
|
|
ami_tree_close(twin);
|
|
|
|
return TRUE;
|
2008-10-12 01:38:04 +04:00
|
|
|
break;
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
case GID_CANCEL:
|
2013-08-12 14:44:36 +04:00
|
|
|
sslcert_viewer_reject(twin->ssl_data);
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_close(twin);
|
|
|
|
return TRUE;
|
2008-10-12 01:38:04 +04:00
|
|
|
break;
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
break;
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
case WMHI_MOUSEMOVE:
|
2010-12-19 02:34:56 +03:00
|
|
|
drag_x_move = 0;
|
|
|
|
drag_y_move = 0;
|
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
break;
|
|
|
|
}
|
2008-10-14 02:34:54 +04:00
|
|
|
|
2011-11-11 17:09:12 +04:00
|
|
|
if((twin->win->MouseX - bbox->Left >=0) &&
|
|
|
|
(twin->win->MouseX - bbox->Width - bbox->Left <=0) &&
|
|
|
|
(twin->win->MouseY - bbox->Top >=0) &&
|
|
|
|
(twin->win->MouseY - bbox->Height - bbox->Top <=0))
|
|
|
|
{
|
2011-12-18 21:59:23 +04:00
|
|
|
if((twin->type != AMI_TREE_SSLCERT) &&
|
|
|
|
(twin->rmbtrapped == FALSE))
|
2011-11-11 17:09:12 +04:00
|
|
|
{
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2011-11-11 17:09:12 +04:00
|
|
|
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)TRUE, sizeof(BOOL));
|
2015-01-19 02:13:32 +03:00
|
|
|
#endif
|
2011-12-18 21:59:23 +04:00
|
|
|
twin->rmbtrapped = TRUE;
|
2011-11-11 17:09:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(twin->rmbtrapped == TRUE)
|
|
|
|
{
|
2015-01-19 02:13:32 +03:00
|
|
|
#ifdef __amigaos4__
|
2011-11-11 17:09:12 +04:00
|
|
|
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)FALSE, sizeof(BOOL));
|
2015-01-19 02:13:32 +03:00
|
|
|
#endif
|
2011-12-18 21:59:23 +04:00
|
|
|
twin->rmbtrapped = FALSE;
|
2011-11-11 17:09:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
|
|
|
|
x = twin->win->MouseX - bbox->Left + xs;
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&ys);
|
|
|
|
y = twin->win->MouseY - bbox->Top + ys;
|
|
|
|
|
2010-10-20 02:22:03 +04:00
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_DRAG_ON)
|
|
|
|
{
|
|
|
|
ami_drag_icon_move();
|
|
|
|
|
2010-12-19 02:34:56 +03:00
|
|
|
if((twin->win->MouseX < bbox->Left) &&
|
|
|
|
((twin->win->MouseX - bbox->Left) > -AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_x_move = twin->win->MouseX - bbox->Left;
|
2010-12-19 02:34:56 +03:00
|
|
|
if((twin->win->MouseX > (bbox->Left + bbox->Width)) &&
|
|
|
|
((twin->win->MouseX - (bbox->Left + bbox->Width)) < AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_x_move = twin->win->MouseX - (bbox->Left + bbox->Width);
|
2010-12-19 02:34:56 +03:00
|
|
|
if((twin->win->MouseY < bbox->Top) &&
|
|
|
|
((twin->win->MouseY - bbox->Top) > -AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_y_move = twin->win->MouseY - bbox->Top;
|
2010-12-19 02:34:56 +03:00
|
|
|
if((twin->win->MouseY > (bbox->Top + bbox->Height)) &&
|
|
|
|
((twin->win->MouseY - (bbox->Top + bbox->Height)) < AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_y_move = twin->win->MouseY - (bbox->Top + bbox->Height);
|
2011-11-13 21:41:56 +04:00
|
|
|
|
2013-12-16 00:43:56 +04:00
|
|
|
tree_mouse_action(twin->tree, twin->mouse_state | twin->key_state, x, y);
|
2010-10-20 02:22:03 +04:00
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
if((x >= xs) && (y >= ys) && (x < bbox->Width + xs) &&
|
|
|
|
(y < bbox->Height + ys))
|
|
|
|
{
|
|
|
|
ami_tree_update_quals(twin);
|
|
|
|
|
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_PRESS_1)
|
|
|
|
{
|
2011-11-10 22:58:47 +04:00
|
|
|
if((abs(x - twin->drag_x) + abs(y - twin->drag_y)) > 2)
|
|
|
|
{
|
|
|
|
tree_mouse_action(twin->tree,
|
|
|
|
BROWSER_MOUSE_DRAG_1 | twin->key_state, x, y);
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_HOLDING_1 |
|
|
|
|
BROWSER_MOUSE_DRAG_ON;
|
|
|
|
ami_tree_drag_icon_show(twin);
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
else if(twin->mouse_state & BROWSER_MOUSE_PRESS_2)
|
|
|
|
{
|
2011-11-10 22:58:47 +04:00
|
|
|
if((abs(x - twin->drag_x) + abs(y - twin->drag_y)) > 2)
|
|
|
|
{
|
|
|
|
tree_mouse_action(twin->tree,
|
|
|
|
BROWSER_MOUSE_DRAG_2 | twin->key_state, x, y);
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_HOLDING_2 |
|
|
|
|
BROWSER_MOUSE_DRAG_ON;
|
|
|
|
ami_tree_drag_icon_show(twin);
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
}
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->lastclick.tv_sec = 0;
|
|
|
|
twin->lastclick.tv_usec = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WMHI_MOUSEBUTTONS:
|
2014-11-15 17:01:38 +03:00
|
|
|
if(ami_gui_get_space_box((Object *)twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
|
|
|
|
warn_user("NoMemory", "");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
|
|
|
|
x = twin->win->MouseX - bbox->Left + xs;
|
|
|
|
GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&ys);
|
|
|
|
y = twin->win->MouseY - bbox->Top + ys;
|
|
|
|
|
|
|
|
ami_tree_update_quals(twin);
|
|
|
|
|
|
|
|
if((x >= xs) && (y >= ys) && (x < bbox->Width + xs) &&
|
|
|
|
(y < bbox->Height + ys))
|
|
|
|
{
|
|
|
|
switch(code)
|
|
|
|
{
|
|
|
|
case SELECTDOWN:
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_PRESS_1;
|
2011-11-10 22:58:47 +04:00
|
|
|
if(twin->drag_x == 0) twin->drag_x = x;
|
|
|
|
if(twin->drag_y == 0) twin->drag_y = y;
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case MIDDLEDOWN:
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_PRESS_2;
|
2011-11-10 22:58:47 +04:00
|
|
|
if(twin->drag_x == 0) twin->drag_x = x;
|
|
|
|
if(twin->drag_y == 0) twin->drag_y = y;
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
2011-11-11 17:09:12 +04:00
|
|
|
case MENUDOWN:
|
2013-09-12 14:10:37 +04:00
|
|
|
#if 0
|
2011-11-11 17:09:12 +04:00
|
|
|
if(tree_node_has_selection(tree_get_root(twin->tree)) == false)
|
|
|
|
{
|
|
|
|
tree_set_node_selected_at(twin->tree, x, y, true);
|
|
|
|
}
|
2011-12-17 22:47:35 +04:00
|
|
|
ami_context_menu_show_tree(twin->tree, twin->win, twin->type);
|
2013-09-12 14:10:37 +04:00
|
|
|
#endif
|
2011-11-11 17:09:12 +04:00
|
|
|
break;
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(x < xs) x = xs;
|
|
|
|
if(y < ys) y = ys;
|
|
|
|
if(x >= bbox->Width + xs) x = bbox->Width + xs - 1;
|
|
|
|
if(y >= bbox->Height + ys) y = bbox->Height + ys - 1;
|
|
|
|
|
2014-11-15 17:01:38 +03:00
|
|
|
ami_gui_free_space_box(bbox);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
switch(code)
|
|
|
|
{
|
|
|
|
case SELECTUP:
|
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_PRESS_1)
|
|
|
|
{
|
2014-11-11 03:03:04 +03:00
|
|
|
CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_CLICK_1;
|
|
|
|
|
|
|
|
if(twin->lastclick.tv_sec)
|
|
|
|
{
|
|
|
|
if(DoubleClick(twin->lastclick.tv_sec,
|
|
|
|
twin->lastclick.tv_usec,
|
|
|
|
curtime.tv_sec, curtime.tv_usec))
|
|
|
|
twin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
|
|
|
|
}
|
|
|
|
tree_mouse_action(twin->tree,
|
|
|
|
twin->mouse_state | twin->key_state, x, y);
|
|
|
|
|
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
|
|
|
|
{
|
|
|
|
twin->lastclick.tv_sec = 0;
|
|
|
|
twin->lastclick.tv_usec = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
twin->lastclick.tv_sec = curtime.tv_sec;
|
|
|
|
twin->lastclick.tv_usec = curtime.tv_usec;
|
|
|
|
}
|
|
|
|
}
|
2010-10-30 14:44:44 +04:00
|
|
|
else ami_tree_drag_end(twin, x, y);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->mouse_state=0;
|
|
|
|
twin->drag_x = 0;
|
|
|
|
twin->drag_y = 0;
|
|
|
|
break;
|
2010-12-17 02:28:33 +03:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
case MIDDLEUP:
|
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_PRESS_2)
|
|
|
|
{
|
2014-11-11 03:03:04 +03:00
|
|
|
CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
|
2010-12-17 02:28:33 +03:00
|
|
|
|
|
|
|
twin->mouse_state = BROWSER_MOUSE_CLICK_2;
|
|
|
|
|
|
|
|
if(twin->lastclick.tv_sec)
|
|
|
|
{
|
|
|
|
if(DoubleClick(twin->lastclick.tv_sec,
|
|
|
|
twin->lastclick.tv_usec,
|
|
|
|
curtime.tv_sec, curtime.tv_usec))
|
|
|
|
twin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
tree_mouse_action(twin->tree,
|
2010-12-17 02:28:33 +03:00
|
|
|
twin->mouse_state | twin->key_state, x, y);
|
|
|
|
|
|
|
|
if(twin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
|
|
|
|
{
|
|
|
|
twin->lastclick.tv_sec = 0;
|
|
|
|
twin->lastclick.tv_usec = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
twin->lastclick.tv_sec = curtime.tv_sec;
|
|
|
|
twin->lastclick.tv_usec = curtime.tv_usec;
|
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
2010-10-30 14:44:44 +04:00
|
|
|
else ami_tree_drag_end(twin, x, y);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
twin->mouse_state=0;
|
|
|
|
twin->drag_x = 0;
|
|
|
|
twin->drag_y = 0;
|
2008-09-28 17:55:40 +04:00
|
|
|
break;
|
2010-12-17 23:30:50 +03:00
|
|
|
|
|
|
|
case SELECTDOWN:
|
|
|
|
case MIDDLEDOWN:
|
|
|
|
tree_mouse_action(twin->tree,
|
|
|
|
twin->mouse_state | twin->key_state, x, y);
|
|
|
|
break;
|
2008-09-28 17:55:40 +04:00
|
|
|
}
|
2010-12-19 15:49:41 +03:00
|
|
|
ami_tree_update_buttons(twin);
|
2008-09-28 17:55:40 +04:00
|
|
|
break;
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
case WMHI_RAWKEY:
|
|
|
|
storage = result & WMHI_GADGETMASK;
|
|
|
|
|
|
|
|
GetAttr(WINDOW_InputEvent,twin->objects[OID_MAIN],(ULONG *)&ie);
|
|
|
|
nskey = ami_key_to_nskey(storage, ie);
|
|
|
|
tree_keypress(twin->tree, nskey);
|
2015-03-27 12:36:19 +03:00
|
|
|
if(nskey == NS_KEY_COPY_SELECTION) {
|
2015-01-17 18:33:32 +03:00
|
|
|
/* if we've copied a selection we need to clear it - style guide rules */
|
2015-03-27 12:36:19 +03:00
|
|
|
tree_keypress(twin->tree, NS_KEY_CLEAR_SELECTION);
|
2015-01-17 18:33:32 +03:00
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
case WMHI_MENUPICK:
|
2010-10-05 23:14:46 +04:00
|
|
|
item = ItemAddress(twin->win->MenuStrip,code);
|
2008-09-28 17:55:40 +04:00
|
|
|
while (code != MENUNULL)
|
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
menunum = MENUNUM(code);
|
|
|
|
itemnum = ITEMNUM(code);
|
|
|
|
subnum = SUBNUM(code);
|
|
|
|
|
|
|
|
switch(menunum)
|
|
|
|
{
|
|
|
|
case 0: // tree
|
|
|
|
switch(itemnum)
|
|
|
|
{
|
|
|
|
case 0: // export
|
|
|
|
if(AslRequestTags(savereq,
|
2013-05-25 16:59:42 +04:00
|
|
|
ASLFR_Window, twin->win,
|
|
|
|
ASLFR_SleepWindow, TRUE,
|
2010-10-05 23:14:46 +04:00
|
|
|
ASLFR_TitleText,messages_get("NetSurf"),
|
|
|
|
ASLFR_Screen,scrn,
|
|
|
|
ASLFR_InitialFile,"tree_export.html",
|
|
|
|
TAG_DONE))
|
|
|
|
{
|
2010-12-30 03:53:11 +03:00
|
|
|
strlcpy(fname,savereq->fr_Drawer,1024);
|
2010-10-05 23:14:46 +04:00
|
|
|
AddPart(fname,savereq->fr_File,1024);
|
2013-01-06 04:21:15 +04:00
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_WAIT);
|
2010-10-05 23:14:46 +04:00
|
|
|
if(twin->type == AMI_TREE_HISTORY)
|
2013-09-03 01:41:04 +04:00
|
|
|
global_history_export(fname, NULL);
|
2010-10-05 23:14:46 +04:00
|
|
|
else if(twin->type == AMI_TREE_HOTLIST)
|
2013-09-03 01:41:04 +04:00
|
|
|
hotlist_export(fname, NULL);
|
2013-01-06 04:21:15 +04:00
|
|
|
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // expand
|
|
|
|
switch(subnum)
|
|
|
|
{
|
|
|
|
case 0: // all
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // lev 1
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_expand(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_expand(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_expand(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // lev 2
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_expand(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // collapse
|
|
|
|
switch(subnum)
|
|
|
|
{
|
|
|
|
case 0: // all
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // lev 1
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_contract(true);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // lev 2
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2013-09-03 15:36:55 +04:00
|
|
|
global_history_contract(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2013-09-03 15:36:55 +04:00
|
|
|
cookie_manager_contract(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2013-09-03 15:36:55 +04:00
|
|
|
hotlist_contract(false);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-12-19 15:04:35 +03:00
|
|
|
case 5: // snapshot
|
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_int(history_window_ypos, twin->win->TopEdge);
|
|
|
|
nsoption_set_int(history_window_xpos, twin->win->LeftEdge);
|
|
|
|
nsoption_set_int(history_window_xsize, twin->win->Width);
|
|
|
|
nsoption_set_int(history_window_ysize, twin->win->Height);
|
2010-12-19 15:04:35 +03:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_int(cookies_window_ypos, twin->win->TopEdge);
|
|
|
|
nsoption_set_int(cookies_window_xpos, twin->win->LeftEdge);
|
|
|
|
nsoption_set_int(cookies_window_xsize, twin->win->Width);
|
|
|
|
nsoption_set_int(cookies_window_ysize, twin->win->Height);
|
2010-12-19 15:04:35 +03:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_int(hotlist_window_ypos, twin->win->TopEdge);
|
|
|
|
nsoption_set_int(hotlist_window_xpos, twin->win->LeftEdge);
|
|
|
|
nsoption_set_int(hotlist_window_xsize, twin->win->Width);
|
|
|
|
nsoption_set_int(hotlist_window_ysize, twin->win->Height);
|
2010-12-19 15:04:35 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7: // close
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_close(twin);
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // edit
|
|
|
|
switch(itemnum)
|
|
|
|
{
|
2013-11-17 20:33:06 +04:00
|
|
|
case 0: // new folder
|
|
|
|
hotlist_add_folder(NULL, false, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // new entry
|
|
|
|
hotlist_add_entry(NULL, NULL, false, 0);
|
|
|
|
break;
|
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
case 3: // edit
|
|
|
|
hotlist_edit_selection();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5: // delete
|
2010-10-05 23:14:46 +04:00
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2015-03-27 12:36:19 +03:00
|
|
|
global_history_keypress(NS_KEY_DELETE_LEFT);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2015-03-27 12:36:19 +03:00
|
|
|
cookie_manager_keypress(NS_KEY_DELETE_LEFT);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2015-03-27 12:36:19 +03:00
|
|
|
hotlist_keypress(NS_KEY_DELETE_LEFT);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
2010-12-19 15:49:41 +03:00
|
|
|
ami_tree_update_buttons(twin);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
case 7: // select all
|
2010-10-05 23:14:46 +04:00
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2015-03-27 12:36:19 +03:00
|
|
|
global_history_keypress(NS_KEY_SELECT_ALL);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2015-03-27 12:36:19 +03:00
|
|
|
cookie_manager_keypress(NS_KEY_SELECT_ALL);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2015-03-27 12:36:19 +03:00
|
|
|
hotlist_keypress(NS_KEY_SELECT_ALL);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
2010-12-19 15:49:41 +03:00
|
|
|
ami_tree_update_buttons(twin);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
|
2014-11-14 02:31:26 +03:00
|
|
|
case 8: // clear
|
2010-10-05 23:14:46 +04:00
|
|
|
switch(twin->type)
|
|
|
|
{
|
|
|
|
case AMI_TREE_HISTORY:
|
2015-03-27 12:36:19 +03:00
|
|
|
global_history_keypress(NS_KEY_CLEAR_SELECTION);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_COOKIES:
|
2015-03-27 12:36:19 +03:00
|
|
|
cookie_manager_keypress(NS_KEY_CLEAR_SELECTION);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
case AMI_TREE_HOTLIST:
|
2015-03-27 12:36:19 +03:00
|
|
|
hotlist_keypress(NS_KEY_CLEAR_SELECTION);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
2010-12-19 15:49:41 +03:00
|
|
|
ami_tree_update_buttons(twin);
|
2010-10-05 23:14:46 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
code = item->NextSelect;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
case WMHI_NEWSIZE:
|
2012-02-26 18:40:34 +04:00
|
|
|
ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_draw(twin);
|
|
|
|
break;
|
2008-09-28 17:55:40 +04:00
|
|
|
|
|
|
|
case WMHI_CLOSEWINDOW:
|
2010-10-05 23:14:46 +04:00
|
|
|
if(twin->type == AMI_TREE_SSLCERT)
|
2013-08-12 14:44:36 +04:00
|
|
|
sslcert_viewer_reject(twin->ssl_data);
|
2008-09-28 17:55:40 +04:00
|
|
|
ami_tree_close(twin);
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-12-19 02:34:56 +03:00
|
|
|
|
|
|
|
if(drag_x_move || drag_y_move)
|
|
|
|
ami_tree_scroll(twin, drag_x_move, drag_y_move);
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2009-04-15 02:36:57 +04:00
|
|
|
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2008-10-14 02:34:54 +04:00
|
|
|
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
const struct treeview_table ami_tree_callbacks = {
|
|
|
|
.redraw_request = ami_tree_redraw_request,
|
|
|
|
.resized = ami_tree_resized,
|
|
|
|
.scroll_visible = ami_tree_scroll_visible,
|
|
|
|
.get_window_dimensions = ami_tree_get_window_dimensions
|
|
|
|
};
|
2013-10-26 20:08:24 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
struct treeview_window *ami_tree_create(int flags,
|
|
|
|
struct sslcert_session_data *ssl_data)
|
2008-10-12 01:38:04 +04:00
|
|
|
{
|
2014-10-18 02:18:58 +04:00
|
|
|
struct treeview_window *twin;
|
2012-02-26 14:42:15 +04:00
|
|
|
|
2015-01-19 02:13:32 +03:00
|
|
|
twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
|
2012-02-26 14:42:15 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
if(!twin)
|
|
|
|
{
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return NULL;
|
2012-02-26 14:42:15 +04:00
|
|
|
}
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
twin->ssl_data = ssl_data;
|
|
|
|
twin->tree = tree_create(flags, &ami_tree_callbacks, twin);
|
2013-09-14 15:44:32 +04:00
|
|
|
|
2015-08-06 01:42:20 +03:00
|
|
|
ami_NewMinList(&twin->shared_pens);
|
2014-10-18 02:18:58 +04:00
|
|
|
twin->globals.shared_pens = &twin->shared_pens;
|
2013-09-14 15:44:32 +04:00
|
|
|
|
2014-10-18 02:18:58 +04:00
|
|
|
return twin;
|
2013-10-26 20:08:24 +04:00
|
|
|
}
|
2015-01-26 03:05:01 +03:00
|
|
|
|