Commit 94d0510d authored by David Brown's avatar David Brown
Browse files

Choices now allows gadgets to be in any subwindow with some limitations which...

Choices now allows gadgets to be in any subwindow with some limitations which are addressed in the header file.  Also there is no longer a concept of named subwindows.
parent 26638448
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -60,20 +60,20 @@
/* Locals */
char *consonant = "bcdfghjklmnpqrstvwxyz";
char *vowel = "aeiou";
static char *consonant = "bcdfghjklmnpqrstvwxyz";
static char *vowel = "aeiou";
static int * subwindows = NULL;
static ObjectId current_subwindow = CDSubNone;
static ObjectId colourdbox_id = 0;
static ObjectId * subwindows = NULL;
static int current_subwindow = CDSubNone;
static ObjectId colourdbox_id = 0;
static int save_ticked = -1;
static int disp_ticked = -1;
static int save_ticked = -1;
static int disp_ticked = -1;
static int choices_modechanged = 0;
global_choices * new_choices = NULL;
ObjectId choices_windowid = 0;
global_choices * new_choices = NULL;
ObjectId choices_windowid = 0;
/* Static function prototypes */
......@@ -96,9 +96,11 @@ static int choices_save_m_click_handler (int eventcode, Toolbox
static int choices_option_state_handler (int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle);
static int choices_redraw_fakepage_handler (int eventcode, WimpPollBlock * event, IdBlock * id_block, void * handle);
static int choices_open_choice_window (int eventcode, WimpPollBlock * event, IdBlock * id_block, void * handle);
static _kernel_oserror * choices_colour_set_component (ObjectId window, ComponentId component, int colour);
static _kernel_oserror * choices_set_save_field (ObjectId obj, ComponentId comp, int state);
static _kernel_oserror * choices_set_display_field (ObjectId obj, ComponentId comp, int state);
static ObjectId choices_find_component (ComponentId component);
/*************************************************/
/* choices_show_subwindow() */
......@@ -233,6 +235,7 @@ static _kernel_oserror * choices_show_subwindow(ObjectId choices_window, int sub
int choices_to_be_shown(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
_kernel_oserror *e;
ObjectId window;
#ifdef TRACE
if (tl & (1u<<29)) Printf("choices_to_be_shown: Called\n");
......@@ -269,19 +272,21 @@ int choices_to_be_shown(int eventcode, ToolboxEvent * event, IdBlock * idb, void
/* Create all choices subwindows. Set their ObjectIds to NULL if they cannot be created */
e = toolbox_create_object(0, "ChSub0", subwindows + CDSubBrowseDefaults); if (e) subwindows[CDSubBrowseDefaults] = NULL;
e = toolbox_create_object(0, "ChSub1", subwindows + CDSubWindows); if (e) subwindows[CDSubWindows] = NULL;
e = toolbox_create_object(0, "ChSub2", subwindows + CDSubColours); if (e) subwindows[CDSubColours] = NULL;
e = toolbox_create_object(0, "ChSub3", subwindows + CDSubFonts); if (e) subwindows[CDSubFonts] = NULL;
e = toolbox_create_object(0, "ChSub4", subwindows + CDSubHotlist); if (e) subwindows[CDSubHotlist] = NULL;
e = toolbox_create_object(0, "ChSub5", subwindows + CDSubHistory); if (e) subwindows[CDSubHistory] = NULL;
e = toolbox_create_object(0, "ChSub6", subwindows + CDSubSub6); if (e) subwindows[CDSubSub6] = NULL;
e = toolbox_create_object(0, "ChSub7", subwindows + CDSubSub7); if (e) subwindows[CDSubSub7] = NULL;
e = toolbox_create_object(0, "ChSub8", subwindows + CDSubSub8); if (e) subwindows[CDSubSub8] = NULL;
/* Might be worth changing this to a loop in the future */
e = toolbox_create_object(0, "ChSub0", &subwindows[0]); if (e) subwindows[0] = NULL;
e = toolbox_create_object(0, "ChSub1", &subwindows[1]); if (e) subwindows[1] = NULL;
e = toolbox_create_object(0, "ChSub2", &subwindows[2]); if (e) subwindows[2] = NULL;
e = toolbox_create_object(0, "ChSub3", &subwindows[3]); if (e) subwindows[3] = NULL;
e = toolbox_create_object(0, "ChSub4", &subwindows[4]); if (e) subwindows[4] = NULL;
e = toolbox_create_object(0, "ChSub5", &subwindows[5]); if (e) subwindows[5] = NULL;
e = toolbox_create_object(0, "ChSub6", &subwindows[6]); if (e) subwindows[6] = NULL;
e = toolbox_create_object(0, "ChSub7", &subwindows[7]); if (e) subwindows[7] = NULL;
e = toolbox_create_object(0, "ChSub8", &subwindows[8]); if (e) subwindows[8] = NULL;
ChkError(choices_show_subwindow(idb->self_id, CDSubBrowseDefaults));
ChkError(choices_show_subwindow(idb->self_id, 0));
ChkError(radiobutton_set_state(0, idb->self_id, CDBrowseDefaults, 1));
ChkError(radiobutton_set_state(0, idb->self_id, CDFirstSubRadio + 0, 1));
ChkError(choices_set_contents());
......@@ -301,9 +306,13 @@ int choices_to_be_shown(int eventcode, ToolboxEvent * event, IdBlock * idb, void
if (!e) e = event_register_toolbox_handler(-1, ECD_HiSaveBt, choices_save_m_button_handler, NULL);
if (!e) e = event_register_toolbox_handler(-1, ECDSaveMenuClick, choices_save_m_click_handler, NULL);
if (!e) e = event_register_toolbox_handler(-1, ECDDispMenuClick, choices_display_m_click_handler, NULL);
if (!e) e = event_register_toolbox_handler(subwindows[CDSubBrowseDefaults], OptionButton_StateChanged, choices_option_state_handler, NULL);
if (!e) e = event_register_toolbox_handler(-1, OptionButton_StateChanged, choices_option_state_handler, NULL);
if ((window = choices_find_component(CD_FakePage)) != 0)
{
if (!e) e = event_register_wimp_handler(window, Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
}
if (!e) e = event_register_wimp_handler(*(subwindows + CDSubColours), Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
if (!e) e = event_register_wimp_handler(idb->self_id, Wimp_EOpenWindow, choices_open_choice_window, NULL);
/* Deal with errors */
......@@ -321,9 +330,13 @@ int choices_to_be_shown(int eventcode, ToolboxEvent * event, IdBlock * idb, void
event_deregister_toolbox_handler(-1, ECD_HiSaveBt, choices_save_m_button_handler, NULL);
event_deregister_toolbox_handler(-1, ECDSaveMenuClick, choices_save_m_click_handler, NULL);
event_deregister_toolbox_handler(-1, ECDDispMenuClick, choices_display_m_click_handler, NULL);
event_deregister_toolbox_handler(subwindows[CDSubBrowseDefaults], OptionButton_StateChanged, choices_option_state_handler, NULL);
event_deregister_toolbox_handler(-1, OptionButton_StateChanged, choices_option_state_handler, NULL);
if ((window = choices_find_component(CD_FakePage)) != 0)
{
event_deregister_wimp_handler(window, Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
}
event_deregister_wimp_handler(*(subwindows + CDSubColours), Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
event_deregister_wimp_handler(idb->self_id, Wimp_EOpenWindow, choices_open_choice_window, NULL);
ChkError(e);
......@@ -373,6 +386,7 @@ static void choices_delete_subwindows(void)
int choices_hidden(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
_kernel_oserror * e;
ObjectId window;
/* Close subwindow */
......@@ -397,9 +411,12 @@ int choices_hidden(int eventcode, ToolboxEvent * event, IdBlock * idb, void * ha
event_deregister_toolbox_handler(-1, ECD_HiSaveBt, choices_save_m_button_handler, NULL);
event_deregister_toolbox_handler(-1, ECDSaveMenuClick, choices_save_m_click_handler, NULL);
event_deregister_toolbox_handler(-1, ECDDispMenuClick, choices_display_m_click_handler, NULL);
event_deregister_toolbox_handler(subwindows[CDSubBrowseDefaults], OptionButton_StateChanged, choices_option_state_handler, NULL);
event_deregister_toolbox_handler(-1, OptionButton_StateChanged, choices_option_state_handler, NULL);
event_deregister_wimp_handler(*(subwindows + CDSubColours), Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
if ((window = choices_find_component(CD_FakePage)) != 0)
{
event_deregister_wimp_handler(window, Wimp_ERedrawWindow, choices_redraw_fakepage_handler, NULL);
}
event_deregister_wimp_handler(idb->self_id, Wimp_EOpenWindow, choices_open_choice_window, NULL);
choices_windowid = 0;
......@@ -419,25 +436,19 @@ int choices_hidden(int eventcode, ToolboxEvent * event, IdBlock * idb, void * ha
static int choices_radio_click_handler(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
ObjectId window;
int window, state;
switch(idb->self_component)
radiobutton_get_state(0, idb->self_id, idb->self_component, &state, NULL);
/* Is this a radiobutton selected event? */
if (state)
{
case CDBrowseDefaults: window = CDSubBrowseDefaults; break;
case CDWindows: window = CDSubWindows; break;
case CDColours: window = CDSubColours; break;
case CDFonts: window = CDSubFonts; break;
case CDHotlist: window = CDSubHotlist; break;
case CDHistory: window = CDSubHistory; break;
case CDSub6: window = CDSubSub6; break;
case CDSub7: window = CDSubSub7; break;
case CDSub8: window = CDSubSub8; break;
default: window = CDNoSubwindows; break;
window = idb->self_component - CDFirstSubRadio;
if (window > CDNoSubwindows) window = CDSubNone;
choices_show_subwindow(idb->self_id, window);
}
choices_show_subwindow(idb->self_id, window);
return 1;
}
......@@ -453,59 +464,39 @@ static int choices_radio_click_handler(int eventcode, ToolboxEvent * event, IdBl
static _kernel_oserror * choices_set_contents(void)
{
ObjectId window;
/* No error handling here, as we want to allow items to be missing */
if (subwindows[CDSubBrowseDefaults])
{
writablefield_set_value(0, subwindows[CDSubBrowseDefaults], CD_Homepage, new_choices->home_page);
optionbutton_set_state(0, subwindows[CDSubBrowseDefaults], CD_UnderlineLinks, new_choices->underline_links);
optionbutton_set_state(0, subwindows[CDSubBrowseDefaults], CD_UseDocColours, new_choices->use_source_cols);
optionbutton_set_state(0, subwindows[CDSubBrowseDefaults], CD_ShowForeground, new_choices->show_foreground);
optionbutton_set_state(0, subwindows[CDSubBrowseDefaults], CD_ShowBackground, new_choices->show_background);
/* Get encoding name */
choices_set_encoding_field();
}
if (subwindows[CDSubWindows])
{
optionbutton_set_state(0, subwindows[CDSubWindows], CD_URLBar, new_choices->url_bar);
optionbutton_set_state(0, subwindows[CDSubWindows], CD_StatusBar, new_choices->status_bar);
optionbutton_set_state(0, subwindows[CDSubWindows], CD_ButtonBar, new_choices->button_bar);
optionbutton_set_state(0, subwindows[CDSubWindows], CD_FullScreen, new_choices->full_screen);
}
if (subwindows[CDSubColours])
{
choices_colour_set_component(subwindows[CDSubColours], CD_BackColour, new_choices->background_colour);
choices_colour_set_component(subwindows[CDSubColours], CD_TextColour, new_choices->text_colour);
choices_colour_set_component(subwindows[CDSubColours], CD_LinkColour, new_choices->link_colour);
choices_colour_set_component(subwindows[CDSubColours], CD_UsedColour, new_choices->used_colour);
choices_colour_set_component(subwindows[CDSubColours], CD_FolwColour, new_choices->followed_colour);
choices_colour_set_component(subwindows[CDSubColours], CD_SlctColour, new_choices->selected_colour);
}
if (subwindows[CDSubHotlist])
{
numberrange_set_value(0, subwindows[CDSubHotlist], CD_HlAutoOpen, new_choices->auto_open_delay);
numberrange_set_value(0, subwindows[CDSubHotlist], CD_HlAutoScroll, new_choices->auto_scroll_delay);
choices_set_display_field(subwindows[CDSubHotlist], CD_HlDispDisp, new_choices->hotlist_show);
choices_set_save_field(subwindows[CDSubHotlist], CD_HlSaveDisp, new_choices->save_hotlist);
}
if (subwindows[CDSubHistory])
{
numberrange_set_value(0, subwindows[CDSubHistory], CD_HiLines, new_choices->v_hist_size);
numberrange_set_value(0, subwindows[CDSubHistory], CD_HiMaxSize, new_choices->g_hist_size);
choices_set_display_field(subwindows[CDSubHistory], CD_HiDispDisp, new_choices->show_urls);
choices_set_save_field(subwindows[CDSubHistory], CD_HiSaveDisp, new_choices->save_history);
}
if ((window = choices_find_component(CD_Homepage)) != 0) writablefield_set_value(0, window, CD_Homepage, new_choices->home_page);
if ((window = choices_find_component(CD_UnderlineLinks)) != 0) optionbutton_set_state(0, window, CD_UnderlineLinks, new_choices->underline_links);
if ((window = choices_find_component(CD_UseDocColours)) != 0) optionbutton_set_state(0, window, CD_UseDocColours, new_choices->use_source_cols);
if ((window = choices_find_component(CD_ShowForeground)) != 0) optionbutton_set_state(0, window, CD_ShowForeground, new_choices->show_foreground);
if ((window = choices_find_component(CD_ShowBackground)) != 0) optionbutton_set_state(0, window, CD_ShowBackground, new_choices->show_background);
/* Get encoding name */
choices_set_encoding_field(); //
if ((window = choices_find_component(CD_URLBar)) != 0) optionbutton_set_state(0, window, CD_URLBar, new_choices->url_bar);
if ((window = choices_find_component(CD_StatusBar)) != 0) optionbutton_set_state(0, window, CD_StatusBar, new_choices->status_bar);
if ((window = choices_find_component(CD_ButtonBar)) != 0) optionbutton_set_state(0, window, CD_ButtonBar , new_choices->button_bar);
if ((window = choices_find_component(CD_FullScreen)) != 0) optionbutton_set_state(0, window, CD_FullScreen, new_choices->full_screen);
if ((window = choices_find_component(CD_BackColour)) != 0) choices_colour_set_component(window, CD_BackColour, new_choices->background_colour);
if ((window = choices_find_component(CD_TextColour)) != 0) choices_colour_set_component(window, CD_TextColour, new_choices->text_colour);
if ((window = choices_find_component(CD_LinkColour)) != 0) choices_colour_set_component(window, CD_LinkColour, new_choices->link_colour);
if ((window = choices_find_component(CD_UsedColour)) != 0) choices_colour_set_component(window, CD_UsedColour, new_choices->used_colour);
if ((window = choices_find_component(CD_FolwColour)) != 0) choices_colour_set_component(window, CD_FolwColour, new_choices->followed_colour);
if ((window = choices_find_component(CD_SlctColour)) != 0) choices_colour_set_component(window, CD_SlctColour, new_choices->selected_colour);
if ((window = choices_find_component(CD_HlAutoOpen)) != 0) numberrange_set_value(0, window, CD_HlAutoOpen, new_choices->auto_open_delay);
if ((window = choices_find_component(CD_HlAutoScroll)) != 0) numberrange_set_value(0, window, CD_HlAutoScroll, new_choices->auto_scroll_delay);
if ((window = choices_find_component(CD_HlDispDisp)) != 0) choices_set_display_field(window, CD_HlDispDisp, new_choices->hotlist_show);
if ((window = choices_find_component(CD_HlSaveDisp)) != 0) choices_set_save_field(window, CD_HlSaveDisp, new_choices->save_hotlist);
if ((window = choices_find_component(CD_HiLines)) != 0) numberrange_set_value(0, window, CD_HiLines, new_choices->v_hist_size);
if ((window = choices_find_component(CD_HiMaxSize)) != 0) numberrange_set_value(0, window, CD_HiMaxSize, new_choices->g_hist_size);
if ((window = choices_find_component(CD_HiDispDisp)) != 0) choices_set_display_field(window, CD_HiDispDisp, new_choices->show_urls);
if ((window = choices_find_component(CD_HiSaveDisp)) != 0) choices_set_save_field(window, CD_HiSaveDisp, new_choices->save_history);
return NULL;
}
......@@ -523,16 +514,16 @@ static _kernel_oserror * choices_get_contents(void)
_kernel_oserror * e;
WimpGetWindowStateBlock s;
browser_data * b;
ObjectId window;
char * tempstring;
int state;
int reqsize;
/* The lack of error chechking is to allow */
/* items to be missing from the dialogue. */
if (subwindows[CDSubBrowseDefaults])
if ((window = choices_find_component(CD_Homepage)) != 0)
{
e = writablefield_get_value(0, subwindows[CDSubBrowseDefaults], CD_Homepage, NULL, 0, &reqsize);
e = writablefield_get_value(0, window, CD_Homepage, NULL, 0, &reqsize);
if (!e)
{
......@@ -540,7 +531,7 @@ static _kernel_oserror * choices_get_contents(void)
if (tempstring)
{
e = writablefield_get_value(0, subwindows[CDSubBrowseDefaults], CD_Homepage, tempstring, reqsize, NULL);
e = writablefield_get_value(0, window, CD_Homepage, tempstring, reqsize, NULL);
if (!e)
{
......@@ -562,32 +553,11 @@ static _kernel_oserror * choices_get_contents(void)
}
}
if (subwindows[CDSubWindows])
{
e = optionbutton_get_state(0, subwindows[CDSubWindows], CD_URLBar, &state);
if (!e) new_choices->url_bar = !!state;
e = optionbutton_get_state(0, subwindows[CDSubWindows], CD_StatusBar, &state);
if (!e) new_choices->status_bar = !!state;
e = optionbutton_get_state(0, subwindows[CDSubWindows], CD_ButtonBar, &state);
if (!e) new_choices->button_bar = !!state;
e = optionbutton_get_state(0, subwindows[CDSubWindows], CD_FullScreen, &state);
if (!e) new_choices->full_screen = !!state;
}
if (subwindows[CDSubHotlist])
{
numberrange_get_value(0, subwindows[CDSubHotlist], CD_HlAutoOpen, &new_choices->auto_open_delay);
numberrange_get_value(0, subwindows[CDSubHotlist], CD_HlAutoScroll, &new_choices->auto_scroll_delay);
}
if ((window = choices_find_component(CD_HlAutoOpen)) != 0) numberrange_get_value(0, window, CD_HlAutoOpen, &new_choices->auto_open_delay);
if ((window = choices_find_component(CD_HlAutoScroll)) != 0) numberrange_get_value(0, window, CD_HlAutoScroll, &new_choices->auto_scroll_delay);
if (subwindows[CDSubHistory])
{
numberrange_get_value(0, subwindows[CDSubHistory], CD_HiLines, &new_choices->v_hist_size);
numberrange_get_value(0, subwindows[CDSubHistory], CD_HiMaxSize, &new_choices->g_hist_size);
}
if ((window = choices_find_component(CD_HiLines)) != 0) numberrange_get_value(0, window, CD_HiLines, &new_choices->v_hist_size);
if ((window = choices_find_component(CD_HiMaxSize)) != 0) numberrange_get_value(0, window, CD_HiMaxSize, &new_choices->g_hist_size);
memcpy(&choices, new_choices, sizeof(global_choices));
......@@ -659,10 +629,16 @@ static int choices_set_button_handler(int eventcode, ToolboxEvent * event, IdBlo
static int choices_cancel_button_handler(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
_kernel_oserror *e = NULL;
ObjectId window;
memcpy(new_choices, &choices, sizeof(global_choices));
choices_set_contents();
/* Attempt to redraw fake page display */
if ((window = choices_find_component(CD_FakePage)) != 0) button_set_flags(0, window, CD_FakePage, 0, 0);
if (e) show_error_ret(e);
return 1;
......@@ -685,6 +661,8 @@ static int choices_cancel_button_handler(int eventcode, ToolboxEvent * event, Id
static int choices_save_button_handler(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
_kernel_oserror *e = NULL;
ObjectId window;
e = choices_get_contents();
if (e)
{
......@@ -692,6 +670,10 @@ static int choices_save_button_handler(int eventcode, ToolboxEvent * event, IdBl
return 1;
}
/* Attempt to redraw fake page display */
if ((window = choices_find_component(CD_FakePage)) != 0) button_set_flags(0, window, CD_FakePage, 0, 0);
e = save_save_choices(NULL);
if (e) show_error_ret(e);
......@@ -709,11 +691,16 @@ static int choices_save_button_handler(int eventcode, ToolboxEvent * event, IdBl
_kernel_oserror * choices_set_encoding_field(void)
{
_kernel_oserror *e;
ObjectId objid;
ObjectId objid, destwind;
ComponentId compid;
char *textptr;
int sizereqd;
/* Find which window the encoding display is in */
destwind = choices_find_component(CD_EncodingDisply);
if (!destwind) return NULL;
/* Find menu item which contains encoding name */
if (encoding_get_encoding_item(new_choices->encoding, &objid, &compid))
......@@ -734,7 +721,7 @@ _kernel_oserror * choices_set_encoding_field(void)
free(textptr);
return e;
}
e = displayfield_set_value(0, subwindows[CDSubBrowseDefaults], CD_EncodingDisply, textptr);
e = displayfield_set_value(0, destwind, CD_EncodingDisply, textptr);
free(textptr);
if (e)
......@@ -751,7 +738,7 @@ _kernel_oserror * choices_set_encoding_field(void)
{
/* The encoding name could not be found in the menu structure */
RetError(displayfield_set_value(0, subwindows[CDSubBrowseDefaults], CD_EncodingDisply, "Unknown encoding")); //
RetError(displayfield_set_value(0, destwind, CD_EncodingDisply, "Unknown encoding")); //
}
return NULL;
......@@ -1449,7 +1436,6 @@ static int choices_redraw_fakepage_handler(int eventcode, WimpPollBlock * event,
WimpRedrawWindowBlock block;
WimpGetWindowStateBlock state;
int more, ypos, xtarget, ptsize, gadsize, xstart, nolines;
unsigned int flags;
int fontheight = 0;
int gotfont = 0;
BBox icon_coords, fbox;
......@@ -1486,22 +1472,22 @@ static int choices_redraw_fakepage_handler(int eventcode, WimpPollBlock * event,
nolines = 1; /* Start with one line (half at top, half at bottom) */
if (!gadget_get_flags(0, idb->self_id, CD_LinkColourBt, &flags))
if (choices_find_component(CD_LinkColourBt))
{
nolines ++;
display_this[0] = 1;
}
if (!gadget_get_flags(0, idb->self_id, CD_UsedColourBt, &flags))
if (choices_find_component(CD_UsedColourBt))
{
nolines ++;
display_this[1] = 1;
}
if (!gadget_get_flags(0, idb->self_id, CD_FolwColourBt, &flags))
if (choices_find_component(CD_FolwColourBt))
{
nolines ++;
display_this[2] = 1;
}
if (!gadget_get_flags(0, idb->self_id, CD_SlctColourBt, &flags))
if (choices_find_component(CD_SlctColourBt))
{
nolines ++;
display_this[3] = 1;
......@@ -1635,7 +1621,8 @@ static int choices_redraw_fakepage_handler(int eventcode, WimpPollBlock * event,
static int choices_option_state_handler(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
int state;
int state;
ObjectId window;
ChkError(optionbutton_get_state(0, idb->self_id, idb->self_component, &state));
switch(idb->self_component)
......@@ -1644,18 +1631,24 @@ static int choices_option_state_handler(int eventcode, ToolboxEvent * event, IdB
{
new_choices->underline_links = !!state;
/* Don't bother with errors as fake page display might not exist */
/* Attempt to redraw fake page display */
if (subwindows[CDSubColours])
{
button_set_flags(0, subwindows[CDSubColours], CD_FakePage, 0, 0);
}
if ((window = choices_find_component(CD_FakePage)) != 0) button_set_flags(0, window, CD_FakePage, 0, 0);
break;
}
case CD_UseDocColours: new_choices->use_source_cols = !!state; break;
case CD_ShowForeground: new_choices->show_foreground = !!state; break;
case CD_ShowBackground: new_choices->show_background = !!state; break;
case CD_URLBar: new_choices->url_bar = !!state; break;
case CD_StatusBar: new_choices->status_bar = !!state; break;
case CD_ButtonBar: new_choices->button_bar = !!state; break;
case CD_FullScreen: new_choices->full_screen = !!state; break;
/* Haven't recognised this option button event so pass it on */
default: return 0;
}
return 1;
......@@ -1698,3 +1691,32 @@ static int choices_open_choice_window(int eventcode, WimpPollBlock * event, IdBl
return 1;
}
/*************************************************/
/* choices_find_component() */
/* */
/* Scans all the choices subwindows for the */
/* requested component and returns the id of the */
/* first window in which it was seen. */
/* */
/* Parameters: The component to find. */
/* */
/* Returns: Where to return the object id to. */
/* 0 if the component was not found */
/*************************************************/
static ObjectId choices_find_component(ComponentId component)
{
int findwindow;
unsigned int flags;
for(findwindow = 0; findwindow < CDNoSubwindows; findwindow++)
{
if (subwindows[findwindow])
{
if (!gadget_get_flags(0, subwindows[findwindow], component, &flags)) return subwindows[findwindow];
}
}
return 0;
}
......@@ -28,17 +28,7 @@
#define CDSet 0x2600
#define CDCancel 0x2601
#define CDSaveButton 0x2602
#define CDBrowseDefaults 0x2603
#define CDWindows 0x2604
#define CDColours 0x2605
#define CDFonts 0x2606
#define CDHotlist 0x2607
#define CDHistory 0x2608
#define CDSub6 0x2609
#define CDSub7 0x260a
#define CDSub8 0x260b
#define CDFirstSubRadio 0x2603
#define CDPlaceHolder 0x260f
/* Choices main dialogue and menu event codes */
......@@ -68,20 +58,13 @@
/* Choices subwindows */
#define CDSubNone -1
#define CDSubBrowseDefaults 0
#define CDSubWindows 1
#define CDSubColours 2
#define CDSubFonts 3
#define CDSubHotlist 4
#define CDSubHistory 5
#define CDSubSub6 6
#define CDSubSub7 7
#define CDSubSub8 8
#define CDNoSubwindows 9
/* Choices Subwindow component ids */
/* In all cases there may only be one of each */
/* of these components. */
/* In BrowseDefaults sub window: */
#define CD_Homepage 0x2650
......@@ -101,6 +84,9 @@
/* In colours sub window: */
/* The colour display button MUST have a component id */
/* one less than it's equivalent menu button. */
#define CD_BackColour 0x2690
#define CD_BackColourBt 0x2691
#define CD_TextColour 0x2692
......@@ -113,6 +99,10 @@
#define CD_FolwColourBt 0x2699
#define CD_SlctColour 0x269a
#define CD_SlctColourBt 0x269b
/* The window in which the fake page button resides */
/* must not be auto redraw. */
#define CD_FakePage 0x269c
/* In fonts subwindow */
......@@ -121,6 +111,9 @@
/* In hotlist subwindow */
/* The Display fields must have component id one */
/* less than their equivalent menu buttons. */
#define CD_HlSaveDisp 0x26d0
#define CD_HlSaveBt 0x26d1
#define CD_HlDispDisp 0x26d2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment