From 27f89d971b6f3b91e214fc036c14e5c8afe0562a Mon Sep 17 00:00:00 2001 From: mazze Date: Wed, 4 Apr 2012 18:45:44 +0000 Subject: [PATCH] Derive from a Group class rather than Window class. This gives us more flexibility. git-svn-id: https://svn.aros.org/svn/aros/trunk/contrib@44519 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- pack/unarc/main.c | 18 ++- pack/unarc/mmakefile.src | 2 +- .../{unarcwindow_class.c => unarcgroup_class.c} | 134 ++++++++++----------- .../{unarcwindow_class.h => unarcgroup_class.h} | 16 +-- 4 files changed, 87 insertions(+), 83 deletions(-) rename pack/unarc/{unarcwindow_class.c => unarcgroup_class.c} (80%) rename pack/unarc/{unarcwindow_class.h => unarcgroup_class.h} (53%) diff --git a/pack/unarc/main.c b/pack/unarc/main.c index 79c6f7c47..6874f3853 100644 --- a/pack/unarc/main.c +++ b/pack/unarc/main.c @@ -15,7 +15,7 @@ #include #include -#include "unarcwindow_class.h" +#include "unarcgroup_class.h" #include "locale.h" #define ARGTEMPLATE "ARCHIVE,DESTINATION,PUBSCREEN/K" @@ -84,16 +84,26 @@ int main(int argc, char **argv) MUIA_Application_Version, (IPTR)"$VER: Unarc 1.1 (11.02.2012)", MUIA_Application_Copyright, __(MSG_AppCopyright), MUIA_Application_Description, __(MSG_AppDescription), - SubWindow, (IPTR)(win = UnarcWindowObject, - MUIA_UnarcWindow_Archive, (IPTR)archive, - MUIA_UnarcWindow_Destination, (IPTR)destination, + SubWindow, (IPTR)(win = WindowObject, + MUIA_Window_Title, __(MSG_WI_TITLE), + MUIA_Window_ID, MAKE_ID('U', 'N', 'W', 'I'), pubscreen ? MUIA_Window_PublicScreen : TAG_IGNORE, (IPTR)pubscreen, + WindowContents, (IPTR)(UnarcGroupObject, + MUIA_UnarcGroup_Archive, (IPTR)archive, + MUIA_UnarcGroup_Destination, (IPTR)destination, + End), End), End; if (!app) cleanup_exit(_(MSG_ERR_NO_APPLICATION)); + DoMethod + ( + win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, + app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit + ); + SET(win, MUIA_Window_Open, TRUE); DoMethod(app, MUIM_Application_Execute); cleanup_exit(NULL); diff --git a/pack/unarc/mmakefile.src b/pack/unarc/mmakefile.src index f624687a2..a45477e3f 100644 --- a/pack/unarc/mmakefile.src +++ b/pack/unarc/mmakefile.src @@ -3,7 +3,7 @@ include $(TOP)/config/make.cfg -FILES := main locale unarcwindow_class +FILES := main locale unarcgroup_class EXEDIR := $(AROS_CONTRIB)/Utilities/Archive/Unarc diff --git a/pack/unarc/unarcwindow_class.c b/pack/unarc/unarcgroup_class.c similarity index 80% rename from pack/unarc/unarcwindow_class.c rename to pack/unarc/unarcgroup_class.c index ac873ed6c..b1badcd16 100644 --- a/pack/unarc/unarcwindow_class.c +++ b/pack/unarc/unarcgroup_class.c @@ -17,13 +17,13 @@ #include #include -#include "unarcwindow_class.h" +#include "unarcgroup_class.h" #include "locale.h" #define PATHNAMESIZE (1024) -struct UnarcWindow_DATA +struct UnarcGroup_DATA { Object *btn_all, *btn_none, *btn_invert, *btn_start, *btn_cancel; Object *str_file, *str_targetdir, *lst_content, *ga_progress; @@ -144,7 +144,7 @@ AROS_UFH3S(void, change_selection_func, { AROS_USERFUNC_INIT - struct UnarcWindow_DATA *data = h->h_Data; + struct UnarcGroup_DATA *data = h->h_Data; ULONG status = *(ULONG *)msg; struct Listentry *oldentry, newentry; LONG i; @@ -229,7 +229,7 @@ AROS_UFH3S(void, start_func, D(bug("[start_func] called\n")); - struct UnarcWindow_DATA *data = h->h_Data; + struct UnarcGroup_DATA *data = h->h_Data; struct Listentry *entry; LONG i, result; @@ -293,7 +293,7 @@ AROS_UFH3S(void, read_file_func, D(bug("[read_file_func] called\n")); - struct UnarcWindow_DATA *data = h->h_Data; + struct UnarcGroup_DATA *data = h->h_Data; LONG result; STRPTR filename = (STRPTR)XGET(data->str_file, MUIA_String_Contents); @@ -335,12 +335,16 @@ AROS_UFH3S(void, read_file_func, _(MSG_OK), _(MSG_ERR_NO_ARC), NULL ); } + SET(data->btn_all, MUIA_Disabled, FALSE); + SET(data->btn_none, MUIA_Disabled, FALSE); + SET(data->btn_invert, MUIA_Disabled, FALSE); + SET(data->btn_start, MUIA_Disabled, FALSE); AROS_USERFUNC_EXIT } -Object *UnarcWindow__OM_NEW(Class *CLASS, Object *self, struct opSet *message) +Object *UnarcGroup__OM_NEW(Class *CLASS, Object *self, struct opSet *message) { Object *btn_all, *btn_none, *btn_invert, *btn_start, *btn_cancel; Object *str_file, *str_targetdir, *lst_content, *ga_progress; @@ -367,11 +371,11 @@ Object *UnarcWindow__OM_NEW(Class *CLASS, Object *self, struct opSet *message) { switch (tag->ti_Tag) { - case MUIA_UnarcWindow_Archive: + case MUIA_UnarcGroup_Archive: archive = (STRPTR)tag->ti_Data; break; - case MUIA_UnarcWindow_Destination: + case MUIA_UnarcGroup_Destination: destination = (STRPTR)tag->ti_Data; break; } @@ -384,70 +388,66 @@ Object *UnarcWindow__OM_NEW(Class *CLASS, Object *self, struct opSet *message) self = (Object *) DoSuperNewTags ( CLASS, self, NULL, - MUIA_Window_Title, _(MSG_WI_TITLE), - MUIA_Window_ID, MAKE_ID('U', 'N', 'W', 'I'), - WindowContents, VGroup, - Child, ColGroup(2), - Child, Label(_(MSG_LA_ARCHIVE)), - Child, PopaslObject, - MUIA_Popasl_Type , ASL_FileRequest, - ASLFR_TitleText, _(MSG_FREQ_ARCHIVE_TITLE), - ASLFR_RejectIcons, TRUE, - MUIA_Popstring_String, str_file = StringObject, - StringFrame, - MUIA_String_Contents, archive, - End, - MUIA_Popstring_Button, PopButton(MUII_PopFile), + Child, ColGroup(2), + Child, Label(_(MSG_LA_ARCHIVE)), + Child, PopaslObject, + MUIA_Popasl_Type , ASL_FileRequest, + ASLFR_TitleText, _(MSG_FREQ_ARCHIVE_TITLE), + ASLFR_RejectIcons, TRUE, + MUIA_Popstring_String, str_file = StringObject, + StringFrame, + MUIA_String_Contents, archive, End, - Child, Label(_(MSG_LA_DESTINATION)), - Child, PopaslObject, - MUIA_Popasl_Type , ASL_FileRequest, - ASLFR_TitleText, _(MSG_FREQ_DESTINATION_TITLE), - ASLFR_DrawersOnly, TRUE, - MUIA_Popstring_String, str_targetdir = StringObject, - StringFrame, - MUIA_String_Contents, destination, - End, - MUIA_Popstring_Button, PopButton(MUII_PopDrawer), - End, - End, - Child, ga_progress = GaugeObject, - GaugeFrame, - MUIA_FixHeight, 15, - MUIA_Gauge_Horiz, TRUE, - MUIA_Gauge_Max, 100, + MUIA_Popstring_Button, PopButton(MUII_PopFile), End, - Child, ListviewObject, - MUIA_Listview_Input, FALSE, - MUIA_Listview_List, lst_content = ListObject, - MUIA_Frame, MUIV_Frame_InputList, - MUIA_List_Format, ",", - MUIA_List_DisplayHook, &list_display_hook, - MUIA_List_ConstructHook, &list_constr_hook, - MUIA_List_DestructHook, &list_destr_hook, + Child, Label(_(MSG_LA_DESTINATION)), + Child, PopaslObject, + MUIA_Popasl_Type , ASL_FileRequest, + ASLFR_TitleText, _(MSG_FREQ_DESTINATION_TITLE), + ASLFR_DrawersOnly, TRUE, + MUIA_Popstring_String, str_targetdir = StringObject, + StringFrame, + MUIA_String_Contents, destination, End, + MUIA_Popstring_Button, PopButton(MUII_PopDrawer), End, - Child, HGroup, - Child, btn_all = SimpleButton(_(MSG_BT_ALL)), - Child, btn_none = SimpleButton(_(MSG_BT_NONE)), - Child, btn_invert = SimpleButton(_(MSG_BT_INVERT)), - End, - Child, (IPTR) RectangleObject, - MUIA_Rectangle_HBar, TRUE, - MUIA_FixHeight, 2, - End, - Child, HGroup, - Child, btn_start = SimpleButton(_(MSG_BT_START)), - Child, HVSpace, - Child, btn_cancel = SimpleButton(_(MSG_BT_CANCEL)), + End, + Child, ga_progress = GaugeObject, + GaugeFrame, + MUIA_FixHeight, 15, + MUIA_Gauge_Horiz, TRUE, + MUIA_Gauge_Max, 100, + End, + Child, ListviewObject, + MUIA_Listview_Input, FALSE, + MUIA_Listview_List, lst_content = ListObject, + MUIA_Frame, MUIV_Frame_InputList, + MUIA_List_Format, ",", + MUIA_List_DisplayHook, &list_display_hook, + MUIA_List_ConstructHook, &list_constr_hook, + MUIA_List_DestructHook, &list_destr_hook, End, End, + Child, HGroup, + Child, btn_all = SimpleButton(_(MSG_BT_ALL)), + Child, btn_none = SimpleButton(_(MSG_BT_NONE)), + Child, btn_invert = SimpleButton(_(MSG_BT_INVERT)), + End, + Child, (IPTR) RectangleObject, + MUIA_Rectangle_HBar, TRUE, + MUIA_FixHeight, 2, + End, + Child, HGroup, + Child, btn_start = SimpleButton(_(MSG_BT_START)), + Child, HVSpace, + Child, btn_cancel = SimpleButton(_(MSG_BT_CANCEL)), + End, TAG_DONE ); if (self) { - struct UnarcWindow_DATA *data = INST_DATA(CLASS, self); + struct UnarcGroup_DATA *data = INST_DATA(CLASS, self); data->btn_all = btn_all; data->btn_none = btn_none; @@ -476,12 +476,6 @@ Object *UnarcWindow__OM_NEW(Class *CLASS, Object *self, struct opSet *message) DoMethod ( - self, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, - MUIV_Notify_Application, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit - ); - - DoMethod - ( data->btn_cancel, MUIM_Notify, MUIA_Pressed, FALSE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit ); @@ -535,9 +529,9 @@ Object *UnarcWindow__OM_NEW(Class *CLASS, Object *self, struct opSet *message) } -IPTR UnarcWindow__OM_DISPOSE(Class *CLASS, Object *self, Msg message) +IPTR UnarcGroup__OM_DISPOSE(Class *CLASS, Object *self, Msg message) { - struct UnarcWindow_DATA *data = INST_DATA(CLASS, self); + struct UnarcGroup_DATA *data = INST_DATA(CLASS, self); if (data->ai) xadFreeObjectA(data->ai, 0); @@ -549,7 +543,7 @@ IPTR UnarcWindow__OM_DISPOSE(Class *CLASS, Object *self, Msg message) ZUNE_CUSTOMCLASS_2 ( - UnarcWindow, NULL, MUIC_Window, NULL, + UnarcGroup, NULL, MUIC_Group, NULL, OM_NEW, struct opSet *, OM_DISPOSE, Msg ); diff --git a/pack/unarc/unarcwindow_class.h b/pack/unarc/unarcgroup_class.h similarity index 53% rename from pack/unarc/unarcwindow_class.h rename to pack/unarc/unarcgroup_class.h index 26c88374a..40d1fe300 100644 --- a/pack/unarc/unarcwindow_class.h +++ b/pack/unarc/unarcgroup_class.h @@ -1,5 +1,5 @@ -#ifndef UNARCWINDOW_CLASS_H -#define UNARCWINDOW_CLASS_H +#ifndef UNARCGROUP_CLASS_H +#define UNARCGROUP_CLASS_H /* Copyright © 2012, The AROS Development Team. All rights reserved. @@ -10,17 +10,17 @@ #include /*** Identifier base ********************************************************/ -#define MUIB_UnarcWindow (TAG_USER | 0x10000000) +#define MUIB_UnarcGroup (TAG_USER | 0x10000000) /*** Attributes *************************************************************/ -#define MUIA_UnarcWindow_Archive (MUIB_UnarcWindow | 0) -#define MUIA_UnarcWindow_Destination (MUIB_UnarcWindow | 1) +#define MUIA_UnarcGroup_Archive (MUIB_UnarcGroup | 0) +#define MUIA_UnarcGroup_Destination (MUIB_UnarcGroup | 1) /*** Variables **************************************************************/ -extern struct MUI_CustomClass *UnarcWindow_CLASS; +extern struct MUI_CustomClass *UnarcGroup_CLASS; /*** Macros *****************************************************************/ -#define UnarcWindowObject BOOPSIOBJMACRO_START(UnarcWindow_CLASS->mcc_Class) +#define UnarcGroupObject BOOPSIOBJMACRO_START(UnarcGroup_CLASS->mcc_Class) -#endif /* UNARCWINDOW_CLASS_H */ +#endif /* UNARCGROUP_CLASS_H */ -- 2.11.4.GIT