mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-28 23:09:43 +03:00
- started to work on settings dialog
- some WIP in treeview widgets. Changed destroy / and init handling. It requires some optimization, when the widget is closed it must remove itself from the guiwin list, for perfomance.
This commit is contained in:
parent
3019368c93
commit
f7ee2a0387
@ -42,7 +42,7 @@
|
||||
|
||||
# enable optimizations
|
||||
# -O2 is currently broken with m68000 / m68020-60 builds
|
||||
CFLAGS += -O1
|
||||
CFLAGS += -O3
|
||||
|
||||
# override warning flags removing -Wall
|
||||
WARNFLAGS = -W -Wundef -Wpointer-arith \
|
||||
|
@ -106,10 +106,11 @@ S_ATARI := \
|
||||
plot/eddi.s \
|
||||
plot/font_freetype.c \
|
||||
plot/font_internal.c \
|
||||
gemtk/utils.c \
|
||||
gemtk/aestabs.c \
|
||||
gemtk/dragdrop.c \
|
||||
gemtk/guiwin.c \
|
||||
gemtk/msgbox.c \
|
||||
gemtk/guiwin.c
|
||||
gemtk/utils.c
|
||||
|
||||
S_ATARI := $(addprefix atari/,$(S_ATARI))
|
||||
|
||||
|
@ -353,9 +353,8 @@ static void __CDECL menu_find(short item, short title, void *data)
|
||||
|
||||
static void __CDECL menu_choices(short item, short title, void *data)
|
||||
{
|
||||
static WINDOW * settings_dlg = NULL;
|
||||
LOG(("%s", __FUNCTION__));
|
||||
settings_dlg = open_settings();
|
||||
open_settings();
|
||||
}
|
||||
|
||||
static void __CDECL menu_stop(short item, short title, void *data)
|
||||
|
@ -204,9 +204,10 @@ static void gui_download_window_destroy( struct gui_download_window * gdw)
|
||||
}
|
||||
if (gdw->fbuf != NULL) {
|
||||
free( gdw->fbuf );
|
||||
}
|
||||
wind_close(gdw->aes_handle);
|
||||
guiwin_remove(gdw->guiwin);
|
||||
}
|
||||
guiwin_remove(gdw->guiwin);
|
||||
wind_close(gdw->aes_handle);
|
||||
wind_delete(gdw->aes_handle);
|
||||
free(gdw);
|
||||
}
|
||||
|
||||
@ -269,7 +270,7 @@ struct gui_download_window * gui_download_window_create(download_context *ctx,
|
||||
gemdos_realpath(nsoption_charp(downloads_path), gdos_path);
|
||||
dstsize = strlen(gdos_path) + strlen(filename) + 2;
|
||||
destination = malloc( dstsize );
|
||||
snprintf( destination, dstsize, "%s/%s", gdos_path, filename );
|
||||
snprintf(destination, dstsize, "%s/%s", gdos_path, filename);
|
||||
}
|
||||
|
||||
gdw = calloc(1, sizeof(struct gui_download_window));
|
||||
|
173
atari/gemtk/aestabs.c
Normal file
173
atari/gemtk/aestabs.c
Normal file
@ -0,0 +1,173 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <gem.h>
|
||||
#include <cflib.h>
|
||||
#include "aestabs.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define DEBUG_PRINT(x) printf x
|
||||
#else
|
||||
# define DEBUG_PRINT(x)
|
||||
#endif
|
||||
|
||||
|
||||
AES_TABLIST * tablist_declare(OBJECT *tree, aes_tablist_user_func user_func)
|
||||
{
|
||||
AES_TABLIST * newlist = malloc(sizeof(AES_TABLIST));
|
||||
|
||||
newlist->first = NULL;
|
||||
newlist->tree = tree;
|
||||
newlist->user_func = user_func;
|
||||
DEBUG_PRINT(("aes_tablist_declare: %p\n", newlist));
|
||||
return(newlist);
|
||||
}
|
||||
|
||||
|
||||
AES_TAB * tablist_add(AES_TABLIST * tablist, short obj_tab, OBJECT * page_tree,
|
||||
short obj_page)
|
||||
{
|
||||
AES_TAB * newtab = malloc(sizeof(AES_TAB));
|
||||
|
||||
assert(newtab);
|
||||
assert(tablist);
|
||||
|
||||
newtab->next = NULL;
|
||||
newtab->prev = NULL;
|
||||
newtab->obj_tab = obj_tab;
|
||||
newtab->obj_page = obj_page;
|
||||
newtab->page_tree = page_tree;
|
||||
|
||||
if(newtab->page_tree == NULL){
|
||||
newtab->page_tree = tablist->tree;
|
||||
}
|
||||
|
||||
if (tablist->first == NULL) {
|
||||
tablist->first = newtab;
|
||||
set_state(tablist->tree, newtab->obj_tab, OS_SELECTED, 0);
|
||||
} else {
|
||||
AES_TAB *tmp = tablist->first;
|
||||
while( tmp->next != NULL ) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
tmp->next = newtab;
|
||||
newtab->prev = tmp;
|
||||
newtab->next = NULL;
|
||||
set_state(tablist->tree, newtab->obj_tab, OS_SELECTED, 0);
|
||||
}
|
||||
|
||||
// TODO: Set the visible flag on that register?
|
||||
|
||||
DEBUG_PRINT(("tablist_add: Tab=%p\n", newtab));
|
||||
|
||||
return(newtab);
|
||||
}
|
||||
|
||||
|
||||
short tablist_activate(AES_TABLIST * tablist, short tab, short options)
|
||||
{
|
||||
AES_TAB *tmp, *activated=NULL, *deactivated=NULL;
|
||||
struct aes_tab_s *active;
|
||||
short activated_pg = -1;
|
||||
short is_tab = 0;
|
||||
|
||||
assert(tablist);
|
||||
assert(tablist->first);
|
||||
|
||||
active = tablist_get_active(tablist);
|
||||
|
||||
if (active != NULL) {
|
||||
if ((options & AES_TABLIST_OPTION_FORCE_EVENTS) == 0) {
|
||||
if(active->obj_tab == tab)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
tmp = tablist->first;
|
||||
while (tmp != NULL) {
|
||||
if(tmp->obj_tab == tab) {
|
||||
is_tab = 1;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
if(is_tab == 0) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
tmp = tablist->first;
|
||||
while ( tmp != NULL ) {
|
||||
if(tab != tmp->obj_tab) {
|
||||
if (get_state(tablist->tree, tmp->obj_tab, OS_SELECTED) != 0) {
|
||||
deactivated = tmp;
|
||||
set_state(tablist->tree, tmp->obj_tab, OS_SELECTED, 0);
|
||||
}
|
||||
// the tab registers can share the same page, consider that:
|
||||
if (tablist->tree == tmp->page_tree
|
||||
&& activated_pg != tmp->obj_page) {
|
||||
|
||||
set_flag(tablist->tree, tmp->obj_page, OF_HIDETREE, 1);
|
||||
}
|
||||
} else {
|
||||
activated = tmp;
|
||||
// this tab must the selected / visible
|
||||
set_state(tablist->tree, tmp->obj_tab, OS_SELECTED, 1);
|
||||
if(tablist->tree == tmp->page_tree)
|
||||
set_flag(tablist->tree, tmp->obj_page, OF_HIDETREE, 0);
|
||||
activated_pg = tmp->obj_page;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
if(tablist->user_func != NULL) {
|
||||
AES_TABLIST_FUNC_ARGS args;
|
||||
if(deactivated){
|
||||
args.event = AES_TABLIST_TAB_DEACTIVATED;
|
||||
args.tab = deactivated;
|
||||
tablist->user_func(tablist, &args);
|
||||
}
|
||||
if(activated){
|
||||
args.event = AES_TABLIST_TAB_ACTIVATED;
|
||||
args.tab = activated;
|
||||
tablist->user_func(tablist, &args);
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
struct aes_tab_s *tablist_get_active(AES_TABLIST * tablist)
|
||||
{
|
||||
AES_TAB *tmp = tablist->first;
|
||||
while( tmp != NULL ) {
|
||||
if(get_state(tablist->tree, tmp->obj_tab, OS_SELECTED) != 0) {
|
||||
// that's the one
|
||||
return(tmp);
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
AES_TAB * tablist_find(AES_TABLIST * tablist, OBJECT * page, short tab)
|
||||
{
|
||||
AES_TAB *tmp = tablist->first;
|
||||
while( tmp != NULL ) {
|
||||
if((tmp->page_tree == page) && (tab == tmp->obj_tab)) {
|
||||
return(tmp);
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void tablist_delete(AES_TABLIST *tablist)
|
||||
{
|
||||
AES_TAB *tmp = tablist->first, *cur;
|
||||
while ( tmp != NULL ) {
|
||||
cur = tmp;
|
||||
tmp = tmp->next;
|
||||
DEBUG_PRINT(("tablist_delete, Freeing tab: %p\n", cur));
|
||||
free(cur);
|
||||
}
|
||||
DEBUG_PRINT(("tablist_delete, Freeing list: %p\n", tablist));
|
||||
free(tablist);
|
||||
}
|
56
atari/gemtk/aestabs.h
Normal file
56
atari/gemtk/aestabs.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef AESTABS_H_INCLUDED
|
||||
#define AESTABS_H_INCLUDED
|
||||
|
||||
struct aes_tab_s;
|
||||
struct aes_tablist_s;
|
||||
typedef struct aes_tab_s AES_TAB;
|
||||
typedef struct aes_tablist_s AES_TABLIST;
|
||||
|
||||
#define AES_TABLIST_TAB_ACTIVATED 0x01
|
||||
#define AES_TABLIST_TAB_DEACTIVATED 0x02
|
||||
|
||||
#define AES_TABLIST_OPTION_FORCE_EVENTS 0x01 // do not eat events which do
|
||||
// not changed the internal state
|
||||
// this is required for tabs which
|
||||
// require "activate" events
|
||||
// for tabs which are already
|
||||
// selected.
|
||||
|
||||
|
||||
struct aes_tablist_user_args_s
|
||||
{
|
||||
short event;
|
||||
AES_TAB *tab;
|
||||
};
|
||||
|
||||
typedef struct aes_tablist_user_args_s AES_TABLIST_FUNC_ARGS;
|
||||
|
||||
typedef void (*aes_tablist_user_func)(AES_TABLIST * list,
|
||||
AES_TABLIST_FUNC_ARGS * args);
|
||||
|
||||
struct aes_tab_s {
|
||||
short obj_tab;
|
||||
short obj_page;
|
||||
OBJECT * page_tree;
|
||||
AES_TAB * next, *prev;
|
||||
};
|
||||
|
||||
struct aes_tablist_s {
|
||||
OBJECT *tree;
|
||||
AES_TAB * first;
|
||||
aes_tablist_user_func user_func;
|
||||
};
|
||||
|
||||
|
||||
|
||||
AES_TABLIST * tablist_declare(OBJECT *tree, aes_tablist_user_func user_func);
|
||||
void tablist_delete(AES_TABLIST * tablist);
|
||||
AES_TAB * tablist_add(AES_TABLIST * tablist, short tab, OBJECT *page_tree,
|
||||
short page);
|
||||
short tablist_activate(AES_TABLIST * tablist, short tab, short option);
|
||||
struct aes_tab_s *tablist_get_active(AES_TABLIST * tablist);
|
||||
AES_TAB * tablist_find(AES_TABLIST * tablist, OBJECT *page, short tab);
|
||||
|
||||
#define AES_TAB_IS_ACTIVE(l, x) (tablist_get_active(l) == x)
|
||||
|
||||
#endif // AESTABS_H_INCLUDED
|
@ -7,6 +7,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Utils */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* System type detection added by [GS] */
|
||||
/* detect the system type, AES + kernel */
|
||||
#define SYS_TOS 0x0001
|
||||
@ -23,16 +27,34 @@
|
||||
#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */
|
||||
|
||||
extern unsigned short _systype_v;
|
||||
|
||||
/*
|
||||
Utils
|
||||
*/
|
||||
unsigned short _systype (void);
|
||||
OBJECT *get_tree( int idx );
|
||||
|
||||
/*
|
||||
* MultiTOS Drag&Drop
|
||||
*/
|
||||
#ifndef POINT_WITHIN
|
||||
# define POINT_WITHIN(_x,_y, r) ((_x >= r.g_x) && (_x <= r.g_x + r.g_w ) \
|
||||
&& (_y >= r.g_y) && (_y <= r.g_y + r.g_h))
|
||||
#endif
|
||||
|
||||
#ifndef RC_WITHIN
|
||||
# define RC_WITHIN(a,b) \
|
||||
(((a)->g_x >= (b)->g_x) \
|
||||
&& (((a)->g_x + (a)->g_w) <= ((b)->g_x + (b)->g_w))) \
|
||||
&& (((a)->g_y >= (b)->g_y) \
|
||||
&& (((a)->g_y + (a)->g_h) <= ((b)->g_y + (b)->g_h)))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(_a,_b) ((_a>_b) ? _a : _b)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(_a,_b) ((_a<_b) ? _a : _b)
|
||||
#endif
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* MultiTOS Drag & Drop */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
short ddcreate(short *pipe);
|
||||
short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate, short pipename);
|
||||
short ddrexts(short fd, char *exts);
|
||||
@ -45,17 +67,17 @@ short ddsexts(short fd, char *exts);
|
||||
short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
|
||||
short ddreply(short fd, char ack);
|
||||
|
||||
/*
|
||||
Message box
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Message Box module */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#define MSG_BOX_ALERT 1
|
||||
#define MSG_BOX_CONFIRM 2
|
||||
|
||||
short msg_box_show(short type, const char * msg);
|
||||
|
||||
/*
|
||||
Guiwin
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* GUIWIN Module */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#define GW_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events
|
||||
#define GW_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed
|
||||
#define GW_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical
|
||||
@ -120,29 +142,12 @@ bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
|
||||
void guiwin_toolbar_redraw(GUIWIN *win, GRECT *clip);
|
||||
void guiwin_clear(GUIWIN *win);
|
||||
|
||||
/*
|
||||
* AES Scroller Object
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* AES Scroller module */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef POINT_WITHIN
|
||||
#define POINT_WITHIN(_x,_y, r) ((_x >= r.g_x) && (_x <= r.g_x + r.g_w ) \
|
||||
&& (_y >= r.g_y) && (_y <= r.g_y + r.g_h))
|
||||
#endif
|
||||
|
||||
#ifndef RC_WITHIN
|
||||
#define RC_WITHIN(a,b) \
|
||||
(((a)->g_x >= (b)->g_x) \
|
||||
&& (((a)->g_x + (a)->g_w) <= ((b)->g_x + (b)->g_w))) \
|
||||
&& (((a)->g_y >= (b)->g_y) \
|
||||
&& (((a)->g_y + (a)->g_h) <= ((b)->g_y + (b)->g_h)))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(_a,_b) ((_a>_b) ? _a : _b)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(_a,_b) ((_a<_b) ? _a : _b)
|
||||
#endif
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* AES Tabs module */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#endif // GEMTK_H_INCLUDED
|
||||
|
@ -1,4 +1,20 @@
|
||||
//#include "global.h"
|
||||
/*
|
||||
* Copyright 2012 Ole Loots <ole@monochrom.net>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@ -10,8 +26,8 @@
|
||||
#include <mt_gem.h>
|
||||
#include "gemtk.h"
|
||||
|
||||
//#define DEBUG_PRINT(x) printf x
|
||||
#define DEBUG_PRINT(x)
|
||||
#define DEBUG_PRINT(x) printf x
|
||||
//#define DEBUG_PRINT(x)
|
||||
|
||||
struct gui_window_s {
|
||||
short handle;
|
||||
@ -170,13 +186,20 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
|
||||
|
||||
case WM_SIZED:
|
||||
case WM_REPOSED:
|
||||
wind_get_grect(gw->handle, WF_FULLXYWH, &g2);
|
||||
wind_get_grect(gw->handle, WF_CURRXYWH, &g);
|
||||
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, msg[6], msg[7]);
|
||||
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
|
||||
if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
|
||||
guiwin_send_redraw(gw, NULL);
|
||||
}
|
||||
g.g_w = MIN(msg[6], g2.g_w);
|
||||
g.g_h = MIN(msg[7], g2.g_h);
|
||||
if(g2.g_w != g.g_w || g2.g_h != g.g_h){
|
||||
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, g.g_w, g.g_h);
|
||||
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
|
||||
if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
|
||||
guiwin_send_redraw(gw, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case WM_FULLED:
|
||||
@ -315,7 +338,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
|
||||
if (obj_idx > 0) {
|
||||
if ((dest->toolbar[obj_idx].ob_flags & OF_SELECTABLE)!=0
|
||||
&& ((dest->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0)
|
||||
&& ((dest->flags & GW_FLAG_TOOLBAR_REDRAW) == 0)) {
|
||||
&& ((dest->flags & GW_FLAG_TOOLBAR_REDRAW) == 1)) {
|
||||
dest->toolbar[obj_idx].ob_state |= OS_SELECTED;
|
||||
// TODO: optimize redraw by setting the object clip:
|
||||
guiwin_toolbar_redraw(dest, NULL);
|
||||
|
@ -144,8 +144,8 @@ void gui_poll(bool active)
|
||||
}
|
||||
/* this suits for stuff with lower priority */
|
||||
/* TBD: really be spare on redraws??? */
|
||||
//hotlist_redraw();
|
||||
//global_history_redraw();
|
||||
hotlist_redraw();
|
||||
global_history_redraw();
|
||||
}
|
||||
|
||||
// Handle events until there are no more messages pending or
|
||||
|
@ -98,6 +98,7 @@ typedef struct s_browser * CMP_BROWSER;
|
||||
*/
|
||||
struct s_gui_win_root
|
||||
{
|
||||
short aes_handle;
|
||||
GUIWIN *win;
|
||||
CMP_TOOLBAR toolbar;
|
||||
CMP_STATUSBAR statusbar;
|
||||
|
@ -38,6 +38,10 @@
|
||||
#include "atari/res/netsurf.rsh"
|
||||
#include "atari/history.h"
|
||||
|
||||
|
||||
//TODO: remove/add guiwin handle on close / open - so that the list
|
||||
// is kept tiny.
|
||||
|
||||
extern char * tree_directory_icon_name;
|
||||
extern GRECT desk_area;
|
||||
|
||||
@ -46,6 +50,7 @@ struct s_atari_global_history gl_history;
|
||||
|
||||
void global_history_open( void )
|
||||
{
|
||||
global_history_init();
|
||||
if (gl_history.init == false ) {
|
||||
return;
|
||||
}
|
||||
@ -132,10 +137,6 @@ bool global_history_init( void )
|
||||
void global_history_destroy( void )
|
||||
{
|
||||
|
||||
void global_history_redraw( void )
|
||||
{
|
||||
atari_treeview_redraw( gl_history.tv );
|
||||
}
|
||||
if( gl_history.init == false ) {
|
||||
return;
|
||||
}
|
||||
@ -152,4 +153,9 @@ void global_history_redraw( void )
|
||||
LOG(("done"));
|
||||
}
|
||||
|
||||
void global_history_redraw( void )
|
||||
{
|
||||
atari_treeview_redraw( gl_history.tv );
|
||||
}
|
||||
|
||||
|
||||
|
103
atari/hotlist.c
103
atari/hotlist.c
@ -44,6 +44,9 @@
|
||||
#include "atari/gemtk/gemtk.h"
|
||||
#include "atari/res/netsurf.rsh"
|
||||
|
||||
//TODO: remove/add guiwin handle on close / open - so that the list
|
||||
// is kept tiny.
|
||||
|
||||
extern GRECT desk_area;
|
||||
|
||||
struct atari_hotlist hl;
|
||||
@ -86,7 +89,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
|
||||
break;
|
||||
|
||||
case WM_CLOSED:
|
||||
hotlist_close();
|
||||
hotlist_destroy();
|
||||
break;
|
||||
|
||||
default: break;
|
||||
@ -101,49 +104,51 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
|
||||
|
||||
void hotlist_init(void)
|
||||
{
|
||||
if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){
|
||||
atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" );
|
||||
} else {
|
||||
strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 );
|
||||
}
|
||||
|
||||
LOG(("Hotlist: %s", (char*)&hl.path ));
|
||||
|
||||
if( hl.window == NULL ){
|
||||
int flags = ATARI_TREEVIEW_WIDGETS;
|
||||
short handle = -1;
|
||||
GRECT desk;
|
||||
OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
|
||||
assert( tree );
|
||||
hl.open = false;
|
||||
|
||||
handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
|
||||
hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
|
||||
if( hl.window == NULL ) {
|
||||
LOG(("Failed to allocate Hotlist"));
|
||||
return;
|
||||
}
|
||||
wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
|
||||
guiwin_set_toolbar(hl.window, tree, 0, 0);
|
||||
hl.tv = atari_treeview_create(
|
||||
hotlist_get_tree_flags(),
|
||||
hl.window,
|
||||
handle_event
|
||||
);
|
||||
if (hl.tv == NULL) {
|
||||
/* handle it properly, clean up previous allocs */
|
||||
LOG(("Failed to allocate treeview"));
|
||||
return;
|
||||
if (hl.init == false) {
|
||||
if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){
|
||||
atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" );
|
||||
} else {
|
||||
strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 );
|
||||
}
|
||||
|
||||
hotlist_initialise(
|
||||
hl.tv->tree,
|
||||
(char*)&hl.path,
|
||||
"dir.png"
|
||||
);
|
||||
LOG(("Hotlist: %s", (char*)&hl.path ));
|
||||
|
||||
} else {
|
||||
if( hl.window == NULL ){
|
||||
int flags = ATARI_TREEVIEW_WIDGETS;
|
||||
short handle = -1;
|
||||
GRECT desk;
|
||||
OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
|
||||
assert( tree );
|
||||
hl.open = false;
|
||||
|
||||
handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
|
||||
hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
|
||||
if( hl.window == NULL ) {
|
||||
LOG(("Failed to allocate Hotlist"));
|
||||
return;
|
||||
}
|
||||
wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
|
||||
guiwin_set_toolbar(hl.window, tree, 0, 0);
|
||||
hl.tv = atari_treeview_create(
|
||||
hotlist_get_tree_flags(),
|
||||
hl.window,
|
||||
handle_event
|
||||
);
|
||||
if (hl.tv == NULL) {
|
||||
/* handle it properly, clean up previous allocs */
|
||||
LOG(("Failed to allocate treeview"));
|
||||
return;
|
||||
}
|
||||
|
||||
hotlist_initialise(
|
||||
hl.tv->tree,
|
||||
(char*)&hl.path,
|
||||
"dir.png"
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
hl.init = true;
|
||||
}
|
||||
@ -151,6 +156,7 @@ void hotlist_init(void)
|
||||
|
||||
void hotlist_open(void)
|
||||
{
|
||||
hotlist_init();
|
||||
if( hl.init == false ) {
|
||||
return;
|
||||
}
|
||||
@ -181,17 +187,12 @@ void hotlist_close(void)
|
||||
void hotlist_destroy(void)
|
||||
{
|
||||
|
||||
void hotlist_redraw(void)
|
||||
{
|
||||
int i = 01;
|
||||
atari_treeview_redraw(hl.tv);
|
||||
}
|
||||
if( hl.init == false ) {
|
||||
if( hl.init == false) {
|
||||
return;
|
||||
}
|
||||
if( hl.window != NULL ) {
|
||||
hotlist_cleanup( (char*)&hl.path );
|
||||
if( hl.open )
|
||||
if (hl.open)
|
||||
hotlist_close();
|
||||
wind_delete(guiwin_get_handle(hl.window));
|
||||
guiwin_remove(hl.window);
|
||||
@ -202,6 +203,12 @@ void hotlist_redraw(void)
|
||||
LOG(("done"));
|
||||
}
|
||||
|
||||
void hotlist_redraw(void)
|
||||
{
|
||||
int i = 01;
|
||||
atari_treeview_redraw(hl.tv);
|
||||
}
|
||||
|
||||
struct node;
|
||||
|
||||
void atari_hotlist_add_page( const char * url, const char * title )
|
||||
@ -212,6 +219,8 @@ void atari_hotlist_add_page( const char * url, const char * title )
|
||||
NSTREEVIEW tv = hl.tv;
|
||||
if(hl.tv == NULL )
|
||||
return;
|
||||
// TODO: do no open hotlist, and remove guiwin on close...
|
||||
hotlist_open();
|
||||
if( hl.tv->click.x >= 0 && hl.tv->click.y >= 0 ){
|
||||
hotlist_add_page_xy( url, hl.tv->click.x, hl.tv->click.y );
|
||||
} else {
|
||||
|
@ -488,8 +488,7 @@ const char * file_select( const char * title, const char * name ) {
|
||||
}
|
||||
|
||||
if( FselInput( path, tmpname, (char*)"", use_title, NULL, NULL)) {
|
||||
strncpy( fullname, path, PATH_MAX-1 );
|
||||
strncat( fullname, tmpname, PATH_MAX-strlen(fullname)-1 );
|
||||
snprintf(fullname, PATH_MAX, "%s%s", path, tmpname);
|
||||
return( (const char*)&fullname );
|
||||
}
|
||||
return( NULL );
|
||||
|
Binary file not shown.
@ -209,3 +209,20 @@
|
||||
#define VSCROLLER_BT_DOWN_PIC 5 /* CICON in tree VSCROLLER */
|
||||
#define VSCROLLER_BT_UP 6 /* IBOX in tree VSCROLLER */
|
||||
#define VSCROLLER_BT_UP_PIC 4 /* CICON in tree VSCROLLER */
|
||||
|
||||
#define SETTINGS 15 /* form/dial */
|
||||
#define SETTINGS_EDIT_HOMEPAGE_00 2 /* FTEXT in tree SETTINGS */
|
||||
#define SETTINGS_LBL_CB_HIDE_ADVERTISEMENT 3 /* STRING in tree SETTINGS */
|
||||
#define SETTINGS_LBL_CB_DISABLE_POPUP_WINDOWS 4 /* STRING in tree SETTINGS */
|
||||
#define SETTINGS_CB_HIDE_ADVERTISEMENT 5 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 6 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_LBL_CB_SEND_HTTP_REFERRER 7 /* STRING in tree SETTINGS */
|
||||
#define SETTINGS_CB_SEND_HTTP_REFERRER 8 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_LBL_CB_SEND_DO_NOT_TRACK 9 /* STRING in tree SETTINGS */
|
||||
#define SETTINGS_CB_SEND_DO_NOT_TRACK 10 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_DEC_HISTORY_AGE 12 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_EDIT_HISTORY_AGE 13 /* FTEXT in tree SETTINGS */
|
||||
#define SETTINGS_INC_HISTORY_AGE 14 /* BOXCHAR in tree SETTINGS */
|
||||
#define SETTINGS_BT_CLEAR_HISTORY 15 /* BUTTON in tree SETTINGS */
|
||||
#define SETTINGS_BT_SEL_LOCALE 17 /* BUTTON in tree SETTINGS */
|
||||
#define SETTINGS_BT_GUI_LANG 19 /* BUTTON in tree SETTINGS */
|
||||
|
@ -1,9 +1,9 @@
|
||||
ResourceMaster v3.65
|
||||
#C 15@0@0@0@
|
||||
#C 16@0@0@0@
|
||||
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
|
||||
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
|
||||
#R 0@0@1@1@1@1@
|
||||
#M 20010100@0@7728@624@
|
||||
#M 20010100@0@7728@625@
|
||||
#T 0@1@MAINMENU@@62@@
|
||||
#O 4@32@T_FILE@@
|
||||
#O 5@32@T_EDIT@@
|
||||
@ -198,4 +198,20 @@ ResourceMaster v3.65
|
||||
#O 5@33@BT_DOWN_PIC@@
|
||||
#O 6@25@BT_UP@@
|
||||
#O 4@33@BT_UP_PIC@@
|
||||
#c 205@
|
||||
#T 15@2@SETTINGS@@21@@
|
||||
#O 2@29@EDIT_HOMEPAGE_00@@
|
||||
#O 3@28@LBL_CB_HIDE_ADVERTISEMENT@@
|
||||
#O 4@28@LBL_CB_DISABLE_POPUP_WINDOWS@@
|
||||
#O 5@27@CB_HIDE_ADVERTISEMENT@@
|
||||
#O 6@27@CB_DISABLE_POPUP_WINDOWS@@
|
||||
#O 7@28@LBL_CB_SEND_HTTP_REFERRER@@
|
||||
#O 8@27@CB_SEND_HTTP_REFERRER@@
|
||||
#O 9@28@LBL_CB_SEND_DO_NOT_TRACK@@
|
||||
#O 10@27@CB_SEND_DO_NOT_TRACK@@
|
||||
#O 12@27@DEC_HISTORY_AGE@@
|
||||
#O 13@29@EDIT_HISTORY_AGE@@
|
||||
#O 14@27@INC_HISTORY_AGE@@
|
||||
#O 15@26@BT_CLEAR_HISTORY@@
|
||||
#O 17@26@BT_SEL_LOCALE@@
|
||||
#O 19@26@BT_GUI_LANG@@
|
||||
#c 28255@
|
||||
|
@ -165,7 +165,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
|
||||
|
||||
short ghandle = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
|
||||
|
||||
if (guiwin_get_handle(data->rootwin->win)==ghandle) {
|
||||
if (data->rootwin->aes_handle==ghandle) {
|
||||
// The window found at x,y is an gui_window
|
||||
// and it's the input window.
|
||||
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
|
||||
@ -204,7 +204,6 @@ int window_create(struct gui_window * gw,
|
||||
int err = 0;
|
||||
bool tb, sb;
|
||||
int flags;
|
||||
short aes_handle;
|
||||
|
||||
tb = (inflags & WIDGET_TOOLBAR);
|
||||
sb = (inflags & WIDGET_STATUSBAR);
|
||||
@ -229,13 +228,13 @@ int window_create(struct gui_window * gw,
|
||||
redraw_slots_init(&gw->root->redraw_slots, 8);
|
||||
|
||||
// TODO: use desk size
|
||||
aes_handle = wind_create(flags, 40, 40, app.w, app.h);
|
||||
if(aes_handle<0) {
|
||||
gw->root->aes_handle = wind_create(flags, 40, 40, app.w, app.h);
|
||||
if(gw->root->aes_handle<0) {
|
||||
free(gw->root->title);
|
||||
free(gw->root);
|
||||
return( -1 );
|
||||
}
|
||||
gw->root->win = guiwin_add(aes_handle,
|
||||
gw->root->win = guiwin_add(gw->root->aes_handle,
|
||||
GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM, handle_event);
|
||||
|
||||
struct rootwin_data_s * data = malloc(sizeof(struct rootwin_data_s));
|
||||
@ -265,10 +264,10 @@ int window_create(struct gui_window * gw,
|
||||
}
|
||||
|
||||
// Setup some window defaults:
|
||||
wind_set_str(aes_handle, WF_ICONTITLE, (char*)"NetSurf");
|
||||
wind_set(aes_handle, WF_OPTS, 1, WO0_FULLREDRAW, 0, 0);
|
||||
wind_set(aes_handle, WF_OPTS, 1, WO0_NOBLITW, 0, 0);
|
||||
wind_set(aes_handle, WF_OPTS, 1, WO0_NOBLITH, 0, 0);
|
||||
wind_set_str(gw->root->aes_handle, WF_ICONTITLE, (char*)"NetSurf");
|
||||
wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_FULLREDRAW, 0, 0);
|
||||
wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_NOBLITW, 0, 0);
|
||||
wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_NOBLITH, 0, 0);
|
||||
|
||||
if (inflags & WIN_TOP) {
|
||||
window_set_focus(gw->root, BROWSER, gw->browser);
|
||||
@ -332,6 +331,8 @@ int window_destroy(ROOTWIN *rootwin)
|
||||
free(rootwin->title);
|
||||
|
||||
guiwin_remove(rootwin->win);
|
||||
wind_close(rootwin->aes_handle);
|
||||
wind_delete(rootwin->aes_handle);
|
||||
free(rootwin);
|
||||
return(err);
|
||||
}
|
||||
@ -344,9 +345,8 @@ void window_open(ROOTWIN *rootwin, GRECT pos)
|
||||
|
||||
assert(rootwin->active_gui_window != NULL);
|
||||
|
||||
short aes_handle = guiwin_get_handle(rootwin->win);
|
||||
wind_open(aes_handle, pos.g_x, pos.g_y, pos.g_w, pos.g_h );
|
||||
wind_set_str(aes_handle, WF_NAME, (char *)"");
|
||||
wind_open(rootwin->aes_handle, pos.g_x, pos.g_y, pos.g_w, pos.g_h );
|
||||
wind_set_str(rootwin->aes_handle, WF_NAME, (char *)"");
|
||||
|
||||
rootwin->active_gui_window->browser->attached = true;
|
||||
if(rootwin->statusbar != NULL) {
|
||||
@ -387,7 +387,7 @@ void window_set_stauts(struct s_gui_win_root *rootwin, char * text)
|
||||
|
||||
void window_set_title(struct s_gui_win_root * rootwin, char *title)
|
||||
{
|
||||
wind_set_str(guiwin_get_handle(rootwin->win), WF_NAME, title);
|
||||
wind_set_str(rootwin->aes_handle, WF_NAME, title);
|
||||
}
|
||||
|
||||
void window_scroll_by(ROOTWIN *root, int sx, int sy)
|
||||
@ -662,13 +662,12 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
|
||||
void window_process_redraws(ROOTWIN * rootwin)
|
||||
{
|
||||
GRECT work, visible_ro, tb_area, content_area;
|
||||
short aes_handle, i;
|
||||
short i;
|
||||
bool toolbar_rdrw_required;
|
||||
struct guiwin_scroll_info_s *slid =NULL;
|
||||
|
||||
redraw_active = true;
|
||||
|
||||
aes_handle = guiwin_get_handle(rootwin->win);
|
||||
|
||||
guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, &tb_area);
|
||||
guiwin_get_grect(rootwin->win, GUIWIN_AREA_CONTENT, &content_area);
|
||||
@ -685,7 +684,7 @@ void window_process_redraws(ROOTWIN * rootwin)
|
||||
|
||||
while(plot_lock() == false);
|
||||
|
||||
wind_get_grect(aes_handle, WF_FIRSTXYWH, &visible_ro);
|
||||
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible_ro);
|
||||
while (visible_ro.g_w > 0 && visible_ro.g_h > 0) {
|
||||
|
||||
// TODO: optimze the rectangle list -
|
||||
@ -717,7 +716,7 @@ void window_process_redraws(ROOTWIN * rootwin)
|
||||
}
|
||||
|
||||
}
|
||||
wind_get_grect(aes_handle, WF_NEXTXYWH, &visible_ro);
|
||||
wind_get_grect(rootwin->aes_handle, WF_NEXTXYWH, &visible_ro);
|
||||
}
|
||||
vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy_clip);
|
||||
rootwin->redraw_slots.areas_used = 0;
|
||||
@ -985,10 +984,8 @@ static void on_redraw(ROOTWIN *rootwin, short msg[8])
|
||||
static void on_resized(ROOTWIN *rootwin)
|
||||
{
|
||||
GRECT g;
|
||||
short handle;
|
||||
struct gui_window *gw;
|
||||
|
||||
handle = guiwin_get_handle(rootwin->win);
|
||||
gw = window_get_active_gui_window(rootwin);
|
||||
|
||||
//printf("resized...\n");
|
||||
@ -998,7 +995,7 @@ static void on_resized(ROOTWIN *rootwin)
|
||||
if(gw == NULL)
|
||||
return;
|
||||
|
||||
wind_get_grect(handle, WF_CURRXYWH, &g);
|
||||
wind_get_grect(rootwin->aes_handle, WF_CURRXYWH, &g);
|
||||
|
||||
if (rootwin->loc.g_w != g.g_w || rootwin->loc.g_h != g.g_h) {
|
||||
if ( gw->browser->bw->current_content != NULL ) {
|
||||
|
1043
atari/settings.c
1043
atari/settings.c
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
|
||||
#include <windom.h>
|
||||
|
||||
WINDOW * open_settings(void);
|
||||
void open_settings(void);
|
||||
void close_settings(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user