Commit 048389da authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Minor template fixup

In the quit dialogue the button wasn't regimental 52 OS units high so looked a little odd.
This commit is mostly to get a new version number to match the redraw fix in RISC_OSLib-5_78.
Removed duplicates 'tbash' and 'txtbug', see Test directory for the originals.

Version 1.69. Tagged as 'Edit-1_69'
parent 53a5cf91
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.68"
Module_Version SETA 168
Module_MajorVersion SETS "1.69"
Module_Version SETA 169
Module_MinorVersion SETS ""
Module_Date SETS "25 Sep 2012"
Module_ApplicationDate SETS "25-Sep-12"
Module_Date SETS "24 Oct 2013"
Module_ApplicationDate SETS "24-Oct-13"
Module_ComponentName SETS "Edit"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Edit"
Module_FullVersion SETS "1.68"
Module_HelpVersion SETS "1.68 (25 Sep 2012)"
Module_FullVersion SETS "1.69"
Module_HelpVersion SETS "1.69 (24 Oct 2013)"
END
/* (1.68)
/* (1.69)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.68
#define Module_MajorVersion_CMHG 1.69
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 25 Sep 2012
#define Module_Date_CMHG 24 Oct 2013
#define Module_MajorVersion "1.68"
#define Module_Version 168
#define Module_MajorVersion "1.69"
#define Module_Version 169
#define Module_MinorVersion ""
#define Module_Date "25 Sep 2012"
#define Module_Date "24 Oct 2013"
#define Module_ApplicationDate "25-Sep-12"
#define Module_ApplicationDate "24-Oct-13"
#define Module_ComponentName "Edit"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Edit"
#define Module_FullVersion "1.68"
#define Module_HelpVersion "1.68 (25 Sep 2012)"
#define Module_LibraryVersionInfo "1:68"
#define Module_FullVersion "1.69"
#define Module_HelpVersion "1.69 (24 Oct 2013)"
#define Module_LibraryVersionInfo "1:69"
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* ->c.tbash */
/*
Purpose: Driving test program for Texts, Texts1 modules
Author: WRS
Status: under development
History:
22 July 87 -- started
9 February 88 -- converted to C.
*/
#define BOOL int
#define TRUE 1
#define FALSE 0
#include <stdio.h>
#include <arthur.h>
#include "txt.h"
#include "txtundo.h"
#include "txt1.h"
#include "bbc.h"
/* -------- Printing the text buffer. -------- */
int tbash_readint()
{
int c, sign, result;
while ((c = get()) == ' ' || c == '\n' || c == '\t');
sign = 1;
if (c == '+' || c == '-')
{
sign = (c =='+') ? 1 : -1;
c = get();
}
for (result = 0; c >= '0' && c <= '9'; c = get())
result = 10 * result + c - '0';
result = result * sign;
return result;
}
void tbash_safewrch(c)
char c;
{
if (c >= 32 && c < 127)
printf("%c", c);
else if (c == 0)
printf(".");
else if (c == '\n')
printf("~");
else
printf("?");
}
void tbash_tab(by)
unsigned by;
{
unsigned i;
for (i = 0; i < by; ++i)
printf(" ");
}
void tbash_prmarkerchain(t, m)
txt1_str *t;
txt1_imarker *m;
{
if (m == NULL)
printf(" -> NIL\n");
else
{
printf(" -> ");
if (m == &t->selstart)
printf("sS:");
else if (m == &t->selend)
printf("sE:");
else if (m == &t->w->firstvis)
printf("fV:");
else if (m == &t->w->lastvis)
printf("lV:");
printf("%i", m->pos);
tbash_prmarkerchain(t, m->next);
}
}
void tbash_pr(t)
txt1_str *t;
{
unsigned i;
if (t->top > 200)
printf(">>>>top=%d start=%d gStart=%d gEnd=%d\n",
t->top, t->txtstart, t->gapstart, t->gapend);
else
{
/* zap the gap characters to make things clearer */
if (t->gapend > t->gapstart)
for (i = t->gapstart; i < t->gapend; ++i) t->inbuf[i] = '*';
else if (t->gapend < t->gapstart)
{
for (i = t->gapstart; i <= t->top; ++i) t->inbuf[i] = '*';
for (i = 0; i < t->gapend; ++i) t->inbuf[i] = '*';
}
printf(" [");
for (i = 0; i <= t->top; ++i) tbash_safewrch(t->inbuf[i]);
printf("]\n");
tbash_tab(t->txtstart+1); printf("Start^\n");
tbash_tab(t->gapstart); printf("gStart^\n");
tbash_tab(t->gapend+2); printf("gEnd^\n");
/* Prettyprint markers. */
printf("Marks Before:");
tbash_prmarkerchain(t, t->marksbefore);
printf("Marks After:");
tbash_prmarkerchain(t, t->marksafter);
}
}
/* -------- Input. -------- */
int i;
void tbash_readline(a)
char *a;
{
printf(">\n");
fgets(a, 80, stdin);
printf("Read in:[");
i = 0;
while (a[i] != 0)
tbash_safewrch(a[i++]);
printf("]\n");
}
/* -------- Simple Basher -------- */
/* just does repeated random inserts, deletes, moves. */
unsigned bid;
/* Bash iteration id, to allow me to find cases again. */
void tbash(t, l1, l2)
txt t;
unsigned l1, l2;
{
unsigned i, j, k;
char ch;
int mv;
unsigned de;
unsigned in;
char a[250];
for (i = 1; i <= l1; ++i)
{
for (j = 1; j <= l2; ++j)
{
printf("%d:", bid);
++bid;
switch (rnd(4))
{
case 1:
mv = rnd(50) - 25;
printf("move %d\n", mv);
txt_movedot(t, mv);
case 2:
de = rnd(26) - 1;
printf("delete %d\n", de);
txt_delete(t, de);
case 3:
in = rnd(26) - 1;
printf("insert %d\n", in);
ch = 'a' + rnd(26) - 1;
for (k = 0; k < in; ++k)
a[k] = ch;
txt_replacechars(t, 0, &a[0], in);
case 4:
printf("insert newline\n");
txt_insertchar(t, '\n');
}
}
tbash_pr(t);
}
}
/* -------- Driving program. -------- */
/*
(extension/cycling of buffer?)
(set, moveto, clear marker?)
(add in display of these things, perhaps full-screen mode.)
*/
txt t;
char *a;
char ch, cmd;
int in;
void tbash_main()
{
printf("Texts Test Program, WRS, 4th August 87.\n");
t = txt_new("TT");
txt_show(t);
/* Texts.SetOAction(t, Texts.Cycle); */ /* comment this out to test extension */
bid = 0;
while (1)
{
tbash_pr(t);
while ((cmd = get()) == ' ' || cmd == 10 || cmd == 13);
switch (cmd)
{
case '?':
case 'h':
case 'H':
printf("Commands are Q(uit), M(ove)<dist>, D(elete)<no>,\n");
printf(" I(nsert)<string>, B(ash)<times>, N(ewline),\n");
printf(" (se)L(ect from here to) <num>,\n");
break;
case 'q':
case 'Q':
printf("Bye.\n");
return;
case 'm':
case 'M':
txt_movedot(t, tbash_readint());
break;
case 'd':
case 'D':
txt_delete(t, tbash_readint());
break;
case 'i':
case 'I':
a = gets(a);
i = 0;
while (a[i] != 0) ++i;
txt_replacechars(t, 0, a, i);
break;
case 'n':
case 'N':
txt_insertchar(t, '\n');
break;
case 'l':
case 'L':
in = get();
if (in > 0)
txt_setselect(t, txt_dot(t), txt_dot(t) + in);
else
{
in = txt_dot(t) + in;
if (in < 0) in = 0;
txt_setselect(t, in, txt_dot(t));
}
break;
case 'b':
case 'B':
tbash(t, tbash_readint(), 1);
printf("----Bash done.\n");
break;
default:
printf("Command not recognised: type '?' for command list.\n");
}
}
}
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
suck on this then Villhelm, compile it, run it see where the caret is,
then resize the box a liitle bigger in both dimensions and watch the POOH.
(to run:)
(sit inside source !Edit directory)
*cc -c txtbug -zM -I<C$CLib> -I<C$RISC_OSLib>
*link -o !RunImage o.txtbug,$.risc_oslib.rstubs
*set amu$dir <edit$dir>
(now run by clicking on !Run)
*/
#include "wimpt.h"
#include "res.h"
#include "resspr.h"
#include "template.h"
#include "dbox.h"
#include "txt.h"
#include "flex.h"
#include "msgs.h"
int main(void)
{
txt thetxt;
wimpt_init("Amu"); /* Main Wimp initialisation */
res_init("Amu"); /* Resources */
resspr_init(); /* Application sprites */
template_init(); /* Templates */
dbox_init(); /* Dialogue boxes */
flex_init();
msgs_init();
thetxt = txt_new("AMU output");
txt_show(thetxt);
txt_insertstring(thetxt,"hello there\n");
txt_movedot(thetxt,strlen("hello there\n"));
txt_insertstring(thetxt,"hello there world\n");
txt_movedot(thetxt,strlen("hello there world\n"));
txt_insertstring(thetxt,"Hello there\n");
txt_movedot(thetxt,strlen("Hello there\n"));
while (TRUE) event_process();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment