File: commands.bsh

package info (click to toggle)
king 2.24%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 78,588 kB
  • sloc: java: 111,577; xml: 1,868; cpp: 209; perl: 127; sh: 102; python: 99; makefile: 60; ansic: 7
file content (92 lines) | stat: -rw-r--r-- 2,668 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import driftwood.data.*;
import driftwood.gui.*;
import driftwood.r3.*;
import driftwood.util.*;
import king.*;
import king.core.*;

help() {
    print("==== PREDEFINED VARIABLES ====");
    print("parent                   ToolBox containing the BeanKing plugin");
    print("kMain                    KingMain for this application");
    print("kCanvas                  KinCanvas for drawing operations");
    print("services                 ToolServices for picking, etc.");
    print("");
    print("==== PREDEFINED FUNCTIONS ====");
    print("help()                   this help text");
    print("editor()                 GUI for writing short scripts");
    print("setAccessibility(true)   allow access to non-public fields and methods");
    print("");
    print("bleach()                 removes point colors for all visible");
    print("delete(name?)            deletes all groups/subgroups/lists with given name");
    print("makeMaster(name?)        creates master for named group/subgroup/list");
    print("killMaster(name?)        removes all uses of named master");
    print("killAllMasters()         removes all masters from the kinemage completely");
    print("");
    print("source(getResource(\"/movies.bsh\"));");
    print("");
}
help(); // display this message on startup!

bleach() {
    kin = kMain.getKinemage();
    if(kin == null) return;
    for(pt : KIterator.visiblePoints(kin))
        pt.setColor(null);
}

delete()
{ delete(JOptionPane.showInputDialog("Name to delete:")); }

delete(String delName)
{
    if(delName == null) return;
    kin = kMain.getKinemage();
    if(kin == null) return;
    for(iter = KIterator.allNonPoints(kin); iter.hasNext(); )
    {
        age = iter.next();
        if(delName.equals(age.getName())) iter.remove();
    }
}

makeMaster()
{ makeMaster(JOptionPane.showInputDialog("Name to create master for:")); }

makeMaster(String masterName)
{
    if(masterName == null) return;
    kin = kMain.getKinemage();
    if(kin == null) return;
    for(age : KIterator.allNonPoints(kin))
    {
        if(masterName.equals(age.getName())) age.addMaster(masterName);
    }
}

killMaster()
{ killMaster(JOptionPane.showInputDialog("Name of master to delete:")); }

killMaster(String masterName)
{
    if(masterName == null) return;
    kin = kMain.getKinemage();
    if(kin == null) return;
    for(age : KIterator.allNonPoints(kin))
    {
        age.removeMaster(masterName);
    }
    kin.removeUnusedMasters();
}

killAllMasters()
{
    kin = kMain.getKinemage();
    if(kin == null) return;
    masters = new ArrayList(kin.masterList());
    for(m : masters)
    {
        killMaster(m.getName());
    }
}