Commit 365c46d9 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Minor MousSetup improvements

* Makefile recreated from fragments
* Window size is now compared with screensize on startup and the V scroll bar turned on/off as needed
* Magic numbers changed for header defines
* Version number now inserted at build time rather than being 10 years out of date

Version 0.14. Tagged as 'MousSetup-0_14'
parent 2c2c0693
......@@ -14,119 +14,34 @@
#
# Makefile for MousSetup
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 17-Oct-97 BJGA Derived from InetSetup makefiles
# 28-Oct-97 BJGA No longer uses OSLib
# 10-Nov-97 BJGA Modified to use shared Common directory
# 09-Dec-97 BJGA Split Main.c, and modified to use shared Common library
# 17-Dec-97 BJGA Tidied up
# 11-May-98 BJGA Replaced Common directory with ConfigLib
#
#
# Program specific options:
#
COMPONENT = MousSetup
APP = !${COMPONENT}
RDIR = Resources
LDIR = ${RDIR}.${LOCALE}
TARGET = !RunImage
INSTAPP = ${INSTDIR}.${APP}
INSTTYPE = app
MSGVERSION = ${AWK} -f Build:AwkVers
LDIR = Resources.${LOCALE}
APP_OBJS = Main.o MouseType.o Settings.o ToolboxE.o WimpE.o WimpM.o
LIBS = ${CONLIB} ${EVENTLIB} ${TBOXLIB} ${WIMPLIB}
CINCLUDES = -Itbox:,C:,<Lib$Dir>.ConfigLib.
INSTALLAPPFILES = !Boot !Help !Run !RunImage Res \
!Sprites !Sprites11 !Sprites22 CoSprite CoSprite11 CoSprite22
INSTALLAPP_DEPEND = GenMessage
#
# Generic options:
#
MKDIR = do mkdir -p
CC = cc
ATTR = -attr
CP = copy
LD = link
RM = remove
SQUEEZE = squeeze
WIPE = x wipe
include CApp
CFLAGS = -c -depend !Depend -ffa -gflv ${INCLUDES} -throwback
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
C_WARNINGS = -fa
#
# Libraries
# Patch the messages files with the version
#
CLIB = C:o.stubs
ELIB = Tbox:o.eventlib
TLIB = Tbox:o.toolboxlib
WLIB = Tbox:o.wimplib
CONLIB = <Lib$Dir>.ConfigLib.o.ConfigLib
#
# Include files
#
INCLUDES = -ITbox:,C:,<Lib$Dir>.ConfigLib.
FILES=\
${LDIR}.!Help\
${RDIR}.!Boot\
${LDIR}.!Run\
${RDIR}.!RunImage\
${RDIR}.!Sprites\
${RDIR}.!Sprites11\
${RDIR}.!Sprites22\
${RDIR}.CoSprite\
${RDIR}.CoSprite11\
${RDIR}.CoSprite22\
${LDIR}.Messages\
${LDIR}.Res\
OBJS = Main.o MouseType.o Settings.o ToolboxE.o WimpE.o WimpM.o
#
# Rule patterns
#
.c.o:; ${CC} ${CFLAGS} -o $@ $<
#
# Main rules:
#
# Application
#
all: ${FILES}
@echo ${COMPONENT}: All built (Disc)
install: ${FILES}
GenMessage: ${LDIR}.Messages VersionNum
${MSGVERSION} ${LDIR}.Messages > GenMessage
${MKDIR} ${INSTAPP}
|
${CP} ${RDIR}.!Boot ${INSTAPP}.!Boot ${CPFLAGS}
${CP} ${LDIR}.!Help ${INSTAPP}.!Help ${CPFLAGS}
${CP} ${LDIR}.!Run ${INSTAPP}.!Run ${CPFLAGS}
${CP} ${RDIR}.!RunImage ${INSTAPP}.!RunImage ${CPFLAGS}
${CP} ${RDIR}.!Sprites ${INSTAPP}.!Sprites ${CPFLAGS}
${CP} ${RDIR}.!Sprites11 ${INSTAPP}.!Sprites11 ${CPFLAGS}
${CP} ${RDIR}.!Sprites22 ${INSTAPP}.!Sprites22 ${CPFLAGS}
${CP} ${RDIR}.CoSprite ${INSTAPP}.CoSprite ${CPFLAGS}
${CP} ${RDIR}.CoSprite11 ${INSTAPP}.CoSprite11 ${CPFLAGS}
${CP} ${RDIR}.CoSprite22 ${INSTAPP}.CoSprite22 ${CPFLAGS}
${CP} ${LDIR}.Messages ${INSTAPP}.Messages ${CPFLAGS}
${CP} ${LDIR}.Res ${INSTAPP}.Res ${CPFLAGS}
|
${ATTR} -directories +wr -ww ${INSTAPP}
${ATTR} -files +or +ow +wr -ww ${INSTAPP}
|
@echo ${COMPONENT}: All installed (Disc)
clean:
${WIPE} o.* ${WFLAGS}
${RM} ${RDIR}.!RunImage
@echo ${COMPONENT}: cleaned
${CP} GenMessage ${INSTAPP}.Messages ${CPFLAGS}
#
# Static dependencies:
#
${RDIR}.!RunImage: ${OBJS} ${CONLIB} ${ELIB} ${TLIB} ${WLIB} ${CLIB}
${LD} ${LDFLAGS} -o $@ ${OBJS} ${CONLIB} ${ELIB} ${TLIB} ${WLIB} ${CLIB}
${SQUEEZE} $@
clean::
${RM} GenMessage
#---------------------------------------------------------------------------
# Dynamic dependencies:
_TaskName:Mouse Setup
_Purpose:Configuring the mouse
_Author: Acorn Computers Ltd, 1998
_Version:0.10 (19-Dec-02)
_Version:Fill by awk at build time
_ConfigText:Mouse
_ConfigHelp:Click SELECT to open the mouse configuration window.
_ConfigSprite:co_mouse
......@@ -9,3 +9,4 @@ Mystery:Unrecognised
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?
Err_NoDefCMOS:Cannot find default CMOS file
Err_BadClass:Resource file is corrupt
No preview for this file type
/* (0.13)
/* (0.14)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.13
#define Module_MajorVersion_CMHG 0.14
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Oct 2012
#define Module_Date_CMHG 17 Jan 2013
#define Module_MajorVersion "0.13"
#define Module_Version 13
#define Module_MajorVersion "0.14"
#define Module_Version 14
#define Module_MinorVersion ""
#define Module_Date "06 Oct 2012"
#define Module_Date "17 Jan 2013"
#define Module_ApplicationDate "06-Oct-12"
#define Module_ApplicationDate "17-Jan-13"
#define Module_ComponentName "MousSetup"
#define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Configure2/PlugIns/MousSetup"
#define Module_FullVersion "0.13"
#define Module_HelpVersion "0.13 (06 Oct 2012)"
#define Module_LibraryVersionInfo "0:13"
#define Module_FullVersion "0.14"
#define Module_HelpVersion "0.14 (17 Jan 2013)"
#define Module_LibraryVersionInfo "0:14"
......@@ -28,13 +28,18 @@ Date Who Change
/* CLib */
#include <stdlib.h>
#include <string.h>
#include "swis.h"
/* Toolbox */
#include "event.h"
#include "toolbox.h"
#include "window.h"
/* Common */
#include "error.h"
#include "misc.h"
#include "message.h"
/* Local headers */
#include "Settings.h"
#include "Main.h" /* includes prototypes for this file */
#include "ToolboxE.h"
#include "WimpE.h"
......@@ -63,17 +68,50 @@ In: Command line option:
int main (int argc, char *argv[])
{
int screeny;
ObjectTemplateHeader *objtemplate;
WindowTemplate *wintemplate;
WimpWindow *windef;
error_initialise ();
throw (toolbox_initialise (0, WimpVersion, wimpm_messages, toolboxe_events,
"<MousSetup$Dir>", &messages, &id_block, NULL, NULL, NULL));
misc_parsearguments (argc, argv);
throw (event_initialise (&id_block));
throw (event_set_mask (wimpe_mask));
//
/* Register for messages and events */
wimpm_register ();
wimpe_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 */
error_recover_point();
while (!quit) {
throw (event_poll (NULL, &poll_block, NULL));
......
......@@ -29,6 +29,8 @@ Date Who Change
#include <stdio.h>
#include <string.h>
#include "swis.h"
#include "Global/ModHand.h"
#include "Global/RISCOS.h"
/* Toolbox */
#include "wimplib.h"
/* Common */
......@@ -62,7 +64,7 @@ Out: Pointer to most recently-added record
static pointerv_record *get_pointer_list (void)
{
if (pointer_list != NULL) free_pointer_list ();
return pointer_list = (pointerv_record *) _swi (OS_CallAVector, _INR(0,1)|_IN(9)|_RETURN(1), 1, 0, 0x26);
return pointer_list = (pointerv_record *) _swi (OS_CallAVector, _INR(0,1)|_IN(9)|_RETURN(1), 1, 0, PointerV);
}
/****** free_pointer_list() ***********************************************\
......@@ -75,7 +77,7 @@ static void free_pointer_list (void)
{
while (pointer_list != NULL) {
pointerv_record *next = pointer_list->next;
_swi (OS_Module, _IN(0)|_IN(2), 7, (int) pointer_list);
_swi (OS_Module, _IN(0)|_IN(2), ModHandReason_Free, (int) pointer_list);
pointer_list = next;
}
}
......
......@@ -33,6 +33,7 @@ Date Who Change
/* CLib */
#include <string.h>
#include "swis.h"
#include "Global/OsWords.h"
/* Toolbox */
#include "toolbox.h"
#include "window.h"
......@@ -148,10 +149,10 @@ BOOL settings_write (void)
//
throw (slider_get_value (0, mainwindow_id, mainwindow_mousespeed, &value));
cmos_write (MouseMultiplier, value);
step[0] = 0x2u;
step[0] = OWPointerAndMouse_SetMouseFactors;
step[1] = (unsigned char) value;
step[2] = (unsigned char) value;
_swi (OS_Word, _INR(0,1), 21, step);
_swi (OS_Word, _INR(0,1), OsWord_DefinePointerAndMouse, step);
//
throw (numberrange_get_value (0, mainwindow_id, mainwindow_dragdelay, &value));
sprintf (string, "Configure WimpDragDelay %i", value);
......
......@@ -41,12 +41,10 @@ Date Who Change
#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_objectautocreated (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);
int toolboxe_events [5] = { ActionButton_Selected,
Toolbox_ObjectAutoCreated,
OptionButton_StateChanged,
StringSet_AboutToBeShown,
0 };
......@@ -54,7 +52,6 @@ int toolboxe_events [5] = { ActionButton_Selected,
void toolboxe_register (void)
{
throw (event_register_toolbox_handler (-1, ActionButton_Selected, toolboxe_actionbuttonselected, NULL));
throw (event_register_toolbox_handler (-1, Toolbox_ObjectAutoCreated, toolboxe_objectautocreated, NULL));
throw (event_register_toolbox_handler (-1, OptionButton_StateChanged, toolboxe_optionbuttonstatechanged, NULL));
throw (event_register_toolbox_handler (-1, StringSet_AboutToBeShown, toolboxe_stringsetabouttobeshown, NULL));
}
......@@ -82,20 +79,6 @@ static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, I
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;
}
/****** toolboxe_optionbuttonstatechanged() *******************************\
Purpose: Handles OptionButton_StateChanged event
......
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