// Show list of status bar options void _config_env_status_list(ObjectList *objlist,ULONG id,long first,long last) { Att_List *list; short a,b; char name[80]; // Build list if (!(list=Att_NewList(0))) return; for (a=first;a<=((last)?last:32767);a++) { stccpy(name,GetString(locale,a),sizeof(name)); if (name[0]=='-' && name[1]==0) break; for (b=0;name[b] && name[b]!='\t';b++) if (name[b]=='*') name[b]='%'; Att_NewNode(list,name,0,0); } // Make window busy SetWindowBusy(objlist->window); // Display selection list a=SelectionList(list,objlist->window,0, GetString(locale,MSG_ENVIRONMENT_LISTER_SELECT_STATUS), -1, 0, 0, GetString(locale,MSG_OKAY), GetString(locale,MSG_CANCEL),0,0); // Clear busy ClearWindowBusy(objlist->window); // Selection? if (a!=-1) { Att_Node *node; // Get node if ((node=Att_FindNode(list,a))) { char *ptr,buf[10]; // Get string pointer ptr=strchr(node->node.ln_Name,'\t'); if (ptr) stccpy(buf,node->node.ln_Name,(ptr-node->node.ln_Name)+1); else stccpy(buf,node->node.ln_Name,sizeof(buf)); // Insert into gadget funced_edit_insertstring(objlist,id,buf,DOpusBase,(struct Library *)IntuitionBase); } } // Free list Att_RemList(list,0); }
Title::Title() { nextState = STATE_NULL; titleText = TTFText("GALAGA", 50, "Roboto-Medium.ttf"); std::vector<std::string> optionText = std::vector<std::string>(); optionText.push_back("Play"); optionText.push_back("Quit"); titleOptions = SelectionList(optionText, 175, 150, 30, true); // startSound = Mix_LoadWAV("car-ignition-edit.wav"); // Mix_PlayChannel( -1, startSound, 0 ); }
int LIBFUNC L_Module_Entry( REG(a0, char *argstring), REG(a1, struct Screen *screen), REG(a2, IPCData *ipc), REG(a3, IPCData *main_ipc), REG(d0, ULONG mod_id), REG(d1, EXT_FUNC(func_callback))) { DOpusCallbackInfo info, *infoptr = &info; char filename[300]; FuncArgs *args; // Get callbacks info.dc_Count=DOPUS_HOOK_COUNT; info.dc_RexxCommand=0; info.dc_FileRequest=0; info.dc_GetThemes=0; info.dc_UnlockSource=0; IPC_Command(main_ipc,HOOKCMD_GET_CALLBACKS,0,&info,0,REPLY_NO_PORT); // Must be able to send rexx commands and show file requester if (!info.dc_RexxCommand || !info.dc_FileRequest) return 0; // See if filename is supplied filename[0]=0; if ((args=ParseArgs(func_templates[mod_id],argstring)) && args->FA_Arguments[0]) { strcpy(filename,(char *)args->FA_Arguments[0]); if (!strchr(filename,'/') && !strchr(filename,':')) { lsprintf(filename,"D5THEMES:%s",(IPTR)args->FA_Arguments[0]); } if (mod_id!=CONVERTTHEME && (strlen(filename)<7 || stricmp(filename+strlen(filename)-6,".theme")!=0)) strcat(filename,".theme"); } // No filename? if (!*filename && (mod_id==LOADTHEME || mod_id==CONVERTTHEME)) { FunctionEntry *entry; // Get first entries if ((entry=(FunctionEntry *)func_callback(EXTCMD_GET_ENTRY,IPCDATA(ipc),0))) { struct endentry_packet packet; // Build filename func_callback(EXTCMD_GET_SOURCE,IPCDATA(ipc),filename); AddPart(filename,entry->name,256); // Fill out packet to end entry packet.entry=entry; packet.deselect=1; func_callback(EXTCMD_END_ENTRY,IPCDATA(ipc),&packet); } } // Unlock source lister if (info.dc_UnlockSource) DC_CALL1(infoptr, dc_UnlockSource, DC_REGA0, IPCDATA(ipc)); //DC_UnlockSource(infoptr, IPCDATA(ipc)); //info.dc_UnlockSource(IPCDATA(ipc)); // Save theme? if (mod_id==SAVETHEME || mod_id==BUILDTHEME) { char buf[256]; // Get themes path if (info.dc_GetThemes) DC_CALL1(infoptr, dc_GetThemes, DC_REGA0, buf); //DC_GetThemes(infoptr,buf); //info.dc_GetThemes(buf); else strcpy(buf,"D5THEMES:"); // Get filename if (filename[0] || DC_CALL6(infoptr, dc_FileRequest, DC_REGA0, (struct Window *)screen, DC_REGA1, GetString(locale,(mod_id==SAVETHEME)?MSG_SAVE_THEME_MSG:MSG_BUILD_THEME_MSG), DC_REGA2, buf, DC_REGA3, filename, DC_REGD0, (1<<30)|(1<<31)|FRF_DOSAVEMODE, DC_REGD1, 0)) //DC_FileRequest(infoptr, //info.dc_FileRequest( /* (struct Window *)screen, GetString(locale,(mod_id==SAVETHEME)?MSG_SAVE_THEME_MSG:MSG_BUILD_THEME_MSG), buf, filename, (1<<30)|(1<<31)|FRF_DOSAVEMODE,0))*/ { long res; char *ptr; // Check .theme suffix if (strlen(filename)<7 || stricmp(filename+strlen(filename)-6,".theme")!=0) strcat(filename,".theme"); // Remove spaces for (ptr=FilePart(filename);*ptr;ptr++) if (*ptr==' ') *ptr='_'; // Save theme if ((res=save_theme(screen,&info,filename,(mod_id==BUILDTHEME)?TRUE:FALSE))) { // Build error lsprintf(filename,GetString(locale,MSG_SAVE_ERROR),res); // Show error AsyncRequestTags( ipc, REQTYPE_SIMPLE, 0, 0, 0, AR_Screen,(IPTR)screen, AR_Message,(IPTR)filename, AR_Button,(IPTR)GetString(locale,MSG_OK), TAG_END); } } } // Load theme else if (mod_id==LOADTHEME) { ULONG apply_flags=0; // Flags supplied? if (args) { short num; for (num=0;num<4;num++) { if (args->FA_Arguments[num+1]) apply_flags|=1<<num; } } // No name supplied? if (!filename[0]) { BPTR lock; Att_List *list; Att_Node *node; char *apply_switches[5]; char temp[20]; char path[256]; long err; // Get old apply flags if (!apply_flags && (GetVar("dopus/taf",temp,16,GVF_GLOBAL_ONLY))>0) apply_flags=atoi(temp); // Initial theme path strcpy(path,"D5THEMES:"); if ((lock=Lock(path,ACCESS_READ))) { NameFromLock(lock,path,256); UnLock(lock); } // Get list of themes while ((list=theme_build_list(path))) { // Switches for what to apply apply_switches[0]=GetString(locale,MSG_THEME_APPLY_PALETTE); apply_switches[1]=GetString(locale,MSG_THEME_APPLY_FONTS); apply_switches[2]=GetString(locale,MSG_THEME_APPLY_PICTURES); apply_switches[3]=GetString(locale,MSG_THEME_APPLY_SOUNDS); apply_switches[4]=0; // Show selection list strcpy(filename,path); if ((err=SelectionList( list, 0, screen, GetString(locale,MSG_LOAD_THEME_MSG), -1, SLF_DIR_FIELD|SLF_USE_INITIAL|SLF_SWITCHES|SLF_RETURN_PATH, filename, GetString(locale,MSG_OK), GetString(locale,MSG_CANCEL), apply_switches, &apply_flags))>-1) { // Name selected? if ((node=Att_FindNode(list,err))) { char *ptr; for (ptr=node->node.ln_Name;*ptr;ptr++) if (*ptr==' ') *ptr='_'; lsprintf(filename,"D5THEMES:%s.theme",(IPTR)node->node.ln_Name); } else filename[0]=0; // Save apply flags lsprintf(temp,"%ld",apply_flags); SetEnv("dopus/taf",temp,TRUE); } else if (err!=-1 && filename[0]!=0 && filename[strlen(filename)-1]=='/') filename[0]=0; // Free list Att_RemList(list,0); // Break out? if (err!=-1) break; // Empty path returns to default if (!filename[0]) { // Get themes path if (info.dc_GetThemes) DC_CALL1(infoptr, dc_GetThemes, DC_REGA0, filename); //DC_GetThemes(infoptr,filename); //info.dc_GetThemes(filename); else strcpy(filename,"DOpus5:Themes/"); } // Re-open with new path strcpy(path,filename); // Assign D5THEMES to the new directory if ((lock=Lock(filename,ACCESS_READ)) && !(AssignLock("D5THEMES",lock))) UnLock(lock); } } // File to load? if (filename[0]) { short num; char apply[20],*ptr,command[400],port[40]; // Build apply flags for (num=0,ptr=apply;num<APPLY_LAST;num++) { if (apply_flags&(1<<num)) *(ptr++)=apply_lookup[num]; } *ptr=0; // Get ARexx port name DC_CALL1(infoptr, dc_GetPort, DC_REGA0, port); //DC_GetPort(infoptr,port); //info.dc_GetPort(port); // Build ARexx command to send to DOpus lsprintf(command,"%s %s %s",(IPTR)filename,(IPTR)port,(IPTR)apply); DC_CALL4(infoptr, dc_SendCommand, DC_REGA0, 0, DC_REGA1, command, DC_REGA2, 0, DC_REGD0, COMMANDF_RUN_SCRIPT); //DC_SendCommand(infoptr,0,command,0,COMMANDF_RUN_SCRIPT); //info.dc_SendCommand(0,command,0,COMMANDF_RUN_SCRIPT); } } // Convert theme else if (mod_id==CONVERTTHEME) { // Get filename if (filename[0] || DC_CALL6(infoptr, dc_FileRequest, DC_REGA0, (struct Window *)screen, DC_REGA1, GetString(locale,MSG_CONVERT_THEME_MSG), DC_REGA2, 0, DC_REGA3, filename, DC_REGD0, (1<<30)|(1<<31)|(1<<29)|FRF_DOPATTERNS, DC_REGD1, "#?.theme")) //DC_FileRequest(infoptr, //info.dc_FileRequest( /*(struct Window *)screen, GetString(locale,MSG_CONVERT_THEME_MSG), 0, filename, (1<<30)|(1<<31)|(1<<29)|FRF_DOPATTERNS, "#?.theme"))*/ { char dest[256],buf[256],*ptr; dest[0]=0; if ((args=ParseArgs(func_templates[mod_id],argstring)) && args->FA_Arguments[1]) { strcpy(dest,(char *)args->FA_Arguments[1]); if (!strchr(dest,'/') && !strchr(dest,':')) { lsprintf(dest,"D5THEMES:%s",(IPTR)args->FA_Arguments[0]); } } // Ask for path? if (!dest[0]) { // Get themes path if (info.dc_GetThemes) DC_CALL1(infoptr, dc_GetThemes, DC_REGA0, buf); //DC_GetThemes(infoptr,buf); //info.dc_GetThemes(buf); else strcpy(buf,"D5THEMES:"); } // Get save filename if (dest[0] || DC_CALL6(infoptr, dc_FileRequest, DC_REGA0, (struct Window *)screen, DC_REGA1, GetString(locale,MSG_SAVE_THEME_MSG), DC_REGA2, buf, DC_REGA3, dest, DC_REGD0, (1<<30)|(1<<31)|FRF_DOSAVEMODE, DC_REGD1, 0)) //(DC_FileRequest(infoptr, //(info.dc_FileRequest( /* (struct Window *)screen, GetString(locale,MSG_SAVE_THEME_MSG), buf, dest, (1<<30)|(1<<31)|FRF_DOSAVEMODE,0)))*/ { short res; // Check .theme suffix if (strlen(dest)<7 || stricmp(dest+strlen(dest)-6,".theme")!=0) strcat(dest,".theme"); // Remove spaces for (ptr=FilePart(dest);*ptr;ptr++) if (*ptr==' ') *ptr='_'; // Convert the file if ((res=convert_theme(&info,filename,dest))) { // Build error lsprintf(filename,GetString(locale,MSG_SAVE_ERROR),res); // Show error AsyncRequestTags( ipc, REQTYPE_SIMPLE, 0, 0, 0, AR_Screen,(IPTR)screen, AR_Message,(IPTR)filename, AR_Button,(IPTR)GetString(locale,MSG_OK), TAG_END); } } } } DisposeArgs(args); return 1; }