From 9f5559025cb9858758151b97a338fc1b2f2ff007 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 8 Oct 2012 13:57:13 +0000 Subject: [PATCH] Made bitmap view and path AppMessage targets. Picture files can now be dragged from Wanderer and dropped on these areas to choose that picture. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@45872 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/muimaster/classes/area.h | 2 +- workbench/libs/muimaster/classes/imageadjust.c | 41 +++++++++++++++++++++- .../libs/muimaster/classes/imageadjust_private.h | 1 + workbench/libs/muimaster/classes/popimage.c | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/workbench/libs/muimaster/classes/area.h b/workbench/libs/muimaster/classes/area.h index 008580b4b8..a597af7e6c 100644 --- a/workbench/libs/muimaster/classes/area.h +++ b/workbench/libs/muimaster/classes/area.h @@ -459,7 +459,7 @@ struct MUI_AreaData struct MUI_ImageSpec_intern *mad_Background; /* bg setting - *private* ! */ struct TextFont *mad_Font; /* Font which is used to draw */ struct MUI_MinMax mad_MinMax; /* min/max/default dimensions */ - struct IBox mad_Box; /* coordinates and dim of this object after layouted */ + struct IBox mad_Box; /* coordinates and dim of this object after layout */ BYTE mad_addleft; /* left offset (frame & innerspacing) */ BYTE mad_addtop; /* top offset (frame & innerspacing) */ BYTE mad_subwidth; /* additional width (frame & innerspacing) */ diff --git a/workbench/libs/muimaster/classes/imageadjust.c b/workbench/libs/muimaster/classes/imageadjust.c index 983f7a00da..d2b2ad3347 100644 --- a/workbench/libs/muimaster/classes/imageadjust.c +++ b/workbench/libs/muimaster/classes/imageadjust.c @@ -10,7 +10,8 @@ #include #include -#include +#include +#include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include @@ -59,6 +61,26 @@ static void Bitmap_Function(struct Hook *hook, Object *obj, APTR msg) } +static void AppMessage_Function(struct Hook *hook, Object *obj, void **msg) +{ + struct Imageadjust_DATA *data = *(struct Imageadjust_DATA **)msg; + struct AppMessage *appmsg = msg[1]; + char buf[255]; + struct WBArg *wbarg; + + wbarg = &appmsg->am_ArgList[0]; + buf[0] = '5', buf[1] = ':'; + if (NameFromLock(wbarg->wa_Lock, buf + 2, 253)) + { + if (AddPart(buf + 2, wbarg->wa_Name, 253)) + { + set(data->bitmap_image, MUIA_Imagedisplay_Spec, (IPTR)buf); + set(data->bitmap_string, MUIA_String_Contents, (IPTR)buf + 2); + } + } +} + + static void Gradient_Function(struct Hook *hook, Object *obj, APTR msg) { struct Imageadjust_DATA *data = *(struct Imageadjust_DATA **)msg; @@ -658,6 +680,23 @@ IPTR Imageadjust__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) (APTR) GetTagData(MUIA_Imageadjust_Originator, 0, msg->ops_AttrList); + if (bitmap_group != NULL) + { + data->appmessage_hook.h_Data = data; + data->appmessage_hook.h_Entry = HookEntry; + data->appmessage_hook.h_SubEntry = (HOOKFUNC)AppMessage_Function; + if (bitmap_image != NULL) + DoMethod(bitmap_image, MUIM_Notify, + MUIA_AppMessage, MUIV_EveryTime, + (IPTR)obj, 4, MUIM_CallHook, &data->appmessage_hook, data, + MUIV_TriggerValue); + if (bitmap_string != NULL) + DoMethod(bitmap_string, MUIM_Notify, + MUIA_AppMessage, MUIV_EveryTime, + (IPTR)obj, 4, MUIM_CallHook, &data->appmessage_hook, data, + MUIV_TriggerValue); + } + if (adjust_type != MUIV_Imageadjust_Type_Pen) { data->last_pattern_selected = -1; diff --git a/workbench/libs/muimaster/classes/imageadjust_private.h b/workbench/libs/muimaster/classes/imageadjust_private.h index 4b04e83b08..87eff45eba 100644 --- a/workbench/libs/muimaster/classes/imageadjust_private.h +++ b/workbench/libs/muimaster/classes/imageadjust_private.h @@ -7,6 +7,7 @@ struct Imageadjust_DATA Object *bitmap_string; Object *bitmap_image; struct Hook bitmap_hook; + struct Hook appmessage_hook; struct Hook gradient_hook; struct Hook gradient_swap_hook; diff --git a/workbench/libs/muimaster/classes/popimage.c b/workbench/libs/muimaster/classes/popimage.c index 8b0970bd1c..a0ad952c89 100644 --- a/workbench/libs/muimaster/classes/popimage.c +++ b/workbench/libs/muimaster/classes/popimage.c @@ -118,6 +118,7 @@ IPTR Popimage__MUIM_Popimage_OpenWindow(struct IClass *cl, Object *obj, MUIA_Window_Title, (IPTR) data->wintitle, MUIA_Window_Activate, TRUE, MUIA_Window_IsSubWindow, TRUE, + MUIA_Window_AppWindow, TRUE, MUIA_Window_LeftEdge, _left(obj) + x, MUIA_Window_TopEdge, _bottom(obj) + y + 1, WindowContents, (IPTR) VGroup, -- 2.11.4.GIT