Fri Dec 03 18:34:47 GMT 1999

(gilbertt)

Hrm. Bye bye hardcoding, hello malloc()ed context stack. Improved the test
app further.


SVN revision: 1484
This commit is contained in:
Tom Gilbert 1999-12-03 14:17:56 +00:00
parent 768eebf738
commit 137ade0aa3
3 changed files with 97 additions and 9 deletions

View File

@ -1169,3 +1169,11 @@ I actually needed to do was fix Epplet_draw_image - so I have :)
Lots more to do tonight :)
-------------------------------------------------------------------------------
Fri Dec 03 18:34:47 GMT 1999
(gilbertt)
Hrm. Bye bye hardcoding, hello malloc()ed context stack. Improved the test
app further.

View File

@ -14,8 +14,11 @@ static int window_num = 0; /* For window list */
static Epplet_window *windows = NULL; /* List of windows to loop though */
static Epplet_window context_win; /* Current context win */
static int window_stack_pos; /* For context changes */
static int window_stack_pos=0; /* For context changes */
#if 0
static Epplet_window window_stack[20]; /* For context changes */
#endif
static Epplet_window *window_stack; /* For context changes */
static Epplet_window mainwin; /* Always the main epplet window */
static ImlibData *id = NULL;
@ -529,6 +532,7 @@ Epplet_unregister_window(Epplet_window win)
}
}
#if 0
void
Epplet_window_push_context(Epplet_window newwin)
{
@ -545,12 +549,41 @@ Epplet_window Epplet_window_pop_context(void)
{
window_stack_pos--;
if (window_stack_pos < 1)
{
exit(1);
}
{
return NULL;
}
context_win = window_stack[window_stack_pos - 1];
return window_stack[window_stack_pos];
}
#endif
/***************************/
void
Epplet_window_push_context(Epplet_window newwin)
{
if (((window_stack=realloc(window_stack,sizeof(Epplet_window) * (window_stack_pos+1))) == NULL))
exit(1);
window_stack[window_stack_pos] = newwin;
window_stack_pos++;
context_win = newwin;
}
Epplet_window Epplet_window_pop_context(void)
{
Epplet_window ret;
window_stack_pos--;
ret=window_stack[window_stack_pos];
if (((window_stack=realloc(window_stack,sizeof(Epplet_window) * (window_stack_pos))) == NULL))
exit(1);
/* Window stack pos == 0 corresponds to the main epplet window */
if (window_stack_pos < 1)
return NULL;
context_win = window_stack[window_stack_pos - 1];
return ret;
}
/* Refresh window backgrounds on theme change */
static void

View File

@ -317,7 +317,7 @@ cb_out (void *data, Window w)
static void
btn_cb (void *data)
{
Epplet_window_destroy ((Epplet_window)data);
Epplet_window_destroy ((Epplet_window) data);
return;
}
@ -335,15 +335,15 @@ cb_shoot (void *data)
static int temp = 20;
static int temp2 = 50;
static int temp3 = 80;
Epplet_window mywin;
Epplet_window mywin, mywin2, mywin3;
Epplet_gadget sld, sld2, sld3, lbl, btn;
mywin =
Epplet_create_window (400, 400, 100, 100,
Epplet_create_window (400, 300, 100, 100,
"See! I told you this stuff was easy ;)");
Epplet_window_show (mywin);
Epplet_gadget_show (lbl =
Epplet_create_label (20, 10,
"Hello folks. I think its working :)",
"This window was created on its own.",
2));
Epplet_gadget_show (sld =
Epplet_create_hslider (20, 50, 100, 0, 100, 1, 5, &temp,
@ -355,11 +355,58 @@ cb_shoot (void *data)
Epplet_create_hslider (20, 150, 300, 0, 100, 1, 5,
&temp3, NULL, NULL));
Epplet_gadget_show (btn =
Epplet_create_button ("Close window", NULL, 290, 010,
Epplet_create_button ("Close window", NULL, 290, 270,
100, 20, NULL, 0, NULL, btn_cb,
mywin));
Epplet_window_pop_context ();
mywin2 =
Epplet_create_window (400, 300, 100, 100,
"See! I told you this stuff was easy ;)");
Epplet_window_show (mywin2);
Epplet_gadget_show (lbl =
Epplet_create_label (20, 10,
"This window was created first of two on the context stack.",
2));
Epplet_gadget_show (sld =
Epplet_create_hslider (20, 50, 100, 0, 100, 1, 5, &temp,
NULL, NULL));
Epplet_gadget_show (sld2 =
Epplet_create_hslider (20, 100, 200, 0, 100, 1, 5,
&temp2, NULL, NULL));
Epplet_gadget_show (sld3 =
Epplet_create_hslider (20, 150, 300, 0, 100, 1, 5,
&temp3, NULL, NULL));
Epplet_gadget_show (btn =
Epplet_create_button ("Close window", NULL, 290, 270,
100, 20, NULL, 0, NULL, btn_cb,
mywin2));
mywin3 =
Epplet_create_window (400, 300, 100, 100,
"See! I told you this stuff was easy ;)");
Epplet_window_show (mywin3);
Epplet_gadget_show (lbl =
Epplet_create_label (20, 10,
"This window was created second of two on the context stack.",
2));
Epplet_gadget_show (sld =
Epplet_create_hslider (20, 50, 100, 0, 100, 1, 5, &temp,
NULL, NULL));
Epplet_gadget_show (sld2 =
Epplet_create_hslider (20, 100, 200, 0, 100, 1, 5,
&temp2, NULL, NULL));
Epplet_gadget_show (sld3 =
Epplet_create_hslider (20, 150, 300, 0, 100, 1, 5,
&temp3, NULL, NULL));
Epplet_gadget_show (btn =
Epplet_create_button ("Close window", NULL, 290, 270,
100, 20, NULL, 0, NULL, btn_cb,
mywin3));
Epplet_window_pop_context ();
Epplet_window_pop_context ();
return;
data = NULL;
}