working on immerse subplot window

This commit is contained in:
Thomas Breloff 2015-09-15 17:54:40 -04:00
parent 24b5e7ff09
commit 9b0a645a05
2 changed files with 58 additions and 15 deletions

View File

@ -64,25 +64,67 @@ end
# ------------------------------- # -------------------------------
# function buildSubplotObject!(::ImmersePackage, subplt::Subplot)
# end
# create the underlying object
function buildSubplotObject!(::ImmersePackage, subplt::Subplot) function buildSubplotObject!(::ImmersePackage, subplt::Subplot)
subplt.o = (nothing, nothing)
# box, tb, c = createPlotGuiComponents()
vsep = Gtk.ShortNames.@Box(:v)
# now we create the GUI
i = 0
rows = []
for rowcnt in subplt.layout.rowcounts
# create a new row and add it to the main Box vsep
row = Gtk.ShortNames.@Box(:h)
push!(vsep, row)
# now add the plot components to the row
for plt in subplt.plts[(1:rowcnt) + i]
# get the components... box is the main plot GtkBox, and canvas is the GtkCanvas where it's plotted
box, toolbar, canvas = Immerse.createPlotGuiComponents()
# create and save the Figure
plt.o = (figure(canvas), plt.o[2])
# add the plot's box to the row
push!(row, box)
end
# push!(rows, Gadfly.hstack([getGadflyContext(plt.plotter, plt) for plt in subplt.plts[(1:rowcnt) + i]]...))
i += rowcnt
end
d = subplt.initargs
w,h = d[:size]
win = Gtk.ShortNames.@GtkWindow(vsep, d[:windowtitle], w, h)
guidata[win, :toolbar] = tb
if closecb !== nothing
Gtk.ShortNames.on_signal_destroy(closecb, win)
end
showall(win)
subplt.o = win
end end
# # create the underlying object
# function buildSubplotObject!(::ImmersePackage, subplt::Subplot)
# subplt.o = (nothing, nothing)
# end
function Base.display(::ImmersePackage, subplt::Subplot) function Base.display(::ImmersePackage, subplt::Subplot)
fig, gctx = subplt.o # fig, gctx = subplt.o
if fig == nothing # if fig == nothing
fig = createImmerseFigure(subplt.initargs) # fig = createImmerseFigure(subplt.initargs)
subplt.o = (fig, gctx) # subplt.o = (fig, gctx)
end # end
newfig = Immerse.Figure(fig.canvas) # newfig = Immerse.Figure(fig.canvas)
newfig.cc = buildGadflySubplotContext(subplt) # newfig.cc = buildGadflySubplotContext(subplt)
display(newfig) # display(newfig)
# o is the window... show it
showall(subplt.o)
end end

View File

@ -118,8 +118,9 @@ function plotter()
elseif currentPackageSymbol == :immerse elseif currentPackageSymbol == :immerse
try try
@eval import Immerse, Gadfly @eval import Immerse, Gadfly, Gtk.ShortNames
@eval export Immerse, Gadfly @eval export Immerse, Gadfly
global const GTK = Gtk.ShortNames
catch catch
error("Couldn't import Immerse. Install it with: Pkg.add(\"Immerse\")") error("Couldn't import Immerse. Install it with: Pkg.add(\"Immerse\")")
end end