2008-08-02 18:31:32 +04:00
|
|
|
/*
|
2012-02-12 22:02:49 +04:00
|
|
|
* Copyright 2008-2012 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-02-14 15:26:12 +03:00
|
|
|
/* NetSurf core includes */
|
2008-08-09 19:19:04 +04:00
|
|
|
#include "content/urldb.h"
|
2009-07-24 03:05:34 +04:00
|
|
|
#include "css/utils.h"
|
2008-08-10 00:27:36 +04:00
|
|
|
#include "desktop/history_core.h"
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "desktop/mouse.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "desktop/netsurf.h"
|
|
|
|
#include "desktop/options.h"
|
2009-12-18 02:55:02 +03:00
|
|
|
#include "desktop/save_complete.h"
|
2011-12-24 02:14:00 +04:00
|
|
|
#include "desktop/scrollbar.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "desktop/searchweb.h"
|
|
|
|
#include "desktop/selection.h"
|
2008-08-25 17:32:26 +04:00
|
|
|
#include "desktop/textinput.h"
|
2011-01-20 17:05:13 +03:00
|
|
|
#include "desktop/tree.h"
|
2010-10-30 15:20:53 +04:00
|
|
|
#include "image/ico.h"
|
2012-03-27 00:25:10 +04:00
|
|
|
#include "render/box.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "render/form.h"
|
2012-03-27 00:25:10 +04:00
|
|
|
#include "render/html.h"
|
2011-06-16 22:46:43 +04:00
|
|
|
#include "utils/log.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/utf8.h"
|
2008-09-29 02:50:13 +04:00
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/url.h"
|
2011-02-24 01:27:55 +03:00
|
|
|
#include "content/fetchers/resource.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
|
|
|
|
/* NetSurf Amiga platform includes */
|
2008-09-29 23:35:30 +04:00
|
|
|
#include "amiga/arexx.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/bitmap.h"
|
|
|
|
#include "amiga/clipboard.h"
|
2008-10-21 22:04:27 +04:00
|
|
|
#include "amiga/context_menu.h"
|
|
|
|
#include "amiga/cookies.h"
|
2011-05-07 02:42:37 +04:00
|
|
|
#include "amiga/datatypes.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/download.h"
|
2010-10-30 15:20:53 +04:00
|
|
|
#include "amiga/drag.h"
|
2011-10-15 18:09:35 +04:00
|
|
|
#include "amiga/file.h"
|
2011-06-30 22:58:52 +04:00
|
|
|
#include "amiga/filetype.h"
|
2009-03-15 14:21:46 +03:00
|
|
|
#include "amiga/font.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/gui.h"
|
2009-06-21 02:29:43 +04:00
|
|
|
#include "amiga/gui_options.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/history.h"
|
|
|
|
#include "amiga/history_local.h"
|
|
|
|
#include "amiga/hotlist.h"
|
2011-05-07 00:40:09 +04:00
|
|
|
#include "amiga/icon.h"
|
2011-02-26 20:38:43 +03:00
|
|
|
#include "amiga/launch.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/login.h"
|
|
|
|
#include "amiga/menu.h"
|
2010-03-17 02:55:39 +03:00
|
|
|
#include "amiga/misc.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/plotters.h"
|
2011-05-10 02:11:18 +04:00
|
|
|
#include "amiga/plugin_hack.h"
|
2009-08-31 01:43:14 +04:00
|
|
|
#include "amiga/print.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/schedule.h"
|
|
|
|
#include "amiga/search.h"
|
2010-03-24 01:27:33 +03:00
|
|
|
#include "amiga/theme.h"
|
2010-02-14 15:26:12 +03:00
|
|
|
#include "amiga/tree.h"
|
|
|
|
#include "amiga/utf8.h"
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2010-02-14 15:26:12 +03:00
|
|
|
/* Custom StringView class */
|
2009-07-23 15:23:34 +04:00
|
|
|
#include "amiga/stringview/stringview.h"
|
|
|
|
#include "amiga/stringview/urlhistory.h"
|
|
|
|
|
2010-02-14 15:26:12 +03:00
|
|
|
/* AmigaOS libraries */
|
2011-01-07 02:17:17 +03:00
|
|
|
#ifdef __amigaos4__
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <proto/application.h>
|
2011-01-07 02:17:17 +03:00
|
|
|
#endif
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <proto/asl.h>
|
|
|
|
#include <proto/datatypes.h>
|
|
|
|
#include <proto/dos.h>
|
|
|
|
#include <proto/exec.h>
|
|
|
|
#include <proto/graphics.h>
|
|
|
|
#include <proto/intuition.h>
|
|
|
|
#include <proto/keymap.h>
|
|
|
|
#include <proto/locale.h>
|
|
|
|
#include <proto/Picasso96API.h>
|
|
|
|
#include <proto/utility.h>
|
|
|
|
#include <proto/wb.h>
|
2008-08-15 21:19:57 +04:00
|
|
|
|
2010-02-14 15:26:12 +03:00
|
|
|
/* Other OS includes */
|
2010-04-02 20:25:55 +04:00
|
|
|
#include <datatypes/textclass.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <devices/inputevent.h>
|
2011-01-07 02:50:50 +03:00
|
|
|
#ifdef __amigaos4__
|
2010-03-24 01:27:33 +03:00
|
|
|
#include <graphics/blitattr.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <libraries/application.h>
|
|
|
|
#include <libraries/keymap.h>
|
2011-01-07 02:50:50 +03:00
|
|
|
#endif
|
|
|
|
#include <libraries/gadtools.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <intuition/icclass.h>
|
|
|
|
#include <graphics/rpattr.h>
|
|
|
|
#include <workbench/workbench.h>
|
|
|
|
|
|
|
|
/* ReAction libraries */
|
|
|
|
#include <proto/bevel.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <proto/bitmap.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include <proto/button.h>
|
2008-09-28 00:55:11 +04:00
|
|
|
#include <proto/clicktab.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <proto/layout.h>
|
|
|
|
#include <proto/space.h>
|
|
|
|
#include <proto/string.h>
|
|
|
|
#include <proto/window.h>
|
|
|
|
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <classes/window.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <gadgets/button.h>
|
|
|
|
#include <gadgets/clicktab.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <gadgets/layout.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include <gadgets/scroller.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
#include <gadgets/space.h>
|
2010-02-14 15:26:12 +03:00
|
|
|
#include <gadgets/string.h>
|
|
|
|
#include <images/bevel.h>
|
|
|
|
#include <images/bitmap.h>
|
|
|
|
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <reaction/reaction_macros.h>
|
|
|
|
|
2010-02-14 15:26:12 +03:00
|
|
|
/* newlib includes */
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2011-09-25 14:08:23 +04:00
|
|
|
#define NSA_KBD_SCROLL_PX 10
|
|
|
|
|
2011-06-03 22:08:17 +04:00
|
|
|
/* Extra mouse button defines to match those in intuition/intuition.h */
|
2011-06-03 22:11:19 +04:00
|
|
|
#define SIDEDOWN (IECODE_4TH_BUTTON)
|
|
|
|
#define SIDEUP (IECODE_4TH_BUTTON | IECODE_UP_PREFIX)
|
|
|
|
#define EXTRADOWN (IECODE_5TH_BUTTON)
|
|
|
|
#define EXTRAUP (IECODE_5TH_BUTTON | IECODE_UP_PREFIX)
|
2011-06-03 22:08:17 +04:00
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
struct MsgPort *appport;
|
2008-10-26 15:25:26 +03:00
|
|
|
struct Library *KeymapBase = NULL;
|
|
|
|
struct KeymapIFace *IKeymap = NULL;
|
2009-09-28 22:00:40 +04:00
|
|
|
struct Library *ApplicationBase=NULL;
|
|
|
|
struct ApplicationIFace *IApplication=NULL;
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2009-07-23 15:23:34 +04:00
|
|
|
Class *urlStringClass;
|
|
|
|
|
2008-12-08 00:50:04 +03:00
|
|
|
BOOL locked_screen = FALSE;
|
2009-07-04 20:12:27 +04:00
|
|
|
BOOL screen_closed = FALSE;
|
2009-09-28 22:00:40 +04:00
|
|
|
struct MsgPort *applibport = NULL;
|
|
|
|
ULONG applibsig = 0;
|
2011-09-13 02:38:51 +04:00
|
|
|
BOOL refresh_search_ico = FALSE;
|
2012-04-29 19:59:37 +04:00
|
|
|
BOOL refresh_favicon = FALSE;
|
|
|
|
BOOL refresh_throbber = FALSE;
|
2012-04-07 21:16:32 +04:00
|
|
|
struct Hook newprefs_hook;
|
2008-09-11 23:33:40 +04:00
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
static char *current_user;
|
|
|
|
static char *current_user_dir;
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
const char tree_directory_icon_name[] = "def_drawer.info";
|
|
|
|
const char tree_content_icon_name[] = "def_project.info";
|
2009-03-27 23:04:34 +03:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
static struct DrawInfo *dri;
|
2008-08-31 21:34:00 +04:00
|
|
|
|
2011-09-07 22:38:08 +04:00
|
|
|
const char * const versvn;
|
|
|
|
const char * const verdate;
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
void ami_update_buttons(struct gui_window_2 *);
|
2008-08-15 21:19:57 +04:00
|
|
|
void ami_scroller_hook(struct Hook *,Object *,struct IntuiMessage *);
|
2008-10-21 22:04:27 +04:00
|
|
|
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
|
2009-12-13 14:52:58 +03:00
|
|
|
void ami_change_tab(struct gui_window_2 *gwin, int direction);
|
2009-08-29 03:12:18 +04:00
|
|
|
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
|
2009-08-31 01:43:14 +04:00
|
|
|
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
|
2009-08-29 03:12:18 +04:00
|
|
|
ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin);
|
|
|
|
ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
|
2009-10-03 15:00:10 +04:00
|
|
|
void ami_try_quit(void);
|
2011-05-08 02:21:41 +04:00
|
|
|
Object *ami_gui_splash_open(void);
|
|
|
|
void ami_gui_splash_close(Object *win_obj);
|
2011-09-13 02:38:51 +04:00
|
|
|
static uint32 ami_set_search_ico_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg);
|
2012-04-29 19:59:37 +04:00
|
|
|
static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg);
|
|
|
|
static uint32 ami_set_throbber_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg);
|
2011-10-29 18:14:13 +04:00
|
|
|
bool ami_gui_map_filename(char **remapped, const char *path, const char *file,
|
|
|
|
const char *map);
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-06-22 02:12:52 +04:00
|
|
|
STRPTR ami_locale_langs(void)
|
|
|
|
{
|
|
|
|
struct Locale *locale;
|
|
|
|
STRPTR acceptlangs = NULL, acceptlangs2 = NULL;
|
|
|
|
int i;
|
2011-10-29 18:14:13 +04:00
|
|
|
char *remapped;
|
2009-06-22 02:12:52 +04:00
|
|
|
|
|
|
|
if(locale = OpenLocale(NULL))
|
|
|
|
{
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
{
|
|
|
|
if(locale->loc_PrefLanguages[i])
|
|
|
|
{
|
2011-10-29 18:14:13 +04:00
|
|
|
if(ami_gui_map_filename(&remapped, "PROGDIR:Resources",
|
|
|
|
locale->loc_PrefLanguages[i], "LangNames"))
|
2009-06-22 02:12:52 +04:00
|
|
|
{
|
|
|
|
if(acceptlangs)
|
|
|
|
{
|
|
|
|
acceptlangs2 = acceptlangs;
|
2011-10-29 18:14:13 +04:00
|
|
|
acceptlangs = ASPrintf("%s, %s",acceptlangs2, remapped);
|
2009-06-22 02:12:52 +04:00
|
|
|
FreeVec(acceptlangs2);
|
|
|
|
acceptlangs2 = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-29 18:14:13 +04:00
|
|
|
acceptlangs = ASPrintf("%s", remapped);
|
2009-06-22 02:12:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CloseLocale(locale);
|
|
|
|
}
|
|
|
|
return acceptlangs;
|
|
|
|
}
|
|
|
|
|
2011-10-29 17:35:55 +04:00
|
|
|
bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map)
|
2011-10-29 17:32:53 +04:00
|
|
|
{
|
|
|
|
BPTR fh = 0;
|
|
|
|
char mapfile[1024];
|
|
|
|
char buffer[1024];
|
|
|
|
char *realfname;
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
strcpy(mapfile, path);
|
2011-10-29 17:35:55 +04:00
|
|
|
path_add_part(mapfile, 1024, map);
|
2011-10-29 17:32:53 +04:00
|
|
|
|
|
|
|
if(fh = FOpen(mapfile, MODE_OLDFILE, 0))
|
|
|
|
{
|
|
|
|
while(FGets(fh, buffer, 1024) != 0)
|
|
|
|
{
|
|
|
|
if((buffer[0] == '#') ||
|
|
|
|
(buffer[0] == '\n') ||
|
|
|
|
(buffer[0] == '\0')) continue;
|
|
|
|
|
|
|
|
if(realfname = strchr(buffer, ':'))
|
|
|
|
{
|
2011-10-29 18:14:13 +04:00
|
|
|
if(strncmp(buffer, file, strlen(file)) == 0)
|
2011-10-29 17:32:53 +04:00
|
|
|
{
|
|
|
|
if(realfname[strlen(realfname)-1] == '\n')
|
|
|
|
realfname[strlen(realfname)-1] = '\0';
|
|
|
|
*remapped = strdup(realfname + 1);
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FClose(fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(found == false) *remapped = strdup(file);
|
2011-10-29 17:51:19 +04:00
|
|
|
else LOG(("Remapped %s to %s in path %s using %s", file, *remapped, path, map));
|
2011-10-29 17:32:53 +04:00
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ami_gui_check_resource(char *fullpath, const char *file)
|
|
|
|
{
|
|
|
|
bool free_rmap = false;
|
|
|
|
bool found = false;
|
|
|
|
char *remapped;
|
|
|
|
BPTR lock = 0;
|
|
|
|
|
2011-10-29 17:51:19 +04:00
|
|
|
ami_gui_map_filename(&remapped, fullpath, file, "Resource.map");
|
2011-10-29 17:35:55 +04:00
|
|
|
path_add_part(fullpath, 1024, remapped);
|
2011-10-29 17:32:53 +04:00
|
|
|
|
|
|
|
if(lock = Lock(fullpath, ACCESS_READ))
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
|
2011-10-29 17:51:19 +04:00
|
|
|
if(found) LOG(("Found %s", fullpath));
|
2011-10-29 17:35:55 +04:00
|
|
|
free(remapped);
|
2011-10-29 17:32:53 +04:00
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
2011-10-29 15:24:29 +04:00
|
|
|
bool ami_locate_resource(char *fullpath, const char *file)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-08-10 00:27:36 +04:00
|
|
|
struct Locale *locale;
|
|
|
|
int i;
|
2010-03-24 01:55:56 +03:00
|
|
|
BPTR lock = 0;
|
2011-03-13 21:33:57 +03:00
|
|
|
bool found = false;
|
2011-10-29 17:51:19 +04:00
|
|
|
char *remapped;
|
2008-08-23 20:17:51 +04:00
|
|
|
|
2012-03-30 23:28:37 +04:00
|
|
|
/* Check NetSurf user data area first */
|
|
|
|
|
|
|
|
strcpy(fullpath, current_user_dir);
|
|
|
|
found = ami_gui_check_resource(fullpath, file);
|
|
|
|
if(found) return true;
|
|
|
|
|
|
|
|
/* Secondly check the user's selected theme. NB: ami_locate_resource()
|
2011-10-29 15:24:29 +04:00
|
|
|
* gets called for Messages before options are loaded */
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_charp(theme))
|
2011-10-29 15:24:29 +04:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
strcpy(fullpath, nsoption_charp(theme));
|
2011-10-29 17:32:53 +04:00
|
|
|
found = ami_gui_check_resource(fullpath, file);
|
|
|
|
if(found) return true;
|
2011-10-29 15:24:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If not found, start on the user's preferred languages */
|
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
locale = OpenLocale(NULL);
|
|
|
|
|
|
|
|
for(i=0;i<10;i++)
|
2008-08-09 19:19:04 +04:00
|
|
|
{
|
2011-10-29 15:24:29 +04:00
|
|
|
strcpy(fullpath,"PROGDIR:Resources/");
|
2011-10-29 17:32:53 +04:00
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
if(locale->loc_PrefLanguages[i])
|
|
|
|
{
|
2011-10-29 17:51:19 +04:00
|
|
|
ami_gui_map_filename(&remapped, "PROGDIR:Resources",
|
|
|
|
locale->loc_PrefLanguages[i], "LangNames");
|
|
|
|
path_add_part(fullpath, 1024, remapped);
|
|
|
|
|
2011-10-29 17:32:53 +04:00
|
|
|
found = ami_gui_check_resource(fullpath, file);
|
2008-08-10 00:27:36 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-03-13 21:33:57 +03:00
|
|
|
|
2011-10-29 17:32:53 +04:00
|
|
|
if(found) break;
|
2008-08-10 00:27:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!found)
|
|
|
|
{
|
2011-03-13 21:33:57 +03:00
|
|
|
/* If not found yet, check in PROGDIR:Resources/en,
|
|
|
|
* might not be in user's preferred languages */
|
|
|
|
|
2011-10-29 15:24:29 +04:00
|
|
|
strcpy(fullpath, "PROGDIR:Resources/en/");
|
2011-10-29 17:32:53 +04:00
|
|
|
found = ami_gui_check_resource(fullpath, file);
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
CloseLocale(locale);
|
2011-03-13 21:33:57 +03:00
|
|
|
|
|
|
|
if(!found)
|
|
|
|
{
|
|
|
|
/* Lastly check directly in PROGDIR:Resources */
|
|
|
|
|
2011-10-29 15:24:29 +04:00
|
|
|
strcpy(fullpath, "PROGDIR:Resources/");
|
2011-10-29 17:32:53 +04:00
|
|
|
found = ami_gui_check_resource(fullpath, file);
|
2011-03-13 21:33:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return found;
|
2010-03-24 01:55:56 +03:00
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
void ami_open_resources(void)
|
|
|
|
{
|
|
|
|
/* Allocate ports/ASL and open libraries and devices */
|
2008-08-15 21:19:57 +04:00
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
if(KeymapBase = OpenLibrary("keymap.library",37))
|
|
|
|
{
|
|
|
|
IKeymap = (struct KeymapIFace *)GetInterface(KeymapBase,"main",1,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ApplicationBase = OpenLibrary("application.library",50))
|
|
|
|
{
|
|
|
|
IApplication = (struct ApplicationIFace *)GetInterface(ApplicationBase,"application",1,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
urlStringClass = MakeStringClass();
|
|
|
|
|
|
|
|
if(!(appport = AllocSysObjectTags(ASOT_PORT,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE))) die(messages_get("NoMemory"));
|
|
|
|
|
|
|
|
if(!(sport = AllocSysObjectTags(ASOT_PORT,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE))) die(messages_get("NoMemory"));
|
|
|
|
|
2011-10-15 18:09:35 +04:00
|
|
|
ami_file_req_init();
|
2010-03-24 01:55:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ami_set_options(void)
|
|
|
|
{
|
|
|
|
STRPTR tempacceptlangs;
|
2010-05-06 14:02:58 +04:00
|
|
|
BPTR lock = 0;
|
2012-03-29 02:17:27 +04:00
|
|
|
char temp[1024];
|
2009-08-14 21:53:28 +04:00
|
|
|
|
|
|
|
/* The following line disables the popupmenu.class select menu
|
|
|
|
** This will become a user option when/if popupmenu.class is
|
|
|
|
** updated to show more items than can fit in one column vertically
|
|
|
|
*/
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_bool(core_select_menu, true);
|
2008-12-14 02:25:42 +03:00
|
|
|
|
2011-03-05 14:42:31 +03:00
|
|
|
#ifndef NS_AMIGA_CAIRO
|
|
|
|
/* Ensure we get some output when Cairo not available */
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_int(cairo_renderer, 0);
|
2011-03-05 14:42:31 +03:00
|
|
|
#endif
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if((!nsoption_charp(accept_language)) ||
|
|
|
|
(nsoption_charp(accept_language)[0] == '\0') ||
|
|
|
|
(nsoption_bool(accept_lang_locale) == true))
|
2009-06-22 02:12:52 +04:00
|
|
|
{
|
|
|
|
if(tempacceptlangs = ami_locale_langs())
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_charp(accept_language,
|
|
|
|
(char *)strdup(tempacceptlangs));
|
2009-06-22 02:12:52 +04:00
|
|
|
FreeVec(tempacceptlangs);
|
|
|
|
}
|
|
|
|
}
|
2009-05-09 22:56:12 +04:00
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
sprintf(temp, "%s/Cookies", current_user_dir);
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(cookie_file,
|
2012-03-29 02:17:27 +04:00
|
|
|
(char *)strdup(temp));
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
sprintf(temp, "%s/Hotlist", current_user_dir);
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(hotlist_file,
|
2012-03-29 02:17:27 +04:00
|
|
|
(char *)strdup(temp));
|
2012-03-22 13:34:34 +04:00
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
sprintf(temp, "%s/URLdb", current_user_dir);
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(url_file,
|
2012-03-29 02:17:27 +04:00
|
|
|
(char *)strdup(temp));
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2010-04-22 22:33:29 +04:00
|
|
|
/* devs:curl-ca-bundle.crt is the default place for the ca bundle on OS4,
|
|
|
|
* but we can't rely on it existing, so default to our local one in resources */
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(ca_bundle,
|
|
|
|
(char *)strdup("PROGDIR:Resources/ca-bundle"));
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
|
|
|
|
nsoption_setnull_charp(search_engines_file,
|
|
|
|
(char *)strdup("PROGDIR:Resources/SearchEngines"));
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
search_engines_file_location = nsoption_charp(search_engines_file);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-05-05 19:58:17 +04:00
|
|
|
sprintf(temp, "%s/UnicodeFontCache", current_user_dir);
|
|
|
|
nsoption_setnull_charp(font_unicode_file,
|
|
|
|
(char *)strdup(temp));
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
/* font defaults */
|
|
|
|
nsoption_setnull_charp(font_sans, (char *)strdup("DejaVu Sans"));
|
|
|
|
nsoption_setnull_charp(font_serif, (char *)strdup("DejaVu Serif"));
|
|
|
|
nsoption_setnull_charp(font_mono, (char *)strdup("DejaVu Sans Mono"));
|
|
|
|
nsoption_setnull_charp(font_cursive, (char *)strdup("DejaVu Sans"));
|
|
|
|
nsoption_setnull_charp(font_fantasy, (char *)strdup("DejaVu Serif"));
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_charp(font_unicode) == NULL)
|
2010-05-06 14:02:58 +04:00
|
|
|
{
|
|
|
|
/* Search for some likely candidates */
|
|
|
|
|
|
|
|
if(lock=Lock("FONTS:Code2000.font",ACCESS_READ))
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_charp(font_unicode,
|
|
|
|
(char *)strdup("Code2000"));
|
2010-05-06 14:02:58 +04:00
|
|
|
}
|
|
|
|
else if(lock=Lock("FONTS:Bitstream Cyberbit.font",ACCESS_READ))
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_charp(font_unicode,
|
|
|
|
(char *)strdup("Bitstream Cyberbit"));
|
|
|
|
}
|
2010-05-06 14:02:58 +04:00
|
|
|
}
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(theme,
|
|
|
|
(char *)strdup("PROGDIR:Resources/Themes/Default"));
|
Added ability to load toolbar images from a different path.
Default is still TBImages: (ie AISS, http://www.masonicons.de)
All of the following must be present, in any format that bitmap.image will load
(usually this means any picture.datatype subclasses):
home, home_g, home_s - Home button
nav_east, nav_east_g, nav_east_s - History forward
nav_west, nav_west_g, nav_west_s - History back
reload, reload_g, reload_s - Reload
stop, stop_g, stop_s - Stop
The _g and _s files are ghosted and selected versions respectively.
To set the path, use toolbar_images:<path> in Options.
svn path=/trunk/netsurf/; revision=5304
2008-09-12 01:32:55 +04:00
|
|
|
|
2011-01-20 17:05:13 +03:00
|
|
|
tree_set_icon_dir(strdup("ENV:Sys"));
|
2010-10-29 22:05:48 +04:00
|
|
|
|
2010-08-29 03:46:08 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(arexx_dir, (char *)strdup("Rexx"));
|
2010-08-29 03:46:08 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(arexx_startup, (char *)strdup("Startup.nsrx"));
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(arexx_shutdown, (char *)strdup("Shutdown.nsrx"));
|
|
|
|
|
|
|
|
if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800);
|
|
|
|
if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600);
|
2010-03-24 01:55:56 +03:00
|
|
|
}
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
void ami_amiupdate(void)
|
|
|
|
{
|
2011-04-22 17:55:25 +04:00
|
|
|
/* Create AppPath location for AmiUpdate use */
|
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
BPTR lock = 0, amiupdatefh = 0;
|
2011-04-22 17:55:25 +04:00
|
|
|
|
2008-10-13 22:01:25 +04:00
|
|
|
if(((lock = Lock("ENVARC:AppPaths",SHARED_LOCK)) == 0))
|
|
|
|
{
|
|
|
|
lock = CreateDir("ENVARC:AppPaths");
|
|
|
|
}
|
|
|
|
|
|
|
|
UnLock(lock);
|
|
|
|
|
2011-04-22 17:55:25 +04:00
|
|
|
if(lock = Lock("PROGDIR:", ACCESS_READ))
|
2008-10-13 22:01:25 +04:00
|
|
|
{
|
|
|
|
char filename[1024];
|
|
|
|
|
|
|
|
DevNameFromLock(lock,(STRPTR)&filename,1024L,DN_FULLPATH);
|
|
|
|
|
|
|
|
amiupdatefh = FOpen("ENVARC:AppPaths/NetSurf",MODE_NEWFILE,0);
|
|
|
|
FPuts(amiupdatefh,(CONST_STRPTR)&filename);
|
|
|
|
FClose(amiupdatefh);
|
2011-04-22 17:55:25 +04:00
|
|
|
UnLock(lock);
|
2008-10-13 22:01:25 +04:00
|
|
|
}
|
2010-03-24 01:55:56 +03:00
|
|
|
}
|
|
|
|
|
2011-10-05 12:32:52 +04:00
|
|
|
nsurl *gui_get_resource_url(const char *path)
|
2011-02-24 01:27:55 +03:00
|
|
|
{
|
2011-10-05 12:32:52 +04:00
|
|
|
char buf[1024];
|
|
|
|
char path2[1024];
|
|
|
|
char *raw;
|
|
|
|
nsurl *url = NULL;
|
2011-02-24 02:29:24 +03:00
|
|
|
|
2011-10-05 12:32:52 +04:00
|
|
|
if(ami_locate_resource(buf, path) == false)
|
2011-03-13 21:33:57 +03:00
|
|
|
{
|
2011-10-05 12:32:52 +04:00
|
|
|
if((strncmp(path + strlen(path) - SLEN(".htm"), ".htm", SLEN(".htm")) == 0) ||
|
|
|
|
(strncmp(path + strlen(path) - SLEN(".html"), ".html", SLEN(".html")) == 0))
|
2011-03-13 21:33:57 +03:00
|
|
|
{
|
2011-03-14 21:53:13 +03:00
|
|
|
/* Try with RISC OS HTML filetype, might work */
|
2011-10-05 12:32:52 +04:00
|
|
|
strcpy(path2, path);
|
|
|
|
strcat(path2, ",faf");
|
2011-03-14 21:53:13 +03:00
|
|
|
|
2011-10-05 12:32:52 +04:00
|
|
|
if(ami_locate_resource(buf, path2) == false)
|
2011-03-14 21:53:13 +03:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-03-13 21:33:57 +03:00
|
|
|
}
|
2011-03-14 21:53:13 +03:00
|
|
|
else return NULL;
|
2011-03-13 21:33:57 +03:00
|
|
|
}
|
2011-02-24 02:29:24 +03:00
|
|
|
|
2011-10-05 12:32:52 +04:00
|
|
|
raw = path_to_url(buf);
|
|
|
|
if (raw != NULL) {
|
|
|
|
nsurl_create(raw, &url);
|
|
|
|
free(raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
2011-02-24 01:27:55 +03:00
|
|
|
}
|
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
void gui_init(int argc, char** argv)
|
|
|
|
{
|
|
|
|
BPTR lock = 0;
|
|
|
|
|
|
|
|
ami_open_resources(); /* alloc ports/asl reqs, open libraries/devices */
|
|
|
|
ami_print_init();
|
|
|
|
ami_clipboard_init();
|
2010-04-03 14:24:43 +04:00
|
|
|
ami_openurl_open();
|
2010-03-24 01:55:56 +03:00
|
|
|
|
|
|
|
ami_set_options(); /* check options and set defaults where required */
|
|
|
|
|
|
|
|
win_destroyed = false;
|
|
|
|
nsscreentitle = ASPrintf("NetSurf %s",netsurf_version);
|
|
|
|
|
2011-04-22 21:17:05 +04:00
|
|
|
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
|
|
|
|
|
2010-03-24 01:55:56 +03:00
|
|
|
ami_amiupdate(); /* set env-vars for AmiUpdate */
|
|
|
|
ami_init_fonts();
|
|
|
|
|
2011-06-18 21:40:27 +04:00
|
|
|
ami_context_menu_init();
|
2008-08-25 17:32:26 +04:00
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
window_list = NewObjList();
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
urldb_load(nsoption_charp(url_file));
|
|
|
|
urldb_load_cookies(nsoption_charp(cookie_file));
|
2008-10-13 22:01:25 +04:00
|
|
|
|
2008-11-09 02:08:55 +03:00
|
|
|
save_complete_init();
|
2010-03-24 01:27:33 +03:00
|
|
|
ami_theme_init();
|
2008-12-14 02:25:42 +03:00
|
|
|
ami_init_mouse_pointers();
|
2010-03-24 01:27:33 +03:00
|
|
|
ami_theme_throbber_setup();
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2012-04-07 21:16:32 +04:00
|
|
|
static void ami_gui_newprefs_hook(struct Hook *hook, APTR window, APTR reserved)
|
|
|
|
{
|
|
|
|
gui_system_colour_finalize();
|
|
|
|
gui_system_colour_init();
|
|
|
|
}
|
|
|
|
|
2009-07-04 20:12:27 +04:00
|
|
|
void ami_openscreen(void)
|
|
|
|
{
|
|
|
|
ULONG id = 0;
|
2012-02-25 00:00:51 +04:00
|
|
|
ULONG compositing;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_int(screen_compositing) == -1)
|
2012-02-25 00:00:51 +04:00
|
|
|
compositing = ~0UL;
|
2012-03-22 13:34:34 +04:00
|
|
|
else compositing = nsoption_int(screen_compositing);
|
2012-02-25 00:00:51 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_charp(use_pubscreen) == NULL)
|
2009-07-04 20:12:27 +04:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_charp(modeid)) &&
|
|
|
|
(strncmp(nsoption_charp(modeid), "0x", 2) == 0))
|
2009-07-04 20:12:27 +04:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
id = strtoul(nsoption_charp(modeid), NULL, 0);
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct ScreenModeRequester *screenmodereq = NULL;
|
|
|
|
|
|
|
|
if(screenmodereq = AllocAslRequest(ASL_ScreenModeRequest,NULL))
|
|
|
|
{
|
2010-03-24 01:55:56 +03:00
|
|
|
if(AslRequestTags(screenmodereq,
|
2009-07-05 22:15:55 +04:00
|
|
|
ASLSM_MinDepth,16,
|
2009-07-04 20:12:27 +04:00
|
|
|
ASLSM_MaxDepth,32,
|
2010-03-24 01:55:56 +03:00
|
|
|
TAG_DONE))
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
char *modeid = malloc(20);
|
2010-03-24 01:55:56 +03:00
|
|
|
id = screenmodereq->sm_DisplayID;
|
2012-03-22 13:34:34 +04:00
|
|
|
sprintf(modeid, "0x%lx", id);
|
|
|
|
nsoption_set_charp(modeid, modeid);
|
2012-03-29 02:17:27 +04:00
|
|
|
nsoption_write(current_user_options);
|
2010-03-24 01:55:56 +03:00
|
|
|
}
|
2009-07-04 20:12:27 +04:00
|
|
|
FreeAslRequest(screenmodereq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scrn = OpenScreenTags(NULL,
|
2011-06-18 21:58:36 +04:00
|
|
|
SA_DisplayID, id,
|
|
|
|
SA_Title, nsscreentitle,
|
|
|
|
SA_Type, PUBLICSCREEN,
|
|
|
|
SA_PubName, "NetSurf",
|
|
|
|
SA_LikeWorkbench, TRUE,
|
2012-02-25 00:00:51 +04:00
|
|
|
SA_Compositing, compositing,
|
2009-07-04 20:12:27 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
if(scrn)
|
|
|
|
{
|
|
|
|
PubScreenStatus(scrn,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(scrn = LockPubScreen("NetSurf"))
|
|
|
|
{
|
|
|
|
locked_screen = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_charp(use_pubscreen,
|
|
|
|
strdup("Workbench"));
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_charp(use_pubscreen) != NULL)
|
2009-07-04 20:12:27 +04:00
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
scrn = LockPubScreen(nsoption_charp(use_pubscreen));
|
2011-06-19 15:16:48 +04:00
|
|
|
|
|
|
|
if(scrn == NULL)
|
2009-07-04 20:12:27 +04:00
|
|
|
{
|
|
|
|
scrn = LockPubScreen("Workbench");
|
|
|
|
}
|
2011-06-19 15:16:48 +04:00
|
|
|
locked_screen = TRUE;
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
2009-08-29 03:12:18 +04:00
|
|
|
dri = GetScreenDrawInfo(scrn);
|
2011-04-22 20:54:11 +04:00
|
|
|
ami_font_setdevicedpi(id);
|
2011-01-30 20:30:32 +03:00
|
|
|
|
|
|
|
gui_system_colour_finalize();
|
|
|
|
gui_system_colour_init();
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
void ami_openscreenfirst(void)
|
|
|
|
{
|
|
|
|
ami_openscreen();
|
2009-10-03 15:00:10 +04:00
|
|
|
if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0);
|
2009-09-29 02:17:09 +04:00
|
|
|
}
|
|
|
|
|
2010-03-29 20:59:30 +04:00
|
|
|
static void gui_init2(int argc, char** argv)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-11-16 17:42:40 +03:00
|
|
|
struct browser_window *bw = NULL;
|
2008-09-29 02:50:13 +04:00
|
|
|
struct RDArgs *args;
|
2008-11-09 02:08:55 +03:00
|
|
|
STRPTR temp_homepage_url = NULL;
|
2008-11-16 17:42:40 +03:00
|
|
|
BOOL notalreadyrunning;
|
2011-05-30 22:17:09 +04:00
|
|
|
STRPTR template = "NSOPTS/M,URL/K,FORCE/S";
|
|
|
|
long rarray[] = {0,0,0};
|
2008-09-29 02:50:13 +04:00
|
|
|
enum
|
|
|
|
{
|
2011-05-30 22:17:09 +04:00
|
|
|
A_NSOPTS, /* ignored */
|
2010-03-28 20:42:33 +04:00
|
|
|
A_URL,
|
|
|
|
A_FORCE
|
2008-09-29 02:50:13 +04:00
|
|
|
};
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
notalreadyrunning = ami_arexx_init();
|
2008-11-15 18:28:17 +03:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* Treeview init code ends up calling a font function which needs this */
|
|
|
|
glob = &browserglob;
|
|
|
|
/**/
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
ami_hotlist_initialise(nsoption_charp(hotlist_file));
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_cookies_initialise();
|
|
|
|
ami_global_history_initialise();
|
2010-12-14 03:18:24 +03:00
|
|
|
sslcert_init(tree_content_icon_name);
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
search_web_provider_details(nsoption_int(search_provider));
|
2009-12-22 02:25:35 +03:00
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
if(argc) // argc==0 is started from wb
|
2008-11-09 02:08:55 +03:00
|
|
|
{
|
2008-11-16 17:42:40 +03:00
|
|
|
if(args = ReadArgs(template,rarray,NULL))
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
if (notalreadyrunning &&
|
|
|
|
(nsoption_bool(startup_no_window) == false))
|
2010-04-01 21:44:42 +04:00
|
|
|
ami_openscreenfirst();
|
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
if(rarray[A_URL])
|
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
temp_homepage_url = (char *)strdup((char *)rarray[A_URL]);
|
2010-04-01 21:44:42 +04:00
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
if(notalreadyrunning)
|
|
|
|
{
|
|
|
|
bw = browser_window_create(temp_homepage_url, 0, 0, true,false);
|
|
|
|
free(temp_homepage_url);
|
|
|
|
}
|
|
|
|
}
|
2010-03-28 20:42:33 +04:00
|
|
|
|
|
|
|
if(rarray[A_FORCE])
|
|
|
|
{
|
|
|
|
notalreadyrunning = TRUE;
|
|
|
|
}
|
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
FreeArgs(args);
|
|
|
|
}
|
2008-11-09 02:08:55 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-16 17:42:40 +03:00
|
|
|
struct WBStartup *WBenchMsg = (struct WBStartup *)argv;
|
|
|
|
struct WBArg *wbarg;
|
|
|
|
int first=0,i=0;
|
|
|
|
char fullpath[1024];
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (notalreadyrunning &&
|
|
|
|
(nsoption_bool(startup_no_window) == false))
|
2010-04-01 21:44:42 +04:00
|
|
|
ami_openscreenfirst();
|
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
for(i=0,wbarg=WBenchMsg->sm_ArgList;i<WBenchMsg->sm_NumArgs;i++,wbarg++)
|
|
|
|
{
|
|
|
|
if(i==0) continue;
|
|
|
|
if((wbarg->wa_Lock)&&(*wbarg->wa_Name))
|
|
|
|
{
|
2009-03-15 14:21:46 +03:00
|
|
|
DevNameFromLock(wbarg->wa_Lock,fullpath,1024,DN_FULLPATH);
|
|
|
|
AddPart(fullpath,wbarg->wa_Name,1024);
|
2008-11-16 17:42:40 +03:00
|
|
|
|
|
|
|
if(!temp_homepage_url) temp_homepage_url = path_to_url(fullpath);
|
|
|
|
|
|
|
|
if(notalreadyrunning)
|
|
|
|
{
|
|
|
|
if(!first)
|
|
|
|
{
|
|
|
|
bw = browser_window_create(temp_homepage_url, 0, 0, true,false);
|
|
|
|
first=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bw = browser_window_create(temp_homepage_url, bw, 0, true,false);
|
|
|
|
}
|
|
|
|
free(temp_homepage_url);
|
|
|
|
temp_homepage_url = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE));
|
2008-11-16 17:42:40 +03:00
|
|
|
|
|
|
|
if(!notalreadyrunning)
|
|
|
|
{
|
|
|
|
STRPTR sendcmd = NULL;
|
|
|
|
|
|
|
|
if(temp_homepage_url)
|
|
|
|
{
|
|
|
|
sendcmd = ASPrintf("OPEN \"%s\" NEW",temp_homepage_url);
|
|
|
|
free(temp_homepage_url);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
sendcmd = ASPrintf("OPEN \"%s\" NEW",nsoption_charp(homepage_url));
|
2008-11-16 17:42:40 +03:00
|
|
|
}
|
|
|
|
IDoMethod(arexx_obj,AM_EXECUTE,sendcmd,"NETSURF",NULL,NULL,NULL,NULL);
|
|
|
|
IDoMethod(arexx_obj,AM_EXECUTE,"TOFRONT","NETSURF",NULL,NULL,NULL,NULL);
|
|
|
|
FreeVec(sendcmd);
|
2011-06-19 15:16:48 +04:00
|
|
|
|
2008-11-16 17:42:40 +03:00
|
|
|
netsurf_quit=true;
|
|
|
|
return;
|
2008-11-09 02:08:55 +03:00
|
|
|
}
|
2008-11-16 17:42:40 +03:00
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
if(IApplication)
|
|
|
|
{
|
2010-02-22 22:18:27 +03:00
|
|
|
ULONG desc = REGAPP_Description;
|
|
|
|
if(ApplicationBase->lib_Version < 53) desc = TAG_IGNORE;
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(argc == 0)
|
|
|
|
{
|
2010-02-22 00:24:58 +03:00
|
|
|
ULONG noicon = TAG_IGNORE;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_bool(hide_docky_icon))
|
|
|
|
noicon = REGAPP_NoIcon;
|
2009-12-13 15:14:43 +03:00
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
ami_appid = RegisterApplication(messages_get("NetSurf"),
|
|
|
|
REGAPP_URLIdentifier, "netsurf-browser.org",
|
|
|
|
REGAPP_WBStartup, (struct WBStartup *)argv,
|
2009-12-13 15:14:43 +03:00
|
|
|
noicon, TRUE,
|
2009-09-29 02:17:09 +04:00
|
|
|
REGAPP_HasPrefsWindow, TRUE,
|
|
|
|
REGAPP_CanCreateNewDocs, TRUE,
|
|
|
|
REGAPP_UniqueApplication, TRUE,
|
2010-02-22 00:24:58 +03:00
|
|
|
desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
|
2009-09-29 02:17:09 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TODO: Specify icon when run from Shell */
|
|
|
|
ami_appid = RegisterApplication(messages_get("NetSurf"),
|
|
|
|
REGAPP_URLIdentifier, "netsurf-browser.org",
|
|
|
|
REGAPP_FileName, argv[0],
|
|
|
|
REGAPP_NoIcon, TRUE,
|
|
|
|
REGAPP_HasPrefsWindow, TRUE,
|
|
|
|
REGAPP_CanCreateNewDocs, TRUE,
|
|
|
|
REGAPP_UniqueApplication, TRUE,
|
2010-02-22 00:24:58 +03:00
|
|
|
desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
|
2009-09-29 02:17:09 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
2009-09-28 22:00:40 +04:00
|
|
|
|
|
|
|
GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE);
|
2010-03-28 20:42:33 +04:00
|
|
|
if(applibport) applibsig = (1L << applibport->mp_SigBit);
|
2009-09-28 22:00:40 +04:00
|
|
|
}
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(!bw && (nsoption_bool(startup_no_window) == false))
|
|
|
|
bw = browser_window_create(nsoption_charp(homepage_url), 0, 0, true,false);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2010-03-29 20:59:30 +04:00
|
|
|
/** Normal entry point from OS */
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
setbuf(stderr, NULL);
|
2010-03-30 00:03:44 +04:00
|
|
|
char messages[100];
|
2010-08-29 03:46:08 +04:00
|
|
|
char script[1024];
|
2012-03-29 02:17:27 +04:00
|
|
|
char temp[1024];
|
2012-03-30 22:18:15 +04:00
|
|
|
BPTR lock = 0;
|
|
|
|
int32 user = 0;
|
2011-05-08 02:21:41 +04:00
|
|
|
|
|
|
|
Object *splash_window = ami_gui_splash_open();
|
2010-03-30 00:03:44 +04:00
|
|
|
|
2012-03-30 22:18:15 +04:00
|
|
|
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
|
|
|
|
current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
|
2012-03-29 02:17:27 +04:00
|
|
|
current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
|
2012-03-30 22:18:15 +04:00
|
|
|
|
|
|
|
if(lock = CreateDirTree(current_user_dir))
|
|
|
|
UnLock(lock);
|
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
current_user_options = ASPrintf("%s/Choices", current_user_dir);
|
|
|
|
|
2011-03-13 21:33:57 +03:00
|
|
|
if(ami_locate_resource(messages, "Messages") == false)
|
|
|
|
die("Cannot open Messages file");
|
|
|
|
|
2011-05-10 02:11:18 +04:00
|
|
|
ami_mime_init("PROGDIR:Resources/mimetypes");
|
2012-03-29 02:17:27 +04:00
|
|
|
sprintf(temp, "%s/mimetypes.user", current_user_dir);
|
|
|
|
ami_mime_init(temp);
|
2011-03-13 22:26:16 +03:00
|
|
|
ami_schedule_open_timer();
|
|
|
|
ami_schedule_create();
|
|
|
|
|
2011-05-10 02:11:18 +04:00
|
|
|
amiga_plugin_hack_init();
|
2011-05-07 02:42:37 +04:00
|
|
|
amiga_datatypes_init();
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2012-03-29 02:17:27 +04:00
|
|
|
netsurf_init(&argc, &argv, current_user_options, messages);
|
2010-03-29 20:59:30 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
amiga_icon_init();
|
|
|
|
|
2010-03-30 00:03:44 +04:00
|
|
|
gui_init(argc, argv);
|
2010-03-29 20:59:30 +04:00
|
|
|
gui_init2(argc, argv);
|
|
|
|
|
2011-05-08 02:21:41 +04:00
|
|
|
ami_gui_splash_close(splash_window);
|
|
|
|
|
2012-04-18 22:54:15 +04:00
|
|
|
strlcpy(script, nsoption_charp(arexx_dir), 1024);
|
2012-03-22 13:34:34 +04:00
|
|
|
AddPart(script, nsoption_charp(arexx_startup), 1024);
|
2010-08-29 03:46:08 +04:00
|
|
|
ami_arexx_execute(script);
|
|
|
|
|
2010-03-29 20:59:30 +04:00
|
|
|
netsurf_main_loop();
|
|
|
|
|
2012-04-18 22:54:15 +04:00
|
|
|
strlcpy(script, nsoption_charp(arexx_dir), 1024);
|
2012-03-22 13:34:34 +04:00
|
|
|
AddPart(script, nsoption_charp(arexx_shutdown), 1024);
|
2010-08-29 03:46:08 +04:00
|
|
|
ami_arexx_execute(script);
|
|
|
|
|
2010-03-29 20:59:30 +04:00
|
|
|
netsurf_exit();
|
|
|
|
|
2011-05-10 02:11:18 +04:00
|
|
|
ami_mime_free();
|
|
|
|
|
2010-03-29 20:59:30 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-03 22:08:17 +04:00
|
|
|
void ami_gui_history(struct gui_window_2 *gwin, bool back)
|
|
|
|
{
|
|
|
|
if(back == true)
|
|
|
|
{
|
|
|
|
if(browser_window_back_available(gwin->bw))
|
|
|
|
history_back(gwin->bw, gwin->bw->history);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(browser_window_forward_available(gwin->bw))
|
|
|
|
history_forward(gwin->bw, gwin->bw->history);
|
|
|
|
}
|
|
|
|
|
|
|
|
ami_update_buttons(gwin);
|
|
|
|
}
|
|
|
|
|
2009-11-03 02:02:53 +03:00
|
|
|
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie)
|
|
|
|
{
|
|
|
|
int nskey = 0, chars;
|
|
|
|
UBYTE buffer[20];
|
2011-09-13 01:56:15 +04:00
|
|
|
char *utf8 = NULL;
|
2009-11-03 02:02:53 +03:00
|
|
|
|
|
|
|
if(keycode >= IECODE_UP_PREFIX) return 0;
|
|
|
|
|
|
|
|
switch(keycode)
|
|
|
|
{
|
|
|
|
case RAWKEY_CRSRUP:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_PAGE_UP;
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
nskey = KEY_TEXT_START;
|
|
|
|
}
|
|
|
|
else nskey = KEY_UP;
|
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRDOWN:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_PAGE_DOWN;
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
nskey = KEY_TEXT_END;
|
|
|
|
}
|
|
|
|
else nskey = KEY_DOWN;
|
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRLEFT:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_LINE_START;
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
nskey = KEY_WORD_LEFT;
|
|
|
|
}
|
|
|
|
else nskey = KEY_LEFT;
|
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRRIGHT:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_LINE_END;
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
nskey = KEY_WORD_RIGHT;
|
|
|
|
}
|
|
|
|
else nskey = KEY_RIGHT;
|
|
|
|
break;
|
|
|
|
case RAWKEY_ESC:
|
|
|
|
nskey = KEY_ESCAPE;
|
|
|
|
break;
|
|
|
|
case RAWKEY_PAGEUP:
|
|
|
|
nskey = KEY_PAGE_UP;
|
|
|
|
break;
|
|
|
|
case RAWKEY_PAGEDOWN:
|
|
|
|
nskey = KEY_PAGE_DOWN;
|
|
|
|
break;
|
|
|
|
case RAWKEY_HOME:
|
|
|
|
nskey = KEY_TEXT_START;
|
|
|
|
break;
|
|
|
|
case RAWKEY_END:
|
|
|
|
nskey = KEY_TEXT_END;
|
|
|
|
break;
|
|
|
|
case RAWKEY_BACKSPACE:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_DELETE_LINE_START;
|
|
|
|
}
|
|
|
|
else nskey = KEY_DELETE_LEFT;
|
|
|
|
break;
|
|
|
|
case RAWKEY_DEL:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_DELETE_LINE_END;
|
|
|
|
}
|
|
|
|
else nskey = KEY_DELETE_RIGHT;
|
|
|
|
break;
|
|
|
|
case RAWKEY_TAB:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
nskey = KEY_SHIFT_TAB;
|
|
|
|
}
|
|
|
|
else nskey = KEY_TAB;
|
|
|
|
break;
|
2009-11-04 11:06:52 +03:00
|
|
|
case RAWKEY_F5:
|
|
|
|
// don't translate
|
|
|
|
nskey = keycode;
|
|
|
|
break;
|
2009-11-03 02:02:53 +03:00
|
|
|
default:
|
|
|
|
if((chars = MapRawKey(ie,buffer,20,NULL)) > 0)
|
|
|
|
{
|
2011-09-13 01:56:15 +04:00
|
|
|
utf8_from_local_encoding(buffer, chars, &utf8);
|
|
|
|
nskey = utf8_to_ucs4(utf8, utf8_char_byte_length(utf8));
|
2009-11-03 02:02:53 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nskey;
|
|
|
|
}
|
|
|
|
|
2009-01-11 00:31:21 +03:00
|
|
|
void ami_update_quals(struct gui_window_2 *gwin)
|
|
|
|
{
|
2009-01-11 02:10:54 +03:00
|
|
|
uint32 quals = 0;
|
|
|
|
|
|
|
|
GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals);
|
2009-01-11 00:31:21 +03:00
|
|
|
|
|
|
|
gwin->key_state = 0;
|
|
|
|
|
|
|
|
if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
|
|
|
|
{
|
|
|
|
gwin->key_state |= BROWSER_MOUSE_MOD_1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(quals & IEQUALIFIER_CONTROL)
|
|
|
|
{
|
|
|
|
gwin->key_state |= BROWSER_MOUSE_MOD_2;
|
|
|
|
}
|
2009-09-01 01:48:57 +04:00
|
|
|
|
|
|
|
if((quals & IEQUALIFIER_LALT) || (quals & IEQUALIFIER_RALT))
|
|
|
|
{
|
|
|
|
gwin->key_state |= BROWSER_MOUSE_MOD_3;
|
|
|
|
}
|
2009-01-11 00:31:21 +03:00
|
|
|
}
|
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
|
|
|
|
int mouse_x, int mouse_y)
|
2011-11-30 00:58:57 +04:00
|
|
|
{
|
|
|
|
int xs, ys;
|
|
|
|
int ns_x, ns_y;
|
|
|
|
struct IBox *bbox;
|
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
if(mouse_x == -1) mouse_x = gwin->win->MouseX;
|
|
|
|
if(mouse_y == -1) mouse_y = gwin->win->MouseY;
|
|
|
|
|
2011-11-30 00:58:57 +04:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
|
|
|
|
(ULONG *)&bbox);
|
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
ns_x = (ULONG)(mouse_x - bbox->Left);
|
|
|
|
ns_y = (ULONG)(mouse_y - bbox->Top);
|
2011-11-30 00:58:57 +04:00
|
|
|
|
|
|
|
if((ns_x < 0) || (ns_x > bbox->Width) || (ns_y < 0) || (ns_y > bbox->Height))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
ns_x /= gwin->bw->scale;
|
|
|
|
ns_y /= gwin->bw->scale;
|
|
|
|
|
|
|
|
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
|
|
|
|
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
|
|
|
|
|
|
|
|
ns_x += xs;
|
|
|
|
ns_y += ys;
|
|
|
|
|
|
|
|
*x = ns_x;
|
|
|
|
*y = ns_y;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-12-24 02:14:00 +04:00
|
|
|
void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
|
|
|
|
{
|
|
|
|
struct IBox *bbox;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
GetAttr(SPACE_AreaBox,
|
|
|
|
(Object *)gwin->objects[GID_BROWSER],
|
|
|
|
(ULONG *)&bbox);
|
|
|
|
|
|
|
|
if(ami_mouse_to_ns_coords(gwin, &x, &y, -1, -1) == true)
|
|
|
|
{
|
|
|
|
if(browser_window_scroll_at_point(gwin->bw, x, y,
|
|
|
|
xs, ys) == false)
|
|
|
|
{
|
|
|
|
gui_window_get_scroll(gwin->bw->window,
|
|
|
|
&gwin->bw->window->scrollx,
|
|
|
|
&gwin->bw->window->scrolly);
|
|
|
|
|
|
|
|
switch(xs)
|
|
|
|
{
|
|
|
|
case SCROLL_PAGE_UP:
|
|
|
|
xs = gwin->bw->window->scrollx - bbox->Width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_PAGE_DOWN:
|
|
|
|
xs = gwin->bw->window->scrollx + bbox->Width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_TOP:
|
|
|
|
xs = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_BOTTOM:
|
|
|
|
xs = content_get_width(gwin->bw->current_content);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
xs += gwin->bw->window->scrollx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(ys)
|
|
|
|
{
|
|
|
|
case SCROLL_PAGE_UP:
|
|
|
|
ys = gwin->bw->window->scrolly - bbox->Height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_PAGE_DOWN:
|
|
|
|
ys = gwin->bw->window->scrolly + bbox->Height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_TOP:
|
|
|
|
ys = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCROLL_BOTTOM:
|
|
|
|
ys = content_get_height(gwin->bw->current_content);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ys += gwin->bw->window->scrolly;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_window_set_scroll(gwin->bw->window, xs, ys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-12 01:41:55 +04:00
|
|
|
struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct rect *rect)
|
|
|
|
{
|
|
|
|
struct IBox *bbox, *ibox;
|
|
|
|
|
|
|
|
ibox = AllocVec(sizeof(struct IBox), MEMF_CLEAR | MEMF_PRIVATE);
|
|
|
|
if(ibox == NULL) return NULL;
|
|
|
|
|
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox);
|
|
|
|
|
|
|
|
ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->bw->scale);
|
|
|
|
ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->bw->scale);
|
|
|
|
|
|
|
|
ibox->Width = (rect->x1 - rect->x0) * gwin->bw->scale;
|
|
|
|
ibox->Height = (rect->y1 - rect->y0) * gwin->bw->scale;
|
|
|
|
|
|
|
|
if(ibox->Left < bbox->Left) ibox->Left = bbox->Left;
|
|
|
|
if(ibox->Top < bbox->Top) ibox->Top = bbox->Top;
|
|
|
|
|
|
|
|
if((ibox->Left > (bbox->Left + bbox->Width)) ||
|
|
|
|
(ibox->Top > (bbox->Top + bbox->Height)) ||
|
|
|
|
(ibox->Width < 0) || (ibox->Height < 0))
|
|
|
|
{
|
|
|
|
FreeVec(ibox);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ibox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_gui_trap_mouse(struct gui_window_2 *gwin)
|
|
|
|
{
|
|
|
|
switch(gwin->drag_op)
|
|
|
|
{
|
|
|
|
case GDRAGGING_NONE:
|
|
|
|
case GDRAGGING_SCROLLBAR:
|
|
|
|
case GDRAGGING_OTHER:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if(gwin->ptr_lock)
|
|
|
|
{
|
|
|
|
SetWindowAttrs(gwin->win, WA_GrabFocus, 10,
|
|
|
|
WA_MouseLimits, gwin->ptr_lock, TAG_DONE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
void ami_handle_msg(void)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
|
|
|
struct IntuiMessage *message = NULL;
|
2008-08-19 22:31:56 +04:00
|
|
|
ULONG class,result,storage = 0,x,y,xs,ys,width=800,height=600;
|
2009-01-11 00:31:21 +03:00
|
|
|
uint16 code,quals;
|
2008-08-11 21:53:45 +04:00
|
|
|
struct IBox *bbox;
|
2008-08-09 19:19:04 +04:00
|
|
|
struct nsObject *node;
|
|
|
|
struct nsObject *nnode;
|
2011-06-18 21:40:27 +04:00
|
|
|
struct gui_window_2 *gwin = NULL;
|
2008-08-19 22:31:56 +04:00
|
|
|
struct MenuItem *item;
|
2008-09-28 17:55:40 +04:00
|
|
|
struct InputEvent *ie;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct Node *tabnode;
|
2009-11-03 02:02:53 +03:00
|
|
|
int i, nskey;
|
2010-02-14 03:46:53 +03:00
|
|
|
struct browser_window *closedbw;
|
2010-12-17 02:28:33 +03:00
|
|
|
struct timeval curtime;
|
2010-12-19 02:34:56 +03:00
|
|
|
static int drag_x_move = 0, drag_y_move = 0;
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-12-06 13:43:25 +03:00
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* no windows in list, so NetSurf should not be running */
|
2009-10-03 15:00:10 +04:00
|
|
|
ami_try_quit();
|
2008-12-06 13:43:25 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-06 22:20:16 +04:00
|
|
|
node = (struct nsObject *)GetHead((struct List *)window_list);
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-10-06 22:20:16 +04:00
|
|
|
do
|
2008-08-09 02:38:13 +04:00
|
|
|
{
|
2008-10-06 22:20:16 +04:00
|
|
|
nnode=(struct nsObject *)GetSucc((struct Node *)node);
|
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
gwin = node->objstruct;
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
if(node->Type == AMINS_TVWINDOW)
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
if(ami_tree_event((struct treeview_window *)gwin))
|
2008-09-28 17:55:40 +04:00
|
|
|
{
|
2008-09-28 18:40:19 +04:00
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
2009-10-03 15:00:10 +04:00
|
|
|
ami_try_quit();
|
2008-09-28 18:40:19 +04:00
|
|
|
}
|
2008-09-28 17:55:40 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2008-12-14 02:25:42 +03:00
|
|
|
else if(node->Type == AMINS_FINDWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_search_event())
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
2009-10-03 15:00:10 +04:00
|
|
|
ami_try_quit();
|
2008-12-14 02:25:42 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2009-03-08 15:52:44 +03:00
|
|
|
else if(node->Type == AMINS_HISTORYWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_history_event((struct history_window *)gwin))
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
2009-10-03 15:00:10 +04:00
|
|
|
ami_try_quit();
|
2009-03-08 15:52:44 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2009-11-01 17:53:04 +03:00
|
|
|
else if(node->Type == AMINS_PRINTWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_print_event((struct ami_print_window *)gwin))
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
|
|
|
ami_try_quit();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2009-06-21 02:29:43 +04:00
|
|
|
else if(node->Type == AMINS_GUIOPTSWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_gui_opts_event())
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
2009-09-29 22:24:19 +04:00
|
|
|
/* last window closed, so exit with conditions ;) */
|
2009-10-03 15:00:10 +04:00
|
|
|
if(scrn) ami_try_quit();
|
2009-06-21 02:29:43 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2010-04-10 02:38:51 +04:00
|
|
|
else if(node->Type == AMINS_DLWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_download_window_event((struct gui_download_window *)gwin))
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
|
|
|
ami_try_quit();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(node->Type == AMINS_LOGINWINDOW)
|
|
|
|
{
|
|
|
|
if(ami_401login_event((struct gui_login_window *)gwin))
|
|
|
|
{
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
|
|
|
ami_try_quit();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = nnode;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2008-09-28 17:55:40 +04:00
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
while((result = RA_HandleInput(gwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
|
|
|
|
{
|
2012-04-29 19:59:37 +04:00
|
|
|
//printf("%ld: %ld (switch)\n",code, result & WMHI_CLASSMASK);
|
2008-08-09 19:19:04 +04:00
|
|
|
switch(result & WMHI_CLASSMASK) // class
|
2008-09-05 02:41:26 +04:00
|
|
|
{
|
2008-08-09 19:19:04 +04:00
|
|
|
case WMHI_MOUSEMOVE:
|
2012-01-12 01:41:55 +04:00
|
|
|
ami_gui_trap_mouse(gwin); /* re-assert mouse area */
|
|
|
|
|
2010-12-19 02:34:56 +03:00
|
|
|
drag_x_move = 0;
|
|
|
|
drag_y_move = 0;
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
|
|
|
|
(ULONG *)&bbox);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2009-09-04 22:10:15 +04:00
|
|
|
x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->bw->scale);
|
|
|
|
y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->bw->scale);
|
2009-01-25 03:36:30 +03:00
|
|
|
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
|
|
|
|
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
|
|
|
|
|
|
|
|
x += xs;
|
|
|
|
y += ys;
|
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2010-10-24 21:51:00 +04:00
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_DRAG_ON &&
|
|
|
|
((gwin->bw->drag_type == DRAGGING_SELECTION) ||
|
|
|
|
ami_autoscroll == TRUE))
|
2010-10-20 02:22:03 +04:00
|
|
|
{
|
|
|
|
ami_drag_icon_move();
|
|
|
|
|
2010-12-19 02:34:56 +03:00
|
|
|
if((gwin->win->MouseX < bbox->Left) &&
|
|
|
|
((gwin->win->MouseX - bbox->Left) > -AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_x_move = gwin->win->MouseX - bbox->Left;
|
2010-12-19 02:34:56 +03:00
|
|
|
if((gwin->win->MouseX > (bbox->Left + bbox->Width)) &&
|
|
|
|
((gwin->win->MouseX - (bbox->Left + bbox->Width)) < AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_x_move = gwin->win->MouseX - (bbox->Left + bbox->Width);
|
2010-12-19 02:34:56 +03:00
|
|
|
if((gwin->win->MouseY < bbox->Top) &&
|
|
|
|
((gwin->win->MouseY - bbox->Top) > -AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_y_move = gwin->win->MouseY - bbox->Top;
|
2010-12-19 02:34:56 +03:00
|
|
|
if((gwin->win->MouseY > (bbox->Top + bbox->Height)) &&
|
|
|
|
((gwin->win->MouseY - (bbox->Top + bbox->Height)) < AMI_DRAG_THRESHOLD))
|
2010-10-20 02:22:03 +04:00
|
|
|
drag_y_move = gwin->win->MouseY - (bbox->Top + bbox->Height);
|
|
|
|
}
|
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
if((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))
|
2008-08-09 19:19:04 +04:00
|
|
|
{
|
2009-01-11 02:10:54 +03:00
|
|
|
ami_update_quals(gwin);
|
2011-02-28 22:31:35 +03:00
|
|
|
ami_context_menu_mouse_trap(gwin, TRUE);
|
2008-10-20 22:06:46 +04:00
|
|
|
|
2008-08-18 23:07:12 +04:00
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
|
|
|
|
{
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_1 | gwin->key_state,x,y);
|
2008-08-18 23:07:12 +04:00
|
|
|
gwin->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
|
|
|
|
}
|
|
|
|
else if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
|
|
|
|
{
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_2 | gwin->key_state,x,y);
|
2008-08-18 23:07:12 +04:00
|
|
|
gwin->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_window_mouse_track(gwin->bw,gwin->mouse_state | gwin->key_state,x,y);
|
2008-08-18 23:07:12 +04:00
|
|
|
}
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
2008-09-04 02:02:41 +04:00
|
|
|
else
|
|
|
|
{
|
2011-02-28 22:31:35 +03:00
|
|
|
ami_context_menu_mouse_trap(gwin, FALSE);
|
2008-10-20 22:06:46 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
if(!gwin->mouse_state) ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WMHI_MOUSEBUTTONS:
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
|
|
|
|
(ULONG *)&bbox);
|
2009-08-31 01:43:14 +04:00
|
|
|
|
2009-09-04 22:10:15 +04:00
|
|
|
x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->bw->scale);
|
|
|
|
y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->bw->scale);
|
2009-01-25 03:36:30 +03:00
|
|
|
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
|
|
|
|
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
|
|
|
|
|
|
|
|
x += xs;
|
|
|
|
y += ys;
|
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
|
|
|
|
2009-01-11 02:10:54 +03:00
|
|
|
ami_update_quals(gwin);
|
2009-01-11 00:31:21 +03:00
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
if((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))
|
2008-08-09 19:19:04 +04:00
|
|
|
{
|
2008-08-19 22:31:56 +04:00
|
|
|
//code = code>>16;
|
2008-08-09 19:19:04 +04:00
|
|
|
switch(code)
|
|
|
|
{
|
|
|
|
case SELECTDOWN:
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_1 | gwin->key_state,x,y);
|
2008-08-18 23:07:12 +04:00
|
|
|
gwin->mouse_state=BROWSER_MOUSE_PRESS_1;
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
case MIDDLEDOWN:
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_2 | gwin->key_state,x,y);
|
2008-08-18 23:07:12 +04:00
|
|
|
gwin->mouse_state=BROWSER_MOUSE_PRESS_2;
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-09-04 02:02:41 +04:00
|
|
|
|
|
|
|
if(x<xs) x=xs;
|
|
|
|
if(y<ys) y=ys;
|
|
|
|
if(x>=width+xs) x=width+xs-1;
|
|
|
|
if(y>=height+ys) y=height+ys-1;
|
|
|
|
|
|
|
|
switch(code)
|
|
|
|
{
|
2011-02-28 22:31:35 +03:00
|
|
|
case MENUDOWN:
|
2011-09-02 21:31:47 +04:00
|
|
|
ami_context_menu_show(gwin,x,y);
|
2011-02-28 22:31:35 +03:00
|
|
|
break;
|
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
case SELECTUP:
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
|
|
|
|
{
|
2010-12-17 02:28:33 +03:00
|
|
|
CurrentTime(&curtime.tv_sec, &curtime.tv_usec);
|
|
|
|
|
|
|
|
gwin->mouse_state = BROWSER_MOUSE_CLICK_1;
|
|
|
|
|
|
|
|
if(gwin->lastclick.tv_sec)
|
|
|
|
{
|
|
|
|
if(DoubleClick(gwin->lastclick.tv_sec,
|
|
|
|
gwin->lastclick.tv_usec,
|
|
|
|
curtime.tv_sec, curtime.tv_usec))
|
|
|
|
gwin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
|
|
|
|
}
|
|
|
|
|
|
|
|
browser_window_mouse_click(gwin->bw,
|
|
|
|
gwin->mouse_state | gwin->key_state,x,y);
|
|
|
|
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
|
|
|
|
{
|
|
|
|
gwin->lastclick.tv_sec = 0;
|
|
|
|
gwin->lastclick.tv_usec = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gwin->lastclick.tv_sec = curtime.tv_sec;
|
|
|
|
gwin->lastclick.tv_usec = curtime.tv_usec;
|
|
|
|
}
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-27 21:45:17 +04:00
|
|
|
browser_window_mouse_track(gwin->bw, 0, x, y);
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
|
|
|
gwin->mouse_state=0;
|
|
|
|
break;
|
2010-12-17 02:28:33 +03:00
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
case MIDDLEUP:
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
|
|
|
|
{
|
2010-12-17 02:28:33 +03:00
|
|
|
CurrentTime(&curtime.tv_sec, &curtime.tv_usec);
|
|
|
|
|
|
|
|
gwin->mouse_state = BROWSER_MOUSE_CLICK_2;
|
|
|
|
|
|
|
|
if(gwin->lastclick.tv_sec)
|
|
|
|
{
|
|
|
|
if(DoubleClick(gwin->lastclick.tv_sec,
|
|
|
|
gwin->lastclick.tv_usec,
|
|
|
|
curtime.tv_sec, curtime.tv_usec))
|
|
|
|
gwin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
|
|
|
|
}
|
|
|
|
|
|
|
|
browser_window_mouse_click(gwin->bw,
|
|
|
|
gwin->mouse_state | gwin->key_state,x,y);
|
|
|
|
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
|
|
|
|
{
|
|
|
|
gwin->lastclick.tv_sec = 0;
|
|
|
|
gwin->lastclick.tv_usec = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gwin->lastclick.tv_sec = curtime.tv_sec;
|
|
|
|
gwin->lastclick.tv_usec = curtime.tv_usec;
|
|
|
|
}
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-27 21:45:17 +04:00
|
|
|
browser_window_mouse_track(gwin->bw, 0, x, y);
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
|
|
|
gwin->mouse_state=0;
|
|
|
|
break;
|
2011-06-03 22:08:17 +04:00
|
|
|
|
|
|
|
case SIDEUP:
|
|
|
|
ami_gui_history(gwin, true);
|
|
|
|
break;
|
|
|
|
|
2011-09-24 19:20:05 +04:00
|
|
|
case EXTRAUP:
|
2011-06-03 22:08:17 +04:00
|
|
|
ami_gui_history(gwin, false);
|
|
|
|
break;
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
2009-03-25 03:03:43 +03:00
|
|
|
|
2010-07-29 01:33:51 +04:00
|
|
|
if(drag_save_data && !gwin->mouse_state)
|
2009-03-25 03:03:43 +03:00
|
|
|
ami_drag_save(gwin->win);
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WMHI_GADGETUP:
|
2009-09-05 02:00:09 +04:00
|
|
|
switch(result & WMHI_GADGETMASK)
|
2008-08-09 19:19:04 +04:00
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
case GID_TABS:
|
2010-02-14 03:46:53 +03:00
|
|
|
GetAttrs(gwin->objects[GID_TABS],
|
|
|
|
CLICKTAB_NodeClosed, &tabnode, TAG_DONE);
|
|
|
|
if(tabnode)
|
|
|
|
{
|
|
|
|
GetClickTabNodeAttrs(tabnode,
|
|
|
|
TNA_UserData, &closedbw,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
browser_window_destroy(closedbw);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ami_switch_tab(gwin, true);
|
|
|
|
}
|
2008-10-06 01:20:12 +04:00
|
|
|
break;
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2008-10-06 01:20:12 +04:00
|
|
|
case GID_CLOSETAB:
|
|
|
|
browser_window_destroy(gwin->bw);
|
2008-10-05 03:29:17 +04:00
|
|
|
break;
|
|
|
|
|
2010-02-14 17:00:33 +03:00
|
|
|
case GID_ADDTAB:
|
2012-03-22 13:34:34 +04:00
|
|
|
browser_window_create(nsoption_charp(homepage_url), gwin->bw, 0, true, true);
|
2010-02-14 17:00:33 +03:00
|
|
|
break;
|
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
case GID_URL:
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(STRINGA_TextVal,
|
|
|
|
(Object *)gwin->objects[GID_URL],
|
|
|
|
(ULONG *)&storage);
|
2009-12-18 20:52:31 +03:00
|
|
|
if(search_is_url((char *)storage) == false)
|
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
storage = (ULONG)search_web_from_term((char *)storage);
|
2009-12-18 20:52:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
browser_window_go(gwin->bw,(char *)storage, NULL, true);
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
2009-12-23 02:04:59 +03:00
|
|
|
case GID_TOOLBARLAYOUT:
|
|
|
|
/* Need fixing: never gets here */
|
|
|
|
search_web_retrieve_ico(false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_SEARCHSTRING:
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(STRINGA_TextVal,
|
|
|
|
(Object *)gwin->objects[GID_SEARCHSTRING],
|
|
|
|
(ULONG *)&storage);
|
2011-07-23 18:06:13 +04:00
|
|
|
storage = (ULONG)search_web_from_term((char *)storage);
|
2009-12-23 02:04:59 +03:00
|
|
|
|
|
|
|
browser_window_go(gwin->bw,(char *)storage, NULL, true);
|
|
|
|
break;
|
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
case GID_HOME:
|
2012-03-22 13:34:34 +04:00
|
|
|
browser_window_go(gwin->bw,nsoption_charp(homepage_url),NULL,true);
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_STOP:
|
2009-03-24 21:28:02 +03:00
|
|
|
if(browser_window_stop_available(gwin->bw))
|
|
|
|
browser_window_stop(gwin->bw);
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_RELOAD:
|
2009-01-11 02:10:54 +03:00
|
|
|
ami_update_quals(gwin);
|
2009-01-11 00:31:21 +03:00
|
|
|
|
2009-03-24 21:28:02 +03:00
|
|
|
if(browser_window_reload_available(gwin->bw))
|
2008-10-26 15:25:26 +03:00
|
|
|
{
|
2009-03-24 21:28:02 +03:00
|
|
|
if(gwin->key_state & BROWSER_MOUSE_MOD_1)
|
|
|
|
{
|
|
|
|
browser_window_reload(gwin->bw,true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_reload(gwin->bw,false);
|
|
|
|
}
|
2008-10-26 15:25:26 +03:00
|
|
|
}
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
|
|
|
case GID_BACK:
|
2011-06-03 22:08:17 +04:00
|
|
|
ami_gui_history(gwin, true);
|
2008-08-10 00:27:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_FORWARD:
|
2011-06-03 22:08:17 +04:00
|
|
|
ami_gui_history(gwin, false);
|
2008-08-10 00:27:36 +04:00
|
|
|
break;
|
2008-08-10 13:57:41 +04:00
|
|
|
|
|
|
|
default:
|
2008-08-31 15:21:47 +04:00
|
|
|
// printf("GADGET: %ld\n",(result & WMHI_GADGETMASK));
|
2008-08-10 13:57:41 +04:00
|
|
|
break;
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
case WMHI_RAWKEY:
|
|
|
|
storage = result & WMHI_GADGETMASK;
|
2008-09-28 17:55:40 +04:00
|
|
|
|
2009-07-18 15:36:41 +04:00
|
|
|
if(storage >= IECODE_UP_PREFIX) break;
|
|
|
|
|
2008-09-28 17:55:40 +04:00
|
|
|
GetAttr(WINDOW_InputEvent,gwin->objects[OID_MAIN],(ULONG *)&ie);
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2009-11-03 02:02:53 +03:00
|
|
|
nskey = ami_key_to_nskey(storage, ie);
|
|
|
|
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RCOMMAND)
|
2008-08-25 17:32:26 +04:00
|
|
|
{
|
2009-01-25 03:36:30 +03:00
|
|
|
/* We are duplicating the menu shortcuts here, as if RMBTRAP is active
|
|
|
|
* (ie. when context menus are enabled and the mouse is over the browser
|
|
|
|
* rendering area), Intuition also does not catch the menu shortcut
|
2009-02-01 16:01:46 +03:00
|
|
|
* key presses. Context menus need to be changed to use MENUVERIFY not RMBTRAP */
|
2009-11-03 02:02:53 +03:00
|
|
|
switch(nskey)
|
|
|
|
{
|
2009-11-04 02:17:57 +03:00
|
|
|
case 'n':
|
2012-03-22 13:34:34 +04:00
|
|
|
if ((nsoption_bool(kiosk_mode) == false))
|
|
|
|
browser_window_create(nsoption_charp(homepage_url), NULL,
|
2010-02-14 15:51:30 +03:00
|
|
|
0, true, false);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 't':
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
|
|
|
browser_window_create(nsoption_charp(homepage_url),
|
2011-03-01 22:09:57 +03:00
|
|
|
gwin->bw, 0, true, true);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k':
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2009-11-04 02:17:57 +03:00
|
|
|
browser_window_destroy(gwin->bw);
|
|
|
|
break;
|
|
|
|
|
2011-10-15 18:09:35 +04:00
|
|
|
case 'o':
|
|
|
|
ami_file_open(gwin);
|
|
|
|
break;
|
|
|
|
|
2011-10-15 18:55:03 +04:00
|
|
|
case 's':
|
2011-10-23 17:15:44 +04:00
|
|
|
ami_file_save_req(AMINS_SAVE_SOURCE, gwin,
|
|
|
|
gwin->bw->current_content, NULL);
|
2011-10-15 18:55:03 +04:00
|
|
|
break;
|
|
|
|
|
2009-11-04 02:17:57 +03:00
|
|
|
case 'p':
|
|
|
|
ami_print_ui(gwin->bw->current_content);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'q':
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2009-11-04 02:17:57 +03:00
|
|
|
ami_quit_netsurf();
|
|
|
|
break;
|
|
|
|
|
2009-11-03 02:12:28 +03:00
|
|
|
case 'a':
|
|
|
|
browser_window_key_press(gwin->bw, KEY_SELECT_ALL);
|
|
|
|
break;
|
|
|
|
|
2010-07-24 20:39:37 +04:00
|
|
|
case 'x':
|
|
|
|
browser_window_key_press(gwin->bw, KEY_CUT_SELECTION);
|
|
|
|
break;
|
|
|
|
|
2009-11-03 02:02:53 +03:00
|
|
|
case 'c':
|
|
|
|
browser_window_key_press(gwin->bw, KEY_COPY_SELECTION);
|
2009-11-03 02:12:28 +03:00
|
|
|
browser_window_key_press(gwin->bw, KEY_CLEAR_SELECTION);
|
2009-11-04 11:14:17 +03:00
|
|
|
break;
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2009-11-03 02:02:53 +03:00
|
|
|
case 'v':
|
|
|
|
browser_window_key_press(gwin->bw, KEY_PASTE);
|
|
|
|
break;
|
2009-11-04 02:17:57 +03:00
|
|
|
|
|
|
|
case 'z':
|
|
|
|
browser_window_key_press(gwin->bw, KEY_CLEAR_SELECTION);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'f':
|
|
|
|
ami_search_open(gwin->bw->window);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'h':
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* The following aren't available from the menu at the moment */
|
|
|
|
|
|
|
|
case 'r': // reload
|
|
|
|
if(browser_window_reload_available(gwin->bw))
|
|
|
|
browser_window_reload(gwin->bw,false);
|
|
|
|
break;
|
2011-09-30 02:13:13 +04:00
|
|
|
/*
|
2009-11-04 02:17:57 +03:00
|
|
|
case 'u': // open url
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2012-03-29 02:17:27 +04:00
|
|
|
ActivateLayoutGadget((struct Gadget *)gwin->objects[GID_MAIN],
|
|
|
|
gwin->win, NULL, (uint32)gwin->objects[GID_URL]);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
2011-09-30 02:13:13 +04:00
|
|
|
*/
|
2009-11-03 02:02:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-03 02:12:28 +03:00
|
|
|
if(!browser_window_key_press(gwin->bw, nskey))
|
|
|
|
{
|
|
|
|
switch(nskey)
|
|
|
|
{
|
|
|
|
case KEY_UP:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, 0, -NSA_KBD_SCROLL_PX);
|
2009-11-03 02:12:28 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_DOWN:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, 0, +NSA_KBD_SCROLL_PX);
|
2009-11-03 02:12:28 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_LEFT:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, -NSA_KBD_SCROLL_PX, 0);
|
2009-11-03 02:12:28 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_RIGHT:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, +NSA_KBD_SCROLL_PX, 0);
|
2009-11-03 02:12:28 +03:00
|
|
|
break;
|
2009-11-04 02:17:57 +03:00
|
|
|
|
|
|
|
case KEY_PAGE_UP:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, 0, SCROLL_PAGE_UP);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_PAGE_DOWN:
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, 0, SCROLL_PAGE_DOWN);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_LINE_START: // page left
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, SCROLL_PAGE_UP, 0);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_LINE_END: // page right
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, SCROLL_PAGE_DOWN, 0);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_TEXT_START: // home
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, SCROLL_TOP, SCROLL_TOP);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_TEXT_END: // end
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, SCROLL_BOTTOM, SCROLL_BOTTOM);
|
2009-11-04 02:17:57 +03:00
|
|
|
break;
|
2009-11-04 11:06:52 +03:00
|
|
|
|
2009-12-13 14:52:58 +03:00
|
|
|
case KEY_WORD_RIGHT: // alt+right
|
|
|
|
ami_change_tab(gwin, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_WORD_LEFT: // alt+left
|
|
|
|
ami_change_tab(gwin, -1);
|
|
|
|
break;
|
|
|
|
|
2011-06-25 20:00:02 +04:00
|
|
|
case KEY_DELETE_LEFT: // backspace
|
|
|
|
ami_gui_history(gwin, true);
|
|
|
|
break;
|
|
|
|
|
2009-11-04 11:06:52 +03:00
|
|
|
case RAWKEY_F5: // reload
|
|
|
|
if(browser_window_reload_available(gwin->bw))
|
|
|
|
browser_window_reload(gwin->bw,false);
|
|
|
|
break;
|
2009-11-03 02:12:28 +03:00
|
|
|
}
|
|
|
|
}
|
2008-08-25 17:32:26 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
case WMHI_NEWSIZE:
|
2008-09-28 00:55:11 +04:00
|
|
|
switch(node->Type)
|
|
|
|
{
|
2010-04-28 02:40:28 +04:00
|
|
|
struct Node *tab = NULL, *ntab = NULL;
|
|
|
|
struct browser_window *bw = NULL;
|
|
|
|
|
2008-09-28 00:55:11 +04:00
|
|
|
case AMINS_WINDOW:
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_set_border_gadget_balance(gwin);
|
2008-11-02 03:21:49 +03:00
|
|
|
ami_update_throbber(gwin,true);
|
2010-04-28 02:40:28 +04:00
|
|
|
|
|
|
|
if(gwin->tabs)
|
|
|
|
{
|
|
|
|
tab = GetHead(&gwin->tab_list);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ntab=GetSucc(tab);
|
|
|
|
GetClickTabNodeAttrs(tab,
|
|
|
|
TNA_UserData, &bw,
|
|
|
|
TAG_DONE);
|
|
|
|
bw->reformat_pending = true;
|
|
|
|
} while(tab=ntab);
|
|
|
|
}
|
2011-09-16 22:00:39 +04:00
|
|
|
|
2009-03-14 19:18:09 +03:00
|
|
|
gwin->bw->reformat_pending = true;
|
2008-09-28 00:55:11 +04:00
|
|
|
gwin->redraw_required = true;
|
|
|
|
break;
|
|
|
|
}
|
2008-08-11 21:53:45 +04:00
|
|
|
break;
|
|
|
|
|
2008-08-19 22:31:56 +04:00
|
|
|
case WMHI_CLOSEWINDOW:
|
2008-10-06 11:07:33 +04:00
|
|
|
ami_close_all_tabs(gwin);
|
2008-09-05 02:41:26 +04:00
|
|
|
break;
|
|
|
|
|
2009-07-04 20:12:27 +04:00
|
|
|
case WMHI_ICONIFY:
|
|
|
|
{
|
2009-07-04 22:01:46 +04:00
|
|
|
struct DiskObject *dobj;
|
|
|
|
struct bitmap *bm;
|
|
|
|
|
2011-12-04 18:55:23 +04:00
|
|
|
bm = urldb_get_thumbnail(nsurl_access(hlcache_handle_get_url(gwin->bw->current_content)));
|
2011-07-03 15:47:54 +04:00
|
|
|
if(!bm) bm = content_get_bitmap(gwin->bw->current_content);
|
2011-07-03 15:05:18 +04:00
|
|
|
gwin->dobj = amiga_icon_from_bitmap(bm);
|
2011-10-08 03:12:12 +04:00
|
|
|
amiga_icon_superimpose_favicon_internal(gwin->bw->window->favicon,
|
|
|
|
gwin->dobj);
|
2011-07-03 15:05:18 +04:00
|
|
|
HideWindow(gwin->win);
|
2012-04-28 23:43:46 +04:00
|
|
|
gwin->appicon = AddAppIcon((ULONG)gwin->objects[OID_MAIN],
|
|
|
|
(ULONG)gwin, gwin->win->Title, appport,
|
|
|
|
0, gwin->dobj, NULL);
|
2011-07-03 15:20:00 +04:00
|
|
|
|
|
|
|
curbw = NULL;
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-15 22:00:21 +03:00
|
|
|
case WMHI_INACTIVE:
|
|
|
|
gwin->bw->window->c_h_temp = gwin->bw->window->c_h;
|
|
|
|
gui_window_remove_caret(gwin->bw->window);
|
|
|
|
break;
|
|
|
|
|
2008-10-26 02:22:34 +03:00
|
|
|
case WMHI_ACTIVE:
|
2009-04-14 22:51:10 +04:00
|
|
|
if(gwin->bw) curbw = gwin->bw;
|
2010-03-15 22:00:21 +03:00
|
|
|
if(gwin->bw->window->c_h_temp)
|
|
|
|
gwin->bw->window->c_h = gwin->bw->window->c_h_temp;
|
2008-10-26 02:22:34 +03:00
|
|
|
break;
|
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
case WMHI_INTUITICK:
|
2008-09-08 22:14:14 +04:00
|
|
|
break;
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
default:
|
2012-02-25 22:42:33 +04:00
|
|
|
//printf("class: %ld\n",(result & WMHI_CLASSMASK));
|
2008-09-05 02:41:26 +04:00
|
|
|
break;
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-22 01:41:42 +04:00
|
|
|
if(win_destroyed)
|
|
|
|
{
|
2008-09-05 02:41:26 +04:00
|
|
|
/* we can't be sure what state our window_list is in, so let's
|
2008-08-22 01:41:42 +04:00
|
|
|
jump out of the function and start again */
|
|
|
|
|
|
|
|
win_destroyed = false;
|
|
|
|
return;
|
|
|
|
}
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2010-12-19 02:34:56 +03:00
|
|
|
if(drag_x_move || drag_y_move)
|
|
|
|
{
|
|
|
|
gui_window_get_scroll(gwin->bw->window,
|
|
|
|
&gwin->bw->window->scrollx, &gwin->bw->window->scrolly);
|
|
|
|
|
|
|
|
gui_window_set_scroll(gwin->bw->window,
|
|
|
|
gwin->bw->window->scrollx + drag_x_move,
|
|
|
|
gwin->bw->window->scrolly + drag_y_move);
|
|
|
|
}
|
|
|
|
|
2008-08-22 01:41:42 +04:00
|
|
|
// ReplyMsg((struct Message *)message);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2011-09-16 22:00:39 +04:00
|
|
|
if(node->Type == AMINS_WINDOW)
|
2009-01-11 00:31:21 +03:00
|
|
|
{
|
2010-04-28 02:40:28 +04:00
|
|
|
if(gwin->redraw_required || gwin->bw->reformat_pending)
|
2009-05-31 19:05:26 +04:00
|
|
|
ami_do_redraw(gwin);
|
2008-08-17 20:22:40 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
if(gwin->bw->window->throbbing)
|
2009-01-11 00:31:21 +03:00
|
|
|
ami_update_throbber(gwin,false);
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
if(gwin->bw->window->c_h)
|
|
|
|
{
|
2010-02-14 03:46:53 +03:00
|
|
|
gui_window_place_caret(gwin->bw->window, gwin->bw->window->c_x,
|
|
|
|
gwin->bw->window->c_y, gwin->bw->window->c_h);
|
2008-10-19 15:33:05 +04:00
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
}
|
2008-10-06 22:20:16 +04:00
|
|
|
} while(node = nnode);
|
2011-09-13 02:38:51 +04:00
|
|
|
|
|
|
|
if(refresh_search_ico)
|
|
|
|
{
|
|
|
|
gui_window_set_search_ico(NULL);
|
|
|
|
refresh_search_ico = FALSE;
|
|
|
|
}
|
2012-04-29 19:59:37 +04:00
|
|
|
|
|
|
|
if(refresh_favicon)
|
|
|
|
{
|
|
|
|
gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
|
|
|
|
refresh_favicon = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(refresh_throbber)
|
|
|
|
{
|
|
|
|
ami_update_throbber(gwin, true);
|
|
|
|
refresh_throbber = FALSE;
|
|
|
|
}
|
2008-09-05 02:41:26 +04:00
|
|
|
}
|
|
|
|
|
2011-07-03 15:05:18 +04:00
|
|
|
void ami_gui_appicon_remove(struct gui_window_2 *gwin)
|
|
|
|
{
|
|
|
|
if(gwin->appicon)
|
|
|
|
{
|
|
|
|
RemoveAppIcon(gwin->appicon);
|
|
|
|
amiga_icon_free(gwin->dobj);
|
|
|
|
gwin->appicon = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
void ami_handle_appmsg(void)
|
|
|
|
{
|
|
|
|
struct AppMessage *appmsg;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct gui_window_2 *gwin;
|
2011-12-02 16:47:11 +04:00
|
|
|
int x, y;
|
2008-09-07 19:58:11 +04:00
|
|
|
struct WBArg *appwinargs;
|
|
|
|
STRPTR filename;
|
2011-12-02 16:47:11 +04:00
|
|
|
char *urlfilename;
|
|
|
|
int i = 0;
|
2008-09-04 02:02:41 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
while(appmsg=(struct AppMessage *)GetMsg(appport))
|
2008-09-04 02:02:41 +04:00
|
|
|
{
|
2012-04-28 23:43:46 +04:00
|
|
|
gwin = (struct gui_window_2 *)appmsg->am_UserData;
|
2008-09-07 19:58:11 +04:00
|
|
|
|
2009-07-04 20:12:27 +04:00
|
|
|
if(appmsg->am_Type == AMTYPE_APPICON)
|
|
|
|
{
|
2011-07-03 15:05:18 +04:00
|
|
|
ami_gui_appicon_remove(gwin);
|
|
|
|
ShowWindow(gwin->win, WINDOW_FRONTMOST);
|
2011-07-03 15:20:00 +04:00
|
|
|
ActivateWindow(gwin->win);
|
2009-07-04 20:12:27 +04:00
|
|
|
}
|
2011-07-03 15:05:18 +04:00
|
|
|
else if(appmsg->am_Type == AMTYPE_APPWINDOW)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
for(i = 0; i < appmsg->am_NumArgs; ++i)
|
2008-09-05 02:41:26 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
if(appwinargs = &appmsg->am_ArgList[i])
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
if(filename = AllocVec(1024, MEMF_PRIVATE | MEMF_CLEAR))
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
if(appwinargs->wa_Lock)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
NameFromLock(appwinargs->wa_Lock, filename, 1024);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
AddPart(filename, appwinargs->wa_Name, 1024);
|
2008-09-07 19:58:11 +04:00
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
if(ami_mouse_to_ns_coords(gwin, &x, &y,
|
|
|
|
appmsg->am_MouseX, appmsg->am_MouseY) == false)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
urlfilename = path_to_url(filename);
|
2008-09-07 19:58:11 +04:00
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
if(i == 0)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
browser_window_go(gwin->bw, urlfilename, NULL, true);
|
|
|
|
ActivateWindow(gwin->win);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_create(urlfilename, gwin->bw, 0, true, true);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
|
|
|
|
2011-12-02 16:47:11 +04:00
|
|
|
free(urlfilename);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
if(browser_window_drop_file_at_point(gwin->bw, x, y, filename) == false)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
urlfilename = path_to_url(filename);
|
|
|
|
|
|
|
|
if(i == 0)
|
|
|
|
{
|
|
|
|
browser_window_go(gwin->bw, urlfilename, NULL, true);
|
|
|
|
ActivateWindow(gwin->win);
|
|
|
|
}
|
|
|
|
else
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2011-12-02 16:47:11 +04:00
|
|
|
browser_window_create(urlfilename, gwin->bw, 0, true, true);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
2011-12-02 16:47:11 +04:00
|
|
|
free(urlfilename);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
|
|
|
}
|
2011-12-02 16:47:11 +04:00
|
|
|
FreeVec(filename);
|
2008-09-07 19:58:11 +04:00
|
|
|
}
|
|
|
|
}
|
2008-09-05 02:41:26 +04:00
|
|
|
}
|
|
|
|
}
|
2008-09-04 02:02:41 +04:00
|
|
|
ReplyMsg((struct Message *)appmsg);
|
2008-09-08 22:14:14 +04:00
|
|
|
|
|
|
|
if(gwin->redraw_required)
|
2009-05-31 19:05:26 +04:00
|
|
|
ami_do_redraw(gwin);
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
void ami_handle_applib(void)
|
|
|
|
{
|
|
|
|
struct ApplicationMsg *applibmsg;
|
2009-09-29 02:17:09 +04:00
|
|
|
struct browser_window *bw;
|
2009-09-28 22:00:40 +04:00
|
|
|
|
2010-03-28 20:42:33 +04:00
|
|
|
if(!applibport) return;
|
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
while((applibmsg=(struct ApplicationMsg *)GetMsg(applibport)))
|
|
|
|
{
|
|
|
|
switch (applibmsg->type)
|
|
|
|
{
|
2009-09-29 02:17:09 +04:00
|
|
|
case APPLIBMT_NewBlankDoc:
|
2012-03-22 13:34:34 +04:00
|
|
|
bw = browser_window_create(nsoption_charp(homepage_url), 0, 0, true, false);
|
2009-09-29 02:17:09 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case APPLIBMT_OpenDoc:
|
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
struct ApplicationOpenPrintDocMsg *applibopdmsg =
|
|
|
|
(struct ApplicationOpenPrintDocMsg *)applibmsg;
|
2009-09-29 02:17:09 +04:00
|
|
|
char *tempurl;
|
|
|
|
|
|
|
|
tempurl = path_to_url(applibopdmsg->fileName);
|
|
|
|
bw = browser_window_create(tempurl, 0, 0, true, false);
|
|
|
|
free(tempurl);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
case APPLIBMT_ToFront:
|
2009-09-29 02:17:09 +04:00
|
|
|
if(curbw)
|
|
|
|
{
|
|
|
|
ScreenToFront(scrn);
|
|
|
|
WindowToFront(curbw->window->shared->win);
|
|
|
|
ActivateWindow(curbw->window->shared->win);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
bw = browser_window_create(nsoption_charp(homepage_url), 0, 0, true, false);
|
2009-09-29 02:17:09 +04:00
|
|
|
}
|
2009-09-28 22:00:40 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case APPLIBMT_OpenPrefs:
|
|
|
|
ScreenToFront(scrn);
|
|
|
|
ami_gui_opts_open();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case APPLIBMT_Quit:
|
|
|
|
case APPLIBMT_ForceQuit:
|
|
|
|
ami_quit_netsurf();
|
|
|
|
break;
|
2010-02-13 20:31:10 +03:00
|
|
|
|
|
|
|
case APPLIBMT_CustomMsg:
|
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
struct ApplicationCustomMsg *applibcustmsg =
|
|
|
|
(struct ApplicationCustomMsg *)applibmsg;
|
2011-02-10 00:52:28 +03:00
|
|
|
// STRPTR tempmsg;
|
|
|
|
// if(tempmsg = ASPrintf("\"%s\"",applibcustmsg->customMsg))
|
|
|
|
// {
|
|
|
|
OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
|
|
|
|
// FreeVec(tempmsg);
|
|
|
|
// }
|
2010-02-13 20:31:10 +03:00
|
|
|
}
|
|
|
|
break;
|
2009-09-28 22:00:40 +04:00
|
|
|
}
|
|
|
|
ReplyMsg((struct Message *)applibmsg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
void ami_get_msg(void)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-09-05 02:41:26 +04:00
|
|
|
ULONG winsignal = 1L << sport->mp_SigBit;
|
|
|
|
ULONG appsig = 1L << appport->mp_SigBit;
|
2008-09-08 22:14:14 +04:00
|
|
|
ULONG schedulesig = 1L << msgport->mp_SigBit;
|
2008-09-05 02:41:26 +04:00
|
|
|
ULONG signal;
|
2009-10-16 01:35:29 +04:00
|
|
|
struct TimerRequest *timermsg = NULL;
|
2009-08-29 18:00:57 +04:00
|
|
|
struct MsgPort *printmsgport = ami_print_get_msgport();
|
|
|
|
ULONG printsig = 1L << printmsgport->mp_SigBit;
|
2009-09-28 22:00:40 +04:00
|
|
|
ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig;
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
signal = Wait(signalmask);
|
2012-04-28 23:43:46 +04:00
|
|
|
/*
|
|
|
|
printf("sig recvd %ld (%ld %ld %ld %ld %ld %ld)\n", signal, winsignal , appsig , schedulesig , rxsig , printsig , applibsig);
|
|
|
|
*/
|
2008-09-05 02:41:26 +04:00
|
|
|
if(signal & winsignal)
|
|
|
|
ami_handle_msg();
|
2011-02-10 00:52:28 +03:00
|
|
|
|
|
|
|
if(signal & appsig)
|
2008-09-05 02:41:26 +04:00
|
|
|
ami_handle_appmsg();
|
2011-02-10 00:52:28 +03:00
|
|
|
|
|
|
|
if(signal & rxsig)
|
2008-09-29 23:35:30 +04:00
|
|
|
ami_arexx_handle();
|
2011-02-10 00:52:28 +03:00
|
|
|
|
|
|
|
if(signal & applibsig)
|
2009-09-28 22:00:40 +04:00
|
|
|
ami_handle_applib();
|
2011-02-10 00:52:28 +03:00
|
|
|
|
|
|
|
if(signal & printsig)
|
2009-08-29 18:00:57 +04:00
|
|
|
{
|
|
|
|
while(GetMsg(printmsgport)); //ReplyMsg
|
|
|
|
ami_print_cont();
|
|
|
|
}
|
2011-02-10 00:52:28 +03:00
|
|
|
|
|
|
|
if(signal & schedulesig)
|
2008-09-08 22:14:14 +04:00
|
|
|
{
|
2012-02-26 15:03:09 +04:00
|
|
|
if(timermsg = (struct TimerRequest *)GetMsg(msgport))
|
2011-02-10 00:52:28 +03:00
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
ReplyMsg((struct Message *)timermsg);
|
2011-02-17 00:29:39 +03:00
|
|
|
schedule_run(FALSE);
|
2011-02-10 00:52:28 +03:00
|
|
|
}
|
2008-09-08 22:14:14 +04:00
|
|
|
}
|
2008-09-05 02:41:26 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
|
|
|
|
void gui_poll(bool active)
|
|
|
|
{
|
2008-09-05 02:41:26 +04:00
|
|
|
/* However, down here we are waiting for the user to do something or for a
|
2011-02-10 00:52:28 +03:00
|
|
|
scheduled event to kick in (the active variable seems to have no real
|
|
|
|
bearing on reality, but is supposed to indicate that NetSurf wants
|
|
|
|
control back ASAP, so we poll in that case).
|
2008-09-08 22:14:14 +04:00
|
|
|
schedule_run checks every event, really they need to be sorted so only
|
|
|
|
the first event needs to be run on each signal. */
|
|
|
|
|
|
|
|
if(active)
|
|
|
|
{
|
2011-09-21 04:25:09 +04:00
|
|
|
ami_handle_msg();
|
|
|
|
ami_handle_appmsg();
|
|
|
|
ami_handle_applib();
|
|
|
|
ami_arexx_handle();
|
2011-02-17 00:29:39 +03:00
|
|
|
schedule_run(TRUE);
|
2008-09-08 22:14:14 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ami_get_msg();
|
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-12-13 14:52:58 +03:00
|
|
|
void ami_change_tab(struct gui_window_2 *gwin, int direction)
|
|
|
|
{
|
|
|
|
struct Node *tab_node = gwin->bw->window->tab_node;
|
|
|
|
struct Node *ptab;
|
|
|
|
ULONG ptabnum = 0;
|
|
|
|
|
|
|
|
if(gwin->tabs <= 1) return;
|
|
|
|
|
|
|
|
if(direction > 0)
|
|
|
|
{
|
|
|
|
ptab = GetSucc(tab_node);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ptab = GetPred(tab_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ptab) return;
|
|
|
|
|
|
|
|
GetClickTabNodeAttrs(ptab, TNA_Number, (ULONG *)&ptabnum, TAG_DONE);
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_TABS], gwin->win, NULL,
|
2009-12-13 14:52:58 +03:00
|
|
|
CLICKTAB_Current, ptabnum,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
ami_switch_tab(gwin, true);
|
|
|
|
}
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
|
|
|
|
{
|
|
|
|
struct Node *tabnode;
|
2009-09-09 02:59:47 +04:00
|
|
|
struct IBox *bbox;
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2011-07-03 02:40:45 +04:00
|
|
|
/* Clear the last new tab list */
|
|
|
|
gwin->bw->window->last_new_tab = NULL;
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
if(gwin->tabs == 0) return;
|
|
|
|
|
2011-10-03 22:08:52 +04:00
|
|
|
gui_window_get_scroll(gwin->bw->window,
|
|
|
|
&gwin->bw->window->scrollx, &gwin->bw->window->scrolly);
|
2008-11-09 02:08:55 +03:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(CLICKTAB_CurrentNode, (Object *)gwin->objects[GID_TABS],
|
|
|
|
(ULONG *)&tabnode);
|
2008-10-05 17:17:18 +04:00
|
|
|
GetClickTabNodeAttrs(tabnode,
|
2011-10-03 22:08:52 +04:00
|
|
|
TNA_UserData, &gwin->bw,
|
2008-10-05 17:17:18 +04:00
|
|
|
TAG_DONE);
|
2008-10-26 02:22:34 +03:00
|
|
|
curbw = gwin->bw;
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox);
|
2009-09-09 02:59:47 +04:00
|
|
|
|
|
|
|
if(!gwin->bw->current_content)
|
|
|
|
{
|
2010-02-14 15:51:30 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
|
|
|
|
gwin->win, NULL, STRINGA_TextVal, "", TAG_DONE);
|
|
|
|
|
2009-09-09 02:59:47 +04:00
|
|
|
p96RectFill(gwin->win->RPort, bbox->Left, bbox->Top,
|
|
|
|
bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-05 17:17:18 +04:00
|
|
|
|
|
|
|
ami_update_buttons(gwin);
|
2010-07-24 23:57:27 +04:00
|
|
|
ami_menu_update_disabled(gwin->bw->window, gwin->bw->current_content);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
|
|
|
if(redraw)
|
|
|
|
{
|
2009-12-19 16:42:48 +03:00
|
|
|
gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
|
|
|
|
|
2011-10-03 22:08:52 +04:00
|
|
|
p96RectFill(gwin->win->RPort, bbox->Left, bbox->Top,
|
|
|
|
bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff);
|
2008-12-14 02:25:42 +03:00
|
|
|
|
2011-10-03 22:08:52 +04:00
|
|
|
browser_window_update(gwin->bw, false);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2011-10-03 22:08:52 +04:00
|
|
|
gui_window_set_scroll(gwin->bw->window,
|
|
|
|
gwin->bw->window->scrollx, gwin->bw->window->scrolly);
|
2009-05-31 19:17:35 +04:00
|
|
|
gwin->redraw_scroll = false;
|
2008-11-09 17:02:04 +03:00
|
|
|
|
2010-03-28 19:51:05 +04:00
|
|
|
browser_window_refresh_url_bar(gwin->bw,
|
2011-12-04 18:55:23 +04:00
|
|
|
hlcache_handle_get_url(gwin->bw->current_content), gwin->bw->frag_id);
|
2008-10-05 17:17:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-03 15:00:10 +04:00
|
|
|
void ami_try_quit(void)
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(close_no_quit) == false)
|
2009-10-03 15:00:10 +04:00
|
|
|
{
|
|
|
|
netsurf_quit = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-16 22:46:43 +04:00
|
|
|
if(locked_screen == FALSE)
|
|
|
|
if(CloseScreen(scrn)) scrn = NULL;
|
2009-10-03 15:00:10 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-06 21:47:31 +04:00
|
|
|
void ami_quit_netsurf(void)
|
|
|
|
{
|
|
|
|
struct nsObject *node;
|
|
|
|
struct nsObject *nnode;
|
|
|
|
struct gui_window_2 *gwin;
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(!IsMinListEmpty(window_list))
|
2008-10-06 21:47:31 +04:00
|
|
|
{
|
2009-09-29 02:17:09 +04:00
|
|
|
node = (struct nsObject *)GetHead((struct List *)window_list);
|
2008-10-06 21:47:31 +04:00
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
do
|
2008-10-06 21:47:31 +04:00
|
|
|
{
|
2009-09-29 02:17:09 +04:00
|
|
|
nnode=(struct nsObject *)GetSucc((struct Node *)node);
|
|
|
|
gwin = node->objstruct;
|
2008-10-06 21:47:31 +04:00
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
switch(node->Type)
|
|
|
|
{
|
|
|
|
case AMINS_TVWINDOW:
|
|
|
|
ami_tree_close((struct treeview_window *)gwin);
|
|
|
|
break;
|
2008-10-06 21:47:31 +04:00
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
case AMINS_WINDOW:
|
|
|
|
ami_close_all_tabs(gwin);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(node = nnode);
|
|
|
|
}
|
2008-10-06 21:47:31 +04:00
|
|
|
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
|
|
|
netsurf_quit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-16 22:46:43 +04:00
|
|
|
void ami_gui_close_screen(struct Screen *scrn)
|
|
|
|
{
|
2011-09-11 03:25:49 +04:00
|
|
|
if(scrn == NULL) return;
|
|
|
|
if(CloseScreen(scrn)) return;
|
2011-06-16 22:46:43 +04:00
|
|
|
|
|
|
|
LOG(("Waiting for visitor windows to close..."));
|
2011-09-11 03:25:49 +04:00
|
|
|
do {
|
|
|
|
Delay(50);
|
|
|
|
} while (CloseScreen(scrn) == FALSE);
|
2011-06-16 22:46:43 +04:00
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_quit(void)
|
|
|
|
{
|
2008-08-31 21:34:00 +04:00
|
|
|
int i;
|
|
|
|
|
2010-03-24 01:27:33 +03:00
|
|
|
ami_theme_throbber_free();
|
2008-09-11 23:33:40 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
urldb_save(nsoption_charp(url_file));
|
|
|
|
urldb_save_cookies(nsoption_charp(cookie_file));
|
|
|
|
ami_hotlist_free(nsoption_charp(hotlist_file));
|
2008-10-12 01:38:04 +04:00
|
|
|
ami_cookies_free();
|
|
|
|
ami_global_history_free();
|
2010-10-05 23:14:46 +04:00
|
|
|
sslcert_cleanup();
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
if(IApplication && ami_appid)
|
|
|
|
UnregisterApplication(ami_appid, NULL);
|
|
|
|
|
2008-12-08 00:50:04 +03:00
|
|
|
ami_arexx_cleanup();
|
|
|
|
|
2009-07-09 22:52:55 +04:00
|
|
|
ami_free_layers(&browserglob);
|
2009-10-03 15:00:10 +04:00
|
|
|
FreeScreenDrawInfo(scrn, dri);
|
2008-12-26 22:04:57 +03:00
|
|
|
|
2009-01-16 23:05:21 +03:00
|
|
|
ami_close_fonts();
|
|
|
|
|
2011-06-16 22:46:43 +04:00
|
|
|
/* If it is our public screen, close it or wait until the visitor windows leave */
|
|
|
|
if(locked_screen == FALSE) ami_gui_close_screen(scrn);
|
2008-12-26 22:04:57 +03:00
|
|
|
|
2008-08-23 20:17:51 +04:00
|
|
|
FreeVec(nsscreentitle);
|
2008-10-25 20:37:08 +04:00
|
|
|
|
2011-06-18 21:40:27 +04:00
|
|
|
ami_context_menu_free();
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2010-03-24 01:27:33 +03:00
|
|
|
ami_mouse_pointers_free();
|
2008-10-25 20:37:08 +04:00
|
|
|
ami_clipboard_free();
|
2009-08-29 18:00:57 +04:00
|
|
|
ami_print_free();
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
FreeSysObject(ASOT_PORT,appport);
|
2008-09-05 02:41:26 +04:00
|
|
|
FreeSysObject(ASOT_PORT,sport);
|
2008-09-04 02:02:41 +04:00
|
|
|
|
2011-10-15 18:09:35 +04:00
|
|
|
ami_file_req_free();
|
2009-01-11 00:31:21 +03:00
|
|
|
|
|
|
|
ami_openurl_close();
|
2009-07-23 15:23:34 +04:00
|
|
|
FreeStringClass(urlStringClass);
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
if(IApplication) DropInterface((struct Interface *)IApplication);
|
|
|
|
if(ApplicationBase) CloseLibrary(ApplicationBase);
|
|
|
|
|
|
|
|
if(IKeymap) DropInterface((struct Interface *)IKeymap);
|
|
|
|
if(KeymapBase) CloseLibrary(KeymapBase);
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2011-02-17 00:29:39 +03:00
|
|
|
ami_schedule_free();
|
2011-03-13 22:43:56 +03:00
|
|
|
ami_schedule_close_timer();
|
2011-02-17 00:29:39 +03:00
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
FreeObjList(window_list);
|
2012-03-29 02:17:27 +04:00
|
|
|
|
|
|
|
FreeVec(current_user_options);
|
|
|
|
FreeVec(current_user_dir);
|
|
|
|
FreeVec(current_user);
|
2008-08-10 00:27:36 +04:00
|
|
|
}
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
void ami_update_buttons(struct gui_window_2 *gwin)
|
2008-08-10 00:27:36 +04:00
|
|
|
{
|
2009-03-24 21:28:02 +03:00
|
|
|
BOOL back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
|
2011-09-07 00:58:26 +04:00
|
|
|
uint32 storage = 0;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-03-24 21:28:02 +03:00
|
|
|
if(!browser_window_back_available(gwin->bw))
|
2008-08-10 00:27:36 +04:00
|
|
|
back=TRUE;
|
|
|
|
|
2009-03-24 21:28:02 +03:00
|
|
|
if(browser_window_forward_available(gwin->bw))
|
2008-08-10 00:27:36 +04:00
|
|
|
forward=FALSE;
|
|
|
|
|
2009-03-24 21:28:02 +03:00
|
|
|
if(!browser_window_stop_available(gwin->bw))
|
|
|
|
stop=TRUE;
|
|
|
|
|
|
|
|
if(!browser_window_reload_available(gwin->bw))
|
|
|
|
reload=TRUE;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(kiosk_mode) == false)
|
2009-05-17 14:40:42 +04:00
|
|
|
{
|
2009-09-04 22:10:15 +04:00
|
|
|
if(gwin->tabs <= 1)
|
|
|
|
{
|
|
|
|
tabclose=TRUE;
|
|
|
|
OffMenu(gwin->win,AMI_MENU_CLOSETAB);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OnMenu(gwin->win,AMI_MENU_CLOSETAB);
|
|
|
|
}
|
2009-05-17 14:40:42 +04:00
|
|
|
}
|
2008-10-06 11:07:33 +04:00
|
|
|
|
2011-09-07 00:58:26 +04:00
|
|
|
GetAttr(GA_Disabled, gwin->objects[GID_BACK], &storage);
|
|
|
|
if(storage != back)
|
|
|
|
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
|
|
|
|
gwin->win, NULL, GA_Disabled, back, TAG_DONE);
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2011-09-07 00:58:26 +04:00
|
|
|
GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], &storage);
|
|
|
|
if(storage != forward)
|
|
|
|
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
|
|
|
|
gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
|
2008-10-06 11:07:33 +04:00
|
|
|
|
2011-09-07 00:58:26 +04:00
|
|
|
GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], &storage);
|
|
|
|
if(storage != reload)
|
|
|
|
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
|
|
|
|
gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
|
2009-03-24 21:28:02 +03:00
|
|
|
|
2011-09-07 00:58:26 +04:00
|
|
|
GetAttr(GA_Disabled, gwin->objects[GID_STOP], &storage);
|
|
|
|
if(storage != stop)
|
|
|
|
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
|
|
|
|
gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
|
2009-03-24 21:28:02 +03:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((gwin->tabs) && (ClickTabBase->lib_Version < 53))
|
2008-10-06 11:07:33 +04:00
|
|
|
{
|
2011-09-07 00:58:26 +04:00
|
|
|
GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], &storage);
|
|
|
|
if(storage != tabclose)
|
|
|
|
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
|
|
|
|
gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
|
2008-10-06 11:07:33 +04:00
|
|
|
}
|
2008-08-19 22:31:56 +04:00
|
|
|
}
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
|
|
|
|
{
|
|
|
|
if(ClickTabBase->lib_Version < 53) return;
|
|
|
|
|
|
|
|
if(show)
|
|
|
|
{
|
2010-02-14 18:32:54 +03:00
|
|
|
struct TagItem attrs[3];
|
|
|
|
|
|
|
|
attrs[0].ti_Tag = CHILD_WeightedWidth;
|
|
|
|
attrs[0].ti_Data = 0;
|
|
|
|
attrs[1].ti_Tag = CHILD_WeightedHeight;
|
|
|
|
attrs[1].ti_Data = 0;
|
|
|
|
attrs[2].ti_Tag = TAG_DONE;
|
|
|
|
attrs[2].ti_Data = 0;
|
2010-02-14 17:00:33 +03:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
gwin->objects[GID_TABS] = ClickTabObject,
|
|
|
|
GA_ID, GID_TABS,
|
|
|
|
GA_RelVerify, TRUE,
|
|
|
|
GA_Underscore, 13, // disable kb shortcuts
|
|
|
|
CLICKTAB_Labels, &gwin->tab_list,
|
|
|
|
CLICKTAB_LabelTruncate, TRUE,
|
|
|
|
CLICKTAB_CloseImage, gwin->objects[GID_CLOSETAB_BM],
|
|
|
|
CLICKTAB_FlagImage, gwin->objects[GID_TABS_FLAG],
|
|
|
|
ClickTabEnd;
|
|
|
|
|
2010-02-14 17:00:33 +03:00
|
|
|
gwin->objects[GID_ADDTAB] = ButtonObject,
|
|
|
|
GA_ID, GID_ADDTAB,
|
|
|
|
GA_RelVerify, TRUE,
|
2010-03-18 00:43:23 +03:00
|
|
|
GA_HintInfo, gwin->helphints[GID_ADDTAB],
|
2010-02-14 17:00:33 +03:00
|
|
|
GA_Text, "+",
|
|
|
|
BUTTON_RenderImage, gwin->objects[GID_ADDTAB_BM],
|
|
|
|
ButtonEnd;
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
IDoMethod(gwin->objects[GID_TABLAYOUT], LM_ADDCHILD,
|
|
|
|
gwin->win, gwin->objects[GID_TABS], NULL);
|
2010-02-14 17:00:33 +03:00
|
|
|
|
2010-02-14 18:32:54 +03:00
|
|
|
IDoMethod(gwin->objects[GID_TABLAYOUT], LM_ADDCHILD,
|
|
|
|
gwin->win, gwin->objects[GID_ADDTAB], attrs);
|
2010-02-14 03:46:53 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
IDoMethod(gwin->objects[GID_TABLAYOUT], LM_REMOVECHILD,
|
|
|
|
gwin->win, gwin->objects[GID_TABS]);
|
2010-02-14 17:00:33 +03:00
|
|
|
|
2010-02-14 18:32:54 +03:00
|
|
|
IDoMethod(gwin->objects[GID_TABLAYOUT], LM_REMOVECHILD,
|
2010-02-14 17:00:33 +03:00
|
|
|
gwin->win, gwin->objects[GID_ADDTAB]);
|
2010-02-14 03:46:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
|
|
|
|
|
|
|
|
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
|
|
|
|
gwin->win, NULL, TRUE);
|
|
|
|
|
|
|
|
gwin->redraw_required = true;
|
|
|
|
gwin->bw->reformat_pending = true;
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
2008-08-24 21:17:33 +04:00
|
|
|
struct browser_window *clone, bool new_tab)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
struct gui_window *g = NULL;
|
2008-08-10 00:27:36 +04:00
|
|
|
bool closegadg=TRUE;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct Node *node;
|
2012-03-22 13:34:34 +04:00
|
|
|
ULONG curx=nsoption_int(window_x),cury=nsoption_int(window_y),curw=nsoption_int(window_width),curh=nsoption_int(window_height);
|
Added ability to load toolbar images from a different path.
Default is still TBImages: (ie AISS, http://www.masonicons.de)
All of the following must be present, in any format that bitmap.image will load
(usually this means any picture.datatype subclasses):
home, home_g, home_s - Home button
nav_east, nav_east_g, nav_east_s - History forward
nav_west, nav_west_g, nav_west_s - History back
reload, reload_g, reload_s - Reload
stop, stop_g, stop_s - Stop
The _g and _s files are ghosted and selected versions respectively.
To set the path, use toolbar_images:<path> in Options.
svn path=/trunk/netsurf/; revision=5304
2008-09-12 01:32:55 +04:00
|
|
|
char nav_west[100],nav_west_s[100],nav_west_g[100];
|
|
|
|
char nav_east[100],nav_east_s[100],nav_east_g[100];
|
|
|
|
char stop[100],stop_s[100],stop_g[100];
|
|
|
|
char reload[100],reload_s[100],reload_g[100];
|
|
|
|
char home[100],home_s[100],home_g[100];
|
2009-02-18 23:04:59 +03:00
|
|
|
char closetab[100],closetab_s[100],closetab_g[100];
|
2010-02-14 17:00:33 +03:00
|
|
|
char addtab[100],addtab_s[100],addtab_g[100];
|
2009-09-06 15:23:35 +04:00
|
|
|
char tabthrobber[100];
|
2012-04-29 03:23:29 +04:00
|
|
|
ULONG refresh_mode = WA_SmartRefresh;
|
2008-09-04 02:02:41 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (!scrn) ami_openscreenfirst();
|
2009-09-29 02:17:09 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_bool(kiosk_mode)) new_tab = false;
|
2009-02-07 19:40:56 +03:00
|
|
|
bw->scale = 1.0;
|
2008-10-05 18:22:02 +04:00
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
if(clone)
|
|
|
|
{
|
|
|
|
if(clone->window)
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
curx=clone->window->shared->win->LeftEdge;
|
|
|
|
cury=clone->window->shared->win->TopEdge;
|
|
|
|
curw=clone->window->shared->win->Width;
|
|
|
|
curh=clone->window->shared->win->Height;
|
2008-09-04 02:02:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g = AllocVec(sizeof(struct gui_window),MEMF_PRIVATE | MEMF_CLEAR);
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
if(!g)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
warn_user("NoMemory","");
|
2008-08-31 01:32:05 +04:00
|
|
|
return NULL;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
NewList(&g->dllist);
|
2009-03-28 15:50:19 +03:00
|
|
|
|
2011-09-04 22:50:46 +04:00
|
|
|
if(new_tab && clone)
|
2008-10-05 03:29:17 +04:00
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared = clone->window->shared;
|
|
|
|
g->tab = g->shared->next_tab;
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
if(g->shared->tabs == 1)
|
|
|
|
ami_toggletabbar(g->shared, true);
|
2010-02-14 03:46:53 +03:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
|
|
|
|
g->shared->win, NULL,
|
2010-02-14 03:46:53 +03:00
|
|
|
CLICKTAB_Labels, ~0,
|
2008-10-05 03:29:17 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
|
|
|
|
TNA_Number,g->tab,
|
2008-10-05 03:29:17 +04:00
|
|
|
TNA_UserData,bw,
|
2010-02-14 03:46:53 +03:00
|
|
|
TNA_CloseGadget, TRUE,
|
2008-10-05 03:29:17 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(new_tab_last))
|
2011-07-03 02:04:51 +04:00
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
AddTail(&g->shared->tab_list, g->tab_node);
|
2011-07-03 02:04:51 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-03 02:40:45 +04:00
|
|
|
struct Node *insert_after = clone->window->tab_node;
|
|
|
|
|
|
|
|
if(clone->window->last_new_tab)
|
|
|
|
insert_after = clone->window->last_new_tab;
|
2012-04-29 20:13:53 +04:00
|
|
|
Insert(&g->shared->tab_list, g->tab_node, insert_after);
|
|
|
|
clone->window->last_new_tab = g->tab_node;
|
2011-07-03 02:04:51 +04:00
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
|
|
|
|
g->shared->win, NULL,
|
|
|
|
CLICKTAB_Labels, &g->shared->tab_list,
|
2008-10-05 03:29:17 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(new_tab_active))
|
2008-10-05 17:17:18 +04:00
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL,
|
|
|
|
CLICKTAB_Current,g->tab,
|
2008-10-05 17:17:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
2009-09-01 02:10:05 +04:00
|
|
|
if(ClickTabBase->lib_Version < 53)
|
2012-04-29 20:13:53 +04:00
|
|
|
RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->tabs++;
|
|
|
|
g->shared->next_tab++;
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
if(nsoption_bool(new_tab_active)) ami_switch_tab(g->shared,false);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
ami_update_buttons(g->shared);
|
2008-11-09 02:08:55 +03:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
return g;
|
2008-10-05 03:29:17 +04:00
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared = AllocVec(sizeof(struct gui_window_2),MEMF_PRIVATE | MEMF_CLEAR);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
if(!g->shared)
|
2008-10-05 03:29:17 +04:00
|
|
|
{
|
|
|
|
warn_user("NoMemory","");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook;
|
|
|
|
g->shared->scrollerhook.h_Data = g->shared;
|
2008-08-25 17:32:26 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->search_ico_hook.h_Entry = (void *)ami_set_search_ico_render_hook;
|
|
|
|
g->shared->search_ico_hook.h_Data = g->shared;
|
2011-09-13 02:38:51 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->favicon_hook.h_Entry = (void *)ami_set_favicon_render_hook;
|
|
|
|
g->shared->favicon_hook.h_Data = g->shared;
|
2012-04-29 19:59:37 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->throbber_hook.h_Entry = (void *)ami_set_throbber_render_hook;
|
|
|
|
g->shared->throbber_hook.h_Data = g->shared;
|
2012-04-29 19:59:37 +04:00
|
|
|
|
2012-04-07 21:16:32 +04:00
|
|
|
newprefs_hook.h_Entry = (void *)ami_gui_newprefs_hook;
|
|
|
|
newprefs_hook.h_Data = 0;
|
|
|
|
|
2012-04-29 03:23:29 +04:00
|
|
|
if(nsoption_bool(window_simple_refresh) == true) {
|
|
|
|
refresh_mode = WA_SimpleRefresh;
|
|
|
|
} else {
|
|
|
|
refresh_mode = WA_SmartRefresh;
|
|
|
|
}
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(!nsoption_bool(kiosk_mode))
|
2011-09-04 22:53:54 +04:00
|
|
|
{
|
|
|
|
ULONG addtabclosegadget = TAG_IGNORE;
|
|
|
|
ULONG iconifygadget = FALSE;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if (nsoption_charp(use_pubscreen) &&
|
|
|
|
(locked_screen == TRUE) &&
|
|
|
|
(strcmp(nsoption_charp(use_pubscreen), "Workbench") == 0))
|
2011-09-04 22:53:54 +04:00
|
|
|
iconifygadget = TRUE;
|
2012-04-29 20:13:53 +04:00
|
|
|
ami_create_menu(g->shared);
|
2011-09-04 22:53:54 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
NewList(&g->shared->tab_list);
|
|
|
|
g->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
|
2011-09-04 22:53:54 +04:00
|
|
|
TNA_Number, 0,
|
|
|
|
TNA_UserData, bw,
|
|
|
|
TNA_CloseGadget, TRUE,
|
|
|
|
TAG_DONE);
|
2012-04-29 20:13:53 +04:00
|
|
|
AddTail(&g->shared->tab_list,g->tab_node);
|
2011-09-04 22:53:54 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->tabs=1;
|
|
|
|
g->shared->next_tab=1;
|
2011-09-04 22:53:54 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->svbuffer = AllocVec(2000, MEMF_CLEAR);
|
2011-09-04 22:53:54 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_BACK] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar0"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_FORWARD] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar1"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_STOP] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar2"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_RELOAD] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar3"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_HOME] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar4"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_URL] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpToolbar14"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_SEARCHSTRING] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpWebSearch"), true);
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->helphints[GID_ADDTAB] =
|
2011-09-04 22:53:54 +04:00
|
|
|
remove_escape_chars(messages_get("HelpAddTab"), true);
|
|
|
|
|
|
|
|
ami_get_theme_filename(nav_west,"theme_nav_west",false);
|
|
|
|
ami_get_theme_filename(nav_west_s,"theme_nav_west_s",false);
|
|
|
|
ami_get_theme_filename(nav_west_g,"theme_nav_west_g",false);
|
|
|
|
ami_get_theme_filename(nav_east,"theme_nav_east",false);
|
|
|
|
ami_get_theme_filename(nav_east_s,"theme_nav_east_s",false);
|
|
|
|
ami_get_theme_filename(nav_east_g,"theme_nav_east_g",false);
|
|
|
|
ami_get_theme_filename(stop,"theme_stop",false);
|
|
|
|
ami_get_theme_filename(stop_s,"theme_stop_s",false);
|
|
|
|
ami_get_theme_filename(stop_g,"theme_stop_g",false);
|
|
|
|
ami_get_theme_filename(reload,"theme_reload",false);
|
|
|
|
ami_get_theme_filename(reload_s,"theme_reload_s",false);
|
|
|
|
ami_get_theme_filename(reload_g,"theme_reload_g",false);
|
|
|
|
ami_get_theme_filename(home,"theme_home",false);
|
|
|
|
ami_get_theme_filename(home_s,"theme_home_s",false);
|
|
|
|
ami_get_theme_filename(home_g,"theme_home_g",false);
|
|
|
|
ami_get_theme_filename(closetab,"theme_closetab",false);
|
|
|
|
ami_get_theme_filename(closetab_s,"theme_closetab_s",false);
|
|
|
|
ami_get_theme_filename(closetab_g,"theme_closetab_g",false);
|
|
|
|
ami_get_theme_filename(addtab,"theme_addtab",false);
|
|
|
|
ami_get_theme_filename(addtab_s,"theme_addtab_s",false);
|
|
|
|
ami_get_theme_filename(addtab_g,"theme_addtab_g",false);
|
|
|
|
ami_get_theme_filename(tabthrobber,"theme_tab_loading",false);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_ADDTAB_BM] = BitMapObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
BITMAP_SourceFile, addtab,
|
|
|
|
BITMAP_SelectSourceFile, addtab_s,
|
|
|
|
BITMAP_DisabledSourceFile, addtab_g,
|
|
|
|
BITMAP_Screen, scrn,
|
|
|
|
BITMAP_Masking, TRUE,
|
|
|
|
BitMapEnd;
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_CLOSETAB_BM] = BitMapObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
BITMAP_SourceFile, closetab,
|
|
|
|
BITMAP_SelectSourceFile, closetab_s,
|
|
|
|
BITMAP_DisabledSourceFile, closetab_g,
|
|
|
|
BITMAP_Screen, scrn,
|
|
|
|
BITMAP_Masking, TRUE,
|
|
|
|
BitMapEnd;
|
|
|
|
|
|
|
|
if(ClickTabBase->lib_Version < 53)
|
|
|
|
{
|
|
|
|
addtabclosegadget = LAYOUT_AddChild;
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_CLOSETAB] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID, GID_CLOSETAB,
|
|
|
|
GA_RelVerify, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
BUTTON_RenderImage, g->shared->objects[GID_CLOSETAB_BM],
|
2011-09-04 22:53:54 +04:00
|
|
|
ButtonEnd;
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_TABS] = ClickTabObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_TABS,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Underscore,13, // disable kb shortcuts
|
2012-04-29 20:13:53 +04:00
|
|
|
CLICKTAB_Labels,&g->shared->tab_list,
|
2011-09-04 22:53:54 +04:00
|
|
|
CLICKTAB_LabelTruncate,TRUE,
|
|
|
|
ClickTabEnd;
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_ADDTAB] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID, GID_ADDTAB,
|
|
|
|
GA_RelVerify, TRUE,
|
|
|
|
GA_Text, "+",
|
2012-04-29 20:13:53 +04:00
|
|
|
BUTTON_RenderImage, g->shared->objects[GID_ADDTAB_BM],
|
2011-09-04 22:53:54 +04:00
|
|
|
ButtonEnd;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_TABS_FLAG] = BitMapObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
BITMAP_SourceFile, tabthrobber,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd;
|
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[OID_MAIN] = WindowObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
WA_ScreenTitle,nsscreentitle,
|
|
|
|
WA_Activate, TRUE,
|
|
|
|
WA_DepthGadget, TRUE,
|
|
|
|
WA_DragBar, TRUE,
|
|
|
|
WA_CloseGadget, TRUE,
|
|
|
|
WA_SizeGadget, TRUE,
|
|
|
|
WA_Top,cury,
|
|
|
|
WA_Left,curx,
|
|
|
|
WA_Width,curw,
|
|
|
|
WA_Height,curh,
|
|
|
|
WA_CustomScreen,scrn,
|
|
|
|
WA_ReportMouse,TRUE,
|
2012-04-29 03:23:29 +04:00
|
|
|
refresh_mode, TRUE,
|
2011-09-04 22:53:54 +04:00
|
|
|
WA_SizeBBottom, TRUE,
|
2012-04-29 19:59:37 +04:00
|
|
|
WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
|
2011-09-04 22:53:54 +04:00
|
|
|
IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
|
|
|
IDCMP_RAWKEY | IDCMP_SIZEVERIFY |
|
|
|
|
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
2012-02-25 00:00:51 +04:00
|
|
|
IDCMP_REFRESHWINDOW |
|
|
|
|
IDCMP_ACTIVEWINDOW | IDCMP_EXTENDEDMOUSE,
|
2011-09-04 22:53:54 +04:00
|
|
|
WINDOW_IconifyGadget, iconifygadget,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_NewMenu, g->shared->menu,
|
2012-04-29 19:59:37 +04:00
|
|
|
WINDOW_MenuUserData, WGUD_HOOK,
|
|
|
|
WINDOW_VertProp, 1,
|
|
|
|
WINDOW_NewPrefsHook, &newprefs_hook,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_IDCMPHook, &g->shared->scrollerhook,
|
2012-04-29 03:23:29 +04:00
|
|
|
WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_REFRESHWINDOW |
|
2011-09-04 22:53:54 +04:00
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
|
2012-04-29 19:59:37 +04:00
|
|
|
WINDOW_SharedPort, sport,
|
|
|
|
WINDOW_BuiltInScroll, TRUE,
|
2011-09-04 22:53:54 +04:00
|
|
|
WINDOW_GadgetHelp, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_UserData, g->shared,
|
|
|
|
WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = VGroupObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
LAYOUT_SpaceOuter, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_TOOLBARLAYOUT] = HGroupObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
LAYOUT_VertAlignment, LALIGN_CENTER,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_BACK] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_BACK,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Disabled,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_BACK],
|
2011-09-04 22:53:54 +04:00
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,nav_west,
|
|
|
|
BITMAP_SelectSourceFile,nav_west_s,
|
|
|
|
BITMAP_DisabledSourceFile,nav_west_g,
|
2010-02-14 17:00:33 +03:00
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
2011-09-04 22:53:54 +04:00
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_FORWARD] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_FORWARD,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Disabled,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_FORWARD],
|
2011-09-04 22:53:54 +04:00
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,nav_east,
|
|
|
|
BITMAP_SelectSourceFile,nav_east_s,
|
|
|
|
BITMAP_DisabledSourceFile,nav_east_g,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_STOP] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_STOP,
|
|
|
|
GA_RelVerify,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_STOP],
|
2011-09-04 22:53:54 +04:00
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,stop,
|
|
|
|
BITMAP_SelectSourceFile,stop_s,
|
|
|
|
BITMAP_DisabledSourceFile,stop_g,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_RELOAD] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_RELOAD,
|
|
|
|
GA_RelVerify,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_RELOAD],
|
2011-09-04 22:53:54 +04:00
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,reload,
|
|
|
|
BITMAP_SelectSourceFile,reload_s,
|
|
|
|
BITMAP_DisabledSourceFile,reload_g,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_HOME] = ButtonObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_HOME,
|
|
|
|
GA_RelVerify,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_HOME],
|
2011-09-04 22:53:54 +04:00
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,home,
|
|
|
|
BITMAP_SelectSourceFile,home_s,
|
|
|
|
BITMAP_DisabledSourceFile,home_g,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_ICON] = SpaceObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID, GID_ICON,
|
|
|
|
SPACE_MinWidth, 16,
|
|
|
|
SPACE_MinHeight, 16,
|
|
|
|
SPACE_Transparent, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
// SPACE_RenderHook, &g->shared->favicon_hook,
|
2011-09-04 22:53:54 +04:00
|
|
|
SpaceEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_URL] =
|
2011-09-04 22:53:54 +04:00
|
|
|
NewObject(urlStringClass, NULL,
|
2011-12-02 16:47:11 +04:00
|
|
|
STRINGA_MaxChars, 2000,
|
|
|
|
GA_ID, GID_URL,
|
|
|
|
GA_RelVerify, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_URL],
|
2011-12-02 16:47:11 +04:00
|
|
|
GA_TabCycle, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
STRINGA_Buffer, g->shared->svbuffer,
|
2011-12-02 16:47:11 +04:00
|
|
|
STRINGVIEW_Header, URLHistory_GetList(),
|
2011-09-04 22:53:54 +04:00
|
|
|
StringEnd,
|
|
|
|
|
|
|
|
// GA_ID, GID_TOOLBARLAYOUT,
|
|
|
|
// GA_RelVerify, TRUE,
|
|
|
|
// LAYOUT_RelVerify, TRUE,
|
|
|
|
LAYOUT_WeightBar, TRUE,
|
|
|
|
LAYOUT_AddChild, HGroupObject,
|
|
|
|
LAYOUT_VertAlignment, LALIGN_CENTER,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_SEARCH_ICON] = SpaceObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID, GID_SEARCH_ICON,
|
|
|
|
SPACE_MinWidth, 16,
|
|
|
|
SPACE_MinHeight, 16,
|
|
|
|
SPACE_Transparent, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
SPACE_RenderHook, &g->shared->search_ico_hook,
|
2008-10-05 18:22:02 +04:00
|
|
|
SpaceEnd,
|
2011-09-04 22:53:54 +04:00
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_SEARCHSTRING] =StringObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_SEARCHSTRING,
|
|
|
|
STRINGA_TextVal, NULL,
|
|
|
|
GA_RelVerify,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_HintInfo, g->shared->helphints[GID_SEARCHSTRING],
|
2011-09-04 22:53:54 +04:00
|
|
|
StringEnd,
|
|
|
|
LayoutEnd,
|
|
|
|
CHILD_WeightedWidth, 0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_THROBBER,
|
|
|
|
SPACE_MinWidth,throbber_width,
|
|
|
|
SPACE_MinHeight,throbber_height,
|
|
|
|
SPACE_Transparent,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
// SPACE_RenderHook, &g->shared->throbber_hook,
|
2011-09-04 22:53:54 +04:00
|
|
|
SpaceEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LayoutEnd,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LAYOUT_AddImage, BevelObject,
|
|
|
|
BEVEL_Style, BVS_SBAR_VERT,
|
|
|
|
BevelEnd,
|
|
|
|
CHILD_WeightedHeight, 0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_TABLAYOUT] = HGroupObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
LAYOUT_SpaceInner,FALSE,
|
2012-04-29 20:13:53 +04:00
|
|
|
addtabclosegadget, g->shared->objects[GID_CLOSETAB],
|
2011-09-04 22:53:54 +04:00
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
addtabclosegadget, g->shared->objects[GID_TABS],
|
2011-09-04 22:53:54 +04:00
|
|
|
CHILD_CacheDomain,FALSE,
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
addtabclosegadget, g->shared->objects[GID_ADDTAB],
|
2011-09-04 22:53:54 +04:00
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LayoutEnd,
|
|
|
|
CHILD_WeightedHeight,0,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_BROWSER,
|
|
|
|
SPACE_Transparent,TRUE,
|
|
|
|
SpaceEnd,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* borderless kiosk mode window */
|
2012-04-29 20:13:53 +04:00
|
|
|
g->tab = 0;
|
|
|
|
g->shared->tabs = 0;
|
|
|
|
g->tab_node = NULL;
|
2011-09-04 22:53:54 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[OID_MAIN] = WindowObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
WA_ScreenTitle,nsscreentitle,
|
|
|
|
WA_Activate, TRUE,
|
|
|
|
WA_DepthGadget, FALSE,
|
|
|
|
WA_DragBar, FALSE,
|
|
|
|
WA_CloseGadget, FALSE,
|
|
|
|
WA_Borderless,TRUE,
|
|
|
|
WA_RMBTrap,TRUE,
|
|
|
|
WA_Top,0,
|
|
|
|
WA_Left,0,
|
|
|
|
WA_Width, scrn->Width,
|
|
|
|
WA_Height, scrn->Height,
|
|
|
|
WA_SizeGadget, FALSE,
|
2012-04-29 03:23:29 +04:00
|
|
|
WA_CustomScreen, scrn,
|
|
|
|
WA_ReportMouse, TRUE,
|
|
|
|
refresh_mode, TRUE,
|
|
|
|
WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
|
2011-09-04 22:53:54 +04:00
|
|
|
IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
2012-04-29 03:23:29 +04:00
|
|
|
IDCMP_RAWKEY | IDCMP_REFRESHWINDOW |
|
2011-09-04 22:53:54 +04:00
|
|
|
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
|
|
|
IDCMP_EXTENDEDMOUSE,
|
|
|
|
WINDOW_HorizProp,1,
|
|
|
|
WINDOW_VertProp,1,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_IDCMPHook,&g->shared->scrollerhook,
|
2012-04-29 03:23:29 +04:00
|
|
|
WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE |
|
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_REFRESHWINDOW,
|
2011-09-04 22:53:54 +04:00
|
|
|
WINDOW_SharedPort,sport,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_UserData,g->shared,
|
2011-09-04 22:53:54 +04:00
|
|
|
WINDOW_BuiltInScroll,TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = VGroupObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
LAYOUT_SpaceOuter, TRUE,
|
2012-04-29 20:13:53 +04:00
|
|
|
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
|
2011-09-04 22:53:54 +04:00
|
|
|
GA_ID,GID_BROWSER,
|
|
|
|
SPACE_Transparent,TRUE,
|
|
|
|
SpaceEnd,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
}
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
if(!g->shared->win)
|
2008-08-31 01:32:05 +04:00
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
warn_user("NoMemory","");
|
2012-04-29 20:13:53 +04:00
|
|
|
FreeVec(g->shared);
|
|
|
|
FreeVec(g);
|
2008-08-31 01:32:05 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
GetAttr(WINDOW_VertObject, g->shared->objects[OID_MAIN],
|
|
|
|
(ULONG *)&g->shared->objects[OID_VSCROLL]);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_VSCROLL],
|
|
|
|
g->shared->win, NULL,
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_ID, OID_VSCROLL,
|
|
|
|
ICA_TARGET, ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(kiosk_mode) == false)
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
|
|
|
ULONG sz, size1, size2;
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
sz = ami_get_border_gadget_balance(g->shared,
|
2009-08-29 03:12:18 +04:00
|
|
|
(ULONG *)&size1, (ULONG *)&size2);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_HSCROLL] = NewObject(
|
2009-08-29 03:12:18 +04:00
|
|
|
NULL,
|
|
|
|
"scrollergclass",
|
|
|
|
GA_ID, GID_HSCROLL,
|
|
|
|
PGA_Freedom, FREEHORIZ,
|
2009-08-29 03:26:55 +04:00
|
|
|
GA_RelRight, 1 - size2 - sz,
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_Width, size2,
|
|
|
|
GA_BottomBorder, TRUE,
|
2009-09-05 02:00:09 +04:00
|
|
|
GA_Immediate, TRUE,
|
|
|
|
ICA_TARGET, ICTARGET_IDCMP,
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_DrawInfo, dri,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
GetAttr(GA_Height, (Object *)g->shared->objects[GID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
(ULONG *)&sz);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->objects[GID_STATUS] = NewObject(
|
2009-08-29 03:12:18 +04:00
|
|
|
NULL,
|
|
|
|
"frbuttonclass",
|
|
|
|
GA_ID, GID_STATUS,
|
2012-02-12 03:17:47 +04:00
|
|
|
GA_Left, scrn->WBorLeft + 2,
|
2010-04-02 14:29:20 +04:00
|
|
|
GA_RelBottom, -((2 + sz + scrn->WBorBottom - scrn->RastPort.TxHeight)/2),
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_Width, size1,
|
|
|
|
GA_DrawInfo, dri,
|
|
|
|
GA_BottomBorder, TRUE,
|
2009-09-16 02:49:33 +04:00
|
|
|
GA_ReadOnly, TRUE,
|
|
|
|
GA_Image, (struct Image *)NewObject(
|
|
|
|
NULL,
|
2012-04-01 01:49:50 +04:00
|
|
|
"gaugeiclass",
|
2012-02-12 03:17:47 +04:00
|
|
|
IA_Top, 2 - (scrn->RastPort.TxHeight),
|
2012-04-02 22:05:09 +04:00
|
|
|
IA_Left, -4,
|
2012-02-12 03:17:47 +04:00
|
|
|
IA_Height, 4 + scrn->RastPort.TxHeight,
|
2009-09-16 02:49:33 +04:00
|
|
|
IA_InBorder, TRUE,
|
2012-04-01 01:49:50 +04:00
|
|
|
IA_Label, NULL,
|
|
|
|
IA_Screen, scrn,
|
|
|
|
GAUGEIA_Level, 0,
|
2009-09-16 02:49:33 +04:00
|
|
|
TAG_DONE),
|
2012-04-29 20:13:53 +04:00
|
|
|
GA_Next, g->shared->objects[GID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
AddGList(g->shared->win, (struct Gadget *)g->shared->objects[GID_STATUS],
|
2009-08-29 03:12:18 +04:00
|
|
|
(UWORD)~0, -1, NULL);
|
|
|
|
|
2009-09-16 02:49:33 +04:00
|
|
|
/* Apparently you can't set GA_Width on creation time for frbuttonclass */
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
|
|
|
|
g->shared->win, NULL,
|
2009-09-16 02:49:33 +04:00
|
|
|
GA_Width, size1,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
RefreshGadgets((APTR)g->shared->objects[GID_STATUS],
|
|
|
|
g->shared->win, NULL);
|
2009-08-29 03:12:18 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-29 20:13:53 +04:00
|
|
|
GetAttr(WINDOW_HorizObject, g->shared->objects[OID_MAIN],
|
|
|
|
(ULONG *)&g->shared->objects[OID_HSCROLL]);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
|
|
|
|
g->shared->win, NULL,
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_ID, OID_HSCROLL,
|
|
|
|
ICA_TARGET, ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->rmbtrapped = FALSE;
|
|
|
|
g->shared->bw = bw;
|
2008-10-26 02:22:34 +03:00
|
|
|
curbw = bw;
|
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->appwin = AddAppWindowA((ULONG)g->shared->objects[OID_MAIN],
|
|
|
|
(ULONG)g->shared, g->shared->win, appport, NULL);
|
2012-04-28 23:43:46 +04:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
g->shared->node = AddObject(window_list,AMINS_WINDOW);
|
|
|
|
g->shared->node->objstruct = g->shared;
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2009-07-09 22:52:55 +04:00
|
|
|
glob = &browserglob;
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(locked_screen) UnlockPubScreen(NULL,scrn);
|
2011-03-05 17:36:55 +03:00
|
|
|
search_web_retrieve_ico(false);
|
2009-12-22 02:25:35 +03:00
|
|
|
|
2012-04-29 20:13:53 +04:00
|
|
|
return g;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin)
|
|
|
|
{
|
|
|
|
/* Reset gadget widths according to new calculation */
|
|
|
|
ULONG size1, size2, sz;
|
|
|
|
|
|
|
|
sz = ami_get_border_gadget_balance(gwin, &size1, &size2);
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
gwin->win, NULL,
|
|
|
|
GA_RelRight, - size2 - sz,
|
|
|
|
GA_Width, size2,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
|
2009-08-29 03:12:18 +04:00
|
|
|
gwin->win, NULL,
|
|
|
|
GA_Width, size1,
|
|
|
|
TAG_DONE);
|
2009-08-29 14:16:19 +04:00
|
|
|
|
2010-03-21 17:53:09 +03:00
|
|
|
RefreshWindowFrame(gwin->win);
|
2009-08-29 03:12:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2)
|
|
|
|
{
|
|
|
|
/* Get the sizes that border gadget 1 (status) and 2 (hscroller) need to be.
|
|
|
|
** Returns the width of the vertical scroller (right-hand window border) as
|
|
|
|
** a convenience.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ULONG sz;
|
|
|
|
ULONG available_width;
|
|
|
|
float gad1percent;
|
|
|
|
|
|
|
|
GetAttr(GA_Width, gwin->objects[OID_VSCROLL], (ULONG *)&sz);
|
|
|
|
|
|
|
|
available_width = gwin->win->Width - scrn->WBorLeft - sz;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
gad1percent = nsoption_int(toolbar_status_width) / 10000.0;
|
2009-08-29 03:12:18 +04:00
|
|
|
|
2009-09-16 02:49:33 +04:00
|
|
|
*size1 = (ULONG)(available_width * gad1percent);
|
|
|
|
*size2 = (ULONG)(available_width * (1 - gad1percent));
|
2009-08-29 03:12:18 +04:00
|
|
|
|
|
|
|
return sz;
|
|
|
|
}
|
|
|
|
|
2008-10-06 11:07:33 +04:00
|
|
|
void ami_close_all_tabs(struct gui_window_2 *gwin)
|
|
|
|
{
|
|
|
|
struct Node *tab;
|
|
|
|
struct Node *ntab;
|
|
|
|
|
|
|
|
if(gwin->tabs)
|
|
|
|
{
|
|
|
|
tab = GetHead(&gwin->tab_list);
|
|
|
|
|
2008-10-06 22:20:16 +04:00
|
|
|
do
|
2008-10-06 11:07:33 +04:00
|
|
|
{
|
2008-10-06 22:20:16 +04:00
|
|
|
ntab=GetSucc(tab);
|
2008-10-06 11:07:33 +04:00
|
|
|
GetClickTabNodeAttrs(tab,
|
|
|
|
TNA_UserData,&gwin->bw,
|
|
|
|
TAG_DONE);
|
|
|
|
browser_window_destroy(gwin->bw);
|
2008-10-06 22:20:16 +04:00
|
|
|
} while(tab=ntab);
|
2008-10-06 11:07:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_destroy(gwin->bw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_window_destroy(struct gui_window *g)
|
|
|
|
{
|
2008-10-05 17:17:18 +04:00
|
|
|
struct Node *ptab;
|
2010-02-14 18:32:54 +03:00
|
|
|
ULONG ptabnum = 0;
|
2010-03-17 02:55:39 +03:00
|
|
|
int gid;
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
|
|
|
|
2009-03-15 14:29:33 +03:00
|
|
|
if(g->shared->searchwin && (g->shared->searchwin->gwin == g))
|
|
|
|
{
|
|
|
|
ami_search_close();
|
|
|
|
win_destroyed = true;
|
|
|
|
}
|
2009-01-11 01:57:23 +03:00
|
|
|
|
2009-03-15 14:29:33 +03:00
|
|
|
if(g->hw)
|
|
|
|
{
|
|
|
|
ami_history_close(g->hw);
|
|
|
|
win_destroyed = true;
|
|
|
|
}
|
2009-03-15 14:21:46 +03:00
|
|
|
|
2009-03-28 15:50:19 +03:00
|
|
|
ami_free_download_list(&g->dllist);
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
curbw = NULL;
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
if(g->shared->tabs > 1)
|
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL,
|
2008-10-05 17:17:18 +04:00
|
|
|
CLICKTAB_Labels,~0,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2010-02-14 18:32:54 +03:00
|
|
|
GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS],
|
|
|
|
(ULONG *)&ptabnum);
|
|
|
|
|
|
|
|
if(ptabnum == g->tab)
|
|
|
|
{
|
|
|
|
ptab = GetSucc(g->tab_node);
|
|
|
|
if(!ptab) ptab = GetPred(g->tab_node);
|
|
|
|
|
|
|
|
GetClickTabNodeAttrs(ptab,TNA_Number,(ULONG *)&ptabnum,TAG_DONE);
|
|
|
|
}
|
2008-10-05 17:17:18 +04:00
|
|
|
|
|
|
|
Remove(g->tab_node);
|
|
|
|
FreeClickTabNode(g->tab_node);
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL,
|
2008-10-05 17:17:18 +04:00
|
|
|
CLICKTAB_Labels,&g->shared->tab_list,
|
|
|
|
CLICKTAB_Current,ptabnum,
|
|
|
|
TAG_DONE);
|
2009-09-01 02:10:05 +04:00
|
|
|
|
|
|
|
if(ClickTabBase->lib_Version < 53)
|
2010-02-13 21:03:05 +03:00
|
|
|
RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
g->shared->tabs--;
|
2008-10-05 17:17:18 +04:00
|
|
|
ami_switch_tab(g->shared,true);
|
2010-02-14 03:46:53 +03:00
|
|
|
|
|
|
|
if(g->shared->tabs == 1)
|
|
|
|
ami_toggletabbar(g->shared, false);
|
|
|
|
|
2010-03-18 01:15:03 +03:00
|
|
|
ami_utf8_free(g->tabtitle);
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
FreeVec(g);
|
2008-10-05 03:29:17 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DisposeObject(g->shared->objects[OID_MAIN]);
|
2011-07-03 15:05:18 +04:00
|
|
|
ami_gui_appicon_remove(g->shared);
|
2012-04-28 23:43:46 +04:00
|
|
|
if(g->shared->appwin) RemoveAppWindow(g->shared->appwin);
|
2009-07-23 15:23:34 +04:00
|
|
|
|
2011-03-01 01:12:34 +03:00
|
|
|
/* These aren't freed by the above.
|
|
|
|
* TODO: nav_west etc need freeing too */
|
|
|
|
DisposeObject(g->shared->objects[GID_ADDTAB_BM]);
|
|
|
|
DisposeObject(g->shared->objects[GID_CLOSETAB_BM]);
|
|
|
|
DisposeObject(g->shared->objects[GID_TABS_FLAG]);
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
ami_free_menulabs(g->shared);
|
2010-03-18 01:15:03 +03:00
|
|
|
free(g->shared->wintitle);
|
2009-08-29 14:16:19 +04:00
|
|
|
ami_utf8_free(g->shared->status);
|
2009-07-23 15:23:34 +04:00
|
|
|
FreeVec(g->shared->svbuffer);
|
|
|
|
|
2010-03-17 02:55:39 +03:00
|
|
|
for(gid = 0; gid < GID_LAST; gid++)
|
|
|
|
free(g->shared->helphints[gid]);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
DelObject(g->shared->node);
|
2008-10-05 17:17:18 +04:00
|
|
|
if(g->tab_node)
|
|
|
|
{
|
|
|
|
Remove(g->tab_node);
|
|
|
|
FreeClickTabNode(g->tab_node);
|
|
|
|
}
|
|
|
|
FreeVec(g); // g->shared should be freed by DelObject()
|
2008-08-09 19:19:04 +04:00
|
|
|
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
2009-10-03 15:00:10 +04:00
|
|
|
ami_try_quit();
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
2008-08-10 13:57:41 +04:00
|
|
|
|
|
|
|
win_destroyed = true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_set_title(struct gui_window *g, const char *title)
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
struct Node *node;
|
2008-10-05 17:17:18 +04:00
|
|
|
ULONG cur_tab = 0;
|
2009-09-16 02:49:33 +04:00
|
|
|
char *utf8title;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2009-09-16 02:49:33 +04:00
|
|
|
if(!title) return;
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
utf8title = ami_utf8_easy((char *)title);
|
|
|
|
|
2011-11-10 18:22:02 +04:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1))
|
2008-10-05 03:29:17 +04:00
|
|
|
{
|
2009-09-18 01:44:07 +04:00
|
|
|
node = g->tab_node;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2010-06-26 20:26:05 +04:00
|
|
|
if((g->tabtitle == NULL) || (strcmp(utf8title, g->tabtitle)))
|
|
|
|
{
|
|
|
|
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->win, NULL,
|
2010-06-26 20:26:05 +04:00
|
|
|
CLICKTAB_Labels, ~0,
|
2009-09-16 02:49:33 +04:00
|
|
|
TAG_DONE);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2010-06-26 20:26:05 +04:00
|
|
|
SetClickTabNodeAttrs(node, TNA_Text, utf8title,
|
|
|
|
TNA_HintInfo, utf8title,
|
|
|
|
TAG_DONE);
|
2010-03-18 01:15:03 +03:00
|
|
|
|
2010-06-26 20:26:05 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
|
|
|
|
g->shared->win, NULL,
|
|
|
|
CLICKTAB_Labels, &g->shared->tab_list,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
if(g->tabtitle) ami_utf8_free(g->tabtitle);
|
|
|
|
g->tabtitle = utf8title;
|
|
|
|
|
|
|
|
if(ClickTabBase->lib_Version < 53)
|
|
|
|
RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
|
|
|
|
g->shared->win, NULL, TRUE);
|
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2011-11-10 18:22:02 +04:00
|
|
|
GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS],
|
|
|
|
(ULONG *)&cur_tab);
|
2010-02-14 03:46:53 +03:00
|
|
|
}
|
2009-09-16 02:49:33 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2009-09-18 01:44:07 +04:00
|
|
|
{
|
|
|
|
if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle)))
|
|
|
|
{
|
2010-03-18 01:15:03 +03:00
|
|
|
if(g->shared->wintitle) free(g->shared->wintitle);
|
|
|
|
g->shared->wintitle = strdup(utf8title);
|
2009-09-18 01:44:07 +04:00
|
|
|
SetWindowTitles(g->shared->win, g->shared->wintitle, nsscreentitle);
|
2009-09-16 02:49:33 +04:00
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2012-02-25 22:42:33 +04:00
|
|
|
void ami_do_redraw_tiled(struct gui_window_2 *gwin,
|
2012-02-26 19:44:14 +04:00
|
|
|
int left, int top, int width, int height,
|
|
|
|
int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
|
2012-02-25 22:42:33 +04:00
|
|
|
{
|
2012-02-26 19:44:14 +04:00
|
|
|
int x, y;
|
2012-02-25 22:42:33 +04:00
|
|
|
struct rect clip;
|
2012-03-22 13:34:34 +04:00
|
|
|
int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->bw->scale);
|
|
|
|
int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->bw->scale);
|
2012-02-25 22:42:33 +04:00
|
|
|
|
|
|
|
if(top < 0) {
|
|
|
|
height += top;
|
|
|
|
top = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(left < 0) {
|
|
|
|
width += left;
|
|
|
|
left = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(top < sy) {
|
|
|
|
height += (top - sy);
|
|
|
|
top = sy;
|
|
|
|
}
|
|
|
|
if(left < sx) {
|
|
|
|
width += (left - sx);
|
|
|
|
left = sx;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(((top - sy) + height) > bbox->Height)
|
|
|
|
height = bbox->Height - (top - sy);
|
|
|
|
|
|
|
|
if(((left - sx) + width) > bbox->Width)
|
|
|
|
width = bbox->Width - (left - sx);
|
|
|
|
|
|
|
|
if(width <= 0) return;
|
|
|
|
if(height <= 0) return;
|
|
|
|
|
2012-02-26 19:44:14 +04:00
|
|
|
//printf("%ld %ld %ld %ld\n",left, top, width, height);
|
|
|
|
|
2012-03-03 19:41:14 +04:00
|
|
|
for(y = top; y < (top + height); y += tile_y_scale) {
|
2012-02-25 22:42:33 +04:00
|
|
|
clip.y0 = 0;
|
2012-03-22 13:34:34 +04:00
|
|
|
clip.y1 = nsoption_int(redraw_tile_size_y);
|
2012-03-03 19:41:14 +04:00
|
|
|
if((((y - sy) * gwin->bw->scale) + clip.y1) > bbox->Height)
|
|
|
|
clip.y1 = bbox->Height - ((y - sy) * gwin->bw->scale);
|
2012-02-25 22:42:33 +04:00
|
|
|
|
2012-03-03 19:41:14 +04:00
|
|
|
for(x = left; x < (left + width); x += tile_x_scale) {
|
2012-02-25 22:42:33 +04:00
|
|
|
clip.x0 = 0;
|
2012-03-22 13:34:34 +04:00
|
|
|
clip.x1 = nsoption_int(redraw_tile_size_x);
|
2012-03-03 19:41:14 +04:00
|
|
|
if((((x - sx) * gwin->bw->scale) + clip.x1) > bbox->Width)
|
|
|
|
clip.x1 = bbox->Width - ((x - sx) * gwin->bw->scale);
|
2012-02-25 22:42:33 +04:00
|
|
|
|
2012-03-03 19:41:14 +04:00
|
|
|
//printf("%ld %ld -> %ld %ld\n",clip.x0 - (int)(x), clip.y0 - (int)(y), clip.x1, clip.y1);
|
2012-02-26 19:44:14 +04:00
|
|
|
|
|
|
|
if(browser_window_redraw(gwin->bw,
|
2012-03-03 19:41:14 +04:00
|
|
|
clip.x0 - (int)x,
|
|
|
|
clip.y0 - (int)y,
|
2012-02-26 19:44:14 +04:00
|
|
|
&clip, ctx))
|
2012-02-25 22:42:33 +04:00
|
|
|
{
|
|
|
|
ami_clearclipreg(&browserglob);
|
|
|
|
|
|
|
|
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
|
|
|
|
BLITA_Source, browserglob.bm,
|
|
|
|
BLITA_SrcX, 0,
|
|
|
|
BLITA_SrcY, 0,
|
|
|
|
BLITA_DestType, BLITT_RASTPORT,
|
|
|
|
BLITA_Dest, gwin->win->RPort,
|
2012-03-03 19:41:14 +04:00
|
|
|
BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->bw->scale),
|
|
|
|
BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->bw->scale),
|
|
|
|
BLITA_Width, (int)(clip.x1),
|
|
|
|
BLITA_Height, (int)(clip.y1),
|
2012-02-25 22:42:33 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
/**
|
|
|
|
* Redraw an area of the browser window - Amiga-specific function
|
|
|
|
*
|
|
|
|
* \param g a struct gui_window
|
2011-03-04 22:13:23 +03:00
|
|
|
* \param bw a struct browser_window
|
2009-06-03 23:44:43 +04:00
|
|
|
* \param x0 top-left co-ordinate (in document co-ordinates)
|
|
|
|
* \param y0 top-left co-ordinate (in document co-ordinates)
|
|
|
|
* \param x1 bottom-right co-ordinate (in document co-ordinates)
|
|
|
|
* \param y1 bottom-right co-ordinate (in document co-ordinates)
|
|
|
|
*/
|
|
|
|
|
2011-02-11 22:03:01 +03:00
|
|
|
void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
|
|
|
|
int x0, int y0, int x1, int y1)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2009-06-03 23:44:43 +04:00
|
|
|
ULONG xoffset,yoffset,width=800,height=600;
|
|
|
|
ULONG htemp,vtemp;
|
2009-02-01 02:45:25 +03:00
|
|
|
struct IBox *bbox;
|
|
|
|
ULONG cur_tab = 0;
|
2010-06-05 14:37:02 +04:00
|
|
|
ULONG sx, sy;
|
2011-02-12 13:39:21 +03:00
|
|
|
struct rect clip;
|
2011-03-05 17:36:55 +03:00
|
|
|
struct RastPort *temprp;
|
|
|
|
int posx, posy;
|
2011-06-30 19:48:07 +04:00
|
|
|
struct redraw_context ctx = {
|
|
|
|
.interactive = true,
|
2011-12-24 02:39:25 +04:00
|
|
|
.background_images = true,
|
2011-06-30 19:48:07 +04:00
|
|
|
.plot = &amiplot
|
|
|
|
};
|
2009-02-01 02:45:25 +03:00
|
|
|
|
|
|
|
if(!g) return;
|
2011-03-04 22:13:23 +03:00
|
|
|
if(browser_window_redraw_ready(bw) == false) return;
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2010-06-05 13:59:38 +04:00
|
|
|
sx = g->scrollx;
|
|
|
|
sy = g->scrolly;
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(!((cur_tab == g->tab) || (g->shared->tabs <= 1)))
|
2009-02-01 02:45:25 +03:00
|
|
|
return;
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2012-02-25 22:42:33 +04:00
|
|
|
ami_do_redraw_tiled(g->shared, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox, &ctx);
|
|
|
|
return;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_redraw_window(struct gui_window *g)
|
2008-08-15 21:19:57 +04:00
|
|
|
{
|
2008-10-05 18:22:02 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2008-10-05 18:22:02 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2008-10-05 18:22:02 +04:00
|
|
|
g->shared->redraw_required = true;
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
|
2011-07-06 16:42:17 +04:00
|
|
|
void gui_window_update_box(struct gui_window *g, const struct rect *rect)
|
2008-08-15 21:19:57 +04:00
|
|
|
{
|
2009-08-18 17:06:28 +04:00
|
|
|
if(!g) return;
|
|
|
|
|
2011-02-11 22:03:01 +03:00
|
|
|
ami_do_redraw_limits(g, g->shared->bw,
|
2011-07-06 16:42:17 +04:00
|
|
|
rect->x0, rect->y0,
|
|
|
|
rect->x1, rect->y1);
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
void ami_do_redraw(struct gui_window_2 *g)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-08-30 20:57:35 +04:00
|
|
|
struct Region *reg = NULL;
|
|
|
|
struct Rectangle rect;
|
2010-03-28 19:51:05 +04:00
|
|
|
hlcache_handle *c;
|
2009-05-26 02:32:38 +04:00
|
|
|
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600,x0=0,y0=0;
|
2008-08-11 21:53:45 +04:00
|
|
|
struct IBox *bbox;
|
2009-01-11 00:31:21 +03:00
|
|
|
ULONG oldh=g->oldh,oldv=g->oldv;
|
2009-06-03 23:44:43 +04:00
|
|
|
bool morescroll = false;
|
2011-03-05 17:36:55 +03:00
|
|
|
struct RastPort *temprp;
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2011-03-04 22:13:23 +03:00
|
|
|
if(browser_window_redraw_ready(g->bw) == false) return;
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)g->objects[GID_BROWSER], (ULONG *)&bbox);
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_get_hscroll_pos(g, (ULONG *)&hcurrent);
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_vscroll_pos(g, (ULONG *)&vcurrent);
|
2008-08-07 22:44:28 +04:00
|
|
|
|
2011-12-24 16:49:55 +04:00
|
|
|
g->bw->window->scrollx = hcurrent;
|
|
|
|
g->bw->window->scrolly = vcurrent;
|
|
|
|
|
2008-08-07 22:44:28 +04:00
|
|
|
c = g->bw->current_content;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
|
|
|
xoffset=bbox->Left;
|
|
|
|
yoffset=bbox->Top;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-03-14 19:18:09 +03:00
|
|
|
if(g->bw->reformat_pending)
|
|
|
|
{
|
2011-06-24 13:30:33 +04:00
|
|
|
browser_window_reformat(g->bw,false,width,height);
|
2009-03-14 19:18:09 +03:00
|
|
|
g->bw->reformat_pending = false;
|
2009-05-31 19:05:26 +04:00
|
|
|
g->redraw_scroll = false;
|
2009-03-14 19:18:09 +03:00
|
|
|
}
|
|
|
|
|
2009-06-01 00:14:15 +04:00
|
|
|
if(g->redraw_scroll)
|
|
|
|
{
|
|
|
|
if((abs(vcurrent-oldv) > height) || (abs(hcurrent-oldh) > width))
|
|
|
|
g->redraw_scroll = false;
|
2009-06-19 22:32:31 +04:00
|
|
|
|
|
|
|
if(g->new_content) g->redraw_scroll = false;
|
2009-06-01 00:14:15 +04:00
|
|
|
|
2012-03-03 19:50:05 +04:00
|
|
|
//if(g->bw->scale != 1.0) g->redraw_scroll = false;
|
2011-02-24 02:11:26 +03:00
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2011-03-18 02:13:50 +03:00
|
|
|
if(g->redraw_scroll)
|
2009-01-11 00:31:21 +03:00
|
|
|
{
|
2010-03-17 02:55:39 +03:00
|
|
|
g->bw->window->c_h_temp = g->bw->window->c_h;
|
2010-03-15 21:48:14 +03:00
|
|
|
gui_window_remove_caret(g->bw->window);
|
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
ScrollWindowRaster(g->win,hcurrent-oldh,vcurrent-oldv,
|
2010-07-31 15:43:25 +04:00
|
|
|
xoffset,yoffset,xoffset+width-1,yoffset+height-1);
|
2009-02-02 00:28:59 +03:00
|
|
|
|
2010-03-17 02:55:39 +03:00
|
|
|
g->bw->window->c_h = g->bw->window->c_h_temp;
|
2010-03-15 21:48:14 +03:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
if(vcurrent>oldv)
|
2009-02-05 15:20:23 +03:00
|
|
|
{
|
2011-02-11 22:03:01 +03:00
|
|
|
ami_do_redraw_limits(g->bw->window, g->bw,
|
2012-03-03 19:50:05 +04:00
|
|
|
hcurrent, (height / g->bw->scale) + oldv - 1,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
|
|
|
vcurrent + (height / g->bw->scale) + 1);
|
2009-02-05 15:20:23 +03:00
|
|
|
}
|
2009-05-31 19:05:26 +04:00
|
|
|
else if(vcurrent<oldv)
|
2009-02-05 15:20:23 +03:00
|
|
|
{
|
2011-02-11 22:03:01 +03:00
|
|
|
ami_do_redraw_limits(g->bw->window, g->bw,
|
2012-03-03 19:50:05 +04:00
|
|
|
hcurrent, vcurrent,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
|
|
|
oldv);
|
2009-02-05 15:20:23 +03:00
|
|
|
}
|
2009-02-02 00:28:59 +03:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
if(hcurrent>oldh)
|
2009-02-05 15:20:23 +03:00
|
|
|
{
|
2011-02-11 22:03:01 +03:00
|
|
|
ami_do_redraw_limits(g->bw->window, g->bw,
|
2012-03-03 19:50:05 +04:00
|
|
|
(width / g->bw->scale) + oldh , vcurrent,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
|
|
|
vcurrent + (height / g->bw->scale));
|
2009-02-05 15:20:23 +03:00
|
|
|
}
|
2009-05-31 19:05:26 +04:00
|
|
|
else if(hcurrent<oldh)
|
2009-02-05 15:20:23 +03:00
|
|
|
{
|
2011-02-11 22:03:01 +03:00
|
|
|
ami_do_redraw_limits(g->bw->window, g->bw,
|
2012-03-03 19:50:05 +04:00
|
|
|
hcurrent, vcurrent,
|
|
|
|
oldh, vcurrent + (height / g->bw->scale));
|
2009-02-05 15:20:23 +03:00
|
|
|
}
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-12 13:39:21 +03:00
|
|
|
struct rect clip;
|
2011-06-30 19:48:07 +04:00
|
|
|
struct redraw_context ctx = {
|
|
|
|
.interactive = true,
|
2011-12-24 02:39:25 +04:00
|
|
|
.background_images = true,
|
2011-06-30 19:48:07 +04:00
|
|
|
.plot = &amiplot
|
|
|
|
};
|
2011-02-12 13:39:21 +03:00
|
|
|
|
2011-03-05 17:36:55 +03:00
|
|
|
glob = &browserglob;
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(direct_render) == false)
|
2011-03-05 17:36:55 +03:00
|
|
|
{
|
2012-02-25 22:42:33 +04:00
|
|
|
ami_do_redraw_tiled(g, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx);
|
2011-03-05 17:36:55 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
temprp = browserglob.rp;
|
|
|
|
browserglob.rp = g->win->RPort;
|
|
|
|
clip.x0 = bbox->Left;
|
|
|
|
clip.y0 = bbox->Top;
|
|
|
|
clip.x1 = bbox->Left + bbox->Width;
|
|
|
|
clip.y1 = bbox->Top + bbox->Height;
|
2011-03-04 22:05:12 +03:00
|
|
|
|
2012-02-25 22:42:33 +04:00
|
|
|
if(browser_window_redraw(g->bw, clip.x0 - hcurrent, clip.y0 - vcurrent, &clip, &ctx))
|
2011-03-05 17:36:55 +03:00
|
|
|
{
|
2012-02-25 22:42:33 +04:00
|
|
|
ami_clearclipreg(&browserglob);
|
|
|
|
browserglob.rp = temprp;
|
2011-03-05 17:36:55 +03:00
|
|
|
}
|
2011-02-13 22:59:32 +03:00
|
|
|
}
|
2009-01-15 23:03:15 +03:00
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-01-15 23:03:15 +03:00
|
|
|
ami_update_buttons(g);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2009-01-11 00:31:21 +03:00
|
|
|
g->oldh = hcurrent;
|
|
|
|
g->oldv = vcurrent;
|
2008-08-30 20:57:35 +04:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
g->redraw_scroll = false;
|
2008-08-15 21:19:57 +04:00
|
|
|
g->redraw_required = false;
|
2009-06-19 22:32:31 +04:00
|
|
|
g->new_content = false;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2012-02-25 00:00:51 +04:00
|
|
|
void ami_refresh_window(struct gui_window_2 *gwin)
|
|
|
|
{
|
2012-04-29 03:23:29 +04:00
|
|
|
/* simplerefresh only */
|
|
|
|
|
2012-02-25 00:00:51 +04:00
|
|
|
struct IBox *bbox;
|
2012-04-29 02:53:50 +04:00
|
|
|
int x0, x1, y0, y1, sx, sy;
|
2012-02-25 03:18:24 +04:00
|
|
|
struct RegionRectangle *regrect, *nregrect;
|
2012-02-25 00:00:51 +04:00
|
|
|
|
2012-04-29 02:53:50 +04:00
|
|
|
sx = gwin->bw->window->scrollx;
|
|
|
|
sy = gwin->bw->window->scrolly;
|
|
|
|
|
2012-02-25 00:00:51 +04:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox);
|
|
|
|
|
|
|
|
BeginRefresh(gwin->win);
|
|
|
|
|
2012-04-29 02:53:50 +04:00
|
|
|
x0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinX - bbox->Left) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sx;
|
|
|
|
x1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxX - bbox->Left) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sx;
|
|
|
|
y0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinY - bbox->Top) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sy;
|
|
|
|
y1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxY - bbox->Top) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sy;
|
2012-02-25 03:18:24 +04:00
|
|
|
|
|
|
|
regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle;
|
2012-02-25 00:00:51 +04:00
|
|
|
|
|
|
|
ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1);
|
|
|
|
|
2012-02-25 03:18:24 +04:00
|
|
|
while(regrect)
|
|
|
|
{
|
2012-04-29 02:53:50 +04:00
|
|
|
x0 = ((regrect->bounds.MinX - bbox->Left) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sx;
|
|
|
|
x1 = ((regrect->bounds.MaxX - bbox->Left) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sx;
|
|
|
|
y0 = ((regrect->bounds.MinY - bbox->Top) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sy;
|
|
|
|
y1 = ((regrect->bounds.MaxY - bbox->Top) /
|
|
|
|
browser_window_get_scale(gwin->bw)) + sy;
|
2012-02-25 03:18:24 +04:00
|
|
|
|
|
|
|
regrect = regrect->Next;
|
|
|
|
|
|
|
|
ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1);
|
|
|
|
}
|
|
|
|
|
2012-02-25 00:00:51 +04:00
|
|
|
EndRefresh(gwin->win, TRUE);
|
|
|
|
}
|
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
|
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
if(gwin->objects[GID_HSCROLL])
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(PGA_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
|
2009-08-29 03:12:18 +04:00
|
|
|
}
|
|
|
|
else if(gwin->objects[OID_HSCROLL])
|
|
|
|
{
|
|
|
|
GetAttr(SCROLLER_Top, gwin->objects[OID_HSCROLL], xs);
|
|
|
|
}
|
2009-08-31 01:43:14 +04:00
|
|
|
|
|
|
|
*xs /= gwin->bw->scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
|
|
|
|
{
|
|
|
|
GetAttr(SCROLLER_Top, gwin->objects[OID_VSCROLL], ys);
|
|
|
|
*ys /= gwin->bw->scale;
|
2009-08-29 03:12:18 +04:00
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
|
|
|
{
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_get_hscroll_pos(g->shared, (ULONG *)sx);
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_vscroll_pos(g->shared, (ULONG *)sy);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
|
|
|
{
|
2010-06-05 14:37:02 +04:00
|
|
|
struct IBox *bbox;
|
2008-10-06 01:20:12 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2009-01-25 03:36:30 +03:00
|
|
|
if(!g->shared->bw || !g->shared->bw->current_content) return;
|
2010-06-05 14:37:02 +04:00
|
|
|
|
|
|
|
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
|
|
|
|
|
|
|
|
if(sx < 0) sx=0;
|
|
|
|
if(sy < 0) sy=0;
|
|
|
|
|
2010-06-06 22:50:48 +04:00
|
|
|
if(sx >= content_get_width(g->shared->bw->current_content) - bbox->Width)
|
|
|
|
sx = content_get_width(g->shared->bw->current_content) - bbox->Width;
|
|
|
|
if(sy >= (content_get_height(g->shared->bw->current_content) - bbox->Height))
|
|
|
|
sy = content_get_height(g->shared->bw->current_content) - bbox->Height;
|
2010-06-05 14:37:02 +04:00
|
|
|
|
|
|
|
if(content_get_width(g->shared->bw->current_content) <= bbox->Width) sx = 0;
|
|
|
|
if(content_get_height(g->shared->bw->current_content) <= bbox->Height) sy = 0;
|
2008-10-06 21:47:31 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1))
|
|
|
|
GetAttr(CLICKTAB_Current,
|
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2008-10-06 01:20:12 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_VSCROLL],
|
2009-08-31 01:43:14 +04:00
|
|
|
g->shared->win, NULL,
|
2009-08-31 02:05:09 +04:00
|
|
|
SCROLLER_Top, (ULONG)(sy * g->shared->bw->scale),
|
2008-10-06 01:20:12 +04:00
|
|
|
TAG_DONE);
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
if(g->shared->objects[GID_HSCROLL])
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
g->shared->win, NULL,
|
2009-08-31 02:05:09 +04:00
|
|
|
PGA_Top, (ULONG)(sx * g->shared->bw->scale),
|
2009-08-29 03:12:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
else if(g->shared->objects[OID_HSCROLL])
|
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
g->shared->win, NULL,
|
2009-08-31 02:05:09 +04:00
|
|
|
SCROLLER_Top, (ULONG)(sx * g->shared->bw->scale),
|
2009-08-29 03:12:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-10-06 01:20:12 +04:00
|
|
|
g->shared->redraw_required = true;
|
2009-05-31 19:19:46 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(faster_scroll) == true) g->shared->redraw_scroll = true;
|
2009-06-04 22:19:27 +04:00
|
|
|
else g->shared->redraw_scroll = false;
|
|
|
|
|
2009-03-09 10:21:19 +03:00
|
|
|
g->scrollx = sx;
|
|
|
|
g->scrolly = sy;
|
2009-03-29 03:51:39 +04:00
|
|
|
|
2009-04-06 21:25:21 +04:00
|
|
|
// history_set_current_scroll(g->shared->bw->history,g->scrollx,g->scrolly);
|
2008-10-19 15:33:05 +04:00
|
|
|
}
|
2009-06-19 22:32:31 +04:00
|
|
|
// g->shared->new_content = false;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
|
|
|
|
int x1, int y1)
|
|
|
|
{
|
2008-12-14 02:25:42 +03:00
|
|
|
gui_window_set_scroll(g, x0, y0);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
|
|
|
|
bool scaled)
|
|
|
|
{
|
2008-08-11 21:53:45 +04:00
|
|
|
struct IBox *bbox;
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2008-08-07 22:44:28 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
|
|
|
*width = bbox->Width;
|
|
|
|
*height = bbox->Height;
|
2008-08-07 22:44:28 +04:00
|
|
|
|
|
|
|
if(scaled)
|
|
|
|
{
|
2009-01-11 00:31:21 +03:00
|
|
|
*width /= g->shared->bw->scale;
|
|
|
|
*height /= g->shared->bw->scale;
|
2008-08-07 22:44:28 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_update_extent(struct gui_window *g)
|
|
|
|
{
|
2008-08-17 20:22:40 +04:00
|
|
|
struct IBox *bbox;
|
2008-10-19 15:33:05 +04:00
|
|
|
ULONG cur_tab = 0;
|
2008-08-17 20:22:40 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2008-10-20 22:06:46 +04:00
|
|
|
if(!g->shared->bw->current_content) return;
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2008-10-19 15:33:05 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER],
|
|
|
|
(ULONG *)&bbox);
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
|
2010-03-28 19:51:05 +04:00
|
|
|
SCROLLER_Total, (ULONG)(content_get_height(g->shared->bw->current_content) * g->shared->bw->scale),
|
2009-08-31 01:43:14 +04:00
|
|
|
SCROLLER_Visible, bbox->Height,
|
2008-10-19 15:33:05 +04:00
|
|
|
TAG_DONE);
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
if(g->shared->objects[GID_HSCROLL])
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
g->shared->win, NULL,
|
2010-03-28 19:51:05 +04:00
|
|
|
PGA_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
|
2009-08-29 03:12:18 +04:00
|
|
|
PGA_Visible, bbox->Width,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
else if(g->shared->objects[OID_HSCROLL])
|
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
|
2009-08-29 03:12:18 +04:00
|
|
|
g->shared->win, NULL,
|
2010-03-28 19:51:05 +04:00
|
|
|
SCROLLER_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
|
2009-08-29 03:12:18 +04:00
|
|
|
SCROLLER_Visible, bbox->Width,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
}
|
2009-06-20 13:57:26 +04:00
|
|
|
g->shared->new_content = true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_set_status(struct gui_window *g, const char *text)
|
|
|
|
{
|
2008-10-19 15:33:05 +04:00
|
|
|
ULONG cur_tab = 0;
|
2009-08-29 14:16:19 +04:00
|
|
|
char *utf8text;
|
2010-02-11 21:49:03 +03:00
|
|
|
ULONG size;
|
|
|
|
UWORD chars;
|
|
|
|
struct TextExtent textex;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
|
|
|
if(!g) return;
|
2009-08-14 21:53:28 +04:00
|
|
|
if(!text) return;
|
2010-02-13 21:03:05 +03:00
|
|
|
if(!g->shared->objects[GID_STATUS]) return;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2008-10-19 15:33:05 +04:00
|
|
|
{
|
2009-09-04 22:10:15 +04:00
|
|
|
utf8text = ami_utf8_easy((char *)text);
|
2009-10-16 01:35:29 +04:00
|
|
|
if(utf8text == NULL) return;
|
2009-08-29 14:16:19 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(GA_Width, g->shared->objects[GID_STATUS], (ULONG *)&size);
|
2010-02-11 21:49:03 +03:00
|
|
|
chars = TextFit(&scrn->RastPort, utf8text, strlen(utf8text),
|
2010-04-02 14:49:18 +04:00
|
|
|
&textex, NULL, 1, size - 4, scrn->RastPort.TxHeight);
|
2010-01-09 02:13:20 +03:00
|
|
|
|
2010-02-11 21:49:03 +03:00
|
|
|
utf8text[chars] = 0;
|
2010-01-09 02:13:20 +03:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
|
2010-02-11 21:49:03 +03:00
|
|
|
g->shared->win, NULL,
|
|
|
|
GA_Text, utf8text,
|
|
|
|
TAG_DONE);
|
2009-08-29 03:12:18 +04:00
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshGList((struct Gadget *)g->shared->objects[GID_STATUS],
|
|
|
|
g->shared->win, NULL, 1);
|
2009-08-29 14:16:19 +04:00
|
|
|
|
2010-02-11 21:49:03 +03:00
|
|
|
if(g->shared->status) ami_utf8_free(g->shared->status);
|
|
|
|
g->shared->status = utf8text;
|
2008-10-19 15:33:05 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_set_url(struct gui_window *g, const char *url)
|
|
|
|
{
|
2008-10-05 17:17:18 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2008-10-19 15:33:05 +04:00
|
|
|
if(!url) return;
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2008-10-05 17:17:18 +04:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_URL],
|
|
|
|
g->shared->win, NULL, STRINGA_TextVal, url, TAG_DONE);
|
2008-10-05 17:17:18 +04:00
|
|
|
}
|
2011-07-16 17:53:22 +04:00
|
|
|
|
|
|
|
ami_update_buttons(g->shared);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
/**
|
|
|
|
* function to add retrieved favicon to gui
|
|
|
|
*/
|
2010-03-28 19:51:05 +04:00
|
|
|
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
2009-12-18 02:55:02 +03:00
|
|
|
{
|
2009-12-19 03:39:52 +03:00
|
|
|
struct BitMap *bm = NULL;
|
|
|
|
struct IBox *bbox;
|
2009-12-19 16:42:48 +03:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(kiosk_mode) == true) return;
|
2009-12-19 16:42:48 +03:00
|
|
|
if(!g) return;
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
2010-02-13 21:03:05 +03:00
|
|
|
g->shared->objects[GID_TABS],
|
2009-12-19 16:42:48 +03:00
|
|
|
(ULONG *)&cur_tab);
|
2009-12-19 03:39:52 +03:00
|
|
|
|
2010-03-28 19:51:05 +04:00
|
|
|
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
|
2009-12-19 03:39:52 +03:00
|
|
|
{
|
2010-03-28 19:51:05 +04:00
|
|
|
bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16,
|
2009-12-19 16:42:48 +03:00
|
|
|
g->shared->win->RPort->BitMap);
|
2009-12-19 03:39:52 +03:00
|
|
|
}
|
|
|
|
|
2010-02-14 03:46:53 +03:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
2009-12-19 16:42:48 +03:00
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox, g->shared->objects[GID_ICON], (ULONG *)&bbox);
|
2009-12-19 03:39:52 +03:00
|
|
|
|
2009-12-19 16:42:48 +03:00
|
|
|
EraseRect(g->shared->win->RPort, bbox->Left, bbox->Top,
|
|
|
|
bbox->Left+16, bbox->Top+16);
|
2009-12-19 03:39:52 +03:00
|
|
|
|
2009-12-19 16:42:48 +03:00
|
|
|
if(bm)
|
|
|
|
{
|
|
|
|
BltBitMapTags(BLITA_SrcX, 0,
|
|
|
|
BLITA_SrcY, 0,
|
|
|
|
BLITA_DestX, bbox->Left,
|
|
|
|
BLITA_DestY, bbox->Top,
|
|
|
|
BLITA_Width, 16,
|
|
|
|
BLITA_Height, 16,
|
|
|
|
BLITA_Source, bm,
|
|
|
|
BLITA_Dest, g->shared->win->RPort,
|
|
|
|
BLITA_SrcType, BLITT_BITMAP,
|
|
|
|
BLITA_DestType, BLITT_RASTPORT,
|
|
|
|
BLITA_UseSrcAlpha, TRUE,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2009-12-19 03:39:52 +03:00
|
|
|
}
|
2009-12-19 16:42:48 +03:00
|
|
|
|
|
|
|
g->favicon = icon;
|
2009-12-18 02:55:02 +03:00
|
|
|
}
|
|
|
|
|
2012-04-29 19:59:37 +04:00
|
|
|
static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg)
|
|
|
|
{
|
|
|
|
refresh_favicon = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
/**
|
|
|
|
* set gui display of a retrieved favicon representing the search
|
|
|
|
* provider
|
|
|
|
* \param ico may be NULL for local calls; then access current cache from
|
|
|
|
* search_web_ico()
|
|
|
|
*/
|
2010-03-28 19:51:05 +04:00
|
|
|
void gui_window_set_search_ico(hlcache_handle *ico)
|
2009-12-18 02:55:02 +03:00
|
|
|
{
|
2009-12-22 02:25:35 +03:00
|
|
|
struct BitMap *bm = NULL;
|
|
|
|
struct IBox *bbox;
|
|
|
|
ULONG cur_tab = 0;
|
|
|
|
struct nsObject *node;
|
|
|
|
struct nsObject *nnode;
|
|
|
|
struct gui_window_2 *gwin;
|
2011-07-02 23:38:54 +04:00
|
|
|
char fname[100];
|
2009-12-22 02:25:35 +03:00
|
|
|
|
|
|
|
if(IsMinListEmpty(window_list)) return;
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(kiosk_mode) == true) return;
|
2011-10-08 01:53:35 +04:00
|
|
|
|
2009-12-22 02:25:35 +03:00
|
|
|
if (ico == NULL) ico = search_web_ico();
|
2010-03-28 19:51:05 +04:00
|
|
|
if ((ico != NULL) && (content_get_bitmap(ico) != NULL))
|
2009-12-22 02:25:35 +03:00
|
|
|
{
|
2010-03-28 19:51:05 +04:00
|
|
|
bm = ami_getcachenativebm(content_get_bitmap(ico), 16, 16, NULL);
|
2009-12-22 02:25:35 +03:00
|
|
|
}
|
2011-07-02 23:38:54 +04:00
|
|
|
|
2009-12-22 02:25:35 +03:00
|
|
|
node = (struct nsObject *)GetHead((struct List *)window_list);
|
|
|
|
|
|
|
|
do {
|
|
|
|
nnode=(struct nsObject *)GetSucc((struct Node *)node);
|
|
|
|
gwin = node->objstruct;
|
|
|
|
|
2011-09-05 02:35:11 +04:00
|
|
|
if(node->Type == AMINS_WINDOW)
|
2009-12-22 02:25:35 +03:00
|
|
|
{
|
2010-03-18 00:43:23 +03:00
|
|
|
GetAttr(SPACE_AreaBox, gwin->objects[GID_SEARCH_ICON], (ULONG *)&bbox);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCH_ICON],
|
|
|
|
gwin->win, NULL,
|
|
|
|
GA_HintInfo, search_web_provider_name(),
|
|
|
|
TAG_DONE);
|
2009-12-22 02:25:35 +03:00
|
|
|
|
|
|
|
EraseRect(gwin->win->RPort, bbox->Left, bbox->Top,
|
|
|
|
bbox->Left+16, bbox->Top+16);
|
|
|
|
|
|
|
|
if(bm)
|
|
|
|
{
|
|
|
|
BltBitMapTags(BLITA_SrcX, 0,
|
|
|
|
BLITA_SrcY, 0,
|
|
|
|
BLITA_DestX, bbox->Left,
|
|
|
|
BLITA_DestY, bbox->Top,
|
|
|
|
BLITA_Width, 16,
|
|
|
|
BLITA_Height, 16,
|
|
|
|
BLITA_Source, bm,
|
|
|
|
BLITA_Dest, gwin->win->RPort,
|
|
|
|
BLITA_SrcType, BLITT_BITMAP,
|
|
|
|
BLITA_DestType, BLITT_RASTPORT,
|
|
|
|
BLITA_UseSrcAlpha, TRUE,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while(node = nnode);
|
2009-12-18 02:55:02 +03:00
|
|
|
}
|
|
|
|
|
2011-09-13 02:38:51 +04:00
|
|
|
static uint32 ami_set_search_ico_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg)
|
|
|
|
{
|
|
|
|
refresh_search_ico = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-04-29 19:59:37 +04:00
|
|
|
static uint32 ami_set_throbber_render_hook(struct Hook *hook, APTR space,
|
|
|
|
struct gpRender *msg)
|
|
|
|
{
|
|
|
|
refresh_throbber = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
|
|
|
|
{
|
2008-08-22 01:41:42 +04:00
|
|
|
struct IBox *bbox;
|
2008-09-28 00:55:11 +04:00
|
|
|
ULONG xs,ys;
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
|
|
|
|
2008-09-28 00:55:11 +04:00
|
|
|
gui_window_remove_caret(g);
|
|
|
|
|
2010-02-13 21:03:05 +03:00
|
|
|
GetAttr(SPACE_AreaBox,g->shared->objects[GID_BROWSER],(ULONG *)&bbox);
|
2011-03-20 01:40:02 +03:00
|
|
|
xs = g->scrollx;
|
|
|
|
ys = g->scrolly;
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
SetAPen(g->shared->win->RPort,3);
|
2008-09-28 01:33:00 +04:00
|
|
|
|
2009-03-28 18:43:12 +03:00
|
|
|
if((y-ys+height) > (bbox->Height)) height = bbox->Height-y+ys;
|
|
|
|
|
|
|
|
if(((x-xs) <= 0) || ((x-xs+2) >= (bbox->Width)) || ((y-ys) <= 0) || ((y-ys) >= (bbox->Height))) return;
|
2008-09-28 01:33:00 +04:00
|
|
|
|
2011-03-19 16:00:45 +03:00
|
|
|
g->c_w = 2;
|
2010-09-19 16:38:23 +04:00
|
|
|
|
2009-04-29 21:05:40 +04:00
|
|
|
SetDrMd(g->shared->win->RPort,COMPLEMENT);
|
|
|
|
|
2011-03-19 16:00:45 +03:00
|
|
|
RectFill(g->shared->win->RPort, x + bbox->Left - xs, y + bbox->Top - ys,
|
|
|
|
x + bbox->Left + g->c_w - xs, y+bbox->Top + height - ys);
|
2008-09-28 01:33:00 +04:00
|
|
|
|
2009-04-29 21:05:40 +04:00
|
|
|
SetDrMd(g->shared->win->RPort,JAM1);
|
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
g->c_x = x;
|
|
|
|
g->c_y = y;
|
|
|
|
g->c_h = height;
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2010-09-19 16:38:23 +04:00
|
|
|
OnMenu(g->shared->win, AMI_MENU_PASTE);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_remove_caret(struct gui_window *g)
|
|
|
|
{
|
2008-08-22 01:41:42 +04:00
|
|
|
struct IBox *bbox;
|
2008-09-28 01:33:00 +04:00
|
|
|
int xs,ys;
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2010-09-19 16:58:25 +04:00
|
|
|
if(g->c_h == 0) return;
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
if((nsoption_bool(kiosk_mode) == false))
|
2010-09-19 16:38:23 +04:00
|
|
|
OffMenu(g->shared->win, AMI_MENU_PASTE);
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2011-03-19 16:00:45 +03:00
|
|
|
ami_do_redraw_limits(g, g->shared->bw, g->c_x, g->c_y,
|
|
|
|
g->c_x + g->c_w + 1, g->c_y + g->c_h + 1);
|
2008-09-23 00:41:01 +04:00
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
g->c_h = 0;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_new_content(struct gui_window *g)
|
|
|
|
{
|
2010-03-28 19:51:05 +04:00
|
|
|
hlcache_handle *c;
|
2009-05-23 23:06:58 +04:00
|
|
|
|
2009-05-31 19:17:35 +04:00
|
|
|
if(g && g->shared && g->shared->bw && g->shared->bw->current_content)
|
2009-05-23 23:06:58 +04:00
|
|
|
c = g->shared->bw->current_content;
|
|
|
|
else return;
|
2009-05-17 14:40:42 +04:00
|
|
|
|
2009-08-23 19:59:41 +04:00
|
|
|
ami_clearclipreg(&browserglob);
|
2009-06-03 11:14:24 +04:00
|
|
|
g->shared->new_content = true;
|
2009-06-14 16:34:53 +04:00
|
|
|
g->scrollx = 0;
|
|
|
|
g->scrolly = 0;
|
2009-06-19 22:32:31 +04:00
|
|
|
g->shared->oldh = 0;
|
|
|
|
g->shared->oldv = 0;
|
2009-12-22 02:25:35 +03:00
|
|
|
g->favicon = NULL;
|
2009-05-24 17:13:27 +04:00
|
|
|
|
2010-07-24 23:57:27 +04:00
|
|
|
ami_menu_update_disabled(g, c);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool gui_window_scroll_start(struct gui_window *g)
|
|
|
|
{
|
2009-06-19 22:32:31 +04:00
|
|
|
return true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2012-01-11 18:20:26 +04:00
|
|
|
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
2012-01-11 20:45:17 +04:00
|
|
|
const struct rect *rect)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2012-01-12 01:41:55 +04:00
|
|
|
g->shared->drag_op = type;
|
|
|
|
if(rect) g->shared->ptr_lock = ami_ns_rect_to_ibox(g->shared, rect);
|
|
|
|
|
|
|
|
if(type == GDRAGGING_NONE)
|
|
|
|
{
|
2012-01-15 19:57:02 +04:00
|
|
|
SetWindowAttrs(g->shared->win, WA_GrabFocus, 0,
|
2012-01-12 01:41:55 +04:00
|
|
|
WA_MouseLimits, NULL, TAG_DONE);
|
|
|
|
|
2012-01-15 19:57:02 +04:00
|
|
|
if(g->shared->ptr_lock)
|
2012-01-12 01:41:55 +04:00
|
|
|
{
|
2012-01-15 19:57:02 +04:00
|
|
|
FreeVec(g->shared->ptr_lock);
|
|
|
|
g->shared->ptr_lock = NULL;
|
2012-01-12 01:41:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-19 22:32:31 +04:00
|
|
|
return true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg)
|
|
|
|
{
|
2011-11-30 00:58:57 +04:00
|
|
|
ULONG gid;
|
2008-10-12 01:38:04 +04:00
|
|
|
struct gui_window_2 *gwin = hook->h_Data;
|
2009-03-29 03:51:39 +04:00
|
|
|
struct IntuiWheelData *wheel;
|
2011-02-10 00:52:28 +03:00
|
|
|
Object *reqrefresh = NULL;
|
2009-03-29 03:51:39 +04:00
|
|
|
|
|
|
|
switch(msg->Class)
|
|
|
|
{
|
|
|
|
case IDCMP_IDCMPUPDATE:
|
2011-02-10 00:52:28 +03:00
|
|
|
gid = GetTagData( GA_ID, 0, msg->IAddress );
|
|
|
|
|
2009-03-29 03:51:39 +04:00
|
|
|
switch( gid )
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
2009-09-05 02:00:09 +04:00
|
|
|
case GID_HSCROLL:
|
2009-03-29 03:51:39 +04:00
|
|
|
case OID_HSCROLL:
|
|
|
|
case OID_VSCROLL:
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(faster_scroll) == true) gwin->redraw_scroll = true;
|
2011-02-24 02:11:26 +03:00
|
|
|
else gwin->redraw_scroll = false;
|
2010-06-05 13:59:38 +04:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
gwin->redraw_required = true;
|
2009-12-23 16:29:10 +03:00
|
|
|
break;
|
2009-03-29 03:51:39 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDCMP_EXTENDEDMOUSE:
|
|
|
|
if(msg->Code == IMSGCODE_INTUIWHEELDATA)
|
|
|
|
{
|
|
|
|
wheel = (struct IntuiWheelData *)msg->IAddress;
|
|
|
|
|
2011-12-24 02:14:00 +04:00
|
|
|
ami_gui_scroll_internal(gwin, wheel->WheelX * 50, wheel->WheelY * 50);
|
2009-03-29 03:51:39 +04:00
|
|
|
}
|
|
|
|
break;
|
2009-08-01 17:16:16 +04:00
|
|
|
|
|
|
|
case IDCMP_SIZEVERIFY:
|
|
|
|
break;
|
2012-02-25 00:00:51 +04:00
|
|
|
|
|
|
|
case IDCMP_REFRESHWINDOW:
|
|
|
|
ami_refresh_window(gwin);
|
|
|
|
break;
|
2012-02-25 03:18:24 +04:00
|
|
|
|
|
|
|
default:
|
|
|
|
printf("UNHANDLED EVENT %ld\n",msg->Class);
|
|
|
|
break;
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
// ReplyMsg((struct Message *)msg);
|
2008-08-11 21:53:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-24 23:57:27 +04:00
|
|
|
/* return the text box at posn x,y in window coordinates
|
|
|
|
x,y are updated to be document co-ordinates */
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2010-07-28 01:41:21 +04:00
|
|
|
struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
|
2010-07-24 20:39:37 +04:00
|
|
|
{
|
|
|
|
struct IBox *bbox;
|
2010-07-24 23:57:27 +04:00
|
|
|
ULONG xs,ys,width,height;
|
2010-07-24 20:39:37 +04:00
|
|
|
struct box *box,*text_box=0;
|
|
|
|
hlcache_handle *content;
|
|
|
|
int box_x=0,box_y=0;
|
|
|
|
|
2010-09-17 00:55:25 +04:00
|
|
|
content = gwin->bw->current_content;
|
|
|
|
|
|
|
|
if(content_get_type(content) != CONTENT_HTML) return NULL;
|
|
|
|
|
2010-07-28 01:41:21 +04:00
|
|
|
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
|
2010-07-24 20:39:37 +04:00
|
|
|
(ULONG *)&bbox);
|
|
|
|
|
2010-07-28 01:41:21 +04:00
|
|
|
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
|
2010-07-24 23:57:27 +04:00
|
|
|
*x = *x - (bbox->Left) +xs;
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2010-07-28 01:41:21 +04:00
|
|
|
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
|
2010-07-24 23:57:27 +04:00
|
|
|
*y = *y - (bbox->Top) + ys;
|
2010-07-24 20:39:37 +04:00
|
|
|
|
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
|
|
|
|
|
|
|
box = html_get_box_tree(content);
|
2010-07-24 23:57:27 +04:00
|
|
|
while ((box = box_at_point(box, *x, *y, &box_x, &box_y, &content)))
|
2010-07-24 20:39:37 +04:00
|
|
|
{
|
|
|
|
if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue;
|
|
|
|
|
|
|
|
if (box->gadget)
|
|
|
|
{
|
|
|
|
switch (box->gadget->type)
|
|
|
|
{
|
|
|
|
case GADGET_TEXTBOX:
|
|
|
|
case GADGET_TEXTAREA:
|
|
|
|
case GADGET_PASSWORD:
|
|
|
|
text_box = box;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-07-24 23:57:27 +04:00
|
|
|
return text_box;
|
2010-07-24 20:39:37 +04:00
|
|
|
}
|
2011-02-28 22:31:35 +03:00
|
|
|
|
|
|
|
BOOL ami_gadget_hit(Object *obj, int x, int y)
|
|
|
|
{
|
|
|
|
int top, left, width, height;
|
|
|
|
|
|
|
|
GetAttrs(obj,
|
|
|
|
GA_Left, &left,
|
|
|
|
GA_Top, &top,
|
|
|
|
GA_Width, &width,
|
|
|
|
GA_Height, &height,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
if((x >= left) && (x <= (left + width)) && (y >= top) && (y <= (top + height)))
|
|
|
|
return TRUE;
|
|
|
|
else return FALSE;
|
|
|
|
}
|
2011-05-08 02:21:41 +04:00
|
|
|
|
|
|
|
Object *ami_gui_splash_open(void)
|
|
|
|
{
|
2011-09-07 22:38:08 +04:00
|
|
|
Object *win_obj, *bm_obj;
|
2011-05-08 02:21:41 +04:00
|
|
|
struct Window *win;
|
|
|
|
struct Screen *wbscreen = LockPubScreen("Workbench");
|
2011-09-07 22:38:08 +04:00
|
|
|
uint32 top = 0, left = 0;
|
|
|
|
STRPTR ver_string;
|
2011-09-08 03:01:53 +04:00
|
|
|
struct TextAttr tattr;
|
|
|
|
struct TextFont *tfont;
|
2011-05-08 02:21:41 +04:00
|
|
|
|
|
|
|
win_obj = WindowObject,
|
2011-09-07 22:38:08 +04:00
|
|
|
WA_Borderless, TRUE,
|
2011-05-08 02:21:41 +04:00
|
|
|
WA_ToolBox, TRUE,
|
|
|
|
WA_BusyPointer, TRUE,
|
|
|
|
WINDOW_Position, WPOS_CENTERSCREEN,
|
|
|
|
WINDOW_LockWidth, TRUE,
|
|
|
|
WINDOW_LockHeight, TRUE,
|
2011-09-07 00:58:26 +04:00
|
|
|
WINDOW_ParentGroup, LayoutObject,
|
2011-09-07 22:38:08 +04:00
|
|
|
LAYOUT_AddImage, bm_obj = BitMapObject,
|
|
|
|
BITMAP_SourceFile, "PROGDIR:Resources/splash.png",
|
2011-05-08 02:21:41 +04:00
|
|
|
BITMAP_Screen, wbscreen,
|
|
|
|
BitMapEnd,
|
|
|
|
LayoutEnd,
|
|
|
|
EndWindow;
|
|
|
|
|
|
|
|
win = RA_OpenWindow(win_obj);
|
|
|
|
|
2011-09-07 22:38:08 +04:00
|
|
|
GetAttrs(bm_obj, IA_Top, &top,
|
|
|
|
IA_Left, &left,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2011-09-08 03:01:53 +04:00
|
|
|
SetRPAttrs(win->RPort, RPTAG_APenColor, 0x003F6DFE, TAG_DONE);
|
|
|
|
SetDrMd(win->RPort, JAM1);
|
2011-09-07 22:38:08 +04:00
|
|
|
|
2011-12-24 16:57:42 +04:00
|
|
|
tattr.ta_Name = "DejaVu Serif Italic.font";
|
2011-09-08 03:01:53 +04:00
|
|
|
tattr.ta_YSize = 24;
|
|
|
|
tattr.ta_Style = 0;
|
|
|
|
tattr.ta_Flags = 0;
|
|
|
|
|
|
|
|
if(tfont = ami_font_open_disk_font(&tattr))
|
2011-12-24 16:57:42 +04:00
|
|
|
{
|
2011-09-08 03:01:53 +04:00
|
|
|
SetFont(win->RPort, tfont);
|
2011-12-24 16:57:42 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tattr.ta_Name = "DejaVu Serif Oblique.font";
|
|
|
|
if(tfont = ami_font_open_disk_font(&tattr))
|
|
|
|
SetFont(win->RPort, tfont);
|
|
|
|
}
|
2011-09-08 03:01:53 +04:00
|
|
|
|
|
|
|
Move(win->RPort, left + 5, top + 25);
|
2011-09-07 22:38:08 +04:00
|
|
|
Text(win->RPort, "Initialising...", strlen("Initialising..."));
|
|
|
|
|
2011-09-08 03:01:53 +04:00
|
|
|
if(tfont) ami_font_close_disk_font(tfont);
|
|
|
|
|
|
|
|
tattr.ta_Name = "DejaVu Sans.font";
|
|
|
|
tattr.ta_YSize = 16;
|
|
|
|
tattr.ta_Style = 0;
|
|
|
|
tattr.ta_Flags = 0;
|
|
|
|
|
|
|
|
if(tfont = ami_font_open_disk_font(&tattr))
|
|
|
|
SetFont(win->RPort, tfont);
|
|
|
|
|
2011-09-07 22:38:08 +04:00
|
|
|
#ifdef NDEBUG
|
2012-02-12 22:02:49 +04:00
|
|
|
ver_string = ASPrintf("%s", netsurf_version);
|
2011-09-07 22:38:08 +04:00
|
|
|
#else
|
|
|
|
ver_string = ASPrintf("NetSurf %s (%s)", versvn, verdate);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Move(win->RPort, left + 185, top + 220);
|
|
|
|
Text(win->RPort, ver_string, strlen(ver_string));
|
|
|
|
|
2011-09-08 03:01:53 +04:00
|
|
|
if(ver_string) FreeVec(ver_string);
|
|
|
|
if(tfont) ami_font_close_disk_font(tfont);
|
2011-09-07 22:38:08 +04:00
|
|
|
|
2011-05-08 02:21:41 +04:00
|
|
|
UnlockPubScreen(NULL, wbscreen);
|
|
|
|
|
|
|
|
return win_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_gui_splash_close(Object *win_obj)
|
|
|
|
{
|
|
|
|
if(win_obj) DisposeObject(win_obj);
|
|
|
|
}
|