Cursors
Cursors change based on content
This commit is contained in:
parent
ba704aa24c
commit
92533b7236
4 changed files with 43 additions and 3 deletions
|
@ -8,6 +8,7 @@ import datetime
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
import cairo
|
import cairo
|
||||||
import datetime
|
import datetime
|
||||||
import threading
|
import threading
|
||||||
|
@ -152,6 +153,7 @@ def run(project, win):
|
||||||
win.current["script_find"] = [0,0]
|
win.current["script_find"] = [0,0]
|
||||||
win.current["camera_arrived"] = False
|
win.current["camera_arrived"] = False
|
||||||
|
|
||||||
|
|
||||||
if "pointers" not in win.story:
|
if "pointers" not in win.story:
|
||||||
win.story["pointers"] = {} # List of text pointers per scene
|
win.story["pointers"] = {} # List of text pointers per scene
|
||||||
|
|
||||||
|
@ -236,6 +238,16 @@ def pmdrawing(pmdrawing, main_layer, win):
|
||||||
win.current['w'] = win.get_size()[0]
|
win.current['w'] = win.get_size()[0]
|
||||||
win.current['h'] = win.get_size()[1]
|
win.current['h'] = win.get_size()[1]
|
||||||
|
|
||||||
|
|
||||||
|
win.cursors = {
|
||||||
|
"arrow":Gdk.Cursor.new(Gdk.CursorType.ARROW),
|
||||||
|
"watch":Gdk.Cursor.new(Gdk.CursorType.WATCH),
|
||||||
|
"text" :Gdk.Cursor.new(Gdk.CursorType.XTERM),
|
||||||
|
"hand" :Gdk.Cursor.new(Gdk.CursorType.HAND1),
|
||||||
|
"cross":Gdk.Cursor.new(Gdk.CursorType.CROSS)
|
||||||
|
}
|
||||||
|
win.current["cursor"] = win.cursors["arrow"]
|
||||||
|
|
||||||
# Attemt to make things straight when pressing Ctrl.
|
# Attemt to make things straight when pressing Ctrl.
|
||||||
if 65507 in win.current["keys"] and win.current["LMB"]:
|
if 65507 in win.current["keys"] and win.current["LMB"]:
|
||||||
|
|
||||||
|
@ -355,6 +367,9 @@ def pmdrawing(pmdrawing, main_layer, win):
|
||||||
main_layer.set_source_surface(layer, 0 , 0)
|
main_layer.set_source_surface(layer, 0 , 0)
|
||||||
main_layer.paint()
|
main_layer.paint()
|
||||||
|
|
||||||
|
|
||||||
|
win.get_root_window().set_cursor(win.current["cursor"])
|
||||||
|
|
||||||
# If you press ESC you get back from any window to the main menu.
|
# If you press ESC you get back from any window to the main menu.
|
||||||
if 65307 in win.current["keys"] and win.url != "install_updates":
|
if 65307 in win.current["keys"] and win.url != "install_updates":
|
||||||
win.url = "story_editor"
|
win.url = "story_editor"
|
||||||
|
|
|
@ -66,6 +66,8 @@ def node_dot(layer, win, x, y, direction="in", entry="end"):
|
||||||
fill=False)
|
fill=False)
|
||||||
layer.stroke()
|
layer.stroke()
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["arrow"]
|
||||||
|
|
||||||
# Start drawing the line
|
# Start drawing the line
|
||||||
|
|
||||||
if not win.previous["LMB"] and win.current["LMB"] and direction != "in":
|
if not win.previous["LMB"] and win.current["LMB"] and direction != "in":
|
||||||
|
@ -359,7 +361,9 @@ def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0)
|
||||||
# Launching the item
|
# Launching the item
|
||||||
if int(win.current["mx"]) in range(int(x), int(x+width))\
|
if int(win.current["mx"]) in range(int(x), int(x+width))\
|
||||||
and int(win.current["my"]) in range(int(y), int(y+height)):
|
and int(win.current["my"]) in range(int(y), int(y+height)):
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["hand"]
|
||||||
|
|
||||||
if not win.current["LMB"] and win.previous["LMB"]\
|
if not win.current["LMB"] and win.previous["LMB"]\
|
||||||
and entry in win.story["selected"]\
|
and entry in win.story["selected"]\
|
||||||
and int(win.current["mx"]) == int(win.previous["LMB"][0])\
|
and int(win.current["mx"]) == int(win.previous["LMB"][0])\
|
||||||
|
@ -709,7 +713,9 @@ def link_node(outlayer, win, x, y, width=150, height=150, name="", num=0, linkty
|
||||||
# Launching the item
|
# Launching the item
|
||||||
if int(win.current["mx"]) in range(int(x), int(x+width))\
|
if int(win.current["mx"]) in range(int(x), int(x+width))\
|
||||||
and int(win.current["my"]) in range(int(y), int(y+height)):
|
and int(win.current["my"]) in range(int(y), int(y+height)):
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["hand"]
|
||||||
|
|
||||||
if not win.current["LMB"] and win.previous["LMB"]\
|
if not win.current["LMB"] and win.previous["LMB"]\
|
||||||
and entry in win.story["selected"]\
|
and entry in win.story["selected"]\
|
||||||
and int(win.current["mx"]) == int(win.previous["LMB"][0])\
|
and int(win.current["mx"]) == int(win.previous["LMB"][0])\
|
||||||
|
|
|
@ -1145,6 +1145,11 @@ def layer(win):
|
||||||
|
|
||||||
win.cur = "/"+scene
|
win.cur = "/"+scene
|
||||||
win.textactive = ""
|
win.textactive = ""
|
||||||
|
|
||||||
|
if int(win.current["my"]) in range(int(y+win.scroll["script"] + current_Y), int(y+win.scroll["script"] + current_Y)+25)\
|
||||||
|
and int(win.current["mx"]-x) in range(tileX, tileX+len(word)*12+12):
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["text"]
|
||||||
|
|
||||||
# This is the logic to draw our selection and logic that
|
# This is the logic to draw our selection and logic that
|
||||||
# come with the selection.
|
# come with the selection.
|
||||||
|
|
|
@ -768,6 +768,14 @@ def layer(win):
|
||||||
stf = datetime.datetime.now()
|
stf = datetime.datetime.now()
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
|
if win.url == "story_editor"\
|
||||||
|
and int(win.current["mx"]) in range(50, int(win.current["w"]-50)) \
|
||||||
|
and int(win.current["my"]) in range(50, int(win.current["h"]-30)):
|
||||||
|
|
||||||
|
# The cross cursor
|
||||||
|
win.current["cursor"] = win.cursors["cross"]
|
||||||
|
|
||||||
|
|
||||||
####### NODES #######
|
####### NODES #######
|
||||||
|
|
||||||
# Clipping so it wont draw beyon the frame
|
# Clipping so it wont draw beyon the frame
|
||||||
|
@ -1099,6 +1107,8 @@ def layer(win):
|
||||||
fill=False)
|
fill=False)
|
||||||
layer.stroke()
|
layer.stroke()
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["arrow"]
|
||||||
|
|
||||||
if win.current["LMB"] and not win.previous["LMB"]:
|
if win.current["LMB"] and not win.previous["LMB"]:
|
||||||
|
|
||||||
win.current["tool"] = "scale"
|
win.current["tool"] = "scale"
|
||||||
|
@ -1127,6 +1137,8 @@ def layer(win):
|
||||||
|
|
||||||
if win.current["tool"] == "connect":
|
if win.current["tool"] == "connect":
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["arrow"]
|
||||||
|
|
||||||
if not win.current["LMB"]:
|
if not win.current["LMB"]:
|
||||||
win.current["tool"] = "selection"
|
win.current["tool"] = "selection"
|
||||||
|
|
||||||
|
@ -1181,7 +1193,9 @@ def layer(win):
|
||||||
savenow = True
|
savenow = True
|
||||||
|
|
||||||
if savenow:
|
if savenow:
|
||||||
|
|
||||||
|
win.current["cursor"] = win.cursors["watch"]
|
||||||
|
|
||||||
# Now let's run the history record.
|
# Now let's run the history record.
|
||||||
story.undo_record(win)
|
story.undo_record(win)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue