Commit 04aa7146 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Uncurl some braces.

Makes wood and trees easier to distinguish.
parent 4caa65b7
......@@ -833,7 +833,9 @@ void draw_action_changestate (diagrec *diag, draw_state newstate,
if (wimpt_complain (err))
{ draw_undo_prevent_undo (diag);
return;
} } }
}
}
}
else
{ ftracef0 ("Complete any path etc\n");
draw_enter_complete (diag);
......@@ -1277,7 +1279,9 @@ void draw_paper_close (viewrec *vuue)
wimpt_complain (os_cli (cli));
/*don't close if shift down!*/
if (shifted) return;
} } }
}
}
}
/*If only view on a modified diagram, give user a chance to save it*/
if (singlevuue && diag->misc->options.modified)
......@@ -1302,7 +1306,8 @@ void draw_paper_close (viewrec *vuue)
default:
break; /*cancel, do nothing, it stays updated.*/
} }
}
}
/*If singlevuue & modified, either reply was cancel OR yes & save failed
so don't delete diagram. If singlevuue & !modified, (includes reply
......@@ -1322,7 +1327,8 @@ void draw_paper_close (viewrec *vuue)
draw_enter_claim_nulls (diag, vuue->prevview);
else
draw_enter_claim_nulls (diag, vuue->nextview);
} }
}
}
/*Give away selection if this is the only vuue*/
if (draw_select_owns (diag) && singlevuue)
......@@ -1341,7 +1347,8 @@ void draw_paper_close (viewrec *vuue)
{ dispose_view (vuue); /*remove from view list, free memory*/
/*closes and deletes the window*/
draw_displ_redrawtitle (diag); /*Redraw other titles*/
} }
}
}
static void paper_but (wimp_mousestr *m, viewrec *vuue)
......@@ -1403,7 +1410,9 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
{ case state_sel:
draw_select_longselect (diag, vuue, &pt, shifted);
break;
} } }
}
}
}
else if (m->bbits & wimp_BCLICKLEFT) /*0x400 Short 'select'*/
{ if (control)
set_paper_limit (vuue, pt, TRUE);
......@@ -1430,7 +1439,9 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
case state_edit:
draw_edit_select (diag);
break;
} } }
}
}
}
else if (m->bbits & wimp_BRIGHT) /*0x001 Double 'adjust'*/
{ if (shifted)
{ draw_action_abandon (diag);
......@@ -1441,7 +1452,9 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
{ case state_edit:
draw_edit_doubleadjust (diag, &pt);
break;
} } }
}
}
}
else if (m->bbits & wimp_BDRAGRIGHT) /*0x010 Long 'adjust'*/
{ if (control)
{ /*Start printer limits drag (inner box)*/
......@@ -1464,7 +1477,8 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
case state_edit:
draw_edit_long_shift_adjust (diag, vuue, &pt);
break;
} }
}
}
else /*not shifted*/
{ switch (diag->misc->mainstate)
{ case state_sel:
......@@ -1475,7 +1489,9 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
case state_edit:
draw_edit_longadjust (diag, vuue, &pt);
break;
} } }
}
}
}
else if (m->bbits & wimp_BCLICKRIGHT) /*0x100 Short 'adjust'*/
{ if (control)
set_paper_limit (vuue, pt, FALSE);
......@@ -1495,14 +1511,17 @@ static void paper_but (wimp_mousestr *m, viewrec *vuue)
case state_edit:
draw_edit_adjust (diag, &pt);
break;
} }
}
}
else /*shifted*/
{ switch (diag->misc->mainstate)
{ case state_edit:
draw_edit_adjust (diag, &pt); /*Do the same for shift-adjust as
for adjust in edit mode. JRC 6 Feb 1990*/
break;
} } }
}
}
}
diag->misc->ptzzz = pt;
......@@ -1594,7 +1613,8 @@ static os_error *load_file (diagrec *diag, viewrec *vuue, draw_objcoord *pt,
break;
}
break;
} }
}
}
return NULL;
}
......@@ -1634,7 +1654,8 @@ static void draw_paper__wimp_event_handler (wimp_eventstr *e, void *handle)
for (diag = draw_startdiagchain; diag != 0; diag = diag->nextdiag)
if (diag->misc->wantsnulls)
draw_obj_drop_construction (diag);
} }
}
}
break;
case wimp_EREDRAW:
......@@ -1906,7 +1927,8 @@ static BOOL draw_mayquit (void)
else
sprintf (a, msgs_lookup ("DrawQ2"), count);
return dboxquery_quit (a) == dboxquery_quit_DISCARD;
} }
}
}
/*Prequit handler - used when we get a closedown, either
global or Task 'Draw' => Quit from the Task Manager window.*/
......@@ -1975,7 +1997,11 @@ static void draw_prequit (void)
wimp_EKEY, akbd_Sh + akbd_Ctl + akbd_Fn12, taskmgr);
wimpt_noerr (wimp_sendmessage (wimp_EKEY, (wimp_msgstr*) &ee,
taskmgr));
} } } } }
}
}
}
}
}
/**************************************************************************
* *
......@@ -2734,7 +2760,8 @@ int main (int argc, char **argv)
else /*must be a filename*/
{ char *filename = *argv;
draw_file_load_named_file (filename, NULL, NULL);
} }
}
}
while (TRUE) event_process ();
......
......@@ -616,7 +616,8 @@ static os_error *do_objtext (draw_objptr hdrptr, draw_objcoord *org,
{ ftracef1 ("do_objtext: *ERROR* \"%s\"\n", error->errmess);
TRACE_FONT
return error;
} }
}
}
else
{ /*Really system font.*/
ftracef0 ("do_objtext: calling do_objtext_system\n");
......@@ -626,7 +627,8 @@ static os_error *do_objtext (draw_objptr hdrptr, draw_objcoord *org,
error->errmess);
TRACE_FONT
return error;
} }
}
}
TRACE_FONT
return NULL;
......@@ -1670,7 +1672,9 @@ static os_error *update_each_view (diagrec *diag,
if ((error = (*funcp) (diag, &org)) != NULL)
if (final == NULL) final = error; /*save the first only*/
wimp_get_rectangle (&r, &more);
} } }
}
}
}
return final;
}
......@@ -1695,7 +1699,8 @@ static os_error *update_this_view (viewrec *vuue,
if (final == NULL) final = error; /*save the first only*/
wimp_get_rectangle (&r, &more);
} }
}
}
return final;
}
......@@ -1889,7 +1894,8 @@ static os_error *displ_strokepath_linebyline (drawmod_pathelemptr pathptr,
blkC.move.y = blkL.move.y = pathptr.bezier->y3;
pathptr.bezier++;
break;
} }
}
}
return NULL;
}
......@@ -2002,7 +2008,8 @@ static void blob_point (int x, int y, int fg, int bg)
{ ftracef4 ("bbc_rectanglefill (%d, %d, %d, %d)\n",
x-grabW/2, y-grabH/2, grabW, grabH);
bbc_rectanglefill (x-grabW/2, y-grabH/2, grabW, grabH);
} }
}
}
static void paint_point (int x, int y, draw_objcoord *org)
......@@ -2214,7 +2221,8 @@ static os_error *paint_skeleton_pathentry (diagrec *diag,
endptr.bytep = ptz.bytep; /*dont blob final pt*/
paint_line_blobs (objhdr, endptr, org, FALSE);
} }
}
}
return NULL;
}
......@@ -2256,7 +2264,9 @@ static os_error *paint_skeleton_edit (draw_objptr hdrptr,
return error;
paint_point (currele.bezier->x3, currele.bezier->y3, org);
break;
} } }
}
}
}
/*stroke outline-eor in grey*/
displ_gcol (3, draw_colours.skeleton, -1);
......@@ -2278,7 +2288,8 @@ static os_error *paint_skeleton_edit (draw_objptr hdrptr,
if ((error = paint_skeleton_edit (objptr, subptr, currele, org)) !=
NULL)
return error;
} }
}
}
break;
}
return NULL;
......@@ -3067,7 +3078,10 @@ void draw_displ_eor_bbox (diagrec *diag, int obj_off) /*show bounding box*/
while (more)
{ paint_bbox (hdrptr, &org);
wimp_get_rectangle (&r, &more);
} } } }
}
}
}
}
/* ---------------------------------------------------------------------- */
......
......@@ -923,7 +923,8 @@ os_error *draw_edit_addpoint(diagrec *diag)
sizeof (drawmod_path_bezierstr);
ftracef0 ("draw_edit_addpoint: calling fit_mid_curve\n");
fit_mid_curve (prev, eleptr, next);
} }
}
}
else
{ curr.x = eleptr.lineto->x; curr.y = eleptr.lineto->y;
......@@ -1552,7 +1553,8 @@ void draw_edit_text (diagrec *diag, int obj_off)
case dbox_CLOSE:
open = FALSE;
break;
} }
}
}
/*Return the caret to where it was. J R C 4th Oct 1993*/
draw_displ_showcaret_if_up (diag);
......
......@@ -1039,7 +1039,9 @@ os_error *draw_enter_adjust (diagrec *diag, draw_objcoord *pt)
draw_edit_text (diag, obj_off);
break;
#endif
} } }
}
}
}
else
{ int obj_off = diag->misc->solidlimit; /* Where object will be after */
/* the complete! */
......
......@@ -206,14 +206,16 @@ static void refont_object (draw_objptr hdrptr, int *changelist)
for (i = start; i < limit; i+=objptr.objhdrp->size)
{ objptr.bytep = hdrptr.bytep + i;
refont_object (objptr, changelist);
} }
}
}
break;
case draw_OBJTRFMTEXT:
hdrptr.trfmtextp->textstyle.fontref =
changelist [hdrptr.trfmtextp->textstyle.fontref];
break;
} }
}
}
static BOOL tieupfontrefs (diagrec *diag)
{ draw_diagstr *misc = diag->misc;
......@@ -242,7 +244,8 @@ static BOOL tieupfontrefs (diagrec *diag)
listend.bytep = hdrptr.bytep + hdrptr.fontlistp->size;
break;
} }
}
}
if (liststart.bytep == 0) return TRUE; /*no new font list*/
......
......@@ -290,7 +290,9 @@ static void readstyle_path (draw_objptr hdrptr, void *handle)
if (pat->elements [j] != try->elements [j])
{ found = FALSE;
break;
} } }
}
}
}
if (found) { style->path_data.pattern = try; break; }
}
......@@ -431,7 +433,8 @@ static void set_style (diagrec *diag, restyle_action action, int changeto)
/* Reset the caret: probably not the best way */
draw_displ_eor_skeleton (diag);
} }
}
}
switch (action)
{ case restyle_LINEWIDTH:
......@@ -1244,7 +1247,8 @@ static void do_select (int which, int code, char *hit, diagrec *diag,
}
else
draw_edit_text (diag, obj_off);
} }
}
}
break;
case s_Select_Snap:
......@@ -1284,7 +1288,8 @@ static void do_select (int which, int code, char *hit, diagrec *diag,
case s_Select_To_Path:
draw_select_convert_to_paths (sel); /*or give error message*/
break;
} }
}
}
else
{
#if 0
......@@ -1313,7 +1318,8 @@ static void do_select (int which, int code, char *hit, diagrec *diag,
draw_trans_rotate (diag, -1, -1, &rotate);
ftracef0 ("AFTER:\n"), draw_trace_db (diag);
} }
}
}
else
{ draw_trans_scale_str scale;
BOOL negative_scale = FALSE;
......@@ -1366,7 +1372,9 @@ static void do_select (int which, int code, char *hit, diagrec *diag,
if (negative_scale) draw_select_make_rotatable (diag);
draw_trans_scale (diag, -1, -1, &scale);
} } }
}
}
}
wimpt_complain (err);
ftracef0 ("do_select]\n");
......@@ -2476,7 +2484,8 @@ void draw_menu_proc (void *handle, char *hit)
draw_undo_redo (diag);
}
break;
} }
}
}
break;
case s_Save: /* file */
......@@ -2816,7 +2825,8 @@ void draw_menu_proc (void *handle, char *hit)
vuue->gridunit [size].divide [xy];
draw_current_options.grid.o [4] =
size == grid_Cm;
} }
}
}
redrawGrid = TRUE;
}
......@@ -2850,7 +2860,8 @@ void draw_menu_proc (void *handle, char *hit)
draw_menu_toolbox_toggle (vuue);
draw_current_options.toolbox = vuue->flags.showpane;
break;
} }
}
}
/* changing system 'font size' or drawing grid crosses alters */
/* VDU5 character size, so restore normal values */
......@@ -3213,7 +3224,9 @@ void draw_menu_processkeys (diagrec *diag, viewrec *vuue, int key)
{ draw_obj_addtext_char (diag, key);
diag->misc->substate = state_text_char;
draw_displ_eor_skeleton (diag); /* paint the text */
} } }
}
}
}
else
/*not a character or a Draw control key, so give it back*/
wimp_processkey (key);
......
......@@ -883,7 +883,9 @@ BOOL draw_obj_findTextBox(draw_objptr hdrptr, draw_bboxtyp *bbox)
bbox->y1 = (bbox->y1 << 8)/MAXZOOMFACTOR + hdrptr.textp->coord.y;
return(TRUE);
} } }
}
}
}
/*Either text is in system font, OR an unfound fancy font (so rendered in */
/*system font) or some font manager call went bang, so.. */
......@@ -1174,7 +1176,8 @@ static BOOL find_trfmtext_bbox (draw_objptr hdrptr, draw_bboxtyp *bbox)
}
return TRUE;
} }
}
}
static void bound_trfmtext (draw_objptr hdrptr)
/*We know the matrix is rotate (theta).shear (phi) for some theta, phi,
......@@ -1317,7 +1320,8 @@ BOOL draw_obj_bound_object(draw_objptr hdrptr)
if (draw_obj_bound_object (objptr))
{ got_one = TRUE;
draw_obj_bound_minmax2 (objptr, &bound);
} }
}
}
if (got_one)
{ hdrptr.groupp->bbox = bound;
......@@ -1389,7 +1393,8 @@ void draw_obj_bound_objects
{ hdrptr.bytep = diag->paper + i;
if (draw_obj_bound_object(hdrptr) && box)
draw_obj_unify(box, draw_displ_bbox(hdrptr));
} }
}
}
void draw_obj_bound_selection(draw_bboxtyp *boundp)
......@@ -1428,9 +1433,11 @@ static void Bound_Width (draw_objptr hdrptr, int *widthp)
i += objptr.objhdrp->size)
{ objptr.bytep = hdrptr.bytep + i;
Bound_Width (objptr, widthp);
} }
}
}
break;
} }
}
}
void draw_obj_bound_selection_width (int *widthp)
......@@ -1983,7 +1990,8 @@ static int over_object_search(diagrec *diag, int obj_off, draw_objcoord *pt)
return found;
else
found = i; /*over body of object*/
} }
}
}
break;
case draw_OBJTAGG:
......@@ -1998,7 +2006,8 @@ static int over_object_search(diagrec *diag, int obj_off, draw_objcoord *pt)
return found;
else
found = i; /*over body of object*/
} }
}
}
break;
default: /* unknown, may not even have a BBox */
......
......@@ -172,7 +172,9 @@ void draw_print_recachepagelimits (void)
/*draw_displ_show_printmargins (diag);*/
draw_displ_forceredraw (diag);
} } }
}
}
}
/* Assumed to be called shortly after a 'print_recachepagelimits()' and
should have the same (is/not)present state*/
......
......@@ -274,4 +274,5 @@ void draw_scan_traverse_object(draw_objptr hdrptr,
(*arrayp [tag]) (hdrptr, handle);
}
break;
} }
}
}
......@@ -61,6 +61,8 @@
#include "werr.h"
#include "wimp.h"
#include "wimpt.h"
#include "jpeg.h"
#include "dbox.h"
#include "ftrace.h"
#include "guard.h"
......@@ -128,7 +130,9 @@ static int over_selected_object (diagrec *diag, draw_objcoord *pt,
{ found = draw_selection->array [i];
posn = overStretch;
break; /*over BR (stretch) box*/
} } }
}
}
}
*regionp = posn;
*offsetp = found;
......@@ -288,7 +292,8 @@ static void draw_select_clear (diagrec *diag)
ftracef1 ("draw_select_clear: flex_extend (, %d)\n", sizeof (selection_str));
FLEX_EXTEND ((flex_ptr) &draw_selection,sizeof (selection_str));
draw_selection->limit = default_SELECTIONSIZE;
} }
}
}
}
void draw_select_claim_selection (diagrec *diag)
......@@ -303,7 +308,8 @@ void draw_select_claim_selection (diagrec *diag)
draw_selection->owner = diag;
draw_selection->indx = 0;
} }
}
}
void draw_select_release_selection (diagrec *diag)
......@@ -344,7 +350,8 @@ static os_error *draw_select_range (diagrec *diag, int start, int end)
draw_selection->array [draw_selection->indx++] = offset;
offset += sizeof (draw_textcolhdr);
column.bytep = diag->paper + offset;
} }
}
}
break;
case draw_OBJTEXT:
......@@ -362,7 +369,8 @@ static os_error *draw_select_range (diagrec *diag, int start, int end)
default:
ftracef1("draw_select_range: unknown object type %d\n",hdrptr.objhdrp->tag);
break;
} }
}
}
return 0; /*exit OK*/
}
......@@ -400,7 +408,8 @@ os_error *draw_select_select (diagrec *diag, draw_objcoord *pt)
if (draw_obj_over_object (diag, pt, &obj_region, &obj_off))
{ ftracef0 ("select object\n");
err = draw_select_object (diag, obj_off);
} }
}
}
return err;
}
......@@ -422,7 +431,8 @@ void draw_select_doubleselect (diagrec *diag, draw_objcoord *pt)
if (prev != obj_off)
{ deselect_object (diag, obj_off);
draw_select_object (diag, prev);
} }
}
}
}
/*If over a selected object,*/
......@@ -546,7 +556,8 @@ os_error *draw_select_adjust (diagrec *diag, draw_objcoord *pt)
{ if (draw_obj_over_object (diag, pt, &obj_region,&obj_off))
{ draw_undo_separate_major_edits (diag);
err = draw_select_object (diag, obj_off);
} }
}
}
return err;
}
......@@ -566,7 +577,8 @@ void draw_select_longadjust (diagrec *diag, viewrec *vuue, draw_objcoord *pt,
{ ftracef0 ("Not over selected object, retain selection\n");
draw_start_capture (vuue, shifted? state_sel_shift_adjust:
state_sel_adjust, pt, FALSE);
} }
}
}
void draw_select_clearall (diagrec *diag)
......@@ -647,7 +659,8 @@ os_error *draw_select_capture_area (diagrec *diag, int toggle,
ftracef1("draw_select_capture_area: unknown object type %d\n",hdrptr.objhdrp->tag);
/*ignore unknown types*/
break;
} }
}
}
/*Complete the selection*/
draw_select_marked (diag, TRUE);
......@@ -713,7 +726,8 @@ void draw_select_marked (diagrec *diag, BOOL select)
{ entry = entry & ~Mark;
draw_displ_eor_bbox (diag, entry);
if (select) draw_selection->array [i] = entry;
} }
}
}
/*Tidy up array if deselecting*/
if (!select)
......@@ -726,7 +740,8 @@ void draw_select_marked (diagrec *diag, BOOL select)
draw_selection->array [to++] = entry;
}
draw_selection->indx = to;
} }
}
}
/*-------------------------------------------------------------------------*/
/**/
......@@ -801,12 +816,14 @@ void draw_select_justify_selection (int horz, int vert)
if (t.dx != 0 || t.dy != 0)
draw_trans_translate (diag, obj_off, next_off, &t);
} }
}
}