<commit_before>
import "../HomestuckDollLib.dart";
import "dart:html";
import "../DollLib/DollRenderer.dart";
import "../DollMakerTools.dart";
import "../navbar.dart";
import "BaseController.dart";

QueenController controller;

void main() {
    print("Hello World");
    loadNavbar();
    Random rand = new Random();
    Doll doll = new QueenDoll();
    CanvasElement canvas = new CanvasElement(width: doll.width, height: doll.height);
    querySelector("#doll").append(canvas);
    controller = new QueenController(doll,canvas);
    print("going to load doll");
    loadDoll();
    //bundle means i don't have to preload shit
    //Renderer.loadHomestuckDollParts(doll, loadDoll);

}

void loadDoll() {
    print("loading doll");
    String dataString = window.location.search;
    print("dataSTring is $dataString");
    if(dataString.isNotEmpty) {
       controller.doll = new QueenDoll.fromDataString(dataString.substring(1)); //chop off leading ?
    }

    //whether i loaded or not, it's time to draw.
    controller.setupForms();
    controller.drawDollCreator();
}


class QueenController extends BaseController {
  QueenController(Doll doll, CanvasElement canvas) : super(doll, canvas);

  @override
  void drawDollCreator([bool inQueue = false]) {
      print("Draw doll creator");
      Renderer.clearCanvas(canvas);
      Renderer.drawDoll(canvas, doll);
      TextAreaElement dataBox = querySelector("#shareableURL");
      dataBox.value = "${window.location.origin}${window.location.pathname}?${doll.toDataBytesX()}";
      actionQueue.add(doll.toDataBytesX());
      if(!inQueue) {
          actionQueueIndex = actionQueue.length-1;
      }
  }


@override
  void randomizeDoll() {
      print("randomizing and redrawing");
      doll.randomize();
      //can't do it in regular draw part cuz onChange is a bitch.
      DollMakerTools.syncColorPickersToSprite(doll.palette);
      drawLayerControls();
      drawDollCreator();
  }

  @override
  void randomizeDollNotColors() {
      print("randomizing and redrawing");
      doll.randomizeNotColors();
      //can't do it in regular draw part cuz onChange is a bitch.
      DollMakerTools.syncColorPickersToSprite(doll.palette);
      drawDollCreator();
      drawLayerControls();
  }


@override
  void setupForms() {
      querySelector("#randomize").onClick.listen((e) => randomizeDoll());
      querySelector("#randomizeColors").onClick.listen((e) => randomizeDollColors());<commit_msg>there we go<commit_after>
import "../HomestuckDollLib.dart";
import "dart:html";
import "../DollLib/DollRenderer.dart";
import "../DollMakerTools.dart";
import "../navbar.dart";
import "BaseController.dart";

QueenController controller;

void main() {
    print("Hello World");
    loadNavbar();
    Random rand = new Random();
    Doll doll = new QueenDoll();
    CanvasElement canvas = new CanvasElement(width: doll.width, height: doll.height);
    querySelector("#doll").append(canvas);
    controller = new QueenController(doll,canvas);
    print("going to load doll");
    loadDoll();
    //bundle means i don't have to preload shit
    //Renderer.loadHomestuckDollParts(doll, loadDoll);

}

void loadDoll() {
    print("loading doll");
    String dataString = window.location.search;
    print("dataSTring is $dataString");
    if(dataString.isNotEmpty) {
       controller.doll = new QueenDoll.fromDataString(dataString.substring(1)); //chop off leading ?
    }

    //whether i loaded or not, it's time to draw.
    controller.setupForms();
    controller.drawDollCreator();
}


class QueenController extends BaseController {
  QueenController(Doll doll, CanvasElement canvas) : super(doll, canvas);

  @override
  void drawDollCreator([bool inQueue = false]) {
      print("Draw doll creator");
      Renderer.clearCanvas(canvas);
      Renderer.drawDoll(canvas, doll);
      TextAreaElement dataBox = querySelector("#shareableURL");
      dataBox.value = "${window.location.origin}${window.location.pathname}?${doll.toDataBytesX()}";
      //don't add it to the queue if you're already messing around in it, dunkass. you'll never escape the loop.
      if(!inQueue) {
          actionQueue.add(doll.toDataBytesX());
          actionQueueIndex = actionQueue.length-1;
      }
  }


@override
  void randomizeDoll() {
      print("randomizing and redrawing");
      doll.randomize();
      //can't do it in regular draw part cuz onChange is a bitch.
      DollMakerTools.syncColorPickersToSprite(doll.palette);
      drawLayerControls();
      drawDollCreator();
  }

  @override
  void randomizeDollNotColors() {
      print("randomizing and redrawing");
      doll.randomizeNotColors();
      //can't do it in regular draw part cuz onChange is a bitch.
      DollMakerTools.syncColorPickersToSprite(doll.palette);
      drawDollCreator();
      drawLayerControls();
  }


@override
  void setupForms() {
      querySelector("#randomize").onClick.listen((e) => randomizeDoll());
      querySelector("#randomizeColors").onClick.listen((e) => randomizeDollColors());
{'fraction_non_alphanumeric': 0.12919896640826872, 'fraction_numerical': 0.000795070562512423, 'mean_word_length': 3.702803738317757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219346', 'n_tokens_mistral': 1543, 'n_tokens_neox': 1501, 'n_words': 346}