2008-08-02 18:31:32 +04:00
|
|
|
/*
|
2009-01-11 00:31:21 +03:00
|
|
|
* Copyright 2008-9 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
#include "amiga/gui.h"
|
2008-08-02 18:31:32 +04:00
|
|
|
#include "desktop/netsurf.h"
|
2008-08-03 20:13:57 +04:00
|
|
|
#include "desktop/options.h"
|
2008-08-02 18:31:32 +04:00
|
|
|
#include "utils/messages.h"
|
|
|
|
#include <proto/exec.h>
|
|
|
|
#include <proto/intuition.h>
|
2009-03-28 15:50:19 +03:00
|
|
|
#include <proto/asl.h>
|
2008-08-02 18:31:32 +04:00
|
|
|
#include "amiga/plotters.h"
|
2008-08-03 20:13:57 +04:00
|
|
|
#include "amiga/schedule.h"
|
|
|
|
#include <proto/timer.h>
|
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-09 19:19:04 +04:00
|
|
|
#include <libraries/keymap.h>
|
2008-08-10 00:27:36 +04:00
|
|
|
#include "desktop/history_core.h"
|
|
|
|
#include <proto/locale.h>
|
|
|
|
#include <proto/dos.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
#include <intuition/icclass.h>
|
|
|
|
#include <proto/utility.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <proto/graphics.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
#include <proto/Picasso96API.h>
|
2008-08-17 20:22:40 +04:00
|
|
|
#include "render/form.h"
|
|
|
|
#include <graphics/rpattr.h>
|
2008-08-19 22:31:56 +04:00
|
|
|
#include <libraries/gadtools.h>
|
2008-09-14 02:39:48 +04:00
|
|
|
#include <datatypes/pictureclass.h>
|
2008-08-22 01:41:42 +04:00
|
|
|
#include "desktop/selection.h"
|
2008-08-23 20:17:51 +04:00
|
|
|
#include "utils/utf8.h"
|
|
|
|
#include "amiga/utf8.h"
|
2008-08-24 01:56:49 +04:00
|
|
|
#include "amiga/hotlist.h"
|
2008-08-25 17:32:26 +04:00
|
|
|
#include "amiga/menu.h"
|
|
|
|
#include "amiga/options.h"
|
|
|
|
#include <libraries/keymap.h>
|
|
|
|
#include "desktop/textinput.h"
|
2008-08-31 21:34:00 +04:00
|
|
|
#include <intuition/pointerclass.h>
|
|
|
|
#include <math.h>
|
2008-09-04 02:02:41 +04:00
|
|
|
#include <workbench/workbench.h>
|
2008-09-11 23:33:40 +04:00
|
|
|
#include <proto/datatypes.h>
|
2008-09-23 00:41:01 +04:00
|
|
|
#include <proto/icon.h>
|
|
|
|
#include <workbench/icon.h>
|
2008-09-28 00:55:11 +04:00
|
|
|
#include "amiga/tree.h"
|
2008-09-29 02:50:13 +04:00
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "amiga/login.h"
|
|
|
|
#include "utils/url.h"
|
|
|
|
#include <string.h>
|
2008-09-29 23:35:30 +04:00
|
|
|
#include "amiga/arexx.h"
|
2008-10-12 01:38:04 +04:00
|
|
|
#include "amiga/hotlist.h"
|
|
|
|
#include "amiga/history.h"
|
2008-10-21 22:04:27 +04:00
|
|
|
#include "amiga/context_menu.h"
|
|
|
|
#include "amiga/cookies.h"
|
2008-10-25 20:37:08 +04:00
|
|
|
#include "amiga/clipboard.h"
|
2008-10-26 15:25:26 +03:00
|
|
|
#include <proto/keymap.h>
|
2008-11-09 02:08:55 +03:00
|
|
|
#include "amiga/save_complete.h"
|
2008-11-15 18:28:17 +03:00
|
|
|
#include "amiga/fetch_file.h"
|
2008-12-14 02:25:42 +03:00
|
|
|
#include "amiga/fetch_mailto.h"
|
|
|
|
#include "amiga/search.h"
|
2009-01-11 00:31:21 +03:00
|
|
|
#include <devices/inputevent.h>
|
2009-03-08 15:52:44 +03:00
|
|
|
#include "amiga/history_local.h"
|
2009-03-15 14:21:46 +03:00
|
|
|
#include "amiga/font.h"
|
2009-03-28 15:50:19 +03:00
|
|
|
#include "amiga/download.h"
|
2009-06-15 22:41:14 +04:00
|
|
|
#include <graphics/blitattr.h>
|
2009-06-21 02:29:43 +04:00
|
|
|
#include "amiga/gui_options.h"
|
2009-07-04 22:01:46 +04:00
|
|
|
#include "amiga/bitmap.h"
|
2009-08-31 01:43:14 +04:00
|
|
|
#include "amiga/print.h"
|
2009-09-28 22:00:40 +04:00
|
|
|
#include <libraries/application.h>
|
|
|
|
#include <proto/application.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2009-07-23 15:23:34 +04:00
|
|
|
#include "amiga/stringview/stringview.h"
|
|
|
|
#include "amiga/stringview/urlhistory.h"
|
|
|
|
|
2008-12-28 15:24:18 +03:00
|
|
|
#ifdef NS_AMIGA_CAIRO
|
|
|
|
#include <cairo/cairo-amigaos.h>
|
|
|
|
#endif
|
2008-08-15 21:19:57 +04:00
|
|
|
#include <hubbub/hubbub.h>
|
|
|
|
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <proto/window.h>
|
|
|
|
#include <proto/layout.h>
|
|
|
|
#include <proto/bitmap.h>
|
|
|
|
#include <proto/string.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include <proto/button.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
#include <proto/space.h>
|
2008-08-18 23:07:12 +04:00
|
|
|
#include <proto/popupmenu.h>
|
2008-09-28 00:55:11 +04:00
|
|
|
#include <proto/clicktab.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <classes/window.h>
|
|
|
|
#include <gadgets/layout.h>
|
|
|
|
#include <gadgets/string.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include <gadgets/scroller.h>
|
|
|
|
#include <gadgets/button.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <images/bitmap.h>
|
2008-08-11 21:53:45 +04:00
|
|
|
#include <gadgets/space.h>
|
2008-09-28 00:55:11 +04:00
|
|
|
#include <gadgets/clicktab.h>
|
2008-08-18 23:07:12 +04:00
|
|
|
#include <classes/popupmenu.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <reaction/reaction_macros.h>
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
char *default_stylesheet_url;
|
2009-07-24 03:05:34 +04:00
|
|
|
char *quirks_stylesheet_url;
|
2008-08-02 18:31:32 +04:00
|
|
|
char *adblock_stylesheet_url;
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
struct MsgPort *appport;
|
2008-08-03 20:13:57 +04:00
|
|
|
struct Device *TimerBase;
|
|
|
|
struct TimerIFace *ITimer;
|
2008-08-18 23:07:12 +04:00
|
|
|
struct Library *PopupMenuBase = NULL;
|
|
|
|
struct PopupMenuIFace *IPopupMenu = NULL;
|
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-09-14 02:39:48 +04:00
|
|
|
struct BitMap *throbber = NULL;
|
2009-06-15 22:41:14 +04:00
|
|
|
ULONG throbber_width,throbber_height,throbber_frames,throbber_update_interval;
|
2008-10-20 22:06:46 +04:00
|
|
|
BOOL rmbtrapped;
|
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
|
|
|
uint32 ami_appid;
|
|
|
|
struct MsgPort *applibport = NULL;
|
|
|
|
ULONG applibsig = 0;
|
2008-09-11 23:33:40 +04:00
|
|
|
|
2009-08-14 21:53:28 +04:00
|
|
|
extern colour scroll_widget_fg_colour;
|
|
|
|
extern colour scroll_widget_bg_colour;
|
|
|
|
extern colour scroll_widget_arrow_colour;
|
2009-03-27 23:04:34 +03:00
|
|
|
|
2009-06-30 11:02:52 +04:00
|
|
|
static Object *mouseptrobj[AMI_LASTPOINTER+1];
|
|
|
|
static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1];
|
|
|
|
static int mouseptrcurrent=0;
|
2009-08-29 03:12:18 +04:00
|
|
|
static struct DrawInfo *dri;
|
2008-08-31 21:34:00 +04:00
|
|
|
|
|
|
|
char *ptrs[AMI_LASTPOINTER+1] = {
|
2008-12-14 02:25:42 +03:00
|
|
|
"ptr_default",
|
|
|
|
"ptr_point",
|
|
|
|
"ptr_caret",
|
|
|
|
"ptr_menu",
|
|
|
|
"ptr_up",
|
|
|
|
"ptr_down",
|
|
|
|
"ptr_left",
|
|
|
|
"ptr_right",
|
|
|
|
"ptr_rightup",
|
|
|
|
"ptr_leftdown",
|
|
|
|
"ptr_leftup",
|
|
|
|
"ptr_rightdown",
|
|
|
|
"ptr_cross",
|
|
|
|
"ptr_move",
|
2009-03-25 22:59:10 +03:00
|
|
|
"ptr_wait",
|
2008-12-14 02:25:42 +03:00
|
|
|
"ptr_help",
|
|
|
|
"ptr_nodrop",
|
|
|
|
"ptr_notallowed",
|
|
|
|
"ptr_progress",
|
2009-03-25 22:59:10 +03:00
|
|
|
"ptr_blank",
|
|
|
|
"ptr_drag"};
|
2008-12-14 02:25:42 +03:00
|
|
|
|
|
|
|
char *ptrs32[AMI_LASTPOINTER+1] = {
|
|
|
|
"ptr32_default",
|
|
|
|
"ptr32_point",
|
|
|
|
"ptr32_caret",
|
|
|
|
"ptr32_menu",
|
|
|
|
"ptr32_up",
|
|
|
|
"ptr32_down",
|
|
|
|
"ptr32_left",
|
|
|
|
"ptr32_right",
|
|
|
|
"ptr32_rightup",
|
|
|
|
"ptr32_leftdown",
|
|
|
|
"ptr32_leftup",
|
|
|
|
"ptr32_rightdown",
|
|
|
|
"ptr32_cross",
|
|
|
|
"ptr32_move",
|
2009-03-25 22:59:10 +03:00
|
|
|
"ptr32_wait",
|
2008-12-14 02:25:42 +03:00
|
|
|
"ptr32_help",
|
|
|
|
"ptr32_nodrop",
|
|
|
|
"ptr32_notallowed",
|
|
|
|
"ptr32_progress",
|
2009-03-25 22:59:10 +03:00
|
|
|
"ptr32_blank",
|
|
|
|
"ptr32_drag"};
|
2008-08-31 21:34:00 +04:00
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
void ami_update_throbber(struct gui_window_2 *g,bool redraw);
|
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-08-18 23:07:12 +04:00
|
|
|
uint32 ami_popup_hook(struct Hook *hook,Object *item,APTR reserved);
|
2008-09-23 00:41:01 +04:00
|
|
|
void ami_init_mouse_pointers(void);
|
2008-10-21 22:04:27 +04:00
|
|
|
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
|
2008-08-15 21:19:57 +04:00
|
|
|
static void *myrealloc(void *ptr, size_t len, void *pw);
|
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);
|
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;
|
|
|
|
|
|
|
|
if(locale = OpenLocale(NULL))
|
|
|
|
{
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
{
|
|
|
|
if(locale->loc_PrefLanguages[i])
|
|
|
|
{
|
|
|
|
if(messages_get(locale->loc_PrefLanguages[i]) != locale->loc_PrefLanguages[i])
|
|
|
|
{
|
|
|
|
if(acceptlangs)
|
|
|
|
{
|
|
|
|
acceptlangs2 = acceptlangs;
|
|
|
|
acceptlangs = ASPrintf("%s, %s",acceptlangs2,messages_get(locale->loc_PrefLanguages[i]));
|
|
|
|
FreeVec(acceptlangs2);
|
|
|
|
acceptlangs2 = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
acceptlangs = ASPrintf("%s",messages_get(locale->loc_PrefLanguages[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CloseLocale(locale);
|
|
|
|
}
|
|
|
|
return acceptlangs;
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_init(int argc, char** argv)
|
|
|
|
{
|
2008-08-10 00:27:36 +04:00
|
|
|
struct Locale *locale;
|
2009-06-22 02:12:52 +04:00
|
|
|
char lang[100],throbberfile[100];
|
|
|
|
STRPTR tempacceptlangs;
|
2008-08-10 00:27:36 +04:00
|
|
|
bool found=FALSE;
|
|
|
|
int i;
|
2008-10-13 22:01:25 +04:00
|
|
|
BPTR lock=0,amiupdatefh;
|
2008-09-14 02:39:48 +04:00
|
|
|
Object *dto;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-08-03 20:13:57 +04:00
|
|
|
msgport = AllocSysObjectTags(ASOT_PORT,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2008-12-20 13:54:59 +03:00
|
|
|
tioreq= (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST,
|
|
|
|
ASOIOR_Size,sizeof(struct TimeRequest),
|
2008-08-03 20:13:57 +04:00
|
|
|
ASOIOR_ReplyPort,msgport,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE);
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-09-08 22:14:14 +04:00
|
|
|
OpenDevice("timer.device",UNIT_WAITUNTIL,(struct IORequest *)tioreq,0);
|
2008-08-03 20:13:57 +04:00
|
|
|
|
2008-12-20 13:54:59 +03:00
|
|
|
TimerBase = (struct Device *)tioreq->Request.io_Device;
|
2008-08-03 20:13:57 +04:00
|
|
|
ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL);
|
|
|
|
|
2008-09-04 02:02:41 +04:00
|
|
|
if(!(appport = AllocSysObjectTags(ASOT_PORT,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE))) die(messages_get("NoMemory"));
|
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
if(!(sport = AllocSysObjectTags(ASOT_PORT,
|
|
|
|
ASO_NoTrack,FALSE,
|
|
|
|
TAG_DONE))) die(messages_get("NoMemory"));
|
|
|
|
|
2009-08-29 18:00:57 +04:00
|
|
|
ami_print_init();
|
|
|
|
|
2008-08-18 23:07:12 +04:00
|
|
|
if(PopupMenuBase = OpenLibrary("popupmenu.class",0))
|
|
|
|
{
|
|
|
|
IPopupMenu = (struct PopupMenuIFace *)GetInterface(PopupMenuBase,"main",1,NULL);
|
|
|
|
}
|
|
|
|
|
2008-10-26 15:25:26 +03:00
|
|
|
if(KeymapBase = OpenLibrary("keymap.library",37))
|
|
|
|
{
|
|
|
|
IKeymap = (struct KeymapIFace *)GetInterface(KeymapBase,"main",1,NULL);
|
|
|
|
}
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
if(ApplicationBase = OpenLibrary("application.library",50))
|
|
|
|
{
|
|
|
|
IApplication = (struct ApplicationIFace *)GetInterface(ApplicationBase,"application",1,NULL);
|
|
|
|
}
|
|
|
|
|
2009-07-23 15:23:34 +04:00
|
|
|
urlStringClass = MakeStringClass();
|
|
|
|
|
2008-10-25 20:37:08 +04:00
|
|
|
ami_clipboard_init();
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2008-09-28 00:55:11 +04:00
|
|
|
win_destroyed = false;
|
|
|
|
|
2009-03-18 00:25:20 +03:00
|
|
|
options_read("PROGDIR:Resources/Options");
|
2008-08-25 17:32:26 +04:00
|
|
|
|
|
|
|
verbose_log = option_verbose_log;
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2009-01-15 15:26:06 +03:00
|
|
|
filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL);
|
|
|
|
savereq = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
|
|
|
ASLFR_DoSaveMode,TRUE,
|
|
|
|
ASLFR_RejectIcons,TRUE,
|
|
|
|
ASLFR_InitialDrawer,option_download_dir,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2008-08-23 20:17:51 +04:00
|
|
|
nsscreentitle = ASPrintf("NetSurf %s",netsurf_version);
|
|
|
|
|
2009-03-18 00:25:20 +03:00
|
|
|
if(lock=Lock("PROGDIR:Resources/LangNames",ACCESS_READ))
|
2008-08-09 19:19:04 +04:00
|
|
|
{
|
2008-08-10 00:27:36 +04:00
|
|
|
UnLock(lock);
|
2009-03-18 00:25:20 +03:00
|
|
|
messages_load("PROGDIR:Resources/LangNames");
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
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
|
|
|
{
|
2009-03-18 00:25:20 +03:00
|
|
|
strcpy(lang,"PROGDIR:Resources/");
|
2008-08-10 00:27:36 +04:00
|
|
|
if(locale->loc_PrefLanguages[i])
|
|
|
|
{
|
2009-03-15 14:21:46 +03:00
|
|
|
strcat(lang,messages_get(locale->loc_PrefLanguages[i]));
|
2008-08-10 00:27:36 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2009-05-08 02:40:52 +04:00
|
|
|
strcat(lang,"/Messages");
|
2008-08-23 20:17:51 +04:00
|
|
|
// printf("%s\n",lang);
|
2008-08-10 00:27:36 +04:00
|
|
|
if(lock=Lock(lang,ACCESS_READ))
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
|
|
|
found=TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!found)
|
|
|
|
{
|
2009-05-08 02:40:52 +04:00
|
|
|
strcpy(lang,"PROGDIR:Resources/en/Messages");
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
CloseLocale(locale);
|
|
|
|
|
2009-03-27 23:04:34 +03:00
|
|
|
messages_load(lang);
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-03-27 23:04:34 +03:00
|
|
|
default_stylesheet_url = "file:///PROGDIR:Resources/amiga.css";
|
2009-07-24 03:05:34 +04:00
|
|
|
quirks_stylesheet_url = "file:///PROGDIR:Resources/quirks.css";
|
2009-03-18 00:25:20 +03:00
|
|
|
adblock_stylesheet_url = "file:///PROGDIR:Resources/adblock.css";
|
2008-08-15 21:19:57 +04:00
|
|
|
|
2009-03-18 00:25:20 +03:00
|
|
|
if(hubbub_initialise("PROGDIR:Resources/Aliases",myrealloc,NULL) != HUBBUB_OK)
|
2008-08-15 21:19:57 +04:00
|
|
|
{
|
|
|
|
die(messages_get("NoMemory"));
|
|
|
|
}
|
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
nscss_screen_dpi = INTTOFIX(72);
|
2009-08-14 21:53:28 +04:00
|
|
|
scroll_widget_fg_colour = 0x00aaaaaa;
|
|
|
|
scroll_widget_bg_colour = 0x00833c3c;
|
|
|
|
scroll_widget_arrow_colour = 0x00d6d6d6;
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
option_core_select_menu = true;
|
2008-12-14 02:25:42 +03:00
|
|
|
|
2009-05-09 22:56:12 +04:00
|
|
|
if((!option_accept_language) || (option_accept_language[0] == '\0'))
|
2009-06-22 02:12:52 +04:00
|
|
|
{
|
|
|
|
if(tempacceptlangs = ami_locale_langs())
|
|
|
|
{
|
|
|
|
option_accept_language = (char *)strdup(tempacceptlangs);
|
|
|
|
FreeVec(tempacceptlangs);
|
|
|
|
}
|
|
|
|
}
|
2009-05-09 22:56:12 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_cookie_file) || (option_cookie_file[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_cookie_file = (char *)strdup("PROGDIR:Resources/Cookies");
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
if((!option_hotlist_file) || (option_hotlist_file[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_hotlist_file = (char *)strdup("PROGDIR:Resources/Hotlist");
|
2008-08-25 17:32:26 +04:00
|
|
|
|
|
|
|
if((!option_url_file) || (option_url_file[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_url_file = (char *)strdup("PROGDIR:Resources/URLs");
|
2008-08-25 17:32:26 +04:00
|
|
|
|
2008-10-12 01:38:04 +04:00
|
|
|
if((!option_recent_file) || (option_recent_file[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_recent_file = (char *)strdup("PROGDIR:Resources/Recent");
|
2008-10-12 01:38:04 +04:00
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
/*
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_cookie_jar) || (option_cookie_jar[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_cookie_jar = (char *)strdup("PROGDIR:Resources/CookieJar");
|
2008-08-25 17:32:26 +04:00
|
|
|
*/
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_ca_bundle) || (option_ca_bundle[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_ca_bundle = (char *)strdup("devs:curl-ca-bundle.crt");
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_font_sans) || (option_font_sans[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_font_sans = (char *)strdup("DejaVu Sans");
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_font_serif) || (option_font_serif[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_font_serif = (char *)strdup("DejaVu Serif");
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_font_mono) || (option_font_mono[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_font_mono = (char *)strdup("DejaVu Sans Mono");
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-12 21:47:35 +04:00
|
|
|
if((!option_font_cursive) || (option_font_cursive[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_font_cursive = (char *)strdup("DejaVu Sans");
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
if((!option_font_fantasy) || (option_font_fantasy[0] == '\0'))
|
2008-09-29 02:50:13 +04:00
|
|
|
option_font_fantasy = (char *)strdup("DejaVu Serif");
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-10-18 17:56:12 +04:00
|
|
|
if((!option_theme) || (option_theme[0] == '\0'))
|
2009-03-18 00:25:20 +03:00
|
|
|
option_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
|
|
|
|
2008-10-26 15:25:26 +03:00
|
|
|
if((!option_arexx_dir) || (option_arexx_dir[0] == '\0'))
|
2009-03-18 00:34:01 +03:00
|
|
|
option_arexx_dir = (char *)strdup("PROGDIR:Rexx");
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2008-08-18 23:07:12 +04:00
|
|
|
if(!option_window_width) option_window_width = 800;
|
|
|
|
if(!option_window_height) option_window_height = 600;
|
|
|
|
|
2009-01-16 23:05:21 +03:00
|
|
|
ami_init_fonts();
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
plot=amiplot;
|
2008-08-03 20:13:57 +04:00
|
|
|
|
2008-10-13 22:01:25 +04:00
|
|
|
/* AmiUpdate */
|
|
|
|
if(((lock = Lock("ENVARC:AppPaths",SHARED_LOCK)) == 0))
|
|
|
|
{
|
|
|
|
lock = CreateDir("ENVARC:AppPaths");
|
|
|
|
}
|
|
|
|
|
|
|
|
UnLock(lock);
|
|
|
|
|
|
|
|
if(lock=GetCurrentDir())
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
/* end Amiupdate */
|
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
ami_init_menulabs();
|
2008-10-25 20:37:08 +04:00
|
|
|
if(option_context_menu) ami_context_menu_init();
|
2008-08-25 17:32:26 +04:00
|
|
|
|
2008-08-03 20:13:57 +04:00
|
|
|
schedule_list = NewObjList();
|
2008-08-09 19:19:04 +04:00
|
|
|
window_list = NewObjList();
|
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
urldb_load(option_url_file);
|
2008-08-09 19:19:04 +04:00
|
|
|
urldb_load_cookies(option_cookie_file);
|
2008-10-13 22:01:25 +04:00
|
|
|
|
|
|
|
if(lock = Lock(option_hotlist_file,SHARED_LOCK))
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
|
|
|
hotlist = options_load_tree(option_hotlist_file);
|
|
|
|
}
|
2008-08-03 20:13:57 +04:00
|
|
|
|
2008-08-24 01:56:49 +04:00
|
|
|
if(!hotlist) ami_hotlist_init(&hotlist);
|
2008-10-12 01:38:04 +04:00
|
|
|
ami_global_history_initialise();
|
|
|
|
ami_cookies_initialise();
|
2008-11-09 02:08:55 +03:00
|
|
|
save_complete_init();
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-03-15 14:21:46 +03:00
|
|
|
strcpy(throbberfile,option_theme);
|
|
|
|
AddPart(throbberfile,"Theme",100);
|
|
|
|
|
|
|
|
lock = Lock(throbberfile,ACCESS_READ);
|
|
|
|
|
|
|
|
if(!lock)
|
|
|
|
{
|
|
|
|
warn_user("ThemeApplyErr",option_theme);
|
2009-03-18 00:25:20 +03:00
|
|
|
strcpy(throbberfile,"PROGDIR:Resources/Themes/Default/Theme");
|
2009-03-15 14:21:46 +03:00
|
|
|
free(option_theme);
|
2009-03-18 00:25:20 +03:00
|
|
|
option_theme = (char *)strdup("PROGDIR:Resources/Themes/Default");
|
2009-03-15 14:21:46 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UnLock(lock);
|
|
|
|
}
|
|
|
|
|
2008-10-18 17:56:12 +04:00
|
|
|
messages_load(throbberfile);
|
|
|
|
|
2008-12-14 02:25:42 +03:00
|
|
|
ami_init_mouse_pointers();
|
|
|
|
|
2009-03-15 14:21:46 +03:00
|
|
|
ami_get_theme_filename(throbberfile,"theme_throbber");
|
2008-10-18 17:56:12 +04:00
|
|
|
throbber_frames=atoi(messages_get("theme_throbber_frames"));
|
2009-06-15 22:41:14 +04:00
|
|
|
throbber_update_interval = atoi(messages_get("theme_throbber_delay"));
|
2009-08-18 17:06:28 +04:00
|
|
|
if(throbber_update_interval == 0) throbber_update_interval = 100;
|
2008-10-18 17:56:12 +04:00
|
|
|
|
|
|
|
if(dto = NewDTObject(throbberfile,
|
2008-09-14 02:39:48 +04:00
|
|
|
DTA_GroupID,GID_PICTURE,
|
|
|
|
PDTA_DestMode,PMODE_V43,
|
|
|
|
TAG_DONE))
|
|
|
|
{
|
|
|
|
struct BitMapHeader *throbber_bmh;
|
|
|
|
struct RastPort throbber_rp;
|
|
|
|
|
|
|
|
if(GetDTAttrs(dto,PDTA_BitMapHeader,&throbber_bmh,TAG_DONE))
|
|
|
|
{
|
2008-10-18 17:56:12 +04:00
|
|
|
throbber_width = throbber_bmh->bmh_Width / throbber_frames;
|
2008-09-14 02:39:48 +04:00
|
|
|
throbber_height = throbber_bmh->bmh_Height;
|
|
|
|
|
|
|
|
InitRastPort(&throbber_rp);
|
|
|
|
|
|
|
|
if(throbber = p96AllocBitMap(throbber_bmh->bmh_Width,
|
|
|
|
throbber_height,32,
|
|
|
|
BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
|
|
|
|
NULL,RGBFB_A8R8G8B8))
|
|
|
|
{
|
|
|
|
struct RenderInfo ri;
|
2008-11-02 03:21:49 +03:00
|
|
|
UBYTE *throbber_tempmem = AllocVec(throbber_bmh->bmh_Width*throbber_height*4,MEMF_PRIVATE | MEMF_CLEAR);
|
2008-09-14 02:39:48 +04:00
|
|
|
throbber_rp.BitMap = throbber;
|
|
|
|
ri.Memory = throbber_tempmem;
|
|
|
|
ri.BytesPerRow = 4*throbber_bmh->bmh_Width;
|
|
|
|
ri.RGBFormat = RGBFB_A8R8G8B8;
|
|
|
|
|
|
|
|
IDoMethod(dto,PDTM_READPIXELARRAY,ri.Memory,PBPAFMT_ARGB,ri.BytesPerRow,0,0,throbber_bmh->bmh_Width,throbber_height);
|
|
|
|
|
|
|
|
p96WritePixelArray((struct RenderInfo *)&ri,0,0,&throbber_rp,0,0,throbber_bmh->bmh_Width,throbber_height);
|
|
|
|
|
|
|
|
FreeVec(throbber_tempmem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DisposeDTObject(dto);
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-07-04 20:12:27 +04:00
|
|
|
void ami_openscreen(void)
|
|
|
|
{
|
|
|
|
ULONG id = 0;
|
|
|
|
if(!option_use_pubscreen || option_use_pubscreen[0] == '\0')
|
|
|
|
{
|
|
|
|
if((option_modeid) && (strncmp(option_modeid,"0x",2) == 0))
|
|
|
|
{
|
|
|
|
id = strtoul(option_modeid,NULL,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct ScreenModeRequester *screenmodereq = NULL;
|
|
|
|
|
|
|
|
if(screenmodereq = AllocAslRequest(ASL_ScreenModeRequest,NULL))
|
|
|
|
{
|
|
|
|
AslRequestTags(screenmodereq,
|
2009-07-05 22:15:55 +04:00
|
|
|
ASLSM_MinDepth,16,
|
2009-07-04 20:12:27 +04:00
|
|
|
ASLSM_MaxDepth,32,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
id = screenmodereq->sm_DisplayID;
|
|
|
|
option_modeid = malloc(20);
|
|
|
|
sprintf(option_modeid,"0x%lx",id);
|
|
|
|
|
|
|
|
FreeAslRequest(screenmodereq);
|
|
|
|
options_write("PROGDIR:Resources/Options");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scrn = OpenScreenTags(NULL,
|
|
|
|
SA_DisplayID,id,
|
|
|
|
SA_Title,nsscreentitle,
|
|
|
|
SA_Type,CUSTOMSCREEN,
|
|
|
|
SA_PubName,"NetSurf",
|
|
|
|
SA_LikeWorkbench,TRUE,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
if(scrn)
|
|
|
|
{
|
|
|
|
PubScreenStatus(scrn,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(scrn = LockPubScreen("NetSurf"))
|
|
|
|
{
|
|
|
|
locked_screen = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
option_use_pubscreen = "Workbench";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(option_use_pubscreen && option_use_pubscreen[0] != '\0')
|
|
|
|
{
|
|
|
|
if(scrn = LockPubScreen(option_use_pubscreen))
|
|
|
|
{
|
|
|
|
locked_screen = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scrn = LockPubScreen("Workbench");
|
|
|
|
}
|
|
|
|
}
|
2009-08-29 03:12:18 +04:00
|
|
|
dri = GetScreenDrawInfo(scrn);
|
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
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_init2(int argc, char** argv)
|
|
|
|
{
|
2008-11-16 17:42:40 +03:00
|
|
|
struct browser_window *bw = NULL;
|
2008-09-29 02:50:13 +04:00
|
|
|
long rarray[] = {0};
|
|
|
|
struct RDArgs *args;
|
|
|
|
STRPTR template = "URL/A";
|
2008-11-09 02:08:55 +03:00
|
|
|
STRPTR temp_homepage_url = NULL;
|
2008-11-16 17:42:40 +03:00
|
|
|
BOOL notalreadyrunning;
|
2008-09-29 02:50:13 +04:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
A_URL
|
|
|
|
};
|
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
|
|
|
ami_fetch_file_register();
|
2009-01-11 00:31:21 +03:00
|
|
|
ami_openurl_open();
|
2008-11-15 18:28:17 +03:00
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(notalreadyrunning && (option_startup_no_window == false))
|
|
|
|
ami_openscreenfirst();
|
2008-12-26 22:04:57 +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))
|
|
|
|
{
|
|
|
|
if(rarray[A_URL])
|
|
|
|
{
|
|
|
|
temp_homepage_url = (char *)strdup(rarray[A_URL]);
|
|
|
|
if(notalreadyrunning)
|
|
|
|
{
|
|
|
|
bw = browser_window_create(temp_homepage_url, 0, 0, true,false);
|
|
|
|
free(temp_homepage_url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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];
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((!option_homepage_url) || (option_homepage_url[0] == '\0'))
|
|
|
|
option_homepage_url = (char *)strdup(NETSURF_HOMEPAGE);
|
|
|
|
|
|
|
|
if(!notalreadyrunning)
|
|
|
|
{
|
|
|
|
STRPTR sendcmd = NULL;
|
|
|
|
|
|
|
|
if(temp_homepage_url)
|
|
|
|
{
|
|
|
|
sendcmd = ASPrintf("OPEN \"%s\" NEW",temp_homepage_url);
|
|
|
|
free(temp_homepage_url);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sendcmd = ASPrintf("OPEN \"%s\" NEW",option_homepage_url);
|
|
|
|
}
|
|
|
|
IDoMethod(arexx_obj,AM_EXECUTE,sendcmd,"NETSURF",NULL,NULL,NULL,NULL);
|
|
|
|
IDoMethod(arexx_obj,AM_EXECUTE,"TOFRONT","NETSURF",NULL,NULL,NULL,NULL);
|
|
|
|
FreeVec(sendcmd);
|
|
|
|
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)
|
|
|
|
{
|
2009-09-29 02:17:09 +04:00
|
|
|
if(argc == 0)
|
|
|
|
{
|
|
|
|
ami_appid = RegisterApplication(messages_get("NetSurf"),
|
|
|
|
REGAPP_URLIdentifier, "netsurf-browser.org",
|
|
|
|
REGAPP_WBStartup, (struct WBStartup *)argv,
|
|
|
|
// REGAPP_NoIcon, TRUE,
|
|
|
|
REGAPP_HasPrefsWindow, TRUE,
|
|
|
|
REGAPP_CanCreateNewDocs, TRUE,
|
|
|
|
REGAPP_UniqueApplication, TRUE,
|
|
|
|
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,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2009-09-28 22:00:40 +04:00
|
|
|
|
|
|
|
GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE);
|
|
|
|
applibsig = (1L << applibport->mp_SigBit);
|
|
|
|
}
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(!bw && (option_startup_no_window == false))
|
|
|
|
bw = browser_window_create(option_homepage_url, 0, 0, true,false);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct gui_window_2 *gwin,*destroywin=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-01-25 14:18:42 +03:00
|
|
|
UBYTE buffer[20];
|
2009-05-26 02:32:38 +04:00
|
|
|
int chars,i;
|
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-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;
|
|
|
|
}
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
|
2008-08-09 02:38:13 +04:00
|
|
|
//printf("class %ld\n",class);
|
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:
|
2008-09-29 02:50:13 +04:00
|
|
|
GetAttr(SPACE_AreaBox,gwin->gadgets[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
|
|
|
|
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);
|
2009-01-11 00:31:21 +03:00
|
|
|
|
2008-10-20 22:06:46 +04:00
|
|
|
if(option_context_menu && rmbtrapped == FALSE)
|
|
|
|
{
|
2009-03-15 14:21:46 +03:00
|
|
|
SetWindowAttr(gwin->win,WA_RMBTrap,(APTR)TRUE,1);
|
2009-01-26 21:38:47 +03:00
|
|
|
rmbtrapped=TRUE; // crash points to this line
|
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
|
|
|
|
{
|
2008-10-20 22:06:46 +04:00
|
|
|
if(option_context_menu && rmbtrapped == TRUE)
|
|
|
|
{
|
2009-01-26 21:38:47 +03:00
|
|
|
SetWindowAttr(gwin->win,WA_RMBTrap,FALSE,1);
|
2008-10-20 22:06:46 +04:00
|
|
|
rmbtrapped=FALSE;
|
|
|
|
}
|
|
|
|
|
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:
|
2009-08-31 01:43:14 +04:00
|
|
|
GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
|
|
|
|
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-10-21 22:04:27 +04:00
|
|
|
|
|
|
|
case MENUDOWN:
|
2008-10-25 20:37:08 +04:00
|
|
|
if(!option_sticky_context_menu) ami_context_menu_show(gwin,x,y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENUUP:
|
|
|
|
if(option_sticky_context_menu) ami_context_menu_show(gwin,x,y);
|
2008-10-21 22:04:27 +04:00
|
|
|
break;
|
2008-08-09 19:19:04 +04:00
|
|
|
}
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
case SELECTUP:
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
|
|
|
|
{
|
|
|
|
browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_1 | gwin->key_state,x,y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_mouse_drag_end(gwin->bw,0,x,y);
|
|
|
|
}
|
|
|
|
gwin->mouse_state=0;
|
|
|
|
break;
|
|
|
|
case MIDDLEUP:
|
|
|
|
if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
|
|
|
|
{
|
|
|
|
browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_2 | gwin->key_state,x,y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_mouse_drag_end(gwin->bw,0,x,y);
|
|
|
|
}
|
|
|
|
gwin->mouse_state=0;
|
|
|
|
break;
|
|
|
|
}
|
2009-03-25 03:03:43 +03:00
|
|
|
|
|
|
|
if(drag_save && !gwin->mouse_state)
|
|
|
|
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:
|
2008-10-05 17:17:18 +04:00
|
|
|
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;
|
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
case GID_URL:
|
2008-09-29 02:50:13 +04:00
|
|
|
GetAttr(STRINGA_TextVal,gwin->gadgets[GID_URL],(ULONG *)&storage);
|
2008-08-10 00:27:36 +04:00
|
|
|
browser_window_go(gwin->bw,(char *)storage,NULL,true);
|
2008-08-10 13:57:41 +04:00
|
|
|
//printf("%s\n",(char *)storage);
|
2008-08-09 19:19:04 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_HOME:
|
2008-09-05 02:41:26 +04:00
|
|
|
browser_window_go(gwin->bw,option_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:
|
2009-03-24 21:28:02 +03:00
|
|
|
if(browser_window_back_available(gwin->bw))
|
2008-08-10 00:27:36 +04:00
|
|
|
{
|
|
|
|
history_back(gwin->bw,gwin->bw->history);
|
|
|
|
}
|
2008-09-05 02:41:26 +04:00
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
ami_update_buttons(gwin);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_FORWARD:
|
2009-03-24 21:28:02 +03:00
|
|
|
if(browser_window_forward_available(gwin->bw))
|
2008-08-10 00:27:36 +04:00
|
|
|
{
|
|
|
|
history_forward(gwin->bw,gwin->bw->history);
|
|
|
|
}
|
|
|
|
|
|
|
|
ami_update_buttons(gwin);
|
|
|
|
break;
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
case GID_LOGIN:
|
2008-09-05 02:41:26 +04:00
|
|
|
ami_401login_login((struct gui_login_window *)gwin);
|
|
|
|
win_destroyed = true;
|
2008-08-31 01:32:05 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GID_CANCEL:
|
|
|
|
if(gwin->node->Type == AMINS_LOGINWINDOW)
|
|
|
|
{
|
|
|
|
ami_401login_close((struct gui_login_window *)gwin);
|
|
|
|
win_destroyed = true;
|
|
|
|
}
|
2009-04-30 22:40:26 +04:00
|
|
|
else if(gwin->node->Type == AMINS_DLWINDOW)
|
|
|
|
{
|
|
|
|
ami_download_window_abort((struct gui_download_window *)gwin);
|
|
|
|
win_destroyed = true;
|
|
|
|
}
|
2008-08-31 01:32:05 +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-19 22:31:56 +04:00
|
|
|
case WMHI_MENUPICK:
|
|
|
|
item = ItemAddress(gwin->win->MenuStrip,code);
|
|
|
|
while (code != MENUNULL)
|
|
|
|
{
|
2008-10-15 02:43:02 +04:00
|
|
|
ami_menupick(code,gwin,item);
|
2008-08-25 17:32:26 +04:00
|
|
|
if(win_destroyed) break;
|
2008-08-19 22:31:56 +04:00
|
|
|
code = item->NextSelect;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
switch(storage)
|
|
|
|
{
|
|
|
|
case RAWKEY_CRSRUP:
|
2009-02-01 16:01:46 +03:00
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_PAGE_UP);
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_TEXT_START);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_UP);
|
2008-08-25 17:32:26 +04:00
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRDOWN:
|
2009-02-01 16:01:46 +03:00
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_PAGE_DOWN);
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_TEXT_END);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_DOWN);
|
2008-08-25 17:32:26 +04:00
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRLEFT:
|
2009-02-01 16:01:46 +03:00
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_LINE_START);
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_WORD_LEFT);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_LEFT);
|
2008-08-25 17:32:26 +04:00
|
|
|
break;
|
|
|
|
case RAWKEY_CRSRRIGHT:
|
2009-02-01 16:01:46 +03:00
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_LINE_END);
|
|
|
|
}
|
|
|
|
else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_WORD_RIGHT);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_RIGHT);
|
2008-08-25 17:32:26 +04:00
|
|
|
break;
|
|
|
|
case RAWKEY_ESC:
|
2009-02-01 16:01:46 +03:00
|
|
|
browser_window_key_press(gwin->bw,KEY_ESCAPE);
|
|
|
|
break;
|
|
|
|
case RAWKEY_PAGEUP:
|
|
|
|
browser_window_key_press(gwin->bw,KEY_PAGE_UP);
|
|
|
|
break;
|
|
|
|
case RAWKEY_PAGEDOWN:
|
|
|
|
browser_window_key_press(gwin->bw,KEY_PAGE_DOWN);
|
|
|
|
break;
|
|
|
|
case RAWKEY_HOME:
|
|
|
|
browser_window_key_press(gwin->bw,KEY_TEXT_START);
|
|
|
|
break;
|
|
|
|
case RAWKEY_END:
|
|
|
|
browser_window_key_press(gwin->bw,KEY_TEXT_END);
|
|
|
|
break;
|
|
|
|
case RAWKEY_BACKSPACE:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_DELETE_LINE_START);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_DELETE_LEFT);
|
|
|
|
break;
|
|
|
|
case RAWKEY_DEL:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_DELETE_LINE_END);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_DELETE_RIGHT);
|
|
|
|
break;
|
|
|
|
case RAWKEY_TAB:
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
|
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,KEY_SHIFT_TAB);
|
|
|
|
}
|
|
|
|
else browser_window_key_press(gwin->bw,KEY_TAB);
|
2008-08-25 17:32:26 +04:00
|
|
|
break;
|
2008-10-26 15:25:26 +03:00
|
|
|
default:
|
2009-01-25 14:18:42 +03:00
|
|
|
if((chars = MapRawKey(ie,buffer,20,NULL)) > 0)
|
2009-01-25 03:36:30 +03:00
|
|
|
{
|
2009-05-26 02:32:38 +04:00
|
|
|
/* this doesn't work - MapRawKey would take notice of capslock if it was in
|
|
|
|
ie_qualifier anyway
|
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_CAPSLOCK)
|
|
|
|
{
|
|
|
|
for(i=0;i<chars;i++)
|
|
|
|
buffer[i] = ToUpper(buffer[i]);
|
|
|
|
}
|
|
|
|
*/
|
2009-01-25 03:36:30 +03:00
|
|
|
if(ie->ie_Qualifier & IEQUALIFIER_RCOMMAND)
|
|
|
|
{
|
|
|
|
/* 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-01-25 03:36:30 +03:00
|
|
|
switch(buffer[0])
|
|
|
|
{
|
|
|
|
case 'c':
|
2009-02-01 16:01:46 +03:00
|
|
|
browser_window_key_press(gwin->bw, KEY_COPY_SELECTION);
|
|
|
|
browser_window_key_press(gwin->bw, KEY_ESCAPE);
|
2009-01-25 03:36:30 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'v':
|
2009-02-01 16:01:46 +03:00
|
|
|
browser_window_key_press(gwin->bw, KEY_PASTE);
|
2009-01-25 03:36:30 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-18 15:36:41 +04:00
|
|
|
else
|
2009-01-25 03:36:30 +03:00
|
|
|
{
|
|
|
|
browser_window_key_press(gwin->bw,buffer[0]);
|
|
|
|
}
|
|
|
|
}
|
2008-10-26 15:25:26 +03:00
|
|
|
break;
|
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)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
// fall through
|
2008-09-28 00:55:11 +04:00
|
|
|
case AMINS_FRAME:
|
2009-03-14 19:18:09 +03:00
|
|
|
//GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
|
|
|
//browser_reformat_pending = true;
|
|
|
|
gwin->bw->reformat_pending = true;
|
|
|
|
//browser_window_reformat(gwin->bw,bbox->Width,bbox->Height);
|
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;
|
|
|
|
ULONG *argb;
|
|
|
|
|
|
|
|
bm = urldb_get_thumbnail(gwin->bw->current_content->url);
|
|
|
|
argb = AllocVec(bm->nativebmwidth * bm->nativebmheight, MEMF_CLEAR);
|
|
|
|
BltBitMapTags(BLITA_Width, bm->nativebmwidth,
|
|
|
|
BLITA_Height, bm->nativebmheight,
|
|
|
|
BLITA_SrcType, BLITT_BITMAP,
|
|
|
|
BLITA_Source, bm->nativebm,
|
|
|
|
BLITA_DestType, BLITT_ARGB32,
|
|
|
|
BLITA_Dest, argb,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
// dobj = NewDiskObject(WBPROJECT);
|
|
|
|
dobj = GetIconTags(NULL, ICONGETA_GetDefaultType, WBPROJECT, TAG_DONE);
|
|
|
|
IconControl(dobj,
|
|
|
|
ICONCTRLA_SetWidth, bm->nativebmwidth,
|
|
|
|
ICONCTRLA_SetHeight, bm->nativebmheight,
|
|
|
|
ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
|
|
|
|
ICONCTRLA_SetImageData1, argb,
|
|
|
|
ICONCTRLA_SetImageData2, argb,
|
|
|
|
TAG_DONE);
|
|
|
|
*/
|
2009-07-04 20:12:27 +04:00
|
|
|
SetAttrs(gwin->objects[OID_MAIN],
|
|
|
|
WINDOW_IconTitle, gwin->win->Title,
|
2009-07-04 22:01:46 +04:00
|
|
|
// WINDOW_Icon, dobj,
|
2009-07-04 20:12:27 +04:00
|
|
|
TAG_DONE);
|
|
|
|
RA_Iconify(gwin->objects[OID_MAIN]);
|
|
|
|
screen_closed = CloseScreen(scrn);
|
|
|
|
}
|
|
|
|
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;
|
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:
|
|
|
|
// printf("class: %ld\n",(result & WMHI_CLASSMASK));
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2009-01-11 00:31:21 +03:00
|
|
|
if((node->Type == AMINS_WINDOW) || (node->Type == AMINS_FRAME))
|
|
|
|
{
|
2009-02-05 15:20:23 +03:00
|
|
|
if(gwin->redraw_required)
|
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)
|
|
|
|
{
|
|
|
|
// struct gui_window tgw;
|
|
|
|
// tgw.shared = gwin;
|
|
|
|
gui_window_place_caret(gwin->bw->window,gwin->bw->window->c_x,gwin->bw->window->c_y,gwin->bw->window->c_h);
|
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
}
|
2008-10-06 22:20:16 +04:00
|
|
|
} while(node = nnode);
|
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;
|
2008-09-07 19:58:11 +04:00
|
|
|
struct IBox *bbox;
|
|
|
|
ULONG x,y,xs,ys,width,height,len;
|
|
|
|
struct WBArg *appwinargs;
|
|
|
|
STRPTR filename;
|
|
|
|
struct box *box,*file_box=0,*text_box=0;
|
|
|
|
struct content *content;
|
|
|
|
int box_x=0,box_y=0;
|
|
|
|
BPTR fh = 0;
|
|
|
|
char *utf8text,*urlfilename;
|
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
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
GetAttr(WINDOW_UserData,(struct Window *)appmsg->am_ID,(ULONG *)&gwin);
|
2008-09-07 19:58:11 +04:00
|
|
|
|
2009-07-04 20:12:27 +04:00
|
|
|
if(appmsg->am_Type == AMTYPE_APPICON)
|
|
|
|
{
|
|
|
|
if(screen_closed)
|
|
|
|
{
|
|
|
|
ami_openscreen();
|
|
|
|
screen_closed = FALSE;
|
|
|
|
}
|
|
|
|
gwin->win = (struct Window *)RA_OpenWindow(gwin->objects[OID_MAIN]);
|
2009-07-04 22:01:46 +04:00
|
|
|
gwin->redraw_required = true;
|
|
|
|
ScreenToFront(scrn);
|
2009-07-04 20:12:27 +04:00
|
|
|
WindowToFront(gwin->win);
|
|
|
|
}
|
|
|
|
else if(appmsg->am_Type == AMTYPE_APPWINDOW)
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
2008-09-05 02:41:26 +04:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
|
2008-09-07 19:58:11 +04:00
|
|
|
x = (appmsg->am_MouseX) - (bbox->Left) +xs;
|
|
|
|
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
|
2008-09-07 19:58:11 +04:00
|
|
|
y = appmsg->am_MouseY - bbox->Top + ys;
|
|
|
|
|
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
|
|
|
|
|
|
|
if(appwinargs = appmsg->am_ArgList)
|
2008-09-05 02:41:26 +04:00
|
|
|
{
|
2008-11-02 03:21:49 +03:00
|
|
|
if(filename = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR))
|
2008-09-07 19:58:11 +04:00
|
|
|
{
|
|
|
|
if(appwinargs->wa_Lock)
|
|
|
|
{
|
|
|
|
NameFromLock(appwinargs->wa_Lock,filename,1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
AddPart(filename,appwinargs->wa_Name,1024);
|
|
|
|
|
|
|
|
if((!gwin->bw->current_content || gwin->bw->current_content->type != CONTENT_HTML) || (!((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))))
|
|
|
|
{
|
|
|
|
urlfilename = path_to_url(filename);
|
|
|
|
browser_window_go(gwin->bw,urlfilename,NULL,true);
|
|
|
|
free(urlfilename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
content = gwin->bw->current_content;
|
|
|
|
box = content->data.html.layout;
|
|
|
|
while ((box = box_at_point(box, x, y, &box_x, &box_y, &content)))
|
|
|
|
{
|
2009-07-24 03:05:34 +04:00
|
|
|
if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue;
|
2008-09-07 19:58:11 +04:00
|
|
|
|
|
|
|
if (box->gadget)
|
|
|
|
{
|
|
|
|
switch (box->gadget->type)
|
|
|
|
{
|
|
|
|
case GADGET_FILE:
|
|
|
|
file_box = box;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GADGET_TEXTBOX:
|
|
|
|
case GADGET_TEXTAREA:
|
|
|
|
case GADGET_PASSWORD:
|
|
|
|
text_box = box;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!file_box && !text_box)
|
2008-09-29 02:50:13 +04:00
|
|
|
return;
|
2008-09-07 19:58:11 +04:00
|
|
|
|
|
|
|
if(file_box)
|
|
|
|
{
|
|
|
|
utf8_convert_ret ret;
|
|
|
|
char *utf8_fn;
|
|
|
|
|
|
|
|
if(utf8_from_local_encoding(filename,0,&utf8_fn) != UTF8_CONVERT_OK)
|
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
warn_user("NoMemory","");
|
2008-09-07 19:58:11 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(file_box->gadget->value);
|
|
|
|
file_box->gadget->value = utf8_fn;
|
|
|
|
|
2008-09-29 02:50:13 +04:00
|
|
|
box_coords(file_box, (int *)&x, (int *)&y);
|
2008-09-07 19:58:11 +04:00
|
|
|
gui_window_redraw(gwin->bw->window,x,y,
|
|
|
|
x + file_box->width,
|
|
|
|
y + file_box->height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
browser_window_mouse_click(gwin->bw, BROWSER_MOUSE_PRESS_1, x,y);
|
2008-09-08 22:14:14 +04:00
|
|
|
/* This bit pastes a plain text file into a form. Really we should be using
|
|
|
|
Datatypes for this to support more formats */
|
|
|
|
|
2008-09-07 19:58:11 +04:00
|
|
|
if(fh = FOpen(filename,MODE_OLDFILE,0))
|
|
|
|
{
|
|
|
|
while(len = FRead(fh,filename,1,1024))
|
|
|
|
{
|
|
|
|
if(utf8_from_local_encoding(filename,len,&utf8text) == UTF8_CONVERT_OK)
|
|
|
|
{
|
|
|
|
browser_window_paste_text(gwin->bw,utf8text,strlen(utf8text),true);
|
|
|
|
free(utf8text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FClose(fh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
FreeVec(filename);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
while((applibmsg=(struct ApplicationMsg *)GetMsg(applibport)))
|
|
|
|
{
|
|
|
|
switch (applibmsg->type)
|
|
|
|
{
|
2009-09-29 02:17:09 +04:00
|
|
|
case APPLIBMT_NewBlankDoc:
|
|
|
|
bw = browser_window_create(option_homepage_url, 0, 0, true, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case APPLIBMT_OpenDoc:
|
|
|
|
{
|
|
|
|
struct ApplicationOpenPrintDocMsg *applibopdmsg = applibmsg;
|
|
|
|
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
|
|
|
|
{
|
|
|
|
bw = browser_window_create(option_homepage_url, 0, 0, true, false);
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
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);
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
if(signal & winsignal)
|
|
|
|
{
|
|
|
|
ami_handle_msg();
|
|
|
|
}
|
|
|
|
else if(signal & appsig)
|
|
|
|
{
|
|
|
|
ami_handle_appmsg();
|
|
|
|
}
|
2008-09-29 23:35:30 +04:00
|
|
|
else if(signal & rxsig)
|
|
|
|
{
|
|
|
|
ami_arexx_handle();
|
|
|
|
}
|
2009-09-28 22:00:40 +04:00
|
|
|
else if(signal & applibsig)
|
|
|
|
{
|
|
|
|
ami_handle_applib();
|
|
|
|
}
|
2009-08-29 18:00:57 +04:00
|
|
|
else if(signal & printsig)
|
|
|
|
{
|
|
|
|
while(GetMsg(printmsgport)); //ReplyMsg
|
|
|
|
ami_print_cont();
|
|
|
|
}
|
2008-09-08 22:14:14 +04:00
|
|
|
else if(signal & schedulesig)
|
|
|
|
{
|
2009-10-16 01:35:29 +04:00
|
|
|
timermsg = (struct TimeRequest *)GetMsg(msgport);
|
|
|
|
//schedule_run();
|
2008-09-08 22:14:14 +04:00
|
|
|
}
|
2008-09-05 02:41:26 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
void gui_multitask(void)
|
|
|
|
{
|
|
|
|
/* This seems a bit topsy-turvy to me, but in this function, NetSurf is doing
|
|
|
|
stuff and we need to poll for user events */
|
2008-08-02 18:31:32 +04:00
|
|
|
|
2008-09-05 02:41:26 +04:00
|
|
|
ami_handle_msg();
|
|
|
|
ami_handle_appmsg();
|
2008-11-02 03:21:49 +03:00
|
|
|
ami_arexx_handle();
|
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
|
2008-09-08 22:14:14 +04:00
|
|
|
scheduled event to kick in (scheduled events are signalled using
|
|
|
|
timer.device, but NetSurf seems to still be wanting to run code. We ask
|
|
|
|
Intuition to send IDCMP_INTUITICKS messages every 1/10s to our active
|
|
|
|
window to break us out of ami_get_msg to stop NetSurf stalling (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).
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
gui_multitask();
|
|
|
|
schedule_run();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ami_get_msg();
|
2008-09-14 02:53:38 +04:00
|
|
|
schedule_run(); // run on intuitick
|
2008-09-08 22:14:14 +04:00
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
if(gwin->tabs == 0) return;
|
|
|
|
|
2008-11-09 02:08:55 +03:00
|
|
|
gui_window_get_scroll(gwin->bw->window,&gwin->bw->window->scrollx,&gwin->bw->window->scrolly);
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
GetAttr(CLICKTAB_CurrentNode,gwin->gadgets[GID_TABS],(ULONG *)&tabnode);
|
|
|
|
GetClickTabNodeAttrs(tabnode,
|
|
|
|
TNA_UserData,&gwin->bw,
|
|
|
|
TAG_DONE);
|
2008-10-26 02:22:34 +03:00
|
|
|
curbw = gwin->bw;
|
2009-09-09 02:59:47 +04:00
|
|
|
GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
|
|
|
|
|
|
|
if(!gwin->bw->current_content)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
if(redraw)
|
|
|
|
{
|
2009-01-17 19:13:56 +03: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
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_update(gwin->bw,false);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
2009-03-30 22:04:30 +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
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
if(gwin->bw->current_content)
|
2009-03-30 22:04:30 +04:00
|
|
|
browser_window_refresh_url_bar(gwin->bw,gwin->bw->current_content->url,
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if(option_close_no_quit == false)
|
|
|
|
{
|
|
|
|
netsurf_quit = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(CloseScreen(scrn)) scrn = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
node = nnode;
|
|
|
|
|
|
|
|
} while(node = nnode);
|
|
|
|
}
|
2008-10-06 21:47:31 +04:00
|
|
|
|
|
|
|
if(IsMinListEmpty(window_list))
|
|
|
|
{
|
|
|
|
/* last window closed, so exit */
|
|
|
|
netsurf_quit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
void gui_quit(void)
|
|
|
|
{
|
2008-08-31 21:34:00 +04:00
|
|
|
int i;
|
|
|
|
|
2008-09-14 02:39:48 +04:00
|
|
|
p96FreeBitMap(throbber);
|
2008-09-11 23:33:40 +04:00
|
|
|
|
2008-08-25 17:32:26 +04:00
|
|
|
urldb_save(option_url_file);
|
2008-08-09 19:19:04 +04:00
|
|
|
urldb_save_cookies(option_cookie_file);
|
2008-08-25 17:32:26 +04:00
|
|
|
options_save_tree(hotlist,option_hotlist_file,messages_get("TreeHotlist"));
|
2008-10-12 01:38:04 +04:00
|
|
|
void ami_global_history_save();
|
|
|
|
|
|
|
|
ami_cookies_free();
|
|
|
|
ami_global_history_free();
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2008-08-15 21:19:57 +04:00
|
|
|
hubbub_finalise(myrealloc,NULL);
|
|
|
|
|
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();
|
|
|
|
|
2008-12-08 00:50:04 +03:00
|
|
|
if(!locked_screen) /* set if we are using somebody else's screen */
|
|
|
|
{
|
|
|
|
while(!CloseScreen(scrn));
|
|
|
|
}
|
2009-02-14 15:29:07 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* have a go at closing the public screen, apparently this is OK to do */
|
|
|
|
CloseScreen(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
|
|
|
|
|
|
|
if(option_context_menu) ami_context_menu_free();
|
2008-08-25 17:32:26 +04:00
|
|
|
ami_free_menulabs();
|
|
|
|
|
2008-08-31 21:34:00 +04:00
|
|
|
for(i=0;i<=AMI_LASTPOINTER;i++)
|
|
|
|
{
|
|
|
|
if(mouseptrbm[i])
|
|
|
|
{
|
|
|
|
FreeRaster(mouseptrbm[i]->Planes[0],16,16);
|
|
|
|
FreeRaster(mouseptrbm[i]->Planes[1],16,16);
|
|
|
|
FreeVec(mouseptrbm[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2008-08-22 01:41:42 +04:00
|
|
|
FreeAslRequest(filereq);
|
2009-01-11 00:31:21 +03:00
|
|
|
FreeAslRequest(savereq);
|
|
|
|
|
|
|
|
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(IPopupMenu) DropInterface((struct Interface *)IPopupMenu);
|
|
|
|
if(PopupMenuBase) CloseLibrary(PopupMenuBase);
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2009-09-28 22:00:40 +04:00
|
|
|
if(IKeymap) DropInterface((struct Interface *)IKeymap);
|
|
|
|
if(KeymapBase) CloseLibrary(KeymapBase);
|
2008-10-26 15:25:26 +03:00
|
|
|
|
2008-08-03 20:13:57 +04:00
|
|
|
if(ITimer)
|
|
|
|
{
|
|
|
|
DropInterface((struct Interface *)ITimer);
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseDevice((struct IORequest *) tioreq);
|
|
|
|
FreeSysObject(ASOT_IOREQUEST,tioreq);
|
|
|
|
FreeSysObject(ASOT_PORT,msgport);
|
|
|
|
|
|
|
|
FreeObjList(schedule_list);
|
2008-08-10 00:27:36 +04:00
|
|
|
FreeObjList(window_list);
|
|
|
|
}
|
|
|
|
|
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;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-05-24 17:13:27 +04:00
|
|
|
if(gwin->bw->browser_window_type != BROWSER_WINDOW_NORMAL)
|
|
|
|
return;
|
|
|
|
|
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;
|
|
|
|
|
2009-09-04 22:10:15 +04:00
|
|
|
if(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL &&
|
|
|
|
option_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
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
RefreshSetGadgetAttrs(gwin->gadgets[GID_BACK],gwin->win,NULL,
|
|
|
|
GA_Disabled,back,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs(gwin->gadgets[GID_FORWARD],gwin->win,NULL,
|
|
|
|
GA_Disabled,forward,
|
|
|
|
TAG_DONE);
|
2008-10-06 11:07:33 +04:00
|
|
|
|
2009-03-24 21:28:02 +03:00
|
|
|
RefreshSetGadgetAttrs(gwin->gadgets[GID_RELOAD],gwin->win,NULL,
|
|
|
|
GA_Disabled,reload,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs(gwin->gadgets[GID_STOP],gwin->win,NULL,
|
|
|
|
GA_Disabled,stop,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2008-10-06 11:07:33 +04:00
|
|
|
if(gwin->tabs)
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs(gwin->gadgets[GID_CLOSETAB],gwin->win,NULL,
|
|
|
|
GA_Disabled,tabclose,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-08-19 22:31:56 +04:00
|
|
|
}
|
|
|
|
|
2008-10-18 17:56:12 +04:00
|
|
|
void ami_get_theme_filename(char *filename,char *themestring)
|
|
|
|
{
|
|
|
|
if(messages_get(themestring)[0] == '*') strncpy(filename,messages_get(themestring)+1,100);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(filename,option_theme);
|
|
|
|
AddPart(filename,messages_get(themestring),100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2008-08-25 17:32:26 +04:00
|
|
|
struct NewMenu *menu;
|
2008-08-02 18:31:32 +04:00
|
|
|
struct gui_window *gwin = NULL;
|
2008-08-10 00:27:36 +04:00
|
|
|
bool closegadg=TRUE;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct Node *node;
|
2008-09-04 02:02:41 +04:00
|
|
|
ULONG curx=option_window_x,cury=option_window_y,curw=option_window_width,curh=option_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];
|
2009-09-06 15:23:35 +04:00
|
|
|
char tabthrobber[100];
|
2008-09-04 02:02:41 +04:00
|
|
|
|
2008-11-15 18:28:17 +03:00
|
|
|
if((bw->browser_window_type == BROWSER_WINDOW_IFRAME) && option_no_iframes) return NULL;
|
|
|
|
|
2009-09-29 02:17:09 +04:00
|
|
|
if(!scrn) ami_openscreenfirst();
|
|
|
|
|
2008-10-05 18:22:02 +04:00
|
|
|
if(option_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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
gwin = AllocVec(sizeof(struct gui_window),MEMF_PRIVATE | MEMF_CLEAR);
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
if(!gwin)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2009-03-28 15:50:19 +03:00
|
|
|
NewList(&gwin->dllist);
|
|
|
|
|
2008-11-15 18:28:17 +03:00
|
|
|
/*
|
|
|
|
if(bw->browser_window_type == BROWSER_WINDOW_IFRAME)
|
|
|
|
{
|
|
|
|
gwin->shared = bw->parent->window->shared;
|
|
|
|
gwin->bw = bw;
|
|
|
|
return gwin;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
if(new_tab && clone && (bw->browser_window_type == BROWSER_WINDOW_NORMAL))
|
2008-10-05 03:29:17 +04:00
|
|
|
{
|
|
|
|
gwin->shared = clone->window->shared;
|
2008-10-06 01:20:12 +04:00
|
|
|
gwin->tab = gwin->shared->next_tab;
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
SetGadgetAttrs(gwin->shared->gadgets[GID_TABS],gwin->shared->win,NULL,
|
|
|
|
CLICKTAB_Labels,~0,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
gwin->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
|
2008-10-06 01:20:12 +04:00
|
|
|
TNA_Number,gwin->tab,
|
2008-10-05 03:29:17 +04:00
|
|
|
TNA_UserData,bw,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
AddTail(&gwin->shared->tab_list,gwin->tab_node);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs(gwin->shared->gadgets[GID_TABS],gwin->shared->win,NULL,
|
|
|
|
CLICKTAB_Labels,&gwin->shared->tab_list,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
if(option_new_tab_active)
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs(gwin->shared->gadgets[GID_TABS],gwin->shared->win,NULL,
|
2008-10-06 01:20:12 +04:00
|
|
|
CLICKTAB_Current,gwin->tab,
|
2008-10-05 17:17:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
2009-09-01 02:10:05 +04:00
|
|
|
if(ClickTabBase->lib_Version < 53)
|
|
|
|
RethinkLayout(gwin->shared->gadgets[GID_TABLAYOUT],gwin->shared->win,NULL,TRUE);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
|
|
|
gwin->shared->tabs++;
|
2008-10-05 17:17:18 +04:00
|
|
|
gwin->shared->next_tab++;
|
|
|
|
|
|
|
|
if(option_new_tab_active) ami_switch_tab(gwin->shared,false);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2008-11-09 02:08:55 +03:00
|
|
|
ami_update_buttons(gwin->shared);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
return gwin;
|
|
|
|
}
|
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
gwin->shared = AllocVec(sizeof(struct gui_window_2),MEMF_PRIVATE | MEMF_CLEAR);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
|
|
|
if(!gwin->shared)
|
|
|
|
{
|
|
|
|
warn_user("NoMemory","");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-15 14:21:46 +03:00
|
|
|
gwin->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook;
|
2008-10-12 01:38:04 +04:00
|
|
|
gwin->shared->scrollerhook.h_Data = gwin->shared;
|
2008-08-25 17:32:26 +04:00
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
switch(bw->browser_window_type)
|
|
|
|
{
|
2008-08-25 17:32:26 +04:00
|
|
|
case BROWSER_WINDOW_IFRAME:
|
2008-08-09 19:19:04 +04:00
|
|
|
case BROWSER_WINDOW_FRAMESET:
|
|
|
|
case BROWSER_WINDOW_FRAME:
|
2008-10-05 17:17:18 +04:00
|
|
|
|
|
|
|
gwin->tab = 0;
|
|
|
|
gwin->shared->tabs = 0;
|
|
|
|
gwin->tab_node = NULL;
|
|
|
|
|
|
|
|
gwin->shared->objects[OID_MAIN] = WindowObject,
|
2008-08-23 20:17:51 +04:00
|
|
|
WA_ScreenTitle,nsscreentitle,
|
2008-08-28 02:19:25 +04:00
|
|
|
// WA_Title, messages_get("NetSurf"),
|
2008-08-25 17:32:26 +04:00
|
|
|
WA_Activate, FALSE,
|
2008-08-11 21:53:45 +04:00
|
|
|
WA_DepthGadget, TRUE,
|
|
|
|
WA_DragBar, TRUE,
|
|
|
|
WA_CloseGadget, FALSE,
|
2008-09-04 02:02:41 +04:00
|
|
|
WA_Top,cury,
|
|
|
|
WA_Left,curx,
|
|
|
|
WA_Width,curw,
|
|
|
|
WA_Height,curh,
|
2008-08-11 21:53:45 +04:00
|
|
|
WA_SizeGadget, TRUE,
|
|
|
|
WA_CustomScreen,scrn,
|
|
|
|
WA_ReportMouse,TRUE,
|
2009-05-25 14:13:53 +04:00
|
|
|
WA_SmartRefresh,TRUE,
|
2008-08-11 21:53:45 +04:00
|
|
|
WA_IDCMP,IDCMP_MENUPICK | IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS |
|
2009-08-01 17:16:16 +04:00
|
|
|
IDCMP_NEWSIZE | IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_SIZEVERIFY |
|
2009-10-16 01:35:29 +04:00
|
|
|
IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE | IDCMP_INTUITICKS,
|
2008-08-11 21:53:45 +04:00
|
|
|
// WINDOW_IconifyGadget, TRUE,
|
2008-10-05 17:17:18 +04:00
|
|
|
// WINDOW_NewMenu,menu,
|
2008-08-11 21:53:45 +04:00
|
|
|
WINDOW_HorizProp,1,
|
|
|
|
WINDOW_VertProp,1,
|
2008-10-05 03:29:17 +04:00
|
|
|
WINDOW_IDCMPHook,&gwin->shared->scrollerhook,
|
2009-08-01 17:16:16 +04:00
|
|
|
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_SIZEVERIFY,
|
2008-09-04 02:02:41 +04:00
|
|
|
WINDOW_AppPort, appport,
|
|
|
|
WINDOW_AppWindow,TRUE,
|
2008-12-28 15:24:18 +03:00
|
|
|
WINDOW_BuiltInScroll,TRUE,
|
2008-09-05 02:41:26 +04:00
|
|
|
WINDOW_SharedPort,sport,
|
2008-10-05 03:29:17 +04:00
|
|
|
WINDOW_UserData,gwin->shared,
|
2008-08-18 23:07:12 +04:00
|
|
|
// WINDOW_Position, WPOS_CENTERSCREEN,
|
2008-08-15 21:19:57 +04:00
|
|
|
// WINDOW_CharSet,106,
|
2008-10-05 03:29:17 +04:00
|
|
|
WINDOW_ParentGroup, gwin->shared->gadgets[GID_MAIN] = VGroupObject,
|
2008-08-15 21:19:57 +04:00
|
|
|
// LAYOUT_CharSet,106,
|
2008-08-11 21:53:45 +04:00
|
|
|
LAYOUT_SpaceOuter, TRUE,
|
2008-10-05 03:29:17 +04:00
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
|
2008-08-11 21:53:45 +04:00
|
|
|
GA_ID,GID_BROWSER,
|
2009-03-08 15:52:44 +03:00
|
|
|
SPACE_Transparent,TRUE,
|
2008-08-15 21:19:57 +04:00
|
|
|
/*
|
2008-08-11 21:53:45 +04:00
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Immediate,TRUE,
|
|
|
|
GA_FollowMouse,TRUE,
|
2008-08-15 21:19:57 +04:00
|
|
|
*/
|
2008-08-11 21:53:45 +04:00
|
|
|
SpaceEnd,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
break;
|
2008-08-09 19:19:04 +04:00
|
|
|
case BROWSER_WINDOW_NORMAL:
|
2008-10-05 18:22:02 +04:00
|
|
|
if(!option_kiosk_mode)
|
|
|
|
{
|
|
|
|
menu = ami_create_menu(bw->browser_window_type);
|
|
|
|
|
|
|
|
NewList(&gwin->shared->tab_list);
|
|
|
|
gwin->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
|
|
|
|
TNA_Number,0,
|
|
|
|
TNA_UserData,bw,
|
|
|
|
TAG_DONE);
|
|
|
|
AddTail(&gwin->shared->tab_list,gwin->tab_node);
|
|
|
|
|
|
|
|
gwin->shared->tabs=1;
|
|
|
|
gwin->shared->next_tab=1;
|
|
|
|
|
2009-07-23 15:23:34 +04:00
|
|
|
gwin->shared->svbuffer = AllocVec(2000, MEMF_CLEAR);
|
|
|
|
|
2008-10-18 17:56:12 +04:00
|
|
|
ami_get_theme_filename(nav_west,"theme_nav_west");
|
|
|
|
ami_get_theme_filename(nav_west_s,"theme_nav_west_s");
|
|
|
|
ami_get_theme_filename(nav_west_g,"theme_nav_west_g");
|
|
|
|
ami_get_theme_filename(nav_east,"theme_nav_east");
|
|
|
|
ami_get_theme_filename(nav_east_s,"theme_nav_east_s");
|
|
|
|
ami_get_theme_filename(nav_east_g,"theme_nav_east_g");
|
|
|
|
ami_get_theme_filename(stop,"theme_stop");
|
|
|
|
ami_get_theme_filename(stop_s,"theme_stop_s");
|
|
|
|
ami_get_theme_filename(stop_g,"theme_stop_g");
|
|
|
|
ami_get_theme_filename(reload,"theme_reload");
|
|
|
|
ami_get_theme_filename(reload_s,"theme_reload_s");
|
|
|
|
ami_get_theme_filename(reload_g,"theme_reload_g");
|
|
|
|
ami_get_theme_filename(home,"theme_home");
|
|
|
|
ami_get_theme_filename(home_s,"theme_home_s");
|
|
|
|
ami_get_theme_filename(home_g,"theme_home_g");
|
|
|
|
ami_get_theme_filename(closetab,"theme_closetab");
|
2009-02-18 23:04:59 +03:00
|
|
|
ami_get_theme_filename(closetab_s,"theme_closetab_s");
|
|
|
|
ami_get_theme_filename(closetab_g,"theme_closetab_g");
|
2009-09-06 15:23:35 +04:00
|
|
|
ami_get_theme_filename(tabthrobber,"theme_tab_loading");
|
2008-10-05 18:22:02 +04:00
|
|
|
|
|
|
|
gwin->shared->objects[OID_MAIN] = WindowObject,
|
|
|
|
WA_ScreenTitle,nsscreentitle,
|
|
|
|
// WA_Title, messages_get("NetSurf"),
|
|
|
|
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,
|
2009-05-25 14:13:53 +04:00
|
|
|
WA_SmartRefresh,TRUE,
|
2009-08-29 03:12:18 +04:00
|
|
|
WA_SizeBBottom, TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WA_IDCMP,IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
|
|
|
|
IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
2009-08-01 17:16:16 +04:00
|
|
|
IDCMP_RAWKEY | IDCMP_SIZEVERIFY |
|
2008-10-05 18:22:02 +04:00
|
|
|
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
2009-10-16 01:35:29 +04:00
|
|
|
IDCMP_ACTIVEWINDOW | IDCMP_INTUITICKS |
|
2009-09-05 02:00:09 +04:00
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_GADGETDOWN,
|
2009-07-04 22:01:46 +04:00
|
|
|
// WINDOW_IconifyGadget, TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_NewMenu,menu,
|
2009-08-29 03:12:18 +04:00
|
|
|
// WINDOW_HorizProp,1,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_VertProp,1,
|
|
|
|
WINDOW_IDCMPHook,&gwin->shared->scrollerhook,
|
2009-08-01 17:16:16 +04:00
|
|
|
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE |
|
2009-09-05 02:00:09 +04:00
|
|
|
IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY |
|
|
|
|
IDCMP_GADGETDOWN,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_AppPort, appport,
|
|
|
|
WINDOW_AppWindow,TRUE,
|
|
|
|
WINDOW_SharedPort,sport,
|
2008-12-28 15:24:18 +03:00
|
|
|
WINDOW_BuiltInScroll,TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_UserData,gwin->shared,
|
|
|
|
// WINDOW_Position, WPOS_CENTERSCREEN,
|
|
|
|
// WINDOW_CharSet,106,
|
|
|
|
WINDOW_ParentGroup, gwin->shared->gadgets[GID_MAIN] = VGroupObject,
|
|
|
|
// LAYOUT_CharSet,106,
|
|
|
|
LAYOUT_SpaceOuter, TRUE,
|
|
|
|
LAYOUT_AddChild, HGroupObject,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_BACK] = ButtonObject,
|
|
|
|
GA_ID,GID_BACK,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Disabled,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,nav_west,
|
|
|
|
BITMAP_SelectSourceFile,nav_west_s,
|
|
|
|
BITMAP_DisabledSourceFile,nav_west_g,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_FORWARD] = ButtonObject,
|
|
|
|
GA_ID,GID_FORWARD,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
GA_Disabled,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
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,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_STOP] = ButtonObject,
|
|
|
|
GA_ID,GID_STOP,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
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,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_RELOAD] = ButtonObject,
|
|
|
|
GA_ID,GID_RELOAD,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
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,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_HOME] = ButtonObject,
|
|
|
|
GA_ID,GID_HOME,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
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,
|
2009-07-23 15:23:34 +04:00
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_URL] =
|
|
|
|
NewObject(urlStringClass, NULL,
|
|
|
|
STRINGA_MaxChars, 2000,
|
|
|
|
GA_ID, GID_URL,
|
|
|
|
GA_RelVerify, TRUE,
|
|
|
|
GA_TabCycle, TRUE,
|
|
|
|
STRINGA_Buffer, gwin->shared->svbuffer,
|
|
|
|
STRINGVIEW_Header, URLHistory_GetList(),
|
|
|
|
// STRINGA_TextVal, NULL,
|
|
|
|
StringEnd,
|
|
|
|
/*
|
|
|
|
StringObject,
|
2008-10-05 18:22:02 +04:00
|
|
|
GA_ID,GID_URL,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
StringEnd,
|
2009-07-23 15:23:34 +04:00
|
|
|
*/
|
2008-10-05 18:22:02 +04:00
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_THROBBER] = SpaceObject,
|
|
|
|
GA_ID,GID_THROBBER,
|
|
|
|
SPACE_MinWidth,throbber_width,
|
|
|
|
SPACE_MinHeight,throbber_height,
|
2009-03-08 15:52:44 +03:00
|
|
|
SPACE_Transparent,TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
SpaceEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LayoutEnd,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_TABLAYOUT] = HGroupObject,
|
2009-03-11 22:23:57 +03:00
|
|
|
LAYOUT_SpaceInner,FALSE,
|
2008-10-06 01:20:12 +04:00
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_CLOSETAB] = ButtonObject,
|
|
|
|
GA_ID,GID_CLOSETAB,
|
|
|
|
GA_RelVerify,TRUE,
|
|
|
|
BUTTON_Transparent,TRUE,
|
|
|
|
BUTTON_RenderImage,BitMapObject,
|
|
|
|
BITMAP_SourceFile,closetab,
|
2009-02-18 23:04:59 +03:00
|
|
|
BITMAP_SelectSourceFile,closetab_s,
|
|
|
|
BITMAP_DisabledSourceFile,closetab_g,
|
2008-10-06 01:20:12 +04:00
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
|
|
|
ButtonEnd,
|
|
|
|
CHILD_WeightedWidth,0,
|
|
|
|
CHILD_WeightedHeight,0,
|
2008-10-05 18:22:02 +04:00
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_TABS] = ClickTabObject,
|
|
|
|
GA_ID,GID_TABS,
|
|
|
|
GA_RelVerify,TRUE,
|
2009-02-01 16:26:21 +03:00
|
|
|
GA_Underscore,13, // disable kb shortcuts
|
2008-10-05 18:22:02 +04:00
|
|
|
CLICKTAB_Labels,&gwin->shared->tab_list,
|
|
|
|
CLICKTAB_LabelTruncate,TRUE,
|
2009-09-06 15:23:35 +04:00
|
|
|
CLICKTAB_FlagImage, BitMapObject,
|
|
|
|
BITMAP_SourceFile, tabthrobber,
|
|
|
|
BITMAP_Screen,scrn,
|
|
|
|
BITMAP_Masking,TRUE,
|
|
|
|
BitMapEnd,
|
2008-10-05 18:22:02 +04:00
|
|
|
ClickTabEnd,
|
|
|
|
CHILD_CacheDomain,FALSE,
|
|
|
|
LayoutEnd,
|
|
|
|
CHILD_WeightedHeight,0,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
|
|
|
|
GA_ID,GID_BROWSER,
|
2009-03-08 15:52:44 +03:00
|
|
|
SPACE_Transparent,TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
SpaceEnd,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* borderless kiosk mode window */
|
|
|
|
gwin->tab = 0;
|
|
|
|
gwin->shared->tabs = 0;
|
|
|
|
gwin->tab_node = NULL;
|
|
|
|
|
|
|
|
gwin->shared->objects[OID_MAIN] = WindowObject,
|
|
|
|
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,
|
2009-01-11 00:31:21 +03:00
|
|
|
WA_Width,option_window_width,
|
|
|
|
WA_Height,option_window_height,
|
2008-10-05 18:22:02 +04:00
|
|
|
WA_SizeGadget, FALSE,
|
|
|
|
WA_CustomScreen,scrn,
|
|
|
|
WA_ReportMouse,TRUE,
|
|
|
|
WA_IDCMP,IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
|
|
|
|
IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
|
2009-10-16 01:35:29 +04:00
|
|
|
IDCMP_RAWKEY | IDCMP_INTUITICKS |
|
2008-10-05 18:22:02 +04:00
|
|
|
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
|
2009-10-16 01:35:29 +04:00
|
|
|
IDCMP_EXTENDEDMOUSE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_HorizProp,1,
|
|
|
|
WINDOW_VertProp,1,
|
|
|
|
WINDOW_IDCMPHook,&gwin->shared->scrollerhook,
|
2009-03-29 03:51:39 +04:00
|
|
|
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_AppPort, appport,
|
|
|
|
WINDOW_AppWindow,TRUE,
|
|
|
|
WINDOW_SharedPort,sport,
|
|
|
|
WINDOW_UserData,gwin->shared,
|
2008-12-28 15:24:18 +03:00
|
|
|
WINDOW_BuiltInScroll,TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
WINDOW_ParentGroup, gwin->shared->gadgets[GID_MAIN] = VGroupObject,
|
|
|
|
LAYOUT_SpaceOuter, TRUE,
|
|
|
|
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
|
|
|
|
GA_ID,GID_BROWSER,
|
2009-03-08 15:52:44 +03:00
|
|
|
SPACE_Transparent,TRUE,
|
2008-10-05 18:22:02 +04:00
|
|
|
SpaceEnd,
|
|
|
|
EndGroup,
|
|
|
|
EndWindow;
|
|
|
|
}
|
2008-08-11 21:53:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
gwin->shared->win = (struct Window *)RA_OpenWindow(gwin->shared->objects[OID_MAIN]);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
if(!gwin->shared->win)
|
2008-08-31 01:32:05 +04:00
|
|
|
{
|
2008-09-29 02:50:13 +04:00
|
|
|
warn_user("NoMemory","");
|
2008-10-05 03:29:17 +04:00
|
|
|
FreeVec(gwin->shared);
|
2008-08-31 01:32:05 +04:00
|
|
|
FreeVec(gwin);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
GetAttr(WINDOW_VertObject, gwin->shared->objects[OID_MAIN],
|
|
|
|
(ULONG *)&gwin->shared->objects[OID_VSCROLL]);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)gwin->shared->objects[OID_VSCROLL],
|
|
|
|
gwin->shared->win, NULL,
|
|
|
|
GA_ID, OID_VSCROLL,
|
|
|
|
ICA_TARGET, ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
2008-08-10 13:57:41 +04:00
|
|
|
|
2009-09-04 22:10:15 +04:00
|
|
|
if(bw->browser_window_type == BROWSER_WINDOW_NORMAL &&
|
|
|
|
option_kiosk_mode == false)
|
2009-08-29 03:12:18 +04:00
|
|
|
{
|
|
|
|
ULONG sz, size1, size2;
|
|
|
|
|
|
|
|
sz = ami_get_border_gadget_balance(gwin->shared,
|
|
|
|
(ULONG *)&size1, (ULONG *)&size2);
|
|
|
|
|
|
|
|
gwin->shared->gadgets[GID_HSCROLL] = (struct Gadget *)NewObject(
|
|
|
|
NULL,
|
|
|
|
"scrollergclass",
|
|
|
|
GA_ID, GID_HSCROLL,
|
|
|
|
PGA_Freedom, FREEHORIZ,
|
|
|
|
// GA_Left, size1,
|
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);
|
|
|
|
|
|
|
|
GetAttr(GA_Height, gwin->shared->gadgets[GID_HSCROLL],
|
|
|
|
(ULONG *)&sz);
|
|
|
|
|
|
|
|
gwin->shared->gadgets[GID_STATUS] = (struct Gadget *)NewObject(
|
|
|
|
NULL,
|
|
|
|
"frbuttonclass",
|
|
|
|
GA_ID, GID_STATUS,
|
|
|
|
GA_Left, scrn->WBorLeft,
|
2009-08-29 03:26:55 +04:00
|
|
|
GA_RelBottom, -((1 + 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,
|
|
|
|
"frameiclass",
|
|
|
|
IA_FrameType, FRAME_DISPLAY,
|
2009-09-18 01:44:07 +04:00
|
|
|
IA_Top, 1-(scrn->RastPort.TxHeight),
|
2009-09-16 02:49:33 +04:00
|
|
|
IA_Left, -1,
|
2009-09-18 01:44:07 +04:00
|
|
|
IA_Height, scrn->WBorBottom + scrn->RastPort.TxHeight,
|
2009-09-16 02:49:33 +04:00
|
|
|
IA_InBorder, TRUE,
|
|
|
|
TAG_DONE),
|
2009-08-29 03:12:18 +04:00
|
|
|
GA_Next, gwin->shared->gadgets[GID_HSCROLL],
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
AddGList(gwin->shared->win, gwin->shared->gadgets[GID_STATUS],
|
|
|
|
(UWORD)~0, -1, NULL);
|
|
|
|
|
2009-09-16 02:49:33 +04:00
|
|
|
/* Apparently you can't set GA_Width on creation time for frbuttonclass */
|
|
|
|
|
|
|
|
SetGadgetAttrs(gwin->shared->gadgets[GID_STATUS],
|
|
|
|
gwin->shared->win, NULL,
|
|
|
|
GA_Width, size1,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
RefreshGadgets((APTR)gwin->shared->gadgets[GID_STATUS],
|
|
|
|
gwin->shared->win, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetAttr(WINDOW_HorizObject, gwin->shared->objects[OID_MAIN],
|
|
|
|
(ULONG *)&gwin->shared->objects[OID_HSCROLL]);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)gwin->shared->objects[OID_HSCROLL],
|
|
|
|
gwin->shared->win, NULL,
|
|
|
|
GA_ID, OID_HSCROLL,
|
|
|
|
ICA_TARGET, ICTARGET_IDCMP,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
gwin->shared->bw = bw;
|
2008-10-26 02:22:34 +03:00
|
|
|
curbw = bw;
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
gwin->shared->node = AddObject(window_list,AMINS_WINDOW);
|
|
|
|
gwin->shared->node->objstruct = gwin->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);
|
2008-08-02 18:31:32 +04:00
|
|
|
return gwin;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs((APTR)gwin->gadgets[GID_HSCROLL],
|
|
|
|
gwin->win, NULL,
|
|
|
|
// GA_Left, size1,
|
|
|
|
GA_RelRight, - size2 - sz,
|
|
|
|
GA_Width, size2,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
RefreshSetGadgetAttrs((APTR)gwin->gadgets[GID_STATUS],
|
|
|
|
gwin->win, NULL,
|
|
|
|
GA_Width, size1,
|
|
|
|
TAG_DONE);
|
2009-08-29 14:16:19 +04:00
|
|
|
|
2009-09-16 02:49:33 +04:00
|
|
|
RefreshGList(gwin->gadgets[GID_STATUS], gwin->win, NULL, 2);
|
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;
|
|
|
|
|
|
|
|
gad1percent = option_toolbar_status_width / 10000.0;
|
|
|
|
|
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;
|
|
|
|
ULONG ptabnum;
|
|
|
|
|
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);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
if(g->shared->tabs > 1)
|
|
|
|
{
|
2008-10-05 17:17:18 +04:00
|
|
|
SetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL,
|
|
|
|
CLICKTAB_Labels,~0,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2008-10-06 01:20:12 +04:00
|
|
|
ptab = GetSucc(g->tab_node);
|
|
|
|
if(!ptab) ptab = GetPred(g->tab_node);
|
2008-10-05 17:17:18 +04:00
|
|
|
|
|
|
|
GetClickTabNodeAttrs(ptab,TNA_Number,(ULONG *)&ptabnum,TAG_DONE);
|
|
|
|
Remove(g->tab_node);
|
|
|
|
FreeClickTabNode(g->tab_node);
|
|
|
|
RefreshSetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL,
|
|
|
|
CLICKTAB_Labels,&g->shared->tab_list,
|
|
|
|
CLICKTAB_Current,ptabnum,
|
|
|
|
TAG_DONE);
|
2009-09-01 02:10:05 +04:00
|
|
|
|
|
|
|
if(ClickTabBase->lib_Version < 53)
|
|
|
|
RethinkLayout(g->shared->gadgets[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);
|
|
|
|
FreeVec(g);
|
2008-10-05 03:29:17 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-26 02:22:34 +03:00
|
|
|
curbw = NULL;
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
DisposeObject(g->shared->objects[OID_MAIN]);
|
2009-07-23 15:23:34 +04:00
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
if(g->tab_node)
|
|
|
|
{
|
2009-09-18 01:44:07 +04:00
|
|
|
node = g->tab_node;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
SetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL,
|
|
|
|
CLICKTAB_Labels,~0,
|
|
|
|
TAG_DONE);
|
2009-09-01 02:10:05 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
SetClickTabNodeAttrs(node, TNA_Text, utf8title, TAG_DONE);
|
|
|
|
RefreshSetGadgetAttrs(g->shared->gadgets[GID_TABS], g->shared->win, NULL,
|
|
|
|
CLICKTAB_Labels, &g->shared->tab_list,
|
2009-09-16 02:49:33 +04:00
|
|
|
TAG_DONE);
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
if(ClickTabBase->lib_Version < 53)
|
|
|
|
RethinkLayout(g->shared->gadgets[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
|
|
|
|
}
|
2008-10-05 03:29:17 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
2009-09-16 02:49:33 +04:00
|
|
|
|
2009-09-18 01:44:07 +04:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
|
|
|
if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle)))
|
|
|
|
{
|
|
|
|
if(g->shared->wintitle) ami_utf8_free(g->shared->wintitle);
|
|
|
|
g->shared->wintitle = utf8title;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
/**
|
|
|
|
* Redraw an area of the browser window - Amiga-specific function
|
|
|
|
*
|
|
|
|
* \param g a struct gui_window
|
|
|
|
* \param c a struct content
|
|
|
|
* \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)
|
|
|
|
* \param sx horizontal scroller position
|
|
|
|
* \param sy vertical scroller position
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ami_do_redraw_limits(struct gui_window *g, struct content *c,int x0, int y0, int x1, int y1, ULONG sx, ULONG sy)
|
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;
|
|
|
|
|
|
|
|
if(!g) return;
|
|
|
|
|
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
|
|
|
|
if(!((cur_tab == g->tab) || (g->shared->tabs == 0)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
|
|
|
|
|
|
|
if(!c) return;
|
|
|
|
if (c->locked) return;
|
|
|
|
|
|
|
|
current_redraw_browser = g->shared->bw;
|
|
|
|
|
2009-08-31 16:05:35 +04:00
|
|
|
width=bbox->Width / g->shared->bw->scale;
|
|
|
|
height=bbox->Height / g->shared->bw->scale;
|
2009-02-02 00:28:59 +03:00
|
|
|
xoffset=bbox->Left;
|
|
|
|
yoffset=bbox->Top;
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2009-08-31 16:05:35 +04:00
|
|
|
/* x0 *= g->shared->bw->scale;
|
|
|
|
x1 *= g->shared->bw->scale;
|
|
|
|
y0 *= g->shared->bw->scale;
|
|
|
|
y1 *= g->shared->bw->scale;
|
|
|
|
|
|
|
|
sx *= g->shared->bw->scale;
|
|
|
|
sy *= g->shared->bw->scale;
|
|
|
|
*/
|
2009-02-01 02:45:25 +03:00
|
|
|
plot=amiplot;
|
2009-08-29 18:00:57 +04:00
|
|
|
glob = &browserglob;
|
2009-03-28 23:36:07 +03:00
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
if((y1<sy) || (y0>sy+height)) return;
|
|
|
|
if((x1<sx) || (x0>sx+width)) return;
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
if((x0-(int)sx)<0) x0 = sx;
|
|
|
|
if((y0-(int)sy)<0) y0 = sy;
|
2009-02-07 19:40:56 +03:00
|
|
|
|
2009-06-03 23:44:43 +04:00
|
|
|
if((x1-x0)+(xoffset+x0-sx)>(width)) x1 = (width-(x0-sx)+x0);
|
|
|
|
if((y1-y0)+(yoffset+y0-sy)>(height)) y1 = (height-(y0-sy)+y0);
|
2009-02-04 21:10:10 +03:00
|
|
|
|
2009-08-29 18:24:47 +04:00
|
|
|
glob->scale = g->shared->bw->scale;
|
|
|
|
|
|
|
|
content_redraw(c,
|
2009-08-31 16:05:35 +04:00
|
|
|
-sx, -sy,
|
|
|
|
width - sx,
|
|
|
|
height - sy,
|
|
|
|
(x0 - sx) * g->shared->bw->scale,
|
|
|
|
(y0 - sy) * g->shared->bw->scale,
|
|
|
|
(x1 - sx) * g->shared->bw->scale,
|
|
|
|
(y1 - sy) * g->shared->bw->scale,
|
2009-02-01 02:45:25 +03:00
|
|
|
g->shared->bw->scale,
|
|
|
|
0xFFFFFF);
|
|
|
|
|
|
|
|
current_redraw_browser = NULL;
|
|
|
|
|
2009-08-23 19:59:41 +04:00
|
|
|
ami_clearclipreg(&browserglob);
|
2009-03-07 23:52:50 +03:00
|
|
|
|
2009-08-31 16:05:35 +04:00
|
|
|
BltBitMapRastPort(browserglob.bm,
|
|
|
|
(x0 - sx) * g->shared->bw->scale,
|
|
|
|
(y0 - sy) * g->shared->bw->scale,
|
|
|
|
g->shared->win->RPort,
|
|
|
|
xoffset + ((x0 - sx) * g->shared->bw->scale),
|
|
|
|
yoffset + ((y0 - sy) * g->shared->bw->scale),
|
|
|
|
(x1 - x0) * g->shared->bw->scale,
|
|
|
|
(y1 - y0) * g->shared->bw->scale,
|
|
|
|
0x0C0);
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
2009-02-02 01:54:31 +03:00
|
|
|
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
|
|
|
|
{
|
2009-06-03 23:44:43 +04:00
|
|
|
ULONG sx,sy;
|
2009-02-02 01:54:31 +03:00
|
|
|
struct content *c;
|
|
|
|
c = g->shared->bw->current_content;
|
|
|
|
|
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);
|
2009-06-03 23:44:43 +04:00
|
|
|
|
|
|
|
ami_do_redraw_limits(g,c,x0,y0,x1,y1,sx,sy);
|
2009-02-02 01:54:31 +03:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2008-10-05 18:22:02 +04:00
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
|
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
g->shared->redraw_required = true;
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_update_box(struct gui_window *g,
|
|
|
|
const union content_msg_data *data)
|
|
|
|
{
|
2009-06-03 23:44:43 +04:00
|
|
|
ULONG sx,sy;
|
|
|
|
|
2009-08-18 17:06:28 +04:00
|
|
|
if(!g) return;
|
|
|
|
|
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);
|
2009-06-03 23:44:43 +04:00
|
|
|
|
2009-02-08 13:12:27 +03:00
|
|
|
ami_do_redraw_limits(g,g->shared->bw->current_content,
|
2009-02-02 01:54:31 +03:00
|
|
|
data->redraw.x,data->redraw.y,
|
|
|
|
data->redraw.width+data->redraw.x,
|
2009-06-03 23:44:43 +04:00
|
|
|
data->redraw.height+data->redraw.y,
|
|
|
|
sx,sy);
|
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;
|
2008-08-07 22:44:28 +04:00
|
|
|
struct content *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;
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
GetAttr(SPACE_AreaBox,g->gadgets[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
|
|
|
|
|
|
|
c = g->bw->current_content;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
|
|
|
if(!c) return;
|
2008-08-18 23:07:12 +04:00
|
|
|
if (c->locked) return;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2008-08-07 22:44:28 +04:00
|
|
|
current_redraw_browser = g->bw;
|
2009-07-07 23:28:34 +04:00
|
|
|
// currp = &browserglob.rp;
|
2008-08-30 20:57:35 +04:00
|
|
|
|
2008-08-11 21:53:45 +04:00
|
|
|
width=bbox->Width;
|
|
|
|
height=bbox->Height;
|
|
|
|
xoffset=bbox->Left;
|
|
|
|
yoffset=bbox->Top;
|
2008-08-26 05:20:01 +04:00
|
|
|
plot = amiplot;
|
2009-08-29 18:00:57 +04:00
|
|
|
glob = &browserglob;
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-03-14 19:18:09 +03:00
|
|
|
if(g->bw->reformat_pending)
|
|
|
|
{
|
|
|
|
browser_window_reformat(g->bw,width,height);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2008-08-10 00:27:36 +04:00
|
|
|
// if (c->type == CONTENT_HTML) scale = 1;
|
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
if(g->redraw_scroll && c->type == CONTENT_HTML)
|
2009-01-11 00:31:21 +03:00
|
|
|
{
|
2009-06-03 23:44:43 +04:00
|
|
|
ScrollWindowRaster(g->win,hcurrent-oldh,vcurrent-oldv,
|
|
|
|
xoffset,yoffset,xoffset+width,yoffset+height);
|
2009-02-02 00:28:59 +03:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
if(vcurrent>oldv)
|
2009-02-05 15:20:23 +03:00
|
|
|
{
|
2009-08-31 16:12:00 +04:00
|
|
|
ami_do_redraw_limits(g->bw->window, c,
|
|
|
|
hcurrent, (height / g->bw->scale) + oldv,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
2009-09-01 01:48:57 +04:00
|
|
|
vcurrent + (height / g->bw->scale),
|
2009-08-31 16:12:00 +04:00
|
|
|
hcurrent, vcurrent);
|
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
|
|
|
{
|
2009-08-31 16:12:00 +04:00
|
|
|
ami_do_redraw_limits(g->bw->window, c,
|
|
|
|
hcurrent, vcurrent,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
|
|
|
oldv, hcurrent, vcurrent);
|
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
|
|
|
{
|
2009-08-31 16:12:00 +04:00
|
|
|
ami_do_redraw_limits(g->bw->window, c,
|
|
|
|
(width / g->bw->scale) + oldh, vcurrent,
|
|
|
|
hcurrent + (width / g->bw->scale),
|
|
|
|
vcurrent + (height / g->bw->scale),
|
|
|
|
hcurrent, vcurrent);
|
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
|
|
|
{
|
2009-08-31 16:12:00 +04:00
|
|
|
ami_do_redraw_limits(g->bw->window, c,
|
|
|
|
hcurrent, vcurrent,
|
|
|
|
oldh, vcurrent+(height / g->bw->scale),
|
|
|
|
hcurrent, vcurrent);
|
2009-02-05 15:20:23 +03:00
|
|
|
}
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-02 01:54:31 +03:00
|
|
|
ami_clg(0xffffff);
|
2009-08-29 18:24:47 +04:00
|
|
|
glob->scale = g->bw->scale;
|
2009-02-01 02:45:25 +03:00
|
|
|
|
2009-02-04 21:10:10 +03:00
|
|
|
if(c->type == CONTENT_HTML)
|
|
|
|
{
|
2009-08-31 01:43:14 +04:00
|
|
|
content_redraw(c, -hcurrent,
|
|
|
|
-vcurrent,
|
|
|
|
(width / g->bw->scale) - hcurrent,
|
|
|
|
(height / g->bw->scale) - vcurrent,
|
|
|
|
0,0,width,
|
|
|
|
height,
|
2009-02-04 21:10:10 +03:00
|
|
|
g->bw->scale,0xFFFFFF);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
content_redraw(c, -hcurrent /* * g->bw->scale */,
|
|
|
|
-vcurrent /* * g->bw->scale */,
|
2009-08-31 01:43:14 +04:00
|
|
|
(width / g->bw->scale) - hcurrent,
|
|
|
|
(height / g->bw->scale) - vcurrent,
|
2009-01-15 23:03:15 +03:00
|
|
|
0,0,c->width /* * g->bw->scale */,
|
|
|
|
c->height /* * g->bw->scale */,
|
|
|
|
g->bw->scale,0xFFFFFF);
|
2009-02-04 21:10:10 +03:00
|
|
|
}
|
2009-02-02 01:54:31 +03:00
|
|
|
|
2009-08-23 19:59:41 +04:00
|
|
|
ami_clearclipreg(&browserglob);
|
2009-07-09 22:52:55 +04:00
|
|
|
BltBitMapRastPort(browserglob.bm,0,0,g->win->RPort,bbox->Left,bbox->Top,
|
2009-05-30 02:30:15 +04:00
|
|
|
bbox->Width,bbox->Height,0x0C0);
|
2009-01-15 23:03:15 +03:00
|
|
|
}
|
2008-08-10 00:27:36 +04:00
|
|
|
|
2009-01-15 23:03:15 +03:00
|
|
|
current_redraw_browser = NULL;
|
2008-08-15 21:19:57 +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
|
|
|
}
|
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
|
|
|
|
{
|
|
|
|
if(gwin->gadgets[GID_HSCROLL])
|
|
|
|
{
|
|
|
|
GetAttr(PGA_Top, gwin->gadgets[GID_HSCROLL], xs);
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
2008-10-06 01:20:12 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2008-10-06 21:47:31 +04:00
|
|
|
if(sx<0) sx=0;
|
|
|
|
if(sy<0) sy=0;
|
2009-01-25 03:36:30 +03:00
|
|
|
if(!g->shared->bw || !g->shared->bw->current_content) return;
|
2008-12-14 02:25:42 +03:00
|
|
|
if(sx > g->shared->bw->current_content->width) sx = g->shared->bw->current_content->width;
|
|
|
|
if(sy > g->shared->bw->current_content->height) sy = g->shared->bw->current_content->height;
|
2008-10-06 21:47:31 +04:00
|
|
|
|
2008-10-06 01:20:12 +04:00
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
2008-08-31 01:32:05 +04:00
|
|
|
|
2008-10-06 01:20:12 +04:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
2009-08-31 01:43:14 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],
|
|
|
|
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
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
if(g->shared->gadgets[GID_HSCROLL])
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
|
|
|
|
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])
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
|
|
|
|
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
|
|
|
|
2009-06-19 22:32:31 +04:00
|
|
|
if(option_faster_scroll) 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_position_frame(struct gui_window *g, int x0, int y0,
|
|
|
|
int x1, int y1)
|
|
|
|
{
|
2008-08-31 01:32:05 +04:00
|
|
|
if(!g) return;
|
2008-11-15 18:28:17 +03:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
ChangeWindowBox(g->shared->win,x0,y0,x1-x0,y1-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
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[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
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
|
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2008-10-19 15:33:05 +04:00
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
|
2009-08-31 01:43:14 +04:00
|
|
|
SCROLLER_Total, (ULONG)(g->shared->bw->current_content->height * g->shared->bw->scale),
|
|
|
|
SCROLLER_Visible, bbox->Height,
|
2008-10-19 15:33:05 +04:00
|
|
|
TAG_DONE);
|
2008-08-09 19:19:04 +04:00
|
|
|
|
2009-08-29 03:12:18 +04:00
|
|
|
if(g->shared->gadgets[GID_HSCROLL])
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
|
|
|
|
g->shared->win, NULL,
|
2009-08-31 01:43:14 +04:00
|
|
|
PGA_Total, (ULONG)(g->shared->bw->current_content->width * 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])
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
|
|
|
|
g->shared->win, NULL,
|
2009-08-31 01:43:14 +04:00
|
|
|
SCROLLER_Total, (ULONG)(g->shared->bw->current_content->width * 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;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
|
|
|
if(!g) return;
|
2009-08-14 21:53:28 +04:00
|
|
|
if(!text) return;
|
2009-09-04 22:10:15 +04:00
|
|
|
if(!g->shared->gadgets[GID_STATUS]) return;
|
2008-10-19 15:33:05 +04:00
|
|
|
|
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
|
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
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
|
|
|
|
|
|
|
if((g->shared->status == NULL) || (strcmp(utf8text,g->shared->status)))
|
|
|
|
{
|
2009-08-30 14:22:26 +04:00
|
|
|
SetGadgetAttrs(g->shared->gadgets[GID_STATUS],
|
2009-08-29 03:12:18 +04:00
|
|
|
g->shared->win, NULL,
|
2009-08-29 14:16:19 +04:00
|
|
|
GA_Text, utf8text,
|
2009-08-29 03:12:18 +04:00
|
|
|
TAG_DONE);
|
|
|
|
|
2009-09-16 02:49:33 +04:00
|
|
|
RefreshGList(g->shared->gadgets[GID_STATUS],g->shared->win,NULL,1);
|
2009-08-29 14:16:19 +04: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_pointer(struct gui_window *g, gui_pointer_shape shape)
|
2008-10-05 03:29:17 +04:00
|
|
|
{
|
|
|
|
ami_update_pointer(g->shared->win,shape);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
|
2008-08-02 18:31:32 +04:00
|
|
|
{
|
2008-09-23 00:41:01 +04:00
|
|
|
if(mouseptrcurrent == shape) return;
|
2009-03-25 22:59:10 +03:00
|
|
|
if(drag_save) return;
|
2008-09-23 00:41:01 +04:00
|
|
|
|
|
|
|
if(option_use_os_pointers)
|
2008-08-07 22:44:28 +04:00
|
|
|
{
|
2008-09-23 00:41:01 +04:00
|
|
|
switch(shape)
|
|
|
|
{
|
|
|
|
case GUI_POINTER_DEFAULT:
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,TAG_DONE);
|
2008-09-23 00:41:01 +04:00
|
|
|
break;
|
2008-08-31 21:34:00 +04:00
|
|
|
|
2008-09-23 00:41:01 +04:00
|
|
|
case GUI_POINTER_WAIT:
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,
|
2008-09-23 00:41:01 +04:00
|
|
|
WA_BusyPointer,TRUE,
|
|
|
|
WA_PointerDelay,TRUE,
|
|
|
|
TAG_DONE);
|
|
|
|
break;
|
2008-08-07 22:44:28 +04:00
|
|
|
|
2008-09-23 00:41:01 +04:00
|
|
|
default:
|
|
|
|
if(mouseptrobj[shape])
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,WA_Pointer,mouseptrobj[shape],TAG_DONE);
|
2008-09-23 00:41:01 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,TAG_DONE);
|
2008-09-23 00:41:01 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(mouseptrobj[shape])
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,WA_Pointer,mouseptrobj[shape],TAG_DONE);
|
2008-09-23 00:41:01 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-24 01:41:52 +04:00
|
|
|
if(shape == GUI_POINTER_WAIT)
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,
|
2008-09-24 01:41:52 +04:00
|
|
|
WA_BusyPointer,TRUE,
|
|
|
|
WA_PointerDelay,TRUE,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
SetWindowPointer(win,TAG_DONE);
|
2008-09-24 01:41:52 +04:00
|
|
|
}
|
2008-09-23 00:41:01 +04:00
|
|
|
}
|
2008-08-07 22:44:28 +04:00
|
|
|
}
|
2008-08-31 21:34:00 +04:00
|
|
|
|
2008-09-23 00:41:01 +04:00
|
|
|
mouseptrcurrent = shape;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_hide_pointer(struct gui_window *g)
|
|
|
|
{
|
2009-03-25 22:59:10 +03:00
|
|
|
if(mouseptrcurrent != AMI_GUI_POINTER_BLANK)
|
2008-09-23 00:41:01 +04:00
|
|
|
{
|
2009-03-25 22:59:10 +03:00
|
|
|
SetWindowPointer(g->shared->win,WA_Pointer,mouseptrobj[AMI_GUI_POINTER_BLANK],TAG_DONE);
|
|
|
|
mouseptrcurrent = AMI_GUI_POINTER_BLANK;
|
2008-09-23 00:41:01 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_init_mouse_pointers(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct RastPort mouseptr;
|
|
|
|
struct DiskObject *dobj;
|
|
|
|
uint32 format = IDFMT_BITMAPPED;
|
|
|
|
int32 mousexpt=0,mouseypt=0;
|
|
|
|
|
|
|
|
InitRastPort(&mouseptr);
|
|
|
|
|
|
|
|
for(i=0;i<=AMI_LASTPOINTER;i++)
|
|
|
|
{
|
|
|
|
BPTR ptrfile = 0;
|
|
|
|
mouseptrbm[i] = NULL;
|
|
|
|
mouseptrobj[i] = NULL;
|
2008-12-14 02:25:42 +03:00
|
|
|
char ptrfname[1024];
|
2008-09-23 00:41:01 +04:00
|
|
|
|
|
|
|
if(option_truecolour_mouse_pointers)
|
|
|
|
{
|
2009-06-30 11:02:52 +04:00
|
|
|
ami_get_theme_filename(&ptrfname,ptrs32[i]);
|
2008-12-14 02:25:42 +03:00
|
|
|
if(dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE))
|
2008-09-23 00:41:01 +04:00
|
|
|
{
|
|
|
|
if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE))
|
|
|
|
{
|
|
|
|
if(IDFMT_DIRECTMAPPED == format)
|
|
|
|
{
|
|
|
|
int32 width = 0, height = 0;
|
|
|
|
uint8* data = 0;
|
|
|
|
IconControl(dobj,
|
|
|
|
ICONCTRLA_GetWidth, &width,
|
|
|
|
ICONCTRLA_GetHeight, &height,
|
|
|
|
ICONCTRLA_GetImageData1, &data,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
if (width > 0 && width <= 64 && height > 0 && height <= 64 && data)
|
|
|
|
{
|
|
|
|
STRPTR tooltype;
|
|
|
|
|
|
|
|
if(tooltype = FindToolType(dobj->do_ToolTypes, "XOFFSET"))
|
|
|
|
mousexpt = atoi(tooltype);
|
|
|
|
|
|
|
|
if(tooltype = FindToolType(dobj->do_ToolTypes, "YOFFSET"))
|
|
|
|
mouseypt = atoi(tooltype);
|
|
|
|
|
|
|
|
if (mousexpt < 0 || mousexpt >= width)
|
|
|
|
mousexpt = 0;
|
|
|
|
if (mouseypt < 0 || mouseypt >= height)
|
|
|
|
mouseypt = 0;
|
|
|
|
|
|
|
|
static uint8 dummyPlane[64 * 64 / 8];
|
|
|
|
static struct BitMap dummyBitMap = { 64 / 8, 64, 0, 2, 0, { dummyPlane, dummyPlane, 0, 0, 0, 0, 0, 0 }, };
|
|
|
|
|
2009-06-30 11:02:52 +04:00
|
|
|
mouseptrobj[i] = NewObject(NULL, "pointerclass",
|
2008-09-23 00:41:01 +04:00
|
|
|
POINTERA_BitMap, &dummyBitMap,
|
|
|
|
POINTERA_XOffset, -mousexpt,
|
|
|
|
POINTERA_YOffset, -mouseypt,
|
|
|
|
POINTERA_WordWidth, (width + 15) / 16,
|
|
|
|
POINTERA_XResolution, POINTERXRESN_SCREENRES,
|
|
|
|
POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT,
|
2008-12-20 13:54:59 +03:00
|
|
|
POINTERA_ImageData, data,
|
|
|
|
POINTERA_Width, width,
|
|
|
|
POINTERA_Height, height,
|
2008-09-23 00:41:01 +04:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!mouseptrobj[i])
|
|
|
|
{
|
2009-03-15 14:21:46 +03:00
|
|
|
ami_get_theme_filename(ptrfname,ptrs[i]);
|
2008-12-14 02:25:42 +03:00
|
|
|
if(ptrfile = Open(ptrfname,MODE_OLDFILE))
|
2008-09-23 00:41:01 +04:00
|
|
|
{
|
|
|
|
int mx,my;
|
2008-11-02 03:21:49 +03:00
|
|
|
UBYTE *pprefsbuf = AllocVec(1061,MEMF_PRIVATE | MEMF_CLEAR);
|
2008-09-23 00:41:01 +04:00
|
|
|
Read(ptrfile,pprefsbuf,1061);
|
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
mouseptrbm[i]=AllocVec(sizeof(struct BitMap),MEMF_PRIVATE | MEMF_CLEAR);
|
2008-09-23 00:41:01 +04:00
|
|
|
InitBitMap(mouseptrbm[i],2,32,32);
|
|
|
|
mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
|
|
|
|
mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
|
|
|
|
mouseptr.BitMap = mouseptrbm[i];
|
|
|
|
|
|
|
|
for(my=0;my<32;my++)
|
|
|
|
{
|
|
|
|
for(mx=0;mx<32;mx++)
|
|
|
|
{
|
|
|
|
SetAPen(&mouseptr,pprefsbuf[(my*(33))+mx]-'0');
|
|
|
|
WritePixel(&mouseptr,mx,my);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mousexpt = ((pprefsbuf[1056]-'0')*10)+(pprefsbuf[1057]-'0');
|
|
|
|
mouseypt = ((pprefsbuf[1059]-'0')*10)+(pprefsbuf[1060]-'0');
|
|
|
|
|
|
|
|
mouseptrobj[i] = NewObject(NULL,"pointerclass",
|
|
|
|
POINTERA_BitMap,mouseptrbm[i],
|
|
|
|
POINTERA_WordWidth,2,
|
|
|
|
POINTERA_XOffset,-mousexpt,
|
|
|
|
POINTERA_YOffset,-mouseypt,
|
|
|
|
POINTERA_XResolution,POINTERXRESN_SCREENRES,
|
|
|
|
POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
FreeVec(pprefsbuf);
|
|
|
|
Close(ptrfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} // for
|
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
|
|
|
|
2008-10-05 17:17:18 +04:00
|
|
|
if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
|
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
|
|
|
RefreshSetGadgetAttrs(g->shared->gadgets[GID_URL],g->shared->win,NULL,STRINGA_TextVal,url,TAG_DONE);
|
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_start_throbber(struct gui_window *g)
|
|
|
|
{
|
2008-09-14 02:39:48 +04:00
|
|
|
struct IBox *bbox;
|
2009-09-06 14:48:14 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
|
|
|
if(!g) return;
|
|
|
|
|
2009-09-06 15:23:35 +04:00
|
|
|
if(g->tab_node)
|
|
|
|
{
|
|
|
|
GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
|
|
|
|
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, TRUE, TAG_DONE);
|
|
|
|
RefreshGadgets((APTR)g->shared->gadgets[GID_TABS],
|
|
|
|
g->shared->win, NULL);
|
|
|
|
}
|
2009-09-06 14:48:14 +04:00
|
|
|
|
|
|
|
g->throbbing = true;
|
|
|
|
|
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_THROBBER],(ULONG *)&bbox);
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
if(g->shared->throbber_frame == 0) g->shared->throbber_frame=1;
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
BltBitMapRastPort(throbber,throbber_width,0,g->shared->win->RPort,bbox->Left,bbox->Top,throbber_width,throbber_height,0x0C0);
|
|
|
|
}
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_stop_throbber(struct gui_window *g)
|
|
|
|
{
|
2008-09-14 02:39:48 +04:00
|
|
|
struct IBox *bbox;
|
2009-09-06 14:48:14 +04:00
|
|
|
ULONG cur_tab = 0;
|
|
|
|
|
|
|
|
if(!g) return;
|
|
|
|
|
2009-09-06 15:23:35 +04:00
|
|
|
if(g->tab_node)
|
|
|
|
{
|
|
|
|
GetAttr(CLICKTAB_Current, g->shared->gadgets[GID_TABS],
|
|
|
|
(ULONG *)&cur_tab);
|
|
|
|
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, FALSE, TAG_DONE);
|
|
|
|
RefreshGadgets((APTR)g->shared->gadgets[GID_TABS],
|
|
|
|
g->shared->win, NULL);
|
|
|
|
}
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
g->throbbing = false;
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
if((cur_tab == g->tab) || (g->shared->tabs == 0))
|
|
|
|
{
|
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_THROBBER],(ULONG *)&bbox);
|
|
|
|
|
|
|
|
BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort, bbox->Left,
|
|
|
|
bbox->Top, throbber_width, throbber_height, 0x0C0);
|
|
|
|
}
|
|
|
|
// g->shared->throbber_frame = 0;
|
2008-09-14 02:39:48 +04:00
|
|
|
}
|
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
void ami_update_throbber(struct gui_window_2 *g,bool redraw)
|
2008-09-14 02:39:48 +04:00
|
|
|
{
|
|
|
|
struct IBox *bbox;
|
2009-09-06 14:48:14 +04:00
|
|
|
int frame = g->throbber_frame;
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
if(!g) return;
|
2008-10-05 18:22:02 +04:00
|
|
|
if(!g->gadgets[GID_THROBBER]) return;
|
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
if(g->bw->window->throbbing == false)
|
2008-09-14 02:39:48 +04:00
|
|
|
{
|
2009-09-06 14:48:14 +04:00
|
|
|
frame = 0;
|
|
|
|
g->throbber_frame=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!redraw)
|
2008-11-02 03:21:49 +03:00
|
|
|
{
|
2009-09-06 14:48:14 +04:00
|
|
|
if(g->throbber_update_count < throbber_update_interval)
|
|
|
|
{
|
|
|
|
g->throbber_update_count++;
|
|
|
|
return;
|
|
|
|
}
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
g->throbber_update_count = 0;
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
g->throbber_frame++;
|
|
|
|
if(g->throbber_frame > (throbber_frames-1))
|
|
|
|
g->throbber_frame=1;
|
2008-11-02 03:21:49 +03:00
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
}
|
2008-11-02 03:21:49 +03:00
|
|
|
}
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2008-11-02 03:21:49 +03:00
|
|
|
GetAttr(SPACE_AreaBox,g->gadgets[GID_THROBBER],(ULONG *)&bbox);
|
2008-09-14 02:39:48 +04:00
|
|
|
|
2009-06-15 22:41:14 +04:00
|
|
|
/*
|
|
|
|
EraseRect(g->win->RPort,bbox->Left,bbox->Top,
|
|
|
|
bbox->Left+throbber_width,bbox->Top+throbber_height);
|
|
|
|
*/
|
|
|
|
|
2009-09-06 14:48:14 +04:00
|
|
|
BltBitMapTags(BLITA_SrcX, throbber_width * frame,
|
2009-06-15 22:41:14 +04:00
|
|
|
BLITA_SrcY,0,
|
|
|
|
BLITA_DestX,bbox->Left,
|
|
|
|
BLITA_DestY,bbox->Top,
|
|
|
|
BLITA_Width,throbber_width,
|
|
|
|
BLITA_Height,throbber_height,
|
|
|
|
BLITA_Source,throbber,
|
|
|
|
BLITA_Dest,g->win->RPort,
|
|
|
|
BLITA_SrcType,BLITT_BITMAP,
|
|
|
|
BLITA_DestType,BLITT_RASTPORT,
|
|
|
|
// BLITA_UseSrcAlpha,TRUE,
|
|
|
|
TAG_DONE);
|
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);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
|
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
|
|
|
|
2009-04-29 21:05:40 +04:00
|
|
|
SetDrMd(g->shared->win->RPort,COMPLEMENT);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
RectFill(g->shared->win->RPort,x+bbox->Left-xs,y+bbox->Top-ys,x+bbox->Left+2-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;
|
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;
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
2009-08-29 03:12:18 +04:00
|
|
|
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
|
2009-08-31 01:43:14 +04:00
|
|
|
ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
|
2008-08-22 01:41:42 +04:00
|
|
|
|
2009-07-07 23:28:34 +04:00
|
|
|
BltBitMapRastPort(browserglob.bm,g->c_x-xs,g->c_y-ys,g->shared->win->RPort,bbox->Left+g->c_x-xs,bbox->Top+g->c_y-ys,2+1,g->c_h+1,0x0C0);
|
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)
|
|
|
|
{
|
2009-05-23 23:06:58 +04:00
|
|
|
struct content *c;
|
|
|
|
|
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-05-24 17:13:27 +04:00
|
|
|
|
2009-09-04 22:10:15 +04:00
|
|
|
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL ||
|
|
|
|
option_kiosk_mode == true) return;
|
2009-05-24 17:13:27 +04:00
|
|
|
|
2009-05-17 14:40:42 +04:00
|
|
|
if(c->type <= CONTENT_CSS)
|
|
|
|
{
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_SAVEAS_TEXT);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_SAVEAS_COMPLETE);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_SAVEAS_PDF);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_COPY);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_PASTE);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_SELECTALL);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_CLEAR);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_FIND);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SAVEAS_IFF);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SAVEAS_TEXT);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SAVEAS_COMPLETE);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SAVEAS_PDF);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_PASTE);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SELECTALL);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_CLEAR);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_FIND);
|
|
|
|
|
2009-05-19 11:23:56 +04:00
|
|
|
#ifdef WITH_NS_SVG
|
|
|
|
if(c->bitmap || c->type == CONTENT_SVG)
|
|
|
|
#else
|
2009-05-17 14:40:42 +04:00
|
|
|
if(c->bitmap)
|
2009-05-19 11:23:56 +04:00
|
|
|
#endif
|
2009-05-17 14:40:42 +04:00
|
|
|
{
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_COPY);
|
|
|
|
OnMenu(g->shared->win,AMI_MENU_SAVEAS_IFF);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_COPY);
|
|
|
|
OffMenu(g->shared->win,AMI_MENU_SAVEAS_IFF);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
bool gui_window_box_scroll_start(struct gui_window *g,
|
|
|
|
int x0, int y0, int x1, int y1)
|
|
|
|
{
|
2008-08-30 20:57:35 +04:00
|
|
|
DebugPrintF("box scroll start\n");
|
2009-06-19 22:32:31 +04:00
|
|
|
return true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool gui_window_frame_resize_start(struct gui_window *g)
|
|
|
|
{
|
2009-06-19 22:32:31 +04:00
|
|
|
DebugPrintF("resize frame\n");
|
|
|
|
return true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_window_set_scale(struct gui_window *g, float scale)
|
|
|
|
{
|
2009-08-31 01:43:14 +04:00
|
|
|
browserglob.scale = scale;
|
|
|
|
g->shared->new_content = true;
|
|
|
|
g->shared->redraw_required = true;
|
2008-08-02 18:31:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_create_form_select_menu(struct browser_window *bw,
|
|
|
|
struct form_control *control)
|
|
|
|
{
|
2008-08-18 23:07:12 +04:00
|
|
|
struct gui_window *gwin = bw->window;
|
2008-08-19 22:31:56 +04:00
|
|
|
struct form_option *opt = control->data.select.items;
|
|
|
|
ULONG i = 0;
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-10-21 22:04:27 +04:00
|
|
|
if(gwin->shared->objects[OID_MENU]) DisposeObject(gwin->shared->objects[OID_MENU]);
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
gwin->shared->popuphook.h_Entry = ami_popup_hook;
|
|
|
|
gwin->shared->popuphook.h_Data = gwin;
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
gwin->shared->control = control;
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-10-21 22:04:27 +04:00
|
|
|
gwin->shared->objects[OID_MENU] = PMMENU(ami_utf8_easy(control->name)),
|
2008-10-05 03:29:17 +04:00
|
|
|
PMA_MenuHandler, &gwin->shared->popuphook,End;
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-08-19 22:31:56 +04:00
|
|
|
while(opt)
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
IDoMethod(gwin->shared->objects[OID_MENU],PM_INSERT,NewObject( POPUPMENU_GetItemClass(), NULL, PMIA_Title, (ULONG)ami_utf8_easy(opt->text),PMIA_ID,i,PMIA_CheckIt,TRUE,PMIA_Checked,opt->selected,TAG_DONE),~0);
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-08-19 22:31:56 +04:00
|
|
|
opt = opt->next;
|
|
|
|
i++;
|
|
|
|
}
|
2008-08-18 23:07:12 +04:00
|
|
|
|
2008-09-01 22:03:40 +04:00
|
|
|
gui_window_set_pointer(gwin,GUI_POINTER_DEFAULT); // Clear the menu-style pointer
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
IDoMethod(gwin->shared->objects[OID_MENU],PM_OPEN,gwin->shared->win);
|
2008-08-18 23:07:12 +04:00
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
ULONG gid,x,y;
|
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;
|
|
|
|
|
|
|
|
gui_window_get_scroll(gwin->bw->window,
|
|
|
|
&gwin->bw->window->scrollx,&gwin->bw->window->scrolly);
|
|
|
|
|
|
|
|
switch(msg->Class)
|
|
|
|
{
|
|
|
|
case IDCMP_IDCMPUPDATE:
|
|
|
|
gid = GetTagData( GA_ID, 0, msg->IAddress );
|
|
|
|
|
|
|
|
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:
|
2009-04-06 21:25:21 +04:00
|
|
|
// history_set_current_scroll(gwin->bw->history,
|
|
|
|
// gwin->bw->window->scrollx,gwin->bw->window->scrolly);
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2009-05-31 19:05:26 +04:00
|
|
|
if(option_faster_scroll)
|
|
|
|
gwin->redraw_scroll = true;
|
|
|
|
gwin->redraw_required = true;
|
2009-03-29 03:51:39 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDCMP_EXTENDEDMOUSE:
|
|
|
|
if(msg->Code == IMSGCODE_INTUIWHEELDATA)
|
|
|
|
{
|
|
|
|
wheel = (struct IntuiWheelData *)msg->IAddress;
|
|
|
|
|
|
|
|
gui_window_set_scroll(gwin->bw->window,
|
2009-08-31 14:16:23 +04:00
|
|
|
gwin->bw->window->scrollx + (wheel->WheelX * 50),
|
|
|
|
gwin->bw->window->scrolly + (wheel->WheelY * 50));
|
2009-03-29 03:51:39 +04:00
|
|
|
}
|
|
|
|
break;
|
2009-08-01 17:16:16 +04:00
|
|
|
|
|
|
|
case IDCMP_SIZEVERIFY:
|
|
|
|
break;
|
2008-08-15 21:19:57 +04:00
|
|
|
}
|
|
|
|
// ReplyMsg((struct Message *)msg);
|
2008-08-11 21:53:45 +04:00
|
|
|
}
|
|
|
|
|
2008-08-18 23:07:12 +04:00
|
|
|
uint32 ami_popup_hook(struct Hook *hook,Object *item,APTR reserved)
|
|
|
|
{
|
|
|
|
int32 itemid = 0;
|
|
|
|
struct gui_window *gwin = hook->h_Data;
|
|
|
|
|
|
|
|
if(GetAttr(PMIA_ID, item, &itemid))
|
|
|
|
{
|
2008-10-05 03:29:17 +04:00
|
|
|
browser_window_form_select(gwin->shared->bw,gwin->shared->control,itemid);
|
2008-08-18 23:07:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return itemid;
|
|
|
|
}
|
2008-08-11 21:53:45 +04:00
|
|
|
|
2008-08-15 21:19:57 +04:00
|
|
|
static void *myrealloc(void *ptr, size_t len, void *pw)
|
|
|
|
{
|
|
|
|
return realloc(ptr, len);
|
|
|
|
}
|