Commit 5236394b authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Relocate iconbar settings out of the mouse setup

This plugin is now only concerned with aspects of the mouse driver and speed.
Window reduced in size to small enough to not need an optional scroll bar too.

Version 0.16. Tagged as 'MousSetup-0_16'
parent a6288111
...@@ -9,4 +9,3 @@ Mystery:Unrecognised ...@@ -9,4 +9,3 @@ Mystery:Unrecognised
NoneAvail:No mouse drivers are available NoneAvail:No mouse drivers are available
NewType:You are about to change the mouse type to '%s'. If you do not have this sort of mouse connected the pointer will stop working. Do you want to continue with the reconfiguration? NewType:You are about to change the mouse type to '%s'. If you do not have this sort of mouse connected the pointer will stop working. Do you want to continue with the reconfiguration?
Err_NoDefCMOS:Cannot find default CMOS file Err_NoDefCMOS:Cannot find default CMOS file
Err_BadClass:Resource file is corrupt
No preview for this file type
/* (0.15) /* (0.16)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.15 #define Module_MajorVersion_CMHG 0.16
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 17 Jul 2013 #define Module_Date_CMHG 03 Aug 2013
#define Module_MajorVersion "0.15" #define Module_MajorVersion "0.16"
#define Module_Version 15 #define Module_Version 16
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "17 Jul 2013" #define Module_Date "03 Aug 2013"
#define Module_ApplicationDate "17-Jul-13" #define Module_ApplicationDate "03-Aug-13"
#define Module_ComponentName "MousSetup" #define Module_ComponentName "MousSetup"
#define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Configure2/PlugIns/MousSetup" #define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Configure2/PlugIns/MousSetup"
#define Module_FullVersion "0.15" #define Module_FullVersion "0.16"
#define Module_HelpVersion "0.15 (17 Jul 2013)" #define Module_HelpVersion "0.16 (03 Aug 2013)"
#define Module_LibraryVersionInfo "0:15" #define Module_LibraryVersionInfo "0:16"
...@@ -28,18 +28,13 @@ Date Who Change ...@@ -28,18 +28,13 @@ Date Who Change
/* CLib */ /* CLib */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "swis.h"
/* Toolbox */ /* Toolbox */
#include "event.h" #include "event.h"
#include "toolbox.h" #include "toolbox.h"
#include "window.h"
/* Common */ /* Common */
#include "error.h" #include "error.h"
#include "misc.h" #include "misc.h"
#include "message.h"
/* Local headers */ /* Local headers */
#include "Settings.h"
#include "Main.h" /* includes prototypes for this file */ #include "Main.h" /* includes prototypes for this file */
#include "ToolboxE.h" #include "ToolboxE.h"
#include "WimpE.h" #include "WimpE.h"
...@@ -68,11 +63,6 @@ In: Command line option: ...@@ -68,11 +63,6 @@ In: Command line option:
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int screeny;
ObjectTemplateHeader *objtemplate;
WindowTemplate *wintemplate;
WimpWindow *windef;
error_initialise (); error_initialise ();
throw (toolbox_initialise (0, WimpVersion, wimpm_messages, toolboxe_events, throw (toolbox_initialise (0, WimpVersion, wimpm_messages, toolboxe_events,
"<MousSetup$Dir>", &messages, &id_block, NULL, NULL, NULL)); "<MousSetup$Dir>", &messages, &id_block, NULL, NULL, NULL));
...@@ -85,32 +75,6 @@ int main (int argc, char *argv[]) ...@@ -85,32 +75,6 @@ int main (int argc, char *argv[])
wimpe_register (); wimpe_register ();
toolboxe_register (); toolboxe_register ();
/* Read the window object in by hand */
throw (toolbox_template_lookup (0, "Mouse", (void **)&objtemplate));
if (objtemplate->object_class != Window_ObjectClass) {
_kernel_oserror e = { 0, "" };
strcpy (e.errmess, message_lookup_direct (messages,"Err_BadClass"));
_swi (OS_GenerateError, _IN(0), &e);
}
wintemplate = objtemplate->body;
windef = &wintemplate->window;
screeny = _swi (OS_ReadModeVariable, _INR(0,1) | _RETURN(2), -1, 12) <<
_swi (OS_ReadModeVariable, _INR(0,1) | _RETURN(2), -1, 5);
/* Calculate the window height compared with the screen and
* turn the vertical scrollbar on if it doesn't fit
*/
if ((windef->visible_area.ymax - windef->visible_area.ymin) >= screeny) {
windef->flags |= WimpWindow_VScroll;
}
else {
windef->flags &= ~WimpWindow_VScroll;
}
throw (toolbox_create_object (Toolbox_CreateObject_InCore, objtemplate, &mainwindow_id));
misc_openwindow (mainwindow_id, TRUE);
settings_read (cmos_read);
/* Go */ /* Go */
error_recover_point(); error_recover_point();
while (!quit) { while (!quit) {
......
...@@ -52,28 +52,17 @@ const cmos cmos_details [18] = { { 0xC2, 0, 8 }, /* MouseMultiplier */ ...@@ -52,28 +52,17 @@ const cmos cmos_details [18] = { { 0xC2, 0, 8 }, /* MouseMultiplier */
{ 0x1D, 0, 8 }, /* MouseType */ { 0x1D, 0, 8 }, /* MouseType */
{ 0xDD, 0, 4 }, /* (WimpDragDelay EOR 5) */ { 0xDD, 0, 4 }, /* (WimpDragDelay EOR 5) */
{ 0xDD, 4, 4 }, /* (WimpAutoScrollDelay EOR 5) */
{ 0xDE, 0, 1 }, /* WimpDragDelayUnit */ { 0xDE, 0, 1 }, /* WimpDragDelayUnit */
{ 0xDE, 1, 1 }, /* WimpAutoScrollDelayUnit */
{ 0xDE, 2, 5 }, /* (WimpDragMove/4 EOR 8) */ { 0xDE, 2, 5 }, /* (WimpDragMove/4 EOR 8) */
{ 0xDF, 0, 4 }, /* (WimpDoubleClickDelay EOR 10) */ { 0xDF, 0, 4 }, /* (WimpDoubleClickDelay EOR 10) */
{ 0xDF, 4, 4 }, /* (WimpAutoFrontDelay EOR 5) */
{ 0x16, 0, 1 }, /* WimpDoubleClickDelayUnit */ { 0x16, 0, 1 }, /* WimpDoubleClickDelayUnit */
{ 0x16, 1, 1 }, /* WimpAutoFrontDelayUnit */
{ 0x16, 2, 5 }, /* (WimpDoubleClickMove/4 EOR 8) */
{ 0x16, 7, 1 }, /* WimpAutoFrontIconBar */
{ 0xC5, 7, 1 }, /* WimpFlagsSubMenus */ { 0x16, 2, 5 }, /* (WimpDoubleClickMove/4 EOR 8) */
{ 0x17, 0, 4 }, /* (WimpAutoMenuDelay EOR 10) */
{ 0x17, 4, 1 }, /* WimpAutoMenuDelayUnit */
{ 0x1B, 0, 4 }, /* (WimpMenuDragDelay EOR 10) */
{ 0x1B, 4, 1 } }; /* WimpMenuDragDelayUnit */
{ 0xDD, 4, 4 }, /* (WimpAutoScrollDelay EOR 5) */
{ 0xDE, 1, 1 } }; /* WimpAutoScrollDelayUnit */
/****** settings_read() ***************************************************\ /****** settings_read() ***************************************************\
...@@ -111,21 +100,6 @@ void settings_read (int(*get)(cmos item, void *messages)) ...@@ -111,21 +100,6 @@ void settings_read (int(*get)(cmos item, void *messages))
value = get (WimpAutoScrollDelay, &messages) ^ 5; value = get (WimpAutoScrollDelay, &messages) ^ 5;
if (1 == get (WimpAutoScrollDelayUnit, &messages)) value *= 10; if (1 == get (WimpAutoScrollDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_autoscr, value)); throw (numberrange_set_value (0, mainwindow_id, mainwindow_autoscr, value));
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_openmenu, value = get (WimpFlagsSubMenus, &messages)));
misc_shadecomponents (!value, mainwindow_id, mainwindow_openmenu_shademin, mainwindow_openmenu_shademax);
value = get (WimpAutoMenuDelay, &messages) ^ 10;
if (1 == get (WimpAutoMenuDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_openmenudelay, value));
value = get (WimpMenuDragDelay, &messages) ^ 10;
if (1 == get (WimpMenuDragDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_closemenudelay, value));
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_autofront, value = !get (WimpAutoFrontIconBar, &messages)));
misc_shadecomponents (!value, mainwindow_id, mainwindow_autofront_shademin, mainwindow_autofront_shademax);
value = get (WimpAutoFrontDelay, &messages) ^ 5;
if (1 == get (WimpAutoFrontDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_autofrontdelay, value));
// //
} }
...@@ -157,44 +131,22 @@ BOOL settings_write (void) ...@@ -157,44 +131,22 @@ BOOL settings_write (void)
throw (numberrange_get_value (0, mainwindow_id, mainwindow_dragdelay, &value)); throw (numberrange_get_value (0, mainwindow_id, mainwindow_dragdelay, &value));
sprintf (string, "Configure WimpDragDelay %i", value); sprintf (string, "Configure WimpDragDelay %i", value);
_swi (OS_CLI, _IN(0), string); _swi (OS_CLI, _IN(0), string);
//
throw (numberrange_get_value (0, mainwindow_id, mainwindow_dragdist, &value)); throw (numberrange_get_value (0, mainwindow_id, mainwindow_dragdist, &value));
sprintf (string, "Configure WimpDragMove %i", value); sprintf (string, "Configure WimpDragMove %i", value);
_swi (OS_CLI, _IN(0), string); _swi (OS_CLI, _IN(0), string);
//
throw (numberrange_get_value (0, mainwindow_id, mainwindow_dclickdelay, &value)); throw (numberrange_get_value (0, mainwindow_id, mainwindow_dclickdelay, &value));
sprintf (string, "Configure WimpDoubleClickDelay %i", value); sprintf (string, "Configure WimpDoubleClickDelay %i", value);
_swi (OS_CLI, _IN(0), string); _swi (OS_CLI, _IN(0), string);
//
throw (numberrange_get_value (0, mainwindow_id, mainwindow_dclickdist, &value)); throw (numberrange_get_value (0, mainwindow_id, mainwindow_dclickdist, &value));
sprintf (string, "Configure WimpDoubleClickMove %i", value); sprintf (string, "Configure WimpDoubleClickMove %i", value);
_swi (OS_CLI, _IN(0), string); _swi (OS_CLI, _IN(0), string);
//
throw (numberrange_get_value (0, mainwindow_id, mainwindow_autoscr, &value)); throw (numberrange_get_value (0, mainwindow_id, mainwindow_autoscr, &value));
sprintf (string, "Configure WimpAutoScrollDelay %i", value); sprintf (string, "Configure WimpAutoScrollDelay %i", value);
_swi (OS_CLI, _IN(0), string); _swi (OS_CLI, _IN(0), string);
// //
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_openmenu, &value));
if (value) {
cmos_write (WimpFlagsSubMenus, TRUE);
misc_applywimpflags ();
throw (numberrange_get_value (0, mainwindow_id, mainwindow_openmenudelay, &value));
sprintf (string, "Configure WimpAutoMenuDelay %i", value);
_swi (OS_CLI, _IN(0), string);
throw (numberrange_get_value (0, mainwindow_id, mainwindow_closemenudelay, &value));
sprintf (string, "Configure WimpMenuDragDelay %i", value);
_swi (OS_CLI, _IN(0), string);
}
else {
cmos_write (WimpFlagsSubMenus, FALSE);
misc_applywimpflags ();
}
//
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_autofront, &value));
if (value) {
_swi (OS_CLI, _IN(0), "Configure WimpAutoFrontIconBar On");
throw (numberrange_get_value (0, mainwindow_id, mainwindow_autofrontdelay, &value));
sprintf (string, "Configure WimpAutoFrontDelay %i", value);
_swi (OS_CLI, _IN(0), string);
}
else {
_swi (OS_CLI, _IN(0), "Configure WimpAutoFrontIconBar Off");
}
return TRUE; return TRUE;
} }
...@@ -41,19 +41,19 @@ Date Who Change ...@@ -41,19 +41,19 @@ Date Who Change
#include "ToolboxE.h" /* includes prototypes for this file */ #include "ToolboxE.h" /* includes prototypes for this file */
static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle); static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_optionbuttonstatechanged (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_stringsetabouttobeshown (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle); static int toolboxe_stringsetabouttobeshown (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_objectautocreated (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
int toolboxe_events [5] = { ActionButton_Selected, int toolboxe_events [5] = { ActionButton_Selected,
OptionButton_StateChanged,
StringSet_AboutToBeShown, StringSet_AboutToBeShown,
Toolbox_ObjectAutoCreated,
0 }; 0 };
void toolboxe_register (void) void toolboxe_register (void)
{ {
throw (event_register_toolbox_handler (-1, ActionButton_Selected, toolboxe_actionbuttonselected, NULL)); throw (event_register_toolbox_handler (-1, ActionButton_Selected, toolboxe_actionbuttonselected, NULL));
throw (event_register_toolbox_handler (-1, OptionButton_StateChanged, toolboxe_optionbuttonstatechanged, NULL));
throw (event_register_toolbox_handler (-1, StringSet_AboutToBeShown, toolboxe_stringsetabouttobeshown, NULL)); throw (event_register_toolbox_handler (-1, StringSet_AboutToBeShown, toolboxe_stringsetabouttobeshown, NULL));
throw (event_register_toolbox_handler (-1, Toolbox_ObjectAutoCreated, toolboxe_objectautocreated, NULL));
} }
/****** toolboxe_actionbuttonselected() ***********************************\ /****** toolboxe_actionbuttonselected() ***********************************\
...@@ -79,23 +79,6 @@ static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, I ...@@ -79,23 +79,6 @@ static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, I
return 1; return 1;
} }
/****** toolboxe_optionbuttonstatechanged() *******************************\
Purpose: Handles OptionButton_StateChanged event
\**************************************************************************/
static int toolboxe_optionbuttonstatechanged (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
if (id_block->self_component == mainwindow_openmenu)
misc_shadecomponents (!((OptionButtonStateChangedEvent *) event)->new_state,
mainwindow_id, mainwindow_openmenu_shademin, mainwindow_openmenu_shademax);
if (id_block->self_component == mainwindow_autofront)
misc_shadecomponents (!((OptionButtonStateChangedEvent *) event)->new_state,
mainwindow_id, mainwindow_autofront_shademin, mainwindow_autofront_shademax);
return 1;
}
/****** toolboxe_stringsetabouttobeshown() ********************************\ /****** toolboxe_stringsetabouttobeshown() ********************************\
Purpose: Handles StringSet_AboutToBeShown event Purpose: Handles StringSet_AboutToBeShown event
...@@ -113,3 +96,17 @@ static int toolboxe_stringsetabouttobeshown (int event_code, ToolboxEvent *event ...@@ -113,3 +96,17 @@ static int toolboxe_stringsetabouttobeshown (int event_code, ToolboxEvent *event
} }
return 1; return 1;
} }
/****** toolboxe_objectautocreated() **************************************\
Purpose: Handles Toolbox_ObjectAutoCreated event
\**************************************************************************/
static int toolboxe_objectautocreated (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
mainwindow_id = id_block->self_id;
misc_openwindow (mainwindow_id, TRUE);
settings_read (cmos_read);
return 1;
}
...@@ -41,21 +41,13 @@ Date Who Change ...@@ -41,21 +41,13 @@ Date Who Change
#define MouseMultiplier ((cmos) cmos_details[0]) #define MouseMultiplier ((cmos) cmos_details[0])
#define MouseType ((cmos) cmos_details[1]) #define MouseType ((cmos) cmos_details[1])
#define WimpDragDelay ((cmos) cmos_details[2]) #define WimpDragDelay ((cmos) cmos_details[2])
#define WimpAutoScrollDelay ((cmos) cmos_details[3]) #define WimpDragDelayUnit ((cmos) cmos_details[3])
#define WimpDragDelayUnit ((cmos) cmos_details[4]) #define WimpDragMove ((cmos) cmos_details[4])
#define WimpAutoScrollDelayUnit ((cmos) cmos_details[5]) #define WimpDoubleClickDelay ((cmos) cmos_details[5])
#define WimpDragMove ((cmos) cmos_details[6]) #define WimpDoubleClickDelayUnit ((cmos) cmos_details[6])
#define WimpDoubleClickDelay ((cmos) cmos_details[7]) #define WimpDoubleClickMove ((cmos) cmos_details[7])
#define WimpAutoFrontDelay ((cmos) cmos_details[8]) #define WimpAutoScrollDelay ((cmos) cmos_details[8])
#define WimpDoubleClickDelayUnit ((cmos) cmos_details[9]) #define WimpAutoScrollDelayUnit ((cmos) cmos_details[9])
#define WimpAutoFrontDelayUnit ((cmos) cmos_details[10])
#define WimpDoubleClickMove ((cmos) cmos_details[11])
#define WimpAutoFrontIconBar ((cmos) cmos_details[12])
#define WimpFlagsSubMenus ((cmos) cmos_details[13])
#define WimpAutoMenuDelay ((cmos) cmos_details[14])
#define WimpAutoMenuDelayUnit ((cmos) cmos_details[15])
#define WimpMenuDragDelay ((cmos) cmos_details[16])
#define WimpMenuDragDelayUnit ((cmos) cmos_details[17])
#define mainwindow_mousespeed ((ComponentId) 0x002) #define mainwindow_mousespeed ((ComponentId) 0x002)
#define mainwindow_mousetype ((ComponentId) 0x005) #define mainwindow_mousetype ((ComponentId) 0x005)
...@@ -64,21 +56,10 @@ Date Who Change ...@@ -64,21 +56,10 @@ Date Who Change
#define mainwindow_dclickdelay ((ComponentId) 0x00d) #define mainwindow_dclickdelay ((ComponentId) 0x00d)
#define mainwindow_dclickdist ((ComponentId) 0x010) #define mainwindow_dclickdist ((ComponentId) 0x010)
#define mainwindow_autoscr ((ComponentId) 0x01e) #define mainwindow_autoscr ((ComponentId) 0x01e)
#define mainwindow_openmenu ((ComponentId) 0x012)
#define mainwindow_openmenudelay ((ComponentId) 0x014)
#define mainwindow_closemenudelay ((ComponentId) 0x017)
#define mainwindow_autofront ((ComponentId) 0x019)
#define mainwindow_autofrontdelay ((ComponentId) 0x01b)
#define mainwindow_set ((ComponentId) 0x100) #define mainwindow_set ((ComponentId) 0x100)
#define mainwindow_cancel ((ComponentId) 0x101) #define mainwindow_cancel ((ComponentId) 0x101)
#define mainwindow_default ((ComponentId) 0x102) #define mainwindow_default ((ComponentId) 0x102)
#define mainwindow_openmenu_shademin ((ComponentId) 0x013)
#define mainwindow_openmenu_shademax ((ComponentId) 0x018)
#define mainwindow_autofront_shademin ((ComponentId) 0x01a)
#define mainwindow_autofront_shademax ((ComponentId) 0x01c)
/* Global variables */ /* Global variables */
extern const cmos cmos_details []; extern const cmos cmos_details [];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment