All pastes #606898 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-07-07 05:36 UTC
rendered paste body
collections {
  group {
    name: "test";
    parts {
      part {
        name: "a";
        type: RECT;
        description {
          state: "default" 0.0;
          color: 0 0 0 255;
          rel2.relative: 0.5 1;
        }
        description {
          state: "01" 0.0;
          inherit: "default" 0.0;
          color: 0 120 0 255;
        }
        description {
          state: "10" 0.0;
          inherit: "default" 0.0;
          color: 120 0 0 255;
        }
        description {
          state: "11" 0.0;
          inherit: "default" 0.0;
          color: 120 120 0 255;
        }
      }
      part {
        name: "b";
        type: RECT;
        description {
          state: "default" 0.0;
          color: 255 255 255 255;
          rel1.relative: 0.5 0;
        }
        description {
          state: "01" 0.0;
          inherit: "default" 0.0;
          color: 255 255 120 255;
        }
        description {
          state: "10" 0.0;
          inherit: "default" 0.0;
          color: 255 120 255 255;
        }
        description {
          state: "11" 0.0;
          inherit: "default" 0.0;
          color: 255 120 120 255;
        }
      }
    }
    programs {
      program {
        name: "toggle1";
        signal: "mouse,down,1";
        source: "*";
        script {
          set_int(s1, !get_int(s1));
          update();
        }
      }
      program {
        name: "toggle2";
        signal: "mouse,down,2";
        source: "*";
        script {
          set_int(s2, !get_int(s2));
          update();
        }
      }
    }
    script {
      public s1 = 0;
      public s2 = 0;
      public update() {
        if (get_int(s1) == 0) {
          if (get_int(s2) == 0) {
            set_state(PART:"a", "default", 0.0);
            set_state(PART:"b", "default", 0.0);
          } else {
            set_state(PART:"a", "01", 0.0);
            set_state(PART:"b", "01", 0.0);
          }
        } else {
          if (get_int(s2) == 0) {
            set_state(PART:"a", "10", 0.0);
            set_state(PART:"b", "10", 0.0);
          } else {
            set_state(PART:"a", "11", 0.0);
            set_state(PART:"b", "11", 0.0);
          }
        }
      }
    }
  }
}