mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.3.1
This commit is contained in:
@@ -61,6 +61,5 @@ class Imap_html_fmtrs {
|
||||
, " </a>"
|
||||
, " </div>"
|
||||
), "margin_left", "margin_top", "img_href", "msg_desc", "icon_url"
|
||||
)
|
||||
;
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,37 +17,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.imaps; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.wkrs.imgs.*; import gplx.xowa.htmls.core.wkrs.imgs.atrs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
class Imap_img_fmtr_arg implements gplx.core.brys.Bfr_arg {
|
||||
private Xoh_wtr_ctx hctx; private Imap_map map; private Imap_xtn_mgr xtn_mgr; // private byte[] src;
|
||||
private int img_elem_id, img_w, img_h;
|
||||
private byte[] img_alt, img_src, img_cls, img_href;
|
||||
private byte[] img_alt, img_src, img_cls, img_href, lnki_ttl;
|
||||
private Int_2_ref margin_calc = new Int_2_ref();
|
||||
public void Init(Xoh_wtr_ctx hctx, Imap_xtn_mgr xtn_mgr, Imap_map map, byte[] src, int img_elem_id, byte[] img_alt, byte[] img_src, int img_w, int img_h, byte[] img_cls, byte[] img_href) {
|
||||
public void Init(Xoh_wtr_ctx hctx, Imap_xtn_mgr xtn_mgr, Imap_map map, byte[] src, int img_elem_id, byte[] img_alt, byte[] img_src, int img_w, int img_h, byte[] img_cls, byte[] img_href, byte[] lnki_ttl) {
|
||||
this.hctx = hctx; this.map = map; this.xtn_mgr = xtn_mgr; // this.src = src;
|
||||
this.img_elem_id = img_elem_id; this.img_w = img_w; this.img_h = img_h;
|
||||
this.img_alt = img_alt;
|
||||
this.img_src = img_src;
|
||||
this.img_cls = img_cls;
|
||||
this.img_href = img_href;
|
||||
this.img_alt = img_alt; this.img_src = img_src; this.img_cls = img_cls; this.img_href = img_href;
|
||||
this.lnki_ttl = lnki_ttl;
|
||||
}
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
Bry_fmtr fmtr = Imap_html_fmtrs.Img_anchor_none;
|
||||
byte[] anchor_href = Bry_.Empty, anchor_text = Bry_.Empty;
|
||||
Imap_itm_dflt itm_dflt = map.Dflt();
|
||||
boolean hctx_is_hdump = hctx.Mode_is_hdump();
|
||||
Xoh_arg_img_core img_core_fmtr = xtn_mgr.Img_core_fmtr(hctx_is_hdump);
|
||||
img_core_fmtr.Init(img_elem_id, img_src, img_w, img_h);
|
||||
if (itm_dflt != null) {
|
||||
// Xowe_wiki wiki = map.Xtn_mgr().Wiki();
|
||||
// if (src.length != 0) // imap update will pass 0 src
|
||||
// Imap_link_owner_.Write(itm_dflt, wiki.Appe(), wiki, hctx, src);
|
||||
fmtr = itm_dflt.Link_tid() == Xop_tkn_itm_.Tid_lnki ? Imap_html_fmtrs.Img_anchor_lnki : Imap_html_fmtrs.Img_anchor_lnke;
|
||||
anchor_href = itm_dflt.Link_href();
|
||||
anchor_text = itm_dflt.Link_text();
|
||||
if (hctx.Mode_is_hdump()) {
|
||||
Bry_bfr tmp_bfr = xtn_mgr.Tmp_bfr;
|
||||
byte[] data_xowa_image = Xoh_file_html_fmtr__hdump.Bld_xowa_image_data(tmp_bfr, Xop_lnki_type.Id_none, img_w, img_h, Xop_lnki_tkn.Upright_null, Xof_lnki_time.Null, Xof_lnki_page.Null);
|
||||
byte[] data_xowa_title = Gfh_atr_.Make(tmp_bfr, Xoh_img_xoimg_data.Bry__data_xowa_title, lnki_ttl);
|
||||
byte[] usemap = tmp_bfr.Add(Imap_xtn_mgr.Bry__usemap__html).Add_int_variable(map.Id()).Add_byte_quote().To_bry_and_clear();
|
||||
Xoh_file_html_fmtr__hdump.Bld_anch_n(tmp_bfr, data_xowa_title, data_xowa_image, Xoh_img_cls_.Tid__thumbimage, Bry_.Empty, Bry_.Empty, usemap);
|
||||
bfr.Add_bfr_and_clear(tmp_bfr);
|
||||
}
|
||||
else {
|
||||
Xoh_arg_img_core img_core_fmtr = xtn_mgr.Img_core_fmtr;
|
||||
img_core_fmtr.Init(img_elem_id, img_src, img_w, img_h);
|
||||
if (itm_dflt != null) {
|
||||
// Xowe_wiki wiki = map.Xtn_mgr().Wiki();
|
||||
// if (src.length != 0) // imap update will pass 0 src
|
||||
// Imap_link_owner_.Write(itm_dflt, wiki.Appe(), wiki, hctx, src);
|
||||
fmtr = itm_dflt.Link_tid() == Xop_tkn_itm_.Tid_lnki ? Imap_html_fmtrs.Img_anchor_lnki : Imap_html_fmtrs.Img_anchor_lnke;
|
||||
anchor_href = itm_dflt.Link_href();
|
||||
anchor_text = itm_dflt.Link_text();
|
||||
}
|
||||
fmtr.Bld_bfr_many(bfr, map.Id(), img_elem_id, img_alt, img_core_fmtr, img_cls, anchor_href, anchor_text);
|
||||
}
|
||||
fmtr.Bld_bfr_many(bfr, map.Id(), img_elem_id, img_alt, img_core_fmtr, img_cls, anchor_href, anchor_text);
|
||||
Imap_itm_desc itm_desc = map.Desc();
|
||||
if (itm_desc != null) {
|
||||
Imap_desc_tid.Calc_desc_margins(margin_calc, itm_desc.Desc_tid(), img_w, img_h);
|
||||
|
||||
@@ -43,17 +43,17 @@ public class Imap_map implements Xoh_file_img_wkr, Js_img_wkr {
|
||||
xfer_itm.Html_img_wkr_(this);
|
||||
xfer_itm.Html_elem_tid_(Xof_html_elem.Tid_imap);
|
||||
this.a_href = a_href; this.img_alt = img_alt; this.img_cls_tid = img_cls; this.img_cls_other = img_cls_other;
|
||||
Write_imap_div(tmp_bfr, page.Wikie(), hctx, src, uid, img_w, img_h, img_src, xfer_itm.Orig_w(), xfer_itm.Orig_h());
|
||||
Write_imap_div(tmp_bfr, page.Wikie(), hctx, src, uid, img_w, img_h, img_src, xfer_itm.Orig_w(), xfer_itm.Orig_h(), a_xowa_title);
|
||||
if (hctx.Mode_is_hdump())
|
||||
page.Hdump_data().Imgs_add_img(new Xohd_img_itm__img(), xfer_itm, Xohd_img_itm__gallery_itm.Tid_basic);
|
||||
}
|
||||
public void Html_update(Xoa_page page, Xog_js_wkr js_wkr, int html_uid, int html_w, int html_h, Io_url html_view_url, int orig_w, int orig_h, Io_url html_orig_url, byte[] lnki_ttl) {
|
||||
Xowe_wiki wiki = xtn_mgr.Wiki();
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_k004();
|
||||
Write_imap_div(tmp_bfr, (Xowe_wiki)page.Wiki(), Xoh_wtr_ctx.Basic, Bry_.Empty, html_uid, html_w, html_h, html_view_url.To_http_file_bry(), orig_w, orig_h);
|
||||
Write_imap_div(tmp_bfr, (Xowe_wiki)page.Wiki(), Xoh_wtr_ctx.Basic, Bry_.Empty, html_uid, html_w, html_h, html_view_url.To_http_file_bry(), orig_w, orig_h, lnki_ttl);
|
||||
js_wkr.Html_elem_replace_html("imap_div_" + Int_.To_str(html_uid), tmp_bfr.To_str_and_rls());
|
||||
}
|
||||
private void Write_imap_div(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, byte[] src, int html_uid, int html_w, int html_h, byte[] html_src, int orig_w, int orig_h) {
|
||||
private void Write_imap_div(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, byte[] src, int html_uid, int html_w, int html_h, byte[] html_src, int orig_w, int orig_h, byte[] lnki_ttl) {
|
||||
byte[] desc_style = Calc_desc_style(html_w, html_h);
|
||||
// int shapes_len = shapes.length;
|
||||
// for (int i = 0; i < shapes_len; ++i) {
|
||||
@@ -61,7 +61,7 @@ public class Imap_map implements Xoh_file_img_wkr, Js_img_wkr {
|
||||
// Imap_link_owner_.Write(shape, wiki.Appe(), wiki, hctx, src);
|
||||
// }
|
||||
map_fmtr_arg.Init(id, shapes, Calc_scale(orig_w, orig_h, html_w, html_h));
|
||||
img_fmtr_arg.Init(hctx, xtn_mgr, this, src, html_uid, img_alt, html_src, html_w, html_h, Xoh_img_cls_.To_html(img_cls_tid, img_cls_other), a_href);
|
||||
img_fmtr_arg.Init(hctx, xtn_mgr, this, src, html_uid, img_alt, html_src, html_w, html_h, Xoh_img_cls_.To_html(img_cls_tid, img_cls_other), a_href, lnki_ttl);
|
||||
Imap_html_fmtrs.All.Bld_bfr_many(bfr, html_uid, desc_style, map_fmtr_arg, img_fmtr_arg);
|
||||
}
|
||||
private byte[] Calc_desc_style(int html_w, int html_h) {
|
||||
|
||||
@@ -32,8 +32,9 @@ public class Imap_xtn_mgr extends Xox_mgr_base implements GfoInvkAble {
|
||||
public Btrie_slim_mgr Desc_trie() {return desc_trie;} private Btrie_slim_mgr desc_trie;
|
||||
public byte[] Desc_msg() {return desc_msg;} private byte[] desc_msg;
|
||||
public byte[] Desc_icon_url() {return desc_icon_url;} private byte[] desc_icon_url;
|
||||
public Xoh_arg_img_core Img_core_fmtr(boolean hctx_is_hdump) {return hctx_is_hdump ? img_core_hdump : img_core_basic;}
|
||||
private final Xoh_arg_img_core img_core_basic = new Xoh_arg_img_core__basic(), img_core_hdump = new Xoh_arg_img_core__hdump();
|
||||
public final Xoh_arg_img_core Img_core_fmtr = new Xoh_arg_img_core__basic();
|
||||
public final Xoh_file_html_fmtr__hdump Img_html_hdump_bldr = Xoh_file_html_fmtr__hdump.Hdump;
|
||||
public final Bry_bfr Tmp_bfr = Bry_bfr.new_(255);
|
||||
@Override public Xox_mgr Clone_new() {return new Imap_xtn_mgr();}
|
||||
@Override public void Xtn_init_by_wiki(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
@@ -43,6 +44,9 @@ public class Imap_xtn_mgr extends Xox_mgr_base implements GfoInvkAble {
|
||||
parser = new Imap_parser(this);
|
||||
init = true;
|
||||
}
|
||||
public void Clear() {
|
||||
}
|
||||
public static final byte[]
|
||||
Bry__usemap__html = Bry_.new_a7(" usemap=\"#imagemap_1_")
|
||||
, Bry__usemap__name = Bry_.new_a7("usemap")
|
||||
, Bry__usemap__prefix = Bry_.new_a7("#imagemap_1_")
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user