Skip to content

Commit

Permalink
Changes to tool tip start and visible time now take effect immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Sep 30, 2012
1 parent 04f9185 commit cbdce1b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 18 deletions.
34 changes: 18 additions & 16 deletions doc.h
Expand Up @@ -362,22 +362,24 @@ enum {
DBG_ALL, // a whole lot of useless stuff
};

#define OPT_CUSTOM_COLOUR 0x000001 // colour number (add 1 to colour to save, subtract 1 to load)
#define OPT_RGB_COLOUR 0x000002 // colour is RGB colour
#define OPT_DOUBLE 0x000004 // option is a double
#define OPT_UPDATE_VIEWS 0x000100 // if changed, update all views
#define OPT_UPDATE_INPUT_FONT 0x000200 // if changed, update input font
#define OPT_UPDATE_OUTPUT_FONT 0x000400 // if changed, update output font
#define OPT_FIX_OUTPUT_BUFFER 0x000800 // if changed, rework output buffer size
#define OPT_FIX_WRAP_COLUMN 0x001000 // if changed, wrap column has changed
#define OPT_FIX_SPEEDWALK_DELAY 0x002000 // if changed, speedwalk delay has changed
#define OPT_USE_MXP 0x004000 // if changed, use_mxp has changed
#define OPT_PLUGIN_CANNOT_READ 0x100000 // plugin may not read its value
#define OPT_PLUGIN_CANNOT_WRITE 0x200000 // plugin may not write its value
#define OPT_PLUGIN_CANNOT_RW 0x300000 // plugin may not read or write its value
#define OPT_CANNOT_WRITE 0x400000 // cannot be changed by any script
#define OPT_SERVER_CAN_WRITE 0x800000 // CAN be changed by <recommend_option> tag
#define OPT_FIX_INPUT_WRAP 0x1000000 // Added for input wrapping.
#define OPT_CUSTOM_COLOUR 0x000001 // colour number (add 1 to colour to save, subtract 1 to load)
#define OPT_RGB_COLOUR 0x000002 // colour is RGB colour
#define OPT_DOUBLE 0x000004 // option is a double
#define OPT_UPDATE_VIEWS 0x000100 // if changed, update all views
#define OPT_UPDATE_INPUT_FONT 0x000200 // if changed, update input font
#define OPT_UPDATE_OUTPUT_FONT 0x000400 // if changed, update output font
#define OPT_FIX_OUTPUT_BUFFER 0x000800 // if changed, rework output buffer size
#define OPT_FIX_WRAP_COLUMN 0x001000 // if changed, wrap column has changed
#define OPT_FIX_SPEEDWALK_DELAY 0x002000 // if changed, speedwalk delay has changed
#define OPT_USE_MXP 0x004000 // if changed, use_mxp has changed
#define OPT_PLUGIN_CANNOT_READ 0x100000 // plugin may not read its value
#define OPT_PLUGIN_CANNOT_WRITE 0x200000 // plugin may not write its value
#define OPT_PLUGIN_CANNOT_RW 0x300000 // plugin may not read or write its value
#define OPT_CANNOT_WRITE 0x400000 // cannot be changed by any script
#define OPT_SERVER_CAN_WRITE 0x800000 // CAN be changed by <recommend_option> tag
#define OPT_FIX_INPUT_WRAP 0x1000000 // Added for input wrapping.
#define OPT_FIX_TOOLTIP_VISIBLE 0x2000000 // Added for tooltip delay changing.
#define OPT_FIX_TOOLTIP_START 0x4000000 // Added for tooltip delay changing.

// for debug.options and MXP <option> tag
typedef struct
Expand Down
35 changes: 33 additions & 2 deletions scriptingoptions.cpp
Expand Up @@ -4,6 +4,7 @@
#include "MUSHclient.h"

#include "doc.h"
#include "MUSHview.h"
#include "scripting\errors.h"

#define NL "\r\n"
Expand Down Expand Up @@ -185,8 +186,8 @@ tConfigurationNumericOption OptionsTable [] = {
{"timestamp_input_back_colour", RGB (0, 0, 0), O(m_OutputLinePreambleInputBackColour), 0, 0xFFFFFF, OPT_RGB_COLOUR | OPT_UPDATE_VIEWS},
{"timestamp_notes_back_colour", RGB (0, 0, 0), O(m_OutputLinePreambleNotesBackColour), 0, 0xFFFFFF, OPT_RGB_COLOUR | OPT_UPDATE_VIEWS},
{"timestamp_output_back_colour", RGB (0, 0, 0), O(m_OutputLinePreambleOutputBackColour),0, 0xFFFFFF, OPT_RGB_COLOUR | OPT_UPDATE_VIEWS},
{"tool_tip_visible_time", 5000, O(m_iToolTipVisibleTime), 0, 120000},
{"tool_tip_start_time", 400, O(m_iToolTipStartTime), 0, 120000},
{"tool_tip_visible_time", 5000, O(m_iToolTipVisibleTime), 0, 120000, OPT_FIX_TOOLTIP_VISIBLE},
{"tool_tip_start_time", 400, O(m_iToolTipStartTime), 0, 120000, OPT_FIX_TOOLTIP_START},
{"translate_backslash_sequences", false, O(m_bTranslateBackslashSequences)},
{"translate_german", false, O(m_bTranslateGerman)},
{"treeview_triggers", true, O(m_bTreeviewTriggers)},
Expand Down Expand Up @@ -551,6 +552,36 @@ long iResult = SetBaseOptionItem (iItem,
if (OptionsTable [iItem].iFlags & OPT_FIX_SPEEDWALK_DELAY)
SetSpeedWalkDelay ((short) Value);

POSITION pos;

if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_VISIBLE)
{
for(pos=GetFirstViewPosition();pos!=NULL;)
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
{
CMUSHView* pmyView = (CMUSHView*)pView;
if (pmyView->m_ToolTip.m_hWnd)
pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, Value - 1); // zero will be default (-1)
} // end if
} // end for
} // end of OPT_FIX_TOOLTIP_VISIBLE

if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_START)
{
for(pos=GetFirstViewPosition();pos!=NULL;)
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
{
CMUSHView* pmyView = (CMUSHView*)pView;
if (pmyView->m_ToolTip.m_hWnd)
pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, Value - 1); // zero will be default (-1)
} // end if
} // end for
} // end of OPT_FIX_TOOLTIP_VISIBLE

if (OptionsTable [iItem].iFlags & OPT_USE_MXP)
{
if (m_iUseMXP == eNoMXP && m_bMXP)
Expand Down

0 comments on commit cbdce1b

Please sign in to comment.