mirror of
https://github.com/sheumann/DiskBrowser.git
synced 2024-11-18 17:12:32 +00:00
Cut/copy/paste support and small tweaks to controls.
This commit is contained in:
parent
5a7e0de0d1
commit
f862c2bef8
@ -8,6 +8,7 @@
|
|||||||
#include <misctool.h>
|
#include <misctool.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <control.h>
|
#include <control.h>
|
||||||
|
#include <lineedit.h>
|
||||||
#include <desk.h>
|
#include <desk.h>
|
||||||
#include <gsos.h>
|
#include <gsos.h>
|
||||||
#include <orca.h>
|
#include <orca.h>
|
||||||
@ -21,6 +22,19 @@ char finderRequestName[] = "\pApple~Finder~";
|
|||||||
|
|
||||||
#define winDiskBrowser 1001
|
#define winDiskBrowser 1001
|
||||||
|
|
||||||
|
#define searchLine 1002
|
||||||
|
#define searchButton 1003
|
||||||
|
#define findDisksForText 1004
|
||||||
|
#define forIIGSRadio 1005
|
||||||
|
#define forAnyAppleIIRadio 1006
|
||||||
|
#define disksList 1007
|
||||||
|
#define previousPageButton 1008
|
||||||
|
#define pageText 1009
|
||||||
|
#define pageNumberLine 1010
|
||||||
|
#define ofPagesText 1011
|
||||||
|
#define nextPageButton 1012
|
||||||
|
#define mountDiskButton 1013
|
||||||
|
|
||||||
Word resourceFileID;
|
Word resourceFileID;
|
||||||
|
|
||||||
/* ID of our menu item in the Finder (or 0 if we're not active) */
|
/* ID of our menu item in the Finder (or 0 if we're not active) */
|
||||||
@ -88,11 +102,66 @@ void CloseBrowserWindow(void) {
|
|||||||
}
|
}
|
||||||
#pragma databank 0
|
#pragma databank 0
|
||||||
|
|
||||||
|
boolean DoLEEdit (int editAction) {
|
||||||
|
CtlRecHndl ctl; /* target control handle */
|
||||||
|
unsigned long id; /* control ID */
|
||||||
|
GrafPortPtr port; /* caller's GrafPort */
|
||||||
|
|
||||||
|
port = GetPort();
|
||||||
|
SetPort(window);
|
||||||
|
ctl = FindTargetCtl();
|
||||||
|
id = GetCtlID(ctl);
|
||||||
|
if ((id == searchLine) || (id == pageNumberLine)) {
|
||||||
|
LEFromScrap();
|
||||||
|
switch (editAction) {
|
||||||
|
case cutAction:
|
||||||
|
LECut((LERecHndl) GetCtlTitle(ctl));
|
||||||
|
LEToScrap();
|
||||||
|
break;
|
||||||
|
case copyAction:
|
||||||
|
LECopy((LERecHndl) GetCtlTitle(ctl));
|
||||||
|
LEToScrap();
|
||||||
|
break;
|
||||||
|
case pasteAction:
|
||||||
|
LEPaste((LERecHndl) GetCtlTitle(ctl));
|
||||||
|
break;
|
||||||
|
case clearAction:
|
||||||
|
LEDelete((LERecHndl) GetCtlTitle(ctl));
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
SetPort(port);
|
||||||
|
return ((id == searchLine) || (id == pageNumberLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle an event after TaskMasterDA processing */
|
||||||
|
void HandleEvent(int eventCode, WmTaskRec *taskRec) {
|
||||||
|
switch (eventCode) {
|
||||||
|
case keyDownEvt:
|
||||||
|
case autoKeyEvt:
|
||||||
|
/* Handle keyboard shortcuts for cut/copy/paste */
|
||||||
|
if (taskRec->modifiers & appleKey) {
|
||||||
|
switch (taskRec->message & 0x000000FF) {
|
||||||
|
case 'x': case 'X':
|
||||||
|
DoLEEdit(cutAction);
|
||||||
|
break;
|
||||||
|
case 'c': case 'C':
|
||||||
|
DoLEEdit(copyAction);
|
||||||
|
break;
|
||||||
|
case 'v': case 'V':
|
||||||
|
DoLEEdit(pasteAction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* NDA-style action routine for our window */
|
/* NDA-style action routine for our window */
|
||||||
#pragma databank 1
|
#pragma databank 1
|
||||||
int ActionProc(EventRecord *eventRec, int actionCode) {
|
int ActionProc(EventRecord *eventRec, int actionCode) {
|
||||||
static WmTaskRec taskRec;
|
static WmTaskRec taskRec;
|
||||||
int handledEvent = 0;
|
int handledAction = 0;
|
||||||
|
|
||||||
switch (actionCode) {
|
switch (actionCode) {
|
||||||
case eventAction:
|
case eventAction:
|
||||||
@ -101,23 +170,23 @@ int ActionProc(EventRecord *eventRec, int actionCode) {
|
|||||||
memmove(&taskRec, eventRec, 16);
|
memmove(&taskRec, eventRec, 16);
|
||||||
taskRec.wmTaskMask = 0x1F7FFF; /* everything except tmInfo */
|
taskRec.wmTaskMask = 0x1F7FFF; /* everything except tmInfo */
|
||||||
|
|
||||||
TaskMasterDA(0, &taskRec);
|
HandleEvent(TaskMasterDA(0, &taskRec), &taskRec);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cursorAction:
|
case cursorAction:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cutAction: // TODO
|
case cutAction:
|
||||||
break;
|
|
||||||
case copyAction:
|
case copyAction:
|
||||||
break;
|
|
||||||
case pasteAction:
|
case pasteAction:
|
||||||
break;
|
|
||||||
case clearAction:
|
case clearAction:
|
||||||
|
if (windowOpened) {
|
||||||
|
handledAction = DoLEEdit(actionCode);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handledEvent;
|
return handledAction;
|
||||||
}
|
}
|
||||||
#pragma databank 0
|
#pragma databank 0
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ resource rControlTemplate (previousPageButton) {
|
|||||||
{150, 10, 161, 34},
|
{150, 10, 161, 34},
|
||||||
SimpleButtonControl {{
|
SimpleButtonControl {{
|
||||||
0,
|
0,
|
||||||
$3000+RefIsResource,
|
$1000+RefIsResource,
|
||||||
0,
|
0,
|
||||||
previousPageButton,
|
previousPageButton,
|
||||||
0, /* color table ref */
|
0, /* color table ref */
|
||||||
@ -176,12 +176,12 @@ resource rControlTemplate (pageNumberLine) {
|
|||||||
0,
|
0,
|
||||||
$7000+RefIsResource,
|
$7000+RefIsResource,
|
||||||
0,
|
0,
|
||||||
255, /* max size */
|
4, /* max size */
|
||||||
pageNumberLine /* text ref */
|
pageNumberLine /* text ref */
|
||||||
}};
|
}};
|
||||||
};
|
};
|
||||||
|
|
||||||
resource rPString (pageNumberLine) { "1000" };
|
resource rPString (pageNumberLine) { "" };
|
||||||
|
|
||||||
resource rControlTemplate (ofPagesText) {
|
resource rControlTemplate (ofPagesText) {
|
||||||
ofPagesText, /* control ID */
|
ofPagesText, /* control ID */
|
||||||
@ -195,7 +195,7 @@ resource rControlTemplate (ofPagesText) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resource rTextForLETextBox2 (ofPagesText) {
|
resource rTextForLETextBox2 (ofPagesText) {
|
||||||
"/ 1000"
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
resource rControlTemplate (nextPageButton) {
|
resource rControlTemplate (nextPageButton) {
|
||||||
@ -203,7 +203,7 @@ resource rControlTemplate (nextPageButton) {
|
|||||||
{150, 168, 161, 192},
|
{150, 168, 161, 192},
|
||||||
SimpleButtonControl {{
|
SimpleButtonControl {{
|
||||||
0,
|
0,
|
||||||
$3000+RefIsResource,
|
$1000+RefIsResource,
|
||||||
0,
|
0,
|
||||||
nextPageButton,
|
nextPageButton,
|
||||||
0, /* color table ref */
|
0, /* color table ref */
|
||||||
@ -217,8 +217,8 @@ resource rControlTemplate (mountDiskButton) {
|
|||||||
mountDiskButton,
|
mountDiskButton,
|
||||||
{152, 305, 0, 0},
|
{152, 305, 0, 0},
|
||||||
SimpleButtonControl {{
|
SimpleButtonControl {{
|
||||||
DefaultButton,
|
0,
|
||||||
$3000+RefIsResource,
|
$1000+RefIsResource,
|
||||||
0,
|
0,
|
||||||
mountDiskButton,
|
mountDiskButton,
|
||||||
0, /* color table ref */
|
0, /* color table ref */
|
||||||
|
Loading…
Reference in New Issue
Block a user