void amiga_init (char *dir) { if ((DefaultPubScreen = LockPubScreen (0)) == 0) exit (1); screen_ratio (DefaultPubScreen); char prog_name[256]; static char font_name[MAXFONTPATH]; char *font_desc, *name_ptr; static WORD pens[] = {-1}; static struct TextAttr font = {NULL, 0, FS_NORMAL, 0}; int window = 0; if (Icon == NULL) { if (GetProgramName (prog_name, 256)) Icon = GetDiskObject (prog_name); } if (Icon) { if (FindToolType (Icon->do_ToolTypes, "WINDOW")) window = 1; if (font_desc = FindToolType (Icon->do_ToolTypes, "FONT")) { strcpy (font_name, font_desc); if (name_ptr = strrchr (font_name, '/')) { font.ta_Name = font_name; font.ta_YSize = atoi (name_ptr + 1); strcpy (name_ptr, ".font"); } } if (font.ta_Name) Font = OpenDiskFont (&font); } if (Font == NULL) { font.ta_Name = "topaz.font"; font.ta_YSize = 8; Font = OpenFont (&font); } if (window == 0) { if ((Screen = OpenScreenTags (0, SA_Pens, pens, SA_DisplayID, GetVPModeID (&DefaultPubScreen->ViewPort), SA_Overscan, OSCAN_TEXT, SA_Depth, 2, SA_Type, CUSTOMSCREEN | AUTOSCROLL, SA_Font, &font, SA_Title, TitleBar, TAG_DONE)) == 0) exit (1); } if ((Window = OpenWindowTags (0, WA_Left, 0, WA_Top, Screen ? 2 : DefaultPubScreen->BarHeight + 1, WA_Width, Screen ? Screen->Width : ScreenWidth, WA_Height, Screen ? Screen->Height - 2 : ScreenHeight - DefaultPubScreen->BarHeight - 1, WA_SmartRefresh, 1, WA_NewLookMenus, 1, WA_AutoAdjust, 1, WA_Borderless, Screen ? 1 : 0, WA_Backdrop, Screen ? 1 : 0, WA_Activate, 1, WA_CloseGadget, Screen ? 0 : 1, WA_DragBar, Screen ? 0 : 1, WA_DepthGadget, Screen ? 0 : 1, WA_SizeGadget, Screen ? 0 : 1, WA_SizeBBottom, Screen ? 0 : 1, WA_Title, TitleBar, WA_ScreenTitle, TitleBar, WA_IDCMP, IDCMP_RAWKEY | IDCMP_VANILLAKEY | IDCMP_MENUPICK | IDCMP_CLOSEWINDOW | IDCMP_CHANGEWINDOW, Screen ? WA_CustomScreen : WA_PubScreen, Screen ? Screen : DefaultPubScreen, TAG_DONE)) == 0) exit (1); ThisProcess = (struct Process *)FindTask(0); OldWindowPtr = ThisProcess->pr_WindowPtr; ThisProcess->pr_WindowPtr = Window; if ((Visual = GetVisualInfo (Window->WScreen, TAG_DONE)) == 0) exit (1); if ((Menus = CreateMenus (NewMenus, GTMN_NewLookMenus, TRUE, TAG_DONE)) == 0) exit (1); LayoutMenus (Menus, Visual, GTMN_NewLookMenus, TRUE, TAG_DONE); SetMenuStrip (Window, Menus); if ((GameReq = alloc_freq (dir)) == 0) exit (1); if ((SaveReq = alloc_freq (dir)) == 0) exit (1); if ((ScriptReq = alloc_freq (dir)) == 0) exit (1); RastPort = Window->RPort; SetDrMd (RastPort, JAM2); SetAPen (RastPort, 1); SetBPen (RastPort, 0); SetFont (RastPort, Font); DisplayHeight = ((Window->Height - Window->BorderTop - Window->BorderBottom) / RastPort->TxHeight) - 1; PreviousHeight = DisplayHeight; reset_cursor (); }
static void Standard_SetLowColor(struct RastPort *rp, ULONG color) { struct colorPen *cp = GetColorPen(color); SetBPen(rp, cp->cp_Pen); }
void ShowClipValues(struct Window *nw) { char buf[50]; struct Gadget *gd; SetAPen(nw->RPort, 5); SetBPen(nw->RPort, amii_otherBPen); SetDrMd(nw->RPort, JAM2); sprintf(buf, "%d ", mxsize); gd = &ClipXSIZE; Move(nw->RPort, gd->LeftEdge + (nw->Width + gd->Width) + 8, gd->TopEdge + nw->RPort->TxBaseline); Text(nw->RPort, buf, strlen(buf)); sprintf(buf, "%d ", mysize); gd = &ClipYSIZE; Move(nw->RPort, gd->LeftEdge + (nw->Width + gd->Width) + 8, gd->TopEdge + nw->RPort->TxBaseline); Text(nw->RPort, buf, strlen(buf)); sprintf(buf, "%d ", xclipbord); gd = &ClipXCLIP; Move(nw->RPort, gd->LeftEdge + (nw->Width + gd->Width) + 8, gd->TopEdge + nw->RPort->TxBaseline); Text(nw->RPort, buf, strlen(buf)); sprintf(buf, "%d ", yclipbord); gd = &ClipYCLIP; Move(nw->RPort, gd->LeftEdge + (nw->Width + gd->Width) + 8, gd->TopEdge + nw->RPort->TxBaseline); Text(nw->RPort, buf, strlen(buf)); }
static void WhitePrint(struct RastPort *RPort, char *String, UWORD height, struct GfxBase * GfxBase) { SetAPen(RPort, 1); SetBPen(RPort, 2); SetDrMd(RPort, JAM2); Move(RPort,20,height); Text(RPort, String, strlen(String)); }
void cardRender( Card theCard, struct RastPort *Rast, long xPos, long yPos ) { SetDrMd( Rast, JAM2 ); if( theCard ) { if( cardFaceUp( theCard )) { SetAPen( Rast, 2 ); RectFill( Rast, xPos, yPos, xPos+CARD_WIDTH-1, yPos+CARD_HEIGHT-1 ); SetBPen( Rast, 2 ); switch( cardSuit( theCard )) { case HEARTS: case DIAMONDS: SetAPen( Rast, 6 ); break; default: SetAPen( Rast, 1 ); break; } SuitImages[cardSuit( theCard )].PlaneOnOff = 0x2; DrawImage( Rast, &SuitImages[cardSuit( theCard )], xPos + Rast->TxWidth + 3, yPos + 3 ); DrawImage( Rast, &SuitImages[cardSuit( theCard )], xPos + CARD_WIDTH - Rast->TxWidth - 10, yPos + CARD_HEIGHT - Rast->TxHeight - 2 ); gfxMove( Rast, xPos + 2, yPos + Rast->TxBaseline + 3 ); Text( Rast, RankToStr[cardRank( theCard )], 1 ); gfxMove( Rast, xPos + CARD_WIDTH - Rast->TxWidth - 3, yPos + CARD_HEIGHT - Rast->TxHeight + Rast->TxBaseline - 2 ); Text( Rast, RankToStr[cardRank( theCard )], 1 ); } else { SetAPen( Rast, 7 ); RectFill( Rast, xPos, yPos, xPos+CARD_WIDTH-1, yPos+CARD_HEIGHT-1 ); } } else { SetAPen( Rast, 0 ); RectFill( Rast, xPos, yPos, xPos+CARD_WIDTH-1, yPos+CARD_HEIGHT-1 ); } SetAPen( Rast, 1 ); gfxMove( Rast, xPos, yPos ); Draw( Rast, xPos+CARD_WIDTH-1, yPos ); Draw( Rast, xPos+CARD_WIDTH-1, yPos+CARD_HEIGHT-1 ); Draw( Rast, xPos, yPos+CARD_HEIGHT-1 ); Draw( Rast, xPos, yPos ); SetAPen( Rast, 5 ); WritePixel( Rast, xPos, yPos ); WritePixel( Rast, xPos+CARD_WIDTH-1, yPos ); WritePixel( Rast, xPos, yPos+CARD_HEIGHT-1 ); WritePixel( Rast, xPos+CARD_WIDTH-1, yPos+CARD_HEIGHT-1 ); }
static void zune_render_set_pattern (struct MUI_RenderInfo *mri, LONG pattern) { SetAPen(mri->mri_RastPort, mri->mri_Pens[patternPens[pattern - MUII_BACKGROUND].fg]); SetBPen(mri->mri_RastPort, mri->mri_Pens[patternPens[pattern - MUII_BACKGROUND].bg]); gdk_gc_set_fill(mri->mri_RastPort, GDK_OPAQUE_STIPPLED); if (!mri->mri_PatternStipple) { mri->mri_PatternStipple = gdk_bitmap_create_from_data(mri->mri_Window, patstipple_bits, patstipple_width, patstipple_height); } gdk_gc_set_stipple(mri->mri_RastPort, mri->mri_PatternStipple); }
void statusbar_set_statustext(const char *text, int text_time) { video_canvas_t *canvas; for (canvas = canvaslist; canvas; canvas = canvas->next) { struct Window *window; struct TextExtent te; int x, width, height, max_chars; int basex, basey; if (!canvas->os->has_statusbar || canvas->waiting_for_resize) continue; window = canvas->os->window; width = window->Width - window->BorderLeft - window->BorderRight; height = window->Height - window->BorderTop - window->BorderBottom - statusbar_get_status_height(); basex = window->BorderLeft; basey = window->BorderTop; if (canvas->os->font) { SetFont(window->RPort, canvas->os->font); } /* else we use system default font */ x = width - (canvas->os->disk_width * enabled_drives) - (tape_enabled ? canvas->os->tape_width : 0); SetAPen(window->RPort, 0); SetBPen(window->RPort, 0); _RectFill(window->RPort, 0, height, x - 1, height + statusbar_get_status_height() - 1); max_chars = TextFit(window->RPort, text, strlen(text), &te, NULL, 1, x - (7 * 2), 20); SetAPen(window->RPort, canvas->os->pens[b_black]); _Move(window->RPort, 7, height + 13); Text(window->RPort, text, max_chars /* strlen(text) */); } statusbar_statustext_time=text_time; }
// Update toolbar cache BOOL GetToolBarCache(ToolBarInfo *toolbar,BOOL real) { short depth,width,height,num,x,y; short last_width=0,last_height=0; Cfg_Button *button; struct TagItem tags[4]; struct Rectangle rect; // Invalid toolbar? if (!toolbar) return 0; // Free existing cache FreeToolBarCache(toolbar); // Remap toolbar if this is for real if (real && !toolbar->done_remap) { // Do remap RemapToolBar(toolbar); toolbar->done_remap=1; } // Initialise tags tags[0].ti_Tag=IM_Depth; tags[0].ti_Data=1; tags[1].ti_Tag=IM_Width; tags[1].ti_Data=0; tags[2].ti_Tag=IM_Height; tags[2].ti_Data=0; tags[3].ti_Tag=TAG_DONE; // Minimum depth depth=1; // Count items in toolbar for (button=(Cfg_Button *)toolbar->buttons->buttons.lh_Head,toolbar->count=0; button->node.ln_Succ; button=(Cfg_Button *)button->node.ln_Succ,toolbar->count++); // Allocate position array if (!(toolbar->button_array=AllocVec(sizeof(struct Rectangle)*(toolbar->count+2),MEMF_CLEAR))) { FreeToolBarCache(toolbar); return 0; } // Go through buttons again for (button=(Cfg_Button *)toolbar->buttons->buttons.lh_Head,num=0,toolbar->max_width=0; button->node.ln_Succ; button=(Cfg_Button *)button->node.ln_Succ,num++) { Cfg_ButtonFunction *func; short width,height,x; // Get left button image if ((func=(Cfg_ButtonFunction *) FindFunctionType((struct List *)&button->function_list,FTYPE_LEFT_BUTTON)) && func->image) { // Get depth and other info GetImageAttrs(func->image,tags); // Biggest depth so far? if (tags[0].ti_Data>depth) depth=tags[0].ti_Data; // Get size width=tags[1].ti_Data; height=tags[2].ti_Data; } // Or textual button? else if (!(button->button.flags&BUTNF_GRAPHIC) && func) { struct TextExtent extent; // Get length of label TextExtent(&GUI->screen_pointer->RastPort,func->label,strlen(func->label),&extent); // Get size width=extent.te_Width; height=extent.te_Height; } // Use last size else { width=last_width; height=last_height; } // Minimum size if (width<2) width=8; if (height<2) height=8; // Save size last_width=width; last_height=height; // Increase size for border if (!(toolbar->buttons->window.flags&BTNWF_BORDERLESS)) { width+=2; height+=2; } // Biggest width so far? if (width>toolbar->max_width) toolbar->max_width=width; // Get last position x=(num>0)?toolbar->button_array[num-1].MaxX+1:0; // Store position in array toolbar->button_array[num].MinX=x; toolbar->button_array[num].MinY=0; toolbar->button_array[num].MaxX=x+width-1; toolbar->button_array[num].MaxY=height-1; } // No actual buttons? if (toolbar->count<1 || depth<1) { FreeToolBarCache(toolbar); return 0; } // Store rows/cols toolbar->cols=toolbar->count; toolbar->rows=1; // Valid toolbar arrow? if (GUI->toolbar_arrow_image) { short width,height; // Get size of the arrow button GetImageAttrs(GUI->toolbar_arrow_image,tags); // Biggest depth so far? if (tags[0].ti_Data>depth) depth=tags[0].ti_Data; // Get size width=tags[1].ti_Data; height=tags[2].ti_Data; // Increase size for border if (!(toolbar->buttons->window.flags&BTNWF_BORDERLESS)) { width+=2; height+=2; } // Store size in array toolbar->button_array[toolbar->count].MaxX=width-1; toolbar->button_array[toolbar->count].MaxY=height-1; // Add to maximum width toolbar->max_width+=width; } // Get height of toolbar for (num=0,height=0;num<=toolbar->count;num++) { if ((width=RECTHEIGHT(&toolbar->button_array[num]))>height) height=width; } // Store toolbar height toolbar->button_height=height; // Get cache size toolbar->width=toolbar->button_array[toolbar->count-1].MaxX+1; toolbar->height=toolbar->button_height; // Don't want cache? if (!real) return 1; // Allocate cache bitmap if (!(toolbar->bitmap= NewBitMap( toolbar->width, toolbar->height, depth, BMF_CLEAR, GUI->screen_pointer->RastPort.BitMap))) // 0))) { // Failed FreeToolBarCache(toolbar); return 0; } // Initialise RastPort InitRastPort(&toolbar->rp); toolbar->rp.BitMap=toolbar->bitmap; // Got cache successfully toolbar->cache=1; // Set pens and font SetAPen(&toolbar->rp,1); SetBPen(&toolbar->rp,0); SetFont(&toolbar->rp,GUI->screen_pointer->RastPort.Font); // Initialise draw tags tags[0].ti_Tag=IM_Rectangle; tags[0].ti_Data=(ULONG)▭ tags[1].ti_Tag=IM_ClipBoundary; tags[1].ti_Data=(toolbar->buttons->window.flags&BTNWF_BORDERLESS)?0:2; tags[2].ti_Tag=IM_NoIconRemap; tags[2].ti_Data=(environment->env->desktop_flags&DESKTOPF_NO_REMAP)?TRUE:FALSE; tags[3].ti_Tag=TAG_DONE; // Go through buttons for (button=(Cfg_Button *)toolbar->buttons->buttons.lh_Head,x=0,y=0,num=0; button->node.ln_Succ; button=(Cfg_Button *)button->node.ln_Succ,num++) { Cfg_ButtonFunction *func; BOOL ok=0; // Get button rectangle rect=toolbar->button_array[num]; // Get left button image if ((func=(Cfg_ButtonFunction *)FindFunctionType((struct List *)&button->function_list,FTYPE_LEFT_BUTTON)) && func->image) { // Draw button image RenderImage(&toolbar->rp,func->image,0,0,tags); ok=1; } // Or textual button? else if (!(button->button.flags&BUTNF_GRAPHIC) && func && func->label && *func->label) { // Draw label Move(&toolbar->rp,x,y+toolbar->rp.TxBaseline); Text(&toolbar->rp,func->label,strlen(func->label)); ok=1; } // Draw button border if (!ok || !(toolbar->buttons->window.flags&BTNWF_BORDERLESS)) DrawBox(&toolbar->rp,&rect,GUI->draw_info,0); } return 1; }
void EditClipping(void) { int i; long mflags; static int sizes[] = { 8, 16, 20, 24, 28, 32, 36 }; char buf[40]; int done = 0, okay = 0; long code, qual, class; register struct Gadget *gd, *dgad; register struct Window *nw; register struct IntuiMessage *imsg; register struct PropInfo *pip; register struct Screen *scrn; long aidx; int lmxsize = mxsize, lmysize = mysize; int lxclipbord = xclipbord, lyclipbord = yclipbord; int msx, msy; int drag = 0; static int once = 0; scrn = HackScreen; if (!once) { SetBorder(&ClipOkay); SetBorder(&ClipCancel); once = 1; } ClipNewWindowStructure1.Screen = scrn; #ifdef INTUI_NEW_LOOK if (IntuitionBase->LibNode.lib_Version >= 37) { ((struct PropInfo *) ClipXSIZE.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipYSIZE.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipXCLIP.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipYCLIP.SpecialInfo)->Flags |= PROPNEWLOOK; } #endif if (WINVERS_AMIV || WINVERS_AMII) { #ifdef INTUI_NEW_LOOK ClipNewWindowStructure1.Extension = wintags; ClipNewWindowStructure1.Flags |= WFLG_NW_EXTENDED; #ifdef __GNUC__ fillhook.h_Entry = (void *) &LayerFillHook; #else fillhook.h_Entry = (ULONG (*) ()) LayerFillHook; #endif fillhook.h_Data = (void *) -2; fillhook.h_SubEntry = 0; #endif } nw = OpenWindow((void *) &ClipNewWindowStructure1); if (nw == NULL) { DisplayBeep(NULL); return; } ShowClipValues(nw); mflags = AUTOKNOB | FREEHORIZ; #ifdef INTUI_NEW_LOOK if (IntuitionBase->LibNode.lib_Version >= 37) { mflags |= PROPNEWLOOK; } #endif for (i = 0; i < 7; ++i) { if (mxsize <= sizes[i]) break; } NewModifyProp(&ClipXSIZE, nw, NULL, mflags, (i * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); for (i = 0; i < 7; ++i) { if (mysize <= sizes[i]) break; } NewModifyProp(&ClipYSIZE, nw, NULL, mflags, (i * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); NewModifyProp(&ClipXCLIP, nw, NULL, mflags, ((xclipbord - 2) * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); NewModifyProp(&ClipYCLIP, nw, NULL, mflags, ((yclipbord - 2) * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); while (!done) { WaitPort(nw->UserPort); while (imsg = (struct IntuiMessage *) GetMsg(nw->UserPort)) { gd = (struct Gadget *) imsg->IAddress; code = imsg->Code; class = imsg->Class; qual = imsg->Qualifier; msx = imsg->MouseX; msy = imsg->MouseY; ReplyMsg((struct Message *) imsg); switch (class) { case VANILLAKEY: if (code == '\33') okay = 0, done = 1; else if (code == 'v' && qual == AMIGALEFT) okay = done = 1; else if (code == 'b' && qual == AMIGALEFT) okay = 0, done = 1; else if (code == 'o' || code == 'O') okay = done = 1; else if (code == 'c' || code == 'C') okay = 0, done = 1; break; case CLOSEWINDOW: done = 1; break; case GADGETUP: drag = 0; if (gd->GadgetID == XSIZE || gd->GadgetID == YSIZE || gd->GadgetID == XCLIP || gd->GadgetID == YCLIP) { pip = (struct PropInfo *) gd->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 6); if (gd->GadgetID == XSIZE) { mxsize = sizes[aidx]; } else if (gd->GadgetID == YSIZE) { mysize = sizes[aidx]; } else if (gd->GadgetID == XCLIP) { xclipbord = aidx + 2; } else if (gd->GadgetID == YCLIP) { yclipbord = aidx + 2; } ShowClipValues(nw); #ifdef OPT_DISPMAP dispmap_sanity(); #endif } else if (gd->GadgetID == GADOKAY) { done = 1; okay = 1; } else if (gd->GadgetID == GADCANCEL) { done = 1; okay = 0; } ReportMouse(0, nw); reclip = 2; doredraw(); flush_glyph_buffer(amii_wins[WIN_MAP]->win); reclip = 0; break; case GADGETDOWN: drag = 1; dgad = gd; ReportMouse(1, nw); break; case MOUSEMOVE: if (!drag) break; pip = (struct PropInfo *) dgad->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 6); Move(nw->RPort, dgad->LeftEdge + (nw->Width + dgad->Width) + 8, dgad->TopEdge + nw->RPort->TxBaseline); if (dgad->GadgetID == XSIZE) { mxsize = sizes[aidx]; sprintf(buf, "%d ", lmxsize); } else if (dgad->GadgetID == YSIZE) { mysize = sizes[aidx]; sprintf(buf, "%d ", mysize); } else if (dgad->GadgetID == XCLIP) { xclipbord = aidx + 2; sprintf(buf, "%d ", xclipbord); } else if (dgad->GadgetID == YCLIP) { yclipbord = aidx + 2; sprintf(buf, "%d ", yclipbord); } SetAPen(nw->RPort, 5); SetBPen(nw->RPort, amii_otherBPen); SetDrMd(nw->RPort, JAM2); Text(nw->RPort, buf, strlen(buf)); #ifdef OPT_DISPMAP dispmap_sanity(); #endif break; } } } CloseWindow(nw); /* Restore oldvalues if cancelled. */ if (!okay) { mxsize = lmxsize; mysize = lmysize; xclipbord = lxclipbord; yclipbord = lyclipbord; } }
// Draw an item in the listview void listview_draw_item( Class *cl, struct Gadget *gadget, struct RastPort *rp, struct DrawInfo *drawinfo, ListViewData *data, struct Node *node, unsigned short line, struct IBox *user_box) { short selected=0,tab_flag=0,high; unsigned short x,y,len=0,textlen,pos=0,tabpos=0,width,last_x=0; short fpen; struct TextExtent extent; struct IBox *box; char *name; // User-supplied box? if (user_box) { box=user_box; high=1; } else { box=&data->text_dims; high=(BOOL)(data->sel==data->top+line); } // Get y position y=((unsigned short)box->Top)+line*data->text_height; // Invalid item? if (!node || !node->ln_Succ) { // Fill item SetAPen(rp,drawinfo->dri_Pens[(high)?FILLPEN:BACKGROUNDPEN]); RectFill(rp, box->Left, y, box->Left+box->Width-1, y+data->text_height-1); return; } // Does this item need a highlight select? if (high) { if ((!(data->flags&LVF_CANCEL) && gadget->Flags&GFLG_SELECTED) || (data->flags&LVF_SHOW_SELECTED && !(data->flags&LVF_SELECTED_CHECK))) selected=1; } // Highlight selection? if (high && !(gadget->Flags&GFLG_SELECTED) && data->flags&LVF_SELECTED_HIGH) { fpen=drawinfo->dri_Pens[HIGHLIGHTTEXTPEN]; } // Highlight multi-select? else if (!(data->flags&LVF_NO_HIGHLIGHT) && data->flags&LVF_MULTI_SELECT && data->flags&LVF_SELECTED_HIGH && node->lve_Flags&LVEF_SELECTED) { fpen=drawinfo->dri_Pens[HIGHLIGHTTEXTPEN]; } // Custom pen supplied? else if (node->lve_Flags&LVEF_USE_PEN) { // If selected, check pen is different to background if (selected && node->lve_Pen==drawinfo->dri_Pens[FILLPEN]) fpen=drawinfo->dri_Pens[FILLTEXTPEN]; // Ok to use custom pen else fpen=node->lve_Pen; } // Normal entry else { fpen=drawinfo->dri_Pens[(selected)?FILLTEXTPEN:TEXTPEN]; } SetAPen(rp,fpen); SetBPen(rp,drawinfo->dri_Pens[(selected)?FILLPEN:BACKGROUNDPEN]); SetDrMd(rp,JAM2); // Valid name? if (node->ln_Name) { // Get name pointer name=node->ln_Name; // Only show filenames? if (data->flags&LVF_SHOW_FILENAMES) { // Get filename pointer name=lv_FilePart(name); } // Get text length textlen=strlen(name); // Right-justify? if (data->flags&LVF_RIGHT_JUSTIFY) { char *dots=0; short dotlen=0; // Get length that will fit (from end backwards) len=TextFit( rp, name+textlen-1,textlen, &extent, 0,-1, data->text_width, data->text_height); // Won't all fit? if (len<textlen) { // Get length of dots dots="..."; dotlen=TextLength(rp,dots,3); // Get new length of string that will fit len=TextFit( rp, name+textlen-1,textlen, &extent, 0,-1, data->text_width-dotlen, data->text_height); } // Draw text Move(rp,box->Left+data->text_offset,y+rp->TxBaseline); if (dots) Text(rp,dots,3); Text(rp,name+textlen-len,len); // Save x position last_x=data->text_offset+dotlen+extent.te_Width; } // Normal else { BOOL sep=0; // Get x position x=data->text_offset; // Show separators? if (data->flags&LVF_SHOW_SEPARATORS && strcmp(name,"---")==0) sep=1; // Go through string while (pos<textlen) { // Separator? if (sep) { // Get full size width=data->text_width-x; } // Need to parse else { // Look for tab for (tabpos=0;name[pos+tabpos];tabpos++) if (name[pos+tabpos]=='\t' || name[pos+tabpos]=='\a' || name[pos+tabpos]=='\v') break; // Get text size if (tabpos>0) { len=TextFit( rp, name+pos,tabpos, &extent, 0,1, data->text_width-x, data->text_height); width=extent.te_Width; } else { len=0; width=0; } // Tab across if needed if (tab_flag==1) x=data->text_width-width; else if (tab_flag==2) x=(data->text_width-width)>>1; } // Fill background if needed if (last_x && last_x<x) { SetAPen(rp,drawinfo->dri_Pens[(selected)?FILLPEN:BACKGROUNDPEN]); RectFill(rp, box->Left+last_x, y, box->Left+x-1, y+data->text_height-1); SetAPen(rp,fpen); } // Draw separator? if (sep) { short yp,xp; // Clear area under line SetAPen(rp,drawinfo->dri_Pens[(selected)?FILLPEN:BACKGROUNDPEN]); RectFill(rp, box->Left+x, y, (xp=box->Left+x+width-1), y+data->text_height-1); SetAPen(rp,fpen); // Get y position yp=y+(data->text_height>>1); // Draw line SetDrPt(rp,0xbbbb); Move(rp,box->Left+x,yp); Draw(rp,xp,yp); SetDrPt(rp,0xeeee); Move(rp,box->Left+x,yp+1); Draw(rp,xp,yp+1); SetDrPt(rp,0xffff); } // Draw text else if (len>0) { Move(rp,box->Left+x,y+rp->TxBaseline); Text(rp,name+pos,len); } // Save x position last_x=x+width; // Break if just did separator if (sep) break; // Bump buffer pointer pos+=tabpos+1; // Set tab flag if (pos>0) { if (name[pos-1]=='\t') tab_flag=1; else if (name[pos-1]=='\v') tab_flag=2; else if (name[pos-1]=='\a') { unsigned short tab; // Move text position across tab=(unsigned short)name[pos]; x+=tab*rp->TxWidth; // Bump position ++pos; } // Tab flag not set, bump position else x+=width; } } }
// Draw an object void backdrop_draw_object( BackdropInfo *info, BackdropObject *object, UWORD flags, struct RastPort *rp, short left, short top) { UBYTE fpen=1,bpen=0,drawmode=JAM2,opus_drawmode=JAM2; UWORD *imagedata=0; struct Image *image=0; struct Rectangle rect; short len; BOOL comp=0,draw=1,state=0; short has_border; // No icon? if (!object->icon) return; // See if icon has no border has_border=backdrop_icon_border(object); // Not just clearing image? if (!(flags&BRENDERF_CLEAR)) { // Get image to render if ((image=(struct Image *)object->icon->do_Gadget.GadgetRender)) imagedata=image->ImageData; // Is icon selected? if (object->state) { // Is there a select image? if (object->icon->do_Gadget.SelectRender && (object->icon->do_Gadget.Flags&GFLG_GADGHIMAGE)) { if ((image=(struct Image *)object->icon->do_Gadget.SelectRender)) imagedata=image->ImageData; state=1; } else comp=1; } } #ifdef USE_DRAWICONSTATE if (GetIconRectangle( rp, object->icon, NULL, &rect, ICONDRAWA_Borderless, TRUE, TAG_DONE)) { object->pos.Width = rect.MaxX - rect.MinX + 1; object->pos.Height = rect.MaxY - rect.MinY + 1; } #elif defined(__MORPHOS__) if (ISOWN(object->icon)) { struct OwnDiskObject *o = (APTR)object->icon; object->pos.Width = o->pngimage_width; object->pos.Height = o->pngimage_height; } #endif // Get object position if (flags&BRENDERF_REAL) { short border_x=0,border_y_top=0,border_y_bottom=0; // Border? if (has_border) { // Use default border border_x=ICON_BORDER_X; border_y_top=ICON_BORDER_Y_TOP; border_y_bottom=ICON_BORDER_Y_BOTTOM; } // Calculate full size object->full_size.MinX=left-border_x; object->full_size.MinY=top-border_y_top; object->full_size.MaxX=left+object->pos.Width+border_x-1; object->full_size.MaxY=top+object->pos.Height+border_y_bottom-1; // Get image rectangle rect.MinX=object->full_size.MinX+(info->size.MinX-info->offset_x); rect.MinY=object->full_size.MinY+(info->size.MinY-info->offset_y); rect.MaxX=object->full_size.MaxX+(info->size.MinX-info->offset_x); rect.MaxY=object->full_size.MaxY+(info->size.MinY-info->offset_y); // Store position object->show_rect=rect; object->image_rect=rect; // Is object offscreen? if (rect.MaxX<info->size.MinX || rect.MaxY<info->size.MinY || rect.MinX>info->size.MaxX || rect.MinY>info->size.MaxY) draw=0; // Offset by coordinates left+=info->size.MinX-info->offset_x; top+=info->size.MinY-info->offset_y; } else { rect.MinX=left; rect.MinY=top; rect.MaxX=left+object->pos.Width-1; rect.MaxY=top+object->pos.Height-1; } // Clear area? if (flags&BRENDERF_CLEAR) { // Ok to draw? if (draw) { // Clear whole icon? if (!(flags&BRENDERF_LABEL)) { EraseRect(rp,rect.MinX,rect.MinY,rect.MaxX,rect.MaxY); } } // Can't draw else flags&=~BRENDERF_CLEAR; } // Object state changed? else if (object->flags&BDOF_STATE_CHANGE) { #ifndef USE_DRAWICONSTATE // Need to clear if transparent #if !defined(__MORPHOS__) if (!has_border) #endif EraseRect(rp,rect.MinX,rect.MinY,rect.MaxX,rect.MaxY); #endif object->flags&=~BDOF_STATE_CHANGE; } // Draw as normal if (!(flags&BRENDERF_CLEAR)) { // Not drawing if no image if (!imagedata) draw=0; // Ok to draw? if (draw) { struct BitMap bitmap; BOOL use_mask=0; // Full icon? if (flags&BRENDERF_REAL) { // Want border? if (has_border) { // Draw border around icon DrawBox(rp,&rect,GUI->draw_info,object->state); // Get background colour #ifdef USE_64BIT SetAPen( rp, (object->flags&BDOF_BACKGROUND)? object->pen: GUI->draw_info->dri_Pens[BACKGROUNDPEN]); #else SetAPen( rp, (object->flags&BDOF_BACKGROUND)? object->size: GUI->draw_info->dri_Pens[BACKGROUNDPEN]); #endif // Clear boundary around image #ifdef USE_DRAWICONSTATE RectFill(rp,rect.MinX+1,rect.MinY+1,rect.MaxX-1,rect.MaxY-1); #else RectFill(rp,rect.MinX+1,rect.MinY+1,rect.MaxX-1,rect.MinY+2); RectFill(rp,rect.MinX+1,rect.MinY+1,rect.MinX+3,rect.MaxY-1); RectFill(rp,rect.MinX+4,rect.MaxY-3,rect.MaxX-1,rect.MaxY-1); RectFill(rp,rect.MaxX-3,rect.MinY+3,rect.MaxX-1,rect.MaxY-4); #endif } #ifdef USE_DRAWICONSTATE else { EraseRect(rp,rect.MinX,rect.MinY,rect.MaxX,rect.MaxY); } #endif } #ifdef USE_DRAWICONSTATE DrawIconState( rp, object->icon, NULL, left, top, object->state ? IDS_SELECTED : IDS_NORMAL, ICONDRAWA_Frameless, TRUE, ICONDRAWA_Borderless, TRUE, ICONDRAWA_EraseBackground, FALSE, TAG_DONE); #else #if defined(__MORPHOS__) if (ISOWN(object->icon)) { IPTR tags[] = { BLTBMA_USESOURCEALPHA, TRUE, TAG_DONE }; struct OwnDiskObject *o = (APTR)object->icon; BltBitMapRastPortAlpha(o->pngimage, 0, 0, rp, left, top, o->pngimage_width, o->pngimage_height, (struct TagItem *)&tags); if (object->state) { ProcessPixelArray(rp, left, top, o->pngimage_width, o->pngimage_height, POP_TINT, 0x5082ff, NULL); } } else { #endif // Get image as a bitmap backdrop_image_bitmap(info,image,imagedata,&bitmap); // Using a mask (no border)? if (!has_border && object->image_mask[state]) { // Draw using a mask BltMaskBitMapRastPort( &bitmap,0,0, rp,left,top, image->Width,image->Height, 0xe0, (PLANEPTR)object->image_mask[state]); use_mask=1; } // Draw normally else { // Draw image BltBitMapRastPort( &bitmap,0,0, rp,left,top, image->Width,image->Height, 0xc0); } // Complement? if (comp) { DragInfo *drag_info; UBYTE mask; // Only complement to image depth mask=rp->Mask; SetWrMsk(rp,image->PlanePick); // Need backfill? if ((object->icon->do_Gadget.Flags&GFLG_GADGBACKFILL) && (drag_info=GetDragInfo(info->window,0,-object->pos.Width,-object->pos.Height,0))) { // Draw icon into drag buffer BltBitMapRastPort( &bitmap,0,0, &drag_info->drag_rp,0,0, image->Width,image->Height, 0xc0); // Build mask GetDragMask(drag_info); // Complement area with mask BltMaskBitMapRastPort( &drag_info->drag_bm, 0,0, rp, left,top, image->Width, image->Height, 0x20, (PLANEPTR)drag_info->bob.ImageShadow); // Free temporary drag info FreeDragInfo(drag_info); } // Just complement image else { ClipBlit( rp, left,top, rp, left,top, image->Width, image->Height, 0x50); } // Restore mask SetWrMsk(rp,mask); } #if defined(__MORPHOS__) } #endif #endif // Left out (on desktop), or a link? if (!(environment->env->desktop_flags&DESKTOPF_NO_ARROW) && ((object->type==BDO_LEFT_OUT && !(object->flags&BDOF_DESKTOP_FOLDER) && info->flags&BDIF_MAIN_DESKTOP) || object->flags&BDOF_LINK_ICON)) { struct Image *image; // Get correct image for this resolution image=(GUI->screen_info&SCRI_LORES)?&arrow_image[1]:&arrow_image[0]; // Is object big enough for the 'shortcut arrow'? if (object->pos.Width>(image->Width<<1) && object->pos.Height>image->Height+4) { // Draw arrow in bottom-left corner DrawImage(rp,image,rect.MinX,rect.MaxY-image->Height+1); } } // Ghosted icon? if (object->flags&BDOF_GHOSTED) { // Draw ghosting over the icon backdrop_draw_icon_ghost(rp,&rect,(use_mask)?(PLANEPTR)object->image_mask[state]:0); } } // Get pens from configuration fpen=(info->flags&BDIF_MAIN_DESKTOP)?environment->env->icon_fpen:environment->env->iconw_fpen; bpen=(info->flags&BDIF_MAIN_DESKTOP)?environment->env->icon_bpen:environment->env->iconw_bpen; drawmode=(info->flags&BDIF_MAIN_DESKTOP)?environment->env->icon_style:environment->env->iconw_style; opus_drawmode=drawmode; // Shadow/Outline? if (drawmode==MODE_SHADOW || drawmode==MODE_OUTLINE) { UBYTE temp; // Set back to JAM1 drawmode=JAM1; // Swap the pens temp=fpen; fpen=bpen; bpen=temp; } // Fix pens for user colours if (fpen>=4 && fpen<252) fpen=GUI->pens[fpen-4]; if (bpen>=4 && bpen<252) bpen=GUI->pens[bpen-4]; // Use fast call under 39 if(((struct Library *)GfxBase)->lib_Version>=39) { SetABPenDrMd(rp,fpen,bpen,drawmode); } else { SetAPen(rp,fpen); SetBPen(rp,bpen); SetDrMd(rp,drawmode); } } // Full icon? if (flags&BRENDERF_REAL && !(object->flags&BDOF_NO_LABEL)) { char *name,namebuf[40]; // Bad disk? if (object->type==BDO_BAD_DISK) { // Get bad disk name backdrop_bad_disk_name(object,namebuf); name=namebuf; } // Custom label? else if (object->flags&BDOF_CUSTOM_LABEL) name=object->device_name; // Get name pointer else name=object->name; // Get text length if ((len=strlen(name))) { struct TextExtent extent; short max_width=0,loop,textx,texty; // Splitting long labels? if (environment->env->desktop_flags&DESKTOPF_SPLIT_LABELS) { // Calculate maximum text width (minimum 6 chars) max_width=RECTWIDTH(&rect)+(RECTWIDTH(&rect)>>1); if (max_width<rp->Font->tf_XSize*6) max_width=rp->Font->tf_XSize*6; } // Position for text textx=rect.MinX+(RECTWIDTH(&rect)>>1); texty=rect.MaxY+ICON_LABEL_SPACE+rp->TxBaseline+((opus_drawmode==MODE_OUTLINE)?1:0); Move(rp,textx,texty); // Get text pixel size TextMultiLine(rp,name,len,max_width,TMLF_CENTER|TMLF_EXTENT,&extent); // Fix extent for shadow/outline if (opus_drawmode==MODE_SHADOW) { extent.te_Extent.MaxX++; extent.te_Width++; extent.te_Height++; } else if (opus_drawmode==MODE_OUTLINE) { extent.te_Extent.MinX--; extent.te_Extent.MaxX++; extent.te_Width+=2; extent.te_Height+=2; } // Stretch out rectangle sides if necessary if (extent.te_Extent.MinX<rect.MinX) object->full_size.MinX-=rect.MinX-extent.te_Extent.MinX; if (extent.te_Extent.MaxX>rect.MaxX) object->full_size.MaxX+=extent.te_Extent.MaxX-rect.MaxX; if (object->show_rect.MinX>extent.te_Extent.MinX) object->show_rect.MinX=extent.te_Extent.MinX; if (object->show_rect.MaxX<extent.te_Extent.MinX+extent.te_Width-1) object->show_rect.MaxX=extent.te_Extent.MinX+extent.te_Width-1; // Save bottom of text object->show_rect.MaxY+=ICON_LABEL_SPACE+extent.te_Height; // +((opus_drawmode==MODE_OUTLINE)?1:0); object->full_size.MaxY+=ICON_LABEL_SPACE+extent.te_Height; // +((opus_drawmode==MODE_OUTLINE)?1:0); // Clear? if (flags&BRENDERF_CLEAR) { EraseRect(rp, extent.te_Extent.MinX,rect.MaxY+ICON_LABEL_SPACE+((opus_drawmode==MODE_OUTLINE)?1:0), extent.te_Extent.MinX+extent.te_Width-1,rect.MaxY+ICON_LABEL_SPACE+extent.te_Height-1); } // Draw text else { // Is object selected? if (object->flags&BDOF_SELECTED) { if (drawmode==JAM2) SetDrMd(rp,INVERSVID|JAM2); else if (fpen!=GUI->draw_info->dri_Pens[HIGHLIGHTTEXTPEN]) SetAPen(rp,GUI->draw_info->dri_Pens[HIGHLIGHTTEXTPEN]); else SetAPen(rp,GUI->draw_info->dri_Pens[BACKGROUNDPEN]); } // Shadow if (opus_drawmode==MODE_SHADOW) { // Draw shadow text first Move(rp,textx+1,texty+1); TextMultiLine(rp,name,len,max_width,TMLF_CENTER,0); // Draw text SetAPen(rp,bpen); Move(rp,textx,texty); TextMultiLine(rp,name,len,max_width,TMLF_CENTER,0); } // Normal text else if (opus_drawmode!=MODE_OUTLINE) { // Render text TextMultiLine(rp,name,len,max_width,TMLF_CENTER,0); } // Outline else { Move(rp,textx+1,texty+1); for (loop=0;loop<5;loop++) { // Render text TextMultiLine(rp,name,len,max_width,TMLF_CENTER,0); // Doing shadow? if (loop<4) { short s_x=0,s_y=0; // Switch to other pen? if (loop==3) SetAPen(rp,bpen); // Get the new offsets else if (loop==0) { s_x=-1; s_y=1; } else if (loop==1) { s_x=-1; s_y=-1; } else if (loop==2) { s_x=1; s_y=-1; } // Position for text Move(rp,textx+s_x,texty+s_y); } } } // Reset draw mode if necessary if (object->flags&BDOF_SELECTED) SetDrMd(rp,drawmode); } }
static int get_key(AIN_DeviceID ID, int *keycode, int *offset) { static char *window_text; struct Window *window; AIN_InputEvent *event; int done = 0; window_text = translate_text(IDS_PRESS_KEY_BUTTON); *keycode = *offset = -1; /* no key */ if (ID != -1) { ai_handle[0] = AIN_ObtainDevice(CTX, ID); if (ai_handle[0] != NULL) { AIN_SetDeviceParameter(CTX, ai_handle[0], AINDP_EVENT, TRUE); } } window = OpenWindowTags(NULL, WA_Title, (ULONG)"", WA_Flags, WFLG_NOCAREREFRESH|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_RMBTRAP|WFLG_GIMMEZEROZERO, WA_IDCMP, IDCMP_CLOSEWINDOW|WFLG_REPORTMOUSE|IDCMP_RAWKEY|IDCMP_CHANGEWINDOW, WA_Left, 100, WA_Top, 100, WA_Width, 100, WA_Height, 40, WA_Activate, TRUE, TAG_DONE); if (window != NULL) { struct IntuiMessage *imsg = NULL; ULONG imCode, imClass; /* Resize window and set pens */ int length = TextLength(window->RPort, window_text, strlen(window_text)); ChangeWindowBox(window, 100, 100, window->BorderLeft+length+window->BorderRight+8, window->BorderTop+window->IFont->tf_YSize*2+window->BorderBottom); SetAPen(window->RPort, 1); SetBPen(window->RPort, 0); /* Wait until window has been resized */ while (done == 0) { /* Wait for messages */ Wait((1L << window->UserPort->mp_SigBit) | (1L << ai_port->mp_SigBit)); /* Check for IDCMP messages */ while ((imsg = (struct IntuiMessage *)GetMsg(window->UserPort))) { imClass = imsg->Class; imCode = imsg->Code; ReplyMsg((struct Message *)imsg); if (imClass == IDCMP_CHANGEWINDOW) { Move(window->RPort, 4, window->IFont->tf_YSize); Text(window->RPort, window_text, strlen(window_text)); } else if (imClass == IDCMP_RAWKEY) { imCode &= 0x7f; if (imCode != 69) { *keycode = imCode; } done = 1; /* KEY ok */ } else if (imClass == IDCMP_CLOSEWINDOW) { done = -1; /* cancel */ } } /* Check for AI messages */ if (ai_handle[0] != NULL) { while ((event = AIN_GetEvent(CTX))) { switch(event->Type) { case AINET_AXIS: if ((event->Value >= (ONOFF_VALUE)) || (event->Value <= (-(ONOFF_VALUE)))) { *offset = event->Index; done = 2; /* AI ok */ } break; case AINET_BUTTON: *offset = event->Index; done = 2; /* AI ok */ break; case AINET_HAT: *offset = event->Index; done = 2; /* AI ok */ break; default: break; } AIN_FreeEvent(CTX, event); } } } CloseWindow(window); } if (ai_handle[0] != NULL) { AIN_SetDeviceParameter(CTX, ai_handle[0], AINDP_EVENT, FALSE); /* Remove pending AI messages */ while ((event = AIN_GetEvent(CTX))) { AIN_FreeEvent(CTX, event); } AIN_ReleaseDevice(CTX, ai_handle[0]); ai_handle[0] = NULL; } return done; }
void statusbar_refresh(int drive_number) { video_canvas_t *canvas; int i; if (drive_number == REFRESH_ALL) { enabled_drives = 0; for (i=0; i<DRIVE_NUM; i++) { if (status_enabled & (1 << i)) { status_map[enabled_drives++] = i; } } } for (canvas = canvaslist; canvas; canvas = canvas->next) { struct Window *window; char str[32]; int x, width, height; int basex, basey; if (!canvas->os->has_statusbar || canvas->waiting_for_resize) continue; window = canvas->os->window; width = window->Width - window->BorderLeft - window->BorderRight; height = window->Height - window->BorderTop - window->BorderBottom - statusbar_get_status_height(); basex = window->BorderLeft; basey = window->BorderTop; if (canvas->os->font) { SetFont(window->RPort, canvas->os->font); } /* else we use system default font */ if (drive_number == REFRESH_ALL) { x = width - (canvas->os->disk_width * enabled_drives) - (tape_enabled ? canvas->os->tape_width : 0); SetAPen(window->RPort, 0); SetBPen(window->RPort, 0); _RectFill(window->RPort, 0, height, x - 1, height + statusbar_get_status_height() - 1); } for (i=0; i<enabled_drives; i++) { int drive = status_map[i]; if ((drive_number != REFRESH_ALL) && (drive_number != drive)) continue; sprintf(str, "%2d: %2d.%01d", drive + 8, (int)status_track[drive], (int)(status_track[drive] * 10 - (int)status_track[drive] * 10)); x = width - (canvas->os->disk_width * (enabled_drives - i)); SetAPen(window->RPort, 0); SetBPen(window->RPort, 0); _RectFill(window->RPort, x, height, x + canvas->os->disk_width - 1, height + statusbar_get_status_height() - 1); SetAPen(window->RPort, canvas->os->pens[b_black]); _Move(window->RPort, x, height + 13); Text(window->RPort, str, strlen(str)); x += canvas->os->disk_width - (10 + 7); SetAPen(window->RPort, canvas->os->pens[(status_led[drive] ? (drive_active_led[drive] ? b_green : b_red) : b_black)]); _RectFill(window->RPort, x, height + 4, x + 10, height + 14); } if ((tape_enabled) && ((drive_number == REFRESH_ALL) || (drive_number == TAPE_NUM))) { int motor_color; int record_led; /* motor */ if (tape_motor) { motor_color = b_yellow; } else { motor_color = b_grey; } x = width - (canvas->os->disk_width * enabled_drives) - (tape_enabled ? canvas->os->tape_width : 0); SetAPen(window->RPort, 0); SetBPen(window->RPort, 0); _RectFill(window->RPort, x, height, x + canvas->os->tape_width - 1, height + statusbar_get_status_height() - 1); SetAPen(window->RPort, canvas->os->pens[motor_color]); _RectFill(window->RPort, x, height + 4, x + 10, height + 14); /* control */ record_led = b_black; switch (tape_control) { case DATASETTE_CONTROL_STOP: SetAPen(window->RPort, canvas->os->pens[b_black]); _RectFill(window->RPort, x + 2, height + 4 + 2, x + 10 - 2, height + 14 - 2); break; case DATASETTE_CONTROL_RECORD: record_led = b_red; case DATASETTE_CONTROL_START: SetAPen(window->RPort, canvas->os->pens[b_black]); LINE(x + 2, height + 4 + 2, x + 2, height + 14 - 2); LINE(x + 3, height + 4 + 3, x + 3, height + 14 - 3); LINE(x + 4, height + 4 + 4, x + 4, height + 14 - 4); LINE(x + 5, height + 4 + 5, x + 5, height + 14 - 5); break; case DATASETTE_CONTROL_REWIND: SetAPen(window->RPort, canvas->os->pens[b_black]); LINE(x + 5, height + 4 + 2, x + 2, height + 4 + 5); LINE(x + 2, height + 4 + 5, x + 5, height + 14 - 2); LINE(x + 5 + 3, height + 4 + 2, x + 2 + 3, height + 4 + 5); LINE(x + 2 + 3, height + 4 + 5, x + 5 + 3, height + 14 - 2); break; case DATASETTE_CONTROL_FORWARD: SetAPen(window->RPort, canvas->os->pens[b_black]); LINE(x + 2, height + 4 + 2, x + 5, height + 4 + 5); LINE(x + 5, height + 4 + 5, x + 2, height + 14 - 2); LINE(x + 2 + 3, height + 4 + 2, x + 5 + 3, height + 4 + 5); LINE(x + 5 + 3, height + 4 + 5, x + 2 + 3, height + 14 - 2); break; } SetAPen(window->RPort, canvas->os->pens[record_led]); _RectFill(window->RPort, x + 2 + 14, height + 4 + 2, x + 10 - 2 + 14, height + 14 - 2); /* counter */ sprintf(str, "%03d", tape_counter); SetAPen(window->RPort, canvas->os->pens[b_black]); _Move(window->RPort, x + 28, height + 13); Text(window->RPort, str, strlen(str)); } } }