Merge branch 'master' into magic-8.2

Conflicts:
	.gitignore

Commit of .gitignore, although I have no idea why it was flagged
with a merge conflict, or why git can't just overwrite it with a pull.
This commit is contained in:
Tim Edwards 2020-02-20 10:50:50 -05:00
commit 94b1c53b8f
22 changed files with 302 additions and 113 deletions

16
.gitignore vendored
View File

@ -11,3 +11,19 @@ scripts/defs.mak
*~
scmos/cif_template/objs/*
UPDATE_ME
VERSION
database/database.h
install.log
magic/proto.magicrc
make.log
readline/readline
scmos/gdsquery.tech
scmos/minimum.tech
scmos/scmos-sub.tech
scmos/scmos-tm.tech
scmos/scmos.tech
scmos/scmosWR.tech
tcltk/magic.sh
tcltk/magic.tcl
tcltk/magicdnull
tcltk/magicexec

View File

View File

@ -1792,6 +1792,7 @@ FlatCopyAllLabels(scx, mask, xMask, targetUse)
char pathstring[FLATTERMSIZE];
TerminalPath tpath;
pathstring[0] = '\0';
tpath.tp_first = tpath.tp_next = pathstring;
tpath.tp_last = pathstring + FLATTERMSIZE;

View File

@ -581,8 +581,11 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg)
else
is_touching = GEO_TOUCH(&lab->lab_rect, r);
}
if (!is_touching && (flags & TF_LABEL_DISPLAY) && (lab->lab_font >= 0))
if (!is_touching && (flags & TF_LABEL_DISPLAY) && lab->lab_font >= 0)
{
/* Check against bounds of the rendered label text */
is_touching = GEO_TOUCH(&lab->lab_bbox, r);
}
if (is_touching && TTMaskHasType(mask, lab->lab_type))
if ((*func)(scx, lab, tpath, cdarg))

View File

@ -656,6 +656,9 @@ dbcUnconnectFunc(tile, clientData)
* ----------------------------------------------------------------------------
*/
/* To do: Make the tpath entries dynamically allocated */
#define FLATTERMSIZE 1024
int
dbcConnectLabelFunc(scx, lab, tpath, csa2)
SearchContext *scx;
@ -667,6 +670,8 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
Rect r;
Point offset;
int pos, rotate;
char newlabtext[FLATTERMSIZE];
char *newlabptr;
int dbcConnectFunc(); /* Forward declaration */
GeoTransRect(&scx->scx_trans, &lab->lab_rect, &r);
@ -677,12 +682,29 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
/* Only add labels if they are on the search top level */
/* (NOTE: Could add hierachical labels using tpath) */
if (scx->scx_use == csa2->csa2_topscx->scx_use)
if (scx->scx_use != csa2->csa2_topscx->scx_use)
{
DBEraseLabelsByContent(def, &r, -1, lab->lab_text);
DBPutFontLabel(def, &r, lab->lab_font, lab->lab_size, rotate, &offset,
pos, lab->lab_text, lab->lab_type, lab->lab_flags);
int newllen = tpath->tp_next - tpath->tp_first;
newlabtext[0] = '\0';
if (newllen > 0)
strncpy(newlabtext, tpath->tp_first, newllen);
sprintf(newlabtext + newllen, "%s", lab->lab_text);
newlabptr = newlabtext;
}
else
newlabptr = lab->lab_text;
/* Do not repeat a label copy; check that the label doesn't */
/* already exist in the destination def first. */
if (DBCheckLabelsByContent(def, &r, lab->lab_type, lab->lab_text))
return 0;
if (DBCheckLabelsByContent(def, &r, lab->lab_type, newlabptr))
return 0;
DBEraseLabelsByContent(def, &r, -1, lab->lab_text);
DBPutFontLabel(def, &r, lab->lab_font, lab->lab_size, rotate, &offset,
pos, newlabptr, lab->lab_type, lab->lab_flags);
if (lab->lab_flags & PORT_DIR_MASK)
{
@ -1019,6 +1041,13 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse)
DBTreeSrTiles(scx, mask, xMask, dbcConnectFunc, (ClientData) &csa2);
while (csa2.csa2_top >= 0)
{
char pathstring[FLATTERMSIZE];
TerminalPath tpath;
tpath.tp_first = tpath.tp_next = pathstring;
tpath.tp_last = pathstring + FLATTERMSIZE;
pathstring[0] = '\0';
newmask = csa2.csa2_list[csa2.csa2_top].connectMask;
scx->scx_area = csa2.csa2_list[csa2.csa2_top].area;
newtype = csa2.csa2_list[csa2.csa2_top].dinfo;
@ -1059,7 +1088,7 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse)
searchtype |= TF_LABEL_ATTACH_NOT_SE;
}
}
DBTreeSrLabels(scx, newmask, xMask, NULL, searchtype,
DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype,
dbcConnectLabelFunc, (ClientData) &csa2);
}
freeMagic((char *)csa2.csa2_list);

View File

@ -313,7 +313,55 @@ DBEraseLabel(cellDef, area, mask, areaReturn)
cellDef->cd_flags |= CDMODIFIED|CDGETNEWSTAMP;
return (erasedAny);
}
#define RECTEQUAL(r1, r2) ((r1)->r_xbot == (r2)->r_xbot \
&& (r1)->r_ybot == (r2)->r_ybot \
&& (r1)->r_xtop == (r2)->r_xtop \
&& (r1)->r_ytop == (r2)->r_ytop)
/*
* ----------------------------------------------------------------------------
*
* DBCheckLabelsByContent --
*
* Return any label found on the label list for the given
* CellDef that matches the given specification.
*
* Results:
* Returns a label if a match is found, otherwise returns NULL.
*
* Side effects:
* None.
*
* ----------------------------------------------------------------------------
*/
Label *
DBCheckLabelsByContent(def, rect, type, text)
CellDef *def; /* Where to look for label to delete. */
Rect *rect; /* Coordinates of label. If NULL, then
* labels are searched regardless of coords.
*/
TileType type; /* Layer label is attached to. If < 0, then
* labels are searched regardless of type.
*/
char *text; /* Text associated with label. If NULL, then
* labels are searched regardless of text.
*/
{
Label *lab;
for (lab = def->cd_labels; lab; lab = lab->lab_next)
{
if ((rect != NULL) && !(RECTEQUAL(&lab->lab_rect, rect))) continue;
if ((type >= 0) && (type != lab->lab_type)) continue;
if ((text != NULL) && (strcmp(text, lab->lab_text) != 0)) continue;
return lab;
}
return NULL;
}
/*
* ----------------------------------------------------------------------------
*
@ -348,11 +396,6 @@ DBEraseLabelsByContent(def, rect, type, text)
{
Label *lab, *labPrev;
#define RECTEQUAL(r1, r2) ((r1)->r_xbot == (r2)->r_xbot \
&& (r1)->r_ybot == (r2)->r_ybot \
&& (r1)->r_xtop == (r2)->r_xtop \
&& (r1)->r_ytop == (r2)->r_ytop)
for (labPrev = NULL, lab = def->cd_labels;
lab != NULL;
labPrev = lab, lab = lab->lab_next)

View File

@ -418,7 +418,7 @@ DBWredisplay(w, rootArea, clipArea)
/* Set style information beforehand */
GrSetStuff(STYLE_LABEL);
(void) DBTreeSrLabels(&scontext, &DBAllTypeBits, bitMask,
(TerminalPath *) NULL, TF_LABEL_DISPLAY,
(TerminalPath *) NULL, TF_LABEL_DISPLAY | TF_LABEL_ATTACH,
dbwLabelFunc, (ClientData) NULL);
GrClipTo(&rootClip);
}

View File

@ -1078,7 +1078,7 @@ simdevVisit(dev, hierName, scale, trans)
{
putc(' ', esSimF);
simdevSubstrate(hierName, subnode->efnode_name->efnn_hier,
dev->dev_type, 0, FALSE, esSimF);
dev->dev_type, 0.0, FALSE, esSimF);
}
GeoTransRect(trans, &dev->dev_rect, &r);
@ -1196,7 +1196,8 @@ int
simdevSubstrate( prefix, suffix, type, scale, doAP, outf)
HierName *prefix;
HierName *suffix;
int type, scale;
int type;
float scale;
bool doAP;
FILE *outf;
{
@ -1264,7 +1265,8 @@ FILE *outf;
bool simnAP(node, resClass, scale, outf)
EFNode *node;
int resClass, scale;
int resClass;
float scale;
FILE *outf;
{
int a, p;
@ -1277,8 +1279,8 @@ FILE *outf;
return FALSE;
}
markVisited((nodeClient *)node->efnode_client, resClass);
a = node->efnode_pa[resClass].pa_area*scale*scale;
p = node->efnode_pa[resClass].pa_perim*scale;
a = (int)(node->efnode_pa[resClass].pa_area*scale*scale);
p = (int)(node->efnode_pa[resClass].pa_perim*scale);
if ( a < 0 ) a = 0;
if ( p < 0 ) p = 0;
fprintf(outf,"A_%d,P_%d", a, p);
@ -1288,7 +1290,8 @@ FILE *outf;
bool simnAPHier(dterm, hierName, resClass, scale, outf)
DevTerm *dterm;
HierName *hierName;
int resClass, scale;
int resClass;
float scale;
FILE *outf;
{
EFNode *node = dterm->dterm_node;
@ -1308,8 +1311,8 @@ bool simnAPHier(dterm, hierName, resClass, scale, outf)
return FALSE;
}
markVisited((nodeClientHier *)node->efnode_client, resClass);
a = node->efnode_pa[resClass].pa_area*scale*scale;
p = node->efnode_pa[resClass].pa_perim*scale;
a = (int)(node->efnode_pa[resClass].pa_area*scale*scale);
p = (int)(node->efnode_pa[resClass].pa_perim*scale);
if ( a < 0 ) a = 0;
if ( p < 0 ) p = 0;
fprintf(outf,"A_%d,P_%d", a, p);

View File

@ -370,6 +370,9 @@ GrTCairoPlotSVG (char *filename, MagWindow *mw)
wind_context = tcairodata->context;
tcairodata->surface = (cairo_surface_t *)cairo_svg_surface_create(filename,
(double)screenw, (double)screenh);
cairo_svg_surface_restrict_to_version(tcairodata->surface,
CAIRO_SVG_VERSION_1_2);
tcairodata->context = cairo_create(tcairodata->surface);
WindRedisplay(mw);
WindUpdate();

View File

@ -19,7 +19,7 @@ EXTRA_LIBS = ${MAGICDIR}/cmwind/libcmwind.o ${MAGICDIR}/commands/libcommands.o \
${MAGICDIR}/plow/libplow.o ${MAGICDIR}/utils/libutils.o \
${MAIN_EXTRA_LIBS}
BITMAPS = up.xbm down.xbm left.xbm right.xbm zoom.xbm lock.xbm
BITMAPS = up.png down.png left.png right.png zoom.png lock.xbm
DEST_XBM = $(BITMAPS:%=$(DESTDIR)${INSTALL_TCLDIR}/bitmaps/%)
DFLAGS += -DMAGIC_DATE="\"`date`\"" -DCAD_DIR="${LIBDIR}"

BIN
magic/bitmaps/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
magic/bitmaps/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

BIN
magic/bitmaps/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

BIN
magic/bitmaps/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
magic/bitmaps/zoom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

View File

@ -24,7 +24,6 @@ TCL_FILES = \
tools.tcl \
mazeroute.tcl \
strip_reflibs.tcl \
drc.tcl \
toolkit.tcl \
toolkit_rev0.tcl \
bsitools.tcl \
@ -50,11 +49,13 @@ install-tcl: magicexec magicdnull ${BIN_FILES} ${TCL_FILES}
magicexec: magicexec.c ${MAGICDIR}/defs.mak
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS_NOSTUB} ${LDFLAGS} magicexec.c \
-o magicexec ${LD_RUN_PATH} ${LIBS} ${LIB_SPECS_NOSTUB}
-o magicexec ${LD_RUN_PATH} ${LIB_SPECS_NOSTUB} ${LIBS} \
${GR_LIBS}
magicdnull: magicdnull.c ${MAGICDIR}/defs.mak
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS_NOSTUB} ${LDFLAGS} magicdnull.c \
-o magicdnull ${LD_RUN_PATH} ${LIBS} ${LIB_SPECS_NOSTUB}
-o magicdnull ${LD_RUN_PATH} ${LIB_SPECS_NOSTUB} ${LIBS} \
${GR_LIBS}
magic.tcl: magic.tcl.in ${MAGICDIR}/defs.mak
sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \

View File

@ -1,46 +0,0 @@
#!/bin/tclsh
#----------------------------------------------
# Dump a file of DRC errors from magic
#----------------------------------------------
namespace path {::tcl::mathop ::tcl::mathfunc}
magic::suspendall
set fout [open "drc.out" w]
set oscale [cif scale out]
select top cell
set origcell [cellname list self]
drc check
set celllist [drc list count]
puts stdout "celllist is $celllist"
puts stdout ""
flush stdout
foreach pair $celllist {
set cellname [lindex $pair 0]
set count [lindex $pair 1]
puts stdout "loading $cellname"
flush stdout
load $cellname
select top cell
puts $fout "$cellname $count"
puts $fout "----------------------------------------"
set drcresult [drc listall why]
foreach {errtype coordlist} $drcresult {
puts $fout $errtype
puts $fout "----------------------------------------"
foreach coord $coordlist {
set bllx [* $oscale [lindex $coord 0]]
set blly [* $oscale [lindex $coord 1]]
set burx [* $oscale [lindex $coord 2]]
set bury [* $oscale [lindex $coord 3]]
set coords [format "%.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
puts $fout "$coords"
}
puts $fout "----------------------------------------"
}
puts $fout ""
}
close $fout
load $origcell
magic::resumeall

View File

@ -101,11 +101,13 @@ proc magic::makedrcmanager { mgrpath } {
-command {magic::drccallback update}
button ${mgrpath}.actionbar.last -text "Last" -command {magic::drccallback last}
button ${mgrpath}.actionbar.next -text "Next" -command {magic::drccallback next}
button ${mgrpath}.actionbar.save -text "Save" -command {magic::drc_save_report}
button ${mgrpath}.actionbar.zoom -text "Zoom" -command {magic::drccallback zoom}
pack ${mgrpath}.actionbar.update -side left
pack ${mgrpath}.actionbar.last -side left
pack ${mgrpath}.actionbar.next -side left
pack ${mgrpath}.actionbar.save -side left
pack ${mgrpath}.actionbar.zoom -side right
label ${mgrpath}.target.name -text "Target window:"
@ -150,7 +152,6 @@ proc magic::adddrcentry {key valuelist} {
}
}
#--------------------------------------------------------------
# The cell manager window main callback function
#--------------------------------------------------------------
@ -193,3 +194,107 @@ proc magic::drcmanager {{option "update"}} {
} ;# (if Tk version 8.5)
#---------------------------------------------------
# Alternative way to view/save DRC errors in magic.
# Dump a text file of errors and positions. Note
# that the dump, using "drc listall why", enumerates
# every single edge check and is therefore more
# detailed than the areas declared by "drc count"
# or enumerated in "drc find".
#---------------------------------------------------
proc magic::drc_save_report {{cellname ""} {outfile ""}} {
if {$outfile == ""} {set outfile "drc.out"}
set fout [open $outfile w]
set oscale [cif scale out]
# magic::suspendall
if {$cellname == ""} {
select top cell
set cellname [cellname list self]
set origname ""
} else {
set origname [cellname list self]
puts stdout "loading $cellname\n"
flush stdout
load $cellname
select top cell
}
drc check
set count [drc list count]
puts $fout "$cellname $count"
puts $fout "----------------------------------------"
set drcresult [drc listall why]
foreach {errtype coordlist} $drcresult {
puts $fout $errtype
puts $fout "----------------------------------------"
foreach coord $coordlist {
set bllx [expr {$oscale * [lindex $coord 0]}]
set blly [expr {$oscale * [lindex $coord 1]}]
set burx [expr {$oscale * [lindex $coord 2]}]
set bury [expr {$oscale * [lindex $coord 3]}]
set coords [format " %.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
puts $fout "$coords"
}
puts $fout "----------------------------------------"
}
puts $fout ""
if {$origname != ""} {
load $origname
}
# magic::resumeall
close $fout
puts stdout "done with $outfile\n"
flush stdout
}
#---------------------------------------------------
# Read back a dumped file of DRC errors. This is of
# limited use, as any layout should have DRC errors
# already marked. This routine loads errors into
# "feedback" areas, which is redundant to the error
# tiles. However, feedback areas are more precise,
# as they mark the error area at each checked edge
#---------------------------------------------------
proc magic::drc_load_report {{drc_file ""}} {
if {$drc_file == ""} {
set drc_file "drc.out"
}
set fin [open $drc_file r]
puts stdout "Reading $drc_file\n"
flush stdout
magic::suspendall
set error_text ""
while {[gets $fin line] >= 0} {
if {[string first " " $line] == 0} {
if [regexp { ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)} $line lmatch llx lly urx ury] {
feedback add "$error_text" vert_highlights ${llx}um ${lly}um \
${llx}um ${ury}um ${urx}um ${ury}um ${urx}um ${lly}um
}
} elseif {[string first "-" $line] != 0} {
set error_text $line
}
}
magic::resumeall
close $fin
puts stdout "Done.\n"
puts stdout "Use \"feedback find\" to enumerate errors.\n"
flush stdout
}

View File

@ -15,7 +15,7 @@ for i in $@; do
esac
done
#
eval /home/tim/cad/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
eval /usr/local/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
drc off
box 0 0 0 0
ext2sim $esargs

View File

@ -15,7 +15,7 @@ for i in $@; do
esac
done
#
eval /home/tim/cad/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
eval /usr/local/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
drc off
box 0 0 0 0
ext2spice $esargs

View File

@ -1,5 +1,5 @@
# This is the "Magic wrapper".
# It's main purpose is to redefine the "openwindow" command in magic so that
# Its main purpose is to redefine the "openwindow" command in magic so that
# opening a new window creates a window wrapped by a GUI interface.
#
# Written by Tim Edwards, August 23, 2002.
@ -22,26 +22,43 @@ if {[lsearch [namespace children] ::tkshell] < 0} {
catch {source ${CAD_ROOT}/magic/tcl/tkshell.tcl}
}
# Button images
proc magic::makeglyphimages {} {
global Opts
global Glyph
global CAD_ROOT
set Glyph(up) [image create bitmap \
-file ${CAD_ROOT}/magic/tcl/bitmaps/up.xbm \
-background gray -foreground steelblue]
set Glyph(down) [image create bitmap \
-file ${CAD_ROOT}/magic/tcl/bitmaps/down.xbm \
-background gray -foreground steelblue]
set Glyph(left) [image create bitmap \
-file ${CAD_ROOT}/magic/tcl/bitmaps/left.xbm \
-background gray -foreground steelblue]
set Glyph(right) [image create bitmap \
-file ${CAD_ROOT}/magic/tcl/bitmaps/right.xbm \
-background gray -foreground steelblue]
set Glyph(zoom) [image create bitmap \
-file ${CAD_ROOT}/magic/tcl/bitmaps/zoom.xbm \
-background gray -foreground steelblue]
set Glyph(lock) [image create bitmap \
# Check if glyphs exist---don't need to make them more than once
if {![catch {set Glyph(up)}]} {return}
# Glyph images
set gsize [expr {int($Opts(scale) * 13)}]
set gscale [expr {int($Opts(scale))}]
image create photo stdglyph -file ${CAD_ROOT}/magic/tcl/bitmaps/up.png
image create photo Glyph(up) -width $gsize -height $gsize
Glyph(up) copy stdglyph -zoom $gscale
image create photo stdglyph -file ${CAD_ROOT}/magic/tcl/bitmaps/down.png
image create photo Glyph(down) -width $gsize -height $gsize
Glyph(down) copy stdglyph -zoom $gscale
image create photo stdglyph -file ${CAD_ROOT}/magic/tcl/bitmaps/left.png
image create photo Glyph(left) -width $gsize -height $gsize
Glyph(left) copy stdglyph -zoom $gscale
image create photo stdglyph -file ${CAD_ROOT}/magic/tcl/bitmaps/right.png
image create photo Glyph(right) -width $gsize -height $gsize
Glyph(right) copy stdglyph -zoom $gscale
image create photo stdglyph -file ${CAD_ROOT}/magic/tcl/bitmaps/zoom.png
image create photo Glyph(zoom) -width $gsize -height $gsize
Glyph(zoom) copy stdglyph -zoom $gscale
image create bitmap Glyph(lock) \
-file ${CAD_ROOT}/magic/tcl/bitmaps/lock.xbm \
-background gray80 -foreground steelblue4]
}
# Menu button callback functions
@ -537,6 +554,8 @@ set Opts(crosshair) 0
set Opts(hidelocked) 0
set Opts(hidespecial) 0
set Opts(toolbar) 0
set Opts(scale) 1.0
set Opts(toolscale) 1.0
set Opts(drc) 1
set Opts(autobuttontext) 1
@ -629,7 +648,7 @@ proc magic::cursorview {win} {
return
}
set framename [winfo parent $win]
if {[catch {set cr [cif scale out]}]} {return}
if {[catch {set cr [*bypass cif scale out]}]} {return}
if {$cr == 0} {return}
set olst [${win} cursor internal]
@ -720,18 +739,22 @@ proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} {
# Generate the toolbar images for a technology
proc magic::maketoolimages {} {
global Opts
# Tool size expands with the GUI scale but can also be expanded independently.
set tsize [expr {int($Opts(scale) * $Opts(toolscale) * 16)}]
# Generate a layer image for "space" that will be used when layers are
# invisible.
image create layer img_space -name none
image create layer img_space -name none -width $tsize -height $tsize
set all_layers [concat {errors labels subcell} [magic::tech layer "*"]]
foreach layername $all_layers {
image create layer img_$layername -name $layername
image create layer img_$layername -name $layername -width $tsize -height $tsize
image create layer pale_$layername -name $layername \
-disabled true -icon 23
-disabled true -icon 23 -width $tsize -height $tsize
}
}
@ -896,6 +919,8 @@ proc magic::techrebuild {winpath {cmdstr ""}} {
# current view in magic (in pixels)
proc magic::setscrollvalues {win} {
global Opts
set svalues [${win} view get]
set bvalues [${win} view bbox]
@ -922,16 +947,19 @@ proc magic::setscrollvalues {win} {
set ya [expr { $wheight - $ya }]
set yb [expr { $wheight - $yb }]
${framename}.xscroll.bar coords slider $xa 2 $xb 15
${framename}.yscroll.bar coords slider 2 $ya 15 $yb
set swidth [expr {int($Opts(scale) * 13)}]
set slength [expr {$swidth + 2}]
${framename}.xscroll.bar coords slider $xa 2 $xb $slength
${framename}.yscroll.bar coords slider 2 $ya $slength $yb
set xb [expr { 1 + ($xa + $xb) / 2 }]
set xa [expr { $xb - 2 }]
${framename}.xscroll.bar coords centre $xa 4 $xb 13
${framename}.xscroll.bar coords centre $xa 4 $xb $swidth
set yb [expr { 1 + ($ya + $yb) / 2 }]
set ya [expr { $yb - 2 }]
${framename}.yscroll.bar coords centre 4 $ya 13 $yb
${framename}.yscroll.bar coords centre 4 $ya $swidth $yb
}
# Procedure to update scrollbars in response to an internal command
@ -1015,6 +1043,9 @@ proc magic::dragscroll { w v orient } {
proc magic::makescrollbar { fname orient win } {
global scale
global Glyph
global Opts
set swidth [expr {int($Opts(scale) * 13)}]
set scale($orient,update) 0
set scale($orient,origin) 0
@ -1022,19 +1053,19 @@ proc magic::makescrollbar { fname orient win } {
# To be done: add glyphs for the arrows
if { "$orient" == "x" } {
canvas ${fname}.bar -height 13 -relief sunken -borderwidth 1
button ${fname}.lb -image $Glyph(left) -borderwidth 1 \
canvas ${fname}.bar -height $swidth -relief sunken -borderwidth 1
button ${fname}.lb -image Glyph(left) -borderwidth 1 \
-command "${win} scroll left .1 w"
button ${fname}.ub -image $Glyph(right) -borderwidth 1 \
button ${fname}.ub -image Glyph(right) -borderwidth 1 \
-command "${win} scroll right .1 w"
pack ${fname}.lb -side left
pack ${fname}.bar -fill $orient -expand true -side left
pack ${fname}.ub -side right
} else {
canvas ${fname}.bar -width 13 -relief sunken -borderwidth 1
button ${fname}.lb -image $Glyph(down) -borderwidth 1 \
canvas ${fname}.bar -width $swidth -relief sunken -borderwidth 1
button ${fname}.lb -image Glyph(down) -borderwidth 1 \
-command "${win} scroll down .1 w"
button ${fname}.ub -image $Glyph(up) -borderwidth 1 \
button ${fname}.ub -image Glyph(up) -borderwidth 1 \
-command "${win} scroll up .1 w"
pack ${fname}.ub
pack ${fname}.bar -fill $orient -expand true
@ -1050,7 +1081,7 @@ proc magic::makescrollbar { fname orient win } {
# Create a small mark in the center of the scrolling rectangle which aids
# in determining how much the window is being scrolled when the full
# scrollbar extends past the window edges.
${fname}.bar create rect 4 4 13 13 -fill black -width 0 -tag centre
${fname}.bar create rect 4 4 $swidth $swidth -fill black -width 0 -tag centre
${fname}.bar bind centre <Button-1> "magic::setscroll %W %$orient $orient"
${fname}.bar bind centre <ButtonRelease-1> "magic::scrollview %W $win $orient"
${fname}.bar bind centre <B1-Motion> "magic::dragscroll %W %$orient $orient"
@ -1123,12 +1154,14 @@ proc magic::openwrapper {{cell ""} {framename ""}} {
pack ${framename}.pane -side top -fill both -expand true
frame ${layoutframe}.xscroll -height 13
frame ${layoutframe}.yscroll -width 13
set swidth [expr {int($Opts(scale) * 13)}]
frame ${layoutframe}.xscroll -height $swidth
frame ${layoutframe}.yscroll -width $swidth
magic::makeglyphimages
magic::makescrollbar ${layoutframe}.xscroll x ${winname}
magic::makescrollbar ${layoutframe}.yscroll y ${winname}
button ${layoutframe}.zb -image $Glyph(zoom) -borderwidth 1 -command "${winname} zoom 2"
button ${layoutframe}.zb -image Glyph(zoom) -borderwidth 1 -command "${winname} zoom 2"
# Add bindings for mouse buttons 2 and 3 to the zoom button
bind ${layoutframe}.zb <Button-3> "${winname} zoom 0.5"

View File

@ -2,9 +2,7 @@ args.o: args.c ../utils/magic.h ../utils/utils.h
child.o: child.c ../utils/utils.h ../utils/magic.h ../utils/malloc.h
dqueue.o: dqueue.c ../utils/magic.h ../utils/dqueue.h ../utils/malloc.h
finddisp.o: finddisp.c ../utils/magic.h ../utils/utils.h
flock.o: flock.c ../utils/magic.h ../utils/hash.h ../utils/geometry.h \
../tiles/tile.h ../database/database.h ../windows/windows.h \
../utils/malloc.h
flock.o: flock.c
flsbuf.o: flsbuf.c
fraction.o: fraction.c ../utils/magic.h ../utils/geometry.h
geometry.o: geometry.c ../utils/magic.h ../utils/geometry.h \