push
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// Font metrics bitfield
|
||||
/// Include leading A width and trailing C width in GetWidth() or in DrawText()
|
||||
#define INCLUDE_AC (1<<0)
|
||||
|
||||
DEFINE_BITFIELD(font_flags, list(
|
||||
"INCLUDE_AC" = INCLUDE_AC,
|
||||
))
|
||||
@@ -12,19 +12,28 @@ GLOBAL_LIST_INIT_TYPED(screentip_context_icons, /image, prepare_screentip_contex
|
||||
* # Builds context with each intent for this key
|
||||
* Args:
|
||||
* - context = list (REQUIRED)
|
||||
* - context[key] = list (REQUIRED)
|
||||
* - key = string (REQUIRED)
|
||||
* - allow_image = boolean (not required)
|
||||
*/
|
||||
/proc/build_context(list/context, key, allow_image)
|
||||
if(!(length(context) && length(context[key]) && key))
|
||||
return ""
|
||||
var/list/to_add
|
||||
for(var/intent in context[key])
|
||||
var/key_help = "[length(key) > 3 ? "[copytext(key, 1, -3)][allow_image ? " " : ""]" : ""]"
|
||||
var/icon = "[copytext(key, -3)]-[intent]"
|
||||
// Get everything but the mouse button, may be empty
|
||||
var/key_combo = length(key) > 3 ? "[copytext(key, 1, -3)]" : ""
|
||||
// Grab the mouse button, LMB/RMB+intent
|
||||
var/button = "[copytext(key, -3)]-[intent]"
|
||||
if(allow_image)
|
||||
icon = "\icon[GLOB.screentip_context_icons[icon]]"
|
||||
LAZYADD(to_add, "[key_help][icon]: [context[key][intent]]")
|
||||
// Compile into image, if allowed
|
||||
button = "\icon[GLOB.screentip_context_icons[button]]"
|
||||
LAZYADD(to_add, "[key_combo][button][allow_image ? "" : ":"] [context[key][intent]]")
|
||||
|
||||
var/separator = "[allow_image ? " " : " | "]"
|
||||
// Prepare separator for same button but different intent
|
||||
var/separator = "[allow_image ? " " : " / "]"
|
||||
|
||||
// Voilá, final result
|
||||
return english_list(to_add, "", separator, separator)
|
||||
|
||||
#undef HINT_ICON_FILE
|
||||
|
||||
+78
-79
@@ -1449,99 +1449,98 @@
|
||||
//Update the screentip to reflect what we're hoverin over
|
||||
/atom/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
// Screentips
|
||||
|
||||
var/mob/user = usr
|
||||
if(isnull(user) && !user.client)
|
||||
if(isnull(user))
|
||||
return
|
||||
if(!GET_CLIENT(user))
|
||||
return
|
||||
|
||||
// Screentips
|
||||
var/datum/hud/active_hud = user.hud_used
|
||||
if(active_hud)
|
||||
var/screentips_enabled = user.client.prefs.screentip_pref
|
||||
if(screentips_enabled == SCREENTIP_PREFERENCE_DISABLED || (flags_1 & NO_SCREENTIPS_1))
|
||||
active_hud.screentip_text.maptext = ""
|
||||
else
|
||||
active_hud.screentip_text.maptext_y = 0
|
||||
var/lmb_rmb_line = ""
|
||||
var/ctrl_lmb_ctrl_rmb_line = ""
|
||||
var/alt_lmb_alt_rmb_line = ""
|
||||
var/shift_lmb_ctrl_shift_lmb_line = ""
|
||||
var/extra_lines = 0
|
||||
var/extra_context = ""
|
||||
if(!active_hud)
|
||||
return
|
||||
|
||||
if ((isliving(user) || isovermind(user) || isaicamera(user)) && (user.client.prefs.screentip_pref != SCREENTIP_PREFERENCE_NO_CONTEXT))
|
||||
var/obj/item/held_item = user.get_active_held_item()
|
||||
var/allow_images = user.client.prefs.screentip_allow_images
|
||||
var/screentips_enabled = user.client.prefs.screentip_pref
|
||||
if(screentips_enabled == SCREENTIP_PREFERENCE_DISABLED || (flags_1 & NO_SCREENTIPS_1))
|
||||
active_hud.screentip_text.maptext = ""
|
||||
return
|
||||
|
||||
if (flags_1 & HAS_CONTEXTUAL_SCREENTIPS_1 || held_item?.item_flags & ITEM_HAS_CONTEXTUAL_SCREENTIPS)
|
||||
var/list/context = list()
|
||||
active_hud.screentip_text.maptext_y = 10 // 10px lines us up with the action buttons top left corner
|
||||
var/lmb_rmb_line = ""
|
||||
var/ctrl_lmb_ctrl_rmb_line = ""
|
||||
var/alt_lmb_alt_rmb_line = ""
|
||||
var/shift_lmb_ctrl_shift_lmb_line = ""
|
||||
var/extra_lines = 0
|
||||
var/extra_context = ""
|
||||
|
||||
var/contextual_screentip_returns = \
|
||||
SEND_SIGNAL(src, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, context, held_item, user) \
|
||||
| (held_item && SEND_SIGNAL(held_item, COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET, context, src, user))
|
||||
if ((isliving(user) || isovermind(user) || isaicamera(user)) && (user.client.prefs.screentip_pref != SCREENTIP_PREFERENCE_NO_CONTEXT))
|
||||
var/obj/item/held_item = user.get_active_held_item()
|
||||
|
||||
if (contextual_screentip_returns & CONTEXTUAL_SCREENTIP_SET)
|
||||
// LMB and RMB on one line...
|
||||
var/lmb_text = ""
|
||||
if((SCREENTIP_CONTEXT_LMB in context) && (length(context[SCREENTIP_CONTEXT_LMB]) > 0))
|
||||
lmb_text = build_context(context, SCREENTIP_CONTEXT_LMB, allow_images)
|
||||
var/rmb_text = ""
|
||||
if((SCREENTIP_CONTEXT_RMB in context) && (length(context[SCREENTIP_CONTEXT_RMB]) > 0))
|
||||
rmb_text = build_context(context, SCREENTIP_CONTEXT_RMB, allow_images)
|
||||
if (flags_1 & HAS_CONTEXTUAL_SCREENTIPS_1 || held_item?.item_flags & ITEM_HAS_CONTEXTUAL_SCREENTIPS)
|
||||
var/list/context = list()
|
||||
|
||||
if (lmb_text)
|
||||
lmb_rmb_line = lmb_text
|
||||
if (rmb_text)
|
||||
lmb_rmb_line += " | [allow_images ? " " : ""][rmb_text]"
|
||||
else if (rmb_text)
|
||||
lmb_rmb_line = rmb_text
|
||||
var/contextual_screentip_returns = \
|
||||
SEND_SIGNAL(src, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, context, held_item, user) \
|
||||
| (held_item && SEND_SIGNAL(held_item, COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET, context, src, user))
|
||||
|
||||
// Ctrl-LMB, Ctrl-RMB on one line...
|
||||
if (lmb_rmb_line != "")
|
||||
lmb_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_CTRL_LMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_LMB]) > 0))
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_LMB, allow_images)
|
||||
if (contextual_screentip_returns & CONTEXTUAL_SCREENTIP_SET)
|
||||
var/screentip_images = user.client.prefs.screentip_images
|
||||
// LMB and RMB on one line...
|
||||
var/lmb_text = build_context(context, SCREENTIP_CONTEXT_LMB, screentip_images)
|
||||
var/rmb_text = build_context(context, SCREENTIP_CONTEXT_RMB, screentip_images)
|
||||
|
||||
if((SCREENTIP_CONTEXT_CTRL_RMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_RMB]) > 0))
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += " | [allow_images ? " " : ""]"
|
||||
ctrl_lmb_ctrl_rmb_line += "[SCREENTIP_CONTEXT_CTRL_RMB]: [context[SCREENTIP_CONTEXT_CTRL_RMB]]"
|
||||
ctrl_lmb_ctrl_rmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_RMB, allow_images)
|
||||
if (lmb_text != "")
|
||||
lmb_rmb_line = lmb_text
|
||||
if (rmb_text != "")
|
||||
lmb_rmb_line += " | [rmb_text]"
|
||||
else if (rmb_text != "")
|
||||
lmb_rmb_line = rmb_text
|
||||
|
||||
// Alt-LMB, Alt-RMB on one line...
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_ALT_LMB in context) && (length(context[SCREENTIP_CONTEXT_ALT_LMB]) > 0))
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_LMB, allow_images)
|
||||
if((SCREENTIP_CONTEXT_ALT_RMB in context) && (length(context[SCREENTIP_CONTEXT_ALT_RMB]) > 0))
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += " | [allow_images ? " " : ""]"
|
||||
alt_lmb_alt_rmb_line = build_context(context, SCREENTIP_CONTEXT_ALT_RMB, allow_images)
|
||||
// Ctrl-LMB, Ctrl-RMB on one line...
|
||||
if (lmb_rmb_line != "")
|
||||
lmb_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if (SCREENTIP_CONTEXT_CTRL_LMB in context)
|
||||
ctrl_lmb_ctrl_rmb_line += build_context(context, SCREENTIP_CONTEXT_CTRL_LMB, screentip_images)
|
||||
|
||||
// Shift-LMB, Ctrl-Shift-LMB on one line...
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if((SCREENTIP_CONTEXT_SHIFT_LMB in context) && (length(context[SCREENTIP_CONTEXT_SHIFT_LMB]) > 0))
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_SHIFT_LMB, allow_images)
|
||||
if (SCREENTIP_CONTEXT_CTRL_RMB in context)
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += " | "
|
||||
ctrl_lmb_ctrl_rmb_line += build_context(context, SCREENTIP_CONTEXT_CTRL_RMB, screentip_images)
|
||||
|
||||
if((SCREENTIP_CONTEXT_CTRL_SHIFT_LMB in context) && (length(context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]) > 0))
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
shift_lmb_ctrl_shift_lmb_line += " | [allow_images ? " " : ""]"
|
||||
shift_lmb_ctrl_shift_lmb_line += "[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]: [context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB]]"
|
||||
shift_lmb_ctrl_shift_lmb_line = build_context(context, SCREENTIP_CONTEXT_CTRL_SHIFT_LMB, allow_images)
|
||||
// Alt-LMB, Alt-RMB on one line...
|
||||
if (ctrl_lmb_ctrl_rmb_line != "")
|
||||
ctrl_lmb_ctrl_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if (SCREENTIP_CONTEXT_ALT_LMB in context)
|
||||
alt_lmb_alt_rmb_line += build_context(context, SCREENTIP_CONTEXT_ALT_LMB, screentip_images)
|
||||
if (SCREENTIP_CONTEXT_ALT_RMB in context)
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += " | "
|
||||
alt_lmb_alt_rmb_line += build_context(context, SCREENTIP_CONTEXT_ALT_RMB, screentip_images)
|
||||
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
extra_lines++
|
||||
// Shift-LMB, Ctrl-Shift-LMB on one line...
|
||||
if (alt_lmb_alt_rmb_line != "")
|
||||
alt_lmb_alt_rmb_line += "<br>"
|
||||
extra_lines++
|
||||
if (SCREENTIP_CONTEXT_SHIFT_LMB in context)
|
||||
shift_lmb_ctrl_shift_lmb_line += build_context(context, SCREENTIP_CONTEXT_SHIFT_LMB, screentip_images)
|
||||
if (SCREENTIP_CONTEXT_CTRL_SHIFT_LMB in context)
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
shift_lmb_ctrl_shift_lmb_line += " | "
|
||||
shift_lmb_ctrl_shift_lmb_line += build_context(context, SCREENTIP_CONTEXT_CTRL_SHIFT_LMB, screentip_images)
|
||||
|
||||
if(extra_lines)
|
||||
extra_context = "<br><span style='font-size: 7px'>[lmb_rmb_line][ctrl_lmb_ctrl_rmb_line][alt_lmb_alt_rmb_line][shift_lmb_ctrl_shift_lmb_line]</span>"
|
||||
//first extra line pushes atom name line up 10px, subsequent lines push it up 9px, this offsets that and keeps the first line in the same place
|
||||
active_hud.screentip_text.maptext_y = -10 + (extra_lines - 1) * -9
|
||||
if (shift_lmb_ctrl_shift_lmb_line != "")
|
||||
extra_lines++
|
||||
|
||||
if (screentips_enabled == SCREENTIP_PREFERENCE_CONTEXT_ONLY && extra_context == "")
|
||||
active_hud.screentip_text.maptext = ""
|
||||
else
|
||||
//We inline a MAPTEXT() here, because there's no good way to statically add to a string like this
|
||||
active_hud.screentip_text.maptext = "<span class='maptext' style='text-align: center; font-size: 32px; color: [user.client.prefs.screentip_color]'>[name][extra_context]</span>"
|
||||
if(extra_lines)
|
||||
extra_context = "<br><span class='subcontext'>[lmb_rmb_line][ctrl_lmb_ctrl_rmb_line][alt_lmb_alt_rmb_line][shift_lmb_ctrl_shift_lmb_line]</span>"
|
||||
//first extra line pushes atom name line up 10px, subsequent lines push it up 9px, this offsets that and keeps the first line in the same place
|
||||
active_hud.screentip_text.maptext_y = -1 + (extra_lines - 1) * -9
|
||||
|
||||
if (screentips_enabled == SCREENTIP_PREFERENCE_CONTEXT_ONLY && extra_context == "")
|
||||
active_hud.screentip_text.maptext = ""
|
||||
else
|
||||
//We inline a MAPTEXT() here, because there's no good way to statically add to a string like this
|
||||
active_hud.screentip_text.maptext = "<span class='context' style='text-align: center; color: [user.client.prefs.screentip_color]'>[name][extra_context]</span>"
|
||||
|
||||
@@ -64,7 +64,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/outline_color = COLOR_THEME_MIDNIGHT
|
||||
var/screentip_pref = SCREENTIP_PREFERENCE_ENABLED
|
||||
var/screentip_color = "#ffd391"
|
||||
var/screentip_allow_images = FALSE
|
||||
var/screentip_images = TRUE
|
||||
var/buttons_locked = FALSE
|
||||
var/hotkeys = FALSE
|
||||
|
||||
@@ -832,7 +832,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
dat += "<b>Screentip Color:</b> <span style='border:1px solid #161616; background-color: [screentip_color];'> </span> <a href='?_src_=prefs;preference=screentip_color'>Change</a><BR>"
|
||||
dat += "<font style='border-bottom:2px dotted white; cursor:help;'\
|
||||
title=\"This is an accessibility preference, if disabled, fallbacks to only text which colorblind people can understand better\">\
|
||||
<b>Screentip context with images:</b></font> <a href='?_src_=prefs;preference=screentip_allow_images'>[screentip_allow_images ? "Allowed" : "Disallowed"]</a><br>"
|
||||
<b>Screentip context with images:</b></font> <a href='?_src_=prefs;preference=screentip_images'>[screentip_images ? "Allowed" : "Disallowed"]</a><br>"
|
||||
dat += "<b>tgui Monitors:</b> <a href='?_src_=prefs;preference=tgui_lock'>[(tgui_lock) ? "Primary" : "All"]</a><br>"
|
||||
dat += "<b>tgui Style:</b> <a href='?_src_=prefs;preference=tgui_fancy'>[(tgui_fancy) ? "Fancy" : "No Frills"]</a><br>"
|
||||
dat += "<b>Show Runechat Chat Bubbles:</b> <a href='?_src_=prefs;preference=chat_on_map'>[chat_on_map ? "Enabled" : "Disabled"]</a><br>"
|
||||
@@ -2924,8 +2924,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/pickedScreentipColor = input(user, "Choose your screentip color.", "General Preference", screentip_color) as color|null
|
||||
if(pickedScreentipColor)
|
||||
screentip_color = pickedScreentipColor
|
||||
if("screentip_allow_images")
|
||||
screentip_allow_images = !screentip_allow_images
|
||||
if("screentip_images")
|
||||
screentip_images = !screentip_images
|
||||
if("tgui_lock")
|
||||
tgui_lock = !tgui_lock
|
||||
if("winflash")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// You do not need to raise this if you are adding new values that have sane defaults.
|
||||
// Only raise this value when changing the meaning/format/name/layout of an existing value
|
||||
// where you would want the updater procs below to run
|
||||
#define SAVEFILE_VERSION_MAX 57
|
||||
#define SAVEFILE_VERSION_MAX 58
|
||||
|
||||
/*
|
||||
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
|
||||
@@ -382,6 +382,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
else
|
||||
S["all_quirks"] = list("Dullahan")
|
||||
|
||||
// So, we're already on 57 even though we were meant to be on like, 56? i'm gonna try to correct this,
|
||||
// And i'm so sorry for this.
|
||||
if(current_version < 58)
|
||||
S["screentip_images"] = TRUE // This was meant to default active, i'm so sorry. Turn it off if you must.
|
||||
|
||||
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
||||
if(!ckey)
|
||||
return
|
||||
@@ -423,7 +428,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
S["outline_enabled"] >> outline_enabled
|
||||
S["screentip_pref"] >> screentip_pref
|
||||
S["screentip_color"] >> screentip_color
|
||||
S["screentip_allow_images"] >> screentip_allow_images
|
||||
S["screentip_images"] >> screentip_images
|
||||
S["hotkeys"] >> hotkeys
|
||||
S["chat_on_map"] >> chat_on_map
|
||||
S["max_chat_length"] >> max_chat_length
|
||||
@@ -614,7 +619,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
WRITE_FILE(S["outline_color"], outline_color)
|
||||
WRITE_FILE(S["screentip_pref"], screentip_pref)
|
||||
WRITE_FILE(S["screentip_color"], screentip_color)
|
||||
WRITE_FILE(S["screentip_allow_images"], screentip_allow_images)
|
||||
WRITE_FILE(S["screentip_images"], screentip_images)
|
||||
WRITE_FILE(S["hotkeys"], hotkeys)
|
||||
WRITE_FILE(S["chat_on_map"], chat_on_map)
|
||||
WRITE_FILE(S["max_chat_length"], max_chat_length)
|
||||
|
||||
Reference in New Issue
Block a user