<commit_before>(ns nightmod.core.desktop-launcher
  (:require [clojure.java.io :as io]
            [nightmod.core :refer :all]
            [nightcode.core :as core]
            [nightcode.editors :as editors]
            [nightcode.dialogs :as dialogs]
            [nightcode.shortcuts :as shortcuts]
            [nightcode.ui :as ui]
            [nightcode.utils :as utils]
            [seesaw.core :as s]
            [seesaw.util :as s-util])
  (:import [java.awt BorderLayout Canvas Dimension Window]
           [java.awt.event ComponentAdapter WindowAdapter]
           [javax.swing JLayeredPane]
           [com.badlogic.gdx.backends.lwjgl LwjglApplication]
           [org.lwjgl.input Keyboard]
           [org.pushingpixels.substance.api SubstanceLookAndFeel]
           [org.pushingpixels.substance.api.skin GraphiteSkin])
  (:gen-class))

; allow s/select to work with Canvas
(extend-protocol s-util/Children
  java.awt.Component (children [this] nil))

(def ^:const window-width 1200)
(def ^:const window-height 768)
(def ^:const editor-width 700)

(def ^:dynamic editor-controls [:save :undo :redo :font-dec :font-inc
                                :doc :paredit :paredit-help])

(defn create-layered-pane
  "Returns the pane with the editors."
  []
  (let [pane (s/card-panel :id :editor-pane :items [["" :default-card]])]
    (doto (JLayeredPane.)
      (.setPreferredSize (Dimension. editor-width window-height))
      (.addComponentListener (proxy [ComponentAdapter] []
                               (componentResized [e]
                                 (->> (.getComponent e)
                                      .getHeight
                                      (.setBounds pane 0 0 editor-width)))))
      (.add pane))))

(defn create-canvas-pane<commit_msg>Create editor pane with nightcode function<commit_after>(ns nightmod.core.desktop-launcher
  (:require [clojure.java.io :as io]
            [nightmod.core :refer :all]
            [nightcode.core :as core]
            [nightcode.editors :as editors]
            [nightcode.dialogs :as dialogs]
            [nightcode.shortcuts :as shortcuts]
            [nightcode.ui :as ui]
            [nightcode.utils :as utils]
            [seesaw.core :as s]
            [seesaw.util :as s-util])
  (:import [java.awt BorderLayout Canvas Dimension Window]
           [java.awt.event ComponentAdapter WindowAdapter]
           [javax.swing JLayeredPane]
           [com.badlogic.gdx.backends.lwjgl LwjglApplication]
           [org.lwjgl.input Keyboard]
           [org.pushingpixels.substance.api SubstanceLookAndFeel]
           [org.pushingpixels.substance.api.skin GraphiteSkin])
  (:gen-class))

; allow s/select to work with Canvas
(extend-protocol s-util/Children
  java.awt.Component (children [this] nil))

(def ^:const window-width 1200)
(def ^:const window-height 768)
(def ^:const editor-width 700)

(def ^:dynamic editor-controls [:save :undo :redo :font-dec :font-inc
                                :doc :paredit :paredit-help])

(defn create-layered-pane
  "Returns the pane with the editors."
  []
  (let [pane (core/create-editor-pane)]
    (doto (JLayeredPane.)
      (.setPreferredSize (Dimension. editor-width window-height))
      (.addComponentListener (proxy [ComponentAdapter] []
                               (componentResized [e]
                                 (->> (.getComponent e)
                                      .getHeight
                                      (.setBounds pane 0 0 editor-width)))))
      (.add pane))))

(defn create-canvas-pane
{'fraction_non_alphanumeric': 0.11623979735434843, 'fraction_numerical': 0.006754855052068675, 'mean_word_length': 2.0428082191780823, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4149273', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1078, 'n_words': 252}