more tweaks (savepoint)
This commit is contained in:
parent
8f10956bae
commit
f2a63e2235
|
@ -109,7 +109,7 @@ Boolean gBabbo = false;
|
|||
//UInt16 gNumCols = 3;
|
||||
//UInt16 gNumRows = 11;
|
||||
//MemHandle gHandles[11][3];
|
||||
Int16 gTopVisibleRecord = -1;
|
||||
Int16 firstRecordIndex = -1;
|
||||
Boolean scanRecordsSelected[12];
|
||||
Int16 eventEnteredRow = -1;
|
||||
|
||||
|
@ -506,6 +506,7 @@ static Boolean MainFormHandleEvent(EventPtr event)
|
|||
break;
|
||||
|
||||
case penMoveEvent:
|
||||
if (eventEnteredRow >= 0) {
|
||||
table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
|
||||
if (TableHitTest(table, event->screenX, event->screenY)) {
|
||||
|
||||
|
@ -520,6 +521,7 @@ static Boolean MainFormHandleEvent(EventPtr event)
|
|||
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case penUpEvent:
|
||||
|
@ -538,6 +540,7 @@ static Boolean MainFormHandleEvent(EventPtr event)
|
|||
|
||||
handled = true;
|
||||
}
|
||||
eventEnteredRow = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -547,9 +550,9 @@ static Boolean MainFormHandleEvent(EventPtr event)
|
|||
|
||||
case sclRepeatEvent:
|
||||
if (event->data.sclRepeat.newValue > event->data.sclRepeat.value)
|
||||
gTopVisibleRecord += (event->data.sclRepeat.newValue - event->data.sclRepeat.value);
|
||||
firstRecordIndex += (event->data.sclRepeat.newValue - event->data.sclRepeat.value);
|
||||
else {
|
||||
gTopVisibleRecord -= (event->data.sclRepeat.value - event->data.sclRepeat.newValue);
|
||||
firstRecordIndex -= (event->data.sclRepeat.value - event->data.sclRepeat.newValue);
|
||||
}
|
||||
|
||||
table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
|
||||
|
@ -721,20 +724,18 @@ static Boolean MainFormDoCommand(UInt16 command)
|
|||
FormPtr form;
|
||||
TablePtr table;
|
||||
DmOpenRef db;
|
||||
UInt16 row, offset, records;
|
||||
UInt16 row, offset, records, selected;
|
||||
Int16 rowIndex;
|
||||
Boolean selected;
|
||||
|
||||
handled = false;
|
||||
|
||||
switch (command) {
|
||||
|
||||
case MainEditDeleteSelected:
|
||||
selected = false;
|
||||
selected = 0;
|
||||
for (row = 0; row < 12; row++) {
|
||||
if (scanRecordsSelected[row]) {
|
||||
selected = true;
|
||||
break;
|
||||
selected++;
|
||||
}
|
||||
}
|
||||
if (selected) {
|
||||
|
@ -750,6 +751,9 @@ static Boolean MainFormDoCommand(UInt16 command)
|
|||
}
|
||||
}
|
||||
DmCloseDatabase(db);
|
||||
if (firstRecordIndex > 0) {
|
||||
firstRecordIndex -= selected;
|
||||
}
|
||||
MainFormLoadTable(table, true);
|
||||
ClearScanRecordSelection();
|
||||
TblRedrawTable(table);
|
||||
|
@ -960,15 +964,19 @@ static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
|
|||
ScrollBarPtr scroll;
|
||||
|
||||
db = OpenScanDatabase();
|
||||
records = DmNumRecords(db);
|
||||
|
||||
if (gTopVisibleRecord < 0) {
|
||||
gTopVisibleRecord = (records > 12) ? (records - 12) : 0;
|
||||
records = DmNumRecords(db);
|
||||
if (records) {
|
||||
if (firstRecordIndex < 0) {
|
||||
firstRecordIndex = (records > 12) ? (records - 12) : 0;
|
||||
}
|
||||
} else {
|
||||
firstRecordIndex = -1;
|
||||
}
|
||||
|
||||
rows = (records < 12) ? records : 12;
|
||||
for (row = 0; row < rows; row++) {
|
||||
recordIndex = gTopVisibleRecord + row;
|
||||
recordIndex = firstRecordIndex + row;
|
||||
recordH = DmGetRecord(db, recordIndex);
|
||||
recordP = MemHandleLock(recordH);
|
||||
|
||||
|
@ -999,7 +1007,7 @@ static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
|
|||
if (records <= 12) {
|
||||
SclSetScrollBar(scroll, 0, 0, 0, 0);
|
||||
} else {
|
||||
SclSetScrollBar(scroll, gTopVisibleRecord, 0, records - 12, 11);
|
||||
SclSetScrollBar(scroll, firstRecordIndex, 0, records - 12, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1021,11 +1029,11 @@ static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
|
|||
|
||||
/* numRecords = DmNumRecords(db); */
|
||||
/* rows = (numRecords < 12) ? numRecords : 12; */
|
||||
/* if (gTopVisibleRecord < 0) */
|
||||
/* gTopVisibleRecord = (numRecords > 12) ? (numRecords - 12) : 0; */
|
||||
/* if (firstRecordIndex < 0) */
|
||||
/* firstRecordIndex = (numRecords > 12) ? (numRecords - 12) : 0; */
|
||||
|
||||
/* for (row = 0; row < rows; row++) { */
|
||||
/* rowId = gTopVisibleRecord + row; */
|
||||
/* rowId = firstRecordIndex + row; */
|
||||
/* recordH = DmGetRecord(db, rowId); */
|
||||
/* recordP = (MemPtr) MemHandleLock(recordH); */
|
||||
/* TblSetItemPtr(table, row, 0, &recordP->barcode); */
|
||||
|
@ -1054,7 +1062,7 @@ static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
|
|||
/* if (numRecords <= 12) { */
|
||||
/* SclSetScrollBar(scroll, 0, 0, 0, 0); */
|
||||
/* } else { */
|
||||
/* SclSetScrollBar(scroll, gTopVisibleRecord, 0, numRecords - 12, 11); */
|
||||
/* SclSetScrollBar(scroll, firstRecordIndex, 0, numRecords - 12, 11); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
@ -1346,7 +1354,6 @@ static void StoreScanData()
|
|||
MemHandle recordH;
|
||||
MemPtr recordP;
|
||||
TablePtr table;
|
||||
UInt16 row;
|
||||
|
||||
form = FrmGetFormPtr(MainForm);
|
||||
|
||||
|
@ -1369,12 +1376,7 @@ static void StoreScanData()
|
|||
DmCloseDatabase(db);
|
||||
|
||||
table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
|
||||
row = TblGetLastUsableRow(table);
|
||||
if (row == tblUnusableRow) {
|
||||
gTopVisibleRecord = 0;
|
||||
} else if (row == 11) {
|
||||
gTopVisibleRecord = TblGetRowID(table, 1);
|
||||
}
|
||||
firstRecordIndex = (recordIndex > 11) ? (recordIndex - 11) : 0;
|
||||
MainFormLoadTable(table, true);
|
||||
TblRedrawTable(table);
|
||||
|
||||
|
@ -1480,9 +1482,9 @@ static void StoreScanData()
|
|||
/* table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords)); */
|
||||
/* row = TblGetLastUsableRow(table); */
|
||||
/* if (row == tblUnusableRow) { */
|
||||
/* gTopVisibleRecord = 0; */
|
||||
/* firstRecordIndex = 0; */
|
||||
/* } else if (row == 11) { */
|
||||
/* gTopVisibleRecord = TblGetRowID(table, 1); */
|
||||
/* firstRecordIndex = TblGetRowID(table, 1); */
|
||||
/* } */
|
||||
/* MainFormLoadTable(table, true); */
|
||||
/* TblRedrawTable(table); */
|
||||
|
|
Loading…
Reference in a new issue