Commit 99383d21 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

Add choices dialogue, don't set Draw$Options

Messages/Templates: Extra interactive help, new menu templates, new choices dialogue
DrawChoice.c/h: New source file to handle the choices dialogue, also added to Makefile.

Draw.c/h: Transfer ownership of initial_options to DrawChoice.c, bump up the default undo buffer to a lavish 8k. Delete setting & parsing of Draw$Options. Ensure read of choices happens after the default colours have been read from the icons of the blank paper, otherwise the choices can't override the default grid colour. Add a couple of const qualifiers to clarify where draw_current_options is written.
DrawMenu.c: Refactor draw_menu_makegridmenu() and draw_menu_setgridmenu() so they can handle multiple grid menus in existence, so the choices dialogue can share all the grid menu update code. Split out draw_menu_setgridunits() from the draw_menu_proc() handler for the same reason. No longer diff Draw$Options for changes. Delete some oddly duplicated code in draw_menu_entry_option().
DrawMenuD.h: Defines for the iconbar menu.
DrawFileIO.c/h: constify- draw_file_matches().

Version 1.41. Tagged as 'Draw-1_41'
parent 87d7f0c0
......@@ -91,26 +91,30 @@ OBJS =\
o.Draw o.DrawAction o.DrawCheck o.DrawDispl o.DrawDXF\
o.DrawEdit o.DrawEnter o.DrawFileIO o.DrawGrid o.DrawHelp\
o.DrawMenu o.DrawObject o.DrawPrint o.DrawScan o.DrawSelect\
o.DrawTextC o.DrawTrans o.DrawUndo o.bezierarc o.DrawClipb o.DrawDrag
o.DrawTextC o.DrawTrans o.DrawUndo o.bezierarc o.DrawClipb\
o.DrawDrag o.DrawChoice
OBJSZ =\
oz.Draw oz.DrawAction oz.DrawCheck oz.DrawDispl oz.DrawDXF\
oz.DrawEdit oz.DrawEnter oz.DrawFileIO oz.DrawGrid oz.DrawHelp\
oz.DrawMenu oz.DrawObject oz.DrawPrint oz.DrawScan oz.DrawSelect\
oz.DrawTextC oz.DrawTrans oz.DrawUndo oz.bezierarc oz.DrawClipb oz.DrawDrag
oz.DrawTextC oz.DrawTrans oz.DrawUndo oz.bezierarc oz.DrawClipb\
oz.DrawDrag oz.DrawChoice
OBJSD =\
od.Draw od.DrawAction od.DrawCheck od.DrawDispl\
od.DrawDXF od.DrawEdit od.DrawEnter od.DrawFileIO od.DrawGrid\
od.DrawHelp od.DrawMenu od.DrawObject od.DrawPrint od.DrawScan\
od.DrawSelect od.DrawTextC od.DrawTrans od.DrawUndo\
od.bezierarc od.ftrace od.guard od.flex od.DrawClipb od.DrawDrag
od.bezierarc od.ftrace od.guard od.flex od.DrawClipb\
od.DrawDrag od.DrawChoice
ASMS =\
s.Draw s.DrawAction s.DrawCheck s.DrawDispl s.DrawDXF\
s.DrawEdit s.DrawEnter s.DrawFileIO s.DrawGrid s.DrawHelp\
s.DrawMenu s.DrawObject s.DrawPrint s.DrawScan s.DrawSelect\
s.DrawTextC s.DrawTrans s.DrawUndo s.bezierarc s.DrawClipb s.DrawDrag
s.DrawTextC s.DrawTrans s.DrawUndo s.bezierarc s.DrawClipb\
s.DrawDrag s.DrawChoice
#
# Rule patterns
......
......@@ -2,7 +2,7 @@ BarIcon:!draw
Draw00:Draw
DrawCL:####Draw cannot load this
DrawG1: Lock
DrawM1:>Info,Quit
DrawM1:>Info,Choices...,Quit
DrawNR:####There is not enough memory to do this. Quit any unwanted applications or see the RISC OS User Guide for ways to maximise memory.
DrawQ1:1 drawing modified
DrawQ2:%d drawings modified
......@@ -21,6 +21,8 @@ DrawU:The undo mechanism has been asked to something nonsensical (line %d)
DrawCBE:There is nothing suitable on the clipboard
DrawY:Yes
DrawN:No
DrawGr:Rectangular,Isometric
DrawOr:Landscape,Portrait
Chk00:%s at location 16_%X
ChkB1:Bounding box coordinates are in the wrong order
ChkC1:Bad character in string
......@@ -113,6 +115,7 @@ FileF2:File cannot be loaded into Draw
FileI1:Incompatible format
FileN1:There is not enough memory to do this. Quit any unwanted applications or see the RISC OS User Guide for ways to maximise memory.
FileO1:Cannot open file
FileC1:Cannot save Draw choices
FileP1:Path name is too long
FileS1:Invalid sprite file
FileS2:No selected sprites
......@@ -137,6 +140,7 @@ MenuGr0:Grid spacing
MenuGr1:Subdivisions
MenuGD0:Grid
MenuGD1:Show F1,Lock F1,Auto adjust|Colour|Inch,cm,Inch (y only),cm (y only)|Rectangular,Isometric
MenuGD2:Show,Lock,Auto adjust|Colour|Inch,cm,Inch (y only),cm (y only)|Rectangular,Isometric
MenuGrI:1 4,1 16,1 5,1 10,Spacing,Subdivision
MenuGrC:1 2,1 10,Spacing,Subdivision
MenuGsI:Inch spacing
......@@ -163,8 +167,11 @@ MenuLW0:Line width
MenuLW1:Thin,0.25,0.5,1,2,4,(num)
MenuM0:Misc
MenuM1:>Info,>File,New view,Paper limits,>Print PRINT,Zoom lock ^L,Undo F8,Redo F9
MenuMo0:Mode
MenuMo1:Lines,Closed lines,Curves,Closed curves,Rectangles,Ellipses,Text,Select
MenuP0:Paper limits
MenuP1:Show,Reset|Portrait,Landscape|A0,A1,A2,A3,A4,A5
MenuP2:Show|Portrait,Landscape|A0,A1,A2,A3,A4,A5
MenuS0:Style
MenuS1:Line width,>Line colour,>Fill colour,Line pattern,Join,Start cap,End cap,Winding rule|Font name,Font size,Font height,>Text colour,>Background
MenuSN:(num)
......@@ -240,7 +247,8 @@ HelpT1:\Senter a text line.
HelpT2:Type to enter a text line.|m\Sstart a new text line.|mDouble-click \s (or press RETURN) to complete the text line.
HelpZ1:Drag zoom rectangle.
ICON0/D00:Move the pointer right for information about Draw.
ICON1:\Smake Draw go away.
ICON1:\Schange Draw's configuration.
ICON2:\Squit Draw.
D0:\Rcontrol miscellaneous features.
D1:\Rchoose what to save.
D2:\Rchange the style of objects.
......@@ -313,34 +321,34 @@ D51:\Sscale selected objects horizontally.|m\Rchange the scale factor.
D52:\Sscale selected objects vertically.|m\Rchange the scale factor.
D53:\Sscale the width of selected paths.|m\Rchange the scale factor.
D54:\Sscale selected objects horizontally, vertically and in width.|m\Rchange the scale factor.
D70:\Stoggle the presence of the grid.
D70/CHG0:\Stoggle the presence of the grid.
D71:Click \s (or press |!|KF1) to toggle whether objects are locked to the grid.
D72:\Stoggle whether extra grid points are added at high zoom factors.
D73:\Rchange the grid colour.
D74:\Rchange the grid density, horizontally and vertically (in inches).
D75:\Rchange the grid density, horizontally and vertically (in centimetres).
D76:\Rchange the grid density, vertically only (in inches).
D77:\Rchange the grid density, vertically only (in centimetres).
D78:\Sselect a rectangular grid.
D79:\Sselect a triangular (isometric) grid.
D740/D760:Click \s for an inch/quarter-inch grid.
D741/D761:Click \s for an inch/sixteenth-inch grid.
D742/D762:Click \s for an inch/fifth-of-an-inch grid.
D743/D763:Click \s for an inch/tenth-of-an-inch grid.
D744/D764:\Rchange the distance between major grid points.
D745/D765:Move the pointer to the right to change the number of minor grid points per major grid point.
D750/D770:Click \s for a centimetre/half-centimetre grid.
D751/D771:Click \s for a centimetre/millimetre grid.
D752/D772:\Rchange the distance between major grid points.
D753/D773:Move the pointer to the right to change the number of minor grid points per major grid point.
D7440/D7640:Type a number and \Schange the distance between major grid points (in inches).
D7520/D7720:Type a number and \Schange the distance between major grid points (in centimetres).
D7450/D7650/D7530/D7730:Type a number and \Schange the number of minor grid points per major grid point.
D020:\Stoggle the presence of visible paper limits.
D72/CHG2:\Stoggle whether extra grid points are added at high zoom factors.
D73/CHG3:\Rchange the grid colour.
D74/CHG4:\Rchange the grid density, horizontally and vertically (in inches).
D75/CHG5:\Rchange the grid density, horizontally and vertically (in centimetres).
D76/CHG6:\Rchange the grid density, vertically only (in inches).
D77/CHG7:\Rchange the grid density, vertically only (in centimetres).
D78/CHG8:\Sselect a rectangular grid.
D79/CHG9:\Sselect a triangular (isometric) grid.
D740/D760/CHG40/CHG60:Click \s for an inch/quarter-inch grid.
D741/D761/CHG41/CHG61:Click \s for an inch/sixteenth-inch grid.
D742/D762/CHG42/CHG62:Click \s for an inch/fifth-of-an-inch grid.
D743/D763/CHG43/CHG63:Click \s for an inch/tenth-of-an-inch grid.
D744/D764/CHG44/CHG64:\Rchange the distance between major grid points.
D745/D765/CHG45/CHG65:Move the pointer to the right to change the number of minor grid points per major grid point.
D750/D770/CHG50/CHG70:Click \s for a centimetre/half-centimetre grid.
D751/D771/CHG51/CHG71:Click \s for a centimetre/millimetre grid.
D752/D772/CHG52/CHG72:\Rchange the distance between major grid points.
D753/D773/CHG53/CHG73:Move the pointer to the right to change the number of minor grid points per major grid point.
D7440/D7640/CHG?40:Type a number and \Schange the distance between major grid points (in inches).
D7520/D7720/CHG?20:Type a number and \Schange the distance between major grid points (in centimetres).
D7450/D7650/D7530/D7730/CHG?50/CHG?30:Type a number and \Schange the number of minor grid points per major grid point.
D020/CHP0:\Stoggle the presence of visible paper limits.
D021:\Sreset the paper limits to the printer-driver defaults.
D022:Click \s for vertically-aligned paper.
D023:Click \s for horizontally-aligned paper.
D024/D025/D026/D027/D028/D029:\Schoose this size of paper.
D022/CHP1:Click \s for vertically-aligned paper.
D023/CHP2:Click \s for horizontally-aligned paper.
D024/D025/D026/D027/D028/D029/CHP?:\Schoose this size of paper.
D200/D201/D202/D203/D204/D205:\Schoose the width for paths (in points).
D206:Type a number and \Schoose it as the width for paths (in points).
D230/D231/D232/D233/D234:\Schoose the pattern for paths.
......@@ -366,8 +374,7 @@ D290/D291/D292/D293/D294:\Schoose the size (height and width) used for text line
D295:Type a number and \Schoose the size (height and width) used for text lines (in points).
D2a0/D2a1/D2a2/D2a3/D2a4:\Schoose the height used for text lines (in points).
D2a5:Type a number and \Schoose the height used for text lines (in points).
D730/D731/D732/D733/D734/D735/D736/D737:\Schoose the grid colour.
D738/D739/D73a/D73b/D73c/D73d/D73e/D73f:\Schoose the grid colour.
D73?/CHG3?:\Schoose the grid colour.
EDIT0:Click \s (or press ^F8) to change the current path element to a curve.
EDIT1:Click \s (or press ^F9) to change the current path element to a straight line.
EDIT2:\Sreplace the current path element by a move.
......@@ -383,11 +390,26 @@ LOAD:Fill in the name of a file and click \s on OK to add it into the drawing.|m
INFO:This \w displays information about Draw.
FINF:This \w shows information about this drawing.
SAVEAS:Either drag \s from the file icon to a directory display, or fill in the name of a file and click \s on OK, to save as a drawing.
MAGNIFIER: Either fill in the numerator and denominator, or click \s on the arrows, to use the given zoom factor.
MAGNIFIER/CHOY8/CHOY9:Either fill in the numerator and denominator, or click \s on the arrows, to use the given zoom factor.
CLOSE:\Sanswer the question.
QUIT:\Sanswer the question.
COORDS:Fill in new coordinates for the point, and click \s on OK.
PRINT:Fill in the number of times you want the drawing to be printed, and click \s on Print.
CHOYi:This shows if the toolbox will be shown.|M\Senable or disable this option.
CHOY0:\Ssave these changes.|M\Asave these changes and leave the window open.
CHOYg:\Sclose this \w without making any changes.|M\Arestore the current settings.
CHOYa/CHOY2/CHOY3:You can adjust how much memory is used for undo operations using either the keyboard or the arrows.
CHOY4:This shows the zoom lock state.|M\Senable or disable this option.
CHOY:This \w allows you to set the default state Draw starts up with.
CHM0:\Sstart in lines mode.
CHM1:\Sstart in closed lines mode.
CHM2:\Sstart in curves mode.
CHM3:\Sstart in closed curves mode.
CHM4:\Sstart in rectangles mode.
CHM5:\Sstart in ellipse mode.
CHM6:\Sstart in text tool mode.
CHM7:\Sstart in object selection mode.
CHG1:\Stoggle whether objects are locked to the grid.
#{DictTokens}
......
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "1.40"
Module_Version SETA 140
Module_MajorVersion SETS "1.41"
Module_Version SETA 141
Module_MinorVersion SETS ""
Module_Date SETS "06 Apr 2020"
Module_ApplicationDate SETS "06-Apr-20"
Module_Date SETS "25 Apr 2020"
Module_ApplicationDate SETS "25-Apr-20"
Module_ComponentName SETS "Draw"
Module_FullVersion SETS "1.40"
Module_HelpVersion SETS "1.40 (06 Apr 2020)"
Module_FullVersion SETS "1.41"
Module_HelpVersion SETS "1.41 (25 Apr 2020)"
END
/* (1.40)
/* (1.41)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 1.40
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Apr 2020
#define Module_MajorVersion_CMHG 1.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 25 Apr 2020
#define Module_MajorVersion "1.40"
#define Module_Version 140
#define Module_MajorVersion "1.41"
#define Module_Version 141
#define Module_MinorVersion ""
#define Module_Date "06 Apr 2020"
#define Module_Date "25 Apr 2020"
#define Module_ApplicationDate "06-Apr-20"
#define Module_ApplicationDate "25-Apr-20"
#define Module_ComponentName "Draw"
#define Module_FullVersion "1.40"
#define Module_HelpVersion "1.40 (06 Apr 2020)"
#define Module_LibraryVersionInfo "1:40"
#define Module_FullVersion "1.41"
#define Module_HelpVersion "1.41 (25 Apr 2020)"
#define Module_LibraryVersionInfo "1:41"
......@@ -88,6 +88,7 @@
#include "Draw.h"
#include "DrawAction.h"
#include "DrawChoice.h"
#include "DrawDispl.h"
#include "DrawDXF.h"
#include "DrawEdit.h"
......@@ -96,6 +97,7 @@
#include "DrawGrid.h"
#include "DrawHelp.h"
#include "DrawMenu.h"
#include "DrawMenuD.h"
#include "DrawObject.h"
#include "DrawPrint.h"
#include "DrawSelect.h"
......@@ -192,23 +194,11 @@ static struct
int yshift; /*Positive downwards*/
} blank_position;
static
draw_options
initial_options =
{ {Paper_A4, (paperoptions_typ) 0},
{1.0, 2, {0, 0, 0, 0, 1}},
{1, 1, 0},
TRUE,
{0, 1, 0, 0, 0, 0, 0, 0},
5000
};
draw_options draw_current_options;
/*The directory we started up from (<Draw$Dir> variable might not be the
right place because it is changed if another Draw starts up)*/
static char Draw_Dir [FILENAMEMAX];
#define MAX_OPTIONS 80
/*Raw bounding box, used in routines which form bounds*/
draw_bboxtyp draw_big_box = {INT_MAX, INT_MAX, INT_MIN, INT_MIN };
......@@ -2028,112 +2018,6 @@ static void draw_prequit (void)
}
}
/*Translate draw_current_options to string (in static space).*/
static char *write_options (void)
{ static char Buffer [MAX_OPTIONS + 1];
int len;
draw_options *opt = &draw_current_options;
draw_options *opt0 = &initial_options;
/*name equivalence to save typing.*/
ftracef0 ("write_options\n");
Buffer [0] = '\0';
if (memcmp (&opt->paper, &opt0->paper, sizeof opt->paper) != 0)
{ char P [32];
sprintf
( P,
"P%c%s%s ",
opt->paper.size == Paper_A0?
'0':
opt->paper.size == Paper_A1?
'1':
opt->paper.size == Paper_A2?
'2':
opt->paper.size == Paper_A3?
'3':
opt->paper.size == Paper_A5?
'5':
'4',
opt->paper.o & Paper_Landscape? "L": "",
opt->paper.o & Paper_Show? "S": ""
);
strcat (Buffer, P);
}
if (memcmp (&opt->grid, &opt0->grid, sizeof opt->grid) != 0)
{ char G [32];
sprintf
( G,
"G%.3fx%d%s%s%s%s%s ",
opt->grid.space,
opt->grid.divide,
opt->grid.o [0]? "I": "",
opt->grid.o [1]? "A": "",
opt->grid.o [2]? "S": "",
opt->grid.o [3]? "L": "",
opt->grid.o [4]? "C": ""
);
strcat (Buffer, G);
}
if (memcmp (&opt->zoom, &opt0->zoom, sizeof opt->zoom) != 0)
{ char Z [32];
sprintf
( Z,
"Z%d:%d%s ",
opt->zoom.mul,
opt->zoom.div,
opt->zoom.lock? "L": ""
);
strcat (Buffer, Z);
}
if (memcmp (&opt->toolbox, &opt0->toolbox, sizeof opt->toolbox) != 0)
{ char T [32];
sprintf (T, "T%c ", opt->toolbox? '+': '-' );
strcat (Buffer, T);
}
if (memcmp (&opt->mode, &opt0->mode, sizeof opt->mode) != 0)
{ char M [32];
sprintf
( M,
"M%c ",
opt->mode.line? 'L':
opt->mode.cline? 'l':
opt->mode.curve? 'C':
opt->mode.ccurve? 'c':
opt->mode.rect? 'R':
opt->mode.elli? 'E':
opt->mode.text? 'T':
opt->mode.select? 'S':
'l'
);
strcat (Buffer, M);
}
if (memcmp (&opt->undo_size, &opt0->undo_size, sizeof opt->undo_size) != 0)
{ char U [32];
sprintf (U, "U%d ", opt->undo_size);
strcat (Buffer, U);
}
if ((len = strlen (Buffer)) > 0)
/*Overwrite the last space with '\0' for neatness*/
Buffer [--len] = '\0';
else
/*No output*/
strcpy(Buffer, "\"\"");
return Buffer;
}
/**************************************************************************
* *
* Background message receiver: allow drops onto icon. *
......@@ -2257,13 +2141,9 @@ static void draw_bkg_events (wimp_eventstr *e, void *handle)
case wimp_SAVEDESK:
if (strlen (Draw_Dir) > 0) /*save if we know where we started*/
{ os_gbpbstr gbpb_str;
char lines [17 + MAX_OPTIONS + 1 + 4 + FILENAMEMAX + 1 + 1];
char lines [4 + FILENAMEMAX + 1 + 1];
sprintf
( lines,
"Set Draw$Options %s\nRun %s\n",
write_options (), Draw_Dir
);
sprintf (lines, "Run %s\n", Draw_Dir);
gbpb_str.action = 0x2,
gbpb_str.file_handle = msg->data.savedesk.filehandle,
......@@ -2313,150 +2193,18 @@ static void draw__iconmenuproc (void *handle, char *hit)
handle = handle; /*stupid compiler*/
switch (hit [0])
{ case 1:
{ case s_Iconbar_Info:
if (hit [1]) draw_menu_infoaboutprogram ();
break;
case 2:
if (draw_mayquit ()) exit (0);
case s_Iconbar_Choices:
draw_choice_display ();
break;
}
}
/*Read Draw$Options and parse it*/
/*Set booleans based on the presence of optional letters*/
static char *get_options (char *from, char *look, int *result, int max)
{ int i;
ftracef0 ("get_options\n");
for (i = 0; i < max; i++) result [i] = 0;
while (*from)
{ i = (int) (strchr (look, toupper (*from)) - look);
if (i < max) result [i] = 1;
from++;
}
return from;
}
static void read_options (void)
{ /*Now sets draw_current_options. Called only once, at startup. JRC*/
char buffer [MAX_OPTIONS + 1], *token, *options;
draw_options *opt = &draw_current_options;
/*Set defaults*/
*opt = initial_options;
ftracef0 ("read_options\n");
if ((options = getenv ("Draw$Options")) != NULL)
{ sprintf (buffer, "%.*s", MAX_OPTIONS, options);
/*Get tokens separated by spaces*/
for (token = strtok (buffer, " "); token != NULL;
token = strtok (NULL, " "))
{ /*Find token type*/
switch (toupper (token [0]))
{ case 'P': /*PnL?S?*/
{ BOOL options [2]; /*land, show*/
if (token [1])
{ switch (token [1])
{ case '0': opt->paper.size = Paper_A0; break;
case '1': opt->paper.size = Paper_A1; break;
case '2': opt->paper.size = Paper_A2; break;
case '3': opt->paper.size = Paper_A3; break;
case '5': opt->paper.size = Paper_A5; break;
default : opt->paper.size = Paper_A4; break;
}
token = get_options (&token [2], "LS", options, 2);
opt->paper.o = (paperoptions_typ) ((options [0]? Paper_Landscape: 0) |
(options [1]? Paper_Show: 0));
}
}
break;
case 'G': /*G(<a>x<b>)?I?A?S?L?C?*/
{ double space;
int subdiv;
char *rest = &token [1];
if (isdigit (*rest) &&
(space = strtod (rest, &rest)) != 0.0 &&
toupper (*rest++) == 'X' &&
(subdiv = (int) strtol (rest, &rest, 10)) != 0)
{ opt->grid.space = space;
opt->grid.divide = subdiv;
}
get_options (rest, "IASLC", opt->grid.o, 5);
}
break;
case 'Z': /*Z<a>:<b>L?*/
{ int mul, div;
char *rest;
mul = (int)strtol (token+1, &rest, 10);
if (rest != token && toupper (*rest) != ':') break;
div = (int)strtol (rest+1, &rest, 10);
if (rest == token) break;
if (toupper (*rest) == 'L') opt->zoom.lock = 1;
if (mul < 1) mul = 1;
else if (mul > MAXZOOMFACTOR) mul = MAXZOOMFACTOR;
if (div < 1) div = 1;
else if (div > MAXZOOMFACTOR) div = MAXZOOMFACTOR;
opt->zoom.mul = mul;
opt->zoom.div = div;
ftracef2 ("zoom options set to %d: %d\n",
opt->zoom.mul, opt->zoom.div);
}
break;
case 'T': /*T [+|-]*/
if (token [1] == '+') opt->toolbox = 1;
else if (token [1] == '-') opt->toolbox = 0;
ftracef1 ("toolbox is %s\n", opt->toolbox? "ON": "OFF");
break;
case 'M': /*M [L|l|C|c|R|E|T|S]*/
{ opt->mode.line = opt->mode.cline = opt->mode.curve =
opt->mode.ccurve = opt->mode.rect = opt->mode.elli =
opt->mode.text = opt->mode.select = 0;
switch (token [1])
{ case 'L': opt->mode.line = 1; break;
case 'l': opt->mode.cline = 1; break;
case 'C': opt->mode.curve = 1; break;
case 'c': opt->mode.ccurve = 1; break;
case 'R': case 'r': opt->mode.rect = 1; break;
case 'E': case 'e': opt->mode.elli = 1; break;
case 'T': case 't': opt->mode.text = 1; break;
case 'S': case 's': opt->mode.select = 1; break;
default: opt->mode = initial_options.mode;
}
}
break;
case 'U': /*U<size>*/
{ int size = (int) strtol (token + 1, (char **) NULL, 10);
/*Use either given size rounded to a multiple of 4 or default*/
opt->undo_size = size <= 0? initial_options.undo_size: size & ~3;
}
break;
}
}
case s_Iconbar_Quit:
if (draw_mayquit ()) exit (0);
break;
}
ftracef2 ("zoom options set to %d: %d\n",
opt->zoom.mul, opt->zoom.div);
}
static int get_icon_colour (int index)
......@@ -2621,9 +2369,6 @@ int main (int argc, char **argv)
set_sprite_area ("NumPoint");
set_sprite_area ("DXFloader");
os_read_var_val ("Draw$Dir", Draw_Dir, FILENAMEMAX);
read_options (); /*Sets draw_current_options.*/
t = template_find ("paper");
assert (t->window.nicons <= 10);
memcpy (&blank_view.paper, &t->window,
......@@ -2642,7 +2387,6 @@ int main (int argc, char **argv)
draw_colours.anchorpt = get_icon_colour (1);
draw_colours.bezierpt = get_icon_colour (2);
draw_colours.highlight = get_icon_colour (3);
draw_colours.grid = get_icon_colour (4);
draw_colours.bbox = get_icon_colour (5);
draw_colours.printmargin = get_icon_colour (6);
......@@ -2656,6 +2400,9 @@ int main (int argc, char **argv)
blank_position.paney0 = blank_pane.pane.box.y0;
blank_position.paney1 = blank_pane.pane.box.y1;
os_read_var_val ("Draw$Dir", Draw_Dir, FILENAMEMAX);
draw_choice_read (); /*Sets draw_current_options.*/
/*Claim some memory for the selection group, so that it is possible
to enter select mode and delete items even when RAM is full*/
if (!draw_select_alloc ())
......@@ -3028,12 +2775,10 @@ static os_error *draw_createblank (int size, diagrec **diagp,
{ draw_objptr hdrptr;
diagrec *diag;
draw_options *opt = &draw_current_options;
const draw_options *opt = &draw_current_options;
ftracef1 ("draw_createblank: grab_selection: %c\n",
grab_selection? 'T': 'F');
/*options opt;
read_options (&opt); Now done at startup. JRC.*/
ftracef2 ("draw_selection->owner 0x%X, "
"draw_selection->owner->paper 0x%X\n",
......@@ -3201,16 +2946,6 @@ void draw_modified (diagrec *diag)
draw_modified_no_undo (diag);
}
/* Write to Draw$Options */
void draw_set_dollar_options (void)
{ char *value;
value = write_options ();
os_swix5 (OS_SetVarVal, "Draw$Options", value,
strlen (value), 0, VarType_String);
}
/*Create (but don't display) a view window (plus its pane),*/