mirror of https://github.com/weiju/amiga-stuff
startup and file requester change
- hardware startup: added copper macros - file requester: add blocking requester for parent window
This commit is contained in:
parent
a20c596b9c
commit
b4ed097fad
|
@ -30,26 +30,33 @@ void waitmouse() = "waitmouse:\n\tbtst\t#6,$bfe001\n\tbne\twaitmouse";
|
|||
#define VFREQ_PAL 50
|
||||
#define WB_SCREEN_NAME "Workbench"
|
||||
|
||||
#define BPLCON0 0x100
|
||||
#define COLOR00 0x180
|
||||
|
||||
#define BPLCON0_COLOR (1 << 9)
|
||||
|
||||
#define COP_MOVE(addr, data) addr, data
|
||||
#define COP_WAIT_END 0xffff, 0xfffe
|
||||
|
||||
static UWORD __chip coplist_pal[] = {
|
||||
0x100, 0x200, // otherwise no display!
|
||||
0x180, 0x00,
|
||||
0x8107, 0xfffe, // wait for $8107,$fffe
|
||||
0x180,
|
||||
0xf0f, // background red
|
||||
0xd607, 0xfffe, // wait for $d607,$fffe
|
||||
0x180, 0xff0, // background yellow
|
||||
0xffff, 0xfffe,
|
||||
0xffff, 0xfffe
|
||||
COP_MOVE(BPLCON0, BPLCON0_COLOR),
|
||||
COP_MOVE(COLOR00, 0x000),
|
||||
0x8107, 0xfffe, // wait for $8107,$fffe
|
||||
COP_MOVE(COLOR00, 0xf00),
|
||||
0xd607, 0xfffe, // wait for $d607,$fffe
|
||||
COP_MOVE(COLOR00, 0xff0),
|
||||
COP_WAIT_END,
|
||||
COP_WAIT_END
|
||||
};
|
||||
static UWORD __chip coplist_ntsc[] = {
|
||||
0x100, 0x0200, // otherwise no display!
|
||||
0x180, 0x00,
|
||||
0x6e07, 0xfffe, // wait for $6e07,$fffe
|
||||
0x180, 0xf00, // background red
|
||||
0xb007, 0xfffe, // wait for $b007,$fffe
|
||||
0x180, 0xff0, // background yellow
|
||||
0xffff, 0xfffe,
|
||||
0xffff, 0xfffe
|
||||
COP_MOVE(BPLCON0, BPLCON0_COLOR),
|
||||
COP_MOVE(COLOR00, 0x000),
|
||||
0x6e07, 0xfffe, // wait for $6e07,$fffe
|
||||
COP_MOVE(COLOR00, 0xf00),
|
||||
0xb007, 0xfffe, // wait for $b007,$fffe
|
||||
COP_MOVE(COLOR00, 0xff0),
|
||||
COP_WAIT_END,
|
||||
COP_WAIT_END
|
||||
};
|
||||
|
||||
static struct Screen *wbscreen;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include <string.h>
|
||||
#include <intuition/intuition.h>
|
||||
#include <graphics/clip.h>
|
||||
#include <dos/dosextens.h>
|
||||
|
||||
#include <clib/exec_protos.h>
|
||||
#include <clib/intuition_protos.h>
|
||||
#include <clib/graphics_protos.h>
|
||||
#include <clib/layers_protos.h>
|
||||
#include <clib/dos_protos.h>
|
||||
#include <clib/alib_stdio_protos.h>
|
||||
|
||||
|
@ -87,6 +89,9 @@ enum {
|
|||
LIST_UP_ID, LIST_DOWN_ID
|
||||
} GadgetIDs;
|
||||
|
||||
// This requester's purpose is simply to block the parent window's input
|
||||
static struct Requester block_requester;
|
||||
|
||||
static struct Requester requester;
|
||||
static BOOL req_opened = FALSE;
|
||||
static struct Window *req_window;
|
||||
|
@ -149,7 +154,7 @@ static struct PropInfo propinfo = {AUTOKNOB | FREEVERT, 0, 0, MAXBODY, MAXBODY,
|
|||
static struct NewWindow newwin = {
|
||||
0, 0, 0, REQWIN_HEIGHT, 0, 1,
|
||||
IDCMP_GADGETUP | IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE,
|
||||
WFLG_CLOSEGADGET | WFLG_SMART_REFRESH | WFLG_ACTIVATE | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_NOCAREREFRESH,
|
||||
WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_SIMPLE_REFRESH | WFLG_NOCAREREFRESH,
|
||||
NULL, NULL, WIN_TITLE,
|
||||
NULL, NULL,
|
||||
0, REQWIN_HEIGHT,
|
||||
|
@ -275,9 +280,11 @@ int vertpot2entry(int vertpot)
|
|||
|
||||
static void render_list_backbuffer()
|
||||
{
|
||||
LockLayer(0L, requester.ReqLayer);
|
||||
ClipBlit(&filelist_rastport, 0, 0, requester.ReqLayer->rp,
|
||||
FILE_LIST_BM_MARGIN, FILE_LIST_BM_MARGIN, filelist_bm_width, filelist_bm_height,
|
||||
0xc0);
|
||||
UnlockLayer(requester.ReqLayer);
|
||||
}
|
||||
|
||||
static void draw_selection(struct RastPort *src_rp, int view_index)
|
||||
|
@ -317,7 +324,6 @@ static void draw_list()
|
|||
// layer's rastport, because it is rendered on top of the
|
||||
// parent window and obscures the content
|
||||
struct RastPort *src_rp = &filelist_rastport;
|
||||
struct RastPort *dst_rp = requester.ReqLayer->rp;
|
||||
|
||||
// make sure drawing is clipped, otherwise it will
|
||||
// draw somewhere else into memory
|
||||
|
@ -589,7 +595,7 @@ void init_sizes(struct Window *window, struct Requester *requester)
|
|||
requester->ReqText = NULL;
|
||||
}
|
||||
|
||||
void open_file(struct Window *window)
|
||||
static void open_request_window(struct Window *window)
|
||||
{
|
||||
InitRequester(&requester);
|
||||
init_sizes(window, &requester);
|
||||
|
@ -622,3 +628,22 @@ void open_file(struct Window *window)
|
|||
puts("OpenWindow() failed !!!");
|
||||
}
|
||||
}
|
||||
|
||||
void open_file(struct Window *window)
|
||||
{
|
||||
InitRequester(&block_requester);
|
||||
// note that the Request() call fails, when everything is set to 0,
|
||||
// contrary to the docs.
|
||||
block_requester.Width = 1;
|
||||
block_requester.Height = 1;
|
||||
block_requester.LeftEdge = REQ_HMARGIN;
|
||||
block_requester.TopEdge = REQ_VMARGIN;
|
||||
|
||||
if (Request(&block_requester, window)) {
|
||||
printf("top request opened\n");
|
||||
open_request_window(window);
|
||||
EndRequest(&block_requester, window);
|
||||
} else {
|
||||
printf("top request failed\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
|
||||
static struct NewWindow newwin = {
|
||||
WIN_LEFT, WIN_TOP, WIN_WIDTH, WIN_HEIGHT, 0, 1,
|
||||
IDCMP_CLOSEWINDOW | IDCMP_MENUPICK | IDCMP_GADGETUP | IDCMP_REQCLEAR,
|
||||
WINDOWCLOSE | SMART_REFRESH | ACTIVATE | WINDOWSIZING | WINDOWDRAG | WINDOWDEPTH,
|
||||
IDCMP_CLOSEWINDOW | IDCMP_MENUPICK | IDCMP_GADGETUP,
|
||||
WFLG_CLOSEGADGET | WFLG_SIMPLE_REFRESH | WFLG_ACTIVATE | WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_NOCAREREFRESH,
|
||||
NULL, NULL, WIN_TITLE,
|
||||
NULL, NULL,
|
||||
WIN_MIN_WIDTH, WIN_MIN_HEIGHT,
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# jpg2ham6 - a tool to convert jpg images to HAM6 IFF/ILBM
|
||||
# requires Netpbm
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <jpg-file> <iff-file>"
|
||||
else
|
||||
jpegtopnm $1 | ppmtoilbm -ham6 -ecs > $2
|
||||
fi
|
Loading…
Reference in New Issue