Browser is now browsing!
This commit is contained in:
parent
f477ee15d0
commit
2807ff5521
5 changed files with 242 additions and 55 deletions
|
@ -64,20 +64,25 @@ static ListboxT *_lstInfo = NULL;
|
||||||
|
|
||||||
static uint8_t _channel = 0;
|
static uint8_t _channel = 0;
|
||||||
static char *_lastSearchText = NULL;
|
static char *_lastSearchText = NULL;
|
||||||
|
static char *_nextZoomImage = NULL;
|
||||||
static GameT _selectedGame = { 0 };
|
static GameT _selectedGame = { 0 };
|
||||||
|
|
||||||
|
|
||||||
static void btnTabClick(WidgetT *widget);
|
static void btnTabClick(WidgetT *widget);
|
||||||
|
static void btnZoomCloseClick(WidgetT *widget);
|
||||||
static void fraBoxShow(void);
|
static void fraBoxShow(void);
|
||||||
|
static void fraBoxReady(char *file);
|
||||||
static void fraDescriptionShow(void);
|
static void fraDescriptionShow(void);
|
||||||
|
static void fraDescriptionReady(char *file);
|
||||||
static void fraInfoShow(void);
|
static void fraInfoShow(void);
|
||||||
static void fraScreensShow(void);
|
static void fraScreensShow(void);
|
||||||
static void fraScreensReady(char *file);
|
static void fraScreensReady(char *file);
|
||||||
static void packetHandler(PacketDecodeDataT *packet);
|
static void packetHandler(PacketDecodeDataT *packet);
|
||||||
|
static void picClick(WidgetT *widget);
|
||||||
static void tabsBusySet(uint8_t busy);
|
static void tabsBusySet(uint8_t busy);
|
||||||
static void timSearchUpdate(WidgetT *widget);
|
static void timSearchUpdate(WidgetT *widget);
|
||||||
static void updateSelectedGame(void);
|
static void updateSelectedGame(void);
|
||||||
|
static void winZoomReady(char *file);
|
||||||
|
|
||||||
|
|
||||||
void browserHide(void) {
|
void browserHide(void) {
|
||||||
|
@ -90,8 +95,6 @@ void browserHide(void) {
|
||||||
|
|
||||||
void browserShow(void) {
|
void browserShow(void) {
|
||||||
|
|
||||||
//char **lines = NULL;
|
|
||||||
|
|
||||||
TagItemT uiBrowser[] = {
|
TagItemT uiBrowser[] = {
|
||||||
T_START,
|
T_START,
|
||||||
T_WINDOW, O(_winBrowser),
|
T_WINDOW, O(_winBrowser),
|
||||||
|
@ -162,27 +165,33 @@ void browserShow(void) {
|
||||||
T_PICTURE, O(_picThumb[0]), // Thumbs are 160x100
|
T_PICTURE, O(_picThumb[0]), // Thumbs are 160x100
|
||||||
T_X, 1, T_Y, 5,
|
T_X, 1, T_Y, 5,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
T_PICTURE, O(_picThumb[1]),
|
T_PICTURE, O(_picThumb[1]),
|
||||||
T_X, 167, T_Y, 5,
|
T_X, 167, T_Y, 5,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
T_PICTURE, O(_picThumb[2]),
|
T_PICTURE, O(_picThumb[2]),
|
||||||
T_X, 333, T_Y, 5,
|
T_X, 333, T_Y, 5,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
|
|
||||||
T_PICTURE, O(_picThumb[3]),
|
T_PICTURE, O(_picThumb[3]),
|
||||||
T_X, 1, T_Y, 116,
|
T_X, 1, T_Y, 116,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
T_PICTURE, O(_picThumb[4]),
|
T_PICTURE, O(_picThumb[4]),
|
||||||
T_X, 167, T_Y, 116,
|
T_X, 167, T_Y, 116,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
T_PICTURE, O(_picThumb[5]),
|
T_PICTURE, O(_picThumb[5]),
|
||||||
T_X, 333, T_Y, 116,
|
T_X, 333, T_Y, 116,
|
||||||
T_CACHENAME, P("browser:no-screen.png"),
|
T_CACHENAME, P("browser:no-screen.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
|
|
||||||
T_FRAME, T_DONE,
|
T_FRAME, T_DONE,
|
||||||
|
@ -203,10 +212,12 @@ void browserShow(void) {
|
||||||
T_PICTURE, O(_picBox[0]), // Thumbs are 240x210
|
T_PICTURE, O(_picBox[0]), // Thumbs are 240x210
|
||||||
T_X, 1, T_Y, 5,
|
T_X, 1, T_Y, 5,
|
||||||
T_CACHENAME, P("browser:no-box.png"),
|
T_CACHENAME, P("browser:no-box.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
T_PICTURE, O(_picBox[1]),
|
T_PICTURE, O(_picBox[1]),
|
||||||
T_X, 250, T_Y, 5,
|
T_X, 250, T_Y, 5,
|
||||||
T_CACHENAME, P("browser:no-box.png"),
|
T_CACHENAME, P("browser:no-box.png"),
|
||||||
|
T_CLICK, P(picClick),
|
||||||
T_PICTURE, T_DONE,
|
T_PICTURE, T_DONE,
|
||||||
|
|
||||||
T_FRAME, T_DONE,
|
T_FRAME, T_DONE,
|
||||||
|
@ -245,49 +256,15 @@ void browserShow(void) {
|
||||||
guiFocusSet(W(_txtSearch));
|
guiFocusSet(W(_txtSearch));
|
||||||
_channel = netChannelGet(packetHandler);
|
_channel = netChannelGet(packetHandler);
|
||||||
|
|
||||||
|
// This forces the background timer to run the search.
|
||||||
_lastSearchText = strdup("x");
|
_lastSearchText = strdup("x");
|
||||||
|
|
||||||
/*
|
guiDebugAreaShow(W(_btnBoxTab));
|
||||||
guiDebugAreaShow(W(_fraSearch));
|
|
||||||
|
|
||||||
lines = utilWrapText(
|
|
||||||
"The Post-Terran Minerals Corporation (PTMC) digs up minerals on all nine planets of the solar system, "
|
|
||||||
"employing humans and robots to do its job. Unfortunately, the mining robots are now being controlled by a hacker, "
|
|
||||||
"and have taken the human workers hostage. The PTMC has tried to get the robots back under their control, but "
|
|
||||||
"communication with the mining stations has been lost. In desperation, the PTMC modifies a Pyro-GX ship for combat "
|
|
||||||
"and hires a mercenary, codenamed 'Material Defender', to fly it. The mission is to destroy the infected mines and "
|
|
||||||
"rescue human hostages, destroying any hostile robot that gets in the way.", 57);
|
|
||||||
while (arrlen(lines) > 0) {
|
|
||||||
listboxItemAdd(_lstDescription, lines[0]);
|
|
||||||
DEL(lines[0]);
|
|
||||||
arrdel(lines, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
listboxItemAdd(_lstResults, "123456789012345678901234567890123456789012345678901234567");
|
|
||||||
listboxItemAdd(_lstResults, "2");
|
|
||||||
listboxItemAdd(_lstResults, "3");
|
|
||||||
listboxItemAdd(_lstResults, "4");
|
|
||||||
listboxItemAdd(_lstResults, "5");
|
|
||||||
listboxItemAdd(_lstResults, "6");
|
|
||||||
listboxItemAdd(_lstResults, "7");
|
|
||||||
listboxItemAdd(_lstResults, "8");
|
|
||||||
listboxItemAdd(_lstResults, "9");
|
|
||||||
listboxItemAdd(_lstResults, "10");
|
|
||||||
listboxItemAdd(_lstResults, "11");
|
|
||||||
listboxItemAdd(_lstResults, "12");
|
|
||||||
listboxItemAdd(_lstResults, "13");
|
|
||||||
listboxItemAdd(_lstResults, "14");
|
|
||||||
listboxItemAdd(_lstResults, "15");
|
|
||||||
listboxItemAdd(_lstResults, "16");
|
|
||||||
listboxItemAdd(_lstResults, "17");
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void btnTabClick(WidgetT *widget) {
|
static void btnTabClick(WidgetT *widget) {
|
||||||
|
|
||||||
tabsBusySet(1);
|
|
||||||
|
|
||||||
// Hide everything.
|
// Hide everything.
|
||||||
widgetVisibleSet(W(_fraBox), 0);
|
widgetVisibleSet(W(_fraBox), 0);
|
||||||
widgetVisibleSet(W(_fraDescription), 0);
|
widgetVisibleSet(W(_fraDescription), 0);
|
||||||
|
@ -302,28 +279,153 @@ static void btnTabClick(WidgetT *widget) {
|
||||||
if (widget == W(_btnDescriptionTab)) fraDescriptionShow();
|
if (widget == W(_btnDescriptionTab)) fraDescriptionShow();
|
||||||
if (widget == W(_btnInfoTab)) fraInfoShow();
|
if (widget == W(_btnInfoTab)) fraInfoShow();
|
||||||
if (widget == W(_btnScreensTab)) fraScreensShow();
|
if (widget == W(_btnScreensTab)) fraScreensShow();
|
||||||
if (widget == W(_btnSearchTab)) {
|
if (widget == W(_btnSearchTab)) widgetVisibleSet(W(_fraSearch), 1);
|
||||||
widgetVisibleSet(W(_fraSearch), 1);
|
}
|
||||||
tabsBusySet(0);
|
|
||||||
}
|
|
||||||
|
static void btnZoomCloseClick(WidgetT *widget) {
|
||||||
|
WindowT *w = (WindowT *)guiParentGet(widget);
|
||||||
|
|
||||||
|
guiDelete(D(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fraBoxShow(void) {
|
static void fraBoxShow(void) {
|
||||||
widgetVisibleSet(W(_fraBox), 1);
|
char **fileList = NULL;
|
||||||
tabsBusySet(0);
|
char *temp;
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
tabsBusySet(1);
|
||||||
|
|
||||||
|
// Build list of box filenames needed.
|
||||||
|
for (i=0; i<_selectedGame.boxes; i++) {
|
||||||
|
temp = utilCreateString("games:%c:%s:box%d.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
||||||
|
utilStringToLower(temp);
|
||||||
|
arrput(fileList, temp);
|
||||||
|
temp = utilCreateString("games:%c:%s:box%d-thumb.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
||||||
|
utilStringToLower(temp);
|
||||||
|
arrput(fileList, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileList) {
|
||||||
|
fileCacheCheckArr(fraBoxReady, fileList);
|
||||||
|
} else {
|
||||||
|
fraBoxReady(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fraDescriptionShow(void) {
|
static void fraBoxReady(char *file) {
|
||||||
widgetVisibleSet(W(_fraDescription), 1);
|
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
// Is this a file update notice? If so, exit.
|
||||||
|
if (file) return;
|
||||||
|
|
||||||
tabsBusySet(0);
|
tabsBusySet(0);
|
||||||
|
|
||||||
|
// Are there boxes?
|
||||||
|
if (_selectedGame.boxes == 0) {
|
||||||
|
// Nope.
|
||||||
|
pictureReplace(_picBox[0], "browser:no-box.png");
|
||||||
|
widgetVisibleSet(W(_picBox[1]), 0);
|
||||||
|
} else {
|
||||||
|
for (i=0; i<2; i++) {
|
||||||
|
if (i < _selectedGame.boxes) {
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, "games:%c:%s:box%d-thumb.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
||||||
|
utilStringToLower(_scratch);
|
||||||
|
pictureReplace(_picBox[i], _scratch);
|
||||||
|
widgetVisibleSet(W(_picBox[i]), 1);
|
||||||
|
} else {
|
||||||
|
widgetVisibleSet(W(_picBox[i]), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display us.
|
||||||
|
widgetVisibleSet(W(_fraBox), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void fraDescriptionShow(void) {
|
||||||
|
char **fileList = NULL;
|
||||||
|
char *temp;
|
||||||
|
|
||||||
|
tabsBusySet(1);
|
||||||
|
|
||||||
|
temp = utilCreateString("games:%c:%s:banner.png", _selectedGame.shortName[0], _selectedGame.shortName);
|
||||||
|
utilStringToLower(temp);
|
||||||
|
arrput(fileList, temp);
|
||||||
|
|
||||||
|
fileCacheCheckArr(fraDescriptionReady, fileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void fraDescriptionReady(char *file) {
|
||||||
|
|
||||||
|
char **lines = NULL;
|
||||||
|
|
||||||
|
// Is this a file update notice? If so, exit.
|
||||||
|
if (file) return;
|
||||||
|
|
||||||
|
tabsBusySet(0);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, "games:%c:%s:banner.png", _selectedGame.shortName[0], _selectedGame.shortName);
|
||||||
|
utilStringToLower(_scratch);
|
||||||
|
pictureReplace(_picBanner, _scratch);
|
||||||
|
|
||||||
|
listboxItemsClear(_lstDescription);
|
||||||
|
lines = utilWrapText(_selectedGame.description, 57);
|
||||||
|
while (arrlen(lines) > 0) {
|
||||||
|
listboxItemAdd(_lstDescription, lines[0]);
|
||||||
|
DEL(lines[0]);
|
||||||
|
arrdel(lines, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show us.
|
||||||
|
widgetVisibleSet(W(_fraDescription), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fraInfoShow(void) {
|
static void fraInfoShow(void) {
|
||||||
|
|
||||||
|
listboxItemsClear(_lstInfo);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Title: %s", _selectedGame.title);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, "Developer: %s", _selectedGame.developer);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, "Publisher: %s", _selectedGame.publisher);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Released: %s", _selectedGame.releaseDate);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Rating: %s", _selectedGame.rating);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Series: %s", _selectedGame.series);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Source: %s", _selectedGame.origin);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Type: %s",
|
||||||
|
_selectedGame.type == GAME_TYPE_DOOR ? "BBS Door" :
|
||||||
|
_selectedGame.type == GAME_TYPE_SERIAL ? "Modem or Serial" :
|
||||||
|
_selectedGame.type == GAME_TYPE_IPX ? "IPX Network" :
|
||||||
|
_selectedGame.type == GAME_TYPE_FICTION ? "Interactive Fiction" : "Unknown"
|
||||||
|
);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Players: %d", _selectedGame.maxPlayers);
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
|
snprintf(_scratch, SCRATCH_SIZE, " Joinable: %s", _selectedGame.joinable ? "Yes" : "No");
|
||||||
|
listboxItemAdd(_lstInfo, _scratch);
|
||||||
|
|
||||||
widgetVisibleSet(W(_fraInfo), 1);
|
widgetVisibleSet(W(_fraInfo), 1);
|
||||||
tabsBusySet(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,6 +434,8 @@ static void fraScreensShow(void) {
|
||||||
char *temp;
|
char *temp;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
|
tabsBusySet(1);
|
||||||
|
|
||||||
// Build list of screen filenames needed.
|
// Build list of screen filenames needed.
|
||||||
for (i=0; i<_selectedGame.screens; i++) {
|
for (i=0; i<_selectedGame.screens; i++) {
|
||||||
temp = utilCreateString("games:%c:%s:screen%d.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
temp = utilCreateString("games:%c:%s:screen%d.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
||||||
|
@ -357,6 +461,8 @@ static void fraScreensReady(char *file) {
|
||||||
// Is this a file update notice? If so, exit.
|
// Is this a file update notice? If so, exit.
|
||||||
if (file) return;
|
if (file) return;
|
||||||
|
|
||||||
|
tabsBusySet(0);
|
||||||
|
|
||||||
// Are there screenshots?
|
// Are there screenshots?
|
||||||
if (_selectedGame.screens == 0) {
|
if (_selectedGame.screens == 0) {
|
||||||
// Nope.
|
// Nope.
|
||||||
|
@ -369,7 +475,6 @@ static void fraScreensReady(char *file) {
|
||||||
if (i < _selectedGame.screens) {
|
if (i < _selectedGame.screens) {
|
||||||
snprintf(_scratch, SCRATCH_SIZE, "games:%c:%s:screen%d-thumb.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
snprintf(_scratch, SCRATCH_SIZE, "games:%c:%s:screen%d-thumb.png", _selectedGame.shortName[0], _selectedGame.shortName, i + 1);
|
||||||
utilStringToLower(_scratch);
|
utilStringToLower(_scratch);
|
||||||
logWrite("Loading screen: %s\n", _scratch);
|
|
||||||
pictureReplace(_picThumb[i], _scratch);
|
pictureReplace(_picThumb[i], _scratch);
|
||||||
widgetVisibleSet(W(_picThumb[i]), 1);
|
widgetVisibleSet(W(_picThumb[i]), 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -380,7 +485,6 @@ static void fraScreensReady(char *file) {
|
||||||
|
|
||||||
// Display us.
|
// Display us.
|
||||||
widgetVisibleSet(W(_fraScreens), 1);
|
widgetVisibleSet(W(_fraScreens), 1);
|
||||||
tabsBusySet(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -389,6 +493,38 @@ static void packetHandler(PacketDecodeDataT *packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void picClick(WidgetT *widget) {
|
||||||
|
PictureT *p = (PictureT *)widget;
|
||||||
|
char *c = NULL;
|
||||||
|
char **fileList = NULL;
|
||||||
|
|
||||||
|
_nextZoomImage = strdup(pictureFilenameGet(p));
|
||||||
|
|
||||||
|
if (strcmp(_nextZoomImage, "browser:no-box.png") == 0 || strcmp(_nextZoomImage, "browser:no-screen.png") == 0) {
|
||||||
|
// Can't zoom nothing!
|
||||||
|
DEL(_nextZoomImage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c = strstr(_nextZoomImage, "-thumb.png");
|
||||||
|
if (!c) {
|
||||||
|
// Someone didn't follow naming rules!
|
||||||
|
DEL(_nextZoomImage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c[0] = '.';
|
||||||
|
c[1] = 'p';
|
||||||
|
c[2] = 'n';
|
||||||
|
c[3] = 'g';
|
||||||
|
c[4] = 0;
|
||||||
|
|
||||||
|
tabsBusySet(1);
|
||||||
|
arrput(fileList, _nextZoomImage);
|
||||||
|
fileCacheCheckArr(winZoomReady, fileList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void tabsBusySet(uint8_t busy) {
|
static void tabsBusySet(uint8_t busy) {
|
||||||
uint8_t enabled = busy ? 0 : 1;
|
uint8_t enabled = busy ? 0 : 1;
|
||||||
|
|
||||||
|
@ -501,3 +637,30 @@ static void updateSelectedGame(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void winZoomReady(char *file) {
|
||||||
|
WindowT *winZoom = NULL;
|
||||||
|
PictureT *picZoom = NULL;
|
||||||
|
ButtonT *btnClose = NULL;
|
||||||
|
uint16_t w;
|
||||||
|
uint16_t h;
|
||||||
|
|
||||||
|
// Is this a file update notice? If so, exit.
|
||||||
|
if (file) return;
|
||||||
|
|
||||||
|
tabsBusySet(0);
|
||||||
|
|
||||||
|
picZoom = pictureNew(1, 1, _nextZoomImage);
|
||||||
|
w = widgetWidthGet(W(picZoom)) + 7 + 8 + 2;
|
||||||
|
h = widgetHeightGet(W(picZoom)) + 26 + 8 + 22 + 6;
|
||||||
|
|
||||||
|
btnClose = buttonNew(w - 77, widgetHeightGet(W(picZoom)) + 3, "Close", btnZoomCloseClick);
|
||||||
|
|
||||||
|
winZoom = windowNew(vbeDisplayWidthGet() / 2 - w / 2, vbeDisplayHeightGet() / 2 - h / 2, w, h, "Image");
|
||||||
|
guiAttach(W(winZoom), W(picZoom));
|
||||||
|
guiAttach(W(winZoom), W(btnClose));
|
||||||
|
guiAttach(guiRootGet(), W(winZoom));
|
||||||
|
|
||||||
|
DEL(_nextZoomImage);
|
||||||
|
}
|
||||||
|
|
|
@ -218,7 +218,6 @@ void guiDelayedFree(void **pointer) {
|
||||||
// Delayed Free allows freeing of data that may be in use by the
|
// Delayed Free allows freeing of data that may be in use by the
|
||||||
// GUI system at a safe time. (After compositing.)
|
// GUI system at a safe time. (After compositing.)
|
||||||
arrput(_guiPendingFrees, *pointer);
|
arrput(_guiPendingFrees, *pointer);
|
||||||
*pointer = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,7 +230,6 @@ void guiDelete(WidgetT **widget) {
|
||||||
// that is also handled in the paint event.
|
// that is also handled in the paint event.
|
||||||
|
|
||||||
arrput(_guiDeleteList, widget);
|
arrput(_guiDeleteList, widget);
|
||||||
*widget = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +237,7 @@ static void guiDeleteList(void) {
|
||||||
WidgetT **w = NULL;
|
WidgetT **w = NULL;
|
||||||
WindowT *win = NULL;
|
WindowT *win = NULL;
|
||||||
|
|
||||||
if (_guiDeleteList) {
|
if (_guiDeleteList != NULL) {
|
||||||
while (arrlen(_guiDeleteList) > 0) {
|
while (arrlen(_guiDeleteList) > 0) {
|
||||||
w = arrpop(_guiDeleteList);
|
w = arrpop(_guiDeleteList);
|
||||||
guiDeleteListItem(w);
|
guiDeleteListItem(w);
|
||||||
|
@ -261,12 +259,17 @@ static void guiDeleteList(void) {
|
||||||
|
|
||||||
static void guiDeleteListItem(WidgetT **widget) {
|
static void guiDeleteListItem(WidgetT **widget) {
|
||||||
WidgetT *w = *widget;
|
WidgetT *w = *widget;
|
||||||
size_t len = arrlenu(w->children);
|
size_t len = 0;
|
||||||
size_t plen = arrlen(w->parent != NULL ? w->parent->children : 0);
|
size_t plen = 0;
|
||||||
size_t x = 0;
|
size_t x = 0;
|
||||||
uint8_t nuke = 1;
|
uint8_t nuke = 1;
|
||||||
static uint16_t depth = 0;
|
static uint16_t depth = 0;
|
||||||
|
|
||||||
|
if (!w) return;
|
||||||
|
|
||||||
|
len = arrlenu(w->children);
|
||||||
|
plen = arrlen(w->parent != NULL ? w->parent->children : 0);
|
||||||
|
|
||||||
// Delete children.
|
// Delete children.
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
for (x=0; x<len; x++) {
|
for (x=0; x<len; x++) {
|
||||||
|
@ -329,6 +332,7 @@ void guiFocusSet(WidgetT *widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did the focus change?
|
// Did the focus change?
|
||||||
if (widget != _guiFocused) {
|
if (widget != _guiFocused) {
|
||||||
// Remove focus from current control.
|
// Remove focus from current control.
|
||||||
|
@ -424,8 +428,16 @@ static uint8_t guiMouseChildrenProcess(WidgetT *widget, MouseT *mouse) {
|
||||||
uint16_t sx;
|
uint16_t sx;
|
||||||
uint16_t sy;
|
uint16_t sy;
|
||||||
uint8_t event = MOUSE_EVENT_NONE;
|
uint8_t event = MOUSE_EVENT_NONE;
|
||||||
|
WidgetT *who = NULL;
|
||||||
static WidgetT *focusDown = NULL;
|
static WidgetT *focusDown = NULL;
|
||||||
|
|
||||||
|
// If one of our parents is hidden or disabled, skip all this.
|
||||||
|
who = widget;
|
||||||
|
while (who) {
|
||||||
|
if (GUI_GET_FLAG(widget, WIDGET_FLAG_DISABLED) || GUI_GET_FLAG(widget, WIDGET_FLAG_HIDDEN)) return 0;
|
||||||
|
who = who->parent;
|
||||||
|
}
|
||||||
|
|
||||||
// Get widget and screen coordinates of pointer.
|
// Get widget and screen coordinates of pointer.
|
||||||
guiWidgetPositionOnScreenGet(widget, &r);
|
guiWidgetPositionOnScreenGet(widget, &r);
|
||||||
sx = r.x;
|
sx = r.x;
|
||||||
|
@ -582,6 +594,11 @@ void guiParentAndChildrenDirtySet(WidgetT *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WidgetT *guiParentGet(WidgetT *widget) {
|
||||||
|
return widget->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void guiPendingEventAdd(WidgetT *widget, void *callback) {
|
void guiPendingEventAdd(WidgetT *widget, void *callback) {
|
||||||
PendingEventsT *p = NULL;
|
PendingEventsT *p = NULL;
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,7 @@ void guiMouseBusyPop();
|
||||||
void guiMouseBusyPush();
|
void guiMouseBusyPush();
|
||||||
void guiPaint(WidgetT *widget);
|
void guiPaint(WidgetT *widget);
|
||||||
void guiParentAndChildrenDirtySet(WidgetT *widget);
|
void guiParentAndChildrenDirtySet(WidgetT *widget);
|
||||||
|
WidgetT *guiParentGet(WidgetT *widget);
|
||||||
void guiPendingEventAdd(WidgetT *widget, void *callback);
|
void guiPendingEventAdd(WidgetT *widget, void *callback);
|
||||||
WidgetT *guiRootGet(void);
|
WidgetT *guiRootGet(void);
|
||||||
void guiShutdown(void);
|
void guiShutdown(void);
|
||||||
|
|
|
@ -39,6 +39,11 @@ static void pictureDel(WidgetT **widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *pictureFilenameGet(PictureT *picture) {
|
||||||
|
return picture->filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WidgetT *pictureInit(WidgetT *widget, char *filename) {
|
WidgetT *pictureInit(WidgetT *widget, char *filename) {
|
||||||
PictureT *l = (PictureT *)widget;
|
PictureT *l = (PictureT *)widget;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ typedef struct PictureS {
|
||||||
|
|
||||||
|
|
||||||
void pictureClickHandlerSet(PictureT *picture, widgetCallback callback);
|
void pictureClickHandlerSet(PictureT *picture, widgetCallback callback);
|
||||||
|
char *pictureFilenameGet(PictureT *picture);
|
||||||
WidgetT *pictureInit(WidgetT *widget, char *filename);
|
WidgetT *pictureInit(WidgetT *widget, char *filename);
|
||||||
PictureT *pictureNew(uint16_t x, uint16_t y, char *filename);
|
PictureT *pictureNew(uint16_t x, uint16_t y, char *filename);
|
||||||
void pictureReplace(PictureT *picture, char *filename);
|
void pictureReplace(PictureT *picture, char *filename);
|
||||||
|
|
Loading…
Add table
Reference in a new issue