int iup_pplotlua_open(lua_State * L) { if (iuplua_opencall_internal(L)) IupPPlotOpen(); iuplua_get_env(L); iuppplotlua_open(L); return 0; }
VALUE rb_IupPPlot(VALUE self) { extern VALUE rb_cIupPPlot; Ihandle* v; if(!PPlotOpen) { IupPPlotOpen(); PPlotOpen = 1; } v = IupPPlot(); if(v) return rb_funcall(rb_cIupPPlot,rb_intern("new"),1,ULONG2NUM((unsigned long)v)); return Qnil; }
/* main */ int main(int argc, char **argv) { Ihandle *vboxr[MAXPLOT+1]; /* tabs containing the plots */ Ihandle *dlg, *vboxl, *hbox, *lbl1, *lbl2, *lbl3, *bt1, *boxinfo, *boxdial1, *boxdial2, *f1, *f2; int ii; IupOpen(&argc, &argv); // init IUP IupControlsOpen(); // init the addicional controls library (we use IupTabs) IupPPlotOpen(); // init IupPPlot library // cdInitGdiPlus(); // create plots for (ii=0; ii<MAXPLOT; ii++) plot[ii] = IupPPlot(); // left panel: plot control // Y zooming dial1 = IupDial("VERTICAL"); lbl1 = IupLabel("+"); lbl2 = IupLabel("-"); boxinfo = IupVbox(lbl1, IupFill(), lbl2, NULL); boxdial1 = IupHbox(boxinfo, dial1, NULL); IupSetAttribute(boxdial1, "ALIGNMENT", "ACENTER"); IupSetAttribute(boxinfo, "ALIGNMENT", "ACENTER"); IupSetAttribute(boxinfo, "SIZE", "20x52"); IupSetAttribute(boxinfo, "GAP", "2"); IupSetAttribute(boxinfo, "MARGIN", "4"); IupSetAttribute(boxinfo, "EXPAND", "YES"); IupSetAttribute(lbl1, "EXPAND", "NO"); IupSetAttribute(lbl2, "EXPAND", "NO"); IupSetAttribute(dial1, "ACTIVE", "NO"); IupSetAttribute(dial1, "SIZE", "20x52"); IupSetCallback(dial1, "BUTTON_PRESS_CB", (Icallback)dial1_btndown_cb); IupSetCallback(dial1, "MOUSEMOVE_CB", (Icallback)dial1_btnup_cb); IupSetCallback(dial1, "BUTTON_RELEASE_CB", (Icallback)dial1_btnup_cb); tgg1 = IupToggle("Y Autoscale", NULL); IupSetCallback(tgg1, "ACTION", (Icallback)tgg1_cb); IupSetAttribute(tgg1, "VALUE", "ON"); f1 = IupFrame( IupVbox(boxdial1, tgg1, NULL) ); IupSetAttribute(f1, "TITLE", "Y Zoom"); // X zooming dial2 = IupDial("HORIZONTAL"); lbl1 = IupLabel("-"); lbl2 = IupLabel("+"); boxinfo = IupHbox(lbl1, IupFill(), lbl2, NULL); boxdial2 = IupVbox(dial2, boxinfo, NULL); IupSetAttribute(boxdial2, "ALIGNMENT", "ACENTER"); IupSetAttribute(boxinfo, "ALIGNMENT", "ACENTER"); IupSetAttribute(boxinfo, "SIZE", "64x16"); IupSetAttribute(boxinfo, "GAP", "2"); IupSetAttribute(boxinfo, "MARGIN", "4"); IupSetAttribute(boxinfo, "EXPAND", "HORIZONTAL"); IupSetAttribute(lbl1, "EXPAND", "NO"); IupSetAttribute(lbl2, "EXPAND", "NO"); IupSetAttribute(dial2, "ACTIVE", "NO"); IupSetAttribute(dial2, "SIZE", "64x16"); IupSetCallback(dial2, "BUTTON_PRESS_CB", (Icallback)dial2_btndown_cb); IupSetCallback(dial2, "MOUSEMOVE_CB", (Icallback)dial2_btnup_cb); IupSetCallback(dial2, "BUTTON_RELEASE_CB", (Icallback)dial2_btnup_cb); tgg2 = IupToggle("X Autoscale", NULL); IupSetCallback(tgg2, "ACTION", (Icallback)tgg2_cb); f2 = IupFrame( IupVbox(boxdial2, tgg2, NULL) ); IupSetAttribute(f2, "TITLE", "X Zoom"); lbl1 = IupLabel(""); IupSetAttribute(lbl1, "SEPARATOR", "HORIZONTAL"); tgg3 = IupToggle("Vertical Grid", NULL); IupSetCallback(tgg3, "ACTION", (Icallback)tgg3_cb); tgg4 = IupToggle("Horizontal Grid", NULL); IupSetCallback(tgg4, "ACTION", (Icallback)tgg4_cb); lbl2 = IupLabel(""); IupSetAttribute(lbl2, "SEPARATOR", "HORIZONTAL"); tgg5 = IupToggle("Legend", NULL); IupSetCallback(tgg5, "ACTION", (Icallback)tgg5_cb); lbl3 = IupLabel(""); IupSetAttribute(lbl3, "SEPARATOR", "HORIZONTAL"); bt1 = IupButton("Export PDF", NULL); IupSetCallback(bt1, "ACTION", (Icallback)bt1_cb); vboxl = IupVbox(f1, f2, lbl1, tgg3, tgg4, lbl2, tgg5, lbl3, bt1, NULL); IupSetAttribute(vboxl, "GAP", "4"); IupSetAttribute(vboxl, "EXPAND", "NO"); // right panel: tabs with plots for (ii=0; ii<MAXPLOT; ii++) { vboxr[ii] = IupVbox(plot[ii], NULL); // each plot a tab IupSetfAttribute(vboxr[ii], "TABTITLE", "Plot %d", ii); // name each tab } vboxr[MAXPLOT] = NULL; // mark end of vector tabs = IupTabsv(vboxr); // create tabs IupSetCallback(tabs, "TABCHANGE_CB", (Icallback)tabs_tabchange_cb); // dialog hbox = IupHbox(vboxl, tabs, NULL); IupSetAttribute(hbox, "MARGIN", "4x4"); IupSetAttribute(hbox, "GAP", "10"); dlg = IupDialog(hbox); IupSetAttributes(dlg, "SIZE=500x240" ); IupSetAttribute(dlg, "TITLE", "IupPPlot Example"); InitPlots(); // It must be able to be done independent of dialog Mapping tabs_tabchange_cb(tabs, vboxr[0]); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); IupSetAttribute(dlg, "SIZE", NULL); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int main ( int argc, char **argv ) { IupOpen(&argc, &argv); #ifndef IUPLUA_NO_GL IupGLCanvasOpen(); #endif #ifndef IUPLUA_NO_CD IupControlsOpen(); IupPPlotOpen(); #endif lua_open(); lua_setdebug(1); lua_iolibopen( ); lua_strlibopen( ); lua_mathlibopen( ); iuplua_open( ); iupkey_open( ); #ifndef IUPLUA_NO_GL iupgllua_open(); #endif #ifndef IUPLUA_NO_CD iupcontrolslua_open(); iup_pplotlua_open(); cdlua_open(); cdluaiup_open(); #endif #ifndef IUPLUA_NO_IM iupimlua_open(); imlua_open(); #endif if (argc <= 1) { if(!iuplua_dofile("console3.lua")) { #ifdef TEC_BIGENDIAN #ifdef TEC_64 #include "loh/console3_be64.loh" #else #include "loh/console3_be32.loh" #endif #else #ifdef TEC_64 #ifdef WIN64 #include "loh/console3_le64w.loh" #else #include "loh/console3_le64.loh" #endif #else #include "loh/console3.loh" #endif #endif } } else { int ok = 1, i = 1; /* Running all .lua given as arguments */ while(ok & (i < argc)) { ok = iuplua_dofile(argv[i]); i++; } if(!ok) { return EXIT_FAILURE; } } #ifndef IUPLUA_NO_CD cdlua_close(); IupControlsClose(); #endif IupClose(); lua_close(); return EXIT_SUCCESS; }
VALUE rb_IupPPlotOpen(VALUE self) { IupPPlotOpen(); return Qnil; }