~stuart/sandpad/internalfenv

« back to all changes in this revision

Viewing changes to sandpad.wlua

  • Committer: Stuart P. Bentley
  • Date: 2009-08-24 04:39:53 UTC
  • Revision ID: stuart@testtrack4.com-20090824043953-s16kgkt4yi8g8g1o
initial branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
      if stacklevel then
56
56
        if stacklevel==0 then
57
57
          return fake_G
58
 
        else if stacklevel>0
 
58
        elseif stacklevel>0 then
59
59
          return getfenv(stacklevel+1)
60
60
        end
61
61
      else
240
240
  iup.Update(returndata)
241
241
end
242
242
 
243
 
local nofile=true
244
243
boxes={ --individual box definitions
245
244
  --[[on env chains:
246
245
    each env runs from a shadow of the env above it,
266
265
      }
267
266
    },
268
267
    cls={
269
 
      nameclear=iup.button{title=strings.buttons.fileid,
270
 
        active="NO",padding="2x";
271
 
        action=function(self)
272
 
          boxes[1].cls.filename.value=""
273
 
          self.title=strings.buttons.fileid
274
 
          boxes[1].cls.astog.value="OFF"
275
 
          setactive(1,{"nameclear","astog","save"},"NO")
276
 
          nofile=true
277
 
        end},
278
 
      filename=iup.text{expand="HORIZONTAL",
279
 
        tip=strings.tips.filename;
280
 
        action=function(self,change,value)
281
 
          if value=="" then
282
 
            boxes[1].cls.nameclear.title=strings.buttons.fileid
283
 
            boxes[1].cls.astog.value="OFF"
284
 
            setactive(1,{"nameclear","astog","save"},"NO")
285
 
            nofile=true
286
 
          else
287
 
            if nofile then --wrong way to do this but
288
 
              boxes[1].cls.nameclear.title=strings.buttons.clear
289
 
              setactive(1,{"nameclear","astog"},"YES")
290
 
              nofile=false
291
 
            end
292
 
            boxes[1].cls.astog.value="OFF"
293
 
            setactive(1,"save","YES")
294
 
          end
295
 
        end},
296
 
      astog=iup.toggle{title=strings.pre.auto,value="OFF",
297
 
        active="NO",tip=strings.tips.auto.save;
298
 
        action=function(self,state)
299
 
          if state==1 then
300
 
            setactive(1,"save","NO")
301
 
          else
302
 
            setactive(1,"save","YES")
303
 
          end
304
 
        end
305
 
      },
306
 
      save=iup.button{title=strings.buttons.save,focusonclick="NO",
307
 
        active="NO",padding="2x";
308
 
        action=function()
309
 
        end
310
 
      },
311
 
      tgLua=iup.toggle{title=strings.combos.box1.lua, value="ON",
312
 
        tip=strings.tips.box1radio.lua},
313
 
      tgString=iup.toggle{title=strings.combos.box1.string,
314
 
        tip=strings.tips.box1radio.string},
315
 
      luable=iup.label{title="",expand="HORIZONTAL"}
 
268
    --development branched to branches/1.0/leftboxcontrols
316
269
    }
317
270
  },
318
271
  {--2
595
548
Sandpad=iup.dialog{title=strings.appname;
596
549
  iup.hbox{
597
550
    iup.vbox{
598
 
      iup.hbox{
599
 
        iup.hbox{
600
 
          boxes[1].cls.nameclear,
601
 
          boxes[1].cls.filename
602
 
          ;gap=2,margin="0x0",alignment="ACENTER"
603
 
        },
604
 
        iup.hbox{
605
 
          boxes[1].cls.astog,
606
 
          boxes[1].cls.save
607
 
          ;gap=-1,margin="0x0",alignment="ACENTER"
608
 
        }
609
 
        ;gap=4,margin=0,alignment="ACENTER"
610
 
      },
611
 
      boxes[1].text,
612
 
      iup.radio{
613
 
        iup.hbox{
614
 
          boxes[1].cls.tgString,
615
 
          boxes[1].cls.tgLua,
616
 
          boxes[1].cls.luable
617
 
        }
618
 
      }
 
551
      --development of filename in branches/1.0/leftboxcontrols
 
552
      boxes[1].text
 
553
      --development of string/Lua radio in branches/1.0/leftboxcontrols
619
554
      ;gap=4--,margin=0
620
555
    },
621
556
    iup.vbox{
652
587
  ;menu=iup.menu{
653
588
    iup.submenu{title=strings.menus.file.title;
654
589
      iup.menu{
655
 
        iup.item{title=strings.menus.file.open},
656
 
        iup.item{title=strings.menus.file.saveas},
657
 
        iup.item{title=strings.menus.file.new},
 
590
        --development of file options in branches/1.0/leftboxcontrols
658
591
        iup.item{title=strings.menus.file.clear,
659
592
          action=clearallboxes},
660
593
        iup.separator{},