mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Stop using the same large list of gadget constants everywhere
Saves a small amount of memory
This commit is contained in:
parent
a268252629
commit
64bc2a7931
@ -80,10 +80,18 @@
|
||||
#define APPNOTIFY_StopBackMsg ( TAG_USER + 17 )
|
||||
#endif
|
||||
|
||||
enum {
|
||||
OID_D_MAIN = 0,
|
||||
GID_D_MAIN,
|
||||
GID_D_STATUS,
|
||||
GID_D_CANCEL,
|
||||
GID_D_LAST
|
||||
};
|
||||
|
||||
struct gui_download_window {
|
||||
struct ami_generic_window w;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
Object *objects[GID_D_LAST];
|
||||
BPTR fh;
|
||||
uint32 size;
|
||||
uint32 downloaded;
|
||||
@ -183,7 +191,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
|
||||
APPNOTIFY_StopBackMsg, bkm,
|
||||
TAG_DONE);
|
||||
} else {
|
||||
dw->objects[OID_MAIN] = WindowObj,
|
||||
dw->objects[OID_D_MAIN] = WindowObj,
|
||||
WA_ScreenTitle, ami_gui_get_screen_title(),
|
||||
WA_Title, dw->url,
|
||||
WA_Activate, TRUE,
|
||||
@ -197,9 +205,9 @@ static struct gui_download_window *gui_download_window_create(download_context *
|
||||
WINDOW_IconifyGadget, FALSE,
|
||||
WINDOW_LockHeight,TRUE,
|
||||
WINDOW_Position, WPOS_CENTERSCREEN,
|
||||
WINDOW_ParentGroup, dw->objects[GID_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, dw->objects[GID_STATUS] = FuelGaugeObj,
|
||||
GA_ID,GID_STATUS,
|
||||
WINDOW_ParentGroup, dw->objects[GID_D_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, dw->objects[GID_D_STATUS] = FuelGaugeObj,
|
||||
GA_ID,GID_D_STATUS,
|
||||
GA_Text,messages_get("amiDownload"),
|
||||
FUELGAUGE_Min,0,
|
||||
FUELGAUGE_Max,total_size,
|
||||
@ -212,8 +220,8 @@ static struct gui_download_window *gui_download_window_create(download_context *
|
||||
FuelGaugeEnd,
|
||||
CHILD_NominalSize,TRUE,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, dw->objects[GID_CANCEL] = ButtonObj,
|
||||
GA_ID,GID_CANCEL,
|
||||
LAYOUT_AddChild, dw->objects[GID_D_CANCEL] = ButtonObj,
|
||||
GA_ID,GID_D_CANCEL,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text,messages_get("Abort"),
|
||||
GA_TabCycle,TRUE,
|
||||
@ -221,7 +229,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
|
||||
EndGroup,
|
||||
EndWindow;
|
||||
|
||||
dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_MAIN]);
|
||||
dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_D_MAIN]);
|
||||
}
|
||||
|
||||
dw->ctx = ctx;
|
||||
@ -256,7 +264,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
|
||||
APPNOTIFY_Percentage, dw->progress,
|
||||
TAG_DONE);
|
||||
} else {
|
||||
RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
|
||||
RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_D_STATUS], dw->win, NULL,
|
||||
FUELGAUGE_Level, dw->downloaded,
|
||||
GA_Text, messages_get("amiDownload"),
|
||||
FUELGAUGE_VarArgs, va,
|
||||
@ -271,7 +279,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
|
||||
APPNOTIFY_Percentage, 100,
|
||||
TAG_DONE);
|
||||
} else {
|
||||
RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
|
||||
RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_D_STATUS], dw->win, NULL,
|
||||
FUELGAUGE_Level, dw->downloaded,
|
||||
GA_Text, messages_get("amiDownloadU"),
|
||||
FUELGAUGE_VarArgs, va,
|
||||
@ -330,8 +338,8 @@ static void gui_download_window_done(struct gui_download_window *dw)
|
||||
|
||||
downloads_in_progress--;
|
||||
|
||||
if(dw->objects[OID_MAIN] != NULL) {
|
||||
DisposeObject(dw->objects[OID_MAIN]);
|
||||
if(dw->objects[OID_D_MAIN] != NULL) {
|
||||
DisposeObject(dw->objects[OID_D_MAIN]);
|
||||
}
|
||||
|
||||
ami_gui_win_list_remove(dw);
|
||||
@ -378,14 +386,14 @@ static BOOL ami_download_window_event(void *w)
|
||||
|
||||
if(dw == NULL) return FALSE; /* We may not have a real window */
|
||||
|
||||
while((result = RA_HandleInput(dw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
|
||||
while((result = RA_HandleInput(dw->objects[OID_D_MAIN], &code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_GADGETUP:
|
||||
switch(result & WMHI_GADGETMASK)
|
||||
{
|
||||
case GID_CANCEL:
|
||||
case GID_D_CANCEL:
|
||||
ami_download_window_abort(dw);
|
||||
return TRUE;
|
||||
break;
|
||||
|
@ -43,7 +43,6 @@ enum
|
||||
OID_MAIN = 0,
|
||||
OID_VSCROLL,
|
||||
OID_HSCROLL,
|
||||
OID_LAST, /* for compatibility */
|
||||
GID_MAIN,
|
||||
GID_TABLAYOUT,
|
||||
GID_BROWSER,
|
||||
@ -66,15 +65,7 @@ enum
|
||||
GID_ADDTAB_BM,
|
||||
GID_TABS,
|
||||
GID_TABS_FLAG,
|
||||
GID_USER,
|
||||
GID_PASS,
|
||||
GID_LOGIN,
|
||||
GID_CANCEL,
|
||||
GID_NEXT,
|
||||
GID_PREV,
|
||||
GID_SEARCHSTRING,
|
||||
GID_SHOWALL,
|
||||
GID_CASE,
|
||||
GID_TOOLBARLAYOUT,
|
||||
GID_HOTLIST,
|
||||
GID_HOTLISTLAYOUT,
|
||||
|
@ -61,10 +61,20 @@ enum {
|
||||
AMI_LOGIN_MSG_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
OID_L_MAIN = 0,
|
||||
GID_L_MAIN,
|
||||
GID_L_USER,
|
||||
GID_L_PASS,
|
||||
GID_L_LOGIN,
|
||||
GID_L_CANCEL,
|
||||
GID_L_LAST
|
||||
};
|
||||
|
||||
struct gui_login_window {
|
||||
struct ami_generic_window w;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
Object *objects[GID_L_LAST];
|
||||
nserror (*cb)(const char *username, const char *password, void *pw);
|
||||
void *cbpw;
|
||||
nsurl *url;
|
||||
@ -128,7 +138,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
ami_utf8_free(pass_utf8);
|
||||
}
|
||||
|
||||
lw->objects[OID_MAIN] = WindowObj,
|
||||
lw->objects[OID_L_MAIN] = WindowObj,
|
||||
WA_ScreenTitle, ami_gui_get_screen_title(),
|
||||
WA_Title, nsurl_access(lw->url),
|
||||
WA_Activate, TRUE,
|
||||
@ -142,7 +152,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
WINDOW_IconifyGadget, FALSE,
|
||||
WINDOW_LockHeight,TRUE,
|
||||
WINDOW_Position, WPOS_CENTERSCREEN,
|
||||
WINDOW_ParentGroup, lw->objects[GID_MAIN] = LayoutVObj,
|
||||
WINDOW_ParentGroup, lw->objects[GID_L_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, StringObj,
|
||||
STRINGA_TextVal, lwc_string_data(lw->host),
|
||||
GA_ReadOnly,TRUE,
|
||||
@ -159,8 +169,8 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
LABEL_Text, lw->messages[AMI_LOGIN_MSG_REALM],
|
||||
LabelEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, lw->objects[GID_USER] = StringObj,
|
||||
GA_ID,GID_USER,
|
||||
LAYOUT_AddChild, lw->objects[GID_L_USER] = StringObj,
|
||||
GA_ID,GID_L_USER,
|
||||
GA_TabCycle,TRUE,
|
||||
STRINGA_TextVal, lw->uname,
|
||||
StringEnd,
|
||||
@ -168,8 +178,8 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
LABEL_Text, lw->messages[AMI_LOGIN_MSG_USER],
|
||||
LabelEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, lw->objects[GID_PASS] = StringObj,
|
||||
GA_ID,GID_PASS,
|
||||
LAYOUT_AddChild, lw->objects[GID_L_PASS] = StringObj,
|
||||
GA_ID,GID_L_PASS,
|
||||
STRINGA_HookType,SHK_PASSWORD,
|
||||
GA_TabCycle,TRUE,
|
||||
STRINGA_TextVal, lw->pwd,
|
||||
@ -179,15 +189,15 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
LabelEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, LayoutHObj,
|
||||
LAYOUT_AddChild, lw->objects[GID_LOGIN] = ButtonObj,
|
||||
GA_ID,GID_LOGIN,
|
||||
LAYOUT_AddChild, lw->objects[GID_L_LOGIN] = ButtonObj,
|
||||
GA_ID,GID_L_LOGIN,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text, lw->messages[AMI_LOGIN_MSG_LOGIN],
|
||||
GA_TabCycle,TRUE,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, lw->objects[GID_CANCEL] = ButtonObj,
|
||||
GA_ID,GID_CANCEL,
|
||||
LAYOUT_AddChild, lw->objects[GID_L_CANCEL] = ButtonObj,
|
||||
GA_ID,GID_L_CANCEL,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text, lw->messages[AMI_LOGIN_MSG_CANCEL],
|
||||
GA_TabCycle,TRUE,
|
||||
@ -197,7 +207,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
EndGroup,
|
||||
EndWindow;
|
||||
|
||||
lw->win = (struct Window *)RA_OpenWindow(lw->objects[OID_MAIN]);
|
||||
lw->win = (struct Window *)RA_OpenWindow(lw->objects[OID_L_MAIN]);
|
||||
ami_gui_win_list_add(lw, AMINS_LOGINWINDOW, &ami_login_table);
|
||||
|
||||
return NSERROR_OK;
|
||||
@ -211,7 +221,7 @@ static void ami_401login_close(void *w)
|
||||
if (lw->cb != NULL)
|
||||
lw->cb(NULL, NULL, lw->cbpw);
|
||||
|
||||
DisposeObject(lw->objects[OID_MAIN]);
|
||||
DisposeObject(lw->objects[OID_L_MAIN]);
|
||||
lwc_string_unref(lw->host);
|
||||
nsurl_unref(lw->url);
|
||||
free(lw->realm);
|
||||
@ -230,8 +240,8 @@ static void ami_401login_login(struct gui_login_window *lw)
|
||||
char *pass;
|
||||
|
||||
/* Get username and password from string gadgets */
|
||||
GetAttr(STRINGA_TextVal,lw->objects[GID_USER],(ULONG *)&user);
|
||||
GetAttr(STRINGA_TextVal,lw->objects[GID_PASS],(ULONG *)&pass);
|
||||
GetAttr(STRINGA_TextVal,lw->objects[GID_L_USER],(ULONG *)&user);
|
||||
GetAttr(STRINGA_TextVal,lw->objects[GID_L_PASS],(ULONG *)&pass);
|
||||
|
||||
/* Convert from local charset to UTF-8 */
|
||||
char *user_utf8 = ami_to_utf8_easy(user);
|
||||
@ -260,19 +270,19 @@ static BOOL ami_401login_event(void *w)
|
||||
ULONG result;
|
||||
uint16 code;
|
||||
|
||||
while((result = RA_HandleInput(lw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
|
||||
while((result = RA_HandleInput(lw->objects[OID_L_MAIN], &code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_GADGETUP:
|
||||
switch(result & WMHI_GADGETMASK)
|
||||
{
|
||||
case GID_LOGIN:
|
||||
case GID_L_LOGIN:
|
||||
ami_401login_login(lw);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case GID_CANCEL:
|
||||
case GID_L_CANCEL:
|
||||
ami_401login_close(lw);
|
||||
return TRUE;
|
||||
break;
|
||||
|
@ -73,6 +73,20 @@ bool ami_print_dump(void);
|
||||
void ami_print_progress(void);
|
||||
void ami_print_close_device(void);
|
||||
|
||||
enum
|
||||
{
|
||||
POID_MAIN = 0,
|
||||
POID_LAST,
|
||||
PGID_MAIN,
|
||||
PGID_PRINTER,
|
||||
PGID_SCALE,
|
||||
PGID_COPIES,
|
||||
PGID_PRINT,
|
||||
PGID_CANCEL,
|
||||
PGID_STATUS,
|
||||
PGID_LAST
|
||||
};
|
||||
|
||||
const struct printer amiprinter = {
|
||||
&amiplot,
|
||||
ami_print_begin,
|
||||
@ -91,30 +105,19 @@ struct ami_printer_info
|
||||
struct print_settings *ps;
|
||||
int page;
|
||||
int pages;
|
||||
Object *gadgets[GID_LAST];
|
||||
Object *objects[OID_LAST];
|
||||
Object *gadgets[PGID_LAST];
|
||||
Object *objects[POID_LAST];
|
||||
struct Window *win;
|
||||
};
|
||||
|
||||
struct ami_print_window {
|
||||
struct ami_generic_window w;
|
||||
struct Window *win;
|
||||
Object *objects[OID_LAST];
|
||||
Object *gadgets[GID_LAST];
|
||||
Object *objects[POID_LAST];
|
||||
Object *gadgets[PGID_LAST];
|
||||
struct hlcache_handle *c;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PGID_MAIN=0,
|
||||
PGID_PRINTER,
|
||||
PGID_SCALE,
|
||||
PGID_COPIES,
|
||||
PGID_PRINT,
|
||||
PGID_CANCEL,
|
||||
PGID_LAST
|
||||
};
|
||||
|
||||
#define IFFPrefChunkCnt 2
|
||||
static LONG IFFPrefChunks[] =
|
||||
{
|
||||
@ -265,7 +268,7 @@ void ami_print_ui(struct hlcache_handle *c)
|
||||
|
||||
ami_print_ui_setup();
|
||||
|
||||
pw->objects[OID_MAIN] = WindowObj,
|
||||
pw->objects[POID_MAIN] = WindowObj,
|
||||
WA_ScreenTitle, ami_gui_get_screen_title(),
|
||||
WA_Title, gadlab[PGID_PRINT],
|
||||
WA_Activate, TRUE,
|
||||
@ -328,7 +331,7 @@ void ami_print_ui(struct hlcache_handle *c)
|
||||
GA_TabCycle,TRUE,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, pw->gadgets[GID_CANCEL] = ButtonObj,
|
||||
LAYOUT_AddChild, pw->gadgets[PGID_CANCEL] = ButtonObj,
|
||||
GA_ID, PGID_CANCEL,
|
||||
GA_RelVerify, TRUE,
|
||||
GA_Text, gadlab[PGID_CANCEL],
|
||||
@ -339,13 +342,13 @@ void ami_print_ui(struct hlcache_handle *c)
|
||||
EndGroup,
|
||||
EndWindow;
|
||||
|
||||
pw->win = (struct Window *)RA_OpenWindow(pw->objects[OID_MAIN]);
|
||||
pw->win = (struct Window *)RA_OpenWindow(pw->objects[POID_MAIN]);
|
||||
ami_gui_win_list_add(pw, AMINS_PRINTWINDOW, &ami_print_table);
|
||||
}
|
||||
|
||||
static void ami_print_close(struct ami_print_window *pw)
|
||||
{
|
||||
DisposeObject(pw->objects[OID_MAIN]);
|
||||
DisposeObject(pw->objects[POID_MAIN]);
|
||||
ami_gui_win_list_remove(pw);
|
||||
|
||||
ami_print_ui_free();
|
||||
@ -362,7 +365,7 @@ static BOOL ami_print_event(void *w)
|
||||
int print_scale;
|
||||
int printer_unit;
|
||||
|
||||
while((result = RA_HandleInput(pw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
|
||||
while((result = RA_HandleInput(pw->objects[POID_MAIN],&code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
@ -509,7 +512,7 @@ bool ami_print_next_page(void)
|
||||
{
|
||||
ami_print_info.page++;
|
||||
|
||||
RefreshSetGadgetAttrs((struct Gadget *)ami_print_info.gadgets[GID_STATUS],
|
||||
RefreshSetGadgetAttrs((struct Gadget *)ami_print_info.gadgets[PGID_STATUS],
|
||||
ami_print_info.win, NULL,
|
||||
FUELGAUGE_Level, ami_print_info.page,
|
||||
TAG_DONE);
|
||||
@ -519,7 +522,7 @@ bool ami_print_next_page(void)
|
||||
void ami_print_end(void)
|
||||
{
|
||||
ami_plot_ra_free(ami_print_info.gg);
|
||||
DisposeObject(ami_print_info.objects[OID_MAIN]);
|
||||
DisposeObject(ami_print_info.objects[POID_MAIN]);
|
||||
|
||||
ami_print_close_device();
|
||||
ami_print_free();
|
||||
@ -554,7 +557,7 @@ bool ami_print_dump(void)
|
||||
|
||||
void ami_print_progress(void)
|
||||
{
|
||||
ami_print_info.objects[OID_MAIN] = WindowObj,
|
||||
ami_print_info.objects[POID_MAIN] = WindowObj,
|
||||
WA_ScreenTitle, ami_gui_get_screen_title(),
|
||||
WA_Title, messages_get("Printing"),
|
||||
WA_Activate, TRUE,
|
||||
@ -568,9 +571,9 @@ void ami_print_progress(void)
|
||||
WINDOW_IconifyGadget, FALSE,
|
||||
WINDOW_LockHeight,TRUE,
|
||||
WINDOW_Position, WPOS_CENTERSCREEN,
|
||||
WINDOW_ParentGroup, ami_print_info.gadgets[GID_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, ami_print_info.gadgets[GID_STATUS] = FuelGaugeObj,
|
||||
GA_ID,GID_STATUS,
|
||||
WINDOW_ParentGroup, ami_print_info.gadgets[PGID_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, ami_print_info.gadgets[PGID_STATUS] = FuelGaugeObj,
|
||||
GA_ID,PGID_STATUS,
|
||||
FUELGAUGE_Min,0,
|
||||
FUELGAUGE_Max,ami_print_info.pages,
|
||||
FUELGAUGE_Level,0,
|
||||
@ -582,8 +585,8 @@ void ami_print_progress(void)
|
||||
CHILD_NominalSize,TRUE,
|
||||
CHILD_WeightedHeight,0,
|
||||
/*
|
||||
LAYOUT_AddChild, ami_print_info.gadgets[GID_CANCEL] = ButtonObj,
|
||||
GA_ID,GID_CANCEL,
|
||||
LAYOUT_AddChild, ami_print_info.gadgets[PGID_CANCEL] = ButtonObj,
|
||||
GA_ID,PGID_CANCEL,
|
||||
GA_Disabled,TRUE,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text,messages_get("Abort"),
|
||||
@ -593,6 +596,6 @@ void ami_print_progress(void)
|
||||
EndGroup,
|
||||
EndWindow;
|
||||
|
||||
ami_print_info.win = (struct Window *)RA_OpenWindow(ami_print_info.objects[OID_MAIN]);
|
||||
ami_print_info.win = (struct Window *)RA_OpenWindow(ami_print_info.objects[POID_MAIN]);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "amiga/search.h"
|
||||
#include "amiga/object.h"
|
||||
#include "amiga/theme.h"
|
||||
#include "amiga/utf8.h"
|
||||
|
||||
#ifndef NOF_ELEMENTS
|
||||
#define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
|
||||
@ -68,10 +69,22 @@
|
||||
|
||||
static bool search_insert;
|
||||
|
||||
enum
|
||||
{
|
||||
OID_S_MAIN = 0,
|
||||
GID_S_MAIN,
|
||||
GID_S_NEXT,
|
||||
GID_S_PREV,
|
||||
GID_S_SEARCHSTRING,
|
||||
GID_S_SHOWALL,
|
||||
GID_S_CASE,
|
||||
GID_S_LAST
|
||||
};
|
||||
|
||||
struct find_window {
|
||||
struct ami_generic_window w;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
Object *objects[GID_S_LAST];
|
||||
struct gui_window *gwin;
|
||||
};
|
||||
|
||||
@ -131,7 +144,7 @@ void ami_search_open(struct gui_window *gwin)
|
||||
|
||||
fwin = calloc(1, sizeof(struct find_window));
|
||||
|
||||
fwin->objects[OID_MAIN] = WindowObj,
|
||||
fwin->objects[OID_S_MAIN] = WindowObj,
|
||||
WA_ScreenTitle, ami_gui_get_screen_title(),
|
||||
WA_Title,messages_get("FindTextNS"),
|
||||
WA_Activate, TRUE,
|
||||
@ -145,22 +158,22 @@ void ami_search_open(struct gui_window *gwin)
|
||||
WINDOW_IconifyGadget, FALSE,
|
||||
WINDOW_LockHeight,TRUE,
|
||||
WINDOW_Position, WPOS_CENTERSCREEN,
|
||||
WINDOW_ParentGroup, fwin->objects[GID_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, fwin->objects[GID_SEARCHSTRING] = StringObj,
|
||||
GA_ID,GID_SEARCHSTRING,
|
||||
WINDOW_ParentGroup, fwin->objects[GID_S_MAIN] = LayoutVObj,
|
||||
LAYOUT_AddChild, fwin->objects[GID_S_SEARCHSTRING] = StringObj,
|
||||
GA_ID,GID_S_SEARCHSTRING,
|
||||
GA_TabCycle,TRUE,
|
||||
GA_RelVerify,TRUE,
|
||||
StringEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, fwin->objects[GID_CASE] = CheckBoxObj,
|
||||
GA_ID,GID_CASE,
|
||||
LAYOUT_AddChild, fwin->objects[GID_S_CASE] = CheckBoxObj,
|
||||
GA_ID,GID_S_CASE,
|
||||
GA_Text,messages_get("CaseSens"),
|
||||
GA_Selected,FALSE,
|
||||
GA_TabCycle,TRUE,
|
||||
GA_RelVerify,TRUE,
|
||||
CheckBoxEnd,
|
||||
LAYOUT_AddChild, fwin->objects[GID_SHOWALL] = CheckBoxObj,
|
||||
GA_ID,GID_SHOWALL,
|
||||
LAYOUT_AddChild, fwin->objects[GID_S_SHOWALL] = CheckBoxObj,
|
||||
GA_ID,GID_S_SHOWALL,
|
||||
GA_Text,messages_get("ShowAll"),
|
||||
GA_Selected,FALSE,
|
||||
GA_TabCycle,TRUE,
|
||||
@ -168,16 +181,16 @@ void ami_search_open(struct gui_window *gwin)
|
||||
CheckBoxEnd,
|
||||
|
||||
LAYOUT_AddChild, LayoutHObj,
|
||||
LAYOUT_AddChild, fwin->objects[GID_PREV] = ButtonObj,
|
||||
GA_ID,GID_PREV,
|
||||
LAYOUT_AddChild, fwin->objects[GID_S_PREV] = ButtonObj,
|
||||
GA_ID,GID_S_PREV,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text,messages_get("Prev"),
|
||||
GA_TabCycle,TRUE,
|
||||
GA_Disabled,TRUE,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, fwin->objects[GID_NEXT] = ButtonObj,
|
||||
GA_ID,GID_NEXT,
|
||||
LAYOUT_AddChild, fwin->objects[GID_S_NEXT] = ButtonObj,
|
||||
GA_ID,GID_S_NEXT,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Text,messages_get("Next"),
|
||||
GA_TabCycle,TRUE,
|
||||
@ -188,20 +201,20 @@ void ami_search_open(struct gui_window *gwin)
|
||||
EndGroup,
|
||||
EndWindow;
|
||||
|
||||
fwin->win = (struct Window *)RA_OpenWindow(fwin->objects[OID_MAIN]);
|
||||
fwin->win = (struct Window *)RA_OpenWindow(fwin->objects[OID_S_MAIN]);
|
||||
fwin->gwin = gwin;
|
||||
ami_gui_win_list_add(fwin, AMINS_FINDWINDOW, &ami_search_table);
|
||||
gwin->shared->searchwin = fwin;
|
||||
|
||||
ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_MAIN], fwin->win,
|
||||
NULL, (ULONG)fwin->objects[GID_SEARCHSTRING]);
|
||||
ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_S_MAIN], fwin->win,
|
||||
NULL, (ULONG)fwin->objects[GID_S_SEARCHSTRING]);
|
||||
}
|
||||
|
||||
void ami_search_close(void)
|
||||
{
|
||||
browser_window_search_clear(fwin->gwin->bw);
|
||||
fwin->gwin->shared->searchwin = NULL;
|
||||
DisposeObject(fwin->objects[OID_MAIN]);
|
||||
DisposeObject(fwin->objects[OID_S_MAIN]);
|
||||
ami_gui_win_list_remove(fwin);
|
||||
fwin = NULL;
|
||||
}
|
||||
@ -213,29 +226,29 @@ static BOOL ami_search_event(void *w)
|
||||
uint16 code;
|
||||
search_flags_t flags;
|
||||
|
||||
while((result = RA_HandleInput(fwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
|
||||
while((result = RA_HandleInput(fwin->objects[OID_S_MAIN],&code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_GADGETUP:
|
||||
switch(result & WMHI_GADGETMASK)
|
||||
{
|
||||
case GID_SEARCHSTRING:
|
||||
case GID_S_SEARCHSTRING:
|
||||
browser_window_search_clear(fwin->gwin->bw);
|
||||
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_S_PREV],
|
||||
fwin->win, NULL,
|
||||
GA_Disabled, FALSE,
|
||||
TAG_DONE);
|
||||
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_S_NEXT],
|
||||
fwin->win, NULL,
|
||||
GA_Disabled, FALSE,
|
||||
TAG_DONE);
|
||||
|
||||
/* fall through */
|
||||
|
||||
case GID_NEXT:
|
||||
case GID_S_NEXT:
|
||||
search_insert = true;
|
||||
flags = SEARCH_FLAG_FORWARDS |
|
||||
ami_search_flags();
|
||||
@ -246,7 +259,7 @@ static BOOL ami_search_event(void *w)
|
||||
ActivateWindow(fwin->gwin->shared->win);
|
||||
break;
|
||||
|
||||
case GID_PREV:
|
||||
case GID_S_PREV:
|
||||
search_insert = true;
|
||||
flags = ~SEARCH_FLAG_FORWARDS &
|
||||
ami_search_flags();
|
||||
@ -299,7 +312,7 @@ void ami_search_set_hourglass(bool active, void *p)
|
||||
char *ami_search_string(void)
|
||||
{
|
||||
char *text;
|
||||
GetAttr(STRINGA_TextVal,fwin->objects[GID_SEARCHSTRING],(ULONG *)&text);
|
||||
GetAttr(STRINGA_TextVal,fwin->objects[GID_S_SEARCHSTRING],(ULONG *)&text);
|
||||
return text;
|
||||
|
||||
}
|
||||
@ -325,7 +338,7 @@ void ami_search_add_recent(const char *string, void *p)
|
||||
|
||||
void ami_search_set_forward_state(bool active, void *p)
|
||||
{
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_S_NEXT],
|
||||
fwin->win, NULL,
|
||||
GA_Disabled, active ? FALSE : TRUE, TAG_DONE);
|
||||
|
||||
@ -339,7 +352,7 @@ void ami_search_set_forward_state(bool active, void *p)
|
||||
|
||||
void ami_search_set_back_state(bool active, void *p)
|
||||
{
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
|
||||
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_S_PREV],
|
||||
fwin->win, NULL,
|
||||
GA_Disabled, active ? FALSE : TRUE, TAG_DONE);
|
||||
}
|
||||
@ -352,8 +365,8 @@ search_flags_t ami_search_flags(void)
|
||||
{
|
||||
ULONG case_sensitive, showall;
|
||||
search_flags_t flags;
|
||||
GetAttr(GA_Selected,fwin->objects[GID_CASE],(ULONG *)&case_sensitive);
|
||||
GetAttr(GA_Selected,fwin->objects[GID_SHOWALL],(ULONG *)&showall);
|
||||
GetAttr(GA_Selected,fwin->objects[GID_S_CASE],(ULONG *)&case_sensitive);
|
||||
GetAttr(GA_Selected,fwin->objects[GID_S_SHOWALL],(ULONG *)&showall);
|
||||
flags = 0 | (case_sensitive ? SEARCH_FLAG_CASE_SENSITIVE : 0) |
|
||||
(showall ? SEARCH_FLAG_SHOWALL : 0);
|
||||
return flags;
|
||||
|
Loading…
Reference in New Issue
Block a user