Jo BLEKu pis do brany - treba rekni, jak jsem napsal do linkse podporu pro porno a implementoval jsem to pomoci tagu
<img porn=1 src=..., ale tys to po me musel opravit, protoze
to bylo ideologicky neerektni a slo to implementovat pres tamto opt==2 nebo jak se to jmenovalo.
Funguje to tak, ze se samotne obrazky naskaluji na celou obrazovku (at uz jsou mensi nebo vetsi nez obrazovka). A protoze Links ma dobre, fotograficke skalovani, tak se da ted honit i pero nad takovymi temi trapnymi thumbnaily co tam porno provozovatele davaj, aby nadrzene lidi nalakali na nejaky placeny websajt.
Jo jeste ten patch je na ronja.twibright.com/porn.diff ale stahujte rychle, protoze budu ronju updatovat a smaze se to :) Jinak to bude v dalsi verzi linkse. Pro jistotu jeste jednou tady:
Index: ChangeLog
===================================================================
RCS file: /home/brain/cvsroot/links-current/ChangeLog,v
retrieving revision 1.371
retrieving revision 1.373
diff -r1.371 -r1.373
0a1,9
> Sat Apr 29 18:06:05 CEST 2006 clock:
>
> Implemented porn mode (bare image autoscaling aka fullscreen).
>
> Sat Apr 29 12:45:07 CEST 2006 clock:
>
> Fixed ignorance of aspect ratio for images where only one dimension
> is specified.
>
Index: default.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/default.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -r1.98 -r1.99
3a4,5
> *
> * Does the configuration file.
422a425,427
> /* prefix: directory
> * name: name of the configuration file (typ. links.cfg)
> */
1399c1404,1407
< struct document_setup dds = { 0, 0, 1, 1, 0, 0, 3, 0, 0, 0, 18, 1, 100, 0 };
---
> struct document_setup dds = { 0, 0, 1, 1, 0, 0, 3, 0, 0, 0, 18, 1,
> 100, /* Image scale */
> 1, /* Porn enable */
> 0 };
1535a1544,1545
> {1, gen_cmd, num_rd, num_wr, 0, 1, &dds.porn_enable, "html_porn_enable",
> "html-porn-enable"},
Index: dip.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/dip.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -r1.92 -r1.93
40c40
< * aspect=157286 for 640x200
---
> * aspect=157286 for 640x200 (tall pixels)
44c44,46
< * when not specified otherwise. */
---
> * when not specified otherwise. Aspect is ratio of
> * the pixel height (in milimeters) to pixel width,
> * multiplied by 65536. */
Index: html.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/html.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -r1.153 -r1.154
796a797
> /* trunc somehow clips the maximum values. Use 0 to disable truncastion. */
832a834
> /* trunc somehow clips the maximum values. Use 0 to disable truncastion. */
1080a1083,1091
> if (d_opt->porn_enable&&i.xsize<0&&i.ysize<0&&get_num(a, "porn")==1){
> /* Strict checking for porn condition ;-) */
> i.autoscale_x=d_opt->xw;
> i.autoscale_y=d_opt->yw;
> }else{
> /* Turn off autoscale */
> i.autoscale_x=0;
> i.autoscale_y=0;
> }
2402c2413
< int nopair;
---
> int nopair; /* Somehow relates to paired elements */
2554a2566
>
Index: html_gr.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/html_gr.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -r1.80 -r1.81
551a552,555
> /* The size is requested in im->xsize and im->ysize. <0 means
> * not specified. Autoscale is requested in im->autoscale.
> * If autoscale is specified, im->xsize and im->ysize must
> * be >0. */
964a969
>
Index: html_r.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/html_r.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -r1.78 -r1.79
1361a1362
> o1->porn_enable == o2->porn_enable &&
Index: img.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/img.c,v
retrieving revision 1.142
retrieving revision 1.144
diff -r1.142 -r1.144
187c187
< /* You thorow in a vertical dimension of image and it returns
---
> /* You throw in a vertical dimension of image and it returns
190c190
< * are non-square, the pixture will be always in one dimension
---
> * are non-square, the picture will be always in one dimension
219a220,243
> /* Returns height (pixels) for prescribed width (pixels). Honours aspect. */
> int width2height(float width_px, float width_mm, float height_mm)
> {
> int height_px;
>
> if (width_px<=0) return width_px;
> height_px=(height_mm*width_px*65536)/(aspect*width_mm);
> if (height_px<1) height_px=1;
> return height_px;
>
> }
>
> /* Returns width (pixels) for prescribed height (pixels). Honours aspect. */
> int height2width(float height_px, float width_mm, float height_mm)
> {
> int width_px;
>
> if (height_px<=0) return height_px;
> width_px=(width_mm*height_px*aspect)/(65536*height_mm);
> if (width_px<1) width_px=1;
> return width_px;
>
> }
>
276c300
< /* Unspecified width and height */
---
> /* Unspecified neither width nor height */
281,283c305,306
< cimg->xww=(cimg->yww
< *cimg->width+(cimg->height>>1))
< /cimg->height;
---
> cimg->xww=height2width(cimg->yww,
> cimg->width, cimg->height);
287a311
> /* Specified width */
289,292c313,332
< /* Specified width unspecified height */
< cimg->yww=(cimg->xww
< *cimg->height+(cimg->width>>1))
< /cimg->width;
---
> /* Unspecified height, specified width */
> cimg->yww=width2height(cimg->xww,
> cimg->width, cimg->height);
> if (cimg->yww<=0) cimg->yww=1;
> }else if (cimg->wanted_xyw_meaning==MEANING_AUTOSCALE){
> /* Specified height and width and autoscale meant */
> /* Try first to nail the height */
> cimg->yww=cimg->wanted_yw;
> cimg->xww=height2width(cimg->yww,
> cimg->width, cimg->height);
> if (cimg->xww>cimg->wanted_xw)
> {
> /* Width too much, we nail the width */
> cimg->xww=cimg->wanted_xw;
> cimg->yww=width2height(cimg->xww,
> cimg->width, cimg->height);
> }
>
> /* Some sanity checks */
> if (cimg->xww<=0) cimg->xww=1;
1132,1133c1172,1174
< * image -> xw
< * image -> yw
---
> * image -> xw (<0 means not known)
> * image -> yw (<0 means not known)
> * image -> xyw meaning (MEANING_AUTOSCALE or MEANING_DIMS)
1144c1185
< image->yw, scale, aspect))){
---
> image->yw, image->xyw_meaning,scale, aspect))){
1158a1200
> cimg->wanted_xyw_meaning=image->xyw_meaning;
1175a1218,1221
> /* The original (unscaled, in pixels pace) size is requested in im->xsize and im->ysize.
> * <0 means unknown. Autoscale is requested in autoscale. When autoscale is on,
> * the requested dimensions are not scaled and they mean maximum allowed
> * dimensions. */
1197,1198c1243,1255
< image->xw=img_scale_h(d_opt->image_scale, im->xsize);
< image->yw=img_scale_v(d_opt->image_scale, im->ysize);
---
>
> if (im->autoscale_x&&im->autoscale_y)
> {
> /* Autoscale requested */
> image->xw=im->autoscale_x;
> image->yw=im->autoscale_y;
> image->xyw_meaning=MEANING_AUTOSCALE;
> }else{
> /* Autoscale not requested */
> image->xw=img_scale_h(d_opt->image_scale, im->xsize);
> image->yw=img_scale_v(d_opt->image_scale, im->ysize);
> image->xyw_meaning=MEANING_DIMS;
> }
Index: imgcache.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/imgcache.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -r1.9 -r1.10
18a19
> /* xyw_meaning either MEANING_DIMS or MEANING_AUTOSCALE. */
20c21
< yw, int scale, int aspect)
---
> yw, int xyw_meaning, int scale, int aspect)
23c24
< if (xw>=0&&yw>=0){
---
> if (xw>=0&&yw>=0&&xyw_meaning==MEANING_DIMS){
31c32,34
< && i->wanted_yw==yw) goto hit;
---
> && i->wanted_yw==yw
> && i->wanted_xyw_meaning==xyw_meaning
> ) goto hit;
38a42
> && i->wanted_xyw_meaning==xyw_meaning
41c45
< }
---
> }
Index: language.h
===================================================================
RCS file: /home/brain/cvsroot/links-current/language.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -r1.79 -r1.80
427,520c427,521
< #define T_DISPLAY_OPTIMIZATION_CRT 423
< #define T_DISPLAY_OPTIMIZATION_LCD_RGB 424
< #define T_DISPLAY_OPTIMIZATION_LCD_BGR 425
< #define T_ASPECT_RATIO 426
< #define T_ASPECT_CORRECTION_ON 427
< #define T_KEYBOARD_CODEPAGE 428
< #define T_COPY_LINK_LOCATION 429
< #define T_COPY_URL_LOCATION 430
< #define T_BLOCK_URL 431
< #define T_BLOCKED_URL 432
< #define T_BLOCK_LIST 433
< #define T_BLOCK_LIST_IN_USE 434
< #define T_BLOCK_LIST_MANAGER 435
< #define T_BLOCK_ADD 436
< #define T_BLOCK_EDIT 437
< #define T_BLOCK_DELETE 438
< #define T_HK_ADD_BOOKMARK 439
< #define T_HK_BOOKMARKS 440
< #define T_HK_SAVE_BOOKMARKS 441
< #define T_HK_GOTO_URL 442
< #define T_HK_GO_BACK 443
< #define T_HK_HISTORY 444
< #define T_HK_RELOAD 445
< #define T_HK_SAVE_AS 446
< #define T_HK_SAVE_URL_AS 447
< #define T_HK_SAVE_FORMATTED_DOCUMENT 448
< #define T_HK_KILL_BACKGROUND_CONNECTIONS 449
< #define T_HK_KILL_ALL_CONNECTIONS 450
< #define T_HK_FLUSH_ALL_CACHES 451
< #define T_HK_RESOURCE_INFO 452
< #define T_HK_CACHE_INFO 453
< #define T_HK_MAIL_AND_TELNEL 454
< #define T_HK_MEMORY_INFO 455
< #define T_HK_OS_SHELL 456
< #define T_HK_RESIZE_TERMINAL 457
< #define T_HK_EXIT 458
< #define T_HK_SEARCH 459
< #define T_HK_SEARCH_BACK 460
< #define T_HK_FIND_NEXT 461
< #define T_HK_FIND_PREVIOUS 462
< #define T_HK_TOGGLE_HTML_PLAIN 463
< #define T_HK_DOCUMENT_INFO 464
< #define T_HK_HEADER_INFO 465
< #define T_HK_FRAME_AT_FULL_SCREEN 466
< #define T_HK_HTML_OPTIONS 467
< #define T_HK_SAVE_HTML_OPTIONS 468
< #define T_HK_ABOUT 469
< #define T_HK_KEYS 470
< #define T_HK_COPYING 471
< #define T_HK_MANUAL 472
< #define T_HK_HOMEPAGE 473
< #define T_HK_CALIBRATION 474
< #define T_HK_ADD 475
< #define T_HK_MODIFY 476
< #define T_HK_DELETE 477
< #define T_HK_LANGUAGE 478
< #define T_HK_CHARACTER_SET 479
< #define T_HK_TERMINAL_OPTIONS 480
< #define T_HK_VIDEO_OPTIONS 481
< #define T_HK_NETWORK_OPTIONS 482
< #define T_HK_CACHE 483
< #define T_HK_ASSOCIATIONS 484
< #define T_HK_FILE_EXTENSIONS 485
< #define T_HK_SAVE_OPTIONS 486
< #define T_HK_FILE 487
< #define T_HK_VIEW 488
< #define T_HK_LINK 489
< #define T_HK_DOWNLOADS 490
< #define T_HK_SETUP 491
< #define T_HK_HELP 492
< #define T_HK_DISPLAY_USEMAP 493
< #define T_HK_FOLLOW_LINK 494
< #define T_HK_OPEN_IN_NEW_WINDOW 495
< #define T_HK_DOWNLOAD_LINK 496
< #define T_HK_RESET_FORM 497
< #define T_HK_SUBMIT_FORM 498
< #define T_HK_SUBMIT_FORM_AND_OPEN_IN_NEW_WINDOW 499
< #define T_HK_SUBMIT_FORM_AND_DOWNLOAD 500
< #define T_HK_VIEW_IMAGE 501
< #define T_HK_DOWNLOAD_IMAGE 502
< #define T_HK_XTERM 503
< #define T_HK_TWTERM 504
< #define T_HK_SCREEN 505
< #define T_HK_WINDOW 506
< #define T_HK_FULL_SCREEN 507
< #define T_HK_BEOS_TERMINAL 508
< #define T_HK_NEW_WINDOW 509
< #define T_HK_JAVASCRIPT_OPTIONS 510
< #define T_HK_MISCELANEOUS_OPTIONS 511
< #define T_HK_COPY_LINK_LOCATION 512
< #define T_HK_COPY_URL_LOCATION 513
< #define T_HK_BLOCK_URL 514
< #define T_HK_BLOCK_LIST 515
< #define T__N_TEXTS 516
---
> #define T_PORN_ENABLE 423
> #define T_DISPLAY_OPTIMIZATION_CRT 424
> #define T_DISPLAY_OPTIMIZATION_LCD_RGB 425
> #define T_DISPLAY_OPTIMIZATION_LCD_BGR 426
> #define T_ASPECT_RATIO 427
> #define T_ASPECT_CORRECTION_ON 428
> #define T_KEYBOARD_CODEPAGE 429
> #define T_COPY_LINK_LOCATION 430
> #define T_COPY_URL_LOCATION 431
> #define T_BLOCK_URL 432
> #define T_BLOCKED_URL 433
> #define T_BLOCK_LIST 434
> #define T_BLOCK_LIST_IN_USE 435
> #define T_BLOCK_LIST_MANAGER 436
> #define T_BLOCK_ADD 437
> #define T_BLOCK_EDIT 438
> #define T_BLOCK_DELETE 439
> #define T_HK_ADD_BOOKMARK 440
> #define T_HK_BOOKMARKS 441
> #define T_HK_SAVE_BOOKMARKS 442
> #define T_HK_GOTO_URL 443
> #define T_HK_GO_BACK 444
> #define T_HK_HISTORY 445
> #define T_HK_RELOAD 446
> #define T_HK_SAVE_AS 447
> #define T_HK_SAVE_URL_AS 448
> #define T_HK_SAVE_FORMATTED_DOCUMENT 449
> #define T_HK_KILL_BACKGROUND_CONNECTIONS 450
> #define T_HK_KILL_ALL_CONNECTIONS 451
> #define T_HK_FLUSH_ALL_CACHES 452
> #define T_HK_RESOURCE_INFO 453
> #define T_HK_CACHE_INFO 454
> #define T_HK_MAIL_AND_TELNEL 455
> #define T_HK_MEMORY_INFO 456
> #define T_HK_OS_SHELL 457
> #define T_HK_RESIZE_TERMINAL 458
> #define T_HK_EXIT 459
> #define T_HK_SEARCH 460
> #define T_HK_SEARCH_BACK 461
> #define T_HK_FIND_NEXT 462
> #define T_HK_FIND_PREVIOUS 463
> #define T_HK_TOGGLE_HTML_PLAIN 464
> #define T_HK_DOCUMENT_INFO 465
> #define T_HK_HEADER_INFO 466
> #define T_HK_FRAME_AT_FULL_SCREEN 467
> #define T_HK_HTML_OPTIONS 468
> #define T_HK_SAVE_HTML_OPTIONS 469
> #define T_HK_ABOUT 470
> #define T_HK_KEYS 471
> #define T_HK_COPYING 472
> #define T_HK_MANUAL 473
> #define T_HK_HOMEPAGE 474
> #define T_HK_CALIBRATION 475
> #define T_HK_ADD 476
> #define T_HK_MODIFY 477
> #define T_HK_DELETE 478
> #define T_HK_LANGUAGE 479
> #define T_HK_CHARACTER_SET 480
> #define T_HK_TERMINAL_OPTIONS 481
> #define T_HK_VIDEO_OPTIONS 482
> #define T_HK_NETWORK_OPTIONS 483
> #define T_HK_CACHE 484
> #define T_HK_ASSOCIATIONS 485
> #define T_HK_FILE_EXTENSIONS 486
> #define T_HK_SAVE_OPTIONS 487
> #define T_HK_FILE 488
> #define T_HK_VIEW 489
> #define T_HK_LINK 490
> #define T_HK_DOWNLOADS 491
> #define T_HK_SETUP 492
> #define T_HK_HELP 493
> #define T_HK_DISPLAY_USEMAP 494
> #define T_HK_FOLLOW_LINK 495
> #define T_HK_OPEN_IN_NEW_WINDOW 496
> #define T_HK_DOWNLOAD_LINK 497
> #define T_HK_RESET_FORM 498
> #define T_HK_SUBMIT_FORM 499
> #define T_HK_SUBMIT_FORM_AND_OPEN_IN_NEW_WINDOW 500
> #define T_HK_SUBMIT_FORM_AND_DOWNLOAD 501
> #define T_HK_VIEW_IMAGE 502
> #define T_HK_DOWNLOAD_IMAGE 503
> #define T_HK_XTERM 504
> #define T_HK_TWTERM 505
> #define T_HK_SCREEN 506
> #define T_HK_WINDOW 507
> #define T_HK_FULL_SCREEN 508
> #define T_HK_BEOS_TERMINAL 509
> #define T_HK_NEW_WINDOW 510
> #define T_HK_JAVASCRIPT_OPTIONS 511
> #define T_HK_MISCELANEOUS_OPTIONS 512
> #define T_HK_COPY_LINK_LOCATION 513
> #define T_HK_COPY_URL_LOCATION 514
> #define T_HK_BLOCK_URL 515
> #define T_HK_BLOCK_LIST 516
> #define T__N_TEXTS 517
Index: language.inc
===================================================================
RCS file: /home/brain/cvsroot/links-current/language.inc,v
retrieving revision 1.167
diff -r1.167 language.inc
426a427
> {T_PORN_ENABLE, "Porn mode (bare image autoscale)" },
Index: links.h
===================================================================
RCS file: /home/brain/cvsroot/links-current/links.h,v
retrieving revision 1.409
retrieving revision 1.410
diff -r1.409 -r1.410
121a122
> #ifndef _SETJMP_H
122a124
> #endif /* _SETJMP_H */
2286a2289
> int porn_enable;
2313a2317
> int porn_enable;
2333a2338
> doo->porn_enable = ds->porn_enable;
2504a2510,2511
> #define MEANING_DIMS 0
> #define MEANING_AUTOSCALE 1
2513,2515c2520,2528
< int wanted_xw, wanted_yw;
< int scale;
< int aspect; /* What aspect ratio the image is for */
---
> int wanted_xw, wanted_yw; /* This is what is written in the alt.
> If some dimension is omitted, then
> it's <0. This is what was requested
> when the image was created. */
> int wanted_xyw_meaning; /* MEANING_DIMS or MEANING_AUTOSCALE.
> The meaning of wanted_xw and wanted_yw. */
> int scale; /* How is the image scaled */
> int aspect; /* What aspect ratio the image is for. But the
> PNG aspect is ignored :( */
2517c2530,2531
< int xww, yww;
---
> int xww, yww; /* This is the resulting dimensions on the screen
> measured in screen pixels. */
2523c2537,2540
< * are garbage.
---
> * are garbage. We assume these dimensions
> * are given in the meter space (not pixel space).
> * Which is true for all images except aspect
> * PNG, but we don't support aspect PNG yet.
2567c2584,2586
< int x, y, xw, yw;
---
> int x, y, xw, yw; /* x,y: coordinates
> xw, yw: width on the screen, or <0 if
> not yet known. Already scaled. */
2607a2627
> int xyw_meaning;
3575c3595,3596
< int xsize, ysize; /* -1 --- unknown size */
---
> int xsize, ysize; /* -1 --- unknown size. Space:pixel
> space of the screen */
3586a3608,3611
> unsigned autoscale_x, autoscale_y; /* Requested autoscale dimensions
> (maximum allowed rectangle), 0,0
> means turned off. 0,something or
> something,0 not allowed. */
3698c3723
< yw, int scale, int aspect);
---
> yw, int xyw_meaning, int scale, int aspect);
Index: menu.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/menu.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -r1.134 -r1.135
1564c1564,1570
< unsigned char *html_texts_g[] = { TEXT(T_DISPLAY_TABLES), TEXT(T_DISPLAY_FRAMES), TEXT(T_DISPLAY_LINKS_TO_IMAGES), TEXT(T_DISPLAY_IMAGE_FILENAMES), TEXT(T_DISPLAY_IMAGES), TEXT(T
---
> unsigned char *html_texts_g[] = { TEXT(T_DISPLAY_TABLES),
> TEXT(T_DISPLAY_FRAMES), TEXT(T_DISPLAY_LINKS_TO_IMAGES),
> TEXT(T_DISPLAY_IMAGE_FILENAMES), TEXT(T_DISPLAY_IMAGES),
> TEXT(T_AUTO_REFRESH), TEXT(T_TARGET_IN_NEW_WINDOW), TEXT(T_TEXT_MARGIN),
> "", TEXT(T_IGNORE_CHARSET_INFO_SENT_BY_SERVER), TEXT(T_USER_FONT_SIZE),
> TEXT(T_SCALE_ALL_IMAGES_BY), TEXT(T_PORN_ENABLE)
> };
1591c1597
< d = mem_calloc(sizeof(struct dialog) + 16 * sizeof(struct dialog_item));
---
> d = mem_calloc(sizeof(struct dialog) + 17 * sizeof(struct dialog_item));
1691a1698,1701
> d->items[a].type = D_CHECKBOX;
> d->items[a].data = (unsigned char *) &ses->ds.porn_enable;
> d->items[a].dlen = sizeof(int);
> a++;
Index: pomocny.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/pomocny.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -r1.14 -r1.15
3a4,5
> *
> * Ponocny je casto nemocny.
Index: session.c
===================================================================
RCS file: /home/brain/cvsroot/links-current/session.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -r1.169 -r1.170
872c872
< add_to_str(&start, &stl, "<img src=\"");
---
> add_to_str(&start, &stl, "<img porn=1 src=\"");
Index: intl/english.lng
===================================================================
RCS file: /home/brain/cvsroot/links-current/intl/english.lng,v
retrieving revision 1.99
retrieving revision 1.100
diff -r1.99 -r1.100
422a423
> T_PORN_ENABLE, "Porn mode (bare image autoscale)",