+static int c_button(map_t*args) {
+ char*name = lu(args, "name");
+ s_button(name);
+ return 0;
+}
+static int current_button_flags = 0;
+static int c_on_press(map_t*args)
+{
+ char*position = lu(args, "position");
+ char*action = "";
+ if(!strcmp(position, "inside")) {
+ current_button_flags |= BC_OVERUP_OVERDOWN;
+ } else if(!strcmp(position, "outside")) {
+ //current_button_flags |= BC_IDLE_OUTDOWN;
+ syntaxerror("IDLE_OVERDOWN not supported by SWF");
+ } else if(!strcmp(position, "anywhere")) {
+ current_button_flags |= /*BC_IDLE_OUTDOWN|*/BC_OVERUP_OVERDOWN|BC_IDLE_OVERDOWN;
+ }
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_release(map_t*args)
+{
+ char*position = lu(args, "position");
+ char*action = "";
+ if(!strcmp(position, "inside")) {
+ current_button_flags |= BC_OVERDOWN_OVERUP;
+ } else if(!strcmp(position, "outside")) {
+ current_button_flags |= BC_OUTDOWN_IDLE;
+ } else if(!strcmp(position, "anywhere")) {
+ current_button_flags |= BC_OVERDOWN_OVERUP|BC_OUTDOWN_IDLE|BC_OVERDOWN_IDLE;
+ }
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_move_in(map_t*args)
+{
+ char*position = lu(args, "state");
+ char*action = "";
+ if(!strcmp(position, "pressed")) {
+ current_button_flags |= BC_OUTDOWN_OVERDOWN;
+ } else if(!strcmp(position, "not_pressed")) {
+ current_button_flags |= BC_IDLE_OVERUP;
+ } else if(!strcmp(position, "any")) {
+ current_button_flags |= BC_OUTDOWN_OVERDOWN|BC_IDLE_OVERUP|BC_IDLE_OVERDOWN;
+ }
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_move_out(map_t*args)
+{
+ char*position = lu(args, "state");
+ char*action = "";
+ if(!strcmp(position, "pressed")) {
+ current_button_flags |= BC_OVERDOWN_OUTDOWN;
+ } else if(!strcmp(position, "not_pressed")) {
+ current_button_flags |= BC_OVERUP_IDLE;
+ } else if(!strcmp(position, "any")) {
+ current_button_flags |= BC_OVERDOWN_OUTDOWN|BC_OVERUP_IDLE|BC_OVERDOWN_IDLE;
+ }
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_key(map_t*args)
+{
+ char*key = lu(args, "key");
+ char*action = "";
+ if(strlen(key)==1) {
+ /* ascii */
+ if(key[0]>=32) {
+ current_button_flags |= 0x4000 + (key[0]*0x200);
+ } else {
+ syntaxerror("invalid character: %c"+key[0]);
+ return 1;
+ }
+ } else {
+ /* TODO:
+ <ctrl-x> = 0x200*(x-'a')
+ esc = = 0x3600
+ space = = 0x4000;
+ */
+ syntaxerror("invalid key: %s",key);
+ }
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+
+static int c_edittext(map_t*args)
+{
+ //"name font size width height text="" color=black maxlength=0 variable="" @password=0 @wordwrap=0 @multiline=0 @html=0 @noselect=0 @readonly=0 @autosize=0"},
+ char*name = lu(args, "name");
+ char*font = lu(args, "font");
+ int size = (int)(1024*parsePxOrPercent(font, lu(args, "size")));
+ int width = parseTwip(lu(args, "width"));
+ int height = parseTwip(lu(args, "height"));
+ char*text = lu(args, "text");
+ RGBA color = parseColor(lu(args, "color"));
+ int maxlength = parseInt(lu(args, "maxlength"));
+ char*variable = lu(args, "variable");
+ char*passwordstr = lu(args, "password");
+ char*wordwrapstr = lu(args, "wordwrap");
+ char*multilinestr = lu(args, "multiline");
+ char*htmlstr = lu(args, "html");
+ char*noselectstr = lu(args, "noselect");
+ char*readonlystr = lu(args, "readonly");
+ char*borderstr = lu(args, "border");
+ char*autosizestr = lu(args, "autosize");
+ char*alignstr = lu(args, "align");
+ int align = -1;
+
+ int flags = 0;
+ if(!strcmp(passwordstr, "password")) flags |= ET_PASSWORD;
+ if(!strcmp(wordwrapstr, "wordwrap")) flags |= ET_WORDWRAP;
+ if(!strcmp(multilinestr, "multiline")) flags |= ET_MULTILINE;
+ if(!strcmp(readonlystr, "readonly")) flags |= ET_READONLY;
+ if(!strcmp(htmlstr, "html")) flags |= ET_HTML;
+ if(!strcmp(noselectstr, "noselect")) flags |= ET_NOSELECT;
+ if(!strcmp(borderstr, "border")) flags |= ET_BORDER;
+ if(!strcmp(autosizestr, "autosize")) flags |= ET_AUTOSIZE;
+ if(!strcmp(alignstr, "left") || !*alignstr) align = ET_ALIGN_LEFT;
+ else if(!strcmp(alignstr, "right")) align = ET_ALIGN_RIGHT;
+ else if(!strcmp(alignstr, "center")) align = ET_ALIGN_CENTER;
+ else if(!strcmp(alignstr, "justify")) align = ET_ALIGN_JUSTIFY;
+ else syntaxerror("Unknown alignment: %s", alignstr);
+
+ s_edittext(name, font, size, width, height, text, &color, maxlength, variable, flags, align);
+ return 0;
+}