Enlightenment CVS committal
Author : davemds
Project : e17
Module : proto
Dir : e17/proto/edje_editor/src/bin
Modified Files:
evas.c evas.h interface.c main.h
Log Message:
* make the MiniWindow movable and fix some bug in it
* Use the new etk_colorpicker with alpha slider
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/evas.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- evas.c 20 Jan 2007 05:13:02 -0000 1.8
+++ evas.c 31 Jan 2007 06:02:21 -0000 1.9
@@ -12,22 +12,25 @@
on_Drag(void *data, Evas_Object *o, const char *emission, const char *source)
{
//printf("ON DRAG\n");
- Evas_Coord x,y;
- Evas_Coord parentx,parenty,parentw,parenth;
- Evas_Coord focusx,focusy,focusw,focush;
+ Evas_Coord x,y;
+ Evas_Coord parentx,parenty,parentw,parenth;
+ Evas_Coord focusx,focusy,focusw,focush;
int mouse_x, mouse_y;
+ // MoveBox
+ if ((int)data == DRAG_MOVEBOX)
+ {
+ evas_pointer_output_xy_get(etk_widget_toplevel_evas_get(ETK_canvas),&x,
&y);
+ //evas_object_move(rel1_handler,mouse_x-2,mouse_y-2);
+ ev_move_fake(x-30,y+8);//TODO
+ }
+
// Resize fake win
if ((int)data == DRAG_MINIARROW)
{
edje_object_part_geometry_get (EV_fakewin,"miniarrow", &x, &y, NULL,
NULL);
-
- /* if (Cur.eg->min.w && x < Cur.eg->min.w) x = Cur.eg->min.w;
- if (Cur.eg->min.h && y < Cur.eg->min.h) y = Cur.eg->min.h;
- if (Cur.eg->max.w && x > Cur.eg->max.w) x = Cur.eg->max.w;
- if (Cur.eg->max.h && y > Cur.eg->max.h) y = Cur.eg->max.h;
- */
-
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
ev_resize_fake((int)x,(int)y);
}
// Move Rel1 Point
@@ -86,13 +89,10 @@
//Calc the rel2_relative_y value
Cur.eps->rel2.relative.y = (float)(y - parenty)/(float)parenth;
-
UpdatePositionFrame();
}
-
ev_redraw();
-
//printf("Drag %s - ",source);
//printf("Position %i, %i\n", x, y);
//Evas_Coord mouse_x, mouse_y;
@@ -103,31 +103,39 @@
void
on_StartDrag(void *data, Evas_Object *o, const char *emission, const char
*source)
{
- printf("Start Drag\n");
- //int mouse_x, mouse_y;
-
-// evas_pointer_output_xy_get(etk_widget_toplevel_evas_get(ETK_canvas),
&mouse_x, &mouse_y);
-// printf("Mouse is at screen position %i, %i\n", mouse_x, mouse_y);
+ //printf("Start Drag\n");
if ((int)data == DRAG_REL1)
edje_object_signal_callback_add(rel1_handler,"DRAG","rel1",on_Drag,(void*)DRAG_REL1);
if ((int)data == DRAG_REL2)
edje_object_signal_callback_add(rel2_handler,"DRAG","rel2",on_Drag,(void*)DRAG_REL2);
+ if ((int)data == DRAG_MOVEBOX)
+ evas_object_event_callback_add(EV_movebox, EVAS_CALLBACK_MOUSE_MOVE,
on_Drag, (void*)DRAG_MOVEBOX);
}
+
void
on_EndDrag(void *data, Evas_Object *o, const char *emission, const char
*source)
{
- printf("End Drag\n");
+ //printf("End Drag\n");
if ((int)data == DRAG_REL1)
edje_object_signal_callback_del(rel1_handler,"DRAG","rel1",on_Drag);
if ((int)data == DRAG_REL2)
edje_object_signal_callback_del(rel2_handler,"DRAG","rel2",on_Drag);
+ if ((int)data == DRAG_MOVEBOX) evas_object_event_callback_del(EV_movebox,
EVAS_CALLBACK_MOUSE_MOVE, on_Drag);
+ if ((int)data == DRAG_MINIARROW)
+ {
+ int fw,fh; //Fakewin geometry
+ evas_object_geometry_get(EV_fakewin,NULL,NULL,&fw,&fh);
+ ev_resize_fake(fw,fh);
+ }
}
void
prepare_canvas(void)
{
+ int x, y;
//Create Focus Handler
focus_handler = edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
edje_object_file_set(focus_handler, EdjeFile, "FocusH");
+ etk_canvas_object_add (ETK_CANVAS(ETK_canvas), focus_handler);
//Create Rel1 handler
rel1_handler = edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
@@ -141,7 +149,6 @@
edje_object_signal_callback_add(rel2_handler,"START_DRAG","rel2",on_StartDrag,(void*)DRAG_REL2);
edje_object_signal_callback_add(rel2_handler,"END_DRAG","rel2",on_EndDrag,(void*)DRAG_REL2);
-
//Create Parent Handlers
rel1X_parent_handler =
edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
edje_object_file_set(rel1X_parent_handler, EdjeFile, "Rel1X_ParentH");
@@ -155,177 +162,29 @@
rel2Y_parent_handler =
edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
edje_object_file_set(rel2Y_parent_handler, EdjeFile, "Rel2Y_ParentH");
- //Create engrave canvas
+ //Create engrave canvas
ecanvas = engrave_canvas_new (etk_widget_toplevel_evas_get(ETK_canvas));
- // etk_canvas_object_add (ETK_CANVAS(ETK_canvas), ecanvas);
-
+ etk_canvas_object_add (ETK_CANVAS(ETK_canvas), ecanvas);
// Create Fake win
EV_fakewin = edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
edje_object_file_set(EV_fakewin, EdjeFile, "FakeWin");
- // etk_canvas_object_add(ETK_CANVAS(ETK_canvas),EV_fakewin);
-
+ etk_canvas_object_add(ETK_CANVAS(ETK_canvas),EV_fakewin);
edje_object_signal_callback_add(EV_fakewin,"DRAG","miniarrow",on_Drag,(void*)DRAG_MINIARROW);
+
edje_object_signal_callback_add(EV_fakewin,"END_DRAG","miniarrow",on_EndDrag,(void*)DRAG_MINIARROW);
- //evas_object_move (EV_fakewin,200+MAIN_LEFT, 200+MAIN_TOP);
- ev_resize_fake(200,200);
-
-
-
-}
-void
-ev_adjust_position(Engrave_Part_State* state, Evas_Object* object)
-{
- /*int ParentX = 0, ParentY = 0, ParentW = 0, ParentH = 0;
- int P1X = 0, P1Y = 0, P2X = 100, P2Y = 100;
- Engrave_Part *part = state->parent;
- Engrave_Group *group = part->parent;
- Engrave_Part *relto_part = NULL;
-
- if (ETK_canvas)
- {
- // Calculate first point
- //Assume we take relativity from the main interface
- evas_object_geometry_get(EV_fakewin, &ParentX, &ParentY, &ParentW,
&ParentH);
-
-
- if (state->rel1.to_x) //If rel1_to_x is found
- {
- relto_part = engrave_group_part_by_name_find(group, state->rel1.to_x);
- if (relto_part)
- {
- ParentX = relto_part->pos.x;
- ParentW = relto_part->pos.w;
- }
- }
- if (state->rel1.to_y) //If rel1_to_y is found
- {
- relto_part = engrave_group_part_by_name_find(group, state->rel1.to_y);
- if (relto_part)
- {
- ParentY = relto_part->pos.y;
- ParentH = relto_part->pos.h;
- }
- }
- //Calculate relativity
- P1X = ParentX + (ParentW * state->rel1.relative.x) +
state->rel1.offset.x;
- P1Y = ParentY + (ParentH * state->rel1.relative.y) +
state->rel1.offset.y;
-
- //Calculate second point
- evas_object_geometry_get(EV_fakewin, &ParentX, &ParentY, &ParentW,
&ParentH);
- if (state->rel2.to_x){
- relto_part = engrave_group_part_by_name_find(group, state->rel2.to_x);
- if (relto_part)
- {
- ParentX = relto_part->pos.x;
- ParentW = relto_part->pos.w;
- }
- }
- if (state->rel2.to_y){
- relto_part = engrave_group_part_by_name_find(group, state->rel2.to_y);
- if (relto_part)
- {
- ParentY = relto_part->pos.y;
- ParentH = relto_part->pos.h;
- }
- }
- P2X = ParentX + (ParentW * state->rel2.relative.x) +
state->rel2.offset.x;
- P2Y = ParentY + (ParentH * state->rel2.relative.y) +
state->rel2.offset.y;
-
-
- //Calculate real coord
- part->pos.x = P1X;
- part->pos.y = P1Y;
-
- part->pos.w = P2X-P1X;
- part->pos.h = P2Y-P1Y;
+ // Create MoveBox
+ EV_movebox =
evas_object_rectangle_add(etk_widget_toplevel_evas_get(ETK_canvas));
+ etk_canvas_object_add (ETK_CANVAS(ETK_canvas), EV_movebox);
+ evas_object_color_set(EV_movebox, 0, 0, 0, 0);
+ evas_object_event_callback_add(EV_movebox, EVAS_CALLBACK_MOUSE_DOWN,
on_StartDrag, (void*)DRAG_MOVEBOX);
+ evas_object_event_callback_add(EV_movebox, EVAS_CALLBACK_MOUSE_UP,
on_EndDrag, (void*)DRAG_MOVEBOX);
- //Reposition the object
- evas_object_move(object,part->pos.x,part->pos.y);
- evas_object_resize(object,part->pos.w,part->pos.h);
+ //Place Fakewin
+ ev_move_fake(20,27);
- if (part->type == ENGRAVE_PART_TYPE_IMAGE){
- evas_object_image_fill_set(part->object,0,0,part->pos.w,part->pos.h);
- }
- } */
}
-void
-ev_draw_part(Engrave_Part* part)
-{
- /* Engrave_Part_State *state = NULL;
- Evas *e = etk_widget_toplevel_evas_get(ETK_canvas);
- char buf[4096];
- //printf("***DRAW PART: %s\n",part->name);
-
- if (part->current_state)
- state = part->current_state;
- else
- state = part->states->data;
-
- if (state)
- {
- switch (part->type)
- {
- case ENGRAVE_PART_TYPE_RECT:
- if (!part->object) //Create RECT
- {
- part->object = evas_object_rectangle_add(e);
- etk_canvas_object_add (ETK_CANVAS(ETK_canvas), part->object);
- }
- //Set the color
- evas_object_color_set(part->object,
- state->color.r, state->color.g,state->color.b, state->color.a);
- break;
- case ENGRAVE_PART_TYPE_IMAGE:
- if (!part->object) //Create IMAGE
- {
- printf("** CREATE ** %s\n",part->name);
- part->object = evas_object_image_add(e);
- etk_canvas_object_add (ETK_CANVAS(ETK_canvas), part->object);
- }
-
snprintf(buf,4096,"%s/%s",OpenFile->im_dir,state->image.normal->name);
- //printf("IMAGE: %s\n",buf);
- //Set the image file
- evas_object_image_file_set(part->object, buf, "");
- //Set the alpha
- evas_object_color_set(part->object,
- state->color.a, state->color.a, state->color.a, state->color.a);
- //Set the border
- evas_object_image_border_set(part->object,state->image.border.l,
-
state->image.border.r,state->image.border.t,state->image.border.b);
-
- break;
- / *case PART_TYPE_TEXT:
- if (!part->ev_obj){ //Create TEXT
- part->ev_obj = evas_object_text_add
(etk_widget_toplevel_evas_get(ETK_canvas));
- etk_canvas_object_add (ETK_CANVAS(ETK_canvas), part->ev_obj);
- }
- evas_object_text_text_set(part->ev_obj,descr->text_text->str);
- g_string_printf(str,"%s/%s",EDCFileDir->str,descr->text_font->str);
- evas_object_text_font_set (part->ev_obj,
str->str,descr->text_size);
- evas_object_color_set(part->ev_obj, descr->color_r,
descr->color_g, descr->color_b, descr->color_a);
- evas_object_text_shadow_color_set(part->ev_obj, descr->color2_r,
descr->color2_g, descr->color2_b, descr->color2_a);
- evas_object_text_outline_color_set(part->ev_obj, descr->color3_r,
descr->color3_g, descr->color3_b, descr->color3_a);
- switch (part->effect){
- case FX_OUTLINE: evas_object_text_style_set(part->ev_obj,
EVAS_TEXT_STYLE_OUTLINE); break;
- case FX_SOFT_OUTLINE: evas_object_text_style_set(part->ev_obj,
EVAS_TEXT_STYLE_SOFT_OUTLINE); break;
- case FX_SHADOW: evas_object_text_style_set(part->ev_obj,
EVAS_TEXT_STYLE_SHADOW); break;
- case FX_SOFT_SHADOW: evas_object_text_style_set(part->ev_obj,
EVAS_TEXT_STYLE_SOFT_SHADOW); break;
- case FX_OUTLINE_SHADOW:
evas_object_text_style_set(part->ev_obj, EVAS_TEXT_STYLE_OUTLINE_SHADOW); break;
- case FX_OUTLINE_SOFT_SHADOW:
evas_object_text_style_set(part->ev_obj, EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW);
break;
- default: evas_object_text_style_set(part->ev_obj,
EVAS_TEXT_STYLE_PLAIN);break;
- }
- break; */
- /*}
-
- if (part->object)
- {
- ev_adjust_position(state,part->object);
- evas_object_show(part->object);
- }
- } */
-}
void
ev_draw_focus(void)
{
@@ -341,13 +200,16 @@
// If a part is selected draw the Focus Handler (only the yellow box)
if (Cur.ep && Cur.ep->current_state)
{
+ int x, y;
+ etk_canvas_object_geometry_get(ETK_canvas,EV_fakewin,&x,&y,NULL,NULL);
+
etk_canvas_object_move(ETK_CANVAS(ETK_canvas),focus_handler,
- Cur.ep->pos.x + MAIN_LEFT - Cur.ep->current_state->rel1.offset.x -
1,
- Cur.ep->pos.y + MAIN_TOP - Cur.ep->current_state->rel1.offset.y -
1);
+ Cur.ep->pos.x + x - Cur.ep->current_state->rel1.offset.x - 2,
+ Cur.ep->pos.y + y - Cur.ep->current_state->rel1.offset.y - 2);
evas_object_resize(focus_handler,
- Cur.ep->pos.w + Cur.ep->current_state->rel1.offset.x -
Cur.ep->current_state->rel2.offset.x + 1,
- Cur.ep->pos.h + Cur.ep->current_state->rel1.offset.y -
Cur.ep->current_state->rel2.offset.y + 1);
+ Cur.ep->pos.w + Cur.ep->current_state->rel1.offset.x -
Cur.ep->current_state->rel2.offset.x + 2,
+ Cur.ep->pos.h + Cur.ep->current_state->rel1.offset.y -
Cur.ep->current_state->rel2.offset.y + 2);
evas_object_raise (focus_handler);
evas_object_show(focus_handler);
}else
@@ -456,6 +318,7 @@
evas_object_show(rel2X_parent_handler);
evas_object_raise (rel2Y_parent_handler);
evas_object_show(rel2Y_parent_handler);
+ evas_object_raise (focus_handler);
}else{
edje_object_signal_emit(rel1_handler,"REL1_HIDE","cprog");
@@ -468,6 +331,7 @@
evas_object_hide(rel2_handler);
}
}
+
void
ev_resize_fake(int w, int h)
{
@@ -488,8 +352,17 @@
//printf("RESIZE: %d %d./ed \n",w,h);
evas_object_resize(EV_fakewin, w, h);
+ evas_object_resize(EV_movebox, w, 10);
edje_object_part_drag_value_set (EV_fakewin, "miniarrow", (double)w,
(double)h);
}
+
+void
+ev_move_fake(int x, int y)
+{
+ //printf("MOVEBOX: %d %d\n",x,y);
+ evas_object_move(EV_fakewin, x, y);
+ evas_object_move(EV_movebox, x, y-14);
+}
void
ev_redraw(void)
{
@@ -502,9 +375,6 @@
//Get the geometry of ETK_canvas
evas_object_geometry_get(EV_canvas_bg,&x,&y,&w,&h);
- //Place Fakewin
- evas_object_move(EV_fakewin, x + 20, y + 27);
-
//Get the geometry of fakewin
evas_object_geometry_get(EV_fakewin,&x,&y,&w,&h);
@@ -514,7 +384,9 @@
evas_object_show(ecanvas);
evas_object_show(EV_fakewin);
+ evas_object_show(EV_movebox);
evas_object_raise(EV_fakewin);
+ evas_object_raise(EV_movebox);
evas_object_raise(focus_handler);
ev_draw_focus();
@@ -522,6 +394,7 @@
{
evas_object_hide(ecanvas);
evas_object_hide(EV_fakewin);
+ evas_object_hide(EV_movebox);
evas_object_hide(rel1X_parent_handler);
evas_object_hide(rel1Y_parent_handler);
evas_object_hide(rel2X_parent_handler);
@@ -530,17 +403,5 @@
evas_object_hide(rel2_handler);
}
}
-void
-ev_hide_group(Engrave_Group* group)
-{
-/* Engrave_Part *part;
- Evas_List *l;
- for (l = group->parts; l; l = l->next)
- {
- part = l->data;
- evas_object_hide(part->object);
- }
- evas_object_hide(focus_handler); */
-}
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/evas.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas.h 13 Jan 2007 03:11:32 -0000 1.3
+++ evas.h 31 Jan 2007 06:02:21 -0000 1.4
@@ -1,9 +1,9 @@
-
void ev_redraw (void);
void ev_draw_focus (void);
void ev_draw_part (Engrave_Part* part);
void ev_resize_fake (int w, int h);
+void ev_move_fake (int x, int y);
void ev_hide_group (Engrave_Group* group);
void prepare_canvas (void);
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/interface.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- interface.c 20 Jan 2007 05:13:02 -0000 1.15
+++ interface.c 31 Jan 2007 06:02:21 -0000 1.16
@@ -1714,6 +1714,7 @@
//ColorPicker
UI_ColorPicker = etk_colorpicker_new();
+ etk_colorpicker_use_alpha_set (UI_ColorPicker, TRUE);
etk_container_add(ETK_CONTAINER(UI_ColorWin), UI_ColorPicker);
//UI_MainWin
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- main.h 19 Jan 2007 08:49:00 -0000 1.5
+++ main.h 31 Jan 2007 06:02:21 -0000 1.6
@@ -78,6 +78,7 @@
DRAG_MINIARROW,
DRAG_REL1,
DRAG_REL2,
+ DRAG_MOVEBOX,
REL_COMBO_INTERFACE
};
@@ -99,6 +100,7 @@
Evas_Object *EV_canvas_bg; //
Evas_Object *EV_canvas_shadow; //
Evas_Object *EV_fakewin; //The simple window implementation
+Evas_Object *EV_movebox; // FIXME
Evas_Object *focus_handler; //The yellow box around the selected
part
Evas_Object *rel1_handler; //The red point
Evas_Object *rel2_handler; //The blue point
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs