OSDN Git Service

unite copying resdata function.
authorornse01 <ornse01@users.sourceforge.jp>
Sun, 18 Apr 2010 05:24:46 +0000 (05:24 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Sun, 18 Apr 2010 05:24:46 +0000 (05:24 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@102 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/Makefile
src/bchan.d
src/main.c

index e5cb975..896661f 100644 (file)
@@ -38,7 +38,7 @@ VPATH = $(S)
 HEADER := $(S) $(HEADER)
 
 # ¥½¡¼¥¹¥Õ¥¡¥¤¥ë
-SRC =  main.c cache.c parser.c layout.c window.c retriever.c tadlib.c confirm.c poptray.c postres.c http.c submit.c sjisstring.c parselib.c submitutil.c bchan_vobj.c tadurl.c bchan_panels.c
+SRC =  main.c cache.c parser.c layout.c window.c retriever.c tadlib.c confirm.c poptray.c postres.c http.c submit.c sjisstring.c parselib.c submitutil.c bchan_vobj.c tadurl.c bchan_panels.c bchan_menus.c
 
 # ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
 DBSRC =
index 99d71cb..8c0bfda 100644 (file)
@@ -55,6 +55,8 @@
 .TEXT_THREADNUMBER     =       42
 .TEXT_THREADINFO       =       43
 .MSGTEXT_CANTRETRIEVE  =       44
+.GMENU_RESNUMBER       =       45
+.MLIST_RESNUMBER       =       46
 
 ---------
 -- data type = PARTS_DATA
        {# MSGTEXT_CANTRETRIEVE 0 0}    -- data number
        "¥¹¥ì¥Ã¥É¾ðÊó¤¬Â¸ºß¤·¤Ê¤¤¤¿¤á¤³¤ÎÁàºî¤Ï¤Ç¤­¤Þ¤»¤ó\0"
 
+       {# MLIST_RESNUMBER 0 0}     -- data number
+       MC_STR+MC_IND "¥ì¥¹¤Î£Î£Ç»ØÄê"
+       MC_STR "¤³¤Î¥ì¥¹¤ò¥È¥ì¡¼¤ËÊ£¼Ì\0"
+
 ---------
 -- data type = MENU_DATA
 ---------
        0L 0L 0L 0L 0L  -- [¾®Êª]
 
 ---------
+-- data type = GMENU_DATA
+---------
+       {% 9 0}                 -- datatype GMENU_DATA
+       {# GMENU_RESNUMBER 0 0}         -- data number
+       1L      -- frame
+       0L      -- bgpat
+       0L      -- indpat
+       -1L     -- chcol
+       0H 0H 250H 40H  -- area
+       0L      -- inact
+       0L      -- select
+       0L      -- desc
+       MLIST_RESNUMBER:L       -- dnum
+       0L      -- ptr
+       2L      -- nitem
+       26H 3H 240H 19H -- r[0]
+       10H 21H 240H 37H        -- r[1]
+
+---------
 -- data type = USER_DATA
 ---------
        {% 64 0}                -- datatype USER_DATA
index 670a56a..7f4ad02 100644 (file)
@@ -53,6 +53,7 @@
 #include       "sjisstring.h"
 #include       "bchan_vobj.h"
 #include       "bchan_panels.h"
+#include       "bchan_menus.h"
 
 #ifdef BCHAN_CONFIG_DEBUG
 # define DP(arg) printf arg
@@ -81,6 +82,7 @@
 #define BCHAN_DBX_FFUSEN_VIEWER 36
 #define BCHAN_DBX_MSGTEXT_NOTFOUND     37
 #define BCHAN_DBX_MSGTEXT_CANTRETRIEVE 44
+#define BCHAN_DBX_GMENU_RESNUMBER 45
 
 #define BCHAN_MENU_WINDOW 4
 
@@ -146,6 +148,7 @@ struct bchan_t_ {
        MNID mnid;
 
        bchan_hmistate_t hmistate;
+       bchan_resmenu_t resmenu;
 
        datretriever_t *retriever;
        datcache_t *cache;
@@ -172,6 +175,7 @@ void        killme(bchan_t *bchan)
 {
        gset_ptr(PS_BUSY, NULL, -1, -1);
        pdsp_msg(NULL);
+       bchan_resmenu_finalize(&bchan->resmenu);
        if (bchan->exectype == EXECREQ) {
                oend_prc(bchan->vid, NULL, 0);
        }
@@ -607,6 +611,29 @@ LOCAL VOID bchan_scrollbyahcnor(bchan_t *bchan, UB *data, W data_len)
        datwindow_scrollbyvalue(bchan->window, 0 - cl, tt - ct);
 }
 
+LOCAL VOID bchan_butdn_pressnumber(bchan_t *bchan, WEVENT *wev, W resindex)
+{
+       W size, err;
+       PNT pos;
+       B *data;
+
+       DP(("press DATDRAW_FINDACTION_TYPE_NUMBER: %d\n", resindex + 1));
+       pos.x = wev->s.pos.x;
+       pos.y = wev->s.pos.y;
+       gcnv_abs(bchan->gid, &pos);
+       err = bchan_resmenu_select(&bchan->resmenu, pos);
+       if (err == BCHAN_RESMENU_SELECT_PUSHTRAY) {
+               size = datlayout_resindextotraytextdata(bchan->layout, resindex, NULL, 0);
+               data = malloc(size);
+               if (data == NULL) {
+                       return;
+               }
+               datlayout_resindextotraytextdata(bchan->layout, resindex, data, size);
+               bchan_pushstringtotray((TC*)data, size/2);
+               free(data);
+       }
+}
+
 LOCAL VOID bchan_butdn(VP arg, WEVENT *wev)
 {
        bchan_t *bchan = (bchan_t*)arg;
@@ -645,7 +672,7 @@ LOCAL VOID bchan_butdn(VP arg, WEVENT *wev)
                return;
        }
        if (type == DATDRAW_FINDACTION_TYPE_NUMBER) {
-               DP(("press DATDRAW_FINDACTION_TYPE_NUMBER: %d\n", resindex + 1));
+               bchan_butdn_pressnumber(bchan, wev, resindex);
                return;
        }
        if (type != DATDRAW_FINDACTION_TYPE_URL) {
@@ -944,6 +971,11 @@ LOCAL W bchan_initialize(bchan_t *bchan, VID vid, WID wid, W exectype)
                DP_ER("mcre_men error", mnid);
                goto error_mcre_men;
        }
+       err = bchan_resmenu_initialize(&bchan->resmenu, BCHAN_DBX_GMENU_RESNUMBER);
+       if (err < 0) {
+               DP_ER("bchan_resmenu_initialize", err);
+               goto error_resmenu_initialize;
+       }
 
        bchan_hmistate_initialize(&bchan->hmistate);
 
@@ -976,6 +1008,8 @@ LOCAL W bchan_initialize(bchan_t *bchan, VID vid, WID wid, W exectype)
 
        return 0;
 
+error_resmenu_initialize:
+       mdel_men(mnid);
 error_mcre_men:
        free(mnitem);
 error_mnitem: