Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI IVIB integration #287

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
68 changes: 35 additions & 33 deletions uni/gui/dialog.icn
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Dialog : Component(
tooltip_y,
tooltip_w,
tooltip_h,
abs_pos_flag # set if set_pos() has been called
abs_pos_flag # set if set_pos() has been called
)

method invoke_validate()
Expand Down Expand Up @@ -213,6 +213,7 @@ class Dialog : Component(
method resize_win(w, h)
WAttrib(self.win, "size=" || w || "," || h)
Enqueue(self.win, &resize)
if \self.uidlog.ivib_maindialog.canvas then self.uidlog.ivib_maindialog.canvas.restore()
end

method init()
Expand Down Expand Up @@ -337,11 +338,11 @@ class Dialog : Component(
# giving up and aborting the whole program.

if (not self.open_win()) &
((not match("font=",attribs[i:=1 to *\attribs])) |
((attribs[i] :=
((not match("font=",attribs[i:=1 to *\attribs])) |
((attribs[i] :=
"font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1") &
(not self.open_win()))) then
fatal("couldn't open/show window")
(not self.open_win()))) then
fatal("couldn't open/show window")

self.init()
self.is_open := 1
Expand All @@ -364,7 +365,7 @@ class Dialog : Component(
self.bevel_dispose()
self.tooltip_dispose()
if \ (is_open) then
self.close_win()
self.close_win()
self.is_open := &null
dispatcher.del(self)
delete((\owning_dialog).child_dialogs, self)
Expand Down Expand Up @@ -451,15 +452,15 @@ $endif
do_handle_event(e)

if (e === ("\t" | Key_Right | Key_Down)) &
( /self.focus | not(self.focus.keeps(e))) then {
( /self.focus | not(self.focus.keeps(e))) then {
if c := find_next_focus() then
self.set_focus(c, e)
}
}
else if (e === (Shift_Tab | Key_Left | Key_Up)) &
( /self.focus | not(self.focus.keeps(e))) then {
( /self.focus | not(self.focus.keeps(e))) then {
if c := find_previous_focus() then
self.set_focus(c, e)
}
}

synch_pointer()
end
Expand Down Expand Up @@ -528,11 +529,11 @@ $endif
ww := WAttrib(self.win, "width")
wh := WAttrib(self.win, "height")
if not (cw := Clone(self.cwin, "bg=pale yellow", "font=sans,14", "fg=black")) then
# try again with default font
if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black")) then
if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black",
"font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1")) then
fail
# try again with default font
if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black")) then
if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black",
"font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1")) then
fail
fh := WAttrib(cw, "fheight")

if find("\n", obj.tooltip) then multiline := 1
Expand All @@ -542,17 +543,17 @@ $endif
numlines := 1
tooltip_w := 0
obj.tooltip ? {
while line := tab(find("\n")) do {
put(lines, line)
="\n"
numlines +:= 1
tooltip_w <:= TextWidth(line) + 4
}
if line := tab(0) & *line > 0 then {
put(lines, line)
tooltip_w <:= TextWidth(line) + 4
}
}
while line := tab(find("\n")) do {
put(lines, line)
="\n"
numlines +:= 1
tooltip_w <:= TextWidth(line) + 20
}
if line := tab(0) & *line > 0 then {
put(lines, line)
tooltip_w <:= TextWidth(line) + 20
}
}
tooltip_h := fh*numlines + 6

tooltip_x := x + 8
Expand All @@ -564,16 +565,16 @@ $endif
tooltip_y := 0 <= wh - tooltip_h

tooltip_win := WOpen("canvas=hidden", "size=" ||
tooltip_w || "," || tooltip_h)
tooltip_w || "," || tooltip_h)
CopyArea(cwin, tooltip_win, tooltip_x, tooltip_y, tooltip_w, tooltip_h,
0, 0)
0, 0)
EraseRectangle(cw, tooltip_x, tooltip_y, tooltip_w, tooltip_h)
Rectangle(cw, tooltip_x, tooltip_y, tooltip_w, tooltip_h)

every i := 1 to *lines do {
center_string(cw, tooltip_x + tooltip_w / 2,
tooltip_y + 3 + fh * (i-1) + fh/2, lines[i], obj.accel)
}
center_string(cw, tooltip_x + tooltip_w / 2,
tooltip_y + 3 + fh * (i-1) + fh/2, lines[i], obj.accel)
}
Uncouple(cw)
end

Expand Down Expand Up @@ -772,6 +773,7 @@ $endif
WAttrib(self.buffer_win, "height=" || nh)
EraseArea(self.win, 0, 0, nw, nh)
self.resize()
if \uidlog then uidlog.ivib_maindialog.canvas.restore()
end

#
Expand Down Expand Up @@ -932,7 +934,7 @@ $endif
#</p>
method compute_position()
local win,pp,px,py,pw,ph,dx,dy
win := parent.win # just to save some typing later...
win := parent.win # just to save some typing later...
if \self.abs_pos_flag then { # compute position relative to screen
pw := WAttrib(win,"displaywidth")
ph := WAttrib(win,"displayheight")
Expand All @@ -941,7 +943,7 @@ $endif
self.y := parse_pos(ph, self.y_spec) |
fatal("invalid y position specification: "||image(self.y_spec))
}
else { # compute position relative to parent window
else { # compute position relative to parent window
pp := WAttrib(win,"pos")
pp ? {
px := integer(1(tab(upto(",")),move(1)))
Expand Down
61 changes: 59 additions & 2 deletions uni/ide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@
BASE=../..
include $(BASE)/Makedefs.uni

ICONDIR=ivib/icon

ICONS=$(ICONDIR)/icn1.icon \
$(ICONDIR)/icn2.icon \
$(ICONDIR)/icn3.icon \
$(ICONDIR)/icn4.icon \
$(ICONDIR)/icn5.icon \
$(ICONDIR)/icn6.icon \
$(ICONDIR)/icn7.icon \
$(ICONDIR)/icn8.icon \
$(ICONDIR)/icn9.icon \
$(ICONDIR)/icn10.icon \
$(ICONDIR)/icn11.icon \
$(ICONDIR)/icn12.icon \
$(ICONDIR)/icn13.icon \
$(ICONDIR)/icn14.icon \
$(ICONDIR)/icn15.icon \
$(ICONDIR)/icn16.icon \
$(ICONDIR)/icn17.icon \
$(ICONDIR)/icn18.icon \
$(ICONDIR)/icn19.icon \
$(ICONDIR)/icn20.icon \
$(ICONDIR)/icn21.icon \
$(ICONDIR)/icn22.icon \
$(ICONDIR)/icn23.icon \
$(ICONDIR)/icn24.icon \
$(ICONDIR)/icn25.icon \
$(ICONDIR)/icn26.icon \
$(ICONDIR)/icn27.icon \
$(ICONDIR)/icn28.icon \
$(ICONDIR)/icn29.icon \
$(ICONDIR)/icn30.icon \
$(ICONDIR)/icn31.icon \
$(ICONDIR)/icn32.icon \
$(ICONDIR)/icon.icon

# needed to link idol.u
export IPATH:=$(UNI)/unicon

Expand All @@ -16,12 +52,14 @@ SRC=ui.icn ide.icn hfiledialog.icn buffertextlist.icn buffertabset.icn \
templates.icn definitions.icn uproject.icn \
classbrowser.icn tree.icn imgs.icn utags.icn matchparen.icn \
qu_replace.icn online.icn about.icn is_binary.icn ptyDispatcher.icn \
shelletl.icn funclookup.icn
shelletl.icn funclookup.icn ivibtab.icn


OBJ=ui.u ide.u hfiledialog.u buffertextlist.u buffertabset.u buffertabitem.u \
mainbar.u modified.u preferences.u templates.u definitions.u \
uproject.u classbrowser.u imgs.u utags.u matchparen.u qu_replace.u \
online.u about.u is_binary.u ptyDispatcher.u shelletl.u funclookup.u\
ivibtab.u

.PHONY: ivib

Expand All @@ -30,7 +68,7 @@ all: ivib ui
ivib:
cd ivib && $(MAKE)

ui: $(OBJ)
ui: $(OBJ) #$(UFILES)
$(UC) $(DASHG) -o ui $(OBJ)
$(CP) ui$(EXE) ../../bin

Expand Down Expand Up @@ -104,6 +142,9 @@ shelletl.u: shelletl.icn
classbrowser.u: classbrowser.icn imgs.u
$(UC) $(UFLAGS2) classbrowser

ivibtab.u: ivibtab.icn
$(UC) $(UFLAGS) ivibtab

#tree.u: tree.icn
# $(UC) $(UFLAGS2) tree

Expand All @@ -115,6 +156,22 @@ ui.u: ui.icn

ui.exe: ui

icons: $(ICONS)

cleanicons:
cd $(ICONDIR) ; \
$(RM) xpmtoims *.icon


# Program to translate xpm to Icon image format.
$(ICONDIR)/xpmtoims: $(ICONDIR)/xpmtoims.icn
$(UNICON) -o $(ICONDIR)/xpmtoims $(ICONDIR)/xpmtoims.icn


# Rule to translate xpm to icon image format.
$(ICONDIR)/%.icon: $(ICONDIR)/%.xpm $(ICONDIR)/xpmtoims
$(ICONDIR)/xpmtoims $< >$@

clean :
$(RM) *.u uniclass.dir uniclass.pag uniclass.db ui$(EXE)
cd ivib && $(MAKE) clean
14 changes: 12 additions & 2 deletions uni/ide/buffertabset.icn
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class BufferTabSet : TabSet()

if /last_on_a_line then
DrawLine(cw, which_one.label_x + which_one.label_w, y + tab_h - 2,
x + w - 1, y + tab_h - 2)
x + w - 1, y + tab_h - 2)

Fg(cw, "black")
DrawLine(cw, x, y + tab_h - 1, which_one.label_x, y + tab_h - 1)

if /last_on_a_line then
DrawLine(cw, which_one.label_x + which_one.label_w, y + tab_h - 1,
x + w - 2, y + tab_h - 1)
x + w - 2, y + tab_h - 1)

Uncouple(cw)

Expand All @@ -60,8 +60,18 @@ class BufferTabSet : TabSet()
# associated with current tab item
#
method set_which_one(x)
local currentFile
self.TabSet.set_which_one(x)
uidlog.set_focus(ide.CurrentEditBox())
if \uidlog.ivib_maindialog then if \uidlog.FileTabSet.get_which_one().filename then {
if \uidlog.FileTabSet.get_which_one().filedirectory then {
currentFile := uidlog.FileTabSet.get_which_one().filedirectory || uidlog.FileTabSet.get_which_one().filename
} else {
currentFile := uidlog.FileTabSet.get_which_one().filename
}
uidlog.ivib_maindialog.op_open_file(currentFile)
uidlog.ivib_maindialog.canvas.restore()
}
return x
end

Expand Down
Loading
Loading