about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2011-05-19 23:49:11 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2011-05-19 23:49:11 -0400
commit018a486c2b209618cfc30be7728349c1617e0e5a (patch)
treed9f957a3c1c6c4684764c4aca17cc10b896840fa /src
parent5a82c9fe06ff24c8e6ddcd72ca840efec3a710dc (diff)
downloadlynx-snapshots-018a486c2b209618cfc30be7728349c1617e0e5a.tar.gz
snapshot of project "lynx", label v2-8-8dev_8d
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c5
-rw-r--r--src/HTForms.h6
-rw-r--r--src/HTML.c14
-rw-r--r--src/HTML.h3
-rw-r--r--src/LYForms.c46
-rw-r--r--src/LYMainLoop.c12
-rw-r--r--src/structdump.h3
7 files changed, 51 insertions, 38 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 6d382d59..6b59f7b6 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.207 2010/11/22 12:55:04 tom Exp $
+ * $LynxId: GridText.c,v 1.209 2011/05/19 23:18:02 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -10081,6 +10081,7 @@ int HText_beginInput(HText *text,
     f->select_list = 0;
     f->number = HTFormNumber;
     f->disabled = HTFormDisabled || I->disabled;
+    f->readonly = I->readonly;
     f->no_cache = NO;
 
     HTFormFields++;
@@ -12680,6 +12681,7 @@ static void insert_new_textarea_anchor(TextAnchor **curr_anchor, HTLine **exit_h
     f->maxlength = anchor->input_field->maxlength;
     f->no_cache = anchor->input_field->no_cache;
     f->disabled = anchor->input_field->disabled;
+    f->readonly = anchor->input_field->readonly;
     f->value_cs = current_char_set;	/* use current setting - kw */
 
     /*  Init all the fields in the new HTLine (but see the #if).   */
@@ -13521,6 +13523,7 @@ int HText_InsertFile(LinkInfo * form_link)
     f->maxlength = anchor_ptr->input_field->maxlength;
     f->no_cache = anchor_ptr->input_field->no_cache;
     f->disabled = anchor_ptr->input_field->disabled;
+    f->readonly = anchor_ptr->input_field->readonly;
     f->value_cs = (file_cs >= 0) ? file_cs : current_char_set;
 
     /*  Init all the fields in the new HTLine (but see the #if).   */
diff --git a/src/HTForms.h b/src/HTForms.h
index 59903231..cfe3ad12 100644
--- a/src/HTForms.h
+++ b/src/HTForms.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTForms.h,v 1.28 2010/09/24 09:40:07 tom Exp $
+ * $LynxId: HTForms.h,v 1.29 2011/05/19 10:53:07 tom Exp $
  */
 #ifndef HTFORMS_H
 #define HTFORMS_H
@@ -35,6 +35,7 @@ extern "C" {
 	int checked;
 	const char *iclass;
 	int disabled;
+	int readonly;
 	const char *error;
 	const char *height;
 	const char *id;
@@ -91,11 +92,14 @@ extern "C" {
 	char *orig_submit_value;	/* original submit value */
 	int size_l;		/* The length of the option list */
 	int disabled;		/* If YES, can't change values */
+	int readonly;		/* If YES, can't change values */
 	int name_cs;
 	int value_cs;
 	char *accept_cs;
     } FormInfo;
 
+#define FormIsReadonly(form) ((form)->disabled || (form)->readonly)
+
 /*
  * As structure for info associated with a form.  There is some redundancy
  * here, this shouldn't waste too much memory since the total number of forms
diff --git a/src/HTML.c b/src/HTML.c
index 1d06f0c8..e413c23a 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.148 2010/11/01 22:19:09 tom Exp $
+ * $LynxId: HTML.c,v 1.150 2011/05/19 23:27:28 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -4418,6 +4418,9 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		}
 	    }
 
+	    if (present && present[HTML_BUTTON_READONLY])
+		I.readonly = YES;
+
 	    if (present && present[HTML_BUTTON_DISABLED])
 		I.disabled = YES;
 
@@ -4775,7 +4778,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		I.value = ImageSrc;
 	    }
 	    if (present && present[HTML_INPUT_READONLY])
-		I.disabled = YES;
+		I.readonly = YES;
 	    if (present && present[HTML_INPUT_CHECKED])
 		I.checked = YES;
 	    if (present && present[HTML_INPUT_SIZE] &&
@@ -5026,10 +5029,11 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	 * Lynx treats disabled and readonly textarea's the same -
 	 * unmodifiable in either case.
 	 */
-	me->textarea_disabled = NO;
+	me->textarea_readonly = NO;
 	if (present && present[HTML_TEXTAREA_READONLY])
-	    me->textarea_disabled = YES;
+	    me->textarea_readonly = YES;
 
+	me->textarea_disabled = NO;
 	if (present && present[HTML_TEXTAREA_DISABLED])
 	    me->textarea_disabled = YES;
 
@@ -6825,6 +6829,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	    I.accept_cs = me->textarea_accept_cs;
 	    me->textarea_accept_cs = NULL;
 	    I.disabled = me->textarea_disabled;
+	    I.readonly = me->textarea_readonly;
 	    I.id = me->textarea_id;
 
 	    /*
@@ -7696,7 +7701,6 @@ HTStructured *HTML_new(HTParentAnchor *anchor,
     me->textarea_accept_cs = NULL;
     me->textarea_cols = 0;
     me->textarea_rows = 4;
-    me->textarea_disabled = NO;
     me->textarea_id = NULL;
 
     HTChunkInit(&me->math, 128);
diff --git a/src/HTML.h b/src/HTML.h
index 03eec899..be2e98f0 100644
--- a/src/HTML.h
+++ b/src/HTML.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.h,v 1.32 2010/09/25 11:36:37 tom Exp $
+ * $LynxId: HTML.h,v 1.33 2011/05/19 09:57:53 tom Exp $
  *
  *					HTML to rich text converter for libwww
  *
@@ -104,6 +104,7 @@ extern "C" {
 	int textarea_cols;
 	int textarea_rows;
 	int textarea_disabled;
+	int textarea_readonly;
 	char *textarea_id;
 	HTChunk math;		/* Grow by 128 */
 	HTChunk style_block;	/* Grow by 128 */
diff --git a/src/LYForms.c b/src/LYForms.c
index cedb89d1..20aa5f6d 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYForms.c,v 1.87 2010/10/31 17:56:18 tom Exp $ */
+/* $LynxId: LYForms.c,v 1.88 2011/05/19 10:54:36 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <HTTP.h>
@@ -87,7 +87,7 @@ int change_form_link_ex(int cur,
 
     switch (form->type) {
     case F_CHECKBOX_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    break;
 	LYSetHilite(cur, form->num_value ? unchecked_box : checked_box);
 	form->num_value = !form->num_value;
@@ -100,14 +100,14 @@ int change_form_link_ex(int cur,
 	    break;
 	}
 
-	if (form->disabled == YES) {
+	if (FormIsReadonly(form)) {
 	    (void) LYhandlePopupList(form->num_value,
 				     links[cur].ly,
 				     links[cur].lx,
 				     (const char **) my_data,
 				     form->size,
 				     form->size_l,
-				     form->disabled,
+				     FormIsReadonly(form),
 				     FALSE);
 #if CTRL_W_HACK != DO_NOTHING
 	    if (!enable_scrollback)
@@ -123,7 +123,7 @@ int change_form_link_ex(int cur,
 					    (const char **) my_data,
 					    form->size,
 					    form->size_l,
-					    form->disabled,
+					    FormIsReadonly(form),
 					    FALSE);
 	{
 	    OptionType *opt_ptr = form->select_list;
@@ -152,7 +152,7 @@ int change_form_link_ex(int cur,
 	break;
 
     case F_RADIO_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    break;
 	/*
 	 * Radio buttons must have one and only one down at a time!
@@ -206,7 +206,7 @@ int change_form_link_ex(int cur,
 	break;
 
     case F_RESET_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    break;
 	HText_ResetForm(form);
 	*refresh_screen = TRUE;
@@ -219,7 +219,7 @@ int change_form_link_ex(int cur,
 	}
 	if (!immediate_submit)
 	    c = form_getstr(cur, use_last_tfpos, FALSE);
-	if (form->disabled == YES &&
+	if (FormIsReadonly(form) &&
 	    (c == '\r' || c == '\n' || immediate_submit)) {
 	    if (peek_mouse_link() >= 0)
 		c = LAC_TO_LKC0(LYK_ACTIVATE);
@@ -303,7 +303,7 @@ int change_form_link_ex(int cur,
 
     case F_SUBMIT_TYPE:
     case F_IMAGE_SUBMIT_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    break;
 	if (form->no_cache &&
 	    form->submit_method != URL_MAIL_METHOD) {
@@ -403,7 +403,7 @@ static int form_getstr(int cur,
 	 * much of the tail as fits.  - FM
 	 */
 	value += (strlen(form->value) - max_length);
-	if (!form->disabled &&
+	if (!FormIsReadonly(form) &&
 	    !(form->submit_method == URL_MAIL_METHOD && no_mail)) {
 	    /*
 	     * If we can edit it, report that we are using the tail.  - FM
@@ -696,13 +696,13 @@ static int form_getstr(int cur,
 		if (c == YES) {
 		    return (ch);
 		} else {
-		    if (form->disabled == YES)
+		    if (FormIsReadonly(form))
 			_statusline(ARROWS_OR_TAB_TO_MOVE);
 		    else
 			_statusline(ENTER_TEXT_ARROWS_OR_TAB);
 		}
 	    }
-	    if (form->disabled == YES) {
+	    if (FormIsReadonly(form)) {
 		/*
 		 * Allow actions that don't modify the contents even in
 		 * disabled form fields, so the user can scroll through the
@@ -851,7 +851,7 @@ void show_formlink_statusline(const FormInfo * form,
 {
     switch (form->type) {
     case F_PASSWORD_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_PASSWORD_UNM_MSG);
 	else
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
@@ -862,25 +862,25 @@ void show_formlink_statusline(const FormInfo * form,
 	    statusline(FORM_LINK_PASSWORD_MESSAGE);
 	break;
     case F_OPTION_LIST_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_OPTION_LIST_UNM_MSG);
 	else
 	    statusline(FORM_LINK_OPTION_LIST_MESSAGE);
 	break;
     case F_CHECKBOX_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_CHECKBOX_UNM_MSG);
 	else
 	    statusline(FORM_LINK_CHECKBOX_MESSAGE);
 	break;
     case F_RADIO_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_RADIO_UNM_MSG);
 	else
 	    statusline(FORM_LINK_RADIO_MESSAGE);
 	break;
     case F_TEXT_SUBMIT_TYPE:
-	if (form->disabled == YES) {
+	if (FormIsReadonly(form)) {
 	    statusline(FORM_LINK_TEXT_SUBMIT_UNM_MSG);
 	} else if (form->submit_method ==
 		   URL_MAIL_METHOD) {
@@ -928,7 +928,7 @@ void show_formlink_statusline(const FormInfo * form,
 	break;
     case F_SUBMIT_TYPE:
     case F_IMAGE_SUBMIT_TYPE:
-	if (form->disabled == YES) {
+	if (FormIsReadonly(form)) {
 	    statusline(FORM_LINK_SUBMIT_DIS_MSG);
 	} else if (form->submit_method ==
 		   URL_MAIL_METHOD) {
@@ -971,25 +971,25 @@ void show_formlink_statusline(const FormInfo * form,
 	}
 	break;
     case F_RESET_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_RESET_DIS_MSG);
 	else
 	    statusline(FORM_LINK_RESET_MESSAGE);
 	break;
     case F_BUTTON_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_BUTTON_DIS_MSG);
 	else
 	    statusline(FORM_LINK_BUTTON_MESSAGE);
 	break;
     case F_FILE_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_FILE_UNM_MSG);
 	else
 	    statusline(FORM_LINK_FILE_MESSAGE);
 	break;
     case F_TEXT_TYPE:
-	if (form->disabled == YES)
+	if (FormIsReadonly(form))
 	    statusline(FORM_LINK_TEXT_UNM_MSG);
 	else
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
@@ -1000,7 +1000,7 @@ void show_formlink_statusline(const FormInfo * form,
 	    statusline(FORM_LINK_TEXT_MESSAGE);
 	break;
     case F_TEXTAREA_TYPE:
-	if (form->disabled == YES) {
+	if (FormIsReadonly(form)) {
 	    statusline(FORM_LINK_TEXT_UNM_MSG);
 	} else {
 	    char *submit_str = NULL;
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index a9a3793e..86511bd1 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.172 2010/09/25 14:57:53 tom Exp $
+ * $LynxId: LYMainLoop.c,v 1.173 2011/05/19 10:56:00 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -1183,7 +1183,7 @@ static int handle_LYK_ACTIVATE(int *c,
 		if (user_mode == NOVICE_MODE &&
 		    textinput_activated &&
 		    (real_cmd == LYK_ACTIVATE || real_cmd == LYK_SUBMIT)) {
-		    form_noviceline(links[curdoc.link].l_form->disabled);
+		    form_noviceline(FormIsReadonly(links[curdoc.link].l_form));
 		}
 	    }
 
@@ -2525,7 +2525,7 @@ static void handle_LYK_DWIMHELP(const char **cshelpfile)
      */
     if (curdoc.link >= 0 && curdoc.link < nlinks &&
 	links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
-	!links[curdoc.link].l_form->disabled &&
+	!FormIsReadonly(links[curdoc.link].l_form) &&
 	F_TEXTLIKE(links[curdoc.link].l_form->type)) {
 	*cshelpfile = LYLineeditHelpURL();
     }
@@ -2990,7 +2990,7 @@ static BOOLEAN handle_LYK_HEAD(int *cmd)
 		 StrNCmp(curdoc.address, "http", 4))) {
 		HTUserMsg(LINK_NOT_HTTP_URL);
 	    } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
-		       links[curdoc.link].l_form->disabled) {
+		       FormIsReadonly(links[curdoc.link].l_form)) {
 		HTUserMsg(FORM_ACTION_DISABLED);
 	    } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
 		       links[curdoc.link].l_form->submit_action != 0 &&
@@ -6539,7 +6539,7 @@ int mainloop(void)
 		     * Replace novice lines if in NOVICE_MODE.
 		     */
 		    if (user_mode == NOVICE_MODE) {
-			form_noviceline(links[curdoc.link].l_form->disabled);
+			form_noviceline(FormIsReadonly(links[curdoc.link].l_form));
 		    }
 		    real_c = change_form_link(curdoc.link,
 					      &newdoc, &refresh_screen,
@@ -6569,7 +6569,7 @@ int mainloop(void)
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
 		} else if (LinkIsTextarea(curdoc.link)
 			   && textfields_need_activation
-			   && !links[curdoc.link].l_form->disabled
+			   && !FormIsReadonly(links[curdoc.link].l_form)
 			   && peek_mouse_link() < 0 &&
 			   (((LKC_TO_LAC(keymap, real_c) == LYK_NEXT_LINK ||
 #ifdef TEXTAREA_AUTOGROW
diff --git a/src/structdump.h b/src/structdump.h
index f9be55ae..a084486b 100644
--- a/src/structdump.h
+++ b/src/structdump.h
@@ -109,6 +109,7 @@ CTRACE((tfp, "\n" \
             "orig_submit_value=|%s|\n"   \
             "           size_l=%d\n"     \
             "         disabled=%d\n"     \
+            "         readonly=%d\n"     \
             "          name_cs=%d\n"     \
             "         value_cs=%d\n"     \
             "        accept_cs=|%s|\n"   \
@@ -120,7 +121,7 @@ CTRACE((tfp, "\n" \
             (F)->hrange, (F)->lrange, (F)->select_list, (F)->submit_action, \
             (F)->submit_method, (F)->submit_enctype, (F)->submit_title, \
             (F)->no_cache, (F)->cp_submit_value, (F)->orig_submit_value, \
-            (F)->size_l, (F)->disabled, (F)->name_cs, (F)->value_cs, \
+            (F)->size_l, (F)->disabled, (F)->readonly, (F)->name_cs, (F)->value_cs, \
             (F)->accept_cs)); \
 } else { \
 CTRACE((tfp, "\n" \