description
{
state: "default" 0.0;
- rel1 { relative: 0.005 0.035; to: "background"; }
- rel2 { relative: 0.995 0.88; to: "background"; }
+ rel1 { relative: 0.005 0.033; to: "background"; }
+ rel2 { relative: 0.995 0.954; to: "background"; }
}
}
description
{
state: "default" 0.0;
- rel1 { relative: 0.0 0.89; to: "background";}
- rel2 { relative: 1.0 0.99; to: "background";}
+ rel1 { relative: 0.0 0.92; to: "background";}
+ rel2 { relative: 1.0 1.00; to: "background";}
color: 0 0 0 0;
}
}
state: "default" 0.0;
rel1 { relative: 0.0 0.0; to: "background/close";}
rel2 { relative: 1.0 1.0; to: "background/close";}
- align: 0.5 0.5;
+ align: 0.5 0.4;
min: 18 12;
max: 18 12;
image
state: "default" 0.0;
rel1.to: "elm.swallow.icon";
rel2.to: "elm.swallow.icon";
- align: 0.95 0.01;
+ align: 1.0 0.0;
min: 46 40;
max: 46 40;
color: 0 0 0 0;
#define N_IMAGES (1)
#define GRID_ITEM_SPACE_W 6
-#define GRID_ITEM_SINGLE_W 187
-#define GRID_ITEM_SINGLE_H 151
+#define GRID_ITEM_SINGLE_W 185
+#define GRID_ITEM_SINGLE_H 161
#define GRID_ITEM_W (GRID_ITEM_SINGLE_W+(GRID_ITEM_SPACE_W*2))
#define GRID_ITEM_H (GRID_ITEM_SINGLE_H)
#define GRID_IMAGE_LIMIT_W 91
if (pos < 0)
pos = pos+HISTORY_QUEUE_MAX_ITEMS;
- if (get_item_contents_by_pos(pos) != NULL && strlen(get_item_contents_by_pos(pos)) > 0)
+ if (clipdrawer_get_item_data(ad, pos) != NULL && strlen(clipdrawer_get_item_data(ad, pos)) > 0)
{
- unesc = clipdrawer_get_plain_string_from_escaped(get_item_contents_by_pos(pos));
+ unesc = clipdrawer_get_plain_string_from_escaped(clipdrawer_get_item_data(ad, pos));
unesc = unesc ? unesc : "";
elm_list_item_append(ad->txtlist, unesc, NULL, NULL, NULL, ad);
free(unesc);
eina_strbuf_replace_all(strent, " absize=240x180 ", " absize=52x39 ");
if (strcnt > 100)
eina_strbuf_append(strent, "...");
+ eina_strbuf_prepend(strent, "<font_size=18>");
elm_scrolled_entry_entry_set(ientry, eina_strbuf_string_get(strent));
elm_scrolled_entry_editable_set(ientry, EINA_FALSE);
sgobj = elm_gengrid_selected_item_get(ad->hig);
griditem_t *ti = NULL;
ti = elm_gengrid_item_data_get(sgobj);
-
- fprintf(stderr, "## grid_click_paste = 0x%x\n", event_info);
}
void _grid_del(const void *data, Evas_Object *obj)
free(ti);
}
+char* clipdrawer_get_item_data(void *data, int pos)
+{
+ struct appdata *ad = data;
+ griditem_t *ti = NULL;
+ griditem_t *newgi = NULL;
+ int count = 0;
+
+ if (pos < 0 || pos > ad->hicount)
+ return NULL;
+
+ Elm_Gengrid_Item *item = elm_gengrid_first_item_get(ad->hig);
+ while (item)
+ {
+ ti = elm_gengrid_item_data_get(item);
+ if (count == pos)
+ {
+ if (!ti)
+ break;
+ if (ti->itype == GI_TEXT)
+ return (char*)eina_strbuf_string_get(ti->istrdata);
+ else
+ return ti->ipathdata;
+ }
+ count++;
+ item = elm_gengrid_item_next_get(item);
+ }
+
+ return NULL;
+}
+
// FIXME: how to remove calling g_get_main_appdata()?
// it's mainly used at 'clipdrawer_image_item'
int clipdrawer_add_item(char *idata, int type)
}
item = elm_gengrid_item_next_get(item);
}
-
newgi->ipathdata = eina_stringshare_add(idata);
}
// for debug
// at starting, showing app view
-// clipdrawer_activate_view(ad);
-
-// clipdrawer_anim_show_effect(ad);
+ //clipdrawer_activate_view(ad);
return 0;
}
case HIDE_ANIM:
deltay = (int)((anim_endy-anim_starty)*posprop);
evas_object_move(ad->win_main, 0, anim_starty+deltay);
- //fprintf(stderr, "## cur pos y = %d\n", anim_starty+deltay);
break;
case SHOW_ANIM:
deltay = (int)((anim_starty-anim_endy)*posprop);
evas_object_move(ad->win_main, 0, anim_starty-deltay);
- //fprintf(stderr, "## cur pos y = %d\n", anim_starty-deltay);
break;
default:
return EINA_FALSE;
{
struct appdata *ad = data;
- fprintf(stderr, "## _change_gengrid_paste_textonly_mode = %d\n", clipdrawer_paste_textonly_get(ad));
-
Elm_Gengrid_Item *item;
griditem_t *ti = NULL;
ti = elm_gengrid_item_data_get(item);
if ((ti->itype == GI_IMAGE) && (ti->ilayout))
{
- fprintf(stderr, "## sig to hide delbtn\n");
-
edje_object_signal_emit(elm_layout_edje_get(ti->ilayout), "elm,state,hide,delbtn", "elm");
Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(ad->hig));
evas_object_color_set(rect, 0, 0, 0, 200);
while (item)
{
ti = elm_gengrid_item_data_get(item);
- fprintf(stderr, "## itype = %d\n", ti->itype);
- fprintf(stderr, "## ilayout = 0x%x\n", ti->ilayout);
if ((ti->itype == GI_IMAGE) && (ti->ilayout))
{
- fprintf(stderr, "## sig to show delbtn\n");
-
edje_object_signal_emit(elm_layout_edje_get(ti->ilayout), "elm,state,show,delbtn", "elm");
Evas_Object *rect = elm_layout_content_unset(ti->ilayout, "elm.swallow.cover");
evas_object_hide(rect);
const char* clipdrawer_get_plain_string_from_escaped(char *escstr);
+char *clipdrawer_get_item_data(void *data, int pos);
int clipdrawer_add_item(char *idata, int type);
void clipdrawer_paste_textonly_set(void *data, Eina_Bool textonly);
#include "common.h"
+#include "cbhm_main.h"
#include "storage.h"
/*
#define STORAGE_BODY_SIZE (STORAGE_MAX_ITEMS * BODY_ITEM_SIZE)
#define TOTAL_STORAGE_SIZE (STORAGE_HEADER_SIZE+STORAGE_BODY_SIZE)
-#define GET_ITEM_ADDR_BY_POSITION(map, pos) (map+STORAGE_HEADER_SIZE+pos*BODY_ITEM_SIZE)
+#define GET_HEADER_ADDR_BY_POSITION(pos) (STORAGE_HEADER_SIZE+pos*(HEADER_ITEM_SIZE+BODY_ITEM_SIZE))
+#define GET_BODY_ADDR_BY_POSITION(pos) (GET_HEADER_ADDR_BY_POSITION(pos)+HEADER_ITEM_SIZE)
-static int g_storage_fd = 0;
+static FILE *g_storage_file = NULL;
static unsigned int g_storage_serial_number = 0;
-static char *g_map = NULL;
-int init_storage()
+int init_storage(void *data)
{
+ struct appdata *ad = data;
+
int i;
int result = 0;
- if (g_storage_fd != 0)
+ if (g_storage_file)
return 1;
- g_storage_fd = open(STORAGE_FILEPATH, O_RDWR | O_CREAT, (mode_t)0600);
- if (g_storage_fd == -1)
- {
- g_storage_fd = 0;
- close_storage();
- DTRACE("Error : failed openning file for writing\n");
- return -1;
- }
-
- result = lseek(g_storage_fd, TOTAL_STORAGE_SIZE-1, SEEK_SET);
- if (result == -1)
- {
- close_storage();
- DTRACE("Error : failed moving file position to file's end\n");
- return -1;
- }
-
- result = write(g_storage_fd, "", 1);
- if (result != 1)
- {
- close_storage();
+ g_storage_file = fopen(STORAGE_FILEPATH, "r+");
+ if (!g_storage_file)
+ { // making data savefile
+ g_storage_file = fopen(STORAGE_FILEPATH, "w+");
+
+ if (!g_storage_file)
+ {
+ close_storage(ad);
+ DTRACE("Error : failed openning file for writing\n");
+ return -1;
+ }
+
+ result = fseek(g_storage_file, TOTAL_STORAGE_SIZE-1, SEEK_SET);
+ if (!result)
+ {
+ close_storage(ad);
+ DTRACE("Error : failed moving file position to file's end\n");
+ return -1;
+ }
+
+ result = fputc(0, g_storage_file);
+ if (result == EOF)
+ {
DTRACE("Error : failed writing to file's end\n");
return -1;
- }
-
- g_map = mmap(0, TOTAL_STORAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, g_storage_fd, 0);
- if (g_map == MAP_FAILED)
- {
- close_storage();
- DTRACE("Error : failed mmapping the file\n");
- return -1;
+ }
}
- // FIXME : do not unconditionaly initialize, maybe old data can be
- // at here
- int *header = g_map;
- for (i = 0; i < STORAGE_MAX_ITEMS; i++)
- {
- char d = 0;
- header[i] = 0;
- memcpy(GET_ITEM_ADDR_BY_POSITION(g_map, i), &d, 1);
- }
DTRACE("Success : storage init is done\n");
g_storage_serial_number = 0;
return 0;
}
-int sync_storage()
+int sync_storage(void *data)
{
- if (g_map == NULL)
+// struct appdata *ad = data;
+
+ if (!g_storage_file)
{
- DTRACE("g_map is null\n");
+ DTRACE("g_storage_file is null\n");
return -1;
}
- msync(g_map, TOTAL_STORAGE_SIZE, MS_ASYNC);
+ fsync(g_storage_file);
return 0;
}
-int get_total_storage_size()
+unsigned int get_storage_serial_code(void *data)
{
- return TOTAL_STORAGE_SIZE;
-}
+// struct appdata *ad = data;
-unsigned int get_storage_serial_code()
-{
return g_storage_serial_number;
}
-int adding_item_to_storage(int pos, char *data)
+int adding_item_to_storage(void *data, int pos, char *idata)
{
- int *header = get_storage_start_addr();
+// struct appdata *ad = data;
- if (g_map == NULL)
+ if (!g_storage_file)
{
- DTRACE("g_map is null");
+ DTRACE("g_storage_file is null\n");
return -1;
}
- // saving relative addr at header
- header[pos] = STORAGE_HEADER_SIZE+pos*BODY_ITEM_SIZE;
- memcpy(GET_ITEM_ADDR_BY_POSITION(g_map, pos), data, BODY_ITEM_SIZE);
+
+ int result;
+ result = fseek(g_storage_file, GET_HEADER_ADDR_BY_POSITION(pos), SEEK_SET);
+ // FIXME : replace from fprintf to fwrite
+ fprintf(g_storage_file, "%d", strlen(idata));
+ fprintf(g_storage_file, "%s", idata);
+
g_storage_serial_number++;
return 0;
}
-char *get_storage_start_addr()
-{
- return g_map;
-}
-
-int get_item_counts()
+int get_item_counts(void *data)
{
- int i, count;
- int *header = get_storage_start_addr();
+ struct appdata *ad = data;
- count = 0;
- for (i = 0; i < STORAGE_MAX_ITEMS; i++)
- {
- if (header[i] != 0)
- count++;
- }
- return count;
-}
-
-char *get_item_contents_by_pos(int pos)
-{
- if (g_map == NULL)
- {
- DTRACE("g_map is null");
- return NULL;
- }
- return GET_ITEM_ADDR_BY_POSITION(g_map, pos);
+ return ad->hicount;
}
-int close_storage()
+int close_storage(void *data)
{
- if (g_map)
- munmap(g_map, TOTAL_STORAGE_SIZE);
- g_map = NULL;
+ struct appdata *ad = data;
- if (g_storage_fd)
- close(g_storage_fd);
- g_storage_fd = 0;
+ if (g_storage_file)
+ fclose(g_storage_file);
+ g_storage_file = NULL;
g_storage_serial_number = 0;
return 0;
#include <fcntl.h>
#include <sys/mman.h>
-int init_storage();
-int sync_storage();
-unsigned int get_storage_serial_code();
-int adding_item_to_storage(int pos, char *data);
-char *get_storage_start_addr();
-int get_item_counts();
-char *get_item_contents_by_pos(int pos);
-int close_storage();
+int init_storage(void *data);
+int sync_storage(void *data);
+unsigned int get_storage_serial_code(void *data);
+int adding_item_to_storage(void *data, int pos, char *idata);
+int get_item_counts(void *data);
+int close_storage(void *data);
int check_regular_file(char *path);
#include "xcnphandler.h"
#include "storage.h"
#include "clipdrawer.h"
+#include "scrcapture.h"
static Ecore_Event_Handler *xsel_clear_handler = NULL;
static Ecore_Event_Handler *xsel_request_handler = NULL;
if (len <= 0)
return -1;
- if (g_lastest_content == NULL)
- g_lastest_content = malloc(sizeof(char)*(HISTORY_QUEUE_ITEM_SIZE));
+// if (g_lastest_content == NULL)
+// g_lastest_content = malloc(sizeof(char)*(HISTORY_QUEUE_ITEM_SIZE));
if (g_history_pos >= HISTORY_QUEUE_MAX_ITEMS)
g_history_pos = 0;
// FIXME: remove g_lasteset_content
//strcpy(g_lastest_content, src);
- memcpy(g_lastest_content, src, len);
- g_lastest_content[len] = '\0';
- adding_item_to_storage(g_history_pos, g_lastest_content);
+// memcpy(g_lastest_content, src, len);
+// g_lastest_content[len] = '\0';
+ g_lastest_content = src;
+ adding_item_to_storage(ad, g_history_pos, g_lastest_content);
increment_current_history_position();
int nserial = 0;
- nserial = get_storage_serial_code();
+ nserial = get_storage_serial_code(ad);
Atom atomCbhmSerial = XInternAtom(g_disp, "CBHM_SERIAL_NUMBER", False);
XChangeProperty(g_disp, g_evtwin, atomCbhmSerial, XA_INTEGER,
32, PropModeReplace,
return 0;
}
-int print_storage_buffer()
+int print_storage_buffer(void *data)
{
+ struct appdata *ad = data;
+
int pos;
int i = 0;
for (i = 0; i < HISTORY_QUEUE_MAX_ITEMS; i++)
pos = get_current_history_position()+i;
if (pos > HISTORY_QUEUE_MAX_ITEMS-1)
pos = pos-HISTORY_QUEUE_MAX_ITEMS;
- DTRACE("%d: %s\n", i, get_item_contents_by_pos(pos) != NULL ? get_item_contents_by_pos(pos) : "NULL");
+ DTRACE("%d: %s\n", i,
+ clipdrawer_get_item_data(ad, pos) != NULL ? clipdrawer_get_item_data(ad, pos) : "NULL");
}
}
check_regular_file(cbbuf+7))
{
DTRACE("clipdrawer add path = %s\n", cbbuf+7);
- clipdrawer_add_item(cbbuf+7, GI_IMAGE);
+ clipdrawer_add_item(ad, cbbuf+7, GI_IMAGE);
}
else
{
add_to_storage_buffer(ad, cbbuf, unesc_len);
- clipdrawer_add_item(cbbuf, GI_TEXT);
+ clipdrawer_add_item(ad, cbbuf, GI_TEXT);
}
DTRACE("len = %ld, data = %s\n", unesc_len, cbbuf);
#endif
#endif
DTRACE("\n");
- print_storage_buffer();
+ print_storage_buffer(ad);
DTRACE("\n");
XFree(cbbuf);
_set_cbhmwin_prop();
_init_atoms();
- init_storage();
+ init_storage(ad);
DTRACE("_cbhm_init ok\n");
static void _cbhm_fini()
{
- close_storage();
+ struct appdata *ad = g_get_main_appdata();
+
+ close_storage(ad);
return;
}
if (strcmp("get count", ev->data.b) == 0)
{
- int icount = get_item_counts();
+ int icount = get_item_counts(ad);
char countbuf[10];
DTRACE("## cbhm count : %d\n", icount);
sprintf(countbuf, "%d", icount);
// FIXME : handle with correct atom
sprintf(atomname, "CBHM_c%d", num);
cbhm_atoms[0] = XInternAtom(g_disp, atomname, False);
- if (get_item_contents_by_pos(num) != NULL)
+ if (clipdrawer_get_item_data(ad, num) != NULL)
{
XChangeProperty(g_disp, reqwin, cbhm_atoms[0], atomUTF8String,
8, PropModeReplace,
- (unsigned char *) get_item_contents_by_pos(num),
- (int) strlen(get_item_contents_by_pos(num)));
+ (unsigned char *) clipdrawer_get_item_data(ad, num),
+ (int) strlen(clipdrawer_get_item_data(ad, num)));
}
}
}
DTRACE("## %d -> %d\n", i, pos);
sprintf(atomname, "CBHM_c%d", i);
cbhm_atoms[i] = XInternAtom(g_disp, atomname, False);
- if (get_item_contents_by_pos(pos) != NULL)
+ if (clipdrawer_get_item_data(ad, pos) != NULL)
{
XChangeProperty(g_disp, reqwin, cbhm_atoms[i], atomUTF8String,
8, PropModeReplace,
- (unsigned char *) get_item_contents_by_pos(pos) ,
- (int) strlen(get_item_contents_by_pos(pos)));
+ (unsigned char *) clipdrawer_get_item_data(ad, pos),
+ (int) strlen(clipdrawer_get_item_data(ad, pos)));
}
pos--;
if (pos < 0)
}
else if (strcmp("get raw", ev->data.b) == 0)
{
+/*
if (get_storage_start_addr != NULL)
{
XChangeProperty(g_disp, reqwin, atomCBHM_cRAW, atomUTF8String,
(unsigned char *) get_storage_start_addr(),
(int) get_total_storage_size());
}
+*/
}
else if (strncmp("show", ev->data.b, 4) == 0)
{