mirror of
https://github.com/unclebob/more-speech.git
synced 2024-09-30 02:21:02 +00:00
Added the edit window. Non-functional.
This commit is contained in:
parent
e9ce907495
commit
1f6273f334
5
issues
Normal file
5
issues
Normal file
@ -0,0 +1,5 @@
|
||||
* Something is wrong with threading, articles appear more than once.
|
||||
This makes the up and down arrow selection malfunction.
|
||||
|
||||
* Layout Manager. A better way of computing window positions and sizes.
|
||||
|
@ -23,6 +23,7 @@
|
||||
[more-speech.ui.header-window :refer [->header-window-controls]]
|
||||
[more-speech.ui.article-window :refer [->article-window-controls]]
|
||||
[more-speech.ui.author-window :refer [->author-window-controls]]
|
||||
[more-speech.ui.edit-window :refer [->edit-window-controls]]
|
||||
[more-speech.ui.graphics :as g]
|
||||
[more-speech.nostr.events :as events]
|
||||
[more-speech.ui.config :as config]))
|
||||
@ -76,10 +77,18 @@
|
||||
article-window-height (- screen-height
|
||||
article-window-top
|
||||
config/article-window-bottom-margin)
|
||||
author-window-top-margin (:top-margin config/author-window-dimensions)
|
||||
author-window-top (:top-margin config/author-window-dimensions)
|
||||
author-window-left-margin (:left-margin config/author-window-dimensions)
|
||||
author-window-width (:width config/author-window-dimensions)
|
||||
author-window-height (* screen-height (:height-fraction config/author-window-dimensions))]
|
||||
author-window-height (* screen-height (:height-fraction config/author-window-dimensions))
|
||||
author-window-left (+ header-window-left author-window-left-margin header-window-width)
|
||||
author-window-width (g/pos-width graphics author-window-width)
|
||||
|
||||
edit-window-top (+ author-window-top author-window-height (:top-margin config/edit-window-dimensions))
|
||||
edit-window-left author-window-left
|
||||
edit-window-width (g/pos-width graphics (:width config/edit-window-dimensions))
|
||||
edit-window-height (- screen-height edit-window-top (:bottom-margin config/edit-window-dimensions))
|
||||
]
|
||||
|
||||
(assoc application
|
||||
:this-update #{}
|
||||
@ -109,11 +118,19 @@
|
||||
|
||||
:author-window (map->text-window
|
||||
{:title "Authors"
|
||||
:x (+ header-window-left author-window-left-margin header-window-width)
|
||||
:y author-window-top-margin
|
||||
:w (g/pos-width graphics author-window-width)
|
||||
:x author-window-left
|
||||
:y author-window-top
|
||||
:w author-window-width
|
||||
:h author-window-height
|
||||
:controls (->author-window-controls)})
|
||||
|
||||
:edit-window (map->text-window
|
||||
{:title "Compose an article."
|
||||
:x edit-window-left
|
||||
:y edit-window-top
|
||||
:w edit-window-width
|
||||
:h edit-window-height
|
||||
:controls (->edit-window-controls)})
|
||||
)
|
||||
))
|
||||
|
||||
|
@ -22,18 +22,22 @@
|
||||
|
||||
(def header-window-dimensions
|
||||
{:x 20 :y 10
|
||||
:width 105 ;window width in chars
|
||||
:text-width 95 ;header text width in chars
|
||||
:width 100 ;window width in chars
|
||||
:text-width 90 ;header text width in chars
|
||||
:left-margin 20 ;px
|
||||
:height-fraction 5/8 ;of screen
|
||||
})
|
||||
|
||||
(def header-lines 2)
|
||||
(def header-top-margin 2)
|
||||
(def header-bottom-margin 2)
|
||||
|
||||
(def article-window-top-margin 10)
|
||||
(def article-window-bottom-margin 10)
|
||||
|
||||
(def article-window-dimensions
|
||||
{
|
||||
:text-width 98
|
||||
:text-width 90
|
||||
})
|
||||
|
||||
(def author-window-dimensions
|
||||
@ -45,6 +49,13 @@
|
||||
:height-fraction 1/4
|
||||
})
|
||||
|
||||
(def header-lines 2)
|
||||
(def header-top-margin 2)
|
||||
(def header-bottom-margin 2)
|
||||
(def edit-window-dimensions
|
||||
{
|
||||
:left-margin 10
|
||||
:top-margin 10
|
||||
:width 100
|
||||
:text-width 90
|
||||
:bottom-margin 10
|
||||
})
|
||||
|
||||
|
||||
|
14
src/more_speech/ui/edit_window.clj
Normal file
14
src/more_speech/ui/edit_window.clj
Normal file
@ -0,0 +1,14 @@
|
||||
(ns more-speech.ui.edit-window
|
||||
(:require [more-speech.ui.text-window :refer [text-window-controls]]))
|
||||
|
||||
(defrecord edit-window-controls []
|
||||
text-window-controls
|
||||
(get-element-height [_controls _state]
|
||||
1)
|
||||
(draw-elements [_controls state _frame]
|
||||
state)
|
||||
(update-elements [_controls state _frame]
|
||||
state)
|
||||
(key-pressed [_controls state _frame _key]
|
||||
state)
|
||||
)
|
Loading…
Reference in New Issue
Block a user