[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev Try #2-Transport links between bookmark files... Here's the cod
From: |
mattack |
Subject: |
lynx-dev Try #2-Transport links between bookmark files... Here's the code |
Date: |
Mon, 5 Jul 1999 01:46:19 -0700 (PDT) |
I've never done this before (or even used diff much), so please inform me
about what I'm doing wrong, while hopefully not blowing my idea out of the
water..
So, basically:
When you are viewing a bookmark file, you can hit 't' to transport the
current link to another bookmark file. I have covered the error cases
I could think of, and tried edge cases (first link, last link). It even
allows a lame way to very slowly reorder your links within one bookmark
file (though you must have multibookmark mode on) by selecting the same
file... It'll move that bookmark to the end.
I'm based upon
Lynx Version 2.8.3dev.2 (18 Jun 1999)
I did the diff -cr orig.dir work.dir and here are the results. I
_removed_ the matching directories lines.. I hope that wasn't wrong.
diff -cr lynx2-8-3/lynx_help/keystrokes/bookmark_help.html
lynx2-8-3.work/lynx_help/keystrokes/bookmark_help.html
*** lynx2-8-3/lynx_help/keystrokes/bookmark_help.html Sun Jul 4 22:04:48 1999
--- lynx2-8-3.work/lynx_help/keystrokes/bookmark_help.html Mon Jul 5
00:32:05 1999
***************
*** 14,21 ****
<em>Bookmark file</em>, or to one you select if multiple bookmarks are
enabled. The remove feature, invoked by pressing an '<em>r</em>' when
a <em>Bookmark file</em> is being displayed, will remove the currently
! highlighted link. You may set and modify the paths and names of your
! <em>Bookmark files</em>, and enable or disable multiple bookmarks, in
! the <A HREF="option_help.html">options screen.</A>
</BODY>
</HTML>
--- 14,25 ----
<em>Bookmark file</em>, or to one you select if multiple bookmarks are
enabled. The remove feature, invoked by pressing an '<em>r</em>' when
a <em>Bookmark file</em> is being displayed, will remove the currently
! highlighted link. The transport (move link) feature, invoked by pressing
! a '<em>t</em>' while a <em>Bookmark file</em> is being displayed and
! multi-bookmark mode is enabled, will prompt you for a bookmark file
! to which to move the currently hilighted link. You may set and modify
! the paths and names of your <em>Bookmark files</em>, and enable or
! disable multiple bookmarks, in the <A HREF="option_help.html">options
! screen.</A>
</BODY>
</HTML>
diff -cr lynx2-8-3/lynx_help/keystrokes/keystroke_help.html
lynx2-8-3.work/lynx_help/keystrokes/keystroke_help.html
*** lynx2-8-3/lynx_help/keystrokes/keystroke_help.html Sun Jul 4 22:53:10 1999
--- lynx2-8-3.work/lynx_help/keystrokes/keystroke_help.html Mon Jul 5
00:32:46 1999
***************
*** 60,65 ****
--- 60,69 ----
q - Quit (Capital 'Q' for quick quit)
/ - Search for a string within the current
document
s - Enter a search string for an external search
+ t - While viewing a <A HREF="bookmark_help.html"
+ >bookmark file</A> in multi-
+ bookmark mode, transport (move) the currently
+ selected link to another bookmark file
n - Go to the next search string
v - View a <A HREF="bookmark_help.html"
>bookmark file</A>
diff -cr lynx2-8-3/src/LYBookmark.c lynx2-8-3.work/src/LYBookmark.c
*** lynx2-8-3/src/LYBookmark.c Sun Jul 4 22:20:08 1999
--- lynx2-8-3.work/src/LYBookmark.c Mon Jul 5 00:24:54 1999
***************
*** 190,198 ****
* so that the change will be evident on return to
* to that file. - FM
*/
! PUBLIC void save_bookmark_link ARGS2(
char *, address,
! char *, title)
{
FILE *fp;
BOOLEAN first_time = FALSE;
--- 190,199 ----
* so that the change will be evident on return to
* to that file. - FM
*/
! PUBLIC BOOLEAN save_bookmark_link ARGS3(
char *, address,
! char *, title,
! BOOLEAN, allowTitleChange)
{
FILE *fp;
BOOLEAN first_time = FALSE;
***************
*** 212,218 ****
*/
if (!(address && *address)) {
HTAlert(MALFORMED_ADDRESS);
! return;
}
/*
--- 213,219 ----
*/
if (!(address && *address)) {
HTAlert(MALFORMED_ADDRESS);
! return FALSE;
}
/*
***************
*** 235,241 ****
} else {
if (*filename == '\0' || !strcmp(filename," ")) {
FREE(bookmark_URL);
! return;
}
strcpy(filename_buffer, filename);
}
--- 236,242 ----
} else {
if (*filename == '\0' || !strcmp(filename," ")) {
FREE(bookmark_URL);
! return FALSE;
}
strcpy(filename_buffer, filename);
}
***************
*** 246,252 ****
*/
if (BookmarkPage == NULL) {
FREE(bookmark_URL);
! return;
}
/*
--- 247,253 ----
*/
if (BookmarkPage == NULL) {
FREE(bookmark_URL);
! return FALSE;
}
/*
***************
*** 261,267 ****
c = LYgetch();
if (TOUPPER(c) != 'L') {
FREE(bookmark_URL);
! return;
}
}
--- 262,268 ----
c = LYgetch();
if (TOUPPER(c) != 'L') {
FREE(bookmark_URL);
! return FALSE;
}
}
***************
*** 268,273 ****
--- 269,277 ----
/*
* Allow user to change the title. - FM
*/
+ if (!allowTitleChange)
+ LYstrncpy(string_buffer, title, sizeof(string_buffer)-1);
+ else
do {
LYstrncpy(string_buffer, title, sizeof(string_buffer)-1);
convert_to_spaces(string_buffer, FALSE);
***************
*** 277,283 ****
LYMBM_statusline(CANCELLED);
sleep(MessageSecs);
FREE(bookmark_URL);
! return;
}
} while(!havevisible(string_buffer));
--- 281,287 ----
LYMBM_statusline(CANCELLED);
sleep(MessageSecs);
FREE(bookmark_URL);
! return FALSE;
}
} while(!havevisible(string_buffer));
***************
*** 319,325 ****
sleep(AlertSecs);
FREE(Title);
FREE(bookmark_URL);
! return;
}
/*
--- 323,329 ----
sleep(AlertSecs);
FREE(Title);
FREE(bookmark_URL);
! return FALSE;
}
/*
***************
*** 401,406 ****
--- 405,411 ----
FREE(bookmark_URL);
LYMBM_statusline(OPERATION_DONE);
sleep(MessageSecs);
+ return TRUE;
}
/*
diff -cr lynx2-8-3/src/LYBookmark.h lynx2-8-3.work/src/LYBookmark.h
*** lynx2-8-3/src/LYBookmark.h Sun Jul 4 22:18:46 1999
--- lynx2-8-3.work/src/LYBookmark.h Mon Jul 5 00:24:50 1999
***************
*** 7,13 ****
#endif /* LYSTRUCTS_H */
extern char * get_bookmark_filename PARAMS((char **name));
! extern void save_bookmark_link PARAMS((char *address, char *title));
extern void remove_bookmark_link PARAMS((int cur, char *cur_bookmark_page));
extern int select_multi_bookmarks NOPARAMS;
extern int select_menu_multi_bookmarks NOPARAMS;
--- 7,13 ----
#endif /* LYSTRUCTS_H */
extern char * get_bookmark_filename PARAMS((char **name));
! extern BOOLEAN save_bookmark_link PARAMS((char *address, char *title, BOOLEAN
allowTitleChange));
extern void remove_bookmark_link PARAMS((int cur, char *cur_bookmark_page));
extern int select_multi_bookmarks NOPARAMS;
extern int select_menu_multi_bookmarks NOPARAMS;
diff -cr lynx2-8-3/src/LYMain.c lynx2-8-3.work/src/LYMain.c
*** lynx2-8-3/src/LYMain.c Mon Jun 28 17:27:30 1999
--- lynx2-8-3.work/src/LYMain.c Mon Jul 5 00:24:53 1999
***************
*** 2950,2955 ****
--- 2950,2959 ----
"make window size change handler non-restarting"
),
#endif /* HAVE_SIGACTION */
+ PARSE_SET(
+ "nonumber_links", UNSET_ARG, &number_links,
+ "disable numbering of links"
+ ),
PARSE_FUN(
"nopause", FUNCTION_ARG, nopause_fun,
"disable forced pauses for statusline messages"
diff -cr lynx2-8-3/src/LYMainLoop.c lynx2-8-3.work/src/LYMainLoop.c
*** lynx2-8-3/src/LYMainLoop.c Sat Jul 3 20:11:48 1999
--- lynx2-8-3.work/src/LYMainLoop.c Mon Jul 5 00:24:53 1999
***************
*** 4482,4489 ****
}
break;
#ifdef DIRED_SUPPORT
- case LYK_TAG_LINK: /* tag or untag the current link */
if (lynx_edit_mode && nlinks > 0 && !no_dired_support) {
if (!strcmp(links[curdoc.link].hightext, ".."))
break; /* Never tag the parent directory */
--- 4482,4515 ----
}
break;
+ case LYK_TAG_LINK: /* transport or tag/untag the current link */
+ // if currently in a Bookmark file, and MultiBookmarks are
enabled
+ if (!strcmp(curdoc.title, BOOKMARK_TITLE) && (LYMultiBookmarks
== TRUE))
+ {
+ BOOLEAN successfulSave = FALSE;
+
+ if (links[curdoc.link].type !=
WWW_FORM_LINK_TYPE)
+ {
+ successfulSave =
save_bookmark_link(links[curdoc.link].lname,
+
links[curdoc.link].hightext,FALSE);
+ refresh_screen = TRUE;
/* MultiBookmark support */
+ }
+ if ((successfulSave == TRUE) &&
(curdoc.bookmark != NULL))
+ {
+
remove_bookmark_link(links[curdoc.link].anchor_number-1,
+
curdoc.bookmark);
+ // MAA following lines
copied from the IMAGE_TOGGLE code
+ #ifdef SOURCE_CACHE
+ if (HTreparse_document()) {
+ break;
+ }
+ #endif
+ cmd = LYK_RELOAD;
+ goto new_cmd;
+ }
+ break;
+ }
#ifdef DIRED_SUPPORT
if (lynx_edit_mode && nlinks > 0 && !no_dired_support) {
if (!strcmp(links[curdoc.link].hightext, ".."))
break; /* Never tag the parent directory */
***************
*** 5259,5265 ****
_statusline(BOOK_D_L_OR_CANCEL);
c = LYgetch_for(FOR_SINGLEKEY);
if (TOUPPER(c) == 'D') {
! save_bookmark_link(curdoc.address, curdoc.title);
refresh_screen = TRUE; /* MultiBookmark support */
goto check_add_bookmark_to_self;
}
--- 5285,5291 ----
_statusline(BOOK_D_L_OR_CANCEL);
c = LYgetch_for(FOR_SINGLEKEY);
if (TOUPPER(c) == 'D') {
! save_bookmark_link(curdoc.address,
curdoc.title,TRUE);
refresh_screen = TRUE; /* MultiBookmark support */
goto check_add_bookmark_to_self;
}
***************
*** 5309,5315 ****
*/
if (links[curdoc.link].type != WWW_FORM_LINK_TYPE) {
save_bookmark_link(links[curdoc.link].lname,
! links[curdoc.link].hightext);
refresh_screen = TRUE; /* MultiBookmark support */
} else {
HTUserMsg(NOBOOK_FORM_FIELD);
--- 5335,5341 ----
*/
if (links[curdoc.link].type != WWW_FORM_LINK_TYPE) {
save_bookmark_link(links[curdoc.link].lname,
!
links[curdoc.link].hightext,TRUE);
refresh_screen = TRUE; /* MultiBookmark support */
} else {
HTUserMsg(NOBOOK_FORM_FIELD);
***************
*** 5335,5341 ****
_statusline(BOOK_D_OR_CANCEL);
c = LYgetch_for(FOR_SINGLEKEY);
if (TOUPPER(c) == 'D') {
! save_bookmark_link(curdoc.address, curdoc.title);
refresh_screen = TRUE; /* MultiBookmark support */
} else {
break;
--- 5361,5367 ----
_statusline(BOOK_D_OR_CANCEL);
c = LYgetch_for(FOR_SINGLEKEY);
if (TOUPPER(c) == 'D') {
! save_bookmark_link(curdoc.address, curdoc.title,TRUE);
refresh_screen = TRUE; /* MultiBookmark support */
} else {
break;
- lynx-dev Try #2-Transport links between bookmark files... Here's the code,
mattack <=
- Re: lynx-dev Try #2-Transport links between bookmark files... Here's the code, Kim DeVaughn, 1999/07/05
- lynx-dev Re: Transport links between bookmark files..., Klaus Weide, 1999/07/05
- Re: lynx-dev Re: Transport links between bookmark files..., mattack, 1999/07/05
- Re: lynx-dev Re: Transport links between bookmark files..., Klaus Weide, 1999/07/06
- Re: lynx-dev Re: Transport links between bookmark files..., Philip Webb, 1999/07/06
- Re: lynx-dev Re: Transport links between bookmark files..., Klaus Weide, 1999/07/06
- lynx-dev new command format (was transport), Philip Webb, 1999/07/07
- Re: lynx-dev new command format (was transport), Klaus Weide, 1999/07/07
- Re: lynx-dev new command format (was transport), Philip Webb, 1999/07/07
- Re: lynx-dev new command format (was transport), Larry W. Virden, 1999/07/07