mirror of
https://github.com/sheumann/DiskBrowser.git
synced 2024-11-21 22:31:13 +00:00
More event processing and tweaks to controls.
This commit is contained in:
parent
f862c2bef8
commit
44d02d36e1
@ -9,6 +9,7 @@
|
||||
#include <memory.h>
|
||||
#include <control.h>
|
||||
#include <lineedit.h>
|
||||
#include <list.h>
|
||||
#include <desk.h>
|
||||
#include <gsos.h>
|
||||
#include <orca.h>
|
||||
@ -46,6 +47,18 @@ GrafPortPtr window;
|
||||
|
||||
Boolean resourceFileOpened, windowOpened;
|
||||
|
||||
/* User preference */
|
||||
boolean gsDisksOnly = true;
|
||||
|
||||
#define DISK_LIST_LENGTH 10
|
||||
|
||||
struct diskListEntry {
|
||||
char *memPtr;
|
||||
Byte memFlag;
|
||||
};
|
||||
|
||||
struct diskListEntry diskList[DISK_LIST_LENGTH];
|
||||
|
||||
/* Record about our system window, to support processing by Desk Manager. */
|
||||
/* See Prog. Ref. for System 6.0, page 20. */
|
||||
static NDASysWindRecord sysWindRecord;
|
||||
@ -93,6 +106,9 @@ void CloseBrowserWindow(void) {
|
||||
CloseWindow(window);
|
||||
windowOpened = false;
|
||||
window = NULL;
|
||||
|
||||
/* reset state */
|
||||
gsDisksOnly = true;
|
||||
}
|
||||
|
||||
if (resourceFileOpened && !windowOpened) {
|
||||
@ -134,9 +150,46 @@ boolean DoLEEdit (int editAction) {
|
||||
return ((id == searchLine) || (id == pageNumberLine));
|
||||
}
|
||||
|
||||
/* Do a search */
|
||||
void DoSearch(void) {
|
||||
for (int i = 0; i < DISK_LIST_LENGTH; i++) {
|
||||
diskList[i].memPtr = "This is the title of some disk you could mount";
|
||||
diskList[i].memFlag = 0;
|
||||
}
|
||||
|
||||
NewList2(NULL, 1, (Ref) diskList, refIsPointer,
|
||||
DISK_LIST_LENGTH, (Handle) GetCtlHandleFromID(window, disksList));
|
||||
}
|
||||
|
||||
/* Handle an event after TaskMasterDA processing */
|
||||
void HandleEvent(int eventCode, WmTaskRec *taskRec) {
|
||||
switch (eventCode) {
|
||||
case wInControl:
|
||||
switch (taskRec->wmTaskData4) {
|
||||
case searchButton:
|
||||
DoSearch();
|
||||
break;
|
||||
|
||||
case forIIGSRadio:
|
||||
gsDisksOnly = true;
|
||||
break;
|
||||
case forAnyAppleIIRadio:
|
||||
gsDisksOnly = false;
|
||||
break;
|
||||
|
||||
case previousPageButton:
|
||||
//TODO
|
||||
break;
|
||||
case nextPageButton:
|
||||
//TODO
|
||||
break;
|
||||
|
||||
case mountDiskButton:
|
||||
// TODO
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case keyDownEvt:
|
||||
case autoKeyEvt:
|
||||
/* Handle keyboard shortcuts for cut/copy/paste */
|
||||
|
@ -35,18 +35,18 @@ resource rWindParam1 (winDiskBrowser) {
|
||||
};
|
||||
|
||||
resource rControlList (winDiskBrowser) {{
|
||||
searchLine,
|
||||
searchButton,
|
||||
findDisksForText,
|
||||
forIIGSRadio,
|
||||
forAnyAppleIIRadio,
|
||||
disksList,
|
||||
mountDiskButton,
|
||||
previousPageButton,
|
||||
pageText,
|
||||
pageNumberLine,
|
||||
ofPagesText,
|
||||
nextPageButton,
|
||||
mountDiskButton
|
||||
disksList,
|
||||
findDisksForText,
|
||||
forIIGSRadio,
|
||||
forAnyAppleIIRadio,
|
||||
searchLine,
|
||||
searchButton
|
||||
}};
|
||||
|
||||
resource rControlTemplate (searchLine) {
|
||||
@ -126,7 +126,7 @@ resource rControlTemplate (disksList) {
|
||||
{45, 10, 147, 410}, /* control rect */
|
||||
ListControl {{
|
||||
$0007, /* flags */
|
||||
$1400, /* more flags */
|
||||
$7400, /* more flags */
|
||||
0, /* refcon */
|
||||
0, /* list size */
|
||||
10, /* List View */
|
||||
@ -195,7 +195,7 @@ resource rControlTemplate (ofPagesText) {
|
||||
};
|
||||
|
||||
resource rTextForLETextBox2 (ofPagesText) {
|
||||
""
|
||||
" "
|
||||
};
|
||||
|
||||
resource rControlTemplate (nextPageButton) {
|
||||
|
Loading…
Reference in New Issue
Block a user